diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-08-31 20:23:06 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-08-31 20:23:06 +0200 |
commit | c657c77d0cf49afba627b93848e1915e2ce7d3ff (patch) | |
tree | 5d96a65df277f52558cd5ff84f2fefbf4480a926 /db | |
parent | 7f6ab8779bd143b1b5f3465e3681abcbc113d19d (diff) |
story and npcs
Diffstat (limited to 'db')
-rw-r--r-- | db/areas.php | 49 | ||||
-rw-r--r-- | db/areas/mansion-basement.json | 5 | ||||
-rw-r--r-- | db/areas/mansion-top-floor.json | 5 | ||||
-rw-r--r-- | db/areas/mansion.json | 5 | ||||
-rw-r--r-- | db/environment/mansion-basement.jpg | bin | 0 -> 66592 bytes | |||
-rw-r--r-- | db/environment/mansion-basement.json | 6 | ||||
-rw-r--r-- | db/environment/mansion-main.jpg | bin | 0 -> 101268 bytes | |||
-rw-r--r-- | db/environment/mansion-main.json | 6 | ||||
-rw-r--r-- | db/environment/mansion-top-floor.jpg | bin | 0 -> 78932 bytes | |||
-rw-r--r-- | db/environment/mansion-top-floor.json | 6 | ||||
-rw-r--r-- | db/i18n.php | 19 | ||||
-rw-r--r-- | db/i18n/de_DE.po | 67 | ||||
-rw-r--r-- | db/maps/cotton-town.svg | 3 | ||||
-rw-r--r-- | db/maps/dryads-grove.svg | 5 | ||||
-rw-r--r-- | db/maps/leather-town.svg | 3 | ||||
-rw-r--r-- | db/npc.php | 43 | ||||
-rw-r--r-- | db/npc/omnichannel-ceo.json | 3 | ||||
-rw-r--r-- | db/npc/tuxemart-keeper.json | 3 |
18 files changed, 202 insertions, 26 deletions
diff --git a/db/areas.php b/db/areas.php index d2c9af9..fd0943a 100644 --- a/db/areas.php +++ b/db/areas.php @@ -8,16 +8,15 @@ foreach (scandir(__DIR__ . '/areas') as $file) { $area = json_decode(file_get_contents($filePath), true); - $encounterSlug = $area['modules/tuxemon.encounter'] ?? ''; - $encounters = json_decode(@file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/encounter/$encounterSlug.json") ?? '', true); - - $environmentSlug = $area['modules/tuxemon.environment'] ?? ''; - $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"); + // encounters $area['encounters'] ??= []; + + $encounterSlug = $area['modules/tuxemon.encounter'] ?? ''; + $encounters = json_decode(@file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/encounter/$encounterSlug.json") ?? '', true); array_push($area['encounters'], ...$encounters['monsters'] ?? []); + if (! empty($area['encounters'])) { // filter out duplicates, because day/night is ignored for now $duplicates = []; @@ -34,16 +33,38 @@ foreach (scandir(__DIR__ . '/areas') as $file) { } $area['encounter_percent_total'] = array_sum(array_column($area['encounters'], 'encounter_percent')); } + $area['requiredEncounters'] ??= 0; + + // trainers + $area['trainers'] ??= []; + + // environment + + $environmentSlug = $area['modules/tuxemon.environment'] ?? ''; + $environment = json_decode(@file_get_contents(dirname(__DIR__) . "/modules/tuxemon/mods/tuxemon/db/environment/$environmentSlug.json") ?? '', true); + + if (isset($area['environment'])) { + $environment = json_decode(file_get_contents(__DIR__ . "/environment/$area[environment].json"), true); + $environment['battle_graphics']['background'] = '/db/environment/' . $environment['battle_graphics']['background']; + } else if (! empty($environment)) { + $environment['battle_graphics']['background'] = '/modules/tuxemon/mods/tuxemon/gfx/ui/combat/' . $environment['battle_graphics']['background']; + } + $area['environment'] = $environment; + + + // map + + $map = @file_get_contents(__DIR__ . "/maps/$fileName.svg"); + $area['map'] = $map; - foreach ($area['connections'] as $areaSlug => $connection) { - $area['connections'][$areaSlug]['modules/tuxemon.slug'] = json_decode(@file_get_contents(__DIR__ . "/areas/$areaSlug.json") ?? '', true)['modules/tuxemon.slug'] ?? ''; - } + + // locations $area['locations'] ??= []; foreach ($area['locations'] as $locationId => $location) { @@ -54,5 +75,15 @@ foreach (scandir(__DIR__ . '/areas') as $file) { } } + + // connections + + foreach ($area['connections'] as $areaSlug => $connection) { + $area['connections'][$areaSlug]['modules/tuxemon.slug'] = json_decode(@file_get_contents(__DIR__ . "/areas/$areaSlug.json") ?? '', true)['modules/tuxemon.slug'] ?? ''; + } + + + // build + file_put_contents(__DIR__ . "/_generated/areas/$fileName.json", json_encode($area)); } diff --git a/db/areas/mansion-basement.json b/db/areas/mansion-basement.json index 1a90497..14ea293 100644 --- a/db/areas/mansion-basement.json +++ b/db/areas/mansion-basement.json @@ -29,6 +29,8 @@ } ], + "environment": "mansion-basement", + "connections": { "mansion": { "conditions": [] @@ -36,6 +38,5 @@ }, "modules/tuxemon.slug": "mansion_basement", - "modules/tuxemon.encounter": "mansion", - "modules/tuxemon.environment": "cave" + "modules/tuxemon.encounter": "mansion" } diff --git a/db/areas/mansion-top-floor.json b/db/areas/mansion-top-floor.json index 02bf87e..4f92836 100644 --- a/db/areas/mansion-top-floor.json +++ b/db/areas/mansion-top-floor.json @@ -61,6 +61,8 @@ } ], + "environment": "mansion-top-floor", + "connections": { "mansion": { "conditions": [] @@ -68,6 +70,5 @@ }, "modules/tuxemon.slug": "mansion_top_floor", - "modules/tuxemon.encounter": "mansion", - "modules/tuxemon.environment": "cave" + "modules/tuxemon.encounter": "mansion" } diff --git a/db/areas/mansion.json b/db/areas/mansion.json index 82de65a..aed6ead 100644 --- a/db/areas/mansion.json +++ b/db/areas/mansion.json @@ -18,6 +18,8 @@ } ], + "environment": "mansion-main", + "connections": { "side-route-a": { "conditions": [] @@ -37,6 +39,5 @@ }, "modules/tuxemon.slug": "mansion", - "modules/tuxemon.encounter": "mansion", - "modules/tuxemon.environment": "cave" + "modules/tuxemon.encounter": "mansion" } diff --git a/db/environment/mansion-basement.jpg b/db/environment/mansion-basement.jpg Binary files differnew file mode 100644 index 0000000..2aa4546 --- /dev/null +++ b/db/environment/mansion-basement.jpg diff --git a/db/environment/mansion-basement.json b/db/environment/mansion-basement.json new file mode 100644 index 0000000..87d5412 --- /dev/null +++ b/db/environment/mansion-basement.json @@ -0,0 +1,6 @@ +{ + "battle_graphics": { + "background": "mansion-basement.jpg", + "background_position": "center" + } +} diff --git a/db/environment/mansion-main.jpg b/db/environment/mansion-main.jpg Binary files differnew file mode 100644 index 0000000..eef40df --- /dev/null +++ b/db/environment/mansion-main.jpg diff --git a/db/environment/mansion-main.json b/db/environment/mansion-main.json new file mode 100644 index 0000000..cc5503e --- /dev/null +++ b/db/environment/mansion-main.json @@ -0,0 +1,6 @@ +{ + "battle_graphics": { + "background": "mansion-main.jpg", + "background_position": "bottom" + } +} diff --git a/db/environment/mansion-top-floor.jpg b/db/environment/mansion-top-floor.jpg Binary files differnew file mode 100644 index 0000000..8fb45cc --- /dev/null +++ b/db/environment/mansion-top-floor.jpg diff --git a/db/environment/mansion-top-floor.json b/db/environment/mansion-top-floor.json new file mode 100644 index 0000000..870e1af --- /dev/null +++ b/db/environment/mansion-top-floor.json @@ -0,0 +1,6 @@ +{ + "battle_graphics": { + "background": "mansion-top-floor.jpg", + "background_position": "center" + } +} diff --git a/db/i18n.php b/db/i18n.php index 0942802..b4f7cbc 100644 --- a/db/i18n.php +++ b/db/i18n.php @@ -10,12 +10,23 @@ function populateI18n ($locale, $poFile) { while ($line = fgets($handle)) { if (str_starts_with($line, 'msgid')) { $nextLine = fgets($handle); - preg_match('/"(.*)"/', $line, $msgid); - preg_match('/"(.*)"/', $nextLine, $msgstr); + preg_match('/"(.*)"/', $line, $msgidMatch); + preg_match('/"(.*)"/', $nextLine, $msgstrMatch); - if (empty($msgid[1]) || str_starts_with($msgid[1], 'PROJECT DESCRIPTION')) continue; + if (empty($msgidMatch[1]) || str_starts_with($msgidMatch[1], 'PROJECT DESCRIPTION')) continue; + $msgid = $msgidMatch[1]; - $i18n[$locale][$msgid[1]] = mb_convert_encoding($msgstr[1], 'UTF-8'); + // get lines immediately after msgstr + $msgstr = $msgstrMatch[1]; + $msgstrNextLine = fgets($handle); + while (! empty(trim($msgstrNextLine))) { + preg_match('/"(.*)"/', $msgstrNextLine, $msgstrNextLineMatch); + $msgstr .= $msgstrNextLineMatch[1]; + + $msgstrNextLine = fgets($handle); + } + + $i18n[$locale][$msgid] = mb_convert_encoding($msgstr, 'UTF-8'); } } } diff --git a/db/i18n/de_DE.po b/db/i18n/de_DE.po index 8fdc013..90b97bb 100644 --- a/db/i18n/de_DE.po +++ b/db/i18n/de_DE.po @@ -175,3 +175,70 @@ msgstr "Wähle dein Tuxemon!" msgid "story:select_starter_monster:monster_selection:title" msgstr "Wähle dein tatsächliches Tuxemon!" + + + + +# modules/tuxemon + + +# Routes + +msgid "dryadsgrove" +msgstr "Nymphenhain" + +msgid "routea" +msgstr "Route A" + +msgid "routec" +msgstr "Route C" + + +# Story + +msgid "spyder_intro00" +msgstr "Hallo! Ich bin der CEO von Omnichannel. Wir betreiben die Zeitungen, Fernsehsender und Radio Stationen in dieser Region.\n" +"Es ist meine Pflicht euch zu informieren." + +msgid "spyder_intro01" +msgstr "Tuxemon sind die Tiere, die in dieser Welt leben.\n" +"Sie lieben es gefangen zu werden, sodass ihre Meister sie für Spaß und Profit kämpfen lassen können.\n" +"Die stärksten gewinnen, genau wie in der Welt der Unternehmen.\n" +"Die meisten Monster lassen sich in der Wildnis finden. Sie entwickeln sich weiter, wenn sie Erfahrung sammeln.\n" +"Aber die fünf Säulen, die die Kathedrale formen, also, die fünf allierten Firmen, die in dieser Region agieren,\n" +"haben die Natur verbessert. Diese Saison bietet wir fünf deluxe Tuxemon an!" + +msgid "spyder_intro_shopkeeper1" +msgstr "Was für eine großartige Präsentation von unserem CEO! Alle Gold Mitglieder bekommen ein kostenloses Tuxemon geboten." + +msgid "spyder_intro_shopkeeper4" +msgstr "Tut mir Leid, aber du bist kein Gold Mitglied. Dieses Angebot gilt nur für Gold Mitlieder." + +msgid "spyder_papertown_myfirstmon_notmet" +msgstr "Ich erkenne dich wieder! Du bist das Kind, das keinen Gold Pass hat.\n" +"Weißt du, ich könnte dir vielleicht helfen.\n" +"Als die neuen schmucken Tuxemon von der Kathedrale kamen, haben wir einfach alle alten in den Müll geschmissen!\n" +"Das fühlt sich nach so einer Verschwendung an, besonders wenn Kinder wie du keine haben!" + +msgid "spyder_papertown_myfirstmon1" +msgstr "*wühl* *wühl*" + +msgid "spyder_papertown_myfirstmon2" +msgstr "Sieht aus als wären Tuxemon in den meisten Mülltonnen. \n Mein Chef hat mich gerufen. Viel Glück!" + +msgid "spyder_papertown_firstfight" +msgstr "Hey, warum wühlst du in den Mülltonnen rum? Das ist eklig - und es ist gegen die Regeln!\n" +"...\n" +"Was? Es wurden komplett normale Tuxemon weggeworfen?\n" +"...\n" +"Nun, wenn sie keine Mängel gehabt hätten, wären sie bestimmt nicht weggeworfen worden.\n" +"Sie müssen im Vergleich zu den neuen Modellen minderwertig sein. Hier, ich zeige es dir!" + +msgid "spyder_papertown_firstfight_win" +msgstr "Hmm, das war wohl Glück. Unmöglich, dass das neue Model schlechter als das alte ist!" + +msgid "spyder_papertown_firstfight_lose" +msgstr "War zu erwarten! Alte Modelle können sich nicht mit neuen vergleichen!" + +msgid "spyder_papertown_firstfight_after" +msgstr "Dieses mal heile ich deine Tuxemon, aber ich bin nicht die Wohlfahrt. Ruht euch das nächste Mal zu Hause aus, wenn deine Monster erschöpft sind." diff --git a/db/maps/cotton-town.svg b/db/maps/cotton-town.svg index d2d7314..0137fb1 100644 --- a/db/maps/cotton-town.svg +++ b/db/maps/cotton-town.svg @@ -5,9 +5,6 @@ > <image href="/db/maps/Cotton_town.png" /> - <text x="275" y="445">Healing Center</text> <rect data-location="healing_center" x="288" y="368" width="80" height="64" stroke="red" fill="transparent" /> - - <text x="470" y="573">Shop</text> <rect data-location="cotton_scoop" x="448" y="496" width="80" height="64" stroke="red" fill="transparent" /> </svg> diff --git a/db/maps/dryads-grove.svg b/db/maps/dryads-grove.svg index ada9703..09a5f29 100644 --- a/db/maps/dryads-grove.svg +++ b/db/maps/dryads-grove.svg @@ -5,5 +5,8 @@ > <image href="/db/maps/Dryads_Grove.png" /> - <rect data-encounter="volcoli" data-encounter-level="55" x="544" y="207" width="16" height="16" stroke="red" fill="transparent" /> + <rect + data-encounter="volcoli" data-encounter-level="55" + data-interactable="true" + x="544" y="207" width="16" height="16" stroke="red" fill="transparent" /> </svg> diff --git a/db/maps/leather-town.svg b/db/maps/leather-town.svg index 9607b32..f131896 100644 --- a/db/maps/leather-town.svg +++ b/db/maps/leather-town.svg @@ -5,9 +5,6 @@ > <image href="/db/maps/Leather_Town.png" /> - <text x="323" y="174">Healing Center</text> <rect data-location="healing_center" x="336" y="97" width="80" height="64" stroke="red" fill="transparent" /> - - <text x="226" y="174">Shop</text> <rect data-location="leather_scoop" x="208" y="97" width="80" height="64" stroke="red" fill="transparent" /> </svg> diff --git a/db/npc.php b/db/npc.php new file mode 100644 index 0000000..4aabc8a --- /dev/null +++ b/db/npc.php @@ -0,0 +1,43 @@ +<?php + +$npcs = []; + +// modules/tuxemon +$basePath = dirname(__DIR__) . '/modules/tuxemon/mods/tuxemon/db/npc'; +foreach (scandir($basePath) as $fileName) { + if (in_array($fileName, ['.', '..'])) continue; + + $filePath = "$basePath/$fileName"; + $json = json_decode(file_get_contents($filePath), true); + + if (isset($json['slug']) && isset($json['template'])) { + $npcs[$json['slug']] = $json; + } else { + foreach ($json as $npc) { + $npcs[$npc['slug']] = $npc; + } + } +} + +// tuxemon clicker +$basePath = __DIR__ . '/npc'; +foreach (scandir($basePath) as $fileName) { + if (in_array($fileName, ['.', '..'])) continue; + + $filePath = "$basePath/$fileName"; + $npc = json_decode(file_get_contents($filePath), true); + + $slug = $npc['modules/tuxemon.slug'] ?? pathinfo($fileName, PATHINFO_FILENAME); + $npcs[$slug] = [ + 'slug' => $slug, + 'template' => [ + [ + 'sprite_name' => $npc['sprite'], + ], + ], + ]; +} + +foreach ($npcs as $slug => $npc) { + file_put_contents(__DIR__ . "/_generated/npc/$slug.json", json_encode($npc)); +} diff --git a/db/npc/omnichannel-ceo.json b/db/npc/omnichannel-ceo.json new file mode 100644 index 0000000..818098a --- /dev/null +++ b/db/npc/omnichannel-ceo.json @@ -0,0 +1,3 @@ +{ + "sprite": "ceo" +} diff --git a/db/npc/tuxemart-keeper.json b/db/npc/tuxemart-keeper.json new file mode 100644 index 0000000..1779fbd --- /dev/null +++ b/db/npc/tuxemart-keeper.json @@ -0,0 +1,3 @@ +{ + "sprite": "shopassist" +} |