summaryrefslogtreecommitdiff
path: root/db/areas.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-23 00:24:50 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-23 00:24:50 +0200
commit4dd1a344c6474087a3f8782dd54f5c7b4acc67ed (patch)
tree7a0229eb721d81c7579a7f5f721a503136c98095 /db/areas.php
parentdbcd0118863ff3e7c5bee45041ccdb757eb2f366 (diff)
area connections and town maps
Diffstat (limited to 'db/areas.php')
-rw-r--r--db/areas.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/db/areas.php b/db/areas.php
index 55b2177..185589e 100644
--- a/db/areas.php
+++ b/db/areas.php
@@ -9,9 +9,22 @@ foreach (scandir(__DIR__ . '/areas') as $file) {
$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);
+ $map = @file_get_contents(__DIR__ . "/maps/$fileName.svg");
array_push($area['encounters'], ...$encounters['monsters'] ?? []);
$area['environment'] = $environment;
+ $area['map'] = $map;
+
+ foreach ($area['connections'] as $areaSlug => $connection) {
+ $area['connections'][$areaSlug]['name'] = json_decode(file_get_contents(__DIR__ . "/areas/$areaSlug.json"), true)['name'];
+ }
+
+ foreach ($area['locations'] ?? [] as $locationId => $location) {
+ if ($location['type'] == 'shop') {
+ $scoop = json_decode(file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/economy/$location[economy].json"), true);
+ array_unshift($area['locations'][$locationId]['items'], ...$scoop['items']);
+ }
+ }
file_put_contents(__DIR__ . "/_generated/areas/$fileName.json", json_encode($area));
}