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

@@ -783,7 +783,8 @@ async def get_current_location(request: Request, current_user: dict = Depends(ge
"name": f"{get_locale_string(npc_def.name, locale) if npc_def else corpse['npc_id']} Corpse",
"emoji": "💀",
"loot_count": len(loot),
"timestamp": corpse['death_timestamp']
"timestamp": corpse['death_timestamp'],
"image_path": npc_def.image_path if npc_def else None
})
for corpse in player_corpses:
@@ -957,7 +958,8 @@ async def move(
response = {
"success": True,
"message": message,
"new_location_id": new_location_id
"new_location_id": new_location_id,
"new_location_name": new_location.name if new_location else "Unknown" # Add location name for frontend
}
# Add encounter info if triggered
@@ -1469,10 +1471,21 @@ async def drop_item(
# Get inventory item by item_id (string), not database id
inventory = await db.get_inventory(player_id)
inv_item = None
for item in inventory:
if item['item_id'] == item_id:
inv_item = item
break
# If inventory_id is provided, use it to find precise item
inventory_id = drop_req.get('inventory_id')
if inventory_id:
for item in inventory:
if item['id'] == inventory_id:
inv_item = item
break
else:
# Fallback to legacy behavior (first matching item_id)
for item in inventory:
if item['item_id'] == item_id:
inv_item = item
break
if not inv_item:
raise HTTPException(status_code=404, detail="Item not found in inventory")