Skip to content

Commit

Permalink
add back item name cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
gc committed Sep 28, 2024
1 parent 3373c12 commit 9235b8a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/structures/Items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import deepMerge from "deepmerge";

import _items from "../data/items/item_data.json" assert { type: "json" };
import type { Item, ItemID } from "../meta/types";
import { cleanString } from "../util/cleanString";
import { Collection } from "./Collection";

// @ts-ignore asdf
Expand Down Expand Up @@ -70,7 +71,7 @@ class Items extends Collection<ItemID, Item> {
}

if (typeof input === "string") {
return itemNameMap.get(input);
return itemNameMap.get(cleanString(input));
}

return undefined;
Expand All @@ -84,8 +85,9 @@ for (const [id, item] of Object.entries(items)) {

if (USELESS_ITEMS.includes(numID)) continue;
itemsExport.set(numID, item);
if (!itemNameMap.has(item.name)) {
itemNameMap.set(item.name, numID);
const cleanName = cleanString(item.name);
if (!itemNameMap.has(cleanName)) {
itemNameMap.set(cleanName, numID);
}
}

Expand Down

0 comments on commit 9235b8a

Please sign in to comment.