返回提交历史
Modified
config-vanilla.json
+0
-5
Modified
src/controllers/api/artifactsController.ts
+2
-3
Modified
src/controllers/api/creditsController.ts
+3
-4
Modified
src/controllers/api/infestedFoundryController.ts
+11
-11
Modified
src/controllers/api/inventoryController.ts
+5
-5
Modified
src/controllers/api/upgradesController.ts
+2
-3
Added
src/controllers/custom/setAccountCheatController.ts
+18
-0
Modified
src/models/inventoryModels/inventoryModel.ts
+8
-0
Modified
src/routes/custom.ts
+2
-0
Modified
src/services/configService.ts
+0
-5
Modified
src/services/infestedFoundryService.ts
+7
-4
Modified
src/services/inventoryService.ts
+3
-3
Modified
src/services/purchaseService.ts
+1
-1
Modified
src/types/inventoryTypes/inventoryTypes.ts
+11
-1
Modified
static/webui/index.html
+22
-22
Modified
static/webui/script.js
+25
-2
XFEstudio/XFESpaceNinjaServer
chore: make 'infinite' cheats per-account toggles (#2619)
Re #2361 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2619 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
f5335704
代码差异
16 个文件
+120
-69
@@ -13,11 +13,6 @@
13
13
"skipTutorial": false,
14
14
"skipAllDialogue": false,
15
15
"unlockAllScans": false,
16
"infiniteCredits": false,
17
"infinitePlatinum": false,
18
"infiniteEndo": false,
19
"infiniteRegalAya": false,
20
"infiniteHelminthMaterials": false,
21
16
"claimingBlueprintRefundsIngredients": false,
22
17
"dontSubtractPurchaseCreditCost": false,
23
18
"dontSubtractPurchasePlatinumCost": false,
@@ -3,7 +3,6 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
3
3
import { RequestHandler } from "express";
4
4
import { IInventoryClient, IUpgradeClient } from "@/src/types/inventoryTypes/inventoryTypes";
5
5
import { addMods, getInventory } from "@/src/services/inventoryService";
6
import { config } from "@/src/services/configService";
7
6
8
7
export const artifactsController: RequestHandler = async (req, res) => {
9
8
const accountId = await getAccountIdForRequest(req);
@@ -34,10 +33,10 @@ export const artifactsController: RequestHandler = async (req, res) => {
34
33
addMods(inventory, [{ ItemType, ItemCount: -1 }]);
35
34
}
36
35
37
if (!config.infiniteCredits) {
36
if (!inventory.infiniteCredits) {
38
37
inventory.RegularCredits -= Cost;
39
38
}
40
if (!config.infiniteEndo) {
39
if (!inventory.infiniteEndo) {
41
40
inventory.FusionPoints -= FusionPointCost;
42
41
}
43
42
@@ -1,5 +1,4 @@
1
1
import { RequestHandler } from "express";
2
import { config } from "@/src/services/configService";
3
2
import { getAccountIdForRequest } from "@/src/services/loginService";
4
3
import { getInventory } from "@/src/services/inventoryService";
5
4
@@ -9,7 +8,7 @@ export const creditsController: RequestHandler = async (req, res) => {
9
8
getAccountIdForRequest(req),
10
9
getInventory(
11
10
req.query.accountId as string,
12
"RegularCredits TradesRemaining PremiumCreditsFree PremiumCredits"
11
"RegularCredits TradesRemaining PremiumCreditsFree PremiumCredits infiniteCredits infinitePlatinum"
13
12
)
14
13
])
15
14
)[1];
@@ -21,10 +20,10 @@ export const creditsController: RequestHandler = async (req, res) => {
21
20
PremiumCredits: inventory.PremiumCredits
22
21
};
23
22
24
if (config.infiniteCredits) {
23
if (inventory.infiniteCredits) {
25
24
response.RegularCredits = 999999999;
26
25
}
27
if (config.infinitePlatinum) {
26
if (inventory.infinitePlatinum) {
28
27
response.PremiumCreditsFree = 0;
29
28
response.PremiumCredits = 999999999;
30
29
}
@@ -15,7 +15,6 @@ import { getRecipe } from "@/src/services/itemDataService";
15
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
import { config } from "@/src/services/configService";
19
18
import {
20
19
addInfestedFoundryXP,
21
20
applyCheatsToInfestedFoundry,
@@ -73,7 +72,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
73
72
addMiscItems(inventory, miscItemChanges);
74
73
75
74
// consume resources
76
if (!config.infiniteHelminthMaterials) {
75
if (!inventory.infiniteHelminthMaterials) {
77
76
let type: string;
78
77
let count: number;
79
78
if (account.BuildLabel && version_compare(account.BuildLabel, "2025.05.20.10.18") < 0) {
@@ -99,7 +98,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
99
98
await inventory.save();
100
99
101
100
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
102
applyCheatsToInfestedFoundry(infestedFoundry);
101
applyCheatsToInfestedFoundry(inventory, infestedFoundry);
103
102
res.json({
104
103
InventoryChanges: {
105
104
MiscItems: miscItemChanges,
@@ -129,13 +128,14 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
129
128
case "c": {
130
129
// consume items
131
130
132
if (config.infiniteHelminthMaterials) {
131
const inventory = await getInventory(account._id.toString());
132
133
if (inventory.infiniteHelminthMaterials) {
133
134
res.status(400).end();
134
135
return;
135
136
}
136
137
137
138
const request = getJSONfromString<IHelminthFeedRequest>(String(req.body));
138
const inventory = await getInventory(account._id.toString());
139
139
inventory.InfestedFoundry ??= {};
140
140
inventory.InfestedFoundry.Resources ??= [];
141
141
@@ -240,7 +240,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
240
240
}
241
241
await inventory.save();
242
242
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
243
applyCheatsToInfestedFoundry(infestedFoundry);
243
applyCheatsToInfestedFoundry(inventory, infestedFoundry);
244
244
res.json({
245
245
InventoryChanges: {
246
246
InfestedFoundry: infestedFoundry
@@ -254,7 +254,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
254
254
const request = getJSONfromString<IHelminthSubsumeRequest>(String(req.body));
255
255
const inventory = await getInventory(account._id.toString());
256
256
const recipe = getRecipe(request.Recipe)!;
257
if (!config.infiniteHelminthMaterials) {
257
if (!inventory.infiniteHelminthMaterials) {
258
258
for (const ingredient of recipe.secretIngredients!) {
259
259
const resource = inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == ingredient.ItemType);
260
260
if (resource) {
@@ -280,7 +280,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
280
280
freeUpSlot(inventory, InventorySlot.SUITS);
281
281
await inventory.save();
282
282
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
283
applyCheatsToInfestedFoundry(infestedFoundry);
283
applyCheatsToInfestedFoundry(inventory, infestedFoundry);
284
284
res.json({
285
285
InventoryChanges: {
286
286
Recipes: recipeChanges,
@@ -307,7 +307,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
307
307
const recipeChanges = handleSubsumeCompletion(inventory);
308
308
await inventory.save();
309
309
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
310
applyCheatsToInfestedFoundry(infestedFoundry);
310
applyCheatsToInfestedFoundry(inventory, infestedFoundry);
311
311
res.json({
312
312
InventoryChanges: {
313
313
...currencyChanges,
@@ -328,7 +328,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
328
328
suit.UpgradesExpiry = upgradesExpiry;
329
329
const recipeChanges = addInfestedFoundryXP(inventory.InfestedFoundry!, 4800_00);
330
330
addRecipes(inventory, recipeChanges);
331
if (!config.infiniteHelminthMaterials) {
331
if (!inventory.infiniteHelminthMaterials) {
332
332
for (let i = 0; i != request.ResourceTypes.length; ++i) {
333
333
inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == request.ResourceTypes[i])!.Count -=
334
334
request.ResourceCosts[i];
@@ -338,7 +338,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
338
338
inventory.InfestedFoundry!.InvigorationsApplied += 1;
339
339
await inventory.save();
340
340
const infestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry!;
341
applyCheatsToInfestedFoundry(infestedFoundry);
341
applyCheatsToInfestedFoundry(inventory, infestedFoundry);
342
342
res.json({
343
343
SuitId: request.SuitId,
344
344
OffensiveUpgrade: request.OffensiveUpgradeType,
@@ -295,17 +295,17 @@ export const getInventoryResponse = async (
295
295
};
296
296
}
297
297
298
if (config.infiniteCredits) {
298
if (inventory.infiniteCredits) {
299
299
inventoryResponse.RegularCredits = 999999999;
300
300
}
301
if (config.infinitePlatinum) {
301
if (inventory.infinitePlatinum) {
302
302
inventoryResponse.PremiumCreditsFree = 0;
303
303
inventoryResponse.PremiumCredits = 999999999;
304
304
}
305
if (config.infiniteEndo) {
305
if (inventory.infiniteEndo) {
306
306
inventoryResponse.FusionPoints = 999999999;
307
307
}
308
if (config.infiniteRegalAya) {
308
if (inventory.infiniteRegalAya) {
309
309
inventoryResponse.PrimeTokens = 999999999;
310
310
}
311
311
@@ -450,7 +450,7 @@ export const getInventoryResponse = async (
450
450
}
451
451
452
452
if (inventoryResponse.InfestedFoundry) {
453
applyCheatsToInfestedFoundry(inventoryResponse.InfestedFoundry);
453
applyCheatsToInfestedFoundry(inventory, inventoryResponse.InfestedFoundry);
454
454
}
455
455
456
456
// Set 2FA enabled so trading post can be used
@@ -7,7 +7,6 @@ import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/se
7
7
import { getRecipeByResult } from "@/src/services/itemDataService";
8
8
import { IInventoryChanges } from "@/src/types/purchaseTypes";
9
9
import { addInfestedFoundryXP, applyCheatsToInfestedFoundry } from "@/src/services/infestedFoundryService";
10
import { config } from "@/src/services/configService";
11
10
import { sendWsBroadcastTo } from "@/src/services/wsService";
12
11
import { EquipmentFeatures, IEquipmentDatabase } from "@/src/types/equipmentTypes";
13
12
@@ -52,7 +51,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
52
51
const recipe = getRecipeByResult(operation.UpgradeRequirement)!;
53
52
for (const ingredient of recipe.ingredients) {
54
53
totalPercentagePointsConsumed += ingredient.ItemCount / 10;
55
if (!config.infiniteHelminthMaterials) {
54
if (!inventory.infiniteHelminthMaterials) {
56
55
inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == ingredient.ItemType)!.Count -=
57
56
ingredient.ItemCount;
58
57
}
@@ -69,7 +68,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
69
68
70
69
inventoryChanges.Recipes = recipeChanges;
71
70
inventoryChanges.InfestedFoundry = inventory.toJSON<IInventoryClient>().InfestedFoundry;
72
applyCheatsToInfestedFoundry(inventoryChanges.InfestedFoundry!);
71
applyCheatsToInfestedFoundry(inventory, inventoryChanges.InfestedFoundry!);
73
72
} else
74
73
switch (operation.UpgradeRequirement) {
75
74
case "/Lotus/Types/Items/MiscItems/OrokinReactor":
@@ -0,0 +1,18 @@
1
import { getInventory } from "@/src/services/inventoryService";
2
import { getAccountIdForRequest } from "@/src/services/loginService";
3
import { IAccountCheats } from "@/src/types/inventoryTypes/inventoryTypes";
4
import { RequestHandler } from "express";
5
6
export const setAccountCheatController: RequestHandler = async (req, res) => {
7
const accountId = await getAccountIdForRequest(req);
8
const payload = req.body as ISetAccountCheatRequest;
9
const inventory = await getInventory(accountId, payload.key);
10
inventory[payload.key] = payload.value;
11
await inventory.save();
12
res.end();
13
};
14
15
interface ISetAccountCheatRequest {
16
key: keyof IAccountCheats;
17
value: boolean;
18
}
@@ -1425,6 +1425,14 @@ const hubNpcCustomizationSchema = new Schema<IHubNpcCustomization>(
1425
1425
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1426
1426
{
1427
1427
accountOwnerId: Schema.Types.ObjectId,
1428
1429
// SNS account cheats
1430
infiniteCredits: Boolean,
1431
infinitePlatinum: Boolean,
1432
infiniteEndo: Boolean,
1433
infiniteRegalAya: Boolean,
1434
infiniteHelminthMaterials: Boolean,
1435
1428
1436
SubscribedToEmails: { type: Number, default: 0 },
1429
1437
SubscribedToEmailsPersonalized: { type: Number, default: 0 },
1430
1438
RewardSeed: BigInt,
@@ -28,6 +28,7 @@ import { setBoosterController } from "@/src/controllers/custom/setBoosterControl
28
28
import { updateFingerprintController } from "@/src/controllers/custom/updateFingerprintController";
29
29
import { changeModularPartsController } from "@/src/controllers/custom/changeModularPartsController";
30
30
import { editSuitInvigorationUpgradeController } from "@/src/controllers/custom/editSuitInvigorationUpgradeController";
31
import { setAccountCheatController } from "@/src/controllers/custom/setAccountCheatController";
31
32
32
33
import { getConfigController, setConfigController } from "@/src/controllers/custom/configController";
33
34
@@ -61,6 +62,7 @@ customRouter.post("/setBooster", setBoosterController);
61
62
customRouter.post("/updateFingerprint", updateFingerprintController);
62
63
customRouter.post("/changeModularParts", changeModularPartsController);
63
64
customRouter.post("/editSuitInvigorationUpgrade", editSuitInvigorationUpgradeController);
65
customRouter.post("/setAccountCheat", setAccountCheatController);
64
66
65
67
customRouter.post("/getConfig", getConfigController);
66
68
customRouter.post("/setConfig", setConfigController);
@@ -20,11 +20,6 @@ export interface IConfig {
20
20
skipTutorial?: boolean;
21
21
skipAllDialogue?: boolean;
22
22
unlockAllScans?: boolean;
23
infiniteCredits?: boolean;
24
infinitePlatinum?: boolean;
25
infiniteEndo?: boolean;
26
infiniteRegalAya?: boolean;
27
infiniteHelminthMaterials?: boolean;
28
23
claimingBlueprintRefundsIngredients?: boolean;
29
24
dontSubtractPurchaseCreditCost?: boolean;
30
25
dontSubtractPurchasePlatinumCost?: boolean;
@@ -1,8 +1,11 @@
1
1
import { ExportRecipes } from "warframe-public-export-plus";
2
2
import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
3
import { IInfestedFoundryClient, IInfestedFoundryDatabase } from "@/src/types/inventoryTypes/inventoryTypes";
3
import {
4
IAccountCheats,
5
IInfestedFoundryClient,
6
IInfestedFoundryDatabase
7
} from "@/src/types/inventoryTypes/inventoryTypes";
4
8
import { addRecipes } from "@/src/services/inventoryService";
5
import { config } from "@/src/services/configService";
6
9
import { ITypeCount } from "@/src/types/commonTypes";
7
10
8
11
export const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundryDatabase, delta: number): ITypeCount[] => {
@@ -97,8 +100,8 @@ export const handleSubsumeCompletion = (inventory: TInventoryDatabaseDocument):
97
100
return recipeChanges;
98
101
};
99
102
100
export const applyCheatsToInfestedFoundry = (infestedFoundry: IInfestedFoundryClient): void => {
101
if (config.infiniteHelminthMaterials) {
103
export const applyCheatsToInfestedFoundry = (cheats: IAccountCheats, infestedFoundry: IInfestedFoundryClient): void => {
104
if (cheats.infiniteHelminthMaterials) {
102
105
infestedFoundry.Resources = [
103
106
{ ItemType: "/Lotus/Types/Items/InfestedFoundry/HelminthCalx", Count: 1000 },
104
107
{ ItemType: "/Lotus/Types/Items/InfestedFoundry/HelminthBiotics", Count: 1000 },
@@ -1201,8 +1201,8 @@ export const updateSlots = (
1201
1201
}
1202
1202
};
1203
1203
1204
const isCurrencyTracked = (usePremium: boolean): boolean => {
1205
return usePremium ? !config.infinitePlatinum : !config.infiniteCredits;
1204
const isCurrencyTracked = (inventory: TInventoryDatabaseDocument, usePremium: boolean): boolean => {
1205
return usePremium ? !inventory.infinitePlatinum : !inventory.infiniteCredits;
1206
1206
};
1207
1207
1208
1208
export const updateCurrency = (
@@ -1211,7 +1211,7 @@ export const updateCurrency = (
1211
1211
usePremium: boolean,
1212
1212
inventoryChanges: IInventoryChanges = {}
1213
1213
): IInventoryChanges => {
1214
if (price != 0 && isCurrencyTracked(usePremium)) {
1214
if (price != 0 && isCurrencyTracked(inventory, usePremium)) {
1215
1215
if (usePremium) {
1216
1216
if (inventory.PremiumCreditsFree > 0) {
1217
1217
const premiumCreditsFreeDelta = Math.min(price, inventory.PremiumCreditsFree) * -1;