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

SpaceNinjaServer

A simple server for a small space ninja game

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

XFEstudio/SpaceNinjaServer

fix: handle boosters in store item utilities (#1894)

e.g. `/Lotus/Types/StoreItems/Boosters/AffinityBoosterStoreItem` Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1894 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

7a295a86
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

1 个文件 +18 -2
Modified src/services/itemDataService.ts +18 -2
@@ -17,6 +17,7 @@ import {
17 17 dict_uk,
18 18 dict_zh,
19 19 ExportArcanes,
20 ExportBoosters,
20 21 ExportCustoms,
21 22 ExportDrones,
22 23 ExportGear,
@@ -217,15 +218,30 @@ export const convertInboxMessage = (message: IInboxMessage): IMessage => {
217 218 };
218 219
219 220 export const isStoreItem = (type: string): boolean => {
220 return type.startsWith("/Lotus/StoreItems/");
221 return type.startsWith("/Lotus/StoreItems/") || type in ExportBoosters;
221 222 };
222 223
223 224 export const toStoreItem = (type: string): string => {
225 if (type.startsWith("/Lotus/Types/StoreItems/Boosters/")) {
226 const boosterEntry = Object.entries(ExportBoosters).find(arr => arr[1].typeName == type);
227 if (boosterEntry) {
228 return boosterEntry[0];
229 }
230 throw new Error(`could not convert ${type} to a store item`);
231 }
224 232 return "/Lotus/StoreItems/" + type.substring("/Lotus/".length);
225 233 };
226 234
227 235 export const fromStoreItem = (type: string): string => {
228 return "/Lotus/" + type.substring("/Lotus/StoreItems/".length);
236 if (type.startsWith("/Lotus/StoreItems/")) {
237 return "/Lotus/" + type.substring("/Lotus/StoreItems/".length);
238 }
239
240 if (type in ExportBoosters) {
241 return ExportBoosters[type].typeName;
242 }
243
244 throw new Error(`${type} is not a store item`);
229 245 };
230 246
231 247 export const getDefaultUpgrades = (parts: string[]): IDefaultUpgrade[] | undefined => {