返回提交历史
Modified
src/controllers/api/updateQuestController.ts
+4
-3
Modified
src/services/itemDataService.ts
+5
-3
XFEstudio/SpaceNinjaServer
fix: don't abort quest update when quest completion rewards are missing. (#937)
Temporary fix until quest completion items are added. This is wip. Your account has to own the quest keys for the quest system to work. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/937 Co-authored-by: Ordis <134585663+OrdisPrime@users.noreply.github.com> Co-committed-by: Ordis <134585663+OrdisPrime@users.noreply.github.com>
30061fb0
代码差异
2 个文件
+9
-6
@@ -30,10 +30,11 @@ export const updateQuestController: RequestHandler = async (req, res) => {
30
30
const questCompletionItems = getQuestCompletionItems(questKeyName);
31
31
logger.debug(`quest completion items`, questCompletionItems);
32
32
33
const inventoryChanges = await addItems(inventory, questCompletionItems);
33
if (questCompletionItems) {
34
const inventoryChanges = await addItems(inventory, questCompletionItems);
35
updateQuestResponse.InventoryChanges = inventoryChanges;
36
}
34
37
inventory.ActiveQuest = "";
35
36
updateQuestResponse.InventoryChanges = inventoryChanges;
37
38
}
38
39
39
40
//TODO: might need to parse the custom data and add the associated items to inventory
@@ -189,11 +189,13 @@ export const getNode = (nodeName: string): IRegion => {
189
189
};
190
190
191
191
export const getQuestCompletionItems = (questKey: string) => {
192
const items = (questCompletionItems as unknown as Record<string, ITypeCount[] | undefined>)[questKey];
192
const items = (questCompletionItems as unknown as Record<string, ITypeCount[]> | undefined)?.[questKey];
193
193
194
if (!items) {
194
throw new Error(`Quest ${questKey} not found in questCompletionItems`);
195
logger.error(
196
`Quest ${questKey} not found in questCompletionItems, quest completion items have not been given. This is a temporary solution`
197
);
195
198
}
196
197
199
return items;
198
200
};
199
201