summaryrefslogtreecommitdiff
path: root/db/areas.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-24 14:42:12 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-24 14:42:12 +0200
commitbde5dc98ad96546b59e91f5a6e552bf80cbf48e4 (patch)
tree37196f5b5065c61ac038ae43d6f2392e29e39371 /db/areas.php
parent7b1c251fcb085dc37de439ea1137373f1905d82e (diff)
translations and error handling
Diffstat (limited to 'db/areas.php')
-rw-r--r--db/areas.php11
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']);
}
}