summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/_generated/areas/city-park.json2
-rw-r--r--db/_generated/areas/cotton-town.json2
-rw-r--r--db/_generated/areas/dryads-grove.json1
-rw-r--r--db/_generated/areas/leather-town.json2
-rw-r--r--db/_generated/areas/paper-town.json2
-rw-r--r--db/_generated/areas/route1.json2
-rw-r--r--db/_generated/areas/route2.json2
-rw-r--r--db/_generated/areas/route3.json2
-rw-r--r--db/_generated/currencies.json2
-rw-r--r--db/areas.php13
-rw-r--r--db/areas/city-park.json2
-rw-r--r--db/areas/cotton-town.json14
-rw-r--r--db/areas/dryads-grove.json15
-rw-r--r--db/areas/leather-town.json14
-rw-r--r--db/areas/paper-town.json2
-rw-r--r--db/areas/route1.json2
-rw-r--r--db/areas/route2.json2
-rw-r--r--db/areas/route3.json2
-rw-r--r--db/currencies.php (renamed from db/currencies/currencies.php)3
-rw-r--r--db/maps/Cotton_town.pngbin0 -> 83611 bytes
-rw-r--r--db/maps/cotton-town.svg13
-rw-r--r--index.html35
-rw-r--r--resources/css/menu.css48
-rw-r--r--resources/css/town.css12
-rw-r--r--resources/js/classes/Area.js12
-rw-r--r--resources/js/game.js3
-rw-r--r--resources/js/helpers.js8
-rw-r--r--resources/js/ui.js54
28 files changed, 239 insertions, 32 deletions
diff --git a/db/_generated/areas/city-park.json b/db/_generated/areas/city-park.json
index 41fe761..9080b55 100644
--- a/db/_generated/areas/city-park.json
+++ b/db/_generated/areas/city-park.json
@@ -1 +1 @@
-{"encounter_slug":"citypark","encounters":[{"monster":"cardiling","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[5,8]},{"monster":"cardiwing","encounter_rate":1,"daytime":true,"exp_req_mod":1,"level_range":[8,11]},{"monster":"cataspike","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[6,9]},{"monster":"eyenemy","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[5,8]},{"monster":"axylightl","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[8,12]},{"monster":"tourbidi","encounter_rate":1,"daytime":false,"exp_req_mod":1,"level_range":[8,12]},{"monster":"squabbit","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[8,12]},{"monster":"puparmor","encounter_rate":1,"daytime":false,"exp_req_mod":1,"level_range":[9,14]}],"requiredEncounters":10,"trainers":[{"name":"Frances","sprite":"florist.png","monsters":[{"slug":"shybulb","level":8},{"slug":"shybulb","level":8}],"inventory":[]}],"environment_slug":"forest","connections":{"route2":{"conditions":[]},"leather-town":{"conditions":["encounters","trainers"]}},"environment":{"slug":"forest","battle_graphics":{"island_back":"woodland_island.png","island_front":"woodland_island.png","background":"forest_background.png"},"battle_music":"music_battle_loop"}} \ No newline at end of file
+{"name":"City Park","encounter_slug":"citypark","encounters":[{"monster":"cardiling","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[5,8]},{"monster":"cardiwing","encounter_rate":1,"daytime":true,"exp_req_mod":1,"level_range":[8,11]},{"monster":"cataspike","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[6,9]},{"monster":"eyenemy","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[5,8]},{"monster":"axylightl","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[8,12]},{"monster":"tourbidi","encounter_rate":1,"daytime":false,"exp_req_mod":1,"level_range":[8,12]},{"monster":"squabbit","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[8,12]},{"monster":"puparmor","encounter_rate":1,"daytime":false,"exp_req_mod":1,"level_range":[9,14]}],"requiredEncounters":10,"trainers":[{"name":"Frances","sprite":"florist.png","monsters":[{"slug":"shybulb","level":8},{"slug":"shybulb","level":8}],"inventory":[]}],"environment_slug":"forest","connections":{"route2":{"conditions":[],"name":"Route 2"},"leather-town":{"conditions":["encounters","trainers"],"name":"Leather Town"}},"environment":{"slug":"forest","battle_graphics":{"island_back":"woodland_island.png","island_front":"woodland_island.png","background":"forest_background.png"},"battle_music":"music_battle_loop"},"map":false} \ No newline at end of file
diff --git a/db/_generated/areas/cotton-town.json b/db/_generated/areas/cotton-town.json
index 3956bc8..43eb76c 100644
--- a/db/_generated/areas/cotton-town.json
+++ b/db/_generated/areas/cotton-town.json
@@ -1 +1 @@
-{"encounter_slug":"","encounters":[],"requiredEncounters":0,"trainers":[],"environment_slug":"interior","events":{"dryads-grove":false},"connections":{"route1":{"conditions":[]},"route2":{"conditions":[]},"dryads-grove":{"conditions":["event.dryads-grove"]}},"environment":{"slug":"interior","battle_graphics":{"island_back":"paper_back_island.png","island_front":"paper_front_island.png","background":"battle_bg03.png"},"battle_music":"music_battle_loop"}} \ No newline at end of file
+{"name":"Cotton Town","encounter_slug":"","encounters":[],"requiredEncounters":0,"trainers":[],"environment_slug":"interior","locations":{"healing_center":{"type":"healingCenter","price":10},"cotton_scoop":{"type":"shop","economy":"cotton_scoop","items":[{"item_name":"potion","price":20,"cost":5},{"item_name":"revive","price":100,"cost":20},{"item_name":"tuxeball","price":50,"cost":10}]}},"events":{"dryads-grove":false},"connections":{"route1":{"conditions":[],"name":"Route 1"},"route2":{"conditions":[],"name":"Route 2"},"dryads-grove":{"conditions":["event.dryads-grove"],"name":"Dryad's Grove"}},"environment":{"slug":"interior","battle_graphics":{"island_back":"paper_back_island.png","island_front":"paper_front_island.png","background":"battle_bg03.png"},"battle_music":"music_battle_loop"},"map":"<svg\n version=\"1.1\"\n xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n viewbox=\"0 0 640 640\"\n>\n <image href=\"\/db\/maps\/Cotton_town.png\" \/>\n\n <text x=\"275\" y=\"445\">Healing Center<\/text>\n <rect data-location=\"healing_center\" x=\"288\" y=\"368\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n\n <text x=\"470\" y=\"573\">Shop<\/text>\n <rect data-location=\"cotton_scoop\" x=\"448\" y=\"496\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n<\/svg>\n"} \ No newline at end of file
diff --git a/db/_generated/areas/dryads-grove.json b/db/_generated/areas/dryads-grove.json
new file mode 100644
index 0000000..61275fe
--- /dev/null
+++ b/db/_generated/areas/dryads-grove.json
@@ -0,0 +1 @@
+{"name":"Dryad's Grove","encounter_slug":"","encounters":[],"requiredEncounters":0,"trainers":[],"environment_slug":"interior","connections":[],"environment":{"slug":"interior","battle_graphics":{"island_back":"paper_back_island.png","island_front":"paper_front_island.png","background":"battle_bg03.png"},"battle_music":"music_battle_loop"},"map":false} \ No newline at end of file
diff --git a/db/_generated/areas/leather-town.json b/db/_generated/areas/leather-town.json
index cf191d6..9cd0551 100644
--- a/db/_generated/areas/leather-town.json
+++ b/db/_generated/areas/leather-town.json
@@ -1 +1 @@
-{"encounter_slug":"","encounters":[],"requiredEncounters":0,"trainers":[],"environment_slug":"interior","connections":{"city-park":{"conditions":[]},"route3":{"conditions":[]}},"environment":{"slug":"interior","battle_graphics":{"island_back":"paper_back_island.png","island_front":"paper_front_island.png","background":"battle_bg03.png"},"battle_music":"music_battle_loop"}} \ No newline at end of file
+{"name":"Leather Town","encounter_slug":"","encounters":[],"requiredEncounters":0,"trainers":[],"environment_slug":"interior","shops":{"leather_scoop":[]},"connections":{"city-park":{"conditions":[],"name":"City Park"},"route3":{"conditions":[],"name":"Route 3"}},"environment":{"slug":"interior","battle_graphics":{"island_back":"paper_back_island.png","island_front":"paper_front_island.png","background":"battle_bg03.png"},"battle_music":"music_battle_loop"},"map":false} \ No newline at end of file
diff --git a/db/_generated/areas/paper-town.json b/db/_generated/areas/paper-town.json
index 8c0f0d4..6a41be0 100644
--- a/db/_generated/areas/paper-town.json
+++ b/db/_generated/areas/paper-town.json
@@ -1 +1 @@
-{"encounter_slug":"","encounters":[],"requiredEncounters":0,"trainers":[{"name":"Rival","monsters":[{"slug":"STARTER","level":2}],"inventory":[]}],"environment_slug":"interior","connections":{"route1":{"conditions":["encounters","trainers"]}},"environment":{"slug":"interior","battle_graphics":{"island_back":"paper_back_island.png","island_front":"paper_front_island.png","background":"battle_bg03.png"},"battle_music":"music_battle_loop"}} \ No newline at end of file
+{"name":"Paper Town","encounter_slug":"","encounters":[],"requiredEncounters":0,"trainers":[{"name":"Rival","monsters":[{"slug":"STARTER","level":2}],"inventory":[]}],"environment_slug":"interior","connections":{"route1":{"conditions":["encounters","trainers"],"name":"Route 1"}},"environment":{"slug":"interior","battle_graphics":{"island_back":"paper_back_island.png","island_front":"paper_front_island.png","background":"battle_bg03.png"},"battle_music":"music_battle_loop"},"map":false} \ No newline at end of file
diff --git a/db/_generated/areas/route1.json b/db/_generated/areas/route1.json
index a7c9987..02a1af0 100644
--- a/db/_generated/areas/route1.json
+++ b/db/_generated/areas/route1.json
@@ -1 +1 @@
-{"encounter_slug":"route1","encounters":[{"monster":"pairagrin","encounter_rate":3.5,"daytime":true,"exp_req_mod":1,"level_range":[2,4]},{"monster":"aardorn","encounter_rate":3.5,"daytime":true,"exp_req_mod":1,"level_range":[2,4]},{"monster":"cataspike","encounter_rate":3.5,"daytime":true,"exp_req_mod":1,"level_range":[2,4]},{"monster":"pairagrin","encounter_rate":3.5,"daytime":false,"exp_req_mod":1,"level_range":[3,5]},{"monster":"aardorn","encounter_rate":3.5,"daytime":false,"exp_req_mod":1,"level_range":[3,5]},{"monster":"cataspike","encounter_rate":3.5,"daytime":false,"exp_req_mod":1,"level_range":[3,5]}],"requiredEncounters":10,"trainers":[{"name":"Bruder Mikki","sprite":"dragonrider.png","monsters":[{"slug":"memnomnom","level":5},{"slug":"jelillow","level":5}],"inventory":[{"slug":"potion","quantity":2}]}],"environment_slug":"forest","connections":{"paper-town":{"conditions":[]},"cotton-town":{"conditions":["encounters","trainers"]}},"environment":{"slug":"forest","battle_graphics":{"island_back":"woodland_island.png","island_front":"woodland_island.png","background":"forest_background.png"},"battle_music":"music_battle_loop"}} \ No newline at end of file
+{"name":"Route 1","encounter_slug":"route1","encounters":[{"monster":"pairagrin","encounter_rate":3.5,"daytime":true,"exp_req_mod":1,"level_range":[2,4]},{"monster":"aardorn","encounter_rate":3.5,"daytime":true,"exp_req_mod":1,"level_range":[2,4]},{"monster":"cataspike","encounter_rate":3.5,"daytime":true,"exp_req_mod":1,"level_range":[2,4]},{"monster":"pairagrin","encounter_rate":3.5,"daytime":false,"exp_req_mod":1,"level_range":[3,5]},{"monster":"aardorn","encounter_rate":3.5,"daytime":false,"exp_req_mod":1,"level_range":[3,5]},{"monster":"cataspike","encounter_rate":3.5,"daytime":false,"exp_req_mod":1,"level_range":[3,5]}],"requiredEncounters":10,"trainers":[{"name":"Bruder Mikki","sprite":"dragonrider.png","monsters":[{"slug":"memnomnom","level":5},{"slug":"jelillow","level":5}],"inventory":[{"slug":"potion","quantity":2}]}],"environment_slug":"forest","connections":{"paper-town":{"conditions":[],"name":"Paper Town"},"cotton-town":{"conditions":["encounters","trainers"],"name":"Cotton Town"}},"environment":{"slug":"forest","battle_graphics":{"island_back":"woodland_island.png","island_front":"woodland_island.png","background":"forest_background.png"},"battle_music":"music_battle_loop"},"map":false} \ No newline at end of file
diff --git a/db/_generated/areas/route2.json b/db/_generated/areas/route2.json
index 719fc7a..5ef92c5 100644
--- a/db/_generated/areas/route2.json
+++ b/db/_generated/areas/route2.json
@@ -1 +1 @@
-{"encounter_slug":"route2","encounters":[{"monster":"cardiling","encounter_rate":2.5,"daytime":true,"exp_req_mod":1,"level_range":[3,6]},{"monster":"aardorn","encounter_rate":2.5,"daytime":true,"exp_req_mod":1,"level_range":[3,6]},{"monster":"eyenemy","encounter_rate":2.5,"daytime":true,"exp_req_mod":1,"level_range":[3,6]},{"monster":"axylightl","encounter_rate":1,"daytime":true,"exp_req_mod":1,"level_range":[4,7]},{"monster":"cataspike","encounter_rate":2.5,"daytime":true,"exp_req_mod":1,"level_range":[3,6]},{"monster":"cardiling","encounter_rate":2.5,"daytime":false,"exp_req_mod":1,"level_range":[3,6]},{"monster":"aardorn","encounter_rate":2.5,"daytime":false,"exp_req_mod":1,"level_range":[4,8]},{"monster":"eyenemy","encounter_rate":2.5,"daytime":false,"exp_req_mod":1,"level_range":[4,8]},{"monster":"axylightl","encounter_rate":1,"daytime":false,"exp_req_mod":1,"level_range":[5,8]},{"monster":"cataspike","encounter_rate":2.5,"daytime":false,"exp_req_mod":1,"level_range":[4,8]}],"requiredEncounters":10,"trainers":[{"name":"Rival","monsters":[{"slug":"cardiling","level":3},{"slug":"eyenemy","level":6},{"slug":"STARTER","level":6}],"inventory":[]}],"environment_slug":"forest","connections":{"cotton-town":{"conditions":[]},"city-park":{"conditions":["encounters","trainers"]}},"environment":{"slug":"forest","battle_graphics":{"island_back":"woodland_island.png","island_front":"woodland_island.png","background":"forest_background.png"},"battle_music":"music_battle_loop"}} \ No newline at end of file
+{"name":"Route 2","encounter_slug":"route2","encounters":[{"monster":"cardiling","encounter_rate":2.5,"daytime":true,"exp_req_mod":1,"level_range":[3,6]},{"monster":"aardorn","encounter_rate":2.5,"daytime":true,"exp_req_mod":1,"level_range":[3,6]},{"monster":"eyenemy","encounter_rate":2.5,"daytime":true,"exp_req_mod":1,"level_range":[3,6]},{"monster":"axylightl","encounter_rate":1,"daytime":true,"exp_req_mod":1,"level_range":[4,7]},{"monster":"cataspike","encounter_rate":2.5,"daytime":true,"exp_req_mod":1,"level_range":[3,6]},{"monster":"cardiling","encounter_rate":2.5,"daytime":false,"exp_req_mod":1,"level_range":[3,6]},{"monster":"aardorn","encounter_rate":2.5,"daytime":false,"exp_req_mod":1,"level_range":[4,8]},{"monster":"eyenemy","encounter_rate":2.5,"daytime":false,"exp_req_mod":1,"level_range":[4,8]},{"monster":"axylightl","encounter_rate":1,"daytime":false,"exp_req_mod":1,"level_range":[5,8]},{"monster":"cataspike","encounter_rate":2.5,"daytime":false,"exp_req_mod":1,"level_range":[4,8]}],"requiredEncounters":10,"trainers":[{"name":"Rival","monsters":[{"slug":"cardiling","level":3},{"slug":"eyenemy","level":6},{"slug":"STARTER","level":6}],"inventory":[]}],"environment_slug":"forest","connections":{"cotton-town":{"conditions":[],"name":"Cotton Town"},"city-park":{"conditions":["encounters","trainers"],"name":"City Park"}},"environment":{"slug":"forest","battle_graphics":{"island_back":"woodland_island.png","island_front":"woodland_island.png","background":"forest_background.png"},"battle_music":"music_battle_loop"},"map":false} \ No newline at end of file
diff --git a/db/_generated/areas/route3.json b/db/_generated/areas/route3.json
index 6d248cc..fbd07f4 100644
--- a/db/_generated/areas/route3.json
+++ b/db/_generated/areas/route3.json
@@ -1 +1 @@
-{"encounter_slug":"route3","encounters":[{"monster":"cardiling","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[7,10]},{"monster":"elofly","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[7,10]},{"monster":"squabbit","encounter_rate":1,"daytime":true,"exp_req_mod":1,"level_range":[8,11]},{"monster":"shybulb","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[7,10]},{"monster":"cardiling","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[9,12]},{"monster":"elofly","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[9,12]},{"monster":"squabbit","encounter_rate":1,"daytime":false,"exp_req_mod":1,"level_range":[9,12]},{"monster":"shybulb","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[9,12]}],"requiredEncounters":10,"trainers":[{"name":"Miner Roxby","sprite":"miner.png","monsters":[{"slug":"rockitten","level":13},{"slug":"ignibus","level":13}]}],"environment_slug":"forest","connections":{"leather-town":{"conditions":[]}},"environment":{"slug":"forest","battle_graphics":{"island_back":"woodland_island.png","island_front":"woodland_island.png","background":"forest_background.png"},"battle_music":"music_battle_loop"}} \ No newline at end of file
+{"name":"Route 3","encounter_slug":"route3","encounters":[{"monster":"cardiling","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[7,10]},{"monster":"elofly","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[7,10]},{"monster":"squabbit","encounter_rate":1,"daytime":true,"exp_req_mod":1,"level_range":[8,11]},{"monster":"shybulb","encounter_rate":3,"daytime":true,"exp_req_mod":1,"level_range":[7,10]},{"monster":"cardiling","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[9,12]},{"monster":"elofly","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[9,12]},{"monster":"squabbit","encounter_rate":1,"daytime":false,"exp_req_mod":1,"level_range":[9,12]},{"monster":"shybulb","encounter_rate":3,"daytime":false,"exp_req_mod":1,"level_range":[9,12]}],"requiredEncounters":10,"trainers":[{"name":"Miner Roxby","sprite":"miner.png","monsters":[{"slug":"rockitten","level":13},{"slug":"ignibus","level":13}]}],"environment_slug":"forest","connections":{"leather-town":{"conditions":[],"name":"Leather Town"}},"environment":{"slug":"forest","battle_graphics":{"island_back":"woodland_island.png","island_front":"woodland_island.png","background":"forest_background.png"},"battle_music":"music_battle_loop"},"map":false} \ No newline at end of file
diff --git a/db/_generated/currencies.json b/db/_generated/currencies.json
index d3dc796..3778e32 100644
--- a/db/_generated/currencies.json
+++ b/db/_generated/currencies.json
@@ -1 +1 @@
-{"last_updated":"2023-08-21","map":{"AUD":{"rate":1.6995,"symbol":"$","name":"Australian Dollar","decimals":2},"BGN":{"rate":1.9558,"symbol":"\u043b\u0432","name":"Bulgarian Lev","decimals":2},"BRL":{"rate":5.414,"symbol":"R$","name":"Brazilian Real","decimals":2},"CAD":{"rate":1.4723,"symbol":"$","name":"Canadian Dollar","decimals":2},"CHF":{"rate":0.9588,"symbol":"CHF","name":"Swiss Franc","decimals":2},"CNY":{"rate":7.9456,"symbol":"\u00a5","name":"Chinese Yuan","decimals":2},"CZK":{"rate":24.02,"symbol":"K\u010d","name":"Czech Republic Koruna","decimals":2},"DKK":{"rate":7.4524,"symbol":"kr","name":"Danish Krone","decimals":2},"GBP":{"rate":0.85475,"symbol":"\u00a3","name":"British Pound Sterling","decimals":2},"HKD":{"rate":8.5488,"symbol":"$","name":"Hong Kong Dollar","decimals":2},"HUF":{"rate":381.73,"symbol":"Ft","name":"Hungarian Forint","decimals":2},"IDR":{"rate":16718,"symbol":"Rp","name":"Indonesian Rupiah","decimals":2},"ILS":{"rate":4.1395,"symbol":"\u20aa","name":"Israeli New Sheqel","decimals":2},"INR":{"rate":90.66,"symbol":"\u20b9","name":"Indian Rupee","decimals":2},"ISK":{"rate":143.7,"symbol":"kr","name":"Icelandic Kr\u00f3na","decimals":2},"JPY":{"rate":159.15,"symbol":"\u00a5","name":"Japanese Yen","decimals":0},"KRW":{"rate":1460.32,"symbol":"\u20a9","name":"South Korean Won","decimals":2},"MXN":{"rate":18.5927,"symbol":"$","name":"Mexican Peso","decimals":2},"MYR":{"rate":5.0706,"symbol":"RM","name":"Malaysian Ringgit","decimals":2},"NOK":{"rate":11.5205,"symbol":"kr","name":"Norwegian Krone","decimals":2},"NZD":{"rate":1.8407,"symbol":"$","name":"New Zealand Dollar","decimals":2},"PHP":{"rate":61.543,"symbol":"\u20b1","name":"Philippine Peso","decimals":2},"PLN":{"rate":4.4785,"symbol":"z\u0142","name":"Polish Zloty","decimals":2},"RON":{"rate":4.9406,"symbol":"lei","name":"Romanian Leu","decimals":2},"SEK":{"rate":11.9095,"symbol":"kr","name":"Swedish Krona","decimals":2},"SGD":{"rate":1.4791,"symbol":"S$","name":"Singapore Dollar","decimals":2},"THB":{"rate":38.314,"symbol":"\u0e3f","name":"Thai Baht","decimals":2},"TRY":{"rate":29.63,"symbol":"\u20ba","name":"Turkish Lira","decimals":2},"USD":{"rate":1.0908,"symbol":"$","name":"United States Dollar","decimals":2},"ZAR":{"rate":20.676,"symbol":"R","name":"South African Rand","decimals":2},"EUR":{"rate":1,"symbol":"\u20ac","name":"Euro","decimals":2}}} \ No newline at end of file
+{"last_updated":"2023-08-22","map":{"AUD":{"rate":1.6878,"symbol":"$","name":"Australian Dollar","decimals":2},"BGN":{"rate":1.9558,"symbol":"\u043b\u0432","name":"Bulgarian Lev","decimals":2},"BRL":{"rate":5.3891,"symbol":"R$","name":"Brazilian Real","decimals":2},"CAD":{"rate":1.4716,"symbol":"$","name":"Canadian Dollar","decimals":2},"CHF":{"rate":0.9565,"symbol":"CHF","name":"Swiss Franc","decimals":2},"CNY":{"rate":7.9387,"symbol":"\u00a5","name":"Chinese Yuan","decimals":2},"CZK":{"rate":24,"symbol":"K\u010d","name":"Czech Republic Koruna","decimals":2},"DKK":{"rate":7.4535,"symbol":"kr","name":"Danish Krone","decimals":2},"GBP":{"rate":0.85288,"symbol":"\u00a3","name":"British Pound Sterling","decimals":2},"HKD":{"rate":8.5328,"symbol":"$","name":"Hong Kong Dollar","decimals":2},"HUF":{"rate":382.03,"symbol":"Ft","name":"Hungarian Forint","decimals":2},"IDR":{"rate":16699,"symbol":"Rp","name":"Indonesian Rupiah","decimals":2},"ILS":{"rate":4.1069,"symbol":"\u20aa","name":"Israeli New Sheqel","decimals":2},"INR":{"rate":90.32,"symbol":"\u20b9","name":"Indian Rupee","decimals":2},"ISK":{"rate":143.7,"symbol":"kr","name":"Icelandic Kr\u00f3na","decimals":2},"JPY":{"rate":158.7,"symbol":"\u00a5","name":"Japanese Yen","decimals":0},"KRW":{"rate":1454.59,"symbol":"\u20a9","name":"South Korean Won","decimals":0},"MXN":{"rate":18.4223,"symbol":"$","name":"Mexican Peso","decimals":2},"MYR":{"rate":5.0603,"symbol":"RM","name":"Malaysian Ringgit","decimals":2},"NOK":{"rate":11.5195,"symbol":"kr","name":"Norwegian Krone","decimals":2},"NZD":{"rate":1.8264,"symbol":"$","name":"New Zealand Dollar","decimals":2},"PHP":{"rate":61.251,"symbol":"\u20b1","name":"Philippine Peso","decimals":2},"PLN":{"rate":4.4643,"symbol":"z\u0142","name":"Polish Zloty","decimals":2},"RON":{"rate":4.9376,"symbol":"lei","name":"Romanian Leu","decimals":2},"SEK":{"rate":11.863,"symbol":"kr","name":"Swedish Krona","decimals":2},"SGD":{"rate":1.4754,"symbol":"S$","name":"Singapore Dollar","decimals":2},"THB":{"rate":38.126,"symbol":"\u0e3f","name":"Thai Baht","decimals":2},"TRY":{"rate":29.614,"symbol":"\u20ba","name":"Turkish Lira","decimals":2},"USD":{"rate":1.0887,"symbol":"$","name":"United States Dollar","decimals":2},"ZAR":{"rate":20.393,"symbol":"R","name":"South African Rand","decimals":2},"EUR":{"rate":1,"symbol":"\u20ac","name":"Euro","decimals":2}}} \ No newline at end of file
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));
}
diff --git a/db/areas/city-park.json b/db/areas/city-park.json
index 113cf51..d0e5af3 100644
--- a/db/areas/city-park.json
+++ b/db/areas/city-park.json
@@ -1,4 +1,6 @@
{
+ "name": "City Park",
+
"encounter_slug": "citypark",
"encounters": [],
diff --git a/db/areas/cotton-town.json b/db/areas/cotton-town.json
index dfd73e5..1f12f73 100644
--- a/db/areas/cotton-town.json
+++ b/db/areas/cotton-town.json
@@ -1,4 +1,6 @@
{
+ "name": "Cotton Town",
+
"encounter_slug": "",
"encounters": [],
@@ -9,6 +11,18 @@
"environment_slug": "interior",
+ "locations": {
+ "healing_center": {
+ "type": "healingCenter",
+ "price": 10
+ },
+ "cotton_scoop": {
+ "type": "shop",
+ "economy": "cotton_scoop",
+ "items": []
+ }
+ },
+
"events": {
"dryads-grove": false
},
diff --git a/db/areas/dryads-grove.json b/db/areas/dryads-grove.json
new file mode 100644
index 0000000..a0a75cc
--- /dev/null
+++ b/db/areas/dryads-grove.json
@@ -0,0 +1,15 @@
+{
+ "name": "Dryad's Grove",
+
+ "encounter_slug": "",
+
+ "encounters": [],
+
+ "requiredEncounters": 0,
+
+ "trainers": [],
+
+ "environment_slug": "interior",
+
+ "connections": {}
+}
diff --git a/db/areas/leather-town.json b/db/areas/leather-town.json
index 7815dfd..5cb24d7 100644
--- a/db/areas/leather-town.json
+++ b/db/areas/leather-town.json
@@ -1,4 +1,6 @@
{
+ "name": "Leather Town",
+
"encounter_slug": "",
"encounters": [],
@@ -9,6 +11,18 @@
"environment_slug": "interior",
+ "locations": {
+ "healing_center": {
+ "type": "healingCenter",
+ "price": 20
+ },
+ "leather_scoop": {
+ "type": "shop",
+ "economy": "leather_scoop",
+ "items": []
+ }
+ },
+
"connections": {
"city-park": {
"conditions": []
diff --git a/db/areas/paper-town.json b/db/areas/paper-town.json
index 7020252..688dd7f 100644
--- a/db/areas/paper-town.json
+++ b/db/areas/paper-town.json
@@ -1,4 +1,6 @@
{
+ "name": "Paper Town",
+
"encounter_slug": "",
"encounters": [],
diff --git a/db/areas/route1.json b/db/areas/route1.json
index 1615772..5c49e04 100644
--- a/db/areas/route1.json
+++ b/db/areas/route1.json
@@ -1,4 +1,6 @@
{
+ "name": "Route 1",
+
"encounter_slug": "route1",
"encounters": [],
diff --git a/db/areas/route2.json b/db/areas/route2.json
index e4c6d2a..b08e1af 100644
--- a/db/areas/route2.json
+++ b/db/areas/route2.json
@@ -1,4 +1,6 @@
{
+ "name": "Route 2",
+
"encounter_slug": "route2",
"encounters": [],
diff --git a/db/areas/route3.json b/db/areas/route3.json
index 3fa7c2f..ea59234 100644
--- a/db/areas/route3.json
+++ b/db/areas/route3.json
@@ -1,4 +1,6 @@
{
+ "name": "Route 3",
+
"encounter_slug": "route3",
"encounters": [],
diff --git a/db/currencies/currencies.php b/db/currencies.php
index 7c8b2ac..7df3993 100644
--- a/db/currencies/currencies.php
+++ b/db/currencies.php
@@ -14,6 +14,7 @@ $currencyNames = json_decode(file_get_contents('https://openexchangerates.org/ap
$decimals = [
'JPY' => 0,
+ 'KRW' => 0,
];
$currencies = [];
@@ -37,6 +38,6 @@ $currencies['map']['EUR'] = [
];
file_put_contents(
- dirname(__DIR__) . '/_generated/currencies.json',
+ __DIR__ . '/_generated/currencies.json',
json_encode($currencies)
);
diff --git a/db/maps/Cotton_town.png b/db/maps/Cotton_town.png
new file mode 100644
index 0000000..bc795b4
--- /dev/null
+++ b/db/maps/Cotton_town.png
Binary files differ
diff --git a/db/maps/cotton-town.svg b/db/maps/cotton-town.svg
new file mode 100644
index 0000000..d2d7314
--- /dev/null
+++ b/db/maps/cotton-town.svg
@@ -0,0 +1,13 @@
+<svg
+ version="1.1"
+ xmlns="http://www.w3.org/2000/svg"
+ viewbox="0 0 640 640"
+>
+ <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/index.html b/index.html
index 0cd65fe..73e5f93 100644
--- a/index.html
+++ b/index.html
@@ -25,21 +25,23 @@
<div id="techniques"></div>
</div>
- <div id="scene__town" class="hidden">
- <div id="shop">
- Shop
- Potion x1
- </div>
- </div>
+ <div id="scene__town" class="hidden"></div>
<div id="log"></div>
<div id="status">
- <span>Money: <span data-template-slot="money"></span></span>
- <span><img src="/modules/tuxemon/mods/tuxemon/gfx/ui/menu/tuxemon.png" title="Monster Progress" /> <span data-template-slot="monsterProgress"></span></span>
- <span><img src="/modules/tuxemon/mods/tuxemon/gfx/ui/menu/player.png" title="Trainer Progress" style="filter: invert(1);" /> <span data-template-slot="trainerProgress"></span></span>
- <button data-template-slot="nextTrainer" class="menu-button">&rArr; Next Trainer</button>
- <button data-template-slot="changeArea" class="menu-button">&rArr; Change Area</button>
+ <div class="status__area">
+ <span><img data-template-slot="showMap" src="/modules/tuxemon/mods/tuxemon/gfx/items/app_map.png" /> <span data-template-slot="area" title="Area"></span></span>
+ </div>
+ <div class="status__numbers">
+ <span><i title="Money">&curren;</i> <span data-template-slot="money"></span></span>
+ <span><img src="/modules/tuxemon/mods/tuxemon/gfx/ui/menu/tuxemon.png" title="Monster Progress" /> <span data-template-slot="monsterProgress"></span></span>
+ <span><img src="/modules/tuxemon/mods/tuxemon/gfx/ui/menu/player.png" title="Trainer Progress" style="filter: invert(1);" /> <span data-template-slot="trainerProgress"></span></span>
+ </div>
+ <div class="status__actions">
+ <button data-template-slot="nextTrainer" class="menu-button">&rArr; Next Trainer</button>
+ <button data-template-slot="changeArea" class="menu-button">&rArr; Change Area</button>
+ </div>
</div>
<div id="menu">
@@ -242,6 +244,17 @@
</div>
</template>
+ <template id="tpl___area-selection">
+ <div class="area-selection"></div>
+ </template>
+
+ <template id="tpl___area-selection__item">
+ <div class="area-selection__item menu-button">
+ &rArr;
+ <span data-template-slot="text"></span>
+ </div>
+ </template>
+
<template id="tpl___inventory">
<div class="inventory">
<div data-template-slot="items"></div>
diff --git a/resources/css/menu.css b/resources/css/menu.css
index 84c6c77..8b0cb0b 100644
--- a/resources/css/menu.css
+++ b/resources/css/menu.css
@@ -97,23 +97,39 @@
color: #fff;
background-color: #000;
padding: 0.5rem;
+ font-size: 1.25rem;
+}
+
+#status > div + div {
+ margin-top: 0.25rem;
+}
+.status__area > span {
display: flex;
- justify-content: space-between;
+ justify-content: center;
align-items: center;
-
- font-size: 1.25rem;
+}
+.status__area > span > span {
+ margin: 0 0.5rem;
}
-#status > span {
+.status__numbers {
+ display: flex;
+ justify-content: space-between;
+}
+.status__numbers > span {
display: flex;
align-items: center;
}
-#status > span > span {
+.status__numbers > span > span {
margin-left: 0.5rem;
}
-#status .menu-button:hover {
+.status__actions {
+ display: flex;
+ justify-content: space-between;
+}
+.status__actions .menu-button:hover {
background-color: rgba(255, 255, 255, 0.5);
}
@@ -200,6 +216,26 @@
+.area-selection {
+ padding: 1rem;
+}
+
+.area-selection__item {
+ display: grid;
+ grid-template-columns: 2.5rem 1fr;
+}
+
+.area-selection__item + .area-selection__item {
+ margin-top: 1rem;
+}
+
+.area-selection__item > span {
+ text-align: center;
+}
+
+
+
+
.inventory__popup {
align-items: start;
}
diff --git a/resources/css/town.css b/resources/css/town.css
index 4dd8195..b8be144 100644
--- a/resources/css/town.css
+++ b/resources/css/town.css
@@ -1,3 +1,11 @@
-#scene__town {
- background-color: #fff;
+#scene__town {}
+
+#scene__town svg {
+ width: 100%;
+ height: 100%;
+ display: block;
+}
+
+svg [data-location] {
+ cursor: pointer;
}
diff --git a/resources/js/classes/Area.js b/resources/js/classes/Area.js
index b2af3ea..b0bd710 100644
--- a/resources/js/classes/Area.js
+++ b/resources/js/classes/Area.js
@@ -11,6 +11,10 @@ class Area {
async initialize () {}
+ get name () {
+ return DB.areas[this.slug].name;
+ }
+
get encounters () {
return DB.areas[this.slug].encounters;
}
@@ -27,6 +31,14 @@ class Area {
return DB.areas[this.slug].environment;
}
+ get map () {
+ return DB.areas[this.slug].map;
+ }
+
+ get locations () {
+ return DB.areas[this.slug].locations;
+ }
+
get events () {
return DB.areas[this.slug].events;
}
diff --git a/resources/js/game.js b/resources/js/game.js
index 7b40015..9370382 100644
--- a/resources/js/game.js
+++ b/resources/js/game.js
@@ -111,6 +111,7 @@ const Game = {
} else if (Memory.state.opponent.type === 'trainer') {
if (Memory.state.opponent.activeMonster === Memory.state.opponent.monsters[Memory.state.opponent.monsters.length - 1]) {
Memory.state.currentArea.trainerProgress++;
+ Memory.state.currentArea.monsterProgress = 0;
if (Memory.state.currentArea.encounters.length > 0) {
await Game.encounterWildMonster();
} else {
@@ -708,6 +709,8 @@ const Game = {
if (Game.isTown(Memory.state.currentArea)) {
UI.elements.sceneBattle.classList.add('hidden');
UI.elements.sceneTown.classList.remove('hidden');
+
+ UI.drawTown();
} else {
UI.elements.sceneTown.classList.add('hidden');
UI.elements.sceneBattle.classList.remove('hidden');
diff --git a/resources/js/helpers.js b/resources/js/helpers.js
index 2395878..e9cb37d 100644
--- a/resources/js/helpers.js
+++ b/resources/js/helpers.js
@@ -4,7 +4,13 @@
* @returns {(string|MonsterSlug|TechniqueSlug)}
*/
function slugToName (slug) {
- return slug.split('_').map((item) => item.charAt(0).toUpperCase() + item.slice(1)).join(' ');
+ const ucfirst = (str) => {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+ };
+
+ return slug
+ .split('_').map((item) => ucfirst(item)).join(' ')
+ .split('-').map((item) => ucfirst(item)).join(' ');
}
/**
diff --git a/resources/js/ui.js b/resources/js/ui.js
index a40550b..3940574 100644
--- a/resources/js/ui.js
+++ b/resources/js/ui.js
@@ -22,6 +22,9 @@ const Template = {
movesetList: document.querySelector('#tpl___moveset__list'),
movesetItem: document.querySelector('#tpl___moveset__item'),
+ areaSelection: document.querySelector('#tpl___area-selection'),
+ areaSelectionItem: document.querySelector('#tpl___area-selection__item'),
+
inventory: document.querySelector('#tpl___inventory'),
inventoryItem: document.querySelector('#tpl___inventory__item'),
@@ -628,6 +631,49 @@ const UI = {
},
+ /* Town */
+
+ async drawTown () {
+ const currentArea = Memory.state.currentArea;
+
+ UI.elements.sceneTown.innerHTML = Memory.state.currentArea.map;
+
+ for (const locationId of Object.keys(currentArea.locations)) {
+ const location = currentArea.locations[locationId];
+
+ UI.elements.sceneTown.querySelector(`[data-location="${locationId}"]`).addEventListener('click', () => {
+ if (location.type === 'healingCenter') {
+ UI.openHealingCenter(location);
+ }
+
+ else if (location.type === 'shop') {
+ UI.openShop(location);
+ }
+ });
+ }
+ },
+
+ openHealingCenter (healingCenter) {},
+
+ async openShop (shop) {
+ const popup = UI.createPopup();
+ const template = document.createElement('div');
+
+ for (const itemData of shop.items) {
+ const item = await fetchItem(itemData.item_name);
+ const itemNode = document.createElement('div');
+
+ itemNode.innerHTML = `<img src="/modules/tuxemon/mods/tuxemon/${item.sprite}" />`;
+ itemNode.innerHTML += `${item.name}`;
+ itemNode.innerHTML += `${itemData.price} ${DB.currencies.map[Memory.state.Settings.currency].symbol}`;
+
+ template.appendChild(itemNode);
+ }
+
+ popup.querySelector('.popup').appendChild(template);
+ UI.drawPopup(popup);
+ },
+
/* Menu */
@@ -688,6 +734,7 @@ const UI = {
`${Memory.state.money.toFixed(DB.currencies.map[Memory.state.Settings.currency].decimals)}` +
' ' +
`${DB.currencies.map[Memory.state.Settings.currency].symbol}`;
+ UI.elements.status.querySelector('[data-template-slot="area"]').textContent = currentArea.name;
UI.elements.status.querySelector('[data-template-slot="monsterProgress"]').textContent = `${currentArea.monsterProgress} / ${currentArea.requiredEncounters}`;
UI.elements.status.querySelector('[data-template-slot="trainerProgress"]').textContent = `${currentArea.trainerProgress} / ${currentArea.trainers.length}`;
@@ -705,14 +752,14 @@ const UI = {
openAreaSelection () {
const popup = UI.createPopup();
- const template = document.createElement('div');
+ const template = UI.createTemplate(Template.areaSelection);
const currentArea = Memory.state.currentArea;
for (const connectionSlug in currentArea.connections) {
const connection = currentArea.connections[connectionSlug];
- const connectionNode = document.createElement('div');
+ const connectionNode = UI.createTemplate(Template.areaSelectionItem);
- connectionNode.textContent = slugToName(connectionSlug);
+ connectionNode.querySelector('[data-template-slot="text"]').textContent = connection.name;
let canGo = true;
for (const condition of connection.conditions) {
@@ -1020,6 +1067,7 @@ const UI = {
const exchangedMoney = baseRateMoney * newCurrency.rate;
Memory.state.money = Number(exchangedMoney.toFixed(newCurrency.decimals));
+ UI.drawTown();
UI.drawStatus();
});