From 2030caa0c85102b1cf6131dd9eefef4a347cda42 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 2 Sep 2023 14:59:09 +0200 Subject: translations and story --- db/npc.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'db/npc.php') diff --git a/db/npc.php b/db/npc.php index 4aabc8a..c2af851 100644 --- a/db/npc.php +++ b/db/npc.php @@ -25,17 +25,24 @@ foreach (scandir($basePath) as $fileName) { if (in_array($fileName, ['.', '..'])) continue; $filePath = "$basePath/$fileName"; - $npc = json_decode(file_get_contents($filePath), true); + $npcData = json_decode(file_get_contents($filePath), true); - $slug = $npc['modules/tuxemon.slug'] ?? pathinfo($fileName, PATHINFO_FILENAME); - $npcs[$slug] = [ + $slug = $npcData['modules/tuxemon.slug'] ?? pathinfo($fileName, PATHINFO_FILENAME); + $npc = [ 'slug' => $slug, 'template' => [ [ - 'sprite_name' => $npc['sprite'], + 'sprite_name' => $npcData['sprite'], + 'combat_front' => $npcData['sprite'], ], ], ]; + + if (isset($npcs[$slug])) { + $npcs[$slug] = array_replace_recursive($npcs[$slug], $npc); + } else { + $npcs[$slug] = $npc; + } } foreach ($npcs as $slug => $npc) { -- cgit v1.2.3