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: considering Zaw parts to be weapons instead of miscitems (#280)

7d169b7c
Sainan <sainan@calamity.gg>
提交于

代码差异

2 个文件 +14 -3
Modified src/controllers/custom/getItemListsController.ts +9 -3
@@ -1,5 +1,5 @@
1 1 import { RequestHandler } from "express";
2 import { MinItem, warframes, weapons, items, getEnglishString } from "@/src/services/itemDataService";
2 import { MinItem, MinWeapon, warframes, weapons, items, getEnglishString } from "@/src/services/itemDataService";
3 3 import badItems from "@/static/json/exclude-mods.json";
4 4 import ExportArcanes from "@/node_modules/warframe-public-export-plus/ExportArcanes.json";
5 5
@@ -29,9 +29,15 @@ const getItemListsController: RequestHandler = (_req, res) => {
29 29 }
30 30 res.json({
31 31 warframes: reduceItems(warframes),
32 weapons: reduceItems(weapons.filter(item => item.productCategory != "OperatorAmps")),
32 weapons: reduceItems(weapons.filter(item => item.productCategory != "OperatorAmps" && item.totalDamage != 0)),
33 33 miscitems: reduceItems(
34 items.filter(item => item.category == "Misc" || item.category == "Resources" || item.category == "Fish")
34 items.filter(
35 item =>
36 item.category == "Misc" ||
37 item.category == "Resources" ||
38 item.category == "Fish" ||
39 ((item as any).productCategory == "Pistols" && (item as MinWeapon).totalDamage == 0)
40 )
35 41 ),
36 42 mods,
37 43 badItems
Modified src/services/itemDataService.ts +5 -0
@@ -41,6 +41,11 @@ export const getWeaponType = (weaponName: string) => {
41 41 throw new Error(`unknown weapon ${weaponName}`);
42 42 }
43 43
44 // Many non-weapon items are "Pistols" in Public Export, so some duck typing is needed.
45 if (weaponInfo.totalDamage == 0) {
46 throw new Error(`${weaponName} doesn't quack like a weapon`);
47 }
48
44 49 const weaponType = weaponInfo.productCategory as WeaponTypeInternal;
45 50
46 51 if (!weaponType) {