Skip to content

Commit

Permalink
Temp fix for copper pan hat
Browse files Browse the repository at this point in the history
  • Loading branch information
colecrouter committed Dec 3, 2023
1 parent 370e0ac commit f5379e1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/routes/(edit)/appearance/Preview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,18 @@
}
}
const hatData = character.hat && itemData.get(character.hat.name);
let hatData: ItemInformation | undefined;
if (character.hat?.name === 'Copper Pan') {
// I hate this so much, but there's no way to grab the info from itemData because +layout.ts converts iteminfo.json into a Map,
// so the hat entry gets nuked. Maybe in the future we'll use a Map<string, Array<ItemInformation>> instead.
const res = await fetch(base + '/iteminfo.json');
const allItems = (await res.json()) as Array<[string, ItemInformation]>;
const pan = allItems.find(([name]) => name === 'Copper Pan')![1];
hatData = pan;
} else {
hatData = character.hat && itemData.get(character.hat.name);
}
if (hatData) {
hatPosition = hatData.sprite;
showHair = hatData?._type == 'Hat' && hatData.showRealHair;
Expand Down Expand Up @@ -257,7 +268,10 @@
position: absolute;
width: 100%;
height: 100%;
box-shadow: 0 0 0 2px #8e3d04, 0 0 0 4px #d97804, 0 0 0 6px #5b2b29;
box-shadow:
0 0 0 2px #8e3d04,
0 0 0 4px #d97804,
0 0 0 6px #5b2b29;
border-radius: 2px;
}
Expand Down
13 changes: 13 additions & 0 deletions src/routes/(edit)/inventory/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@
// This is required for the game to recognize the item as the correct type, but isn't part of the XML structureS
// @ts-expect-error
newItem['@_xsi:type'] = type;
if (symbol === 'hat' && newItemName === 'Copper Pan') {
// @ts-expect-error
newItem['@_xsi:type'] = 'Hat';
}
}
if (newItemData._type === 'ObjectInformation') {
Expand Down Expand Up @@ -308,6 +313,14 @@
player[symbol] = newItem;
}
if (symbol === 'hat' && newItem.name === 'Copper Pan') {
newItem.ignoreHairstyleOffset = true;
newItem.parentSheetIndex = 71;
newItem.indexInTileSheet = 71;
newItem.category = Category.Hat;
newItem.which = 71;
}
// Clear item from the editor window
newItemName = '';
Expand Down

0 comments on commit f5379e1

Please sign in to comment.