summaryrefslogtreecommitdiff
path: root/db/areas.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-20 14:32:40 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-20 14:32:40 +0200
commitb227fc9c2ef361f8aa5ee2f24aa1ade6bc972a73 (patch)
tree8fdd7e980107bfd8fcd58ffe21f2299b37d310c8 /db/areas.php
parent2c7890e90e1aad371854cfe60ad63eaa88e64fec (diff)
area progress
Diffstat (limited to 'db/areas.php')
-rw-r--r--db/areas.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/areas.php b/db/areas.php
new file mode 100644
index 0000000..55b2177
--- /dev/null
+++ b/db/areas.php
@@ -0,0 +1,17 @@
+<?php
+
+foreach (scandir(__DIR__ . '/areas') as $file) {
+ if (in_array($file, ['.', '..'])) continue;
+
+ $filePath = __DIR__ . '/areas/' . $file;
+ $fileName = pathinfo($file, PATHINFO_FILENAME);
+
+ $area = json_decode(file_get_contents($filePath), true);
+ $encounters = json_decode(@file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/encounter/$area[encounter_slug].json") ?? '', true);
+ $environment = json_decode(file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/environment/$area[environment_slug].json"), true);
+
+ array_push($area['encounters'], ...$encounters['monsters'] ?? []);
+ $area['environment'] = $environment;
+
+ file_put_contents(__DIR__ . "/_generated/areas/$fileName.json", json_encode($area));
+}