Fixing Nits

This commit is contained in:
vita10gy 2013-02-23 17:27:54 -06:00
parent 9035e966f1
commit 335e84e7ce

View File

@ -24,7 +24,7 @@ window.plugin.portalWeakness.portalAdded = function(data) {
var d = data.portal.options.details; var d = data.portal.options.details;
var portal_weakness = 0; var portal_weakness = 0;
if(getTeam(d) != 0) { if(getTeam(d) !== 0) {
var only_shields = true; var only_shields = true;
var missing_shields = 0; var missing_shields = 0;
if(window.getTotalPortalEnergy(d)> 0 && window.getCurrentPortalEnergy(d) < window.getTotalPortalEnergy(d)) { if(window.getTotalPortalEnergy(d)> 0 && window.getCurrentPortalEnergy(d) < window.getTotalPortalEnergy(d)) {
@ -33,7 +33,7 @@ window.plugin.portalWeakness.portalAdded = function(data) {
} }
//Ding the portal for every missing sheild. //Ding the portal for every missing sheild.
$.each(d.portalV2.linkedModArray, function(ind, mod) { $.each(d.portalV2.linkedModArray, function(ind, mod) {
if(mod == null) { if(mod === null) {
missing_shields++; missing_shields++;
portal_weakness += .08; portal_weakness += .08;
} }
@ -41,36 +41,34 @@ window.plugin.portalWeakness.portalAdded = function(data) {
//Ding the portal for every missing resonator. //Ding the portal for every missing resonator.
var resCount = 0; var resCount = 0;
$.each(d.resonatorArray.resonators, function(ind, reso) { $.each(d.resonatorArray.resonators, function(ind, reso) {
if(reso == null) { if(reso === null) {
portal_weakness += .125; portal_weakness += .125;
only_shields = false; only_shields = false;
} } else {
else {
resCount++; resCount++;
} }
}); });
if(portal_weakness<0) { if(portal_weakness < 0) {
portal_weakness = 0; portal_weakness = 0;
} }
if(portal_weakness>1) if(portal_weakness > 1)
{ {
portal_weakness = 1; portal_weakness = 1;
} }
if(portal_weakness>0) { if(portal_weakness > 0) {
var fill_opacity = portal_weakness*.7 + .3; var fill_opacity = portal_weakness*.7 + .3;
var color = 'orange'; var color = 'orange';
if(only_shields) { if(only_shields) {
color = 'yellow'; color = 'yellow';
//If only shields are missing, make portal yellow, but fill more than usual since pale yellow is basically invisible //If only shields are missing, make portal yellow, but fill more than usual since pale yellow is basically invisible
fill_opacity = missing_shields*.15 + .1; fill_opacity = missing_shields*.15 + .1;
} } else if(missing_shields > 0) {
else if(missing_shields>0) {
color = 'red'; color = 'red';
} }
fill_opacity = Math.round(fill_opacity*100)/100; fill_opacity = Math.round(fill_opacity*100)/100;
var params = {fillColor: color, fillOpacity: fill_opacity}; var params = {fillColor: color, fillOpacity: fill_opacity};
if(resCount<8) if(resCount < 8)
{ {
// Hole per missing resonator // Hole per missing resonator
var dash = new Array(8-resCount + 1).join("1,4,") + "100,0" var dash = new Array(8-resCount + 1).join("1,4,") + "100,0"