返回提交历史
Modified
src/controllers/api/sellController.ts
+8
-2
Modified
src/models/inventoryModels/inventoryModel.ts
+2
-0
Modified
src/services/inventoryService.ts
+9
-0
Modified
src/types/inventoryTypes/inventoryTypes.ts
+1
-0
XFEstudio/XFESpaceNinjaServer
feat: selling for Dirac (CrewShipFusionPoints) (#2540)
Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2540 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: azdful <mischzaripov@yandex.ru> Co-committed-by: azdful <mischzaripov@yandex.ru>
509f7f0d
代码差异
4 个文件
+20
-2
@@ -9,7 +9,8 @@ import {
9
9
freeUpSlot,
10
10
combineInventoryChanges,
11
11
addCrewShipRawSalvage,
12
addFusionPoints
12
addFusionPoints,
13
addCrewShipFusionPoints
13
14
} from "@/src/services/inventoryService";
14
15
import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
15
16
import { ExportDojoRecipes } from "warframe-public-export-plus";
@@ -26,6 +27,8 @@ export const sellController: RequestHandler = async (req, res) => {
26
27
requiredFields.add("RegularCredits");
27
28
} else if (payload.SellCurrency == "SC_FusionPoints") {
28
29
requiredFields.add("FusionPoints");
30
} else if (payload.SellCurrency == "SC_CrewShipFusionPoints") {
31
requiredFields.add("CrewShipFusionPoints");
29
32
} else {
30
33
requiredFields.add("MiscItems");
31
34
}
@@ -79,6 +82,8 @@ export const sellController: RequestHandler = async (req, res) => {
79
82
inventory.RegularCredits += payload.SellPrice;
80
83
} else if (payload.SellCurrency == "SC_FusionPoints") {
81
84
addFusionPoints(inventory, payload.SellPrice);
85
} else if (payload.SellCurrency == "SC_CrewShipFusionPoints") {
86
addCrewShipFusionPoints(inventory, payload.SellPrice);
82
87
} else if (payload.SellCurrency == "SC_PrimeBucks") {
83
88
addMiscItems(inventory, [
84
89
{
@@ -330,7 +335,8 @@ interface ISellRequest {
330
335
| "SC_FusionPoints"
331
336
| "SC_DistillPoints"
332
337
| "SC_CrewShipFusionPoints"
333
| "SC_Resources";
338
| "SC_Resources"
339
| "somethingelsewemightnotknowabout";
334
340
buildLabel: string;
335
341
}
336
342
@@ -1437,6 +1437,8 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1437
1437
PremiumCreditsFree: { type: Number, default: 0 },
1438
1438
//Endo
1439
1439
FusionPoints: { type: Number, default: 0 },
1440
//Dirac
1441
CrewShipFusionPoints: { type: Number, default: 0 },
1440
1442
//Regal Aya
1441
1443
PrimeTokens: { type: Number, default: 0 },
1442
1444
@@ -1241,6 +1241,15 @@ export const addFusionPoints = (inventory: TInventoryDatabaseDocument, add: numb
1241
1241
return add;
1242
1242
};
1243
1243
1244
export const addCrewShipFusionPoints = (inventory: TInventoryDatabaseDocument, add: number): number => {
1245
if (inventory.CrewShipFusionPoints + add > 2147483647) {
1246
logger.warn(`capping CrewShipFusionPoints balance at 2147483647`);
1247
add = 2147483647 - inventory.CrewShipFusionPoints;
1248
}
1249
inventory.CrewShipFusionPoints += add;
1250
return add;
1251
};
1252
1244
1253
const standingLimitBinToInventoryKey: Record<
1245
1254
Exclude<TStandingLimitBin, "STANDING_LIMIT_BIN_NONE">,
1246
1255
keyof IDailyAffiliations
@@ -215,6 +215,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
215
215
PremiumCredits: number;
216
216
PremiumCreditsFree: number;
217
217
FusionPoints: number;
218
CrewShipFusionPoints: number; //Dirac (pre-rework Railjack)
218
219
PrimeTokens: number;
219
220
SuitBin: ISlots;
220
221
WeaponBin: ISlots;