forked from OpenWF/SpaceNinjaServer
		
	fix(webui): not listing melee arcanes (#265)
This commit is contained in:
		
							parent
							
								
									defaf61b79
								
							
						
					
					
						commit
						fd79450957
					
				
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -13,6 +13,7 @@
 | 
				
			|||||||
        "express": "^5.0.0-beta.3",
 | 
					        "express": "^5.0.0-beta.3",
 | 
				
			||||||
        "mongoose": "^8.1.1",
 | 
					        "mongoose": "^8.1.1",
 | 
				
			||||||
        "warframe-items": "^1.1261.19",
 | 
					        "warframe-items": "^1.1261.19",
 | 
				
			||||||
 | 
					        "warframe-public-export-plus": "^0.1.0",
 | 
				
			||||||
        "warframe-riven-info": "^0.1.0",
 | 
					        "warframe-riven-info": "^0.1.0",
 | 
				
			||||||
        "winston": "^3.11.0",
 | 
					        "winston": "^3.11.0",
 | 
				
			||||||
        "winston-daily-rotate-file": "^4.7.1"
 | 
					        "winston-daily-rotate-file": "^4.7.1"
 | 
				
			||||||
@ -3893,6 +3894,11 @@
 | 
				
			|||||||
        "warframe-worldstate-data": "^2"
 | 
					        "warframe-worldstate-data": "^2"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/warframe-public-export-plus": {
 | 
				
			||||||
 | 
					      "version": "0.1.0",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.1.0.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-a76Be2pwPjKrin67zMux5L9U6zt9bhEtyy723tM2czGGcOZYWp1XdCZY684q3zPytWS0SmEia0C/h/4EiadBnQ=="
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/warframe-riven-info": {
 | 
					    "node_modules/warframe-riven-info": {
 | 
				
			||||||
      "version": "0.1.0",
 | 
					      "version": "0.1.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/warframe-riven-info/-/warframe-riven-info-0.1.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/warframe-riven-info/-/warframe-riven-info-0.1.0.tgz",
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@
 | 
				
			|||||||
    "express": "^5.0.0-beta.3",
 | 
					    "express": "^5.0.0-beta.3",
 | 
				
			||||||
    "mongoose": "^8.1.1",
 | 
					    "mongoose": "^8.1.1",
 | 
				
			||||||
    "warframe-items": "^1.1261.19",
 | 
					    "warframe-items": "^1.1261.19",
 | 
				
			||||||
 | 
					    "warframe-public-export-plus": "^0.1.0",
 | 
				
			||||||
    "warframe-riven-info": "^0.1.0",
 | 
					    "warframe-riven-info": "^0.1.0",
 | 
				
			||||||
    "winston": "^3.11.0",
 | 
					    "winston": "^3.11.0",
 | 
				
			||||||
    "winston-daily-rotate-file": "^4.7.1"
 | 
					    "winston-daily-rotate-file": "^4.7.1"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { MinItem, warframes, weapons, items } from "@/src/services/itemDataService";
 | 
					import { MinItem, warframes, weapons, 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";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface ListedItem {
 | 
					interface ListedItem {
 | 
				
			||||||
    uniqueName: string;
 | 
					    uniqueName: string;
 | 
				
			||||||
@ -19,13 +20,20 @@ function reduceItems(items: MinItem[]): ListedItem[] {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const getItemListsController: RequestHandler = (_req, res) => {
 | 
					const getItemListsController: RequestHandler = (_req, res) => {
 | 
				
			||||||
 | 
					    const mods = reduceItems(items.filter(item => item.category == "Mods"));
 | 
				
			||||||
 | 
					    for (const arcane of ExportArcanes) {
 | 
				
			||||||
 | 
					        mods.push({
 | 
				
			||||||
 | 
					            uniqueName: arcane.uniqueName,
 | 
				
			||||||
 | 
					            name: getEnglishString(arcane.name)
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    res.json({
 | 
					    res.json({
 | 
				
			||||||
        warframes: reduceItems(warframes),
 | 
					        warframes: reduceItems(warframes),
 | 
				
			||||||
        weapons: reduceItems(weapons.filter(item => item.productCategory != "OperatorAmps")),
 | 
					        weapons: reduceItems(weapons.filter(item => item.productCategory != "OperatorAmps")),
 | 
				
			||||||
        miscitems: reduceItems(
 | 
					        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")
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
        mods: reduceItems(items.filter(item => item.category == "Mods" || item.category == "Arcanes")),
 | 
					        mods,
 | 
				
			||||||
        badItems
 | 
					        badItems
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -2,6 +2,7 @@ import { getIndexAfter } from "@/src/helpers/stringHelpers";
 | 
				
			|||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warframe-items";
 | 
					import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warframe-items";
 | 
				
			||||||
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";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type MinWarframe = Omit<Warframe, "patchlogs">;
 | 
					export type MinWarframe = Omit<Warframe, "patchlogs">;
 | 
				
			||||||
export type MinWeapon = Omit<Weapon, "patchlogs">;
 | 
					export type MinWeapon = Omit<Weapon, "patchlogs">;
 | 
				
			||||||
@ -129,3 +130,7 @@ export const getItemByName = (name: string) => {
 | 
				
			|||||||
    const item = items.find(item => item.name === name);
 | 
					    const item = items.find(item => item.name === name);
 | 
				
			||||||
    return item;
 | 
					    return item;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const getEnglishString = (key: string) => {
 | 
				
			||||||
 | 
					    return dict_en[key as keyof typeof dict_en] ?? key;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user