diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-09-02 14:59:09 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-09-02 14:59:09 +0200 |
commit | 2030caa0c85102b1cf6131dd9eefef4a347cda42 (patch) | |
tree | 9188abac0d7b7730ded1e8e154c3f7c589f785cf /db/npc.php | |
parent | 1d29ee6d87d3794a9319bca5bf36afdfe176072c (diff) |
translations and story
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) { |