返回提交历史
Modified
src/controllers/api/infestedFoundryController.ts
+22
-4
XFEstudio/XFESpaceNinjaServer
feat: helminth gaining subsume slots (#677)
3e54977d
代码差异
1 个文件
+22
-4
@@ -3,7 +3,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
3
3
import { getJSONfromString } from "@/src/helpers/stringHelpers";
4
4
import { getInventory, addMiscItems } from "@/src/services/inventoryService";
5
5
import { IOid } from "@/src/types/commonTypes";
6
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
6
import { IInfestedFoundry, IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
7
7
import { ExportMisc } from "warframe-public-export-plus";
8
8
9
9
export const infestedFoundryController: RequestHandler = async (req, res) => {
@@ -60,7 +60,6 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
60
60
const inventory = await getInventory(accountId);
61
61
inventory.InfestedFoundry ??= {};
62
62
inventory.InfestedFoundry.Resources ??= [];
63
inventory.InfestedFoundry.XP ??= 0;
64
63
65
64
const miscItemChanges: IMiscItem[] = [];
66
65
let totalPercentagePointsGained = 0;
@@ -89,7 +88,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
89
88
}
90
89
}
91
90
92
inventory.InfestedFoundry.XP += 666 * totalPercentagePointsGained;
91
addInfestedFoundryXP(inventory.InfestedFoundry, 666 * totalPercentagePointsGained);
93
92
addMiscItems(inventory, miscItemChanges);
94
93
await inventory.save();
95
94
@@ -97,7 +96,8 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
97
96
InventoryChanges: {
98
97
InfestedFoundry: {
99
98
XP: inventory.InfestedFoundry.XP,
100
Resources: inventory.InfestedFoundry.Resources
99
Resources: inventory.InfestedFoundry.Resources,
100
Slots: inventory.InfestedFoundry.Slots
101
101
}
102
102
},
103
103
MiscItems: miscItemChanges
@@ -147,3 +147,21 @@ const colorToShard: Record<string, string> = {
147
147
ACC_PURPLE: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalViolet",
148
148
ACC_PURPLE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic"
149
149
};
150
151
const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundry, delta: number): void => {
152
infestedFoundry.XP ??= 0;
153
const prevXP = infestedFoundry.XP;
154
infestedFoundry.XP += delta;
155
if (prevXP < 2250_00 && infestedFoundry.XP >= 2250_00) {
156
infestedFoundry.Slots ??= 0;
157
infestedFoundry.Slots += 3;
158
}
159
if (prevXP < 15750_00 && infestedFoundry.XP >= 15750_00) {
160
infestedFoundry.Slots ??= 0;
161
infestedFoundry.Slots += 10;
162
}
163
if (prevXP < 39375_00 && infestedFoundry.XP >= 39375_00) {
164
infestedFoundry.Slots ??= 0;
165
infestedFoundry.Slots += 20;
166
}
167
};