add Progress
This commit is contained in:
		
							parent
							
								
									e607678b6f
								
							
						
					
					
						commit
						4ffed8c09d
					
				@ -2,6 +2,7 @@ import { addString } from "@/src/controllers/api/inventoryController";
 | 
			
		||||
import { getInventory } from "@/src/services/inventoryService";
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { addQuestKey, IUpdateQuestRequest, updateQuestKey } from "@/src/services/questService";
 | 
			
		||||
import { IQuestKeyDatabase, IQuestStage } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { ExportKeys } from "warframe-public-export-plus";
 | 
			
		||||
@ -40,12 +41,15 @@ export const manageQuestsController: RequestHandler = async (req, res) => {
 | 
			
		||||
        case "completeAll": {
 | 
			
		||||
            logger.info("completing all quests..");
 | 
			
		||||
            for (const questKey of allQuestKeys) {
 | 
			
		||||
                const chainStageTotal = ExportKeys[questKey].chainStages?.length ?? 0;
 | 
			
		||||
                const Progress = Array(chainStageTotal).fill({ c: 0, i: true, m: true, b: [] } satisfies IQuestStage);
 | 
			
		||||
                const inventoryQuestKey = inventory.QuestKeys.find(qk => qk.ItemType === questKey);
 | 
			
		||||
                if (inventoryQuestKey) {
 | 
			
		||||
                    inventoryQuestKey.Completed = true;
 | 
			
		||||
                    inventoryQuestKey.Progress = Progress;
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                addQuestKey(inventory, { ItemType: questKey, Completed: true, unlock: true, Progress: [] });
 | 
			
		||||
                addQuestKey(inventory, { ItemType: questKey, Completed: true, unlock: true, Progress: Progress });
 | 
			
		||||
            }
 | 
			
		||||
            inventory.ArchwingEnabled = true;
 | 
			
		||||
            inventory.ActiveQuest = "";
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user