Pre-combat-rewrite: Backup current state before comprehensive combat frontend rewrite
This commit is contained in:
@@ -135,18 +135,24 @@ async def spawn_manager_loop(manager=None):
|
||||
if manager:
|
||||
from datetime import datetime
|
||||
npc_def = NPCS.get(npc_id)
|
||||
npc_name = npc_def.name if npc_def else npc_id.replace('_', ' ').title()
|
||||
npc_name_obj = npc_def.name if npc_def else npc_id.replace('_', ' ').title()
|
||||
# Handle localized name for the fallback message
|
||||
if isinstance(npc_name_obj, dict):
|
||||
npc_name_en = npc_name_obj.get('en', str(npc_name_obj))
|
||||
else:
|
||||
npc_name_en = str(npc_name_obj)
|
||||
|
||||
await manager.send_to_location(
|
||||
location_id=location_id,
|
||||
message={
|
||||
"type": "location_update",
|
||||
"data": {
|
||||
"message": f"A {npc_name} appeared!",
|
||||
"message": f"A {npc_name_en} appeared!",
|
||||
"action": "enemy_spawned",
|
||||
"npc_data": {
|
||||
"id": enemy_data['id'],
|
||||
"npc_id": npc_id,
|
||||
"name": npc_name,
|
||||
"name": npc_name_obj,
|
||||
"type": "enemy",
|
||||
"is_wandering": True,
|
||||
"image_path": npc_def.image_path if npc_def else None
|
||||
@@ -209,7 +215,8 @@ async def decay_dropped_items(manager=None):
|
||||
"type": "location_update",
|
||||
"data": {
|
||||
"message": f"{count} dropped item(s) decayed",
|
||||
"action": "items_decayed"
|
||||
"action": "items_decayed",
|
||||
"count": count
|
||||
},
|
||||
"timestamp": datetime.utcnow().isoformat()
|
||||
}
|
||||
@@ -472,7 +479,8 @@ async def decay_corpses(manager=None):
|
||||
"type": "location_update",
|
||||
"data": {
|
||||
"message": f"{total} {corpse_type} decayed",
|
||||
"action": "corpses_decayed"
|
||||
"action": "corpses_decayed",
|
||||
"count": total
|
||||
},
|
||||
"timestamp": datetime.utcnow().isoformat()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user