XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

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>

a259afe9
Ordis <134585663+OrdisPrime@users.noreply.github.com>
提交于

代码差异

3 个文件 +20 -10
Modified src/controllers/custom/manageQuestsController.ts +9 -2
@@ -13,7 +13,8 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
13 13 | "completeAll"
14 14 | "ResetAll"
15 15 | "completeAllUnlocked"
16 | "updateKey";
16 | "updateKey"
17 | "giveAll";
17 18 const questKeyUpdate = req.body as IUpdateQuestRequest["QuestKeys"];
18 19
19 20 const allQuestKeys: string[] = [];
@@ -71,6 +72,7 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
71 72 for (const questKey of inventory.QuestKeys) {
72 73 questKey.Completed = false;
73 74 questKey.Progress = [];
75 questKey.CompletionDate = undefined;
74 76 }
75 77 inventory.ActiveQuest = "";
76 78 break;
@@ -78,7 +80,6 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
78 80 case "completeAllUnlocked": {
79 81 logger.info("completing all unlocked quests..");
80 82 for (const questKey of inventory.QuestKeys) {
81 console.log("size of questkeys", inventory.QuestKeys.length);
82 83 try {
83 84 await completeQuest(inventory, questKey.ItemType);
84 85 } catch (error) {
@@ -105,6 +106,12 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
105 106 inventory.ActiveQuest = "";
106 107 break;
107 108 }
109 case "giveAll": {
110 for (const questKey of allQuestKeys) {
111 addQuestKey(inventory, { ItemType: questKey });
112 }
113 break;
114 }
108 115 }
109 116
110 117 await inventory.save();
Modified static/webui/index.html +6 -4
@@ -539,10 +539,12 @@
539 539 </form>
540 540 <h5 class="mt-3" data-loc="cheats_quests"></h6>
541 541 <div class="mb-2 d-flex flex-wrap gap-2">
542 <button class="btn btn-primary" onclick="doQuestUpdate('unlockAll');" data-loc="cheats_quests_UnlockAll"></button>
543 <button class="btn btn-primary" onclick="doQuestUpdate('completeAll');" data-loc="cheats_quests_CompleteAll"></button>
544 <button class="btn btn-primary" onclick="doQuestUpdate('completeAllUnlocked');" data-loc="cheats_quests_CompleteAllUnlocked"></button>
545 <button class="btn btn-primary" onclick="doQuestUpdate('ResetAll');" data-loc="cheats_quests_ResetAll"></button>
542 <button class="btn btn-primary" onclick="doQuestUpdate('unlockAll');" data-loc="cheats_quests_unlockAll"></button>
543 <button class="btn btn-primary" onclick="doQuestUpdate('completeAll');" data-loc="cheats_quests_completeAll"></button>
544 <button class="btn btn-primary" onclick="doQuestUpdate('completeAllUnlocked');" data-loc="cheats_quests_completeAllUnlocked"></button>
545 <button class="btn btn-primary" onclick="doQuestUpdate('ResetAll');" data-loc="cheats_quests_resetAll"></button>
546 <button class="btn btn-primary" onclick="doQuestUpdate('giveAll');" data-loc="cheats_quests_giveAll"></button>
547
546 548 </div>
547 549 </div>
548 550 </div>
Modified static/webui/translations/en.js +5 -4
@@ -118,10 +118,11 @@ dict = {
118 118 cheats_changeButton: `Change`,
119 119 cheats_none: `None`,
120 120 cheats_quests: `Quests`,
121 cheats_quests_UnlockAll: `Unlock All Quests`,
122 cheats_quests_CompleteAll: `Complete All Quests`,
123 cheats_quests_CompleteAllUnlocked: `Complete All Unlocked Quests`,
124 cheats_quests_ResetAll: `Reset All Quests`,
121 cheats_quests_unlockAll: `Unlock All Quests`,
122 cheats_quests_completeAll: `Complete All Quests`,
123 cheats_quests_completeAllUnlocked: `Complete All Unlocked Quests`,
124 cheats_quests_resetAll: `Reset All Quests`,
125 cheats_quests_giveAll: `Give All Quests`,
125 126 import_importNote: `You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.`,
126 127 import_submit: `Submit`
127 128 };