Skip to content
Open

Pr549 #564

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
199 changes: 107 additions & 92 deletions static/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -3348,79 +3348,80 @@ function loadRawData() {
prevMinLevel = null
}

var data = {
'timestamp': timestamp,
'pokemon': loadPokemon,
'loadOverviewStats': loadOverviewStats,
'loadPokemonStats': loadPokemonStats,
'loadRewardStats': loadRewardStats,
'loadShinyStats': loadShinyStats,
'lastpokemon': lastpokemon,
'pokestops': loadPokestops,
'lures': loadLures,
'rocket': loadRocket,
'quests': loadQuests,
'dustamount': loadDustamount,
'reloaddustamount': reloaddustamount,
'nestavg': loadNestAvg,
'nests': loadNests,
'lastnests': lastnests,
'communities': loadCommunities,
'lastcommunities': lastcommunities,
'portals': loadPortals,
'pois': loadPois,
'lastpois': lastpois,
'newportals': loadNewPortalsOnly,
'lastportals': lastportals,
'lastpokestops': lastpokestops,
'gyms': loadGyms,
'raids': loadRaids,
'lastgyms': lastgyms,
'exEligible': exEligible,
'lastslocs': lastslocs,
'spawnpoints': loadSpawnpoints,
'lastspawns': lastspawns,
'scanlocations': loadScanLocation,
'minIV': loadMinIV,
'prevMinIV': prevMinIV,
'minLevel': loadMinLevel,
'prevMinLevel': prevMinLevel,
'bigKarp': bigKarp,
'tinyRat': tinyRat,
'despawnTimeType': despawnTimeType,
'pokemonGender': pokemonGender,
'swLat': swLat,
'swLng': swLng,
'neLat': neLat,
'neLng': neLng,
'oSwLat': oSwLat,
'oSwLng': oSwLng,
'oNeLat': oNeLat,
'oNeLng': oNeLng,
'reids': String(reincludedPokemon),
'eids': String(excludedPokemon),
'exMinIV': String(excludedMinIV),
'qpreids': String(reincludedQuestsPokemon),
'qpeids': String(questsExcludedPokemon),
'qireids': String(reincludedQuestsItem),
'qieids': String(questsExcludedItem),
'qereids': String(reincludedQuestsEnergy),
'qeeids': String(questsExcludedEnergy),
'qcreids': String(reincludedQuestsCandy),
'qceids': String(questsExcludedCandy),
'geids': String(excludedGrunts),
'greids': String(reincludedGrunts),
'rbeids': String(excludedRaidboss),
'rbreids': String(reincludedRaidboss),
'reeids': String(excludedRaidegg),
'rereids': String(reincludedRaidegg),
'token': token,
'encId': encounterId
}
return $.ajax({
url: 'raw_data',
type: 'POST',
timeout: 300000,
data: {
'timestamp': timestamp,
'pokemon': loadPokemon,
'loadOverviewStats': loadOverviewStats,
'loadPokemonStats': loadPokemonStats,
'loadRewardStats': loadRewardStats,
'loadShinyStats': loadShinyStats,
'lastpokemon': lastpokemon,
'pokestops': loadPokestops,
'lures': loadLures,
'rocket': loadRocket,
'quests': loadQuests,
'dustamount': loadDustamount,
'reloaddustamount': reloaddustamount,
'nestavg': loadNestAvg,
'nests': loadNests,
'lastnests': lastnests,
'communities': loadCommunities,
'lastcommunities': lastcommunities,
'portals': loadPortals,
'pois': loadPois,
'lastpois': lastpois,
'newportals': loadNewPortalsOnly,
'lastportals': lastportals,
'lastpokestops': lastpokestops,
'gyms': loadGyms,
'raids': loadRaids,
'lastgyms': lastgyms,
'exEligible': exEligible,
'lastslocs': lastslocs,
'spawnpoints': loadSpawnpoints,
'lastspawns': lastspawns,
'scanlocations': loadScanLocation,
'minIV': loadMinIV,
'prevMinIV': prevMinIV,
'minLevel': loadMinLevel,
'prevMinLevel': prevMinLevel,
'bigKarp': bigKarp,
'tinyRat': tinyRat,
'despawnTimeType': despawnTimeType,
'pokemonGender': pokemonGender,
'swLat': swLat,
'swLng': swLng,
'neLat': neLat,
'neLng': neLng,
'oSwLat': oSwLat,
'oSwLng': oSwLng,
'oNeLat': oNeLat,
'oNeLng': oNeLng,
'reids': String(reincludedPokemon),
'eids': String(excludedPokemon),
'exMinIV': String(excludedMinIV),
'qpreids': String(reincludedQuestsPokemon),
'qpeids': String(questsExcludedPokemon),
'qireids': String(reincludedQuestsItem),
'qieids': String(questsExcludedItem),
'qereids': String(reincludedQuestsEnergy),
'qeeids': String(questsExcludedEnergy),
'qcreids': String(reincludedQuestsCandy),
'qceids': String(questsExcludedCandy),
'geids': String(excludedGrunts),
'greids': String(reincludedGrunts),
'rbeids': String(excludedRaidboss),
'rbreids': String(reincludedRaidboss),
'reeids': String(excludedRaidegg),
'rereids': String(reincludedRaidegg),
'token': token,
'encId': encounterId
},
data: data,
dataType: 'json',
cache: false,
beforeSend: function beforeSend() {
Expand Down Expand Up @@ -3463,7 +3464,40 @@ function loadRawData() {
complete: function complete() {
rawDataIsLoading = false
}
})
}).done(function(result){
oSwLat = result.oSwLat
oSwLng = result.oSwLng
oNeLat = result.oNeLat
oNeLng = result.oNeLng

if (!data.lastgyms){
lastgyms = result.lastgyms
}
if (!data.lastpokestops){
lastpokestops = result.lastpokestops
}
if (!data.lastpokemon){
lastpokemon = result.lastpokemon
}
if (!data.lastslocs) {
lastslocs = result.lastslocs
}
if (!data.lastspawns) {
lastspawns = result.lastspawns
}
if (!data.lastnests){
lastnests = result.lastnests
}
if (!data.lastcommunities) {
lastcommunities = result.lastcommunities
}
if (!data.lastportals){
lastportals = result.lastportals
}
if (!data.lastpois) {
lastpois = result.lastpois
}
})
}
function loadWeather() {
return $.ajax({
Expand Down Expand Up @@ -4151,8 +4185,8 @@ function submitNewNest(event) { // eslint-disable-line no-unused-vars
var pokemonId = cont.find('.pokemonID').val()
var lat = $('#submitModal .submitLatitude').val()
var lon = $('#submitModal .submitLongitude').val()
if (lat && lat !== '' && lon && lon !== '') {
if (confirm(i8ln('I confirm this is an new nest'))) {
if (pokemonId && lat && lat !== '' && lon && lon !== '') {
if (confirm(i8ln('I confirm this is a new nest'))) {
return $.ajax({
url: 'submit',
type: 'POST',
Expand All @@ -4173,8 +4207,6 @@ function submitNewNest(event) { // eslint-disable-line no-unused-vars
sendToast('success', i8ln('Submitting nest'), pokeList[pokemonId - 1].name + ' ' + i8ln('nest successful submitted'), 'true')
lastnests = false
updateMap()
jQuery('label[for="nests-switch"]').click()
jQuery('label[for="nests-switch"]').click()
$('.modal').modal('hide')
}
})
Expand All @@ -4187,7 +4219,7 @@ function manualNestData(event) { // eslint-disable-line no-unused-vars
var nestId = form.find('[name="editnestid"]').val()
var pokemonId = form.find('.pokemonID').val()
if (nestId && nestId !== '' && pokemonId && pokemonId !== '') {
if (confirm(i8ln('I confirm this is an accurate sighting of a quest'))) {
if (confirm(i8ln('I confirm the edit to this nest is accurate'))) {
return $.ajax({
url: 'submit',
type: 'POST',
Expand All @@ -4207,8 +4239,6 @@ function manualNestData(event) { // eslint-disable-line no-unused-vars
sendToast('success', i8ln('Submitting nest'), i8ln('Nest changed to ') + pokeList[pokemonId - 1].name, 'true')
lastnests = false
updateMap()
jQuery('label[for="nests-switch"]').click()
jQuery('label[for="nests-switch"]').click()
$('.modal').modal('hide')
}
})
Expand Down Expand Up @@ -5427,21 +5457,6 @@ function updateMap() {
}
}

oSwLat = result.oSwLat
oSwLng = result.oSwLng
oNeLat = result.oNeLat
oNeLng = result.oNeLng

lastgyms = result.lastgyms
lastpokestops = result.lastpokestops
lastpokemon = result.lastpokemon
lastslocs = result.lastslocs
lastspawns = result.lastspawns
lastnests = result.lastnests
lastcommunities = result.lastcommunities
lastportals = result.lastportals
lastpois = result.lastpois

prevMinIV = result.preMinIV
prevMinLevel = result.preMinLevel
reids = result.reids
Expand Down