added npc images to API and frontend
This commit is contained in:
@@ -281,6 +281,7 @@ def get_npcs_at_location(location_id: str):
|
|||||||
"role": npc.role,
|
"role": npc.role,
|
||||||
"appearance": npc.appearance.brief,
|
"appearance": npc.appearance.brief,
|
||||||
"tags": npc.tags,
|
"tags": npc.tags,
|
||||||
|
"image_url": npc.image_url,
|
||||||
})
|
})
|
||||||
|
|
||||||
return success_response({
|
return success_response({
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ npc_id: npc_blacksmith_hilda
|
|||||||
name: Hilda Ironforge
|
name: Hilda Ironforge
|
||||||
role: blacksmith
|
role: blacksmith
|
||||||
location_id: crossville_village
|
location_id: crossville_village
|
||||||
|
image_url: /static/images/npcs/crossville/blacksmith_hilda.png
|
||||||
|
|
||||||
personality:
|
personality:
|
||||||
traits:
|
traits:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ npc_id: npc_grom_ironbeard
|
|||||||
name: Grom Ironbeard
|
name: Grom Ironbeard
|
||||||
role: bartender
|
role: bartender
|
||||||
location_id: crossville_tavern
|
location_id: crossville_tavern
|
||||||
|
image_url: /static/images/npcs/crossville/grom_ironbeard.png
|
||||||
|
|
||||||
personality:
|
personality:
|
||||||
traits:
|
traits:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ npc_id: npc_mayor_aldric
|
|||||||
name: Mayor Aldric Thornwood
|
name: Mayor Aldric Thornwood
|
||||||
role: mayor
|
role: mayor
|
||||||
location_id: crossville_village
|
location_id: crossville_village
|
||||||
|
image_url: /static/images/npcs/crossville/mayor_aldric.png
|
||||||
|
|
||||||
personality:
|
personality:
|
||||||
traits:
|
traits:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ npc_id: npc_mira_swiftfoot
|
|||||||
name: Mira Swiftfoot
|
name: Mira Swiftfoot
|
||||||
role: rogue
|
role: rogue
|
||||||
location_id: crossville_tavern
|
location_id: crossville_tavern
|
||||||
|
image_url: /static/images/npcs/crossville/mira_swiftfoot.png
|
||||||
|
|
||||||
personality:
|
personality:
|
||||||
traits:
|
traits:
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ class NPC:
|
|||||||
location_id: str
|
location_id: str
|
||||||
personality: NPCPersonality
|
personality: NPCPersonality
|
||||||
appearance: NPCAppearance
|
appearance: NPCAppearance
|
||||||
|
image_url: Optional[str] = None
|
||||||
knowledge: Optional[NPCKnowledge] = None
|
knowledge: Optional[NPCKnowledge] = None
|
||||||
relationships: List[NPCRelationship] = field(default_factory=list)
|
relationships: List[NPCRelationship] = field(default_factory=list)
|
||||||
inventory_for_sale: List[NPCInventoryItem] = field(default_factory=list)
|
inventory_for_sale: List[NPCInventoryItem] = field(default_factory=list)
|
||||||
@@ -316,6 +317,7 @@ class NPC:
|
|||||||
"name": self.name,
|
"name": self.name,
|
||||||
"role": self.role,
|
"role": self.role,
|
||||||
"location_id": self.location_id,
|
"location_id": self.location_id,
|
||||||
|
"image_url": self.image_url,
|
||||||
"personality": self.personality.to_dict(),
|
"personality": self.personality.to_dict(),
|
||||||
"appearance": self.appearance.to_dict(),
|
"appearance": self.appearance.to_dict(),
|
||||||
"knowledge": self.knowledge.to_dict() if self.knowledge else None,
|
"knowledge": self.knowledge.to_dict() if self.knowledge else None,
|
||||||
@@ -400,6 +402,7 @@ class NPC:
|
|||||||
name=data["name"],
|
name=data["name"],
|
||||||
role=data["role"],
|
role=data["role"],
|
||||||
location_id=data["location_id"],
|
location_id=data["location_id"],
|
||||||
|
image_url=data.get("image_url"),
|
||||||
personality=personality,
|
personality=personality,
|
||||||
appearance=appearance,
|
appearance=appearance,
|
||||||
knowledge=knowledge,
|
knowledge=knowledge,
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ class NPCLoader:
|
|||||||
name=data["name"],
|
name=data["name"],
|
||||||
role=data["role"],
|
role=data["role"],
|
||||||
location_id=data["location_id"],
|
location_id=data["location_id"],
|
||||||
|
image_url=data.get("image_url"),
|
||||||
personality=personality,
|
personality=personality,
|
||||||
appearance=appearance,
|
appearance=appearance,
|
||||||
knowledge=knowledge,
|
knowledge=knowledge,
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ Main NPC definition with personality and dialogue data for AI generation.
|
|||||||
| `location_id` | str | ID of location where NPC resides |
|
| `location_id` | str | ID of location where NPC resides |
|
||||||
| `personality` | NPCPersonality | Personality traits and speech patterns |
|
| `personality` | NPCPersonality | Personality traits and speech patterns |
|
||||||
| `appearance` | NPCAppearance | Physical description |
|
| `appearance` | NPCAppearance | Physical description |
|
||||||
|
| `image_url` | Optional[str] | URL path to NPC portrait image (e.g., "/static/images/npcs/crossville/grom_ironbeard.png") |
|
||||||
| `knowledge` | Optional[NPCKnowledge] | What the NPC knows (public and secret) |
|
| `knowledge` | Optional[NPCKnowledge] | What the NPC knows (public and secret) |
|
||||||
| `relationships` | List[NPCRelationship] | How NPC feels about other NPCs |
|
| `relationships` | List[NPCRelationship] | How NPC feels about other NPCs |
|
||||||
| `inventory_for_sale` | List[NPCInventoryItem] | Items NPC sells (if merchant) |
|
| `inventory_for_sale` | List[NPCInventoryItem] | Items NPC sells (if merchant) |
|
||||||
|
|||||||
@@ -704,7 +704,8 @@ def npc_chat_modal(session_id: str, npc_id: str):
|
|||||||
'name': npc_data.get('name'),
|
'name': npc_data.get('name'),
|
||||||
'role': npc_data.get('role'),
|
'role': npc_data.get('role'),
|
||||||
'appearance': npc_data.get('appearance', {}).get('brief', ''),
|
'appearance': npc_data.get('appearance', {}).get('brief', ''),
|
||||||
'tags': npc_data.get('tags', [])
|
'tags': npc_data.get('tags', []),
|
||||||
|
'image_url': npc_data.get('image_url')
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get relationship info
|
# Get relationship info
|
||||||
|
|||||||
BIN
public_web/static/images/npcs/crossville/blacksmith_hilda.png
Normal file
BIN
public_web/static/images/npcs/crossville/blacksmith_hilda.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 111 KiB |
BIN
public_web/static/images/npcs/crossville/grom_ironbeard.png
Normal file
BIN
public_web/static/images/npcs/crossville/grom_ironbeard.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
BIN
public_web/static/images/npcs/crossville/mayor_aldric.png
Normal file
BIN
public_web/static/images/npcs/crossville/mayor_aldric.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
BIN
public_web/static/images/npcs/crossville/mira_swiftfoot.png
Normal file
BIN
public_web/static/images/npcs/crossville/mira_swiftfoot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
Reference in New Issue
Block a user