Skip to content

Commit

Permalink
Fixed watering cans
Browse files Browse the repository at this point in the history
  • Loading branch information
colecrouter committed Oct 26, 2024
1 parent 95392c4 commit c52bea1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const createItem = (name: string) => {
throw new Error(`Item "${name}" not found in ItemData`);
}

let category: number | undefined;
let category: Category | undefined;
switch (data._type) {
case "Object":
break;
Expand Down Expand Up @@ -56,7 +56,7 @@ export const createItem = (name: string) => {
parentSheetIndex:
"ParentSheetIndex" in data ? data.ParentSheetIndex : undefined,
indexInTileSheet: "SpriteIndex" in data ? data.SpriteIndex : undefined,
category: "Category" in data ? data.Category : undefined,
category: "Category" in data ? data.Category : category,
hasBeenInInventory: true,
SpecialVariable: 0, // TODO ?
isLostItem: false,
Expand Down Expand Up @@ -125,14 +125,15 @@ export const createItem = (name: string) => {
] as const;
item.upgradeLevel = 0;
for (const [level, upgradeLevel] of levels) {
if (name.includes(level)) {
if (name.startsWith(level)) {
console.log(name);
item.upgradeLevel = upgradeLevel;
break;
}
}

// Remove prefix from name
item.name = item.name.split(" ", 2)[1];
item.name = item.name.split(" ").slice(1).join(" ");
}

if (type) {
Expand Down

0 comments on commit c52bea1

Please sign in to comment.