diff --git a/logic/pokemon_keys.php b/logic/pokemon_keys.php index 6a6e4a1e..f282ef54 100644 --- a/logic/pokemon_keys.php +++ b/logic/pokemon_keys.php @@ -11,10 +11,13 @@ function pokemon_keys($gym_id_plus_letter, $raid_level, $action, $event_id = fal global $config; // Init empty keys array. $keys = []; - + $time_now = dt2time(utcnow(), 'Y-m-d H:i'); + + $egg_id = '999' . $raid_level; + // Get pokemon from database - $query = ' + $query = ' SELECT pokemon.id, pokemon.pokedex_id, pokemon.pokemon_form_id FROM raid_bosses LEFT JOIN pokemon @@ -25,24 +28,19 @@ function pokemon_keys($gym_id_plus_letter, $raid_level, $action, $event_id = fal DATE_SUB(\'' . $time_now . '\', INTERVAL '.$config->RAID_EGG_DURATION.' MINUTE) between date_start and date_end OR DATE_ADD(\'' . $time_now . '\', INTERVAL '.$config->RAID_DURATION.' MINUTE) between date_start and date_end ) - ORDER BY pokemon.pokedex_id + UNION + SELECT id, pokedex_id, pokemon_form_id + FROM pokemon + WHERE pokedex_id = \'' . $egg_id . '\' + ORDER BY pokedex_id '; $rs = my_query($query); - $egg_insert = true; // Add key for each raid level while ($pokemon = $rs->fetch()) { $keys[] = array( 'text' => get_local_pokemon_name($pokemon['pokedex_id'], $pokemon['pokemon_form_id']), 'callback_data' => $gym_id_plus_letter . ':' . $action . ':' . (($event_id!==false) ? $event_id . ',' . $raid_level . ',' : '') . $pokemon['id'] ); - if($pokemon['pokedex_id'] > 9990) $egg_insert = false; - } - if($egg_insert) { - $egg_id = '999' . $raid_level; - $keys[] = array( - 'text' => get_local_pokemon_name($egg_id, 0), - 'callback_data' => $gym_id_plus_letter . ':' . $action . ':' . (($event_id!==false) ? $event_id . ',' . $raid_level . ',' : '') . $egg_id - ); } // Get the inline key array.