fix indention/whitespace
This commit is contained in:
parent
baaf098977
commit
f9834d929b
@ -27,51 +27,51 @@ window.plugin.compAPStats.setupCallback = function() {
|
|||||||
|
|
||||||
// do an initial calc for sidebar sizing purposes
|
// do an initial calc for sidebar sizing purposes
|
||||||
window.plugin.compAPStats.onPositionMove();
|
window.plugin.compAPStats.onPositionMove();
|
||||||
|
|
||||||
// make the value update when the map data updates
|
// make the value update when the map data updates
|
||||||
var handleDataResponseOrig = window.handleDataResponse;
|
var handleDataResponseOrig = window.handleDataResponse;
|
||||||
window.handleDataResponse = function(data, textStatus, jqXHR) {
|
window.handleDataResponse = function(data, textStatus, jqXHR) {
|
||||||
handleDataResponseOrig(data, textStatus, jqXHR);
|
handleDataResponseOrig(data, textStatus, jqXHR);
|
||||||
window.plugin.compAPStats.onPositionMove();
|
window.plugin.compAPStats.onPositionMove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.plugin.compAPStats.onPositionMove = function() {
|
window.plugin.compAPStats.onPositionMove = function() {
|
||||||
var result = window.plugin.compAPStats.compAPStats();
|
var result = window.plugin.compAPStats.compAPStats();
|
||||||
$('#available_ap_display').html("Available AP in this area:<br/> Enlightened:\t" +
|
$('#available_ap_display').html("Available AP in this area:<br/> Enlightened:\t" +
|
||||||
digits(result[1]) + "<br/> Resistance:\t" + digits(result[0]));
|
digits(result[1]) + "<br/> Resistance:\t" + digits(result[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
window.plugin.compAPStats.compAPStats = function() {
|
window.plugin.compAPStats.compAPStats = function() {
|
||||||
|
|
||||||
var totalAP_RES = 0;
|
var totalAP_RES = 0;
|
||||||
var totalAP_ENL = 0;
|
var totalAP_ENL = 0;
|
||||||
|
|
||||||
var allResEdges = [];
|
var allResEdges = [];
|
||||||
var allResFields = [];
|
var allResFields = [];
|
||||||
var allEnlEdges = [];
|
var allEnlEdges = [];
|
||||||
var allEnlFields = [];
|
var allEnlFields = [];
|
||||||
|
|
||||||
var displayBounds = map.getBounds();
|
var displayBounds = map.getBounds();
|
||||||
|
|
||||||
// Grab every portal in the viewable area and compute individual AP stats
|
// Grab every portal in the viewable area and compute individual AP stats
|
||||||
$.each(window.portals, function(ind, portal) {
|
$.each(window.portals, function(ind, portal) {
|
||||||
var d = portal.options.details;
|
var d = portal.options.details;
|
||||||
|
|
||||||
// eliminate offscreen portals (selected, and in padding)
|
// eliminate offscreen portals (selected, and in padding)
|
||||||
if(!displayBounds.contains(portal.getLatLng())) return true;
|
if(!displayBounds.contains(portal.getLatLng())) return true;
|
||||||
|
|
||||||
var portalStats = getAttackApGain(d);
|
var portalStats = getAttackApGain(d);
|
||||||
var portalSum = portalStats.resoAp + portalStats.captureAp;
|
var portalSum = portalStats.resoAp + portalStats.captureAp;
|
||||||
|
|
||||||
if (getTeam(d) === TEAM_ENL) {
|
if (getTeam(d) === TEAM_ENL) {
|
||||||
totalAP_RES += portalSum;
|
totalAP_RES += portalSum;
|
||||||
|
|
||||||
$.each(d.portalV2.linkedEdges, function(ind, edge) {
|
$.each(d.portalV2.linkedEdges, function(ind, edge) {
|
||||||
if(!edge) return true;
|
if(!edge) return true;
|
||||||
allEnlEdges.push(edge.edgeGuid);
|
allEnlEdges.push(edge.edgeGuid);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each(d.portalV2.linkedFields, function(ind, field) {
|
$.each(d.portalV2.linkedFields, function(ind, field) {
|
||||||
if(!field) return true;
|
if(!field) return true;
|
||||||
allEnlFields.push(field);
|
allEnlFields.push(field);
|
||||||
@ -79,35 +79,35 @@ window.plugin.compAPStats.compAPStats = function() {
|
|||||||
}
|
}
|
||||||
else if (getTeam(d) === TEAM_RES) {
|
else if (getTeam(d) === TEAM_RES) {
|
||||||
totalAP_ENL += portalSum;
|
totalAP_ENL += portalSum;
|
||||||
|
|
||||||
$.each(d.portalV2.linkedEdges, function(ind, edge) {
|
$.each(d.portalV2.linkedEdges, function(ind, edge) {
|
||||||
if(!edge) return true;
|
if(!edge) return true;
|
||||||
allResEdges.push(edge.edgeGuid);
|
allResEdges.push(edge.edgeGuid);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each(d.portalV2.linkedFields, function(ind, field) {
|
$.each(d.portalV2.linkedFields, function(ind, field) {
|
||||||
if(!field) return true;
|
if(!field) return true;
|
||||||
allResFields.push(field);
|
allResFields.push(field);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// it's a neutral portal, potential for both teams. by definition no fields or edges
|
// it's a neutral portal, potential for both teams. by definition no fields or edges
|
||||||
totalAP_ENL += portalSum;
|
totalAP_ENL += portalSum;
|
||||||
totalAP_RES += portalSum;
|
totalAP_RES += portalSum;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Compute team field AP
|
// Compute team field AP
|
||||||
allResFields = uniqueArray(allResFields);
|
allResFields = uniqueArray(allResFields);
|
||||||
totalAP_ENL += (allResFields.length * DESTROY_FIELD);
|
totalAP_ENL += (allResFields.length * DESTROY_FIELD);
|
||||||
allEnlFields = uniqueArray(allEnlFields);
|
allEnlFields = uniqueArray(allEnlFields);
|
||||||
totalAP_RES += (allEnlFields.length * DESTROY_FIELD);
|
totalAP_RES += (allEnlFields.length * DESTROY_FIELD);
|
||||||
|
|
||||||
// Compute team Link AP
|
// Compute team Link AP
|
||||||
allResEdges = uniqueArray(allResEdges);
|
allResEdges = uniqueArray(allResEdges);
|
||||||
totalAP_ENL += (allResEdges.length * DESTROY_LINK);
|
totalAP_ENL += (allResEdges.length * DESTROY_LINK);
|
||||||
allEnlEdges = uniqueArray(allEnlEdges);
|
allEnlEdges = uniqueArray(allEnlEdges);
|
||||||
totalAP_RES += (allEnlEdges.length * DESTROY_LINK);
|
totalAP_RES += (allEnlEdges.length * DESTROY_LINK);
|
||||||
|
|
||||||
return [totalAP_RES, totalAP_ENL];
|
return [totalAP_RES, totalAP_ENL];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user