chore: use ExportKeys for quests not in questCompletionItems
All checks were successful
Build / build (18) (push) Successful in 42s
Build / build (22) (push) Successful in 1m11s
Build / build (20) (push) Successful in 1m16s
Build / build (18) (pull_request) Successful in 44s
Build / build (20) (pull_request) Successful in 1m13s
Build / build (22) (pull_request) Successful in 1m11s

This commit is contained in:
Sainan 2025-03-29 23:32:25 +01:00
parent 895b9381ca
commit 4d2452b1ad

View File

@ -203,12 +203,27 @@ export const getNode = (nodeName: string): IRegion => {
};
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) {
logger.error(
`Quest ${questKey} not found in questCompletionItems, quest completion items have not been given. This is a temporary solution`
);
const items: ITypeCount[] = [];
const meta = ExportKeys[questKey];
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;
};