AP for destroying portal
Calculate AP gained from destroyed resonators + link TODO: fields :)
This commit is contained in:
@ -66,6 +66,7 @@ window.renderPortalDetails = function(guid) {
|
||||
+ '<div class="mods">'+getModDetails(d)+'</div>'
|
||||
+ '<div id="randdetails">'+randDetails+'</div>'
|
||||
+ '<div id="resodetails">'+getResonatorDetails(d)+'</div>'
|
||||
+ '<div id="destroydetails">'+getDestroyAP(d)+'</div>'
|
||||
+ '<div class="linkdetails">'
|
||||
+ '<aside><a href="'+perma+'">portal link</a></aside>'
|
||||
+ '<aside><a onclick="window.reportPortalIssue(\''+getReportIssueInfoText(d)+'\')">report issue</a></aside>'
|
||||
|
@ -131,3 +131,25 @@ window.renderResonatorDetails = function(slot, level, nrg, dist, nick) {
|
||||
var text = '<span class="meter-text '+cls+'">'+(nick||'')+'</span>';
|
||||
return (slot <= 3 ? text+meter : meter+text) + '<br/>';
|
||||
}
|
||||
|
||||
// calculate AP gain from destroying portal
|
||||
// so far it counts only resonators + links
|
||||
window.getDestroyAP = function(d) {
|
||||
console.log('rendering destroy AP');
|
||||
var res_count = 0;
|
||||
var links = 0;
|
||||
|
||||
$.each(d.resonatorArray.resonators, function(ind, reso)
|
||||
{
|
||||
res_count += 1;
|
||||
});
|
||||
|
||||
if(d.portalV2.linkedEdges) $.each(d.portalV2.linkedEdges, function(ind, link)
|
||||
{
|
||||
links++;
|
||||
});
|
||||
|
||||
var ap_count = (res_count * DESTROY_RESONATOR) + (links * DESTROY_LINK);
|
||||
|
||||
return 'Destroy ' + res_count + 'x res + ' + links + 'x link -> <strong style="color: #FFCE00">' + ap_count + '</strong>AP';
|
||||
}
|
||||
|
2
main.js
2
main.js
@ -128,6 +128,8 @@ var MIN_AP_FOR_LEVEL = [0, 10000, 30000, 70000, 150000, 300000, 600000, 1200000]
|
||||
var HACK_RANGE = 35; // in meters, max. distance from portal to be able to access it
|
||||
var OCTANTS = ['E', 'NE', 'N', 'NW', 'W', 'SW', 'S', 'SE'];
|
||||
var DEFAULT_PORTAL_IMG = 'http://commondatastorage.googleapis.com/ingress/img/default-portal-image.png';
|
||||
var DESTROY_RESONATOR = 75; //AP for destroying portal
|
||||
var DESTROY_LINK = 187; //AP fro destroying link
|
||||
|
||||
// OTHER MORE-OR-LESS CONSTANTS //////////////////////////////////////
|
||||
var NOMINATIM = 'http://nominatim.openstreetmap.org/search?format=json&limit=1&q=';
|
||||
|
Reference in New Issue
Block a user