Display current energy for whole portal

This commit is contained in:
Pavol Babincak
2013-02-09 17:30:32 +01:00
parent c9045aa988
commit 904be9b5b1
4 changed files with 26 additions and 3 deletions

View File

@ -17,7 +17,21 @@ window.getPortalLevel = function(d) {
return hasReso ? Math.max(1, lvl/8) : 0;
}
window.getPortalEnergy = function(d) {
window.getTotalPortalEnergy = function(d) {
var nrg = 0;
$.each(d.resonatorArray.resonators, function(ind, reso) {
if(!reso) return true;
var level = parseInt(reso.level);
var max = RESO_NRG[level];
nrg += max;
});
return nrg;
}
// For backwards compatibility
window.getPortalEnergy = window.getTotalPortalEnergy;
window.getCurrentPortalEnergy = function(d) {
var nrg = 0;
$.each(d.resonatorArray.resonators, function(ind, reso) {
if(!reso) return true;