summaryrefslogtreecommitdiff
path: root/db/npc.php
diff options
context:
space:
mode:
Diffstat (limited to 'db/npc.php')
-rw-r--r--db/npc.php15
1 files changed, 11 insertions, 4 deletions
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) {