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

chore: move more cheats to account section (#2680)

Re #2361 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2680 Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com> Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>

71d0c140
AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
提交于

代码差异

18 个文件 +193 -190
Modified config-vanilla.json +0 -23
@@ -13,38 +13,15 @@
13 13 "skipTutorial": false,
14 14 "skipAllDialogue": false,
15 15 "unlockAllScans": false,
16 "claimingBlueprintRefundsIngredients": false,
17 "dontSubtractPurchaseCreditCost": false,
18 "dontSubtractPurchasePlatinumCost": false,
19 "dontSubtractPurchaseItemCost": false,
20 "dontSubtractPurchaseStandingCost": false,
21 "dontSubtractVoidTraces": false,
22 "dontSubtractConsumables": false,
23 16 "unlockAllShipFeatures": false,
24 17 "unlockAllShipDecorations": false,
25 18 "unlockAllFlavourItems": false,
26 19 "unlockAllSkins": false,
27 20 "unlockAllCapturaScenes": false,
28 "universalPolarityEverywhere": false,
29 "unlockDoubleCapacityPotatoesEverywhere": false,
30 "unlockExilusEverywhere": false,
31 "unlockArcanesEverywhere": false,
32 "noDailyStandingLimits": false,
33 "noDailyFocusLimit": false,
34 "noArgonCrystalDecay": false,
35 "noMasteryRankUpCooldown": false,
36 "noVendorPurchaseLimits": false,
37 "noDeathMarks": false,
38 "noKimCooldowns": false,
39 21 "fullyStockedVendors": false,
40 22 "baroAlwaysAvailable": false,
41 23 "baroFullyStocked": false,
42 "syndicateMissionsRepeatable": false,
43 24 "unlockAllProfitTakerStages": false,
44 "instantFinishRivenChallenge": false,
45 "instantResourceExtractorDrones": false,
46 "noResourceExtractorDronesDamage": false,
47 "skipClanKeyCrafting": false,
48 25 "noDojoRoomBuildStage": false,
49 26 "noDecoBuildStage": false,
50 27 "fastDojoRoomDestruction": false,
Modified src/controllers/api/activateRandomModController.ts +2 -3
@@ -10,11 +10,10 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
10 10 import { getRandomElement } from "@/src/services/rngService";
11 11 import { RequestHandler } from "express";
12 12 import { ExportUpgrades } from "warframe-public-export-plus";
13 import { config } from "@/src/services/configService";
14 13
15 14 export const activateRandomModController: RequestHandler = async (req, res) => {
16 15 const accountId = await getAccountIdForRequest(req);
17 const inventory = await getInventory(accountId);
16 const inventory = await getInventory(accountId, "RawUpgrades Upgrades instantFinishRivenChallenge");
18 17 const request = getJSONfromString<IActiveRandomModRequest>(String(req.body));
19 18 addMods(inventory, [
20 19 {
@@ -23,7 +22,7 @@ export const activateRandomModController: RequestHandler = async (req, res) => {
23 22 }
24 23 ]);
25 24 const rivenType = getRandomElement(rivenRawToRealWeighted[request.ItemType])!;
26 const fingerprint = config.instantFinishRivenChallenge
25 const fingerprint = inventory.instantFinishRivenChallenge
27 26 ? createUnveiledRivenFingerprint(ExportUpgrades[rivenType])
28 27 : createVeiledRivenFingerprint(ExportUpgrades[rivenType]);
29 28 const upgradeIndex =
Modified src/controllers/api/claimCompletedRecipeController.ts +1 -2
@@ -23,7 +23,6 @@ import { InventorySlot, IPendingRecipeDatabase } from "@/src/types/inventoryType
23 23 import { toOid2 } from "@/src/helpers/inventoryHelpers";
24 24 import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
25 25 import { IRecipe } from "warframe-public-export-plus";
26 import { config } from "@/src/services/configService";
27 26 import { EquipmentFeatures, IEquipmentClient, Status } from "@/src/types/equipmentTypes";
28 27
29 28 interface IClaimCompletedRecipeRequest {
@@ -247,7 +246,7 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
247 246 }
248 247 }
249 248 if (
250 config.claimingBlueprintRefundsIngredients &&
249 inventory.claimingBlueprintRefundsIngredients &&
251 250 recipe.secretIngredientAction != "SIA_CREATE_KUBROW" // Can't refund the egg
252 251 ) {
253 252 await refundRecipeIngredients(inventory, InventoryChanges, recipe, pendingRecipe);
Modified src/controllers/api/confirmGuildInvitationController.ts +4 -1
@@ -95,7 +95,10 @@ export const confirmGuildInvitationPostController: RequestHandler = async (req,
95 95 await GuildMember.deleteMany({ accountId: guildMember.accountId, status: 1 });
96 96
97 97 // Update inventory of new member
98 const inventory = await getInventory(guildMember.accountId.toString(), "GuildId LevelKeys Recipes");
98 const inventory = await getInventory(
99 guildMember.accountId.toString(),
100 "GuildId LevelKeys Recipes skipClanKeyCrafting"
101 );
99 102 inventory.GuildId = new Types.ObjectId(req.query.clanId as string);
100 103 giveClanKey(inventory);
101 104 await inventory.save();
Modified src/controllers/api/createGuildController.ts +1 -1
@@ -27,7 +27,7 @@ export const createGuildController: RequestHandler = async (req, res) => {
27 27 rank: 0
28 28 });
29 29
30 const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys Recipes");
30 const inventory = await getInventory(account._id.toString(), "GuildId LevelKeys Recipes skipClanKeyCrafting");
31 31 inventory.GuildId = guild._id;
32 32 const inventoryChanges: IInventoryChanges = {};
33 33 giveClanKey(inventory, inventoryChanges);
Modified src/controllers/api/dronesController.ts +7 -5
@@ -1,5 +1,4 @@
1 1 import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
2 import { config } from "@/src/services/configService";
3 2 import { addMiscItems, getInventory } from "@/src/services/inventoryService";
4 3 import { fromStoreItem } from "@/src/services/itemDataService";
5 4 import { getAccountIdForRequest } from "@/src/services/loginService";
@@ -39,10 +38,13 @@ export const dronesController: RequestHandler = async (req, res) => {
39 38 ActiveDrones: activeDrones
40 39 });
41 40 } else if ("droneId" in req.query && "systemIndex" in req.query) {
42 const inventory = await getInventory(accountId, "Drones");
41 const inventory = await getInventory(
42 accountId,
43 "Drones instantResourceExtractorDrones noResourceExtractorDronesDamage"
44 );
43 45 const drone = inventory.Drones.id(req.query.droneId as string)!;
44 46 const droneMeta = ExportDrones[drone.ItemType];
45 drone.DeployTime = config.instantResourceExtractorDrones ? new Date(0) : new Date();
47 drone.DeployTime = inventory.instantResourceExtractorDrones ? new Date(0) : new Date();
46 48 if (drone.RepairStart) {
47 49 const repairMinutes = (Date.now() - drone.RepairStart.getTime()) / 60_000;
48 50 const hpPerMinute = droneMeta.repairRate / 60;
@@ -51,11 +53,11 @@ export const dronesController: RequestHandler = async (req, res) => {
51 53 }
52 54 drone.System = parseInt(req.query.systemIndex as string);
53 55 const system = ExportSystems[drone.System - 1];
54 drone.DamageTime = config.instantResourceExtractorDrones
56 drone.DamageTime = inventory.instantResourceExtractorDrones
55 57 ? new Date()
56 58 : new Date(Date.now() + getRandomInt(3 * 3600 * 1000, 4 * 3600 * 1000));
57 59 drone.PendingDamage =
58 !config.noResourceExtractorDronesDamage && Math.random() < system.damageChance
60 !inventory.noResourceExtractorDronesDamage && Math.random() < system.damageChance
59 61 ? getRandomInt(system.droneDamage.minValue, system.droneDamage.maxValue)
60 62 : 0;
61 63 const resource = getRandomWeightedRewardUc(system.resources, droneMeta.probabilities)!;
Modified src/controllers/api/inventoryController.ts +7 -7
@@ -68,7 +68,7 @@ export const inventoryController: RequestHandler = async (request, response) =>
68 68 const lastLoginDay = Math.trunc(inventory.NextRefill.getTime() / 86400000) - 1;
69 69 const daysPassed = today - lastLoginDay;
70 70
71 if (config.noArgonCrystalDecay) {
71 if (inventory.noArgonCrystalDecay) {
72 72 inventory.FoundToday = undefined;
73 73 } else {
74 74 for (let i = 0; i != daysPassed; ++i) {
@@ -387,7 +387,7 @@ export const getInventoryResponse = async (
387 387 }
388 388 }
389 389
390 if (config.universalPolarityEverywhere) {
390 if (inventory.universalPolarityEverywhere) {
391 391 const Polarity: IPolarity[] = [];
392 392 // 12 is needed for necramechs. 15 is needed for plexus/crewshipharness.
393 393 for (let i = 0; i != 15; ++i) {
@@ -405,7 +405,7 @@ export const getInventoryResponse = async (
405 405 }
406 406 }
407 407
408 if (config.unlockDoubleCapacityPotatoesEverywhere) {
408 if (inventory.unlockDoubleCapacityPotatoesEverywhere) {
409 409 for (const key of equipmentKeys) {
410 410 if (key in inventoryResponse) {
411 411 for (const equipment of inventoryResponse[key]) {
@@ -416,7 +416,7 @@ export const getInventoryResponse = async (
416 416 }
417 417 }
418 418
419 if (config.unlockExilusEverywhere) {
419 if (inventory.unlockExilusEverywhere) {
420 420 for (const key of equipmentKeys) {
421 421 if (key in inventoryResponse) {
422 422 for (const equipment of inventoryResponse[key]) {
@@ -427,7 +427,7 @@ export const getInventoryResponse = async (
427 427 }
428 428 }
429 429
430 if (config.unlockArcanesEverywhere) {
430 if (inventory.unlockArcanesEverywhere) {
431 431 for (const key of equipmentKeys) {
432 432 if (key in inventoryResponse) {
433 433 for (const equipment of inventoryResponse[key]) {
@@ -438,14 +438,14 @@ export const getInventoryResponse = async (
438 438 }
439 439 }
440 440
441 if (config.noDailyStandingLimits) {
441 if (inventory.noDailyStandingLimits) {
442 442 const spoofedDailyAffiliation = Math.max(999_999, 16000 + inventoryResponse.PlayerLevel * 500);
443 443 for (const key of allDailyAffiliationKeys) {
444 444 inventoryResponse[key] = spoofedDailyAffiliation;
445 445 }
446 446 }
447 447
448 if (config.noDailyFocusLimit) {
448 if (inventory.noDailyFocusLimit) {
449 449 inventoryResponse.DailyFocus = Math.max(999_999, 250000 + inventoryResponse.PlayerLevel * 5000);
450 450 }
451 451
Modified src/controllers/api/projectionManagerController.ts +2 -3
@@ -2,14 +2,13 @@ import { RequestHandler } from "express";
2 2 import { getAccountIdForRequest } from "@/src/services/loginService";
3 3 import { addMiscItems, getInventory } from "@/src/services/inventoryService";
4 4 import { ExportRelics, IRelic } from "warframe-public-export-plus";
5 import { config } from "@/src/services/configService";
6 5
7 6 export const projectionManagerController: RequestHandler = async (req, res) => {
8 7 const accountId = await getAccountIdForRequest(req);
9 const inventory = await getInventory(accountId);
8 const inventory = await getInventory(accountId, "MiscItems dontSubtractVoidTraces");
10 9 const request = JSON.parse(String(req.body)) as IProjectionUpgradeRequest;
11 10 const [era, category, currentQuality] = parseProjection(request.projectionType);
12 const upgradeCost = config.dontSubtractVoidTraces
11 const upgradeCost = inventory.dontSubtractVoidTraces
13 12 ? 0
14 13 : qualityNumberToCost[request.qualityTag] - qualityNumberToCost[qualityKeywordToNumber[currentQuality]];
15 14 const newProjectionType = findProjection(era, category, qualityNumberToKeyword[request.qualityTag]);
Modified src/controllers/api/saveDialogueController.ts +2 -3
@@ -1,4 +1,3 @@
1 import { config } from "@/src/services/configService";
2 1 import { addEmailItem, getDialogue, getInventory, updateCurrency } from "@/src/services/inventoryService";
3 2 import { getAccountIdForRequest } from "@/src/services/loginService";
4 3 import { ICompletedDialogue } from "@/src/types/inventoryTypes/inventoryTypes";
@@ -9,7 +8,7 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
9 8 const accountId = await getAccountIdForRequest(req);
10 9 const request = JSON.parse(String(req.body)) as SaveDialogueRequest;
11 10 if ("YearIteration" in request) {
12 const inventory = await getInventory(accountId, "DialogueHistory");
11 const inventory = await getInventory(accountId, "DialogueHistory noKimCooldowns");
13 12 inventory.DialogueHistory ??= {};
14 13 inventory.DialogueHistory.YearIteration = request.YearIteration;
15 14 await inventory.save();
@@ -17,7 +16,7 @@ export const saveDialogueController: RequestHandler = async (req, res) => {
17 16 } else {
18 17 const inventory = await getInventory(accountId);
19 18 const inventoryChanges: IInventoryChanges = {};
20 const tomorrowAt0Utc = config.noKimCooldowns
19 const tomorrowAt0Utc = inventory.noKimCooldowns
21 20 ? Date.now()
22 21 : (Math.trunc(Date.now() / 86400_000) + 1) * 86400_000;
23 22 const dialogue = getDialogue(inventory, request.DialogueName);
Modified src/controllers/api/trainingResultController.ts +2 -3
@@ -6,7 +6,6 @@ import { RequestHandler } from "express";
6 6 import { unixTimesInMs } from "@/src/constants/timeConstants";
7 7 import { IInventoryChanges } from "@/src/types/purchaseTypes";
8 8 import { createMessage } from "@/src/services/inboxService";
9 import { config } from "@/src/services/configService";
10 9
11 10 interface ITrainingResultsRequest {
12 11 numLevelsGained: number;
@@ -23,11 +22,11 @@ const trainingResultController: RequestHandler = async (req, res): Promise<void>
23 22
24 23 const trainingResults = getJSONfromString<ITrainingResultsRequest>(String(req.body));
25 24
26 const inventory = await getInventory(accountId, "TrainingDate PlayerLevel TradesRemaining");
25 const inventory = await getInventory(accountId, "TrainingDate PlayerLevel TradesRemaining noMasteryRankUpCooldown");
27 26
28 27 if (trainingResults.numLevelsGained == 1) {
29 28 let time = Date.now();
30 if (!config.noMasteryRankUpCooldown) {
29 if (!inventory.noMasteryRankUpCooldown) {
31 30 time += unixTimesInMs.hour * 23;
32 31 }
33 32 inventory.TrainingDate = new Date(time);
Modified src/models/inventoryModels/inventoryModel.ts +23 -0
@@ -1427,11 +1427,34 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
1427 1427 accountOwnerId: Schema.Types.ObjectId,
1428 1428
1429 1429 // SNS account cheats
1430 dontSubtractPurchaseCreditCost: Boolean,
1431 dontSubtractPurchasePlatinumCost: Boolean,
1432 dontSubtractPurchaseItemCost: Boolean,
1433 dontSubtractPurchaseStandingCost: Boolean,
1434 dontSubtractVoidTraces: Boolean,
1435 dontSubtractConsumables: Boolean,
1430 1436 infiniteCredits: Boolean,
1431 1437 infinitePlatinum: Boolean,
1432 1438 infiniteEndo: Boolean,
1433 1439 infiniteRegalAya: Boolean,
1434 1440 infiniteHelminthMaterials: Boolean,
1441 universalPolarityEverywhere: Boolean,
1442 unlockDoubleCapacityPotatoesEverywhere: Boolean,
1443 unlockExilusEverywhere: Boolean,
1444 unlockArcanesEverywhere: Boolean,
1445 syndicateMissionsRepeatable: Boolean,
1446 instantFinishRivenChallenge: Boolean,
1447 noDailyStandingLimits: Boolean,
1448 noDailyFocusLimit: Boolean,
1449 noArgonCrystalDecay: Boolean,
1450 noMasteryRankUpCooldown: Boolean,
1451 noVendorPurchaseLimits: Boolean,
1452 noDeathMarks: Boolean,
1453 noKimCooldowns: Boolean,
1454 skipClanKeyCrafting: Boolean,
1455 claimingBlueprintRefundsIngredients: Boolean,
1456 instantResourceExtractorDrones: Boolean,
1457 noResourceExtractorDronesDamage: Boolean,
1435 1458
1436 1459 SubscribedToEmails: { type: Number, default: 0 },
1437 1460 SubscribedToEmailsPersonalized: { type: Number, default: 0 },
Modified src/services/configService.ts +0 -23
@@ -20,39 +20,16 @@ export interface IConfig {
20 20 skipTutorial?: boolean;
21 21 skipAllDialogue?: boolean;
22 22 unlockAllScans?: boolean;
23 claimingBlueprintRefundsIngredients?: boolean;
24 dontSubtractPurchaseCreditCost?: boolean;
25 dontSubtractPurchasePlatinumCost?: boolean;
26 dontSubtractPurchaseItemCost?: boolean;
27 dontSubtractPurchaseStandingCost?: boolean;
28 dontSubtractVoidTraces?: boolean;
29 dontSubtractConsumables?: boolean;
30 23 unlockAllShipFeatures?: boolean;
31 24 unlockAllShipDecorations?: boolean;
32 25 unlockAllFlavourItems?: boolean;
33 26 unlockAllSkins?: boolean;
34 27 unlockAllCapturaScenes?: boolean;
35 28 unlockAllDecoRecipes?: boolean;
36 universalPolarityEverywhere?: boolean;
37 unlockDoubleCapacityPotatoesEverywhere?: boolean;
38 unlockExilusEverywhere?: boolean;
39 unlockArcanesEverywhere?: boolean;
40 noDailyStandingLimits?: boolean;
41 noDailyFocusLimit?: boolean;
42 noArgonCrystalDecay?: boolean;
43 noMasteryRankUpCooldown?: boolean;
44 noVendorPurchaseLimits?: boolean;
45 noDeathMarks?: boolean;
46 noKimCooldowns?: boolean;
47 29 fullyStockedVendors?: boolean;
48 30 baroAlwaysAvailable?: boolean;
49 31 baroFullyStocked?: boolean;
50 syndicateMissionsRepeatable?: boolean;
51 32 unlockAllProfitTakerStages?: boolean;
52 instantFinishRivenChallenge?: boolean;
53 instantResourceExtractorDrones?: boolean;
54 noResourceExtractorDronesDamage?: boolean;
55 skipClanKeyCrafting?: boolean;
56 33 noDojoRoomBuildStage?: boolean;
57 34 noDojoDecoBuildStage?: boolean;
58 35 fastDojoRoomDestruction?: boolean;
Modified src/services/guildService.ts +1 -1
Modified src/services/inventoryService.ts +9 -5
Modified src/services/missionInventoryUpdateService.ts +4 -4
Modified src/services/purchaseService.ts +13 -14
Modified src/types/inventoryTypes/inventoryTypes.ts +23 -0
Modified static/webui/index.html +92 -92