XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

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
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +21 -6
Modified src/services/itemDataService.ts +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 };