forked from OpenWF/SpaceNinjaServer
		
	feat(webui): give all quests (#981)
Reviewed-on: OpenWF/SpaceNinjaServer#981 Co-authored-by: Ordis <134585663+OrdisPrime@users.noreply.github.com> Co-committed-by: Ordis <134585663+OrdisPrime@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									4d7b3b543b
								
							
						
					
					
						commit
						a259afe912
					
				@ -13,7 +13,8 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        | "completeAll"
 | 
					        | "completeAll"
 | 
				
			||||||
        | "ResetAll"
 | 
					        | "ResetAll"
 | 
				
			||||||
        | "completeAllUnlocked"
 | 
					        | "completeAllUnlocked"
 | 
				
			||||||
        | "updateKey";
 | 
					        | "updateKey"
 | 
				
			||||||
 | 
					        | "giveAll";
 | 
				
			||||||
    const questKeyUpdate = req.body as IUpdateQuestRequest["QuestKeys"];
 | 
					    const questKeyUpdate = req.body as IUpdateQuestRequest["QuestKeys"];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const allQuestKeys: string[] = [];
 | 
					    const allQuestKeys: string[] = [];
 | 
				
			||||||
@ -71,6 +72,7 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
            for (const questKey of inventory.QuestKeys) {
 | 
					            for (const questKey of inventory.QuestKeys) {
 | 
				
			||||||
                questKey.Completed = false;
 | 
					                questKey.Completed = false;
 | 
				
			||||||
                questKey.Progress = [];
 | 
					                questKey.Progress = [];
 | 
				
			||||||
 | 
					                questKey.CompletionDate = undefined;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            inventory.ActiveQuest = "";
 | 
					            inventory.ActiveQuest = "";
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
@ -78,7 +80,6 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        case "completeAllUnlocked": {
 | 
					        case "completeAllUnlocked": {
 | 
				
			||||||
            logger.info("completing all unlocked quests..");
 | 
					            logger.info("completing all unlocked quests..");
 | 
				
			||||||
            for (const questKey of inventory.QuestKeys) {
 | 
					            for (const questKey of inventory.QuestKeys) {
 | 
				
			||||||
                console.log("size of questkeys", inventory.QuestKeys.length);
 | 
					 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    await completeQuest(inventory, questKey.ItemType);
 | 
					                    await completeQuest(inventory, questKey.ItemType);
 | 
				
			||||||
                } catch (error) {
 | 
					                } catch (error) {
 | 
				
			||||||
@ -105,6 +106,12 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
            inventory.ActiveQuest = "";
 | 
					            inventory.ActiveQuest = "";
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        case "giveAll": {
 | 
				
			||||||
 | 
					            for (const questKey of allQuestKeys) {
 | 
				
			||||||
 | 
					                addQuestKey(inventory, { ItemType: questKey });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
 | 
				
			|||||||
@ -539,10 +539,12 @@
 | 
				
			|||||||
                                </form>
 | 
					                                </form>
 | 
				
			||||||
                            <h5 class="mt-3" data-loc="cheats_quests"></h6>
 | 
					                            <h5 class="mt-3" data-loc="cheats_quests"></h6>
 | 
				
			||||||
                                <div class="mb-2 d-flex flex-wrap gap-2">
 | 
					                                <div class="mb-2 d-flex flex-wrap gap-2">
 | 
				
			||||||
                                    <button class="btn btn-primary" onclick="doQuestUpdate('unlockAll');" data-loc="cheats_quests_UnlockAll"></button>
 | 
					                                    <button class="btn btn-primary" onclick="doQuestUpdate('unlockAll');" data-loc="cheats_quests_unlockAll"></button>
 | 
				
			||||||
                                    <button class="btn btn-primary" onclick="doQuestUpdate('completeAll');" data-loc="cheats_quests_CompleteAll"></button>
 | 
					                                    <button class="btn btn-primary" onclick="doQuestUpdate('completeAll');" data-loc="cheats_quests_completeAll"></button>
 | 
				
			||||||
                                    <button class="btn btn-primary" onclick="doQuestUpdate('completeAllUnlocked');" data-loc="cheats_quests_CompleteAllUnlocked"></button>
 | 
					                                    <button class="btn btn-primary" onclick="doQuestUpdate('completeAllUnlocked');" data-loc="cheats_quests_completeAllUnlocked"></button>
 | 
				
			||||||
                                    <button class="btn btn-primary" onclick="doQuestUpdate('ResetAll');" data-loc="cheats_quests_ResetAll"></button>
 | 
					                                    <button class="btn btn-primary" onclick="doQuestUpdate('ResetAll');" data-loc="cheats_quests_resetAll"></button>
 | 
				
			||||||
 | 
					                                    <button class="btn btn-primary" onclick="doQuestUpdate('giveAll');" data-loc="cheats_quests_giveAll"></button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
 | 
				
			|||||||
@ -118,10 +118,11 @@ dict = {
 | 
				
			|||||||
    cheats_changeButton: `Change`,
 | 
					    cheats_changeButton: `Change`,
 | 
				
			||||||
    cheats_none: `None`,
 | 
					    cheats_none: `None`,
 | 
				
			||||||
    cheats_quests: `Quests`,
 | 
					    cheats_quests: `Quests`,
 | 
				
			||||||
    cheats_quests_UnlockAll: `Unlock All Quests`,
 | 
					    cheats_quests_unlockAll: `Unlock All Quests`,
 | 
				
			||||||
    cheats_quests_CompleteAll: `Complete All Quests`,
 | 
					    cheats_quests_completeAll: `Complete All Quests`,
 | 
				
			||||||
    cheats_quests_CompleteAllUnlocked: `Complete All Unlocked Quests`,
 | 
					    cheats_quests_completeAllUnlocked: `Complete All Unlocked Quests`,
 | 
				
			||||||
    cheats_quests_ResetAll: `Reset All 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 <b>will be overwritten</b> in your account.`,
 | 
					    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.`,
 | 
				
			||||||
    import_submit: `Submit`
 | 
					    import_submit: `Submit`
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user