返回提交历史
Modified
src/services/itemDataService.ts
+21
-6
XFEstudio/XFESpaceNinjaServer
chore: use ExportKeys for quests not in questCompletionItems (#1377)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1377 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
3beb1ecc
代码差异
1 个文件
+21
-6
@@ -203,12 +203,27 @@ export const getNode = (nodeName: string): IRegion => {
203
203
};
204
204
205
205
export const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined => {
206
const items = (questCompletionItems as unknown as Record<string, ITypeCount[]> | undefined)?.[questKey];
207
208
if (!items) {
209
logger.error(
210
`Quest ${questKey} not found in questCompletionItems, quest completion items have not been given. This is a temporary solution`
211
);
206
if (questKey in questCompletionItems) {
207
return questCompletionItems[questKey as keyof typeof questCompletionItems];
208
}
209
logger.warn(`Quest ${questKey} not found in questCompletionItems`);
210
211
const items: ITypeCount[] = [];
212
const meta = ExportKeys[questKey];
213
if (meta.rewards) {
214
for (const reward of meta.rewards) {
215
if (reward.rewardType == "RT_STORE_ITEM") {
216
items.push({
217
ItemType: fromStoreItem(reward.itemType),
218
ItemCount: 1
219
});
220
} else if (reward.rewardType == "RT_RESOURCE" || reward.rewardType == "RT_RECIPE") {
221
items.push({
222
ItemType: reward.itemType,
223
ItemCount: reward.amount
224
});
225
}
226
}
212
227
}
213
228
return items;
214
229
};