forked from OpenWF/SpaceNinjaServer
		
	chore: use ExportKeys for quests not in questCompletionItems (#1377)
Reviewed-on: OpenWF/SpaceNinjaServer#1377 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									779bc34082
								
							
						
					
					
						commit
						3beb1ecc42
					
				@ -203,12 +203,27 @@ export const getNode = (nodeName: string): IRegion => {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined => {
 | 
					export const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined => {
 | 
				
			||||||
    const items = (questCompletionItems as unknown as Record<string, ITypeCount[]> | undefined)?.[questKey];
 | 
					    if (questKey in questCompletionItems) {
 | 
				
			||||||
 | 
					        return questCompletionItems[questKey as keyof typeof questCompletionItems];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    logger.warn(`Quest ${questKey} not found in questCompletionItems`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!items) {
 | 
					    const items: ITypeCount[] = [];
 | 
				
			||||||
        logger.error(
 | 
					    const meta = ExportKeys[questKey];
 | 
				
			||||||
            `Quest ${questKey} not found in questCompletionItems, quest completion items have not been given. This is a temporary solution`
 | 
					    if (meta.rewards) {
 | 
				
			||||||
        );
 | 
					        for (const reward of meta.rewards) {
 | 
				
			||||||
 | 
					            if (reward.rewardType == "RT_STORE_ITEM") {
 | 
				
			||||||
 | 
					                items.push({
 | 
				
			||||||
 | 
					                    ItemType: fromStoreItem(reward.itemType),
 | 
				
			||||||
 | 
					                    ItemCount: 1
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            } else if (reward.rewardType == "RT_RESOURCE" || reward.rewardType == "RT_RECIPE") {
 | 
				
			||||||
 | 
					                items.push({
 | 
				
			||||||
 | 
					                    ItemType: reward.itemType,
 | 
				
			||||||
 | 
					                    ItemCount: reward.amount
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return items;
 | 
					    return items;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user