diff --git a/.eslintrc.json b/.eslintrc.json index 8a19911f9..7c18daf44 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -90,6 +90,7 @@ "minLevel": true, "showBigKarp": true, "showTinyRat": true, + "showSeenType": true, "showDespawnTimeType": true, "showPokemonGender": true, "hidePokemonCoords": true, @@ -179,6 +180,7 @@ "noRarityDisplay": true, "noWeatherIcons": true, "noIvShadow": true, + "noRankShadow": true, "hideQuestsPokemon": true, "hideQuestsItem": true, "hideQuestsEnergy": true, @@ -246,6 +248,7 @@ "processShinyStats": true, "noPvp": true, "noHideSingleMarker": true, - "enableJSDebug": true + "enableJSDebug": true, + "pvpRankingMethod": true } } diff --git a/README.md b/README.md index 44b9d8744..03eca3788 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This fork is different is so many ways that its impossible to name them all. Mai > Current Version 2.0 - Second release! with OpenStreetMap engine PokeMap Standalone Frontend or PMSF for short is a PHP Map Interface for RDM, MAD designed to be completely standalone and able to run on any traditional web server. Manual submissions are supported but no longer maintained. - + ## Login Support: ### oAuth: * Discord @@ -24,8 +24,7 @@ It supports all the common database engines, including MySQL, MariaDB. * [Wiki](https://github.com/pmsf/PMSF/wiki). * Join our [Discord](https://discord.gg/JAWztHdqeB) channel for more info about installation. - - + ## Feature Requests [![Feature Requests](https://feathub.com/pmsf/PMSF?format=svg)](https://feathub.com/pmsf/PMSF) diff --git a/config/default.php b/config/default.php index 573103ceb..12e93259e 100644 --- a/config/default.php +++ b/config/default.php @@ -229,6 +229,7 @@ $noRarityDisplay = false; // true/false $noWeatherIcons = true; // true/false $no100IvShadow = false; // true/false +$noRank1Shadow = false; // true/false $noHideSingleMarker = false; // true/false /* Notification Settings */ @@ -256,6 +257,8 @@ $pokemonGenSearchString = 'generation'; // When custom string is used translations do not work. $noPvp = false; // true/false +$noPvpRankingMethod = false; // true/false +$pvpRankingMethod = 'competition'; // 'competition', 'dense', 'ordinal' $excludeMinIV = '[]'; // [] for empty @@ -268,6 +271,8 @@ $noMissingIVOnly = true; // true/false $noBigKarp = false; // true/false $noTinyRat = false; // true/false +$noSeenType = true; // true/false +$showSeenType = 0; // 0 = All, 1 = Wild + Nearby (Pokestop), 2 = Wild, 3 = Nearby (Pokestop + Other), 4 = Nearby (Pokestop), 5 = Nearby (Other) $noDespawnTimeType = true; // true/false $showDespawnTimeType = 0; // 0 = All, 1 = Verified, 2 = Unverified, 3 = Unverified + Nearby (Nearby = no spawn point) $noPokemonGender = false; // true/false @@ -279,6 +284,7 @@ $hideGymCoords = false; // true/false $noExEligible = false; // true/false $exEligible = 'false'; // true/false +$noArEligible = false; // true/false $noTeams = false; // true/false $noInBattle = false; // true/false $noOpenSpot = false; // true/false @@ -333,8 +339,8 @@ $noQuestsEnergy = false; // true/false $noQuestsCandy = false; // true/false $noQuestsStardust = false; // true/false -$noItemNames = false; // true/false -$noItemNumbers = true; // true/false +$noItemNames = false; // true/false +$noItemNumbers = false; // true/false $defaultDustAmount = 500; $hideQuestsPokemon = '[]'; // Pokemon ids will default be hidden in the menu every user is able to change this personaly $excludeQuestsPokemon = []; // All Pokémon in this array will not be shown in the filter. diff --git a/config/example.config.php b/config/example.config.php index c243cb3c8..d82de2bde 100644 --- a/config/example.config.php +++ b/config/example.config.php @@ -229,6 +229,7 @@ $noRarityDisplay = false; // true/false $noWeatherIcons = true; // true/false $no100IvShadow = false; // true/false +$noRank1Shadow = false; // true/false $noHideSingleMarker = false; // true/false /* Notification Settings */ @@ -256,6 +257,8 @@ $pokemonGenSearchString = 'generation'; // When custom string is used translations do not work. $noPvp = false; // true/false +$noPvpRankingMethod = false; // true/false +$pvpRankingMethod = 'competition'; // 'competition', 'dense', 'ordinal' $excludeMinIV = '[131, 143, 147, 148, 149, 248]'; // [] for empty @@ -268,6 +271,8 @@ $noMissingIVOnly = true; // true/false $noBigKarp = false; // true/false $noTinyRat = false; // true/false +$noSeenType = true; // true/false +$showSeenType = 0; // 0 = All, 1 = Wild + Nearby (Pokestop), 2 = Wild, 3 = Nearby (Pokestop + Other), 4 = Nearby (Pokestop), 5 = Nearby (Other) $noDespawnTimeType = true; // true/false $showDespawnTimeType = 0; // 0 = All, 1 = Verified, 2 = Unverified, 3 = Unverified + Nearby (Nearby = no spawn point) $noPokemonGender = false; // true/false @@ -279,6 +284,7 @@ $hideGymCoords = false; // true/false $noExEligible = false; // true/false $exEligible = 'false'; // true/false +$noArEligible = false; // true/false $noTeams = false; // true/false $noInBattle = false; // true/false $noOpenSpot = false; // true/false @@ -334,7 +340,7 @@ $noQuestsCandy = false; // true/false $noQuestsStardust = false; // true/false $noItemNames = false; // true/false -$noItemNumbers = true; // true/false +$noItemNumbers = false; // true/false $defaultDustAmount = 500; $hideQuestsPokemon = '[]'; // Pokemon ids will default be hidden in the menu every user is able to change this personaly $excludeQuestsPokemon = []; // All Pokémon in this array will not be shown in the filter. diff --git a/lib/RDM.php b/lib/RDM.php index 31137742a..462ab1d69 100644 --- a/lib/RDM.php +++ b/lib/RDM.php @@ -4,7 +4,7 @@ class RDM extends Scanner { - public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0, $encId = 0) + public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0, $encId = 0) { global $db; $conds = array(); @@ -14,6 +14,7 @@ public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRa expire_timestamp AS disappear_time, id AS encounter_id, spawn_id, + pokestop_id, lat AS latitude, lon AS longitude, gender, @@ -98,6 +99,19 @@ public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRa $conds[] = '(level >= ' . $minLevel . ' OR pokemon_id IN(' . $exMinIv . ') )'; } } + if (!empty($seenType)) { + if ($seenType == 1) { // Wild + Nearby (Pokestop) + $conds[] = '(spawn_id IS NOT NULL OR pokestop_id IS NOT NULL)'; + } elseif ($seenType == 2) { // Wild + $conds[] = 'spawn_id IS NOT NULL'; + } elseif ($seenType == 3) { // Nearby (Pokestop + Other) + $conds[] = 'spawn_id IS NULL'; + } elseif ($seenType == 4) { // Nearby (Pokestop) + $conds[] = '(spawn_id IS NULL AND pokestop_id IS NOT NULL)'; + } elseif ($seenType == 5) { // Nearby (Other) + $conds[] = '(spawn_id IS NULL AND pokestop_id IS NULL)'; + } + } if (!empty($despawnTimeType)) { if ($despawnTimeType == 1) { $conds[] = 'expire_timestamp_verified = 1'; @@ -117,7 +131,7 @@ public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRa return $this->query_active($select, $conds, $params, $encSql); } - public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng) + public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng) { global $db; $conds = array(); @@ -127,6 +141,7 @@ public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $t expire_timestamp AS disappear_time, id AS encounter_id, spawn_id, + pokestop_id, lat AS latitude, lon AS longitude, gender, @@ -204,6 +219,19 @@ public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $t $conds[] = '(level >= ' . $minLevel . ' OR pokemon_id IN(' . $exMinIv . ') )'; } } + if (!empty($seenType)) { + if ($seenType == 1) { // Wild + Nearby (Pokestop) + $conds[] = '(spawn_id IS NOT NULL OR pokestop_id IS NOT NULL)'; + } elseif ($seenType == 2) { // Wild + $conds[] = 'spawn_id IS NOT NULL'; + } elseif ($seenType == 3) { // Nearby (Pokestop + Other) + $conds[] = 'spawn_id IS NULL'; + } elseif ($seenType == 4) { // Nearby (Pokestop) + $conds[] = '(spawn_id IS NULL AND pokestop_id IS NOT NULL)'; + } elseif ($seenType == 5) { // Nearby (Other) + $conds[] = '(spawn_id IS NULL AND pokestop_id IS NULL)'; + } + } if (!empty($despawnTimeType)) { if ($despawnTimeType == 1) { $conds[] = 'expire_timestamp_verified = 1'; @@ -261,6 +289,9 @@ public function query_active($select, $conds, $params, $encSql = '') $pokemon["weight"] = isset($pokemon["weight"]) ? floatval($pokemon["weight"]) : null; $pokemon["height"] = isset($pokemon["height"]) ? floatval($pokemon["height"]) : null; + $pokemon["level"] = isset($pokemon["level"]) ? intval($pokemon["level"]) : null; + $pokemon["cp"] = isset($pokemon["cp"]) ? intval($pokemon["cp"]) : null; + $pokemon["individual_attack"] = isset($pokemon["individual_attack"]) ? intval($pokemon["individual_attack"]) : null; $pokemon["individual_defense"] = isset($pokemon["individual_defense"]) ? intval($pokemon["individual_defense"]) : null; $pokemon["individual_stamina"] = isset($pokemon["individual_stamina"]) ? intval($pokemon["individual_stamina"]) : null; @@ -277,6 +308,9 @@ public function query_active($select, $conds, $params, $encSql = '') $pokemon["pokemon_name"] = i8ln($this->data[$pokemon["pokemon_id"]]['name']); $pokemon["pokemon_rarity"] = i8ln($this->data[$pokemon["pokemon_id"]]['rarity']); + $pokemon["move_1"] = isset($pokemon["move_1"]) ? intval($pokemon["move_1"]) : null; + $pokemon["move_2"] = isset($pokemon["move_2"]) ? intval($pokemon["move_2"]) : null; + if (isset($pokemon["form"]) && $pokemon["form"] > 0) { $forms = $this->data[$pokemon["pokemon_id"]]["forms"]; foreach ($forms as $f => $v) { @@ -515,7 +549,7 @@ public function get_stops_quest($greids, $qpreids, $qereids, $qcreids, $qireids, public function query_stops($conds, $params) { - global $db; + global $db, $noArEligible; $query = "SELECT id AS pokestop_id, lat AS latitude, @@ -525,6 +559,7 @@ public function query_stops($conds, $params) updated AS last_seen, lure_expire_timestamp AS lure_expiration, incident_expire_timestamp AS incident_expiration, + ar_scan_eligible, lure_id, grunt_type, quest_type, @@ -568,6 +603,8 @@ public function query_stops($conds, $params) } $pokestop["latitude"] = floatval($pokestop["latitude"]); $pokestop["longitude"] = floatval($pokestop["longitude"]); + $pokestop["url"] = ! empty($pokestop["url"]) ? preg_replace("/^http:/i", "https:", $pokestop["url"]) : null; + $pokestop["ar_scan_eligible"] = $noArEligible ? 0 : intval($pokestop["ar_scan_eligible"]); $pokestop["quest_type"] = intval($pokestop["quest_type"]); $pokestop["quest_condition_type"] = intval($pokestop["quest_condition_type"]); $pokestop["quest_condition_type_1"] = intval($pokestop["quest_condition_type_1"]); @@ -582,7 +619,6 @@ public function query_stops($conds, $params) $pokestop["reward_item_id"] = intval($pokestop["reward_item_id"]); $pokestop["reward_item_name"] = empty($item_pid) ? null : i8ln($this->items[$item_pid]["name"]); $pokestop["reward_amount"] = intval($pokestop["reward_amount"]); - $pokestop["url"] = ! empty($pokestop["url"]) ? preg_replace("/^http:/i", "https:", $pokestop["url"]) : null; $pokestop["lure_expiration"] = $pokestop["lure_expiration"] * 1000; $pokestop["incident_expiration"] = $pokestop["incident_expiration"] * 1000; $pokestop["lure_id"] = intval($pokestop["lure_id"]); @@ -668,7 +704,7 @@ public function get_gyms($rbeids, $reeids, $swLat, $swLng, $neLat, $neLng, $exEl public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) { - global $db, $noTeams, $noExEligible, $noInBattle; + global $db, $noTeams, $noExEligible, $noArEligible, $noInBattle; $query = "SELECT id AS gym_id, lat AS latitude, @@ -690,6 +726,7 @@ public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) raid_pokemon_cp, raid_pokemon_gender, raid_pokemon_evolution, + ar_scan_eligible, ex_raid_eligible AS park, in_battle FROM gym @@ -707,6 +744,9 @@ public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) $raid_pid = null; $gym["raid_pokemon_id"] = null; } + $gym["latitude"] = floatval($gym["latitude"]); + $gym["longitude"] = floatval($gym["longitude"]); + $gym["url"] = ! empty($gym["url"]) ? preg_replace("/^http:/i", "https:", $gym["url"]) : null; $gym["team_id"] = $noTeams ? 0 : intval($gym["team_id"]); $gym["pokemon"] = []; $gym["raid_pokemon_name"] = empty($raid_pid) ? null : i8ln($this->data[$raid_pid]["name"]); @@ -714,15 +754,13 @@ public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) $gym["raid_pokemon_costume"] = intval($gym["raid_pokemon_costume"]); $gym["raid_pokemon_evolution"] = intval($gym["raid_pokemon_evolution"]); $gym["raid_pokemon_gender"] = intval($gym["raid_pokemon_gender"]); - $gym["latitude"] = floatval($gym["latitude"]); - $gym["longitude"] = floatval($gym["longitude"]); $gym["slots_available"] = $noTeams ? 0 : intval($gym["slots_available"]); $gym["in_battle"] = $noInBattle ? 0 : intval($gym["in_battle"]); $gym["last_modified"] = $gym["last_modified"] * 1000; $gym["last_scanned"] = $gym["last_scanned"] * 1000; $gym["raid_start"] = $gym["raid_start"] * 1000; $gym["raid_end"] = $gym["raid_end"] * 1000; - $gym["url"] = ! empty($gym["url"]) ? preg_replace("/^http:/i", "https:", $gym["url"]) : null; + $gym["ar_scan_eligible"] = $noArEligible ? 0 : intval($gym["ar_scan_eligible"]); $gym["park"] = $noExEligible ? 0 : intval($gym["park"]); if (isset($gym["raid_pokemon_form"]) && $gym["raid_pokemon_form"] > 0) { $forms = $this->data[$gym["raid_pokemon_id"]]["forms"]; diff --git a/lib/RocketMap.php b/lib/RocketMap.php index 3f01e6722..bafda7e42 100644 --- a/lib/RocketMap.php +++ b/lib/RocketMap.php @@ -12,7 +12,7 @@ public function __construct() $this->setCpMultiplier(); } - public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0, $encId = 0) + public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0, $encId = 0) { global $db; $conds = array(); @@ -93,7 +93,7 @@ public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRa return $this->query_active($select, $conds, $params, $encSql); } - public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng) + public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng) { global $db; $conds = array(); @@ -505,6 +505,7 @@ public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) $gym["raid_start"] = $gym["raid_start"] * 1000; $gym["raid_end"] = $gym["raid_end"] * 1000; $gym["park"] = $noExEligible ? 0 : intval($gym["park"]); + $gym["ar_scan_eligible"] = 0; if (isset($gym["raid_pokemon_form"]) && $gym["raid_pokemon_form"] > 0) { $forms = $this->data[$gym["raid_pokemon_id"]]["forms"]; foreach ($forms as $f => $v) { diff --git a/lib/RocketMap_MAD.php b/lib/RocketMap_MAD.php index fa637ee6b..9b2c2e7ee 100644 --- a/lib/RocketMap_MAD.php +++ b/lib/RocketMap_MAD.php @@ -4,7 +4,7 @@ class RocketMap_MAD extends RocketMap { - public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0, $encId = 0) + public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng, $tstamp = 0, $oSwLat = 0, $oSwLng = 0, $oNeLat = 0, $oNeLng = 0, $encId = 0) { global $db; $conds = array(); @@ -100,6 +100,19 @@ public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRa $conds[] = '(cp_multiplier >= ' . $this->cpMultiplier[$minLevel] . ' OR pokemon_id IN(' . $exMinIv . ') )'; } } + if (!empty($seenType)) { + if ($seenType == 1) { // Wild + Nearby (Pokestop) + $conds[] = '(spawnpoint_id IS NOT NULL OR pokestop_id IS NOT NULL)'; + } elseif ($seenType == 2) { // Wild + $conds[] = 'spawnpoint_id IS NOT NULL'; + } elseif ($seenType == 3) { // Nearby (Pokestop + Other) + $conds[] = 'spawnpoint_id IS NULL'; + } elseif ($seenType == 4) { // Nearby (Pokestop) + $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NOT NULL)'; + } elseif ($seenType == 5) { // Nearby (Other) + $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NULL)'; + } + } if (!empty($despawnTimeType)) { if ($despawnTimeType == 1) { $conds[] = 'ts.calc_endminsec IS NOT NULL'; @@ -120,7 +133,7 @@ public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRa return $this->query_active($select, $conds, $params, $encSql); } - public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng) + public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng) { global $db; $conds = array(); @@ -210,6 +223,19 @@ public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $t $conds[] = '(cp_multiplier >= ' . $this->cpMultiplier[$minLevel] . ' OR pokemon_id IN(' . $exMinIv . ') )'; } } + if (!empty($seenType)) { + if ($seenType == 1) { // Wild + Nearby (Pokestop) + $conds[] = '(spawnpoint_id IS NOT NULL OR pokestop_id IS NOT NULL)'; + } elseif ($seenType == 2) { // Wild + $conds[] = 'spawnpoint_id IS NOT NULL'; + } elseif ($seenType == 3) { // Nearby (Pokestop + Other) + $conds[] = 'spawnpoint_id IS NULL'; + } elseif ($seenType == 4) { // Nearby (Pokestop) + $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NOT NULL)'; + } elseif ($seenType == 5) { // Nearby (Other) + $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NULL)'; + } + } if (!empty($despawnTimeType)) { if ($despawnTimeType == 1) { $conds[] = 'ts.calc_endminsec IS NOT NULL'; @@ -413,7 +439,7 @@ public function get_gyms($rbeids, $reeids, $swLat, $swLng, $neLat, $neLng, $exEl public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) { - global $db, $noTeams, $noExEligible, $noInBattle; + global $db, $noTeams, $noExEligible, $noArEligible, $noInBattle; $query = "SELECT gym.gym_id, latitude, @@ -426,6 +452,7 @@ public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) url, is_in_battle as in_battle, is_ex_raid_eligible AS park, + is_ar_scan_eligible AS ar_scan_eligible, raid.level AS raid_level, raid.pokemon_id AS raid_pokemon_id, raid.form AS raid_pokemon_form, @@ -473,6 +500,7 @@ public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) $gym["raid_end"] = $gym["raid_end"] * 1000; $gym["url"] = ! empty($gym["url"]) ? preg_replace("/^http:/i", "https:", $gym["url"]) : null; $gym["park"] = $noExEligible ? 0 : intval($gym["park"]); + $gym["ar_scan_eligible"] = $noArEligible ? 0 : intval($gym["ar_scan_eligible"]); if (isset($gym["raid_pokemon_form"]) && $gym["raid_pokemon_form"] > 0) { $forms = $this->data[$gym["raid_pokemon_id"]]["forms"]; foreach ($forms as $f => $v) { @@ -784,7 +812,7 @@ public function get_stops_quest($greids, $qpreids, $qereids, $qcreids, $qireids, public function query_stops($conds, $params) { - global $db; + global $db, $noArEligible; $query = "SELECT Unix_timestamp(Convert_tz(lure_expiration, '+00:00', @@global.time_zone)) AS lure_expiration, Unix_timestamp(Convert_tz(incident_expiration, '+00:00', @@global.time_zone)) AS incident_expiration, @@ -795,6 +823,7 @@ public function query_stops($conds, $params) image AS url, longitude, active_fort_modifier AS lure_id, + is_ar_scan_eligible AS ar_scan_eligible, incident_grunt_type AS grunt_type, tq.quest_type, tq.quest_timestamp, @@ -883,6 +912,7 @@ public function query_stops($conds, $params) $pokestop["reward_item_id"] = intval($pokestop["reward_item_id"]); $pokestop["reward_item_name"] = empty($item_pid) ? null : i8ln($this->items[$item_pid]["name"]); $pokestop["last_seen"] = $pokestop["last_seen"] * 1000; + $pokestop["ar_scan_eligible"] = $noArEligible ? 0 : intval($pokestop["ar_scan_eligible"]); $data[] = $pokestop; unset($pokestops[$i]); $i++; diff --git a/pre-index.php b/pre-index.php index 2584a0f8f..48a692a50 100644 --- a/pre-index.php +++ b/pre-index.php @@ -288,6 +288,21 @@ + +
+ + +
+
@@ -313,33 +328,6 @@
- -
-
- -
-
- - -
-
- -
-
- - -
-
- -
-
-
@@ -415,6 +403,48 @@
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+ + +
+ + + + + + + @@ -1585,6 +1620,7 @@ var onlyTriggerGyms = ; var showBigKarp = ; var showTinyRat = ; + var showSeenType = ; var showDespawnTimeType = ; var showPokemonGender = ; var hidePokemonCoords = ; @@ -1632,6 +1668,7 @@ var noRarityDisplay = ; var noWeatherIcons = ; var noIvShadow = ; + var noRankShadow = ; var noRaidTimer = ; var enableRaidTimer = ; var noRocketTimer = ; @@ -1655,6 +1692,7 @@ var noDarkMode = ; var noCatchRates = ; var noPvp = ; + var pvpRankingMethod = ''; var noHideSingleMarker = ; var enableJSDebug = ; diff --git a/raw_data.php b/raw_data.php index c3948c9ab..0c72cecff 100644 --- a/raw_data.php +++ b/raw_data.php @@ -36,6 +36,7 @@ $exMinIv = !empty($_POST['exMinIV']) ? $_POST['exMinIV'] : ''; $bigKarp = !empty($_POST['bigKarp']) ? $_POST['bigKarp'] : false; $tinyRat = !empty($_POST['tinyRat']) ? $_POST['tinyRat'] : false; +$seenType = !empty($_POST['seenType']) ? $_POST['seenType'] : 0; $despawnTimeType = !empty($_POST['despawnTimeType']) ? $_POST['despawnTimeType'] : 0; $pokemonGender = !empty($_POST['pokemonGender']) ? $_POST['pokemonGender'] : 0; $lastpokemon = !empty($_POST['lastpokemon']) ? $_POST['lastpokemon'] : false; @@ -148,12 +149,12 @@ if ($d["lastpokemon"] == "true") { $eids = !empty($_POST['eids']) ? explode(",", $_POST['eids']) : array(); if ($lastpokemon != 'true') { - $d["pokemons"] = $scanner->get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng, 0, 0, 0, 0, 0, $enc_id); + $d["pokemons"] = $scanner->get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng, 0, 0, 0, 0, 0, $enc_id); } else { if ($newarea) { - $d["pokemons"] = $scanner->get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng, 0, $oSwLat, $oSwLng, $oNeLat, $oNeLng, $enc_id); + $d["pokemons"] = $scanner->get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng, 0, $oSwLat, $oSwLng, $oNeLat, $oNeLng, $enc_id); } else { - $d["pokemons"] = $scanner->get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng, $timestamp, 0, 0, 0, 0, $enc_id); + $d["pokemons"] = $scanner->get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng, $timestamp, 0, 0, 0, 0, $enc_id); } } $d["preMinIV"] = $minIv; @@ -163,7 +164,7 @@ $reidsDiff = array_diff($reids, $eids); if (count($reidsDiff)) { - $d["pokemons"] = array_merge($d["pokemons"], $scanner->get_active_by_id($reidsDiff, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng)); + $d["pokemons"] = array_merge($d["pokemons"], $scanner->get_active_by_id($reidsDiff, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRat, $seenType, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng)); } $d["reids"] = $reids; diff --git a/static/data/questtype.json b/static/data/questtype.json index bc0d6de44..5cf3d31e1 100644 --- a/static/data/questtype.json +++ b/static/data/questtype.json @@ -144,7 +144,6 @@ "text": "QUEST_GBL_RANK" }, "53": { - "prototext": "QUEST_CHARGE_ATTACK", "text": "Use {0} Charged Attack(s)" }, "54": { diff --git a/static/images/ar.png b/static/images/ar.png new file mode 100644 index 000000000..abf131fb8 Binary files /dev/null and b/static/images/ar.png differ diff --git a/static/js/map.common.js b/static/js/map.common.js old mode 100755 new mode 100644 index f3516c8f0..aa8b7abc6 --- a/static/js/map.common.js +++ b/static/js/map.common.js @@ -286,6 +286,11 @@ var StoreOptions = { default: showTinyRat, type: StoreTypes.Boolean }, + 'showSeenType': + { + default: showSeenType, + type: StoreTypes.Number + }, 'showDespawnTimeType': { default: showDespawnTimeType, @@ -495,6 +500,11 @@ var StoreOptions = { { default: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches, type: StoreTypes.Boolean + }, + 'pvpRankingMethod': + { + default: pvpRankingMethod, + type: StoreTypes.String } } @@ -536,30 +546,88 @@ var mapData = { pois: {} } -function getPokemonSprite(index, sprite, displayHeight, weather = 0, encounterForm = 0, pokemonCostume = 0, attack = 0, defense = 0, stamina = 0, gender = 0) { - displayHeight = Math.max(displayHeight, 3) - var scale = displayHeight / sprite.iconHeight - // Crop icon just a tiny bit to avoid bleedover from neighbor - var scaledIconSizeWidth = scale * sprite.iconWidth +function getPokemonMarkerIcon(item) { + var iconSize = Store.get('pokemonIconSize') + if (isNotifiedPokemon(item) === true) { + iconSize += Store.get('iconNotifySizeModifier') + } + iconSize = Math.max(iconSize, 20) + var scale = iconSize / pokemonSprites.iconHeight + var scaledIconSizeWidth = scale * pokemonSprites.iconWidth var scaledWeatherIconSizeWidth = scaledIconSizeWidth * 0.6 var scaledWeatherIconOffset = scaledIconSizeWidth * 0.2 - var scaledIconCenterOffset = [scale * sprite.iconWidth / 2, scale * sprite.iconHeight / 2] - var pokemonId = index + 1 - var iv = 100 * (attack + defense + stamina) / 45 - var html = '' - if (weather === 0 || noWeatherIcons) { - html = '' - } else if (noWeatherIcons === false) { - html = '' + - '' + } + var html = '' + if (item['weather_boosted_condition'] > 0 && !noWeatherIcons) { + html += '' } var pokemonIcon = L.divIcon({ iconAnchor: scaledIconCenterOffset, @@ -571,16 +639,7 @@ function getPokemonSprite(index, sprite, displayHeight, weather = 0, encounterFo } function setupPokemonMarker(item, map, isBounceDisabled) { - var iconSize = Store.get('pokemonIconSize') - if (isNotifiedPokemon(item) === true) { - iconSize += Store.get('iconNotifySizeModifier') - } - var pokemonIndex = item['pokemon_id'] - 1 - var pokemonCostume = item['costume'] - var attack = item['individual_attack'] - var defense = item['individual_defense'] - var stamina = item['individual_stamina'] - var icon = getPokemonSprite(pokemonIndex, pokemonSprites, iconSize, item['weather_boosted_condition'], item['form'], item['costume'], item['individual_attack'], item['individual_defense'], item['individual_stamina'], item['gender']) + var icon = getPokemonMarkerIcon(item) var animationDisabled = false if (isBounceDisabled === true) { diff --git a/static/js/map.js b/static/js/map.js index 5df0c7812..e28d7f8cf 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -34,6 +34,7 @@ var shinyTable var language = document.documentElement.lang === '' ? 'en' : document.documentElement.lang var languageSite = 'en' var idToPokemon = {} +var idToForm = {} var idToItem = {} var idToGrunt = {} var idToRaidegg = {} @@ -64,6 +65,7 @@ var prevMinIV = null var prevMinLevel = null var onlyPokemon = 0 var directionProvider +var hidePokemonForms = [] var buffer = [] var reincludedPokemon = [] @@ -344,6 +346,11 @@ function notifyAboutPokemon(id) { // eslint-disable-line no-unused-vars $('#notify-pokemon .pokemon-list .pokemon-icon-sprite[data-value="' + id + '"]').addClass('active') } +function hidePokemonForm(form) { // eslint-disable-line no-unused-vars + hidePokemonForms.push(form) + clearStaleMarkers() +} + function removePokemonMarker(encounterId) { // eslint-disable-line no-unused-vars if (mapData.pokemons[encounterId].marker.rangeCircle) { markers.removeLayer(mapData.pokemons[encounterId].marker.rangeCircle) @@ -1060,6 +1067,7 @@ function initSidebar() { $('#missing-iv-only-switch').prop('checked', Store.get('showMissingIVOnly')) $('#big-karp-switch').prop('checked', Store.get('showBigKarp')) $('#tiny-rat-switch').prop('checked', Store.get('showTinyRat')) + $('#seen-type-select').val(Store.get('showSeenType')) $('#despawn-time-type-select').val(Store.get('showDespawnTimeType')) $('#pokemon-gender-select').val(Store.get('showPokemonGender')) $('#pokestops-switch').prop('checked', Store.get('showPokestops')) @@ -1097,6 +1105,7 @@ function initSidebar() { $('#bounce-switch').prop('checked', Store.get('remember_bounce_notify')) $('#notification-switch').prop('checked', Store.get('remember_notification_notify')) $('#dark-mode-switch').prop('checked', Store.get('darkMode')) + $('#pvp-ranking-method-select').val(Store.get('pvpRankingMethod')) if (Store.get('showGyms') === true || Store.get('showRaids') === true) { $('#gyms-raid-filter-wrapper').toggle(true) @@ -1319,6 +1328,9 @@ function pokemonLabel(item) { } else { contentstring += '
' } + if (form > 0) { + contentstring += ' | ' + } contentstring += '' + ' | ' if (!noHideSingleMarker) { @@ -1363,18 +1375,35 @@ function pokemonLabel(item) { pokemonName = i8ln(pokedex[ranking.pokemon]['name']) } + let rank + switch (Store.get('pvpRankingMethod')) { + case 'competition': + rank = ranking.competition_rank + break + case 'dense': + rank = ranking.dense_rank + break + case 'ordinal': + rank = ranking.ordinal_rank + break + } + + if (rank === undefined) { + rank = ranking.rank + } + let infoString - if (ranking.rank === null) { + if (rank === null) { infoString = i8ln('CP too high') } else { - infoString = '#' + ranking.rank + infoString = '#' + rank } if (ranking.cp !== null) { infoString += ' @' + ranking.cp + i8ln('CP') + ' (' + i8ln('Lvl') + ' ' + (ranking.level) + ')' } let color = '' - if (ranking.rank === 1) { + if (rank === 1) { color = 'color:green' } contentstring += '' + pokemonName + ': ' + infoString + '
' @@ -1396,18 +1425,35 @@ function pokemonLabel(item) { pokemonName = i8ln(pokedex[ranking.pokemon]['name']) } + let rank + switch (Store.get('pvpRankingMethod')) { + case 'competition': + rank = ranking.competition_rank + break + case 'dense': + rank = ranking.dense_rank + break + case 'ordinal': + rank = ranking.ordinal_rank + break + } + + if (rank === undefined) { + rank = ranking.rank + } + let infoString - if (ranking.rank === null) { + if (rank === null) { infoString = i8ln('CP too high') } else { - infoString = '#' + ranking.rank + infoString = '#' + rank } if (ranking.cp !== null) { infoString += ' @' + ranking.cp + i8ln('CP') + ' (' + i8ln('Lvl') + ' ' + (ranking.level) + ')' } let color = '' - if (ranking.rank === 1) { + if (rank === 1) { color = 'color:green' } contentstring += '' + pokemonName + ': ' + infoString + '
' @@ -1783,6 +1829,19 @@ function getQuest(item) { return str } +function getPokemonName(pokemon_id, form_id) { + var pokemonName = idToPokemon[pokemon_id] + + if (form_id > 0) { + var formName = idToForm[form_id] + if (formName && formName.length > 0) { + pokemonName += ' (' + formName + ')' + } + } + + return pokemonName +} + function pokestopLabel(item) { var str var stopImage = '' @@ -1837,35 +1896,72 @@ function pokestopLabel(item) { i8ln('Quest') + ': ' + i8ln(questStr) + '
' - if (item['quest_reward_type'] === 2) { - str += '
' + - i8ln('Reward') + ': ' + - item['reward_amount'] + ' ' + - item['reward_item_name'] + - '
' - } else if (item['quest_reward_type'] === 3) { - str += '
' + - i8ln('Reward') + ': ' + - item['reward_amount'] + ' ' + - i8ln('Stardust') + - '
' - } else if (item['quest_reward_type'] === 4) { - str += '
' + - i8ln('Reward') + ': ' + - item['reward_amount'] + 'x ' + item['reward_pokemon_name'] + ' ' + - i8ln('Candy') + - '
' - } else if (item['quest_reward_type'] === 7) { - str += '
' + - i8ln('Reward') + ': ' + - item['reward_pokemon_name'] + - '
' - } else if (item['quest_reward_type'] === 12) { - str += '
' + - i8ln('Reward') + ': ' + - item['reward_amount'] + ' ' + item['reward_pokemon_name'] + ' ' + - i8ln('Mega energy') + - '
' + if (item['quest_rewards'] === undefined || item['quest_rewards'] === null) { + if (item['quest_reward_type'] === 2) { + str += '
' + + i8ln('Reward') + ': ' + + item['reward_amount'] + ' ' + + item['reward_item_name'] + + '
' + } else if (item['quest_reward_type'] === 3) { + str += '
' + + i8ln('Reward') + ': ' + + item['reward_amount'] + ' ' + + i8ln('Stardust') + + '
' + } else if (item['quest_reward_type'] === 4) { + str += '
' + + i8ln('Reward') + ': ' + + item['reward_amount'] + 'x ' + item['reward_pokemon_name'] + ' ' + + i8ln('Candy') + + '
' + } else if (item['quest_reward_type'] === 7) { + str += '
' + + i8ln('Reward') + ': ' + + getPokemonName(item['reward_pokemon_id'], item['reward_pokemon_formid']) + + '
' + } else if (item['quest_reward_type'] === 12) { + str += '
' + + i8ln('Reward') + ': ' + + item['reward_amount'] + ' ' + item['reward_pokemon_name'] + ' ' + + i8ln('Mega energy') + + '
' + } + } else { + var questRewards = JSON.parse(item['quest_rewards']) + for (var i = 0; i < questRewards.length; i++) { + var questReward = questRewards[i] + if (questReward['type'] === 2) { + str += '
' + + i8ln('Reward') + ': ' + + questReward['info']['amount'] + ' ' + + i8ln(idToItem[questReward['info']['item_id']]) + + '
' + } else if (questReward['type'] === 3) { + str += '
' + + i8ln('Reward') + ': ' + + questReward['info']['amount'] + ' ' + + i8ln('Stardust') + + '
' + } else if (questReward['type'] === 4) { + str += '
' + + i8ln('Reward') + ': ' + + questReward['info']['amount'] + 'x ' + idToPokemon[questReward['info']['pokemon_id']] + ' ' + + i8ln('Candy') + + '
' + } else if (questReward['type'] === 7) { + str += '
' + + i8ln('Reward') + ': ' + + getPokemonName(questReward['info']['pokemon_id'], questReward['info']['form_id']) + + '
' + } else if (questReward['type'] === 12) { + str += '
' + + i8ln('Reward') + ': ' + + questReward['info']['amount'] + ' ' + idToPokemon[questReward['info']['pokemon_id']] + ' ' + + i8ln('Mega energy') + + '
' + } + } } if (!noHideSingleMarker) { str += '' @@ -1963,8 +2059,7 @@ function pokestopLabel(item) { if (hidePokestopCoords === true) { str += '-' } else { - str += ' ' + - ' ' + str += ' ' + ' ' } str += '' if (!noQuests && !noWhatsappLink && item['quest_type'] !== null && lastMidnight < Number(item['quest_timestamp'])) { @@ -2238,19 +2333,22 @@ function getGymMarkerIcon(item) { var costumeId = item['raid_pokemon_costume'] var team = item.team_id var fortMarker = '' + var arIcon = item['ar_scan_eligible'] ? '' : '' var exIcon = (((park !== '0' && onlyTriggerGyms === false && park) || triggerGyms.includes(item['gym_id'])) && (noExGyms === false)) ? '' : '' var inBattle = (item['in_battle'] === 1 && item.last_scanned > (Date.now() - 5 * 60 * 1000)) ? '' : '' + var smallArIcon = item['ar_scan_eligible'] ? '' : '' var smallExIcon = (((park !== '0' && onlyTriggerGyms === false && park) || triggerGyms.includes(item['gym_id'])) && (noExGyms === false)) ? '' : '' var html = '' if (item['raid_pokemon_id'] != null && item.raid_end > Date.now()) { html = '
' + '' + + arIcon + exIcon + inBattle + '' + '
' if (noRaidTimer === false && Store.get(['showRaidTimer'])) { - html += '
' + generateRemainingTimer(item['raid_end'], 'end') + '
' + html += '
' + generateRemainingTimer(item['raid_end'], 'end') + '
' } fortMarker = L.divIcon({ iconSize: [50, 50], @@ -2262,12 +2360,13 @@ function getGymMarkerIcon(item) { } else if (item['raid_level'] !== null && item.raid_start <= Date.now() && item.raid_end > Date.now()) { html = '
' + '' + + arIcon + exIcon + inBattle + '' + '
' if (noRaidTimer === false && Store.get(['showRaidTimer'])) { - html += '
' + generateRemainingTimer(item['raid_end'], 'end') + '
' + html += '
' + generateRemainingTimer(item['raid_end'], 'end') + '
' } fortMarker = L.divIcon({ iconSize: [50, 50], @@ -2279,12 +2378,13 @@ function getGymMarkerIcon(item) { } else if (item['raid_level'] !== null && item.raid_end > Date.now()) { html = '
' + '' + + arIcon + exIcon + inBattle + '' + '
' if (noRaidTimer === false && Store.get(['showRaidTimer'])) { - html += '
' + generateRemainingTimer(item['raid_start'], 'end') + '
' + html += '
' + generateRemainingTimer(item['raid_start'], 'end') + '
' } fortMarker = L.divIcon({ iconSize: [50, 50], @@ -2296,6 +2396,7 @@ function getGymMarkerIcon(item) { } else { html = '
' + '' + + smallArIcon + smallExIcon + inBattle + '
' @@ -2377,8 +2478,8 @@ function updateGymMarker(item, marker) { } else if (item.raid_start <= Date.now()) { icon = getIcon(iconpath.raid, 'raid/egg', '.png', item['raid_level'], 1) } else { - checkAndCreateSound() icon = getIcon(iconpath.raid, 'raid/egg', '.png', item['raid_level']) + checkAndCreateSound() } sendNotification(title, text, icon, item['latitude'], item['longitude']) } @@ -2418,26 +2519,30 @@ function getPokestopMarkerIcon(item) { var genderid var shiny if (Store.get(['showPokestops']) && !Store.get(['showQuests']) && !Store.get(['showLures']) && !Store.get(['showRocket']) && !Store.get(['showAllPokestops'])) { + var arIcon = item['ar_scan_eligible'] ? '' : '' + html = '
' + arIcon + '
' stopMarker = L.divIcon({ iconSize: [31, 31], iconAnchor: [25, 45], popupAnchor: [0, -35], className: 'stop-marker', - html: '
' + html: html }) } else if (Store.get(['showAllPokestops']) && !noAllPokestops) { if (!noTeamRocket && item['incident_expiration'] > Date.now()) { + var arIcon = item['ar_scan_eligible'] ? '' : '' if (!noLures && item['lure_expiration'] > Date.now()) { markerStr = item['lure_id'] } html = '
' + html += arIcon if (item['grunt_type'] > 0) { html += '
' } else { html += '' } if (noRocketTimer === false && Store.get(['showRocketTimer'])) { - html += '
' + html += '
' } stopMarker = L.divIcon({ iconSize: [31, 31], @@ -2447,12 +2552,14 @@ function getPokestopMarkerIcon(item) { html: html }) } else if (!noQuests && item['quest_reward_type'] !== null && lastMidnight < Number(item['quest_timestamp'])) { + var arIcon = item['ar_scan_eligible'] ? '' : '' if (!noLures && item['lure_expiration'] > Date.now()) { markerStr = item['lure_id'] } if (item['quest_reward_type'] === 12) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2470,6 +2577,7 @@ function getPokestopMarkerIcon(item) { shiny = item['reward_pokemon_shiny'] html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2482,6 +2590,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 4) { html = '
' + '' + + arIcon + '' + '' + '
' @@ -2495,6 +2604,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 3) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2507,6 +2617,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 2) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2518,7 +2629,8 @@ function getPokestopMarkerIcon(item) { }) } } else if (!noLures && item['lure_expiration'] > Date.now()) { - html = '
' + var arIcon = item['ar_scan_eligible'] ? '' : '' + html = '
' + arIcon + '
' stopMarker = L.divIcon({ iconSize: [31, 31], iconAnchor: [25, 45], @@ -2527,26 +2639,30 @@ function getPokestopMarkerIcon(item) { html: html }) } else { + var arIcon = item['ar_scan_eligible'] ? '' : '' + html = '
' + arIcon + '
' stopMarker = L.divIcon({ iconSize: [31, 31], iconAnchor: [25, 45], popupAnchor: [0, -35], className: 'stop-marker', - html: '
' + html: html }) } } else if (Store.get(['showRocket']) && !noTeamRocket && item['incident_expiration'] > Date.now()) { + var arIcon = item['ar_scan_eligible'] ? '' : '' if (!noLures && item['lure_expiration'] > Date.now()) { markerStr = 'Lured_' + item['lure_id'] } html = '
' + html += arIcon if (item['grunt_type'] > 0) { html += '
' } else { html += '
' } if (noRocketTimer === false && Store.get(['showRocketTimer'])) { - html += '
' + html += '
' } stopMarker = L.divIcon({ iconSize: [31, 31], @@ -2556,12 +2672,14 @@ function getPokestopMarkerIcon(item) { html: html }) } else if (Store.get(['showQuests']) && !noQuests && item['quest_reward_type'] !== null && lastMidnight < Number(item['quest_timestamp'])) { + var arIcon = item['ar_scan_eligible'] ? '' : '' if (!noLures && item['lure_expiration'] > Date.now()) { markerStr = item['lure_id'] } if (item['quest_reward_type'] === 12) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2579,6 +2697,7 @@ function getPokestopMarkerIcon(item) { shiny = item['reward_pokemon_shiny'] html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2591,6 +2710,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 4) { html = '
' + '' + + arIcon + '' + '' + '
' @@ -2604,6 +2724,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 3) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2616,6 +2737,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 2) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2627,7 +2749,8 @@ function getPokestopMarkerIcon(item) { }) } } else if (Store.get(['showLures']) && !noLures && item['lure_expiration'] > Date.now()) { - html = '
' + var arIcon = item['ar_scan_eligible'] ? '' : '' + html = '
' + arIcon + '
' stopMarker = L.divIcon({ iconSize: [31, 31], iconAnchor: [25, 45], @@ -2636,12 +2759,14 @@ function getPokestopMarkerIcon(item) { html: html }) } else { + var arIcon = item['ar_scan_eligible'] ? '' : '' + html = '
' + arIcon + '
' stopMarker = L.divIcon({ iconSize: [31, 31], iconAnchor: [25, 45], popupAnchor: [0, -35], className: 'stop-marker', - html: '
' + html: html }) } return stopMarker @@ -3165,13 +3290,32 @@ function addListeners(marker) { function clearStaleMarkers() { $.each(mapData.pokemons, function (key, value) { var pvpFiltered = false + var ivFiltered = false + var seenTypeFiltered = false if (minGLRank > 0 || minULRank > 0) { pvpFiltered = true if (minGLRank > 0 && pvpFiltered) { var greatLeague = JSON.parse(mapData.pokemons[key]['pvp_rankings_great_league']) $.each(greatLeague, function (index, ranking) { - if (ranking.rank !== null && ranking.rank <= minGLRank) { + let rank + switch (Store.get('pvpRankingMethod')) { + case 'competition': + rank = ranking.competition_rank + break + case 'dense': + rank = ranking.dense_rank + break + case 'ordinal': + rank = ranking.ordinal_rank + break + } + + if (rank === undefined) { + rank = ranking.rank + } + + if (rank !== null && rank <= minGLRank) { pvpFiltered = false return false } @@ -3180,20 +3324,82 @@ function clearStaleMarkers() { if (minULRank > 0 && pvpFiltered) { var ultraLeague = JSON.parse(mapData.pokemons[key]['pvp_rankings_ultra_league']) $.each(ultraLeague, function (index, ranking) { - if (ranking.rank !== null && ranking.rank <= minULRank) { + let rank + switch (Store.get('pvpRankingMethod')) { + case 'competition': + rank = ranking.competition_rank + break + case 'dense': + rank = ranking.dense_rank + break + case 'ordinal': + rank = ranking.ordinal_rank + break + } + + if (rank === undefined) { + rank = ranking.rank + } + + if (rank !== null && rank <= minULRank) { pvpFiltered = false return false } }) } + if (pvpFiltered) { + if (excludedMinIV.includes(mapData.pokemons[key]['pokemon_id'])) { + pvpFiltered = false + } else if (Store.get('showMissingIVOnly') === true) { + pvpFiltered = false + } else if (minIV > 0 || minLevel > 0) { + let iv = getIv(mapData.pokemons[key]['individual_attack'], mapData.pokemons[key]['individual_defense'], mapData.pokemons[key]['individual_stamina']) + let level = ((mapData.pokemons[key]['level'] != null) ? mapData.pokemons[key]['level'] : getPokemonLevel(mapData.pokemons[key]['cp_multiplier'])) + pvpFiltered = (iv < minIV || level < minLevel) + } + } + } else { + if (excludedMinIV.includes(mapData.pokemons[key]['pokemon_id'])) { + ivFiltered = false + } else if (Store.get('showMissingIVOnly') === true) { + ivFiltered = false + } else if (minIV > 0 || minLevel > 0) { + let iv = getIv(mapData.pokemons[key]['individual_attack'], mapData.pokemons[key]['individual_defense'], mapData.pokemons[key]['individual_stamina']) + let level = ((mapData.pokemons[key]['level'] != null) ? mapData.pokemons[key]['level'] : getPokemonLevel(mapData.pokemons[key]['cp_multiplier'])) + ivFiltered = (iv < minIV || level < minLevel) + } } + + switch(Store.get('showSeenType')) { + case 0: // All + seenTypeFiltered = false + break + case 1: // Wild + Nearby (Pokestop) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] === null && mapData.pokemons[key]['pokestop_id'] === null) + break + case 2: // Wild + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] === null) + break + case 3: // Nearby (Pokestop + Other) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null) + break + case 4: // Nearby (Pokestop) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null || mapData.pokemons[key]['pokestop_id'] === null) + break + case 5: // Nearby (Other) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null || mapData.pokemons[key]['pokestop_id'] !== null) + break + } + if ( mapData.pokemons[key]['disappear_time'] < new Date().getTime() || ( (excludedPokemon.indexOf(mapData.pokemons[key]['pokemon_id']) >= 0 || + hidePokemonForms.indexOf(mapData.pokemons[key]['form']) >= 0 || isTemporaryHidden(mapData.pokemons[key]['pokemon_id']) || (pvpFiltered) || - ((((mapData.pokemons[key]['individual_attack'] + mapData.pokemons[key]['individual_defense'] + mapData.pokemons[key]['individual_stamina']) / 45 * 100 < minIV) || ((mapType === 'rdm' && mapData.pokemons[key]['level'] < minLevel) || (mapType === 'rocketmap' && !isNaN(minLevel) && (mapData.pokemons[key]['cp_multiplier'] < cpMultiplier[minLevel - 1])))) && !excludedMinIV.includes(mapData.pokemons[key]['pokemon_id']) && Store.get('showMissingIVOnly') === false) || + (ivFiltered) || + (seenTypeFiltered) || (Store.get('showMissingIVOnly') === true && mapData.pokemons[key]['individual_attack'] !== null) || (Store.get('showBigKarp') === true && mapData.pokemons[key]['pokemon_id'] === 129 && (mapData.pokemons[key]['weight'] < 13.14 || mapData.pokemons[key]['weight'] === null)) || (Store.get('showTinyRat') === true && mapData.pokemons[key]['pokemon_id'] === 19 && (mapData.pokemons[key]['weight'] > 2.40 || mapData.pokemons[key]['weight'] === null)) || @@ -3336,6 +3542,7 @@ function loadRawData() { var loadMinLevel = Store.get('remember_text_min_level') var bigKarp = Boolean(Store.get('showBigKarp')) var tinyRat = Boolean(Store.get('showTinyRat')) + var seenType = Store.get('showSeenType') var despawnTimeType = Store.get('showDespawnTimeType') var pokemonGender = Store.get('showPokemonGender') var exEligible = Boolean(Store.get('exEligible')) @@ -3361,6 +3568,14 @@ function loadRawData() { prevMinLevel = null } + if (minGLRank > 0 || minULRank > 0) { + // In order to be able to show pokemon meeting IV/Level filters *OR* GL/UL Rank filters, we need to do all the filtering in JS and not in the SQL query. + loadMinIV = 0 + loadMinLevel = 0 + prevMinIV = null + prevMinLevel = null + } + return $.ajax({ url: 'raw_data', type: 'POST', @@ -3404,6 +3619,7 @@ function loadRawData() { 'prevMinLevel': prevMinLevel, 'bigKarp': bigKarp, 'tinyRat': tinyRat, + 'seenType': seenType, 'despawnTimeType': despawnTimeType, 'pokemonGender': pokemonGender, 'swLat': swLat, @@ -4766,21 +4982,66 @@ function processPokemons(i, item) { if (minGLRank > 0 && pvpFiltered) { var greatLeague = JSON.parse(item['pvp_rankings_great_league']) $.each(greatLeague, function (index, ranking) { - if (ranking.rank !== null && ranking.rank <= minGLRank) { + let rank + switch (Store.get('pvpRankingMethod')) { + case 'competition': + rank = ranking.competition_rank + break + case 'dense': + rank = ranking.dense_rank + break + case 'ordinal': + rank = ranking.ordinal_rank + break + } + + if (rank === undefined) { + rank = ranking.rank + } + + if (rank !== null && rank <= minGLRank) { pvpFiltered = false - return false // same as 'break' + return false } }) } if (minULRank > 0 && pvpFiltered) { var ultraLeague = JSON.parse(item['pvp_rankings_ultra_league']) $.each(ultraLeague, function (index, ranking) { - if (ranking.rank !== null && ranking.rank <= minULRank) { + let rank + switch (Store.get('pvpRankingMethod')) { + case 'competition': + rank = ranking.competition_rank + break + case 'dense': + rank = ranking.dense_rank + break + case 'ordinal': + rank = ranking.ordinal_rank + break + } + + if (rank === undefined) { + rank = ranking.rank + } + + if (rank !== null && rank <= minULRank) { pvpFiltered = false - return false // same as 'break' + return false } }) } + if (pvpFiltered) { + if (excludedMinIV.includes(item['pokemon_id'])) { + pvpFiltered = false + } else if (Store.get('showMissingIVOnly') === true) { + pvpFiltered = false + } else if (minIV > 0 || minLevel > 0) { + let iv = getIv(item['individual_attack'], item['individual_defense'], item['individual_stamina']) + let level = ((item['level'] != null) ? item['level'] : getPokemonLevel(item['cp_multiplier'])) + pvpFiltered = (iv < minIV || level < minLevel) + } + } if (pvpFiltered) { return true } @@ -5228,15 +5489,29 @@ function processGyms(i, item) { if (!noLastScan && Store.get('showLastUpdatedGymsOnly')) { var now = new Date() - if (item.last_scanned == null) { - if (Store.get('showLastUpdatedGymsOnly') * 3600 * 1000 + item.last_modified < now.getTime() && (item.raid_end === undefined || item.raid_end < Date.now())) { - removeGymFromMap(item['gym_id']) - return true + if (Store.get('showLastUpdatedGymsOnly') > 0) { + if (item.last_scanned == null) { + if (Store.get('showLastUpdatedGymsOnly') * 3600 * 1000 + item.last_modified < now.getTime() && (item.raid_end === undefined || item.raid_end < Date.now())) { + removeGymFromMap(item['gym_id']) + return true + } + } else { + if (Store.get('showLastUpdatedGymsOnly') * 3600 * 1000 + item.last_scanned < now.getTime() && (item.raid_end === undefined || item.raid_end < Date.now())) { + removeGymFromMap(item['gym_id']) + return true + } } } else { - if (Store.get('showLastUpdatedGymsOnly') * 3600 * 1000 + item.last_scanned < now.getTime() && (item.raid_end === undefined || item.raid_end < Date.now())) { - removeGymFromMap(item['gym_id']) - return true + if (item.last_scanned == null) { + if (Math.abs(Store.get('showLastUpdatedGymsOnly')) * 3600 * 1000 + item.last_modified >= now.getTime()) { + removeGymFromMap(item['gym_id']) + return true + } + } else { + if (Math.abs(Store.get('showLastUpdatedGymsOnly')) * 3600 * 1000 + item.last_scanned >= now.getTime()) { + removeGymFromMap(item['gym_id']) + return true + } } } } @@ -5665,11 +5940,9 @@ var updateLabelDiffTime = function updateLabelDiffTime() { timestring = i8ln('expired') } } else { - if (hours > 0) { - timestring += hours + 'h ' - } - timestring += lpad(minutes, 2, 0) + 'm ' - timestring += lpad(seconds, 2, 0) + 's' + timestring += hours + ':' + timestring += lpad(minutes, 2, 0) + ':' + timestring += lpad(seconds, 2, 0) } $(element).text(timestring) }) @@ -5690,11 +5963,9 @@ function generateRemainingTimer(timestamp, type) { timestring = i8ln('expired') } } else { - if (hours > 0) { - timestring += hours + 'h ' - } - timestring += lpad(minutes, 2, 0) + 'm ' - timestring += lpad(seconds, 2, 0) + 's' + timestring += hours + ':' + timestring += lpad(minutes, 2, 0) + ':' + timestring += lpad(seconds, 2, 0) } return timestring } @@ -6641,6 +6912,11 @@ $(function () { cp: value['cp'] !== undefined ? value['cp'] : 1 }) value['name'] = i8ln(value['name']) + $.each(value['forms'], function (key, pokemonForm) { + if (pokemonForm['nameform'] != 'Normal') { + idToForm[pokemonForm['protoform']] = i8ln(pokemonForm['nameform']) + } + }) value['rarity'] = i8ln(value['rarity']) $.each(value['types'], function (key, pokemonType) { _types.push({ @@ -6722,6 +6998,11 @@ $(function () { lastpokemon = false updateMap() }) + $('#seen-type-select').on('change', function (e) { + Store.set('showSeenType', this.value) + lastpokemon = false + updateMap() + }) $('#despawn-time-type-select').on('change', function (e) { Store.set('showDespawnTimeType', this.value) lastpokemon = false @@ -6732,6 +7013,11 @@ $(function () { lastpokemon = false updateMap() }) + $('#pvp-ranking-method-select').on('change', function (e) { + Store.set('pvpRankingMethod', this.value) + lastpokemon = false + updateMap() + }) $selectPokemonNotify.on('change', function (e) { notifiedPokemon = $selectPokemonNotify.val().split(',').map(Number).sort(function (a, b) { return parseInt(a) - parseInt(b) @@ -7582,7 +7868,7 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { var firstTry = true switch (folder) { case 'gym': - if (iconpath['gymIndex'] === undefined) { + if (iconpath['gymIndex'] === undefined || iconpath['gymIndex'] === null) { if (enableJSDebug) { console.log('No gymIndex? Houston, we have a problem.') } @@ -7616,7 +7902,7 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'invasion': - if (iconpath['invasionIndex'] === undefined) { + if (iconpath['invasionIndex'] === undefined || iconpath['invasionIndex'] === null) { if (enableJSDebug) { console.log('No invasionIndex? Houston, we have a problem.') } @@ -7633,7 +7919,7 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'nest': - if (iconpath['nestIndex'] === undefined) { + if (iconpath['nestIndex'] === undefined || iconpath['nestIndex'] === null) { if (enableJSDebug) { console.log('No nestIndex? Houston, we have a problem.') } @@ -7652,7 +7938,7 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { case 'misc': break case 'pokemon': - if (iconpath['pokemonIndex'] === undefined) { + if (iconpath['pokemonIndex'] === undefined || iconpath['pokemonIndex'] === null) { if (enableJSDebug) { console.log('No pokemonIndex? Houston, we have a problem.') } @@ -7692,7 +7978,7 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'pokestop': - if (iconpath['pokestopIndex'] === undefined) { + if (iconpath['pokestopIndex'] === undefined || iconpath['pokestopIndex'] === null) { if (enableJSDebug) { console.log('No pokestopIndex? Houston, we have a problem.') } @@ -7723,11 +8009,11 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'raid/egg': - if (iconpath['raidIndex'] === undefined) { + if (iconpath['raidIndex'] === undefined || iconpath['raidIndex'] === null) { if (enableJSDebug) { console.log('No raidIndex? Houston, we have a problem.') } - } else if (iconpath['raidIndex']['egg'] === undefined) { + } else if (iconpath['raidIndex']['egg'] === undefined || iconpath['raidIndex']['egg'] === null) { if (enableJSDebug) { console.log('No raidIndex->egg? Houston, we have a problem.') } @@ -7758,11 +8044,11 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'reward/item': - if (iconpath['rewardIndex'] === undefined) { + if (iconpath['rewardIndex'] === undefined || iconpath['rewardIndex'] === null) { if (enableJSDebug) { console.log('No rewardIndex? Houston, we have a problem.') } - } else if (iconpath['rewardIndex']['item'] === undefined) { + } else if (iconpath['rewardIndex']['item'] === undefined || iconpath['rewardIndex']['item'] === null) { if (enableJSDebug) { console.log('No rewardIndex->item? Houston, we have a problem.') } @@ -7790,11 +8076,11 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'reward/mega_resource': - if (iconpath['rewardIndex'] === undefined) { + if (iconpath['rewardIndex'] === undefined || iconpath['rewardIndex'] === null) { if (enableJSDebug) { console.log('No rewardIndex? Houston, we have a problem.') } - } else if (iconpath['rewardIndex']['mega_resource'] === undefined) { + } else if (iconpath['rewardIndex']['mega_resource'] === undefined || iconpath['rewardIndex']['mega_resource'] === null) { if (enableJSDebug) { console.log('No rewardIndex->mega_resource? Houston, we have a problem.') } @@ -7823,11 +8109,11 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'reward/stardust': - if (iconpath['rewardIndex'] === undefined) { + if (iconpath['rewardIndex'] === undefined || iconpath['rewardIndex'] === null) { if (enableJSDebug) { console.log('No rewardIndex? Houston, we have a problem.') } - } else if (iconpath['rewardIndex']['stardust'] === undefined) { + } else if (iconpath['rewardIndex']['stardust'] === undefined || iconpath['rewardIndex']['stardust'] === null) { if (enableJSDebug) { console.log('No rewardIndex->stardust? Houston, we have a problem.') } @@ -7844,11 +8130,11 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'reward/candy': - if (iconpath['rewardIndex'] === undefined) { + if (iconpath['rewardIndex'] === undefined || iconpath['rewardIndex'] === null) { if (enableJSDebug) { console.log('No rewardIndex? Houston, we have a problem.') } - } else if (iconpath['rewardIndex']['candy'] === undefined) { + } else if (iconpath['rewardIndex']['candy'] === undefined || iconpath['rewardIndex']['candy'] === null) { if (enableJSDebug) { console.log('No rewardIndex->candy? Houston, we have a problem.') } @@ -7876,7 +8162,7 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'team': - if (iconpath['teamIndex'] === undefined) { + if (iconpath['teamIndex'] === undefined || iconpath['teamIndex'] === null) { if (enableJSDebug) { console.log('No teamIndex? Houston, we have a problem.') } @@ -7893,7 +8179,7 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'type': - if (iconpath['typeIndex'] === undefined) { + if (iconpath['typeIndex'] === undefined || iconpath['typeIndex'] === null) { if (enableJSDebug) { console.log('No typeIndex? Houston, we have a problem.') } @@ -7910,7 +8196,7 @@ function getIcon(iconRepo, folder, fileType, iconKeyId, ...varArgs) { } break case 'weather': - if (iconpath['weatherIndex'] === undefined) { + if (iconpath['weatherIndex'] === undefined || iconpath['weatherIndex'] === null) { if (enableJSDebug) { console.log('No weatherIndex? Houston, we have a problem.') } diff --git a/static/sass/layout/_gyms.scss b/static/sass/layout/_gyms.scss index ea60bc67b..5991be5d0 100644 --- a/static/sass/layout/_gyms.scss +++ b/static/sass/layout/_gyms.scss @@ -36,20 +36,22 @@ margin: 6px; } .gym-icon-egg-timer { - background-color: pink; + background-color: #F98795; color: white; + left: -3px; top: 50px; position: absolute; font-size: 11px; - font-weight: 500; + border: 1px solid white; border-radius: .25rem!important; } .gym-icon-raid-timer { - background-color: #ff8c00; + background-color: #FF7836; color: white; + left: -3px; top: 50px; position: absolute; font-size: 11px; - font-weight: 500; + border: 1px solid white; border-radius: .25rem!important; } diff --git a/static/sass/layout/_pokestop.scss b/static/sass/layout/_pokestop.scss index 648787bcf..5cd6e9500 100644 --- a/static/sass/layout/_pokestop.scss +++ b/static/sass/layout/_pokestop.scss @@ -63,9 +63,10 @@ .pokestop-icon-rocket-timer { background-color: #c7c7c7; color: black; + left: -3px; top: 50px; position: absolute; font-size: 11px; - font-weight: 500; + border: 1px solid black; border-radius: .25rem!important; }