fix: considering Zaw parts to be weapons instead of miscitems (#280)
This commit is contained in:
		
							parent
							
								
									f80da06754
								
							
						
					
					
						commit
						7d169b7c56
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -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) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user