Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/data/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const getPokemon = async (minLat, maxLat, minLon, maxLon, showPVP, showIV, updat
const sql = `
SELECT id, pokemon_id, lat, lon, spawn_id, expire_timestamp, atk_iv, def_iv, sta_iv, move_1, move_2,
gender, form, cp, level, weather, costume, weight, size, display_pokemon_id, pokestop_id, updated,
first_seen_timestamp, changed, cell_id, expire_timestamp_verified, shiny, username, pvp
first_seen_timestamp, changed, cell_id, expire_timestamp_verified, shiny, username
FROM pokemon
WHERE expire_timestamp >= UNIX_TIMESTAMP() AND lat >= ? AND lat <= ? AND lon >= ? AND lon <= ? AND updated > ?
${onlyVerifiedTimersSQL} ${areaRestrictionsSQL}`;
Expand Down Expand Up @@ -898,12 +898,32 @@ const getDevices = async (deviceFilterExclude = null) => {
excludeDeviceSQL = 'AND (last_seen >= UNIX_TIMESTAMP(NOW() - INTERVAL 15 MINUTE)) AND (last_seen < UNIX_TIMESTAMP(NOW() - INTERVAL 15 MINUTE))';
}

/*
const sql = `
SELECT uuid, instance_name, last_host, last_seen, account_username, last_lat, last_lon, type, data
FROM device
INNER JOIN instance
ON device.instance_name = instance.name ${excludeDeviceSQL}
`;
*/
const sql = `
SELECT
uuid,
instance_name,
last_host,
last_seen,
account_username,
last_lat,
last_lon,
instance.type,
geofence.data
FROM
device
INNER JOIN
instance ON device.instance_name = instance.name
INNER JOIN
geofence ON instance.geofences LIKE CONCAT('%', geofence.name, '%')
`;
const results = await dbSelection('device').query(sql);
let devices = [];
if (results && results.length > 0) {
Expand All @@ -918,7 +938,7 @@ const getDevices = async (deviceFilterExclude = null) => {
last_lat: result.last_lat,
last_lon: result.last_lon,
type: result.type,
data: result.data
data: result.data,
});
}
}
Expand Down
17 changes: 15 additions & 2 deletions static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4671,9 +4671,22 @@ function getDeviceMarker (device, ts) {
marker._popup.setContent(getDevicePopupContent(device));
const data = JSON.parse(device.data);
const route = data.area;
if (device.type === 'circle_pokemon') {
const circleTypes = [
'circle_pokemon',
'circle_smart_pokemon',
'circle_raid',
];
const geofenceTypes = [
'auto_quest',
'bootstrap',
'smart_raid',
'dynamic_pokemon',
'find_tth',
'pokemon_iv',
];
if (circleTypes.includes(device.type)) {
polyline = L.polyline(route, {color: devicePathColor}).addTo(map);
} else if (device.type == 'pokemon_iv' || 'auto_quest') {
} else if (geofenceTypes.includes(device.type)) {
polyline = L.polyline(route, {color: devicePathColor, fill: true, fillColor: devicePathColor}).addTo(map);
}
});
Expand Down