diff options
Diffstat (limited to 'db/areas.php')
-rw-r--r-- | db/areas.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/db/areas.php b/db/areas.php index d423a3e..c1d97e0 100644 --- a/db/areas.php +++ b/db/areas.php @@ -7,8 +7,10 @@ foreach (scandir(__DIR__ . '/areas') as $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); + $encounterSlug = $area['modules/tuxemon.encounter'] ?? ''; + $environmentSlug = $area['modules/tuxemon.environment'] ?? ''; + $encounters = json_decode(@file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/encounter/$encounterSlug.json") ?? '', true); + $environment = json_decode(@file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/environment/$environmentSlug.json") ?? '', true); $map = @file_get_contents(__DIR__ . "/maps/$fileName.svg"); $area['encounters'] ??= []; @@ -21,12 +23,13 @@ foreach (scandir(__DIR__ . '/areas') as $file) { $area['map'] = $map; foreach ($area['connections'] as $areaSlug => $connection) { - $area['connections'][$areaSlug]['name'] = json_decode(file_get_contents(__DIR__ . "/areas/$areaSlug.json"), true)['name']; + $area['connections'][$areaSlug]['modules/tuxemon.slug'] = json_decode(file_get_contents(__DIR__ . "/areas/$areaSlug.json"), true)['modules/tuxemon.slug']; } 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); + $economySlug = $location['modules/tuxemon.economy']; + $scoop = json_decode(file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/economy/$economySlug.json"), true); array_unshift($area['locations'][$locationId]['items'], ...$scoop['items']); } } |