fix: considering Zaw parts to be weapons instead of miscitems (#280)

This commit is contained in:
Sainan 2024-06-06 14:23:46 +02:00 committed by GitHub
parent f80da06754
commit 7d169b7c56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { RequestHandler } from "express";
import { MinItem, warframes, weapons, items, getEnglishString } from "@/src/services/itemDataService";
import { MinItem, MinWeapon, warframes, weapons, items, getEnglishString } from "@/src/services/itemDataService";
import badItems from "@/static/json/exclude-mods.json";
import ExportArcanes from "@/node_modules/warframe-public-export-plus/ExportArcanes.json";
@ -29,9 +29,15 @@ const getItemListsController: RequestHandler = (_req, res) => {
}
res.json({
warframes: reduceItems(warframes),
weapons: reduceItems(weapons.filter(item => item.productCategory != "OperatorAmps")),
weapons: reduceItems(weapons.filter(item => item.productCategory != "OperatorAmps" && item.totalDamage != 0)),
miscitems: reduceItems(
items.filter(item => item.category == "Misc" || item.category == "Resources" || item.category == "Fish")
items.filter(
item =>
item.category == "Misc" ||
item.category == "Resources" ||
item.category == "Fish" ||
((item as any).productCategory == "Pistols" && (item as MinWeapon).totalDamage == 0)
)
),
mods,
badItems

View File

@ -41,6 +41,11 @@ export const getWeaponType = (weaponName: string) => {
throw new Error(`unknown weapon ${weaponName}`);
}
// Many non-weapon items are "Pistols" in Public Export, so some duck typing is needed.
if (weaponInfo.totalDamage == 0) {
throw new Error(`${weaponName} doesn't quack like a weapon`);
}
const weaponType = weaponInfo.productCategory as WeaponTypeInternal;
if (!weaponType) {