Combat frontend rewrite: Clean architecture with structured messages, animations, and i18n
This commit is contained in:
@@ -39,18 +39,20 @@ def translate_travel_message(direction: str, location_name: str, lang: str = 'en
|
||||
|
||||
import json
|
||||
|
||||
def create_combat_message(message_type: str, **data) -> str:
|
||||
"""Create a structured combat message with type and data.
|
||||
def create_combat_message(message_type: str, origin: str = "neutral", **data) -> str:
|
||||
"""Create a structured combat message with type, origin, and data.
|
||||
|
||||
Args:
|
||||
message_type: Type of combat message (combat_start, player_attack, etc.)
|
||||
origin: Origin of the event - "player", "enemy", or "neutral"
|
||||
**data: Dynamic data for the message (damage, npc_name, etc.)
|
||||
|
||||
Returns:
|
||||
Dictionary with 'type' and 'data' fields
|
||||
JSON string with 'type', 'origin', and 'data' fields
|
||||
"""
|
||||
return json.dumps({
|
||||
"type": message_type,
|
||||
"origin": origin,
|
||||
"data": data
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user