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