From b326adcb9a1d2eb69eb76050526fa60717e7ac56 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 21:20:47 +0000 Subject: [PATCH 01/19] Configurable ranking method and support for displaying AR flag Add AR tag to gym marker icons. Add support for configuring which RDM PvP ranking method gets used when filtering and displaying pokemon. Change the egg/raid timers so they look more like the in-game ones. --- config/default.php | 4 +- config/example.config.php | 5 +- lib/RDM.php | 18 +- lib/RocketMap.php | 1 + lib/RocketMap_MAD.php | 2 + pre-index.php | 69 +++++--- static/images/ar.png | Bin 0 -> 1881 bytes static/js/map.common.js | 114 ++++++++---- static/js/map.js | 278 ++++++++++++++++++++++++------ static/sass/layout/_gyms.scss | 10 +- static/sass/layout/_pokestop.scss | 3 +- 11 files changed, 384 insertions(+), 120 deletions(-) create mode 100644 static/images/ar.png diff --git a/config/default.php b/config/default.php index b25750d69..7496b180a 100644 --- a/config/default.php +++ b/config/default.php @@ -333,8 +333,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 3354d926f..e98266716 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 @@ -334,7 +337,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..6fa59e2ad 100644 --- a/lib/RDM.php +++ b/lib/RDM.php @@ -261,6 +261,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 +280,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) { @@ -525,6 +531,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 +575,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"] = 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 +591,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"]); @@ -690,6 +698,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 +716,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 +726,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"] = 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..91427dc9d 100644 --- a/lib/RocketMap.php +++ b/lib/RocketMap.php @@ -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..b06e82d21 100644 --- a/lib/RocketMap_MAD.php +++ b/lib/RocketMap_MAD.php @@ -473,6 +473,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"] = 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) { @@ -883,6 +884,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"] = 0; $data[] = $pokestop; unset($pokestops[$i]); $i++; diff --git a/pre-index.php b/pre-index.php index ce4fdc2b2..99ffa09c1 100644 --- a/pre-index.php +++ b/pre-index.php @@ -313,33 +313,6 @@ - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
-
-
@@ -415,6 +388,48 @@
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+ + +
+ + EX>4Tx04R}tkv&MmKpe$iTcuhm3U&~6$WWauh!$~_Di*;)X)CnqU~=gfG-*gu zTpR`0f`cE6RRFSdL}hb93mEq9V~S)E9nYxlsGIaD&>2# z4$GXkI4hMJYu%H-Fql_Y(p;xGia3^#KoSBZ)KEqRCL*+|q!>uie$2%`Z2ObslE_sC zBgX=&P$1fV@IUz7tx=esa*~2Ep!>zLKE?q5F3_x7*7vbxHBSKFGjOH0{nZ9A`$>Ae zt%Z+({%zpmx~)ljz~v4w^rVTpXiGkt-a-L*KcjET0fVEheMVC00mV^L_t(o!`+#GOq6vT$6xn! zfSkdGyJ)~U56fFSG$LRtJyRy8{$c8c;Idq^tQK37jWF$p^ABwym20|M>xZj!oe*lR znT8!GQ4C2Dp+HlVLkm<4@~%71qd&MiA9$YUcusHw-y47M`Tn@i`}_I%e7|r9L!&g1 zSMG}hmH^9uG~j_TqVvCi12_)s1@_ylf=4yEymFrvcn7$D92n>fu+C-`%0rUNEBD<6 zYypY@5@USKHuf<+-b+G^Z%i=p`k?E&z^P6xN82K}*ee8vih&I_t8gPA&<BD?mbwkAxTx^QL;JJQvBHQ&D(*0|o)sNi3IF?#ls6wF12IhzoPP zcibe7=1wgi{2GmSz`2&&tU_6koIiP-1(H@i_#atQ`);c;PM4du_O4;)nN0@Od)m)N zu0;+P3yCmKA-W>UXkJ zC$rFEW}am_y67myd2^Ecu%C`gGz0pJ`2@&i0L)MsXXhPVR5Y~9jva5iOmnMa)Lq%p?PT?vySRL{ zM{$lw{|qs?1OWX+b?N@+W33^_kJh!^5`i3xi5!cGG^1XT;5P^A6xWONPY{!f45V2# z_;i0=$np0|YjL{VVUycjn8W769KPQ60(*;BVTjX7W4-RrkYz&5M+jE|drcFLZs)M` zYLA~8ksF##2A*4zDeLxX5jMGsn%^a|=NF}_PB`IUn(^Kdtq+Ub<*PlERS%9gL!6HM zRoN03s%U5rncdXjblcw&nNmECnA|V*rzNu7>>22yqhwv^hpLme-gUG(*tD}sBG1aa zPkpNvYOuc_G@8&g?BSFt0L;oT!4PHkR5bG9%6Y1ldA+0zfNQ-j*-~SO)A8h@%+Vny zM%{@sl3+H(>BxL&;Hzkg;U3bA`ayFX-A?Q^O=QhXQP&t$hb}R1teKB~QtarvWo2!P ztV@dV#M~5B2`F4-r%vY3_BE;xDJ;u5U2Z-(&>&lLE?nvk{(r64C2Ng>)jeUI_)z?D z;mYmHmWQiPDYjZ=)vdulrIzf_kw#U@wCvl!M@36yJCk)KdqU znJMI0OtJ_0-H-L7Yq|4|uCTfSB@5S`P~Wi>tbSZpzHRr>kd1TLF(+563~@RRf4)|6 z&5E@jOAe&6wk4QZhl74nEE}JlBdK$aZYS@5c8JY|IU~26)8%GQMdPqpawz1o<|hXl z!aDV(3o>LI=d$Wn)m{)F=K*kgHIn96u1O9QZY9jhFsbfvl%R`_V(nA2Wyjv#`IGEd zhe&^qnA|0RD=y8j&2O4fKdgHN3i?RD(ihK9Cp&erYz*%^cuXP}>3>NabH{)w&7E2j zV{TsFF0`0gXfY4k;L-GHsubJ))(S;S#p`1!$zPyqpRKRu($vzuKQ2q*xytv#tm4QHJ)GV;R1F*kqqbM~?vTjLj+pFNjKkj*cFIs+tg#h&h{8a03MZw#Er!^NtHNcWSXU2Hmv4&qwlBPz<~pxK7VX_Ka!k_4kAQ z=5;#2R-08QQYzx>0iD-J{_c}eRGy3AF=HR*crS@#o3S|4~H7?zx$U?i}dfyc*mz&J+8^!bxUJp+%ArAm*FcQpP7ZC?G? Td' - } else if (noWeatherIcons === false) { - html = '' + - '' + } + var html = '' + if (item['weather_boosted_condition'] > 0 && !noWeatherIcons) { + html += '' } var pokemonIcon = L.divIcon({ iconAnchor: scaledIconCenterOffset, @@ -571,16 +634,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 ee1b2222a..044ff1c14 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1085,6 +1085,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) @@ -1354,18 +1355,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 + '
' @@ -1387,18 +1405,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 + '
' @@ -2228,19 +2263,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], @@ -2252,12 +2290,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], @@ -2269,12 +2308,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], @@ -2286,6 +2326,7 @@ function getGymMarkerIcon(item) { } else { html = '
' + '' + + smallArIcon + smallExIcon + inBattle + '
' @@ -2367,8 +2408,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']) } @@ -2408,26 +2449,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], @@ -2437,12 +2482,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({ @@ -2460,6 +2507,7 @@ function getPokestopMarkerIcon(item) { shiny = item['reward_pokemon_shiny'] html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2472,6 +2520,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 4) { html = '
' + '' + + arIcon + '' + '' + '
' @@ -2485,6 +2534,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 3) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2497,6 +2547,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 2) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2508,7 +2559,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], @@ -2517,26 +2569,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], @@ -2546,12 +2602,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({ @@ -2569,6 +2627,7 @@ function getPokestopMarkerIcon(item) { shiny = item['reward_pokemon_shiny'] html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2581,6 +2640,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 4) { html = '
' + '' + + arIcon + '' + '' + '
' @@ -2594,6 +2654,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 3) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2606,6 +2667,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 2) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2617,7 +2679,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], @@ -2626,12 +2689,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 @@ -3155,13 +3220,31 @@ function addListeners(marker) { function clearStaleMarkers() { $.each(mapData.pokemons, function (key, value) { var pvpFiltered = false + var ivFiltered = 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 } @@ -3170,12 +3253,50 @@ 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) + } } if ( mapData.pokemons[key]['disappear_time'] < new Date().getTime() || @@ -3183,7 +3304,7 @@ function clearStaleMarkers() { (excludedPokemon.indexOf(mapData.pokemons[key]['pokemon_id']) >= 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) || (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)) || @@ -3351,6 +3472,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', @@ -4756,21 +4885,67 @@ 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 } @@ -5655,11 +5830,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) }) @@ -5680,11 +5853,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 } @@ -6722,6 +6893,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) @@ -7572,7 +7748,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.') } @@ -7606,7 +7782,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.') } @@ -7642,7 +7818,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.') } @@ -7682,7 +7858,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.') } @@ -7713,11 +7889,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.') } @@ -7748,11 +7924,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.') } @@ -7780,11 +7956,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.') } @@ -7801,11 +7977,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.') } @@ -7822,11 +7998,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.') } @@ -7854,7 +8030,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.') } @@ -7871,7 +8047,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.') } @@ -7888,7 +8064,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; } From fff0dd8a65a66adcead709a114e04f8e18eb02f1 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 21:21:15 +0000 Subject: [PATCH 02/19] Update default.php --- config/default.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/default.php b/config/default.php index 7496b180a..c710dd801 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 From ccdcd558ba12b1dbe9a87d3104dec981da208ec3 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 21:47:25 +0000 Subject: [PATCH 03/19] Forgot some bits --- .eslintrc.json | 4 +++- README.md | 5 ++--- pre-index.php | 2 ++ static/data/questtype.json | 1 - static/js/map.js | 3 +-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8a19911f9..6ad1dbfcf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -179,6 +179,7 @@ "noRarityDisplay": true, "noWeatherIcons": true, "noIvShadow": true, + "noRankShadow": true, "hideQuestsPokemon": true, "hideQuestsItem": true, "hideQuestsEnergy": true, @@ -246,6 +247,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/pre-index.php b/pre-index.php index 99ffa09c1..5e9703ceb 100644 --- a/pre-index.php +++ b/pre-index.php @@ -1645,6 +1645,7 @@ var noRarityDisplay = ; var noWeatherIcons = ; var noIvShadow = ; + var noRankShadow = ; var noRaidTimer = ; var enableRaidTimer = ; var noRocketTimer = ; @@ -1668,6 +1669,7 @@ var noDarkMode = ; var noCatchRates = ; var noPvp = ; + var pvpRankingMethod = ''; var noHideSingleMarker = ; var enableJSDebug = ; diff --git a/static/data/questtype.json b/static/data/questtype.json index cd898e310..301f2e38f 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/js/map.js b/static/js/map.js index 044ff1c14..5ef5bf4ce 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -4944,7 +4944,6 @@ function processPokemons(i, item) { let level = ((item['level'] != null) ? item['level'] : getPokemonLevel(item['cp_multiplier'])) pvpFiltered = (iv < minIV || level < minLevel) } - } if (pvpFiltered) { return true @@ -7799,7 +7798,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.') } From 2a71e110b598b6186cbb42238e8f9bb08be8ebe5 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 22:56:56 +0000 Subject: [PATCH 04/19] Update map.common.js --- static/js/map.common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/map.common.js b/static/js/map.common.js index 35f54fd38..65fdef692 100755 --- a/static/js/map.common.js +++ b/static/js/map.common.js @@ -612,7 +612,7 @@ function getPokemonMarkerIcon(item) { }) } } - var html = '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) { @@ -525,6 +531,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 +575,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"] = 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 +591,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"]); @@ -690,6 +698,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 +716,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 +726,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"] = 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..91427dc9d 100644 --- a/lib/RocketMap.php +++ b/lib/RocketMap.php @@ -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..b06e82d21 100644 --- a/lib/RocketMap_MAD.php +++ b/lib/RocketMap_MAD.php @@ -473,6 +473,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"] = 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) { @@ -883,6 +884,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"] = 0; $data[] = $pokestop; unset($pokestops[$i]); $i++; diff --git a/pre-index.php b/pre-index.php index 2584a0f8f..d17cea40f 100644 --- a/pre-index.php +++ b/pre-index.php @@ -313,33 +313,6 @@
- -
-
- -
-
- - -
-
- -
-
- - -
-
- -
-
-
@@ -415,6 +388,48 @@
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+ + +
+ +
EX>4Tx04R}tkv&MmKpe$iTcuhm3U&~6$WWauh!$~_Di*;)X)CnqU~=gfG-*gu zTpR`0f`cE6RRFSdL}hb93mEq9V~S)E9nYxlsGIaD&>2# z4$GXkI4hMJYu%H-Fql_Y(p;xGia3^#KoSBZ)KEqRCL*+|q!>uie$2%`Z2ObslE_sC zBgX=&P$1fV@IUz7tx=esa*~2Ep!>zLKE?q5F3_x7*7vbxHBSKFGjOH0{nZ9A`$>Ae zt%Z+({%zpmx~)ljz~v4w^rVTpXiGkt-a-L*KcjET0fVEheMVC00mV^L_t(o!`+#GOq6vT$6xn! zfSkdGyJ)~U56fFSG$LRtJyRy8{$c8c;Idq^tQK37jWF$p^ABwym20|M>xZj!oe*lR znT8!GQ4C2Dp+HlVLkm<4@~%71qd&MiA9$YUcusHw-y47M`Tn@i`}_I%e7|r9L!&g1 zSMG}hmH^9uG~j_TqVvCi12_)s1@_ylf=4yEymFrvcn7$D92n>fu+C-`%0rUNEBD<6 zYypY@5@USKHuf<+-b+G^Z%i=p`k?E&z^P6xN82K}*ee8vih&I_t8gPA&<BD?mbwkAxTx^QL;JJQvBHQ&D(*0|o)sNi3IF?#ls6wF12IhzoPP zcibe7=1wgi{2GmSz`2&&tU_6koIiP-1(H@i_#atQ`);c;PM4du_O4;)nN0@Od)m)N zu0;+P3yCmKA-W>UXkJ zC$rFEW}am_y67myd2^Ecu%C`gGz0pJ`2@&i0L)MsXXhPVR5Y~9jva5iOmnMa)Lq%p?PT?vySRL{ zM{$lw{|qs?1OWX+b?N@+W33^_kJh!^5`i3xi5!cGG^1XT;5P^A6xWONPY{!f45V2# z_;i0=$np0|YjL{VVUycjn8W769KPQ60(*;BVTjX7W4-RrkYz&5M+jE|drcFLZs)M` zYLA~8ksF##2A*4zDeLxX5jMGsn%^a|=NF}_PB`IUn(^Kdtq+Ub<*PlERS%9gL!6HM zRoN03s%U5rncdXjblcw&nNmECnA|V*rzNu7>>22yqhwv^hpLme-gUG(*tD}sBG1aa zPkpNvYOuc_G@8&g?BSFt0L;oT!4PHkR5bG9%6Y1ldA+0zfNQ-j*-~SO)A8h@%+Vny zM%{@sl3+H(>BxL&;Hzkg;U3bA`ayFX-A?Q^O=QhXQP&t$hb}R1teKB~QtarvWo2!P ztV@dV#M~5B2`F4-r%vY3_BE;xDJ;u5U2Z-(&>&lLE?nvk{(r64C2Ng>)jeUI_)z?D z;mYmHmWQiPDYjZ=)vdulrIzf_kw#U@wCvl!M@36yJCk)KdqU znJMI0OtJ_0-H-L7Yq|4|uCTfSB@5S`P~Wi>tbSZpzHRr>kd1TLF(+563~@RRf4)|6 z&5E@jOAe&6wk4QZhl74nEE}JlBdK$aZYS@5c8JY|IU~26)8%GQMdPqpawz1o<|hXl z!aDV(3o>LI=d$Wn)m{)F=K*kgHIn96u1O9QZY9jhFsbfvl%R`_V(nA2Wyjv#`IGEd zhe&^qnA|0RD=y8j&2O4fKdgHN3i?RD(ihK9Cp&erYz*%^cuXP}>3>NabH{)w&7E2j zV{TsFF0`0gXfY4k;L-GHsubJ))(S;S#p`1!$zPyqpRKRu($vzuKQ2q*xytv#tm4QHJ)GV;R1F*kqqbM~?vTjLj+pFNjKkj*cFIs+tg#h&h{8a03MZw#Er!^NtHNcWSXU2Hmv4&qwlBPz<~pxK7VX_Ka!k_4kAQ z=5;#2R-08QQYzx>0iD-J{_c}eRGy3AF=HR*crS@#o3S|4~H7?zx$U?i}dfyc*mz&J+8^!bxUJp+%ArAm*FcQpP7ZC?G? Td' - } else if (noWeatherIcons === false) { - html = '' + - '' + } + var html = '' + if (item['weather_boosted_condition'] > 0 && !noWeatherIcons) { + html += '' } var pokemonIcon = L.divIcon({ iconAnchor: scaledIconCenterOffset, @@ -571,16 +634,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..bafe0c953 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1097,6 +1097,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) @@ -1363,18 +1364,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 +1414,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 + '
' @@ -2238,19 +2273,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 +2300,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 +2318,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 +2336,7 @@ function getGymMarkerIcon(item) { } else { html = '
' + '' + + smallArIcon + smallExIcon + inBattle + '
' @@ -2377,8 +2418,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 +2459,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,6 +2492,7 @@ 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'] } @@ -2470,6 +2516,7 @@ function getPokestopMarkerIcon(item) { shiny = item['reward_pokemon_shiny'] html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2482,6 +2529,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 4) { html = '
' + '' + + arIcon + '' + '' + '
' @@ -2495,6 +2543,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 3) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2507,6 +2556,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 2) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2518,7 +2568,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 +2578,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,6 +2611,7 @@ 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'] } @@ -2579,6 +2635,7 @@ function getPokestopMarkerIcon(item) { shiny = item['reward_pokemon_shiny'] html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2591,6 +2648,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 4) { html = '
' + '' + + arIcon + '' + '' + '
' @@ -2604,6 +2662,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 3) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2616,6 +2675,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 2) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2627,7 +2687,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 +2697,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 +3228,31 @@ function addListeners(marker) { function clearStaleMarkers() { $.each(mapData.pokemons, function (key, value) { var pvpFiltered = false + var ivFiltered = 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,12 +3261,50 @@ 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) + } } if ( mapData.pokemons[key]['disappear_time'] < new Date().getTime() || @@ -3193,7 +3312,7 @@ function clearStaleMarkers() { (excludedPokemon.indexOf(mapData.pokemons[key]['pokemon_id']) >= 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) || (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)) || @@ -3361,6 +3480,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', @@ -4766,21 +4893,67 @@ 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 } @@ -5665,11 +5838,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 +5861,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 } @@ -6732,6 +6901,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 +7756,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 +7790,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.') } @@ -7652,7 +7826,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 +7866,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 +7897,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 +7932,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 +7964,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 +7997,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 +8018,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 +8050,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 +8067,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 +8084,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; } From c87a0d30e6a5834c0eb46eb325a21311e361554f Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 21:21:15 +0000 Subject: [PATCH 06/19] Update default.php --- config/default.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/default.php b/config/default.php index 70aa6e669..367ee4c95 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 From bc4702c689d096046aa610d093b530ec2fecfdea Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 21:47:25 +0000 Subject: [PATCH 07/19] Forgot some bits --- .eslintrc.json | 4 +++- README.md | 5 ++--- pre-index.php | 2 ++ static/data/questtype.json | 1 - static/js/map.js | 3 +-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8a19911f9..6ad1dbfcf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -179,6 +179,7 @@ "noRarityDisplay": true, "noWeatherIcons": true, "noIvShadow": true, + "noRankShadow": true, "hideQuestsPokemon": true, "hideQuestsItem": true, "hideQuestsEnergy": true, @@ -246,6 +247,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/pre-index.php b/pre-index.php index d17cea40f..b79b0f216 100644 --- a/pre-index.php +++ b/pre-index.php @@ -1647,6 +1647,7 @@ var noRarityDisplay = ; var noWeatherIcons = ; var noIvShadow = ; + var noRankShadow = ; var noRaidTimer = ; var enableRaidTimer = ; var noRocketTimer = ; @@ -1670,6 +1671,7 @@ var noDarkMode = ; var noCatchRates = ; var noPvp = ; + var pvpRankingMethod = ''; var noHideSingleMarker = ; var enableJSDebug = ; 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/js/map.js b/static/js/map.js index bafe0c953..ce6a87a7f 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -4952,7 +4952,6 @@ function processPokemons(i, item) { let level = ((item['level'] != null) ? item['level'] : getPokemonLevel(item['cp_multiplier'])) pvpFiltered = (iv < minIV || level < minLevel) } - } if (pvpFiltered) { return true @@ -7807,7 +7806,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.') } From 5c30acf2c5afafab3243aa5724836186937e4dfd Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 22:56:56 +0000 Subject: [PATCH 08/19] Update map.common.js --- static/js/map.common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/map.common.js b/static/js/map.common.js index 35f54fd38..65fdef692 100755 --- a/static/js/map.common.js +++ b/static/js/map.common.js @@ -612,7 +612,7 @@ function getPokemonMarkerIcon(item) { }) } } - var html = '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) { @@ -525,6 +531,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 +575,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"] = 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 +591,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"]); @@ -690,6 +698,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 +716,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 +726,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"] = 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..91427dc9d 100644 --- a/lib/RocketMap.php +++ b/lib/RocketMap.php @@ -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..b06e82d21 100644 --- a/lib/RocketMap_MAD.php +++ b/lib/RocketMap_MAD.php @@ -473,6 +473,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"] = 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) { @@ -883,6 +884,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"] = 0; $data[] = $pokestop; unset($pokestops[$i]); $i++; diff --git a/pre-index.php b/pre-index.php index 2584a0f8f..d17cea40f 100644 --- a/pre-index.php +++ b/pre-index.php @@ -313,33 +313,6 @@
- -
-
- -
-
- - -
-
- -
-
- - -
-
- -
-
-
@@ -415,6 +388,48 @@
+ +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+ + +
+ +
EX>4Tx04R}tkv&MmKpe$iTcuhm3U&~6$WWauh!$~_Di*;)X)CnqU~=gfG-*gu zTpR`0f`cE6RRFSdL}hb93mEq9V~S)E9nYxlsGIaD&>2# z4$GXkI4hMJYu%H-Fql_Y(p;xGia3^#KoSBZ)KEqRCL*+|q!>uie$2%`Z2ObslE_sC zBgX=&P$1fV@IUz7tx=esa*~2Ep!>zLKE?q5F3_x7*7vbxHBSKFGjOH0{nZ9A`$>Ae zt%Z+({%zpmx~)ljz~v4w^rVTpXiGkt-a-L*KcjET0fVEheMVC00mV^L_t(o!`+#GOq6vT$6xn! zfSkdGyJ)~U56fFSG$LRtJyRy8{$c8c;Idq^tQK37jWF$p^ABwym20|M>xZj!oe*lR znT8!GQ4C2Dp+HlVLkm<4@~%71qd&MiA9$YUcusHw-y47M`Tn@i`}_I%e7|r9L!&g1 zSMG}hmH^9uG~j_TqVvCi12_)s1@_ylf=4yEymFrvcn7$D92n>fu+C-`%0rUNEBD<6 zYypY@5@USKHuf<+-b+G^Z%i=p`k?E&z^P6xN82K}*ee8vih&I_t8gPA&<BD?mbwkAxTx^QL;JJQvBHQ&D(*0|o)sNi3IF?#ls6wF12IhzoPP zcibe7=1wgi{2GmSz`2&&tU_6koIiP-1(H@i_#atQ`);c;PM4du_O4;)nN0@Od)m)N zu0;+P3yCmKA-W>UXkJ zC$rFEW}am_y67myd2^Ecu%C`gGz0pJ`2@&i0L)MsXXhPVR5Y~9jva5iOmnMa)Lq%p?PT?vySRL{ zM{$lw{|qs?1OWX+b?N@+W33^_kJh!^5`i3xi5!cGG^1XT;5P^A6xWONPY{!f45V2# z_;i0=$np0|YjL{VVUycjn8W769KPQ60(*;BVTjX7W4-RrkYz&5M+jE|drcFLZs)M` zYLA~8ksF##2A*4zDeLxX5jMGsn%^a|=NF}_PB`IUn(^Kdtq+Ub<*PlERS%9gL!6HM zRoN03s%U5rncdXjblcw&nNmECnA|V*rzNu7>>22yqhwv^hpLme-gUG(*tD}sBG1aa zPkpNvYOuc_G@8&g?BSFt0L;oT!4PHkR5bG9%6Y1ldA+0zfNQ-j*-~SO)A8h@%+Vny zM%{@sl3+H(>BxL&;Hzkg;U3bA`ayFX-A?Q^O=QhXQP&t$hb}R1teKB~QtarvWo2!P ztV@dV#M~5B2`F4-r%vY3_BE;xDJ;u5U2Z-(&>&lLE?nvk{(r64C2Ng>)jeUI_)z?D z;mYmHmWQiPDYjZ=)vdulrIzf_kw#U@wCvl!M@36yJCk)KdqU znJMI0OtJ_0-H-L7Yq|4|uCTfSB@5S`P~Wi>tbSZpzHRr>kd1TLF(+563~@RRf4)|6 z&5E@jOAe&6wk4QZhl74nEE}JlBdK$aZYS@5c8JY|IU~26)8%GQMdPqpawz1o<|hXl z!aDV(3o>LI=d$Wn)m{)F=K*kgHIn96u1O9QZY9jhFsbfvl%R`_V(nA2Wyjv#`IGEd zhe&^qnA|0RD=y8j&2O4fKdgHN3i?RD(ihK9Cp&erYz*%^cuXP}>3>NabH{)w&7E2j zV{TsFF0`0gXfY4k;L-GHsubJ))(S;S#p`1!$zPyqpRKRu($vzuKQ2q*xytv#tm4QHJ)GV;R1F*kqqbM~?vTjLj+pFNjKkj*cFIs+tg#h&h{8a03MZw#Er!^NtHNcWSXU2Hmv4&qwlBPz<~pxK7VX_Ka!k_4kAQ z=5;#2R-08QQYzx>0iD-J{_c}eRGy3AF=HR*crS@#o3S|4~H7?zx$U?i}dfyc*mz&J+8^!bxUJp+%ArAm*FcQpP7ZC?G? Td' - } else if (noWeatherIcons === false) { - html = '' + - '' + } + var html = '' + if (item['weather_boosted_condition'] > 0 && !noWeatherIcons) { + html += '' } var pokemonIcon = L.divIcon({ iconAnchor: scaledIconCenterOffset, @@ -571,16 +634,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..bafe0c953 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1097,6 +1097,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) @@ -1363,18 +1364,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 +1414,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 + '
' @@ -2238,19 +2273,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 +2300,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 +2318,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 +2336,7 @@ function getGymMarkerIcon(item) { } else { html = '
' + '' + + smallArIcon + smallExIcon + inBattle + '
' @@ -2377,8 +2418,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 +2459,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,6 +2492,7 @@ 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'] } @@ -2470,6 +2516,7 @@ function getPokestopMarkerIcon(item) { shiny = item['reward_pokemon_shiny'] html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2482,6 +2529,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 4) { html = '
' + '' + + arIcon + '' + '' + '
' @@ -2495,6 +2543,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 3) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2507,6 +2556,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 2) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2518,7 +2568,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 +2578,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,6 +2611,7 @@ 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'] } @@ -2579,6 +2635,7 @@ function getPokestopMarkerIcon(item) { shiny = item['reward_pokemon_shiny'] html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2591,6 +2648,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 4) { html = '
' + '' + + arIcon + '' + '' + '
' @@ -2604,6 +2662,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 3) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2616,6 +2675,7 @@ function getPokestopMarkerIcon(item) { } else if (item['quest_reward_type'] === 2) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2627,7 +2687,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 +2697,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 +3228,31 @@ function addListeners(marker) { function clearStaleMarkers() { $.each(mapData.pokemons, function (key, value) { var pvpFiltered = false + var ivFiltered = 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,12 +3261,50 @@ 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) + } } if ( mapData.pokemons[key]['disappear_time'] < new Date().getTime() || @@ -3193,7 +3312,7 @@ function clearStaleMarkers() { (excludedPokemon.indexOf(mapData.pokemons[key]['pokemon_id']) >= 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) || (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)) || @@ -3361,6 +3480,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', @@ -4766,21 +4893,67 @@ 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 } @@ -5665,11 +5838,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 +5861,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 } @@ -6732,6 +6901,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 +7756,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 +7790,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.') } @@ -7652,7 +7826,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 +7866,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 +7897,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 +7932,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 +7964,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 +7997,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 +8018,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 +8050,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 +8067,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 +8084,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; } From 3a3b563fbf3cba55d9d534740aef26e80225069e Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 21:21:15 +0000 Subject: [PATCH 10/19] Update default.php --- config/default.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/default.php b/config/default.php index d8ed8cfec..1627277d8 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 From 751148a0cce8efbddc90698c616c200a1fa3a744 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 21:47:25 +0000 Subject: [PATCH 11/19] Forgot some bits --- .eslintrc.json | 4 +++- README.md | 5 ++--- pre-index.php | 2 ++ static/data/questtype.json | 1 - static/js/map.js | 3 +-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 8a19911f9..6ad1dbfcf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -179,6 +179,7 @@ "noRarityDisplay": true, "noWeatherIcons": true, "noIvShadow": true, + "noRankShadow": true, "hideQuestsPokemon": true, "hideQuestsItem": true, "hideQuestsEnergy": true, @@ -246,6 +247,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/pre-index.php b/pre-index.php index d17cea40f..b79b0f216 100644 --- a/pre-index.php +++ b/pre-index.php @@ -1647,6 +1647,7 @@ var noRarityDisplay = ; var noWeatherIcons = ; var noIvShadow = ; + var noRankShadow = ; var noRaidTimer = ; var enableRaidTimer = ; var noRocketTimer = ; @@ -1670,6 +1671,7 @@ var noDarkMode = ; var noCatchRates = ; var noPvp = ; + var pvpRankingMethod = ''; var noHideSingleMarker = ; var enableJSDebug = ; 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/js/map.js b/static/js/map.js index bafe0c953..ce6a87a7f 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -4952,7 +4952,6 @@ function processPokemons(i, item) { let level = ((item['level'] != null) ? item['level'] : getPokemonLevel(item['cp_multiplier'])) pvpFiltered = (iv < minIV || level < minLevel) } - } if (pvpFiltered) { return true @@ -7807,7 +7806,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.') } From 1200022318a5e431b9596199c64a272d1ade7dec Mon Sep 17 00:00:00 2001 From: bradders <> Date: Mon, 15 Nov 2021 22:56:56 +0000 Subject: [PATCH 12/19] Update map.common.js --- static/js/map.common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/map.common.js b/static/js/map.common.js index 35f54fd38..65fdef692 100755 --- a/static/js/map.common.js +++ b/static/js/map.common.js @@ -612,7 +612,7 @@ function getPokemonMarkerIcon(item) { }) } } - var html = '' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ @@ -2618,6 +2619,7 @@ function getPokestopMarkerIcon(item) { if (item['quest_reward_type'] === 12) { html = '
' + '' + + arIcon + '' + '
' stopMarker = L.divIcon({ From 20c9fda5cc1cb3cd0748706d8ba24a95a500694c Mon Sep 17 00:00:00 2001 From: bradders <> Date: Fri, 25 Feb 2022 08:46:30 +0000 Subject: [PATCH 14/19] Spawn type selection Adds the ability to filter map display by spawn/seen type - set 'noSpawnType=false' in access config for groups you wish to have access to this, it's hidden by default. --- .eslintrc.json | 1 + config/default.php | 2 ++ config/example.config.php | 2 ++ lib/RDM.php | 32 ++++++++++++++++++++++++++++++-- lib/RocketMap.php | 4 ++-- lib/RocketMap_MAD.php | 30 ++++++++++++++++++++++++++++-- pre-index.php | 16 ++++++++++++++++ raw_data.php | 9 +++++---- static/js/map.common.js | 5 +++++ static/js/map.js | 32 ++++++++++++++++++++++++++++++++ 10 files changed, 123 insertions(+), 10 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 6ad1dbfcf..41da0f7d8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -90,6 +90,7 @@ "minLevel": true, "showBigKarp": true, "showTinyRat": true, + "showSpawnType": true, "showDespawnTimeType": true, "showPokemonGender": true, "hidePokemonCoords": true, diff --git a/config/default.php b/config/default.php index 1627277d8..a6f9751af 100644 --- a/config/default.php +++ b/config/default.php @@ -271,6 +271,8 @@ $noMissingIVOnly = true; // true/false $noBigKarp = false; // true/false $noTinyRat = false; // true/false +$noSpawnType = true; // true/false +$showSpawnType = 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 diff --git a/config/example.config.php b/config/example.config.php index d2840fa1b..940a21587 100644 --- a/config/example.config.php +++ b/config/example.config.php @@ -271,6 +271,8 @@ $noMissingIVOnly = true; // true/false $noBigKarp = false; // true/false $noTinyRat = false; // true/false +$noSpawnType = true; // true/false +$showSpawnType = 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 diff --git a/lib/RDM.php b/lib/RDM.php index 6fa59e2ad..a6b5cf64b 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, $spawnType, $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($spawnType)) { + if ($spawnType == 1) { // Wild + Nearby (Pokestop) + $conds[] = '(spawn_id IS NOT NULL OR pokestop_id IS NOT NULL)'; + } elseif ($spawnType == 2) { // Wild + $conds[] = 'spawn_id IS NOT NULL'; + } elseif ($spawnType == 3) { // Nearby (Pokestop + Other) + $conds[] = 'spawn_id IS NULL'; + } elseif ($spawnType == 4) { // Nearby (Pokestop) + $conds[] = '(spawn_id IS NULL AND pokestop_id IS NOT NULL)'; + } elseif ($spawnType == 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, $spawnType, $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($spawnType)) { + if ($spawnType == 1) { // Wild + Nearby (Pokestop) + $conds[] = '(spawn_id IS NOT NULL OR pokestop_id IS NOT NULL)'; + } elseif ($spawnType == 2) { // Wild + $conds[] = 'spawn_id IS NOT NULL'; + } elseif ($spawnType == 3) { // Nearby (Pokestop + Other) + $conds[] = 'spawn_id IS NULL'; + } elseif ($spawnType == 4) { // Nearby (Pokestop) + $conds[] = '(spawn_id IS NULL AND pokestop_id IS NOT NULL)'; + } elseif ($spawnType == 5) { // Nearby (Other) + $conds[] = '(spawn_id IS NULL AND pokestop_id IS NULL)'; + } + } if (!empty($despawnTimeType)) { if ($despawnTimeType == 1) { $conds[] = 'expire_timestamp_verified = 1'; diff --git a/lib/RocketMap.php b/lib/RocketMap.php index 91427dc9d..6f6b549d0 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, $spawnType, $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, $spawnType, $despawnTimeType, $gender, $swLat, $swLng, $neLat, $neLng) { global $db; $conds = array(); diff --git a/lib/RocketMap_MAD.php b/lib/RocketMap_MAD.php index b06e82d21..d112c5a3d 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, $spawnType, $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($spawnType)) { + if ($spawnType == 1) { // Wild + Nearby (Pokestop) + $conds[] = '(spawnpoint_id IS NOT NULL OR pokestop_id IS NOT NULL)'; + } elseif ($spawnType == 2) { // Wild + $conds[] = 'spawnpoint_id IS NOT NULL'; + } elseif ($spawnType == 3) { // Nearby (Pokestop + Other) + $conds[] = 'spawnpoint_id IS NULL'; + } elseif ($spawnType == 4) { // Nearby (Pokestop) + $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NOT NULL)'; + } elseif ($spawnType == 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, $spawnType, $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($spawnType)) { + if ($spawnType == 1) { // Wild + Nearby (Pokestop) + $conds[] = '(spawnpoint_id IS NOT NULL OR pokestop_id IS NOT NULL)'; + } elseif ($spawnType == 2) { // Wild + $conds[] = 'spawnpoint_id IS NOT NULL'; + } elseif ($spawnType == 3) { // Nearby (Pokestop + Other) + $conds[] = 'spawnpoint_id IS NULL'; + } elseif ($spawnType == 4) { // Nearby (Pokestop) + $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NOT NULL)'; + } elseif ($spawnType == 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'; diff --git a/pre-index.php b/pre-index.php index b79b0f216..be132622f 100644 --- a/pre-index.php +++ b/pre-index.php @@ -288,6 +288,21 @@
+ +
+ + +
+
@@ -1600,6 +1615,7 @@ var onlyTriggerGyms = ; var showBigKarp = ; var showTinyRat = ; + var showSpawnType = ; var showDespawnTimeType = ; var showPokemonGender = ; var hidePokemonCoords = ; diff --git a/raw_data.php b/raw_data.php index c3948c9ab..3236c5523 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; +$spawnType = !empty($_POST['spawnType']) ? $_POST['spawnType'] : 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, $spawnType, $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, $spawnType, $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, $spawnType, $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, $spawnType, $despawnTimeType, $pokemonGender, $swLat, $swLng, $neLat, $neLng)); } $d["reids"] = $reids; diff --git a/static/js/map.common.js b/static/js/map.common.js index 65fdef692..375f26938 100644 --- a/static/js/map.common.js +++ b/static/js/map.common.js @@ -286,6 +286,11 @@ var StoreOptions = { default: showTinyRat, type: StoreTypes.Boolean }, + 'showSpawnType': + { + default: showSpawnType, + type: StoreTypes.Number + }, 'showDespawnTimeType': { default: showDespawnTimeType, diff --git a/static/js/map.js b/static/js/map.js index 5df78e018..bdd394f17 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1060,6 +1060,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')) + $('#spawn-type-select').val(Store.get('showSpawnType')) $('#despawn-time-type-select').val(Store.get('showDespawnTimeType')) $('#pokemon-gender-select').val(Store.get('showPokemonGender')) $('#pokestops-switch').prop('checked', Store.get('showPokestops')) @@ -3231,6 +3232,7 @@ function clearStaleMarkers() { $.each(mapData.pokemons, function (key, value) { var pvpFiltered = false var ivFiltered = false + var spawnTypeFiltered = false if (minGLRank > 0 || minULRank > 0) { pvpFiltered = true @@ -3308,6 +3310,28 @@ function clearStaleMarkers() { ivFiltered = (iv < minIV || level < minLevel) } } + + switch(Store.get('showSpawnType')) { + case 0: // All + spawnTypeFiltered = false + break + case 1: // Wild + Nearby (Pokestop) + spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] === null && mapData.pokemons[key]['pokestop_id'] === null) + break + case 2: // Wild + spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] === null) + break + case 3: // Nearby (Pokestop + Other) + spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null) + break + case 4: // Nearby (Pokestop) + spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null || mapData.pokemons[key]['pokestop_id'] === null) + break + case 5: // Nearby (Other) + spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null || mapData.pokemons[key]['pokestop_id'] !== null) + break + } + if ( mapData.pokemons[key]['disappear_time'] < new Date().getTime() || ( @@ -3315,6 +3339,7 @@ function clearStaleMarkers() { isTemporaryHidden(mapData.pokemons[key]['pokemon_id']) || (pvpFiltered) || (ivFiltered) || + (spawnTypeFiltered) || (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)) || @@ -3457,6 +3482,7 @@ function loadRawData() { var loadMinLevel = Store.get('remember_text_min_level') var bigKarp = Boolean(Store.get('showBigKarp')) var tinyRat = Boolean(Store.get('showTinyRat')) + var spawnType = Store.get('showSpawnType') var despawnTimeType = Store.get('showDespawnTimeType') var pokemonGender = Store.get('showPokemonGender') var exEligible = Boolean(Store.get('exEligible')) @@ -3533,6 +3559,7 @@ function loadRawData() { 'prevMinLevel': prevMinLevel, 'bigKarp': bigKarp, 'tinyRat': tinyRat, + 'spawnType': spawnType, 'despawnTimeType': despawnTimeType, 'pokemonGender': pokemonGender, 'swLat': swLat, @@ -6892,6 +6919,11 @@ $(function () { lastpokemon = false updateMap() }) + $('#spawn-type-select').on('change', function (e) { + Store.set('showSpawnType', this.value) + lastpokemon = false + updateMap() + }) $('#despawn-time-type-select').on('change', function (e) { Store.set('showDespawnTimeType', this.value) lastpokemon = false From 8b4d5f7e21f6deb4ce0135dd766a7dbe67069206 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Fri, 25 Feb 2022 09:34:00 +0000 Subject: [PATCH 15/19] Rename spawntype to seentype --- .eslintrc.json | 2 +- config/default.php | 4 ++-- config/example.config.php | 4 ++-- lib/RDM.php | 28 ++++++++++++++-------------- lib/RocketMap.php | 4 ++-- lib/RocketMap_MAD.php | 28 ++++++++++++++-------------- pre-index.php | 8 ++++---- raw_data.php | 10 +++++----- static/js/map.common.js | 4 ++-- static/js/map.js | 28 ++++++++++++++-------------- 10 files changed, 60 insertions(+), 60 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 41da0f7d8..7c18daf44 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -90,7 +90,7 @@ "minLevel": true, "showBigKarp": true, "showTinyRat": true, - "showSpawnType": true, + "showSeenType": true, "showDespawnTimeType": true, "showPokemonGender": true, "hidePokemonCoords": true, diff --git a/config/default.php b/config/default.php index a6f9751af..463bbb65b 100644 --- a/config/default.php +++ b/config/default.php @@ -271,8 +271,8 @@ $noMissingIVOnly = true; // true/false $noBigKarp = false; // true/false $noTinyRat = false; // true/false -$noSpawnType = true; // true/false -$showSpawnType = 0; // 0 = All, 1 = Wild + Nearby (Pokestop), 2 = Wild, 3 = Nearby (Pokestop + Other), 4 = Nearby (Pokestop), 5 = Nearby (Other) +$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 diff --git a/config/example.config.php b/config/example.config.php index 940a21587..3b79d6fd3 100644 --- a/config/example.config.php +++ b/config/example.config.php @@ -271,8 +271,8 @@ $noMissingIVOnly = true; // true/false $noBigKarp = false; // true/false $noTinyRat = false; // true/false -$noSpawnType = true; // true/false -$showSpawnType = 0; // 0 = All, 1 = Wild + Nearby (Pokestop), 2 = Wild, 3 = Nearby (Pokestop + Other), 4 = Nearby (Pokestop), 5 = Nearby (Other) +$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 diff --git a/lib/RDM.php b/lib/RDM.php index a6b5cf64b..fd5f6c1e7 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, $spawnType, $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(); @@ -99,16 +99,16 @@ public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRa $conds[] = '(level >= ' . $minLevel . ' OR pokemon_id IN(' . $exMinIv . ') )'; } } - if (!empty($spawnType)) { - if ($spawnType == 1) { // Wild + Nearby (Pokestop) + if (!empty($seenType)) { + if ($seenType == 1) { // Wild + Nearby (Pokestop) $conds[] = '(spawn_id IS NOT NULL OR pokestop_id IS NOT NULL)'; - } elseif ($spawnType == 2) { // Wild + } elseif ($seenType == 2) { // Wild $conds[] = 'spawn_id IS NOT NULL'; - } elseif ($spawnType == 3) { // Nearby (Pokestop + Other) + } elseif ($seenType == 3) { // Nearby (Pokestop + Other) $conds[] = 'spawn_id IS NULL'; - } elseif ($spawnType == 4) { // Nearby (Pokestop) + } elseif ($seenType == 4) { // Nearby (Pokestop) $conds[] = '(spawn_id IS NULL AND pokestop_id IS NOT NULL)'; - } elseif ($spawnType == 5) { // Nearby (Other) + } elseif ($seenType == 5) { // Nearby (Other) $conds[] = '(spawn_id IS NULL AND pokestop_id IS NULL)'; } } @@ -131,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, $spawnType, $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(); @@ -219,16 +219,16 @@ public function get_active_by_id($ids, $minIv, $minLevel, $exMinIv, $bigKarp, $t $conds[] = '(level >= ' . $minLevel . ' OR pokemon_id IN(' . $exMinIv . ') )'; } } - if (!empty($spawnType)) { - if ($spawnType == 1) { // Wild + Nearby (Pokestop) + if (!empty($seenType)) { + if ($seenType == 1) { // Wild + Nearby (Pokestop) $conds[] = '(spawn_id IS NOT NULL OR pokestop_id IS NOT NULL)'; - } elseif ($spawnType == 2) { // Wild + } elseif ($seenType == 2) { // Wild $conds[] = 'spawn_id IS NOT NULL'; - } elseif ($spawnType == 3) { // Nearby (Pokestop + Other) + } elseif ($seenType == 3) { // Nearby (Pokestop + Other) $conds[] = 'spawn_id IS NULL'; - } elseif ($spawnType == 4) { // Nearby (Pokestop) + } elseif ($seenType == 4) { // Nearby (Pokestop) $conds[] = '(spawn_id IS NULL AND pokestop_id IS NOT NULL)'; - } elseif ($spawnType == 5) { // Nearby (Other) + } elseif ($seenType == 5) { // Nearby (Other) $conds[] = '(spawn_id IS NULL AND pokestop_id IS NULL)'; } } diff --git a/lib/RocketMap.php b/lib/RocketMap.php index 6f6b549d0..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, $spawnType, $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, $spawnType, $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(); diff --git a/lib/RocketMap_MAD.php b/lib/RocketMap_MAD.php index d112c5a3d..4d4368c7a 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, $spawnType, $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,16 +100,16 @@ public function get_active($eids, $minIv, $minLevel, $exMinIv, $bigKarp, $tinyRa $conds[] = '(cp_multiplier >= ' . $this->cpMultiplier[$minLevel] . ' OR pokemon_id IN(' . $exMinIv . ') )'; } } - if (!empty($spawnType)) { - if ($spawnType == 1) { // Wild + Nearby (Pokestop) + if (!empty($seenType)) { + if ($seenType == 1) { // Wild + Nearby (Pokestop) $conds[] = '(spawnpoint_id IS NOT NULL OR pokestop_id IS NOT NULL)'; - } elseif ($spawnType == 2) { // Wild + } elseif ($seenType == 2) { // Wild $conds[] = 'spawnpoint_id IS NOT NULL'; - } elseif ($spawnType == 3) { // Nearby (Pokestop + Other) + } elseif ($seenType == 3) { // Nearby (Pokestop + Other) $conds[] = 'spawnpoint_id IS NULL'; - } elseif ($spawnType == 4) { // Nearby (Pokestop) + } elseif ($seenType == 4) { // Nearby (Pokestop) $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NOT NULL)'; - } elseif ($spawnType == 5) { // Nearby (Other) + } elseif ($seenType == 5) { // Nearby (Other) $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NULL)'; } } @@ -133,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, $spawnType, $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(); @@ -223,16 +223,16 @@ 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($spawnType)) { - if ($spawnType == 1) { // Wild + Nearby (Pokestop) + if (!empty($seenType)) { + if ($seenType == 1) { // Wild + Nearby (Pokestop) $conds[] = '(spawnpoint_id IS NOT NULL OR pokestop_id IS NOT NULL)'; - } elseif ($spawnType == 2) { // Wild + } elseif ($seenType == 2) { // Wild $conds[] = 'spawnpoint_id IS NOT NULL'; - } elseif ($spawnType == 3) { // Nearby (Pokestop + Other) + } elseif ($seenType == 3) { // Nearby (Pokestop + Other) $conds[] = 'spawnpoint_id IS NULL'; - } elseif ($spawnType == 4) { // Nearby (Pokestop) + } elseif ($seenType == 4) { // Nearby (Pokestop) $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NOT NULL)'; - } elseif ($spawnType == 5) { // Nearby (Other) + } elseif ($seenType == 5) { // Nearby (Other) $conds[] = '(spawnpoint_id IS NULL AND pokestop_id IS NULL)'; } } diff --git a/pre-index.php b/pre-index.php index be132622f..32fa6b332 100644 --- a/pre-index.php +++ b/pre-index.php @@ -288,10 +288,10 @@
+ if (! $noSeenType) { ?>
- @@ -299,7 +299,7 @@ - +
; var showBigKarp = ; var showTinyRat = ; - var showSpawnType = ; + var showSeenType = ; var showDespawnTimeType = ; var showPokemonGender = ; var hidePokemonCoords = ; diff --git a/raw_data.php b/raw_data.php index 3236c5523..0c72cecff 100644 --- a/raw_data.php +++ b/raw_data.php @@ -36,7 +36,7 @@ $exMinIv = !empty($_POST['exMinIV']) ? $_POST['exMinIV'] : ''; $bigKarp = !empty($_POST['bigKarp']) ? $_POST['bigKarp'] : false; $tinyRat = !empty($_POST['tinyRat']) ? $_POST['tinyRat'] : false; -$spawnType = !empty($_POST['spawnType']) ? $_POST['spawnType'] : 0; +$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; @@ -149,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, $spawnType, $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, $spawnType, $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, $spawnType, $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; @@ -164,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, $spawnType, $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/js/map.common.js b/static/js/map.common.js index 375f26938..aa8b7abc6 100644 --- a/static/js/map.common.js +++ b/static/js/map.common.js @@ -286,9 +286,9 @@ var StoreOptions = { default: showTinyRat, type: StoreTypes.Boolean }, - 'showSpawnType': + 'showSeenType': { - default: showSpawnType, + default: showSeenType, type: StoreTypes.Number }, 'showDespawnTimeType': diff --git a/static/js/map.js b/static/js/map.js index bdd394f17..5c3339577 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1060,7 +1060,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')) - $('#spawn-type-select').val(Store.get('showSpawnType')) + $('#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')) @@ -3232,7 +3232,7 @@ function clearStaleMarkers() { $.each(mapData.pokemons, function (key, value) { var pvpFiltered = false var ivFiltered = false - var spawnTypeFiltered = false + var seenTypeFiltered = false if (minGLRank > 0 || minULRank > 0) { pvpFiltered = true @@ -3311,24 +3311,24 @@ function clearStaleMarkers() { } } - switch(Store.get('showSpawnType')) { + switch(Store.get('showSeenType')) { case 0: // All - spawnTypeFiltered = false + seenTypeFiltered = false break case 1: // Wild + Nearby (Pokestop) - spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] === null && mapData.pokemons[key]['pokestop_id'] === null) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] === null && mapData.pokemons[key]['pokestop_id'] === null) break case 2: // Wild - spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] === null) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] === null) break case 3: // Nearby (Pokestop + Other) - spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null) break case 4: // Nearby (Pokestop) - spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null || mapData.pokemons[key]['pokestop_id'] === null) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null || mapData.pokemons[key]['pokestop_id'] === null) break case 5: // Nearby (Other) - spawnTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null || mapData.pokemons[key]['pokestop_id'] !== null) + seenTypeFiltered = (mapData.pokemons[key]['spawn_id'] !== null || mapData.pokemons[key]['pokestop_id'] !== null) break } @@ -3339,7 +3339,7 @@ function clearStaleMarkers() { isTemporaryHidden(mapData.pokemons[key]['pokemon_id']) || (pvpFiltered) || (ivFiltered) || - (spawnTypeFiltered) || + (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)) || @@ -3482,7 +3482,7 @@ function loadRawData() { var loadMinLevel = Store.get('remember_text_min_level') var bigKarp = Boolean(Store.get('showBigKarp')) var tinyRat = Boolean(Store.get('showTinyRat')) - var spawnType = Store.get('showSpawnType') + var seenType = Store.get('showSeenType') var despawnTimeType = Store.get('showDespawnTimeType') var pokemonGender = Store.get('showPokemonGender') var exEligible = Boolean(Store.get('exEligible')) @@ -3559,7 +3559,7 @@ function loadRawData() { 'prevMinLevel': prevMinLevel, 'bigKarp': bigKarp, 'tinyRat': tinyRat, - 'spawnType': spawnType, + 'seenType': seenType, 'despawnTimeType': despawnTimeType, 'pokemonGender': pokemonGender, 'swLat': swLat, @@ -6919,8 +6919,8 @@ $(function () { lastpokemon = false updateMap() }) - $('#spawn-type-select').on('change', function (e) { - Store.set('showSpawnType', this.value) + $('#seen-type-select').on('change', function (e) { + Store.set('showSeenType', this.value) lastpokemon = false updateMap() }) From 310642ebadb6ab97865ec8114f57645ad8eb1068 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Fri, 25 Feb 2022 10:34:41 +0000 Subject: [PATCH 16/19] Some QOL tweaks Added: Ability to temporarily hide specific pokemon forms Added: Ability to only show gyms that haven't been scanned in the past X hours Added: Display multiple quest rewards on pokestop label --- pre-index.php | 5 +++ static/js/map.js | 103 ++++++++++++++++++++++++++++++----------------- 2 files changed, 70 insertions(+), 38 deletions(-) diff --git a/pre-index.php b/pre-index.php index 32fa6b332..48a692a50 100644 --- a/pre-index.php +++ b/pre-index.php @@ -783,6 +783,11 @@ + + + + +
diff --git a/static/js/map.js b/static/js/map.js index 5c3339577..5d25f4532 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -64,6 +64,7 @@ var prevMinIV = null var prevMinLevel = null var onlyPokemon = 0 var directionProvider +var hidePokemonForms = [] var buffer = [] var reincludedPokemon = [] @@ -344,6 +345,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) @@ -1321,6 +1327,9 @@ function pokemonLabel(item) { } else { contentstring += '
' } + if (form > 0) { + contentstring += ' | ' + } contentstring += '' + ' | ' if (!noHideSingleMarker) { @@ -1873,35 +1882,39 @@ 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') + - '
' + 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 ' + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + ' ' + + i8ln('Candy') + + '
' + } else if (questReward['type'] === 7) { + str += '
' + + i8ln('Reward') + ': ' + + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + + '
' + } else if (questReward['type'] === 12) { + str += '
' + + i8ln('Reward') + ': ' + + questReward['info']['amount'] + ' ' + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + ' ' + + i8ln('Mega energy') + + '
' + } } if (!noHideSingleMarker) { str += '' @@ -1999,8 +2012,7 @@ function pokestopLabel(item) { if (hidePokestopCoords === true) { str += '-' } else { - str += ' ' + - ' ' + str += ' ' + ' ' } str += '' if (!noQuests && !noWhatsappLink && item['quest_type'] !== null && lastMidnight < Number(item['quest_timestamp'])) { @@ -3336,6 +3348,7 @@ function clearStaleMarkers() { 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) || (ivFiltered) || @@ -5429,15 +5442,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 + } } } } From 8365b996e6977ad1d0efb7202dd77a16a3602f5f Mon Sep 17 00:00:00 2001 From: bradders <> Date: Fri, 25 Feb 2022 11:49:57 +0000 Subject: [PATCH 17/19] Fix so it still works with MAD --- static/js/map.js | 61 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/static/js/map.js b/static/js/map.js index 5d25f4532..ad391736f 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1882,39 +1882,72 @@ function pokestopLabel(item) { i8ln('Quest') + ': ' + i8ln(questStr) + '' - var questRewards = JSON.parse(item['quest_rewards']) - for (var i = 0; i < questRewards.length; i++) { - var questReward = questRewards[i] - if (questReward['type'] === 2) { + if (item['quest_rewards'] === undefined || item['quest_rewards'] === null) { + if (item['quest_reward_type'] === 2) { str += '
' + i8ln('Reward') + ': ' + - questReward['info']['amount'] + ' ' + - i8ln(idToItem[questReward['info']['item_id']]) + + item['reward_amount'] + ' ' + + item['reward_item_name'] + '
' - } else if (questReward['type'] === 3) { + } else if (item['quest_reward_type'] === 3) { str += '
' + i8ln('Reward') + ': ' + - questReward['info']['amount'] + ' ' + + item['reward_amount'] + ' ' + i8ln('Stardust') + '
' - } else if (questReward['type'] === 4) { + } else if (item['quest_reward_type'] === 4) { str += '
' + i8ln('Reward') + ': ' + - questReward['info']['amount'] + 'x ' + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + ' ' + + item['reward_amount'] + 'x ' + item['reward_pokemon_name'] + ' ' + i8ln('Candy') + '
' - } else if (questReward['type'] === 7) { + } else if (item['quest_reward_type'] === 7) { str += '
' + i8ln('Reward') + ': ' + - i8ln(idToPokemon[questReward['info']['pokemon_id']]) + + item['reward_pokemon_name'] + '
' - } else if (questReward['type'] === 12) { + } else if (item['quest_reward_type'] === 12) { str += '
' + i8ln('Reward') + ': ' + - questReward['info']['amount'] + ' ' + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + ' ' + + 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 ' + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + ' ' + + i8ln('Candy') + + '
' + } else if (questReward['type'] === 7) { + str += '
' + + i8ln('Reward') + ': ' + + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + + '
' + } else if (questReward['type'] === 12) { + str += '
' + + i8ln('Reward') + ': ' + + questReward['info']['amount'] + ' ' + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + ' ' + + i8ln('Mega energy') + + '
' + } + } } if (!noHideSingleMarker) { str += '' From 980f0dcbc4479afd501ef5477f486479e0b00231 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Fri, 25 Feb 2022 15:58:15 +0000 Subject: [PATCH 18/19] Tweaks Added: Quest encounter reward text on pokestop label now includes pokemon form (if any). Fixed: Use is_ar_scan_eligible field from MAD pokestop table rather than forcing to 0. --- config/default.php | 1 + config/example.config.php | 1 + lib/RDM.php | 8 ++++---- lib/RocketMap_MAD.php | 10 ++++++---- static/js/map.js | 27 +++++++++++++++++++++++---- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/config/default.php b/config/default.php index 463bbb65b..12e93259e 100644 --- a/config/default.php +++ b/config/default.php @@ -284,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 diff --git a/config/example.config.php b/config/example.config.php index 3b79d6fd3..d82de2bde 100644 --- a/config/example.config.php +++ b/config/example.config.php @@ -284,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 diff --git a/lib/RDM.php b/lib/RDM.php index fd5f6c1e7..462ab1d69 100644 --- a/lib/RDM.php +++ b/lib/RDM.php @@ -549,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, @@ -604,7 +604,7 @@ 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"] = intval($pokestop["ar_scan_eligible"]); + $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"]); @@ -704,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, @@ -760,7 +760,7 @@ public function query_gyms($conds, $params, $raids, $gyms, $rbeids, $reeids) $gym["last_scanned"] = $gym["last_scanned"] * 1000; $gym["raid_start"] = $gym["raid_start"] * 1000; $gym["raid_end"] = $gym["raid_end"] * 1000; - $gym["ar_scan_eligible"] = intval($gym["ar_scan_eligible"]); + $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_MAD.php b/lib/RocketMap_MAD.php index 4d4368c7a..9b2c2e7ee 100644 --- a/lib/RocketMap_MAD.php +++ b/lib/RocketMap_MAD.php @@ -439,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, @@ -452,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, @@ -499,7 +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"] = 0; + $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) { @@ -811,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, @@ -822,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, @@ -910,7 +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"] = 0; + $pokestop["ar_scan_eligible"] = $noArEligible ? 0 : intval($pokestop["ar_scan_eligible"]); $data[] = $pokestop; unset($pokestops[$i]); $i++; diff --git a/static/js/map.js b/static/js/map.js index ad391736f..79787f3df 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 = {} @@ -1828,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 (length(formName) > 0) { + pokemonName += ' (' + formName + ')' + } + } + + return pokemonName +} + function pokestopLabel(item) { var str var stopImage = '' @@ -1904,7 +1918,7 @@ function pokestopLabel(item) { } else if (item['quest_reward_type'] === 7) { str += '
' + i8ln('Reward') + ': ' + - item['reward_pokemon_name'] + + getPokemonName(item['reward_pokemon_id'], item['reward_pokemon_formid']) + '
' } else if (item['quest_reward_type'] === 12) { str += '
' + @@ -1932,18 +1946,18 @@ function pokestopLabel(item) { } else if (questReward['type'] === 4) { str += '
' + i8ln('Reward') + ': ' + - questReward['info']['amount'] + 'x ' + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + ' ' + + questReward['info']['amount'] + 'x ' + idToPokemon[questReward['info']['pokemon_id']] + ' ' + i8ln('Candy') + '
' } else if (questReward['type'] === 7) { str += '
' + i8ln('Reward') + ': ' + - i8ln(idToPokemon[questReward['info']['pokemon_id']]) + + getPokemonName(questReward['info']['pokemon_id'], questReward['info']['form_id']) + '
' } else if (questReward['type'] === 12) { str += '
' + i8ln('Reward') + ': ' + - questReward['info']['amount'] + ' ' + i8ln(idToPokemon[questReward['info']['pokemon_id']]) + ' ' + + questReward['info']['amount'] + ' ' + idToPokemon[questReward['info']['pokemon_id']] + ' ' + i8ln('Mega energy') + '
' } @@ -6898,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({ From a1e457f580fdc2cc67dfb1c23f67f6757eaeffa3 Mon Sep 17 00:00:00 2001 From: bradders <> Date: Sat, 26 Feb 2022 02:02:52 +0000 Subject: [PATCH 19/19] wrong language --- static/js/map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/map.js b/static/js/map.js index 79787f3df..e28d7f8cf 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -1834,7 +1834,7 @@ function getPokemonName(pokemon_id, form_id) { if (form_id > 0) { var formName = idToForm[form_id] - if (length(formName) > 0) { + if (formName && formName.length > 0) { pokemonName += ' (' + formName + ')' } }