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

feat: grustrag bolt (#1392)

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

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

代码差异

5 个文件 +54 -8
Modified src/controllers/api/claimCompletedRecipeController.ts +11 -4
@@ -99,6 +99,11 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
99 99 inventory.SpectreLoadouts.push(inventory.PendingSpectreLoadouts[pendingLoadoutIndex]);
100 100 inventory.PendingSpectreLoadouts.splice(pendingLoadoutIndex, 1);
101 101 }
102 } else if (recipe.secretIngredientAction == "SIA_UNBRAND") {
103 inventory.BrandedSuits!.splice(
104 inventory.BrandedSuits!.findIndex(x => x.equals(pendingRecipe.SuitToUnbrand)),
105 1
106 );
102 107 }
103 108
104 109 let InventoryChanges = {};
@@ -116,10 +121,12 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
116 121 ...updateCurrency(inventory, recipe.skipBuildTimePrice, true)
117 122 };
118 123 }
119 InventoryChanges = {
120 ...InventoryChanges,
121 ...(await addItem(inventory, recipe.resultType, recipe.num, false))
122 };
124 if (recipe.secretIngredientAction != "SIA_UNBRAND") {
125 InventoryChanges = {
126 ...InventoryChanges,
127 ...(await addItem(inventory, recipe.resultType, recipe.num, false))
128 };
129 }
123 130 await inventory.save();
124 131 res.json({ InventoryChanges });
125 132 }
Modified src/controllers/api/startRecipeController.ts +2 -0
@@ -111,6 +111,8 @@ export const startRecipeController: RequestHandler = async (req, res) => {
111 111 inventory.PendingSpectreLoadouts.push(spectreLoadout);
112 112 logger.debug("pending spectre loadout", spectreLoadout);
113 113 }
114 } else if (recipe.secretIngredientAction == "SIA_UNBRAND") {
115 pr.SuitToUnbrand = new Types.ObjectId(startRecipeRequest.Ids[recipe.ingredients.length + 0]);
114 116 }
115 117
116 118 await inventory.save();
Modified src/models/inventoryModels/inventoryModel.ts +9 -2
@@ -903,7 +903,8 @@ const pendingRecipeSchema = new Schema<IPendingRecipeDatabase>(
903 903 CompletionDate: Date,
904 904 LongGuns: { type: [EquipmentSchema], default: undefined },
905 905 Pistols: { type: [EquipmentSchema], default: undefined },
906 Melee: { type: [EquipmentSchema], default: undefined }
906 Melee: { type: [EquipmentSchema], default: undefined },
907 SuitToUnbrand: { type: Schema.Types.ObjectId, default: undefined }
907 908 },
908 909 { id: false }
909 910 );
@@ -920,6 +921,7 @@ pendingRecipeSchema.set("toJSON", {
920 921 delete returnedObject.LongGuns;
921 922 delete returnedObject.Pistols;
922 923 delete returnedObject.Melees;
924 delete returnedObject.SuitToUnbrand;
923 925 (returnedObject as IPendingRecipeClient).CompletionDate = {
924 926 $date: { $numberLong: (returnedObject as IPendingRecipeDatabase).CompletionDate.getTime().toString() }
925 927 };
@@ -1484,7 +1486,9 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1484 1486 EchoesHexConquestHardModeStatus: { type: Number, default: undefined },
1485 1487 EchoesHexConquestCacheScoreMission: { type: Number, default: undefined },
1486 1488 EchoesHexConquestActiveFrameVariants: { type: [String], default: undefined },
1487 EchoesHexConquestActiveStickers: { type: [String], default: undefined }
1489 EchoesHexConquestActiveStickers: { type: [String], default: undefined },
1490
1491 BrandedSuits: { type: [Schema.Types.ObjectId], default: undefined }
1488 1492 },
1489 1493 { timestamps: { createdAt: "Created", updatedAt: false } }
1490 1494 );
@@ -1516,6 +1520,9 @@ inventorySchema.set("toJSON", {
1516 1520 if (inventoryDatabase.EntratiVaultCountResetDate) {
1517 1521 inventoryResponse.EntratiVaultCountResetDate = toMongoDate(inventoryDatabase.EntratiVaultCountResetDate);
1518 1522 }
1523 if (inventoryDatabase.BrandedSuits) {
1524 inventoryResponse.BrandedSuits = inventoryDatabase.BrandedSuits.map(toOid);
1525 }
1519 1526 }
1520 1527 });
1521 1528
Modified src/services/missionInventoryUpdateService.ts +27 -1
@@ -30,7 +30,7 @@ import {
30 30 updateSyndicate
31 31 } from "@/src/services/inventoryService";
32 32 import { updateQuestKey } from "@/src/services/questService";
33 import { HydratedDocument } from "mongoose";
33 import { HydratedDocument, Types } from "mongoose";
34 34 import { IInventoryChanges } from "@/src/types/purchaseTypes";
35 35 import { getLevelKeyRewards, getNode, toStoreItem } from "@/src/services/itemDataService";
36 36 import { InventoryDocumentProps, TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
@@ -45,6 +45,7 @@ import kuriaMessage75 from "@/static/fixed_responses/kuriaMessages/seventyFivePe
45 45 import kuriaMessage100 from "@/static/fixed_responses/kuriaMessages/oneHundredPercent.json";
46 46 import conservationAnimals from "@/static/fixed_responses/conservationAnimals.json";
47 47 import { getInfNodes } from "@/src/helpers/nemesisHelpers";
48 import { Loadout } from "../models/inventoryModels/loadoutModel";
48 49
49 50 const getRotations = (rotationCount: number): number[] => {
50 51 if (rotationCount === 0) return [0];
@@ -89,6 +90,31 @@ export const addMissionInventoryUpdates = async (
89 90 if (inventoryUpdates.RewardInfo && inventoryUpdates.RewardInfo.NemesisAbandonedRewards) {
90 91 inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards;
91 92 }
93 if (
94 inventoryUpdates.MissionFailed &&
95 inventoryUpdates.MissionStatus == "GS_FAILURE" &&
96 inventoryUpdates.EndOfMatchUpload &&
97 inventoryUpdates.ObjectiveReached
98 ) {
99 const loadout = (await Loadout.findById(inventory.LoadOutPresets, "NORMAL"))!;
100 const config = loadout.NORMAL.id(inventory.CurrentLoadOutIds[0].$oid)!;
101 const SuitId = new Types.ObjectId(config.s!.ItemId.$oid);
102
103 inventory.BrandedSuits ??= [];
104 if (!inventory.BrandedSuits.find(x => x.equals(SuitId))) {
105 inventory.BrandedSuits.push(SuitId);
106
107 await createMessage(inventory.accountOwnerId.toString(), [
108 {
109 sndr: "/Lotus/Language/Menu/Mailbox_WarframeSender",
110 msg: "/Lotus/Language/G1Quests/BrandedMessage",
111 sub: "/Lotus/Language/G1Quests/BrandedTitle",
112 att: ["/Lotus/Types/Recipes/Components/BrandRemovalBlueprint"],
113 highPriority: true // 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.
114 }
115 ]);
116 }
117 }
92 118 for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
93 119 if (value === undefined) {
94 120 logger.error(`Inventory update key ${key} has no value `);
Modified src/types/inventoryTypes/inventoryTypes.ts +5 -1
@@ -44,6 +44,7 @@ export interface IInventoryDatabase
44 44 | "NextRefill"
45 45 | "Nemesis"
46 46 | "EntratiVaultCountResetDate"
47 | "BrandedSuits"
47 48 | TEquipmentKey
48 49 >,
49 50 InventoryDatabaseEquipment {
@@ -73,6 +74,7 @@ export interface IInventoryDatabase
73 74 NextRefill?: Date;
74 75 Nemesis?: INemesisDatabase;
75 76 EntratiVaultCountResetDate?: Date;
77 BrandedSuits?: Types.ObjectId[];
76 78 }
77 79
78 80 export interface IQuestKeyDatabase {
@@ -346,6 +348,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
346 348 EchoesHexConquestCacheScoreMission?: number;
347 349 EchoesHexConquestActiveFrameVariants?: string[];
348 350 EchoesHexConquestActiveStickers?: string[];
351 BrandedSuits?: IOid[];
349 352 }
350 353
351 354 export interface IAffiliation {
@@ -857,10 +860,11 @@ export interface IPendingRecipeDatabase {
857 860 LongGuns?: IEquipmentDatabase[];
858 861 Pistols?: IEquipmentDatabase[];
859 862 Melee?: IEquipmentDatabase[];
863 SuitToUnbrand?: Types.ObjectId;
860 864 }
861 865
862 866 export interface IPendingRecipeClient
863 extends Omit<IPendingRecipeDatabase, "CompletionDate" | "LongGuns" | "Pistols" | "Melee"> {
867 extends Omit<IPendingRecipeDatabase, "CompletionDate" | "LongGuns" | "Pistols" | "Melee" | "SuitToUnbrand"> {
864 868 CompletionDate: IMongoDate;
865 869 }
866 870