fix: being unable to add Grimoire
This commit is contained in:
		
							parent
							
								
									6ca887fc7b
								
							
						
					
					
						commit
						cbcb845c41
					
				@ -1,7 +1,8 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { MinItem, MinWeapon, warframes, weapons, items, getEnglishString } from "@/src/services/itemDataService";
 | 
					import { MinItem, MinWeapon, warframes, items, getEnglishString } from "@/src/services/itemDataService";
 | 
				
			||||||
import badItems from "@/static/json/exclude-mods.json";
 | 
					import badItems from "@/static/json/exclude-mods.json";
 | 
				
			||||||
import ExportArcanes from "@/node_modules/warframe-public-export-plus/ExportArcanes.json";
 | 
					import ExportArcanes from "@/node_modules/warframe-public-export-plus/ExportArcanes.json";
 | 
				
			||||||
 | 
					import ExportWeapons from "@/node_modules/warframe-public-export-plus/ExportWeapons.json";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface ListedItem {
 | 
					interface ListedItem {
 | 
				
			||||||
    uniqueName: string;
 | 
					    uniqueName: string;
 | 
				
			||||||
@ -29,7 +30,17 @@ const getItemListsController: RequestHandler = (_req, res) => {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    res.json({
 | 
					    res.json({
 | 
				
			||||||
        warframes: reduceItems(warframes),
 | 
					        warframes: reduceItems(warframes),
 | 
				
			||||||
        weapons: reduceItems(weapons.filter(item => item.productCategory != "OperatorAmps" && item.totalDamage != 0)),
 | 
					        weapons: Object.entries(ExportWeapons)
 | 
				
			||||||
 | 
					            .filter(
 | 
				
			||||||
 | 
					                ([_uniqueName, weapon]: [string, any]) =>
 | 
				
			||||||
 | 
					                    weapon.productCategory !== "OperatorAmps" && weapon.totalDamage !== 0
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					            .map(([uniqueName, weapon]: [string, any]) => {
 | 
				
			||||||
 | 
					                return {
 | 
				
			||||||
 | 
					                    uniqueName,
 | 
				
			||||||
 | 
					                    name: getEnglishString(weapon.name)
 | 
				
			||||||
 | 
					                };
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
        miscitems: reduceItems(
 | 
					        miscitems: reduceItems(
 | 
				
			||||||
            items.filter(
 | 
					            items.filter(
 | 
				
			||||||
                item =>
 | 
					                item =>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,4 @@
 | 
				
			|||||||
import { isString } from "@/src/helpers/general";
 | 
					import { isString } from "@/src/helpers/general";
 | 
				
			||||||
import { items } from "@/src/services/itemDataService";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export enum ItemType {
 | 
					export enum ItemType {
 | 
				
			||||||
    Powersuit = "Powersuit",
 | 
					    Powersuit = "Powersuit",
 | 
				
			||||||
@ -22,13 +21,9 @@ interface IAddItemRequest {
 | 
				
			|||||||
    type: ItemType;
 | 
					    type: ItemType;
 | 
				
			||||||
    InternalName: string;
 | 
					    InternalName: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
export const isInternalItemName = (internalName: string): boolean => {
 | 
					 | 
				
			||||||
    const item = items.find(i => i.uniqueName === internalName);
 | 
					 | 
				
			||||||
    return Boolean(item);
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const parseInternalItemName = (internalName: unknown): string => {
 | 
					const parseInternalItemName = (internalName: unknown): string => {
 | 
				
			||||||
    if (!isString(internalName) || !isInternalItemName(internalName)) {
 | 
					    if (!isString(internalName)) {
 | 
				
			||||||
        throw new Error("incorrect internal name");
 | 
					        throw new Error("incorrect internal name");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,7 @@ import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warfr
 | 
				
			|||||||
import badItems from "@/static/json/exclude-mods.json";
 | 
					import badItems from "@/static/json/exclude-mods.json";
 | 
				
			||||||
import dict_en from "@/node_modules/warframe-public-export-plus/dict.en.json";
 | 
					import dict_en from "@/node_modules/warframe-public-export-plus/dict.en.json";
 | 
				
			||||||
import ExportWarframes from "@/node_modules/warframe-public-export-plus/ExportWarframes.json";
 | 
					import ExportWarframes from "@/node_modules/warframe-public-export-plus/ExportWarframes.json";
 | 
				
			||||||
 | 
					import ExportWeapons from "@/node_modules/warframe-public-export-plus/ExportWeapons.json";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type MinWarframe = Omit<Warframe, "patchlogs">;
 | 
					export type MinWarframe = Omit<Warframe, "patchlogs">;
 | 
				
			||||||
export type MinWeapon = Omit<Weapon, "patchlogs">;
 | 
					export type MinWeapon = Omit<Weapon, "patchlogs">;
 | 
				
			||||||
@ -19,13 +20,13 @@ export const warframes: MinWarframe[] = Array.from(new Items({ category: ["Warfr
 | 
				
			|||||||
        return next;
 | 
					        return next;
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const weapons: MinWeapon[] = Array.from(
 | 
					const weapons: MinWeapon[] = Array.from(new Items({ category: ["Primary", "Secondary", "Melee"] }) as Weapon[]).map(
 | 
				
			||||||
    new Items({ category: ["Primary", "Secondary", "Melee"] }) as Weapon[]
 | 
					    item => {
 | 
				
			||||||
).map(item => {
 | 
					 | 
				
			||||||
        const next = { ...item };
 | 
					        const next = { ...item };
 | 
				
			||||||
        delete next.patchlogs;
 | 
					        delete next.patchlogs;
 | 
				
			||||||
        return next;
 | 
					        return next;
 | 
				
			||||||
});
 | 
					    }
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type WeaponTypeInternal = "LongGuns" | "Pistols" | "Melee";
 | 
					export type WeaponTypeInternal = "LongGuns" | "Pistols" | "Melee";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -36,7 +37,7 @@ export const items: MinItem[] = Array.from(new Items({ category: ["All"] }) as M
 | 
				
			|||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const getWeaponType = (weaponName: string) => {
 | 
					export const getWeaponType = (weaponName: string) => {
 | 
				
			||||||
    const weaponInfo = weapons.find(i => i.uniqueName === weaponName);
 | 
					    const weaponInfo = (ExportWeapons as PublicExportPlus.IGenericExport)[weaponName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!weaponInfo) {
 | 
					    if (!weaponInfo) {
 | 
				
			||||||
        throw new Error(`unknown weapon ${weaponName}`);
 | 
					        throw new Error(`unknown weapon ${weaponName}`);
 | 
				
			||||||
 | 
				
			|||||||
@ -95,8 +95,7 @@ window.itemListPromise = new Promise(resolve => {
 | 
				
			|||||||
            "/Lotus/Weapons/Tenno/Rifle/LotusRifle": { name: "Rifle" },
 | 
					            "/Lotus/Weapons/Tenno/Rifle/LotusRifle": { name: "Rifle" },
 | 
				
			||||||
            "/Lotus/Weapons/Tenno/Shotgun/LotusShotgun": { name: "Shotgun" },
 | 
					            "/Lotus/Weapons/Tenno/Shotgun/LotusShotgun": { name: "Shotgun" },
 | 
				
			||||||
            // Missing in data sources
 | 
					            // Missing in data sources
 | 
				
			||||||
            "/Lotus/Upgrades/CosmeticEnhancers/Peculiars/CyoteMod": { name: "Traumatic Peculiar" },
 | 
					            "/Lotus/Upgrades/CosmeticEnhancers/Peculiars/CyoteMod": { name: "Traumatic Peculiar" }
 | 
				
			||||||
            "/Lotus/Weapons/Tenno/Grimoire/TnGrimoire": { name: "Grimoire" }
 | 
					 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        for (const [type, items] of Object.entries(data)) {
 | 
					        for (const [type, items] of Object.entries(data)) {
 | 
				
			||||||
            if (type != "badItems") {
 | 
					            if (type != "badItems") {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user