From 4dd1a344c6474087a3f8782dd54f5c7b4acc67ed Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 23 Aug 2023 00:24:50 +0200 Subject: area connections and town maps --- db/areas.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'db/areas.php') 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)); } -- cgit v1.2.3