diff options
Diffstat (limited to 'db/npc.php')
-rw-r--r-- | db/npc.php | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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) { |