forked from OpenWF/SpaceNinjaServer
chore: improve getItemCategoryByUniqueName (#2130)
unused function, but might as well make it at least half decent Reviewed-on: OpenWF/SpaceNinjaServer#2130 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
9def5c265e
commit
b7c47b91ff
@ -1,5 +1,4 @@
|
|||||||
import { IKeyChainRequest } from "@/src/types/requestTypes";
|
import { IKeyChainRequest } from "@/src/types/requestTypes";
|
||||||
import { getIndexAfter } from "@/src/helpers/stringHelpers";
|
|
||||||
import {
|
import {
|
||||||
dict_de,
|
dict_de,
|
||||||
dict_en,
|
dict_en,
|
||||||
@ -53,20 +52,32 @@ export const getRecipeByResult = (resultType: string): IRecipe | undefined => {
|
|||||||
return Object.values(ExportRecipes).find(x => x.resultType == resultType);
|
return Object.values(ExportRecipes).find(x => x.resultType == resultType);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getItemCategoryByUniqueName = (uniqueName: string): string => {
|
export const getItemCategoryByUniqueName = (uniqueName: string): string | undefined => {
|
||||||
//Lotus/Types/Items/MiscItems/PolymerBundle
|
if (uniqueName in ExportCustoms) {
|
||||||
|
return ExportCustoms[uniqueName].productCategory;
|
||||||
let splitWord = "Items/";
|
|
||||||
if (!uniqueName.includes("/Items/")) {
|
|
||||||
splitWord = "/Types/";
|
|
||||||
}
|
}
|
||||||
|
if (uniqueName in ExportDrones) {
|
||||||
const index = getIndexAfter(uniqueName, splitWord);
|
return "Drones";
|
||||||
if (index === -1) {
|
|
||||||
throw new Error(`error parsing item category ${uniqueName}`);
|
|
||||||
}
|
}
|
||||||
const category = uniqueName.substring(index).split("/")[0];
|
if (uniqueName in ExportKeys) {
|
||||||
return category;
|
return "LevelKeys";
|
||||||
|
}
|
||||||
|
if (uniqueName in ExportGear) {
|
||||||
|
return "Consumables";
|
||||||
|
}
|
||||||
|
if (uniqueName in ExportResources) {
|
||||||
|
return ExportResources[uniqueName].productCategory;
|
||||||
|
}
|
||||||
|
if (uniqueName in ExportSentinels) {
|
||||||
|
return ExportSentinels[uniqueName].productCategory;
|
||||||
|
}
|
||||||
|
if (uniqueName in ExportWarframes) {
|
||||||
|
return ExportWarframes[uniqueName].productCategory;
|
||||||
|
}
|
||||||
|
if (uniqueName in ExportWeapons) {
|
||||||
|
return ExportWeapons[uniqueName].productCategory;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getItemName = (uniqueName: string): string | undefined => {
|
export const getItemName = (uniqueName: string): string | undefined => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user