AP for destroying portal

Calculate AP gained from destroyed resonators + link
TODO: fields :)
This commit is contained in:
Jakub Ludwig
2013-02-09 11:10:53 +01:00
parent d09e59049c
commit c9e2701890
3 changed files with 25 additions and 0 deletions

View File

@ -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>'

View File

@ -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';
}