diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-08-20 14:32:40 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-08-20 14:32:40 +0200 |
commit | b227fc9c2ef361f8aa5ee2f24aa1ade6bc972a73 (patch) | |
tree | 8fdd7e980107bfd8fcd58ffe21f2299b37d310c8 /db/areas.php | |
parent | 2c7890e90e1aad371854cfe60ad63eaa88e64fec (diff) |
area progress
Diffstat (limited to 'db/areas.php')
-rw-r--r-- | db/areas.php | 17 |
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)); +} |