Skip to content

Commit 82cdb69

Browse files
committed
Fix: Center inventory icons by stripping Variation Selector-16 and improving centering logic in sprite generation. Also added Magic Capacity check to Refinement affordance.
1 parent abf6555 commit 82cdb69

7 files changed

Lines changed: 11 additions & 1 deletion

File tree

270 Bytes
Loading
440 Bytes
Loading
351 Bytes
Loading
261 Bytes
Loading
709 Bytes
Loading

Mythril.Data/ResourceManager_Quests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ public bool CanAfford(object item, Character? character = null)
9191
{
9292
if (!Inventory.Has(refinement.InputItem, refinement.Recipe.InputQuantity)) return false;
9393

94+
// If it produces a spell, check against Magic Capacity
95+
if (refinement.Recipe.OutputItem.ItemType == ItemType.Spell)
96+
{
97+
if (Inventory.GetQuantity(refinement.Recipe.OutputItem) >= Inventory.MagicCapacity) return false;
98+
}
99+
94100
// Refinements require the ability to be UNLOCKED and the cadence ASSIGNED
95101
if (character == null) return false;
96102
return HasAbility(character.Value, refinement.Ability);

scripts/generate_sprites.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ def bake_emoji(name, emoji, size=32):
121121
bbox = draw.textbbox((0, 0), emoji, font=font, embedded_color=True)
122122
w = bbox[2] - bbox[0]
123123
h = bbox[3] - bbox[1]
124-
draw.text(((render_size - w) // 2, (render_size - h) // 2 - bbox[1]), emoji, font=font, fill=(255, 255, 255, 255), embedded_color=True)
124+
x = (render_size - w) // 2 - bbox[0]
125+
y = (render_size - h) // 2 - bbox[1]
126+
draw.text((x, y), emoji, font=font, fill=(255, 255, 255, 255), embedded_color=True)
125127
else:
126128
# Fallback to initials if no emoji font
127129
draw.text((render_size//4, render_size//4), name[0], fill=(255, 255, 255, 255))
@@ -175,6 +177,8 @@ def main():
175177
for item in items:
176178
name = item["Name"]
177179
emoji = emoji_mapping.get(name, "📦") # Box as fallback
180+
# Strip variation selector-16 which causes double-width bbox in some Pillow versions
181+
emoji = emoji.replace('\ufe0f', '')
178182
bake_emoji(name, emoji)
179183
print(f"Baked emoji for {name}")
180184

0 commit comments

Comments
 (0)