diff --git a/src/Entity/Npc.php b/src/Entity/Npc.php index 4f89eb4..97fecf3 100644 --- a/src/Entity/Npc.php +++ b/src/Entity/Npc.php @@ -227,4 +227,14 @@ class Npc { return $this->updatedAt; } + + /** + * AssetMapper logical path of this NPC's portrait, e.g. + * "image/npc-pictures/GarrickVoss.png". The file may not exist for + * NPCs added after the portrait sets were generated. + */ + public function getPortraitPath(): string + { + return 'image/npc-pictures/'.str_replace(' ', '', $this->name).'.png'; + } } diff --git a/templates/npc/edit.html.twig b/templates/npc/edit.html.twig index 9ea6420..b11d82d 100644 --- a/templates/npc/edit.html.twig +++ b/templates/npc/edit.html.twig @@ -3,10 +3,17 @@ {% block title %}{{ npc.name }} · NPC's · dmtools{% endblock %} {% block body %} -
-
- ← All NPC's -

{{ npc.name }}

+
+
+ Portrait of {{ npc.name }} +
+ ← All NPC's +

{{ npc.name }}

+ {{ npc.family }}{% if npc.occupation %} · {{ npc.occupation }}{% endif %} +
{% if npc.updatedAt %} Updated {{ npc.updatedAt|date('Y-m-d H:i') }}