From a259afe912e0066577ffb1c0447abf643fb5cf98 Mon Sep 17 00:00:00 2001 From: Ordis <134585663+OrdisPrime@users.noreply.github.com> Date: Fri, 21 Feb 2025 05:30:13 -0800 Subject: [PATCH] feat(webui): give all quests (#981) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/981 Co-authored-by: Ordis <134585663+OrdisPrime@users.noreply.github.com> Co-committed-by: Ordis <134585663+OrdisPrime@users.noreply.github.com> --- src/controllers/custom/manageQuestsController.ts | 11 +++++++++-- static/webui/index.html | 10 ++++++---- static/webui/translations/en.js | 9 +++++---- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/controllers/custom/manageQuestsController.ts b/src/controllers/custom/manageQuestsController.ts index 49283bf3..edf1feae 100644 --- a/src/controllers/custom/manageQuestsController.ts +++ b/src/controllers/custom/manageQuestsController.ts @@ -13,7 +13,8 @@ export const manageQuestsController: RequestHandler = async (req, res) => { | "completeAll" | "ResetAll" | "completeAllUnlocked" - | "updateKey"; + | "updateKey" + | "giveAll"; const questKeyUpdate = req.body as IUpdateQuestRequest["QuestKeys"]; const allQuestKeys: string[] = []; @@ -71,6 +72,7 @@ export const manageQuestsController: RequestHandler = async (req, res) => { for (const questKey of inventory.QuestKeys) { questKey.Completed = false; questKey.Progress = []; + questKey.CompletionDate = undefined; } inventory.ActiveQuest = ""; break; @@ -78,7 +80,6 @@ export const manageQuestsController: RequestHandler = async (req, res) => { case "completeAllUnlocked": { logger.info("completing all unlocked quests.."); for (const questKey of inventory.QuestKeys) { - console.log("size of questkeys", inventory.QuestKeys.length); try { await completeQuest(inventory, questKey.ItemType); } catch (error) { @@ -105,6 +106,12 @@ export const manageQuestsController: RequestHandler = async (req, res) => { inventory.ActiveQuest = ""; break; } + case "giveAll": { + for (const questKey of allQuestKeys) { + addQuestKey(inventory, { ItemType: questKey }); + } + break; + } } await inventory.save(); diff --git a/static/webui/index.html b/static/webui/index.html index 6af03e3c..081ca3d2 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -539,10 +539,12 @@
- - - - + + + + + +
diff --git a/static/webui/translations/en.js b/static/webui/translations/en.js index 70203a0f..77cadccc 100644 --- a/static/webui/translations/en.js +++ b/static/webui/translations/en.js @@ -118,10 +118,11 @@ dict = { cheats_changeButton: `Change`, cheats_none: `None`, cheats_quests: `Quests`, - cheats_quests_UnlockAll: `Unlock All Quests`, - cheats_quests_CompleteAll: `Complete All Quests`, - cheats_quests_CompleteAllUnlocked: `Complete All Unlocked Quests`, - cheats_quests_ResetAll: `Reset All Quests`, + cheats_quests_unlockAll: `Unlock All Quests`, + cheats_quests_completeAll: `Complete All Quests`, + cheats_quests_completeAllUnlocked: `Complete All Unlocked Quests`, + cheats_quests_resetAll: `Reset All Quests`, + cheats_quests_giveAll: `Give All Quests`, import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer will be overwritten in your account.`, import_submit: `Submit` };