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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

chore: update shard removal costs for 38.6.0 (#2094)

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

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

代码差异

1 个文件 +40 -20
Modified src/controllers/api/infestedFoundryController.ts +40 -20
@@ -1,5 +1,5 @@
1 1 import { RequestHandler } from "express";
2 import { getAccountIdForRequest } from "@/src/services/loginService";
2 import { getAccountForRequest } from "@/src/services/loginService";
3 3 import { getJSONfromString } from "@/src/helpers/stringHelpers";
4 4 import { getInventory, addMiscItems, updateCurrency, addRecipes, freeUpSlot } from "@/src/services/inventoryService";
5 5 import { IOid } from "@/src/types/commonTypes";
@@ -12,7 +12,7 @@ import {
12 12 } from "@/src/types/inventoryTypes/inventoryTypes";
13 13 import { ExportMisc } from "warframe-public-export-plus";
14 14 import { getRecipe } from "@/src/services/itemDataService";
15 import { toMongoDate } from "@/src/helpers/inventoryHelpers";
15 import { toMongoDate, version_compare } from "@/src/helpers/inventoryHelpers";
16 16 import { logger } from "@/src/utils/logger";
17 17 import { colorToShard } from "@/src/helpers/shardHelper";
18 18 import { config } from "@/src/services/configService";
@@ -23,12 +23,12 @@ import {
23 23 } from "@/src/services/infestedFoundryService";
24 24
25 25 export const infestedFoundryController: RequestHandler = async (req, res) => {
26 const accountId = await getAccountIdForRequest(req);
26 const account = await getAccountForRequest(req);
27 27 switch (req.query.mode) {
28 28 case "s": {
29 29 // shard installation
30 30 const request = getJSONfromString<IShardInstallRequest>(String(req.body));
31 const inventory = await getInventory(accountId);
31 const inventory = await getInventory(account._id.toString());
32 32 const suit = inventory.Suits.id(request.SuitId.$oid)!;
33 33 if (!suit.ArchonCrystalUpgrades || suit.ArchonCrystalUpgrades.length != 5) {
34 34 suit.ArchonCrystalUpgrades = [{}, {}, {}, {}, {}];
@@ -56,7 +56,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
56 56 case "x": {
57 57 // shard removal
58 58 const request = getJSONfromString<IShardUninstallRequest>(String(req.body));
59 const inventory = await getInventory(accountId);
59 const inventory = await getInventory(account._id.toString());
60 60 const suit = inventory.Suits.id(request.SuitId.$oid)!;
61 61
62 62 const miscItemChanges: IMiscItem[] = [];
@@ -70,19 +70,30 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
70 70 ItemCount: 1
71 71 });
72 72 addMiscItems(inventory, miscItemChanges);
73
74 // consume resources
75 if (!config.infiniteHelminthMaterials) {
76 let type: string;
77 let count: number;
78 if (account.BuildLabel && version_compare(account.BuildLabel, "2025.05.20.10.18") < 0) {
79 // < 38.6.0
80 type = "/Lotus/Types/Items/InfestedFoundry/HelminthBile";
81 count = 300;
82 } else {
83 // >= 38.6.0
84 type =
85 archonCrystalRemovalResource[
86 suit.ArchonCrystalUpgrades![request.Slot].Color!.replace("_MYTHIC", "")
87 ];
88 count = suit.ArchonCrystalUpgrades![request.Slot].Color!.indexOf("_MYTHIC") != -1 ? 300 : 150;
89 }
90 inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == type)!.Count -= count;
91 }
73 92 }
74 93
75 94 // remove from suit
76 95 suit.ArchonCrystalUpgrades![request.Slot] = {};
77 96
78 if (!config.infiniteHelminthMaterials) {
79 // remove bile
80 const bile = inventory.InfestedFoundry!.Resources!.find(
81 x => x.ItemType == "/Lotus/Types/Items/InfestedFoundry/HelminthBile"
82 )!;
83 bile.Count -= 300;
84 }
85
86 97 await inventory.save();
87 98
88 99 const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
@@ -99,7 +110,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
99 110 case "n": {
100 111 // name the beast
101 112 const request = getJSONfromString<IHelminthNameRequest>(String(req.body));
102 const inventory = await getInventory(accountId);
113 const inventory = await getInventory(account._id.toString());
103 114 inventory.InfestedFoundry ??= {};
104 115 inventory.InfestedFoundry.Name = request.newName;
105 116 await inventory.save();
@@ -122,7 +133,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
122 133 }
123 134
124 135 const request = getJSONfromString<IHelminthFeedRequest>(String(req.body));
125 const inventory = await getInventory(accountId);
136 const inventory = await getInventory(account._id.toString());
126 137 inventory.InfestedFoundry ??= {};
127 138 inventory.InfestedFoundry.Resources ??= [];
128 139
@@ -218,7 +229,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
218 229 case "o": {
219 230 // offerings update
220 231 const request = getJSONfromString<IHelminthOfferingsUpdate>(String(req.body));
221 const inventory = await getInventory(accountId);
232 const inventory = await getInventory(account._id.toString());
222 233 inventory.InfestedFoundry ??= {};
223 234 inventory.InfestedFoundry.InvigorationIndex = request.OfferingsIndex;
224 235 inventory.InfestedFoundry.InvigorationSuitOfferings = request.SuitTypes;
@@ -239,7 +250,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
239 250 case "a": {
240 251 // subsume warframe
241 252 const request = getJSONfromString<IHelminthSubsumeRequest>(String(req.body));
242 const inventory = await getInventory(accountId);
253 const inventory = await getInventory(account._id.toString());
243 254 const recipe = getRecipe(request.Recipe)!;
244 255 if (!config.infiniteHelminthMaterials) {
245 256 for (const ingredient of recipe.secretIngredients!) {
@@ -289,7 +300,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
289 300
290 301 case "r": {
291 302 // rush subsume
292 const inventory = await getInventory(accountId);
303 const inventory = await getInventory(account._id.toString());
293 304 const currencyChanges = updateCurrency(inventory, 50, true);
294 305 const recipeChanges = handleSubsumeCompletion(inventory);
295 306 await inventory.save();
@@ -307,7 +318,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
307 318
308 319 case "u": {
309 320 const request = getJSONfromString<IHelminthInvigorationRequest>(String(req.body));
310 const inventory = await getInventory(accountId);
321 const inventory = await getInventory(account._id.toString());
311 322 const suit = inventory.Suits.id(request.SuitId.$oid)!;
312 323 const upgradesExpiry = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);
313 324 suit.OffensiveUpgrade = request.OffensiveUpgradeType;
@@ -340,7 +351,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
340 351 }
341 352
342 353 case "custom_unlockall": {
343 const inventory = await getInventory(accountId);
354 const inventory = await getInventory(account._id.toString());
344 355 inventory.InfestedFoundry ??= {};
345 356 inventory.InfestedFoundry.XP ??= 0;
346 357 if (151875_00 > inventory.InfestedFoundry.XP) {
@@ -439,3 +450,12 @@ const apetiteModel = (x: number): number => {
439 450 }
440 451 return 3;
441 452 };
453
454 const archonCrystalRemovalResource: Record<string, string> = {
455 ACC_RED: "/Lotus/Types/Items/InfestedFoundry/HelminthOxides",
456 ACC_YELLOW: "/Lotus/Types/Items/InfestedFoundry/HelminthBile",
457 ACC_BLUE: "/Lotus/Types/Items/InfestedFoundry/HelminthSynthetics",
458 ACC_GREEN: "/Lotus/Types/Items/InfestedFoundry/HelminthBiotics",
459 ACC_ORANGE: "/Lotus/Types/Items/InfestedFoundry/HelminthPheromones",
460 ACC_PURPLE: "/Lotus/Types/Items/InfestedFoundry/HelminthCalx"
461 };