|
@@ -43,14 +43,14 @@ discard block |
|
|
block discarded – undo |
|
43
|
43
|
$moves_file = json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/moves.json')); |
|
44
|
44
|
} |
|
45
|
45
|
} else { |
|
46
|
|
- $pokemon_file = file_get_contents(SYS_PATH.'/core/json/locales/EN/pokes.json'); |
|
47
|
|
- $translation_file = file_get_contents(SYS_PATH.'/core/json/locales/EN/translations.json'); |
|
|
46
|
+ $pokemon_file = file_get_contents(SYS_PATH.'/core/json/locales/EN/pokes.json'); |
|
|
47
|
+ $translation_file = file_get_contents(SYS_PATH.'/core/json/locales/EN/translations.json'); |
|
48
|
48
|
$moves_file = json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/moves.json')); |
|
49
|
49
|
} |
|
50
|
50
|
} else { |
|
51
|
51
|
$pokemon_file = file_get_contents(SYS_PATH.'/core/json/locales/EN/pokes.json'); |
|
52
|
|
- $translation_file = file_get_contents(SYS_PATH.'/core/json/locales/EN/translations.json'); |
|
53
|
|
- $moves_file = json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/moves.json')); |
|
|
52
|
+ $translation_file = file_get_contents(SYS_PATH.'/core/json/locales/EN/translations.json'); |
|
|
53
|
+ $moves_file = json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/moves.json')); |
|
54
|
54
|
} |
|
55
|
55
|
|
|
56
|
56
|
|
|
@@ -60,23 +60,23 @@ discard block |
|
|
block discarded – undo |
|
60
|
60
|
// always overwrite english if available |
|
61
|
61
|
######################################## |
|
62
|
62
|
|
|
63
|
|
-$locales = (object) array_replace(json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/translations.json'), true), json_decode($translation_file, true)); |
|
|
63
|
+$locales = (object) array_replace(json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/translations.json'), true), json_decode($translation_file, true)); |
|
64
|
64
|
|
|
65
|
65
|
// Recursive replace because of multi level array |
|
66
|
|
-$pokemon_trans_array = array_replace_recursive(json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/pokes.json'), true), json_decode($pokemon_file, true)); |
|
|
66
|
+$pokemon_trans_array = array_replace_recursive(json_decode(file_get_contents(SYS_PATH.'/core/json/locales/EN/pokes.json'), true), json_decode($pokemon_file, true)); |
|
67
|
67
|
|
|
68
|
68
|
// convert associative array back to object array (recursive) |
|
69
|
|
-$pokemon_trans = json_decode(json_encode($pokemon_trans_array), false); |
|
|
69
|
+$pokemon_trans = json_decode(json_encode($pokemon_trans_array), false); |
|
70
|
70
|
unset($pokemon_trans_array); |
|
71
|
71
|
|
|
72
|
72
|
|
|
73
|
73
|
// Merge the pokedex, pokemon translation and rarity file into a new array |
|
74
|
74
|
########################################################################## |
|
75
|
75
|
|
|
76
|
|
-$pokedex_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json'); |
|
77
|
|
-$pokemons = json_decode($pokedex_file); |
|
|
76
|
+$pokedex_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json'); |
|
|
77
|
+$pokemons = json_decode($pokedex_file); |
|
78
|
78
|
|
|
79
|
|
-$pokedex_rarity_file = SYS_PATH.'/core/json/pokedex.rarity.json'; |
|
|
79
|
+$pokedex_rarity_file = SYS_PATH.'/core/json/pokedex.rarity.json'; |
|
80
|
80
|
// initial create of pokedex.rarity.json if it doesn't exist |
|
81
|
81
|
if (!is_file($pokedex_rarity_file)) { |
|
82
|
82
|
include_once(SYS_PATH.'/core/cron/pokedex.rarity.php'); |
|
@@ -86,14 +86,14 @@ discard block |
|
|
block discarded – undo |
|
86
|
86
|
|
|
87
|
87
|
foreach ($pokemons->pokemon as $pokeid => $pokemon) { |
|
88
|
88
|
// Merge name and description from translation files |
|
89
|
|
- $pokemon->name = $pokemon_trans->pokemon->$pokeid->name; |
|
90
|
|
- $pokemon->description = $pokemon_trans->pokemon->$pokeid->description; |
|
|
89
|
+ $pokemon->name = $pokemon_trans->pokemon->$pokeid->name; |
|
|
90
|
+ $pokemon->description = $pokemon_trans->pokemon->$pokeid->description; |
|
91
|
91
|
|
|
92
|
92
|
// Replace quick and charge move with translation |
|
93
|
|
- $quick_move = $pokemon->quick_move; |
|
94
|
|
- $pokemon->quick_move = $pokemon_trans->quick_moves->$quick_move; |
|
95
|
|
- $charge_move = $pokemon->charge_move; |
|
96
|
|
- $pokemon->charge_move = $pokemon_trans->charge_moves->$charge_move; |
|
|
93
|
+ $quick_move = $pokemon->quick_move; |
|
|
94
|
+ $pokemon->quick_move = $pokemon_trans->quick_moves->$quick_move; |
|
|
95
|
+ $charge_move = $pokemon->charge_move; |
|
|
96
|
+ $pokemon->charge_move = $pokemon_trans->charge_moves->$charge_move; |
|
97
|
97
|
|
|
98
|
98
|
// Replace types with translation |
|
99
|
99
|
foreach ($pokemon->types as &$type) { |
|
@@ -103,8 +103,8 @@ discard block |
|
|
block discarded – undo |
|
103
|
103
|
|
|
104
|
104
|
// Resolve candy_id to candy_name |
|
105
|
105
|
if (isset($pokemon->candy_id)) { |
|
106
|
|
- $candy_id = $pokemon->candy_id; |
|
107
|
|
- $pokemon->candy_name = $pokemon_trans->pokemon->$candy_id->name; |
|
|
106
|
+ $candy_id = $pokemon->candy_id; |
|
|
107
|
+ $pokemon->candy_name = $pokemon_trans->pokemon->$candy_id->name; |
|
108
|
108
|
unset($pokemon->candy_id); |
|
109
|
109
|
} |
|
110
|
110
|
// Convert move numbers to names |