chore: save progress before layout changes

This commit is contained in:
Joan
2026-02-10 10:48:53 +01:00
parent 70dc35b4b2
commit bba5d1d9dd
48 changed files with 1535 additions and 690 deletions

View File

@@ -62,7 +62,22 @@ async def get_corpse_details(
# Get player's inventory to check available tools
inventory = await db.get_inventory(player['id'])
available_tools = set([item['item_id'] for item in inventory])
# Map item_id to max durability found in inventory for that item
tools_durability = {}
for item in inventory:
item_id = item['item_id']
durability = 0
# Helper to get actual durability from unique item data
if item.get('unique_item_id'):
unique_item = await db.get_unique_item(item['unique_item_id'])
if unique_item:
durability = unique_item.get('durability', 0)
if item_id not in tools_durability or durability > tools_durability[item_id]:
tools_durability[item_id] = durability
available_tools = set(tools_durability.keys())
if corpse_type == 'npc':
# Get NPC corpse
@@ -80,9 +95,16 @@ async def get_corpse_details(
loot_items = []
for idx, loot_item in enumerate(loot_remaining):
required_tool = loot_item.get('required_tool')
durability_cost = loot_item.get('tool_durability_cost', 5)
item_def = ITEMS_MANAGER.get_item(loot_item['item_id'])
has_tool = required_tool is None or required_tool in available_tools
has_tool = True
if required_tool:
if required_tool not in tools_durability:
has_tool = False
elif tools_durability[required_tool] < durability_cost:
has_tool = False
tool_def = ITEMS_MANAGER.get_item(required_tool) if required_tool else None
loot_items.append({