XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

fix: properly set Harvestable & DeathSquadable fields (#1925)

Closes #1916 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1925 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

3de68e51
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +25 -34
Modified src/models/inventoryModels/inventoryModel.ts +2 -2
@@ -1688,9 +1688,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1688 1688 //Like BossAladV,BossCaptainVor come for you on missions % chance
1689 1689 DeathMarks: { type: [String], default: [] },
1690 1690 //Zanuka
1691 Harvestable: Boolean,
1691 Harvestable: { type: Boolean, default: true },
1692 1692 //Grustag three
1693 DeathSquadable: Boolean,
1693 DeathSquadable: { type: Boolean, default: true },
1694 1694
1695 1695 EndlessXP: { type: [endlessXpProgressSchema], default: undefined },
1696 1696
Modified src/services/missionInventoryUpdateService.ts +22 -32
@@ -143,38 +143,6 @@ export const addMissionInventoryUpdates = async (
143 143 ]);
144 144 }
145 145 }
146
147 // Somewhat heuristically detect G3 capture:
148 // - https://onlyg.it/OpenWF/SpaceNinjaServer/issues/1365
149 // - https://onlyg.it/OpenWF/SpaceNinjaServer/issues/1694
150 // - https://onlyg.it/OpenWF/SpaceNinjaServer/issues/1724
151 if (
152 inventoryUpdates.MissionFailed &&
153 inventoryUpdates.MissionStatus == "GS_FAILURE" &&
154 inventoryUpdates.ObjectiveReached &&
155 !inventoryUpdates.LockedWeaponGroup &&
156 !inventory.LockedWeaponGroup &&
157 !inventoryUpdates.LevelKeyName
158 ) {
159 const loadout = (await Loadout.findById(inventory.LoadOutPresets, "NORMAL"))!;
160 const config = loadout.NORMAL.id(inventory.CurrentLoadOutIds[0].$oid)!;
161 const SuitId = new Types.ObjectId(config.s!.ItemId.$oid);
162
163 inventory.BrandedSuits ??= [];
164 if (!inventory.BrandedSuits.find(x => x.equals(SuitId))) {
165 inventory.BrandedSuits.push(SuitId);
166
167 await createMessage(inventory.accountOwnerId, [
168 {
169 sndr: "/Lotus/Language/Menu/Mailbox_WarframeSender",
170 msg: "/Lotus/Language/G1Quests/BrandedMessage",
171 sub: "/Lotus/Language/G1Quests/BrandedTitle",
172 att: ["/Lotus/Types/Recipes/Components/BrandRemovalBlueprint"],
173 highPriority: true // TOVERIFY: I cannot find any content of this within the last 10 years so I can only assume that highPriority is set (it certainly would make sense), but I just don't know for sure that it is so on live.
174 }
175 ]);
176 }
177 }
178 146 }
179 147 if (inventoryUpdates.RewardInfo) {
180 148 if (inventoryUpdates.RewardInfo.periodicMissionTag) {
@@ -537,6 +505,23 @@ export const addMissionInventoryUpdates = async (
537 505 }
538 506 break;
539 507 }
508 case "BrandedSuits": {
509 inventory.BrandedSuits ??= [];
510 if (!inventory.BrandedSuits.find(x => x.equals(value.$oid))) {
511 inventory.BrandedSuits.push(new Types.ObjectId(value.$oid));
512
513 await createMessage(inventory.accountOwnerId, [
514 {
515 sndr: "/Lotus/Language/Menu/Mailbox_WarframeSender",
516 msg: "/Lotus/Language/G1Quests/BrandedMessage",
517 sub: "/Lotus/Language/G1Quests/BrandedTitle",
518 att: ["/Lotus/Types/Recipes/Components/BrandRemovalBlueprint"],
519 highPriority: true // TOVERIFY: I cannot find any content of this within the last 10 years so I can only assume that highPriority is set (it certainly would make sense), but I just don't know for sure that it is so on live.
520 }
521 ]);
522 }
523 break;
524 }
540 525 case "LockedWeaponGroup": {
541 526 inventory.LockedWeaponGroup = {
542 527 s: new Types.ObjectId(value.s.$oid),
@@ -545,12 +530,17 @@ export const addMissionInventoryUpdates = async (
545 530 m: value.m ? new Types.ObjectId(value.m.$oid) : undefined,
546 531 sn: value.sn ? new Types.ObjectId(value.sn.$oid) : undefined
547 532 };
533 inventory.Harvestable = false;
548 534 break;
549 535 }
550 536 case "UnlockWeapons": {
551 537 inventory.LockedWeaponGroup = undefined;
552 538 break;
553 539 }
540 case "IncHarvester": {
541 inventory.Harvestable = true;
542 break;
543 }
554 544 case "CurrentLoadOutIds": {
555 545 if (value.LoadOuts) {
556 546 const loadout = await Loadout.findOne({ loadoutOwnerId: inventory.accountOwnerId });
Modified src/types/requestTypes.ts +1 -0
@@ -130,6 +130,7 @@ export type IMissionInventoryUpdateRequest = {
130 130 }[];
131 131 KubrowPetEggs?: IKubrowPetEggClient[];
132 132 DiscoveredMarkers?: IDiscoveredMarker[];
133 BrandedSuits?: IOid; // sent when captured by g3
133 134 LockedWeaponGroup?: ILockedWeaponGroupClient; // sent when captured by zanuka
134 135 UnlockWeapons?: boolean; // sent when recovered weapons from zanuka capture
135 136 IncHarvester?: boolean; // sent when recovered weapons from zanuka capture