fix portal level calc for low level portals

This commit is contained in:
Stefan Breunig
2013-02-05 14:24:49 +01:00
parent a2b6b77ba5
commit b0d5695b44

View File

@ -8,11 +8,13 @@
// that value. // that value.
window.getPortalLevel = function(d) { window.getPortalLevel = function(d) {
var lvl = 0; var lvl = 0;
var hasReso = false;
$.each(d.resonatorArray.resonators, function(ind, reso) { $.each(d.resonatorArray.resonators, function(ind, reso) {
if(!reso) return true; if(!reso) return true;
lvl += parseInt(reso.level); lvl += parseInt(reso.level);
hasReso = true;
}); });
return lvl/8; return hasReso ? Math.min(1, lvl/8) : 0;
} }
window.getPortalEnergy = function(d) { window.getPortalEnergy = function(d) {