Skip to content

Commit 873ba7d

Browse files
committed
Fixed stats and missing Pokemon
1 parent ee205a1 commit 873ba7d

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

mods/getdb.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ function parse_master_data($game_master_url) {
165165
if(!isset($row['stats']['attack']) || !isset($row['stats']['defense']) || !isset($row['stats']['stamina'])) {
166166
continue;
167167
}
168-
[$min_cp, $max_cp, $min_weather_cp, $max_weather_cp] = calculate_cps($row['stats']);
169168
$type = $type2 = '';
170169
foreach($row['types'] as $key => $data) {
171170
if($type == '') {
@@ -177,9 +176,17 @@ function parse_master_data($game_master_url) {
177176
$weather .= $weatherboost_table[$key];
178177
}
179178
foreach($row['forms'] as $formData) {
180-
if($formData['name'] == 'Shadow' || $formData['name'] == 'Purified') continue;
181-
$form_name = strtolower(preg_replace('/\s/', '_', $formData['name']));
182-
if($form_name == 'unset') $form_name = 'normal';
179+
if(($formData['name'] == 'Unset' && count($row['forms']) > 1) || $formData['name'] == 'Shadow' || $formData['name'] == 'Purified') continue;
180+
if($formData['name'] == 'Normal') {
181+
$pokemon_array[$pokemon_id]['protoName'] = str_replace('_NORMAL', '', $formData['proto']);
182+
$form_name = 'normal';
183+
}else {
184+
if(isset($pokemon_array[$pokemon_id]['protoName']))
185+
$form_name = str_replace($pokemon_array[$pokemon_id]['protoName'].'_', '', $formData['proto']);
186+
else
187+
$form_name = ($formData['proto'] == 'FORM_UNSET') ? 'normal' : $formData['proto'];
188+
}
189+
[$min_cp, $max_cp, $min_weather_cp, $max_weather_cp] = (isset($formData['stats'])) ? calculate_cps($formData['stats']) : calculate_cps($row['stats']);
183190
$form_id = $formData['form'];
184191
$pokemon_array[$pokemon_id][$form_name] = [
185192
'pokemon_name' => $pokemon_name,
@@ -211,6 +218,7 @@ function parse_master_data($game_master_url) {
211218
$weather .= $weatherboost_table[$key];
212219
}
213220
}
221+
[$min_cp, $max_cp, $min_weather_cp, $max_weather_cp] = calculate_cps($row['stats']);
214222
$pokemon_array[$pokemon_id][$form_name] = [
215223
'pokemon_name' => $pokemon_name,
216224
'pokemon_form_name' => $form_name,

0 commit comments

Comments
 (0)