summaryrefslogtreecommitdiff
path: root/db/npc.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-09-02 14:59:09 +0200
committerDaniel Weipert <code@drogueronin.de>2023-09-02 14:59:09 +0200
commit2030caa0c85102b1cf6131dd9eefef4a347cda42 (patch)
tree9188abac0d7b7730ded1e8e154c3f7c589f785cf /db/npc.php
parent1d29ee6d87d3794a9319bca5bf36afdfe176072c (diff)
translations and story
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) {