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 unlockAllSimarisResearchEntries to a per-account button (#2726)

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

662d8243
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

7 个文件 +49 -32
Modified src/controllers/api/inventoryController.ts +0 -13
@@ -486,19 +486,6 @@ export const getInventoryResponse = async (
486 486 }
487 487 }
488 488
489 if (config.unlockAllSimarisResearchEntries) {
490 inventoryResponse.LibraryPersonalTarget = undefined;
491 inventoryResponse.LibraryPersonalProgress = [
492 "/Lotus/Types/Game/Library/Targets/Research1Target",
493 "/Lotus/Types/Game/Library/Targets/Research2Target",
494 "/Lotus/Types/Game/Library/Targets/Research3Target",
495 "/Lotus/Types/Game/Library/Targets/Research4Target",
496 "/Lotus/Types/Game/Library/Targets/Research5Target",
497 "/Lotus/Types/Game/Library/Targets/Research6Target",
498 "/Lotus/Types/Game/Library/Targets/Research7Target"
499 ].map(type => ({ TargetType: type, Scans: 10, Completed: true }));
500 }
501
502 489 return inventoryResponse;
503 490 };
504 491
Added src/controllers/custom/unlockAllSimarisResearchEntriesController.ts +20 -0
@@ -0,0 +1,20 @@
1 import type { RequestHandler } from "express";
2 import { getAccountIdForRequest } from "../../services/loginService.ts";
3 import { getInventory } from "../../services/inventoryService.ts";
4
5 export const unlockAllSimarisResearchEntriesController: RequestHandler = async (req, res) => {
6 const accountId = await getAccountIdForRequest(req);
7 const inventory = await getInventory(accountId, "LibraryPersonalTarget LibraryPersonalProgress");
8 inventory.LibraryPersonalTarget = undefined;
9 inventory.LibraryPersonalProgress = [
10 "/Lotus/Types/Game/Library/Targets/Research1Target",
11 "/Lotus/Types/Game/Library/Targets/Research2Target",
12 "/Lotus/Types/Game/Library/Targets/Research3Target",
13 "/Lotus/Types/Game/Library/Targets/Research4Target",
14 "/Lotus/Types/Game/Library/Targets/Research5Target",
15 "/Lotus/Types/Game/Library/Targets/Research6Target",
16 "/Lotus/Types/Game/Library/Targets/Research7Target"
17 ].map(type => ({ TargetType: type, Scans: 10, Completed: true }));
18 await inventory.save();
19 res.end();
20 };
Modified src/routes/custom.ts +2 -0
@@ -15,6 +15,7 @@ import { webuiFileChangeDetectedController } from "../controllers/custom/webuiFi
15 15 import { completeAllMissionsController } from "../controllers/custom/completeAllMissionsController.ts";
16 16 import { addMissingHelminthBlueprintsController } from "../controllers/custom/addMissingHelminthBlueprintsController.ts";
17 17 import { unlockAllProfitTakerStagesController } from "../controllers/custom/unlockAllProfitTakerStagesController.ts";
18 import { unlockAllSimarisResearchEntriesController } from "../controllers/custom/unlockAllSimarisResearchEntriesController.ts";
18 19
19 20 import { abilityOverrideController } from "../controllers/custom/abilityOverrideController.ts";
20 21 import { createAccountController } from "../controllers/custom/createAccountController.ts";
@@ -50,6 +51,7 @@ customRouter.get("/webuiFileChangeDetected", webuiFileChangeDetectedController);
50 51 customRouter.get("/completeAllMissions", completeAllMissionsController);
51 52 customRouter.get("/addMissingHelminthBlueprints", addMissingHelminthBlueprintsController);
52 53 customRouter.get("/unlockAllProfitTakerStages", unlockAllProfitTakerStagesController);
54 customRouter.get("/unlockAllSimarisResearchEntries", unlockAllSimarisResearchEntriesController);
53 55
54 56 customRouter.post("/abilityOverride", abilityOverrideController);
55 57 customRouter.post("/createAccount", createAccountController);
Modified src/services/configService.ts +3 -7
@@ -4,7 +4,7 @@ import { repoDir } from "../helpers/pathHelper.ts";
4 4 import { args } from "../helpers/commandLineArguments.ts";
5 5 import { Inbox } from "../models/inboxModel.ts";
6 6
7 export interface IConfig extends IConfigRemovedOptions {
7 export interface IConfig {
8 8 mongodbUrl: string;
9 9 logger: {
10 10 files: boolean;
@@ -33,7 +33,6 @@ export interface IConfig extends IConfigRemovedOptions {
33 33 noDojoResearchCosts?: boolean;
34 34 noDojoResearchTime?: boolean;
35 35 fastClanAscension?: boolean;
36 unlockAllSimarisResearchEntries?: boolean;
37 36 spoofMasteryRank?: number;
38 37 relicRewardItemCountMultiplier?: number;
39 38 nightwaveStandingMultiplier?: number;
@@ -105,6 +104,7 @@ export const configRemovedOptionsKeys = [
105 104 "unlockExilusEverywhere",
106 105 "unlockArcanesEverywhere",
107 106 "unlockAllProfitTakerStages",
107 "unlockAllSimarisResearchEntries",
108 108 "noDailyStandingLimits",
109 109 "noDailyFocusLimit",
110 110 "noArgonCrystalDecay",
@@ -123,11 +123,7 @@ export const configRemovedOptionsKeys = [
123 123 "flawlessRelicsAlwaysGiveSilverReward",
124 124 "radiantRelicsAlwaysGiveGoldReward",
125 125 "disableDailyTribute"
126 ] as const;
127
128 type IConfigRemovedOptions = {
129 [K in (typeof configRemovedOptionsKeys)[number]]?: boolean;
130 };
126 ];
131 127
132 128 export const configPath = path.join(repoDir, args.configPath ?? "config.json");
133 129
Modified src/services/configWatcherService.ts +13 -4
@@ -1,6 +1,13 @@
1 1 import chokidar from "chokidar";
2 2 import { logger } from "../utils/logger.ts";
3 import { config, configPath, configRemovedOptionsKeys, loadConfig, syncConfigWithDatabase } from "./configService.ts";
3 import {
4 config,
5 configPath,
6 configRemovedOptionsKeys,
7 loadConfig,
8 syncConfigWithDatabase,
9 type IConfig
10 } from "./configService.ts";
4 11 import { saveConfig, shouldReloadConfig } from "./configWriterService.ts";
5 12 import { getWebPorts, startWebServer, stopWebServer } from "./webService.ts";
6 13 import { sendWsBroadcast } from "./wsService.ts";
@@ -35,9 +42,11 @@ chokidar.watch(configPath).on("change", () => {
35 42 export const validateConfig = (): void => {
36 43 let modified = false;
37 44 for (const key of configRemovedOptionsKeys) {
38 if (config[key] !== undefined) {
39 logger.debug(`Spotted removed option ${key} with value ${config[key]} in config.json.`);
40 delete config[key];
45 if (config[key as keyof IConfig] !== undefined) {
46 logger.debug(
47 `Spotted removed option ${key} with value ${String(config[key as keyof IConfig])} in config.json.`
48 );
49 delete config[key as keyof IConfig];
41 50 modified = true;
42 51 }
43 52 }
Modified static/webui/index.html +3 -6
@@ -799,10 +799,6 @@
799 799 <input class="form-check-input" type="checkbox" id="radiantRelicsAlwaysGiveGoldReward" />
800 800 <label class="form-check-label" for="radiantRelicsAlwaysGiveGoldReward" data-loc="cheats_radiantRelicsAlwaysGiveGoldReward"></label>
801 801 </div>
802 <div class="form-check">
803 <input class="form-check-input" type="checkbox" id="unlockAllSimarisResearchEntries" />
804 <label class="form-check-label" for="unlockAllSimarisResearchEntries" data-loc="cheats_unlockAllSimarisResearchEntries"></label>
805 </div>
806 802 <div class="form-check">
807 803 <input class="form-check-input" type="checkbox" id="disableDailyTribute" />
808 804 <label class="form-check-label" for="disableDailyTribute" data-loc="cheats_disableDailyTribute"></label>
@@ -812,14 +808,15 @@
812 808 <label class="form-check-label" for="finishInvasionsInOneMission" data-loc="cheats_finishInvasionsInOneMission"></label>
813 809 </div>
814 810 <div class="mt-2 mb-2 d-flex flex-wrap gap-2">
815 <button class="btn btn-primary" onclick="debounce(doUnlockAllMissions);" data-loc="cheats_unlockAllMissions"></button>
811 <button class="btn btn-primary" onclick="debounce(unlockAllMissions);" data-loc="cheats_unlockAllMissions"></button>
816 812 <button class="btn btn-primary" onclick="debounce(markAllAsRead);" data-loc="cheats_markAllAsRead"></button>
817 813 <button class="btn btn-primary" onclick="doUnlockAllFocusSchools();" data-loc="cheats_unlockAllFocusSchools"></button>
818 814 <button class="btn btn-primary" onclick="doHelminthUnlockAll();" data-loc="cheats_helminthUnlockAll"></button>
819 815 <button class="btn btn-primary" onclick="debounce(addMissingHelminthRecipes);" data-loc="cheats_addMissingSubsumedAbilities"></button>
820 816 <button class="btn btn-primary" onclick="doIntrinsicsUnlockAll();" data-loc="cheats_intrinsicsUnlockAll"></button>
821 817 <button class="btn btn-primary" onclick="debounce(doMaxPlexus);" data-loc="inventory_maxPlexus"></button>
822 <button class="btn btn-primary" onclick="debounce(doUnlockAllProfitTakerStages);" data-loc="cheats_unlockAllProfitTakerStages"></button>
818 <button class="btn btn-primary" onclick="debounce(unlockAllProfitTakerStages);" data-loc="cheats_unlockAllProfitTakerStages"></button>
819 <button class="btn btn-primary" onclick="debounce(unlockAllSimarisResearchEntries);" data-loc="cheats_unlockAllSimarisResearchEntries"></button>
823 820 </div>
824 821 <form class="mt-2" onsubmit="doChangeSupportedSyndicate(); return false;">
825 822 <label class="form-label" for="changeSyndicate" data-loc="cheats_changeSupportedSyndicate"></label>
Modified static/webui/script.js +8 -2
@@ -2750,18 +2750,24 @@ async function doMaxPlexus() {
2750 2750 }
2751 2751 }
2752 2752
2753 async function doUnlockAllMissions() {
2753 async function unlockAllMissions() {
2754 2754 await revalidateAuthz();
2755 2755 await fetch("/custom/completeAllMissions?" + window.authz);
2756 2756 toast(loc("cheats_unlockAllMissions_ok"));
2757 2757 }
2758 2758
2759 async function doUnlockAllProfitTakerStages() {
2759 async function unlockAllProfitTakerStages() {
2760 2760 await revalidateAuthz();
2761 2761 await fetch("/custom/unlockAllProfitTakerStages?" + window.authz);
2762 2762 toast(loc("cheats_unlockSucc"));
2763 2763 }
2764 2764
2765 async function unlockAllSimarisResearchEntries() {
2766 await revalidateAuthz();
2767 await fetch("/custom/unlockAllSimarisResearchEntries?" + window.authz);
2768 toast(loc("cheats_unlockSucc"));
2769 }
2770
2765 2771 const importSamples = {
2766 2772 maxFocus: {
2767 2773 FocusUpgrades: [