diff options
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)); +}  | 
