Skip to content

Commit 1cf4bb8

Browse files
authored
Merge pull request #281 from LordJavi/ar-scan-eligible
Add AR Scan Eligible
2 parents 69b711b + 397a4ff commit 1cf4bb8

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

src/configs/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"database": "rdmdb",
9898
"charset": "utf8mb4",
9999
"sessionTable": "sessions",
100+
"arScanColumn": false,
100101
"useFor": []
101102
},
102103
"manualdb": {

src/data/map.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const db = new MySQLConnector(config.db.scanner);
1313
const dbManual = new MySQLConnector(config.db.manualdb);
1414

1515
const masterfile = require('../../static/data/masterfile.json');
16+
const arScanEligible = config.db.scanner.arScanColumn ? ', ar_scan_eligible' : '';
1617

1718
const dbSelection = (category) => {
1819
let dbSelection;
@@ -383,7 +384,7 @@ const getGyms = async (minLat, maxLat, minLon, maxLon, updated = 0, showRaids =
383384
raid_spawn_timestamp, raid_battle_timestamp, raid_pokemon_id, enabled, availble_slots, updated,
384385
raid_level, ex_raid_eligible, in_battle, raid_pokemon_move_1, raid_pokemon_move_2, raid_pokemon_form,
385386
raid_pokemon_cp, raid_pokemon_gender, raid_is_exclusive, cell_id, total_cp, sponsor_id,
386-
raid_pokemon_evolution, raid_pokemon_costume
387+
raid_pokemon_evolution, raid_pokemon_costume${arScanEligible}
387388
FROM gym
388389
WHERE lat >= ? AND lat <= ? AND lon >= ? AND lon <= ? AND updated > ? AND deleted = false
389390
${excludeLevelSQL} AND (
@@ -423,6 +424,12 @@ const getGyms = async (minLat, maxLat, minLon, maxLon, updated = 0, showRaids =
423424
raidBattleTimestamp = null;
424425
raidPokemonId = null;
425426
}
427+
428+
let arScanEligible = null;
429+
if (config.db.scanner.arScanColumn) {
430+
arScanEligible = result.ar_scan_eligible;
431+
}
432+
426433
gyms.push({
427434
id: result.id,
428435
lat: result.lat,
@@ -453,6 +460,7 @@ const getGyms = async (minLat, maxLat, minLon, maxLon, updated = 0, showRaids =
453460
sponsor_id: result.sponsor_id,
454461
raid_pokemon_evolution: result.raid_pokemon_evolution,
455462
raid_pokemon_costume: result.raid_pokemon_costume,
463+
ar_scan_eligible: arScanEligible,
456464
});
457465
}
458466
}
@@ -666,7 +674,7 @@ const getPokestops = async (minLat, maxLat, minLon, maxLon, updated = 0, showPok
666674
SELECT id, lat, lon, name, url, enabled, lure_expire_timestamp, last_modified_timestamp, updated,
667675
quest_type, quest_timestamp, quest_target, CAST(quest_conditions AS CHAR) AS quest_conditions,
668676
CAST(quest_rewards AS CHAR) AS quest_rewards, quest_template, cell_id, lure_id, pokestop_display,
669-
incident_expire_timestamp, grunt_type, sponsor_id
677+
incident_expire_timestamp, grunt_type, sponsor_id${arScanEligible}
670678
FROM pokestop
671679
WHERE lat >= ? AND lat <= ? AND lon >= ? AND lon <= ? AND updated > ? AND deleted = false AND
672680
(false ${excludeTypeSQL} ${excludePokemonSQL} ${excludeEvolutionSQL} ${excludeItemSQL} ${excludePokestopSQL} ${excludeInvasionSQL})
@@ -723,6 +731,11 @@ const getPokestops = async (minLat, maxLat, minLon, maxLon, updated = 0, showPok
723731
gruntType = null;
724732
}
725733

734+
let arScanEligible = null;
735+
if (config.db.scanner.arScanColumn) {
736+
arScanEligible = result.ar_scan_eligible;
737+
}
738+
726739
pokestops.push({
727740
id: result.id,
728741
lat: result.lat,
@@ -744,7 +757,8 @@ const getPokestops = async (minLat, maxLat, minLon, maxLon, updated = 0, showPok
744757
pokestop_display: pokestopDisplay,
745758
incident_expire_timestamp: incidentExpireTimestamp,
746759
grunt_type: gruntType,
747-
sponsor_id: result.sponsor_id
760+
sponsor_id: result.sponsor_id,
761+
ar_scan_eligible: arScanEligible,
748762
});
749763
}
750764
}

static/img/misc/ar.png

3.98 KB
Loading

static/js/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3180,6 +3180,10 @@ function getPokestopPopupContent (pokestop) {
31803180
});
31813181
}
31823182

3183+
if (pokestop.ar_scan_eligible) {
3184+
content += '<img src="/img/misc/ar.png" height="26" width="26"><br><br>'
3185+
}
3186+
31833187
const updatedDate = new Date(pokestop.updated * 1000);
31843188
if (updatedDate) {
31853189
content += '<div class="last-updated"><b>Last Updated:</b> ' + updatedDate.toLocaleDateString() + ' ' + updatedDate.toLocaleTimeString() + ' (' + getTimeSince(updatedDate) + ')</div>';
@@ -3417,6 +3421,11 @@ function getGymPopupContent (gym) {
34173421
content += `<b>Worst CP:</b> ${getCpAtLevel(gym.raid_pokemon_id, gym.raid_pokemon_form, 20, false)} / Weather: ${getCpAtLevel(gym.raid_pokemon_id, gym.raid_pokemon_form, 25, false)}<br><br>`;
34183422
}
34193423
}
3424+
3425+
if (gym.ar_scan_eligible) {
3426+
content += '<img src="/img/misc/ar.png" height="26" width="26"><br><br>';
3427+
}
3428+
34203429
content += '</div>';
34213430

34223431
const updatedDate = new Date(gym.updated * 1000);

0 commit comments

Comments
 (0)