mirror of
https://github.com/maierfelix/POGOserver.git
synced 2026-04-19 16:07:22 -05:00
Update
- Refresh markers - Remove forts
This commit is contained in:
parent
d5f69faed0
commit
fa2faa8099
47
main.js
47
main.js
|
|
@ -24,11 +24,24 @@
|
|||
let description = prompt("Enter fort description: ");
|
||||
send({
|
||||
action: "addFortToPosition",
|
||||
lat: lat,
|
||||
lng: lng,
|
||||
latitude: lat,
|
||||
longitude: lng,
|
||||
zoom: map.zoom,
|
||||
name: name,
|
||||
desc: description
|
||||
description: description
|
||||
}, function(res) {
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
|
||||
function removeFort(fort) {
|
||||
console.log(fort);
|
||||
let sure = prompt("Do you really want to remove this fort?");
|
||||
if (sure === null) return void 0;
|
||||
send({
|
||||
action: "deleteFortById",
|
||||
cell_id: fort.cellId,
|
||||
cell_uid: fort.uid
|
||||
}, function(res) {
|
||||
console.log(res);
|
||||
});
|
||||
|
|
@ -99,6 +112,7 @@
|
|||
server_ping.style.display = "block";
|
||||
fort_manager.style.opacity = 1;
|
||||
initHeartBeat();
|
||||
refreshMapForts();
|
||||
refreshConnectedPlayers();
|
||||
getServerVersion();
|
||||
}
|
||||
|
|
@ -119,6 +133,32 @@
|
|||
});
|
||||
}
|
||||
|
||||
function refreshMapForts() {
|
||||
let center = map.getCenter();
|
||||
let lat = center.lat();
|
||||
let lng = center.lng();
|
||||
send({
|
||||
action: "getFortsByPosition",
|
||||
lat: lat,
|
||||
lng: lng
|
||||
}, function(res) {
|
||||
map.removeMarkers();
|
||||
let ii = 0;
|
||||
let length = res.forts.length;
|
||||
for (; ii < length; ++ii) {
|
||||
let fort = res.forts[ii];
|
||||
map.addMarker({
|
||||
lat: fort.latitude,
|
||||
lng: fort.longitude,
|
||||
title: fort.name,
|
||||
dblclick: function() {
|
||||
removeFort(this);
|
||||
}.bind(fort)
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function initHeartBeat() {
|
||||
clearInterval(heartInterval);
|
||||
heartInterval = setInterval(function() {
|
||||
|
|
@ -142,6 +182,7 @@
|
|||
var ping = res.timestamp - now;
|
||||
server_ping.innerHTML = "Ping: " + ping + "ms";
|
||||
refreshConnectedPlayers();
|
||||
refreshMapForts();
|
||||
}
|
||||
});
|
||||
}, 3e3);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user