From fa39a97c0a081ce3d05d4f706ef06bd88f68bcab Mon Sep 17 00:00:00 2001 From: genBTC Date: Fri, 3 Nov 2023 22:19:50 -0400 Subject: [PATCH] Update fight-info.js clean code --- modules/fight-info.js | 84 +++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 52 deletions(-) diff --git a/modules/fight-info.js b/modules/fight-info.js index aed65e8b1..0c8b260a3 100644 --- a/modules/fight-info.js +++ b/modules/fight-info.js @@ -27,22 +27,22 @@ "Titimp", "Chronoimp" ]; - - // Fast imps + + // Fast imps M["fightinfo"].fast = [ "Snimp", - "Kittimp", - "Gorillimp", - "Squimp", - "Shrimp", - "Chickimp", - "Frimp", - "Slagimp", - "Lavimp", - "Kangarimp", - "Entimp", - "Carbimp", + "Kittimp", + "Gorillimp", + "Squimp", + "Shrimp", + "Chickimp", + "Frimp", + "Slagimp", + "Lavimp", + "Kangarimp", + "Entimp", + "Carbimp", ]; //Colors for special imps (This has been disabled) @@ -59,32 +59,24 @@ function Update() { // Check if we should update world or map info - if(game.global.mapsActive) + if (game.global.mapsActive) { - // Check if current map already infoed - // Can't do this because of map repeating - /*if(M["fightinfo"].lastProcessedMap === null || M["fightinfo"].lastProcessedMap !== game.global.lookingAtMap) - M["fightinfo"].lastProcessedMap = game.global.lookingAtMap; - else - return;*/ - - // Cell data + // (cant check if current MAP already infoed - because of maps repeating) + // Cell data - MAP GRID var cells = game.global.mapGridArray; - // DOM rows var $rows = Array.prototype.slice.call(M["fightinfo"].$mapGrid.children); } else { - // Check if current world already infoed - if(M["fightinfo"].lastProcessedWorld === null || M["fightinfo"].lastProcessedWorld !== game.global.world) + // Check if current WORLD already infoed + if (M["fightinfo"].lastProcessedWorld === null || M["fightinfo"].lastProcessedWorld !== game.global.world) M["fightinfo"].lastProcessedWorld = game.global.world; else return; - // Cell data + // Cell data - WORLD GRID var cells = game.global.gridArray; - // DOM rows var $rows = Array.prototype.slice.call(M["fightinfo"].$worldGrid.children); } @@ -102,81 +94,69 @@ }); // Process all cells - for(var i = 0; i < $cells.length; i++) + for (var i = 0; i < $cells.length; i++) { // DOM cell var $cell = $cells[i]; - // Cell data var cell = cells[i]; - if(cell.name.toLowerCase().indexOf('skele') > -1) // Skeletimp cell + if (cell.name.toLowerCase().indexOf('skele') > -1) // Skeletimp cell { if(cell.special.length === 0) $cell.innerHTML = " "; $cell.title = cell.name; - //$cell.style.color = M["fightinfo"].colors.bone; //(This changes the colour of the glyph - bad bc it overrides trimps and looks bad against corruption etc) $cell.style.textShadow = '0px 0px 10px #ffffff'; } - - else if(M["fightinfo"].exotics.indexOf(cell.name) > -1) // Exotic cell + else if (M["fightinfo"].exotics.indexOf(cell.name) > -1) // Exotic cell { if(cell.special.length === 0) $cell.innerHTML = " "; $cell.title = cell.name; - //$cell.style.color = M["fightinfo"].colors.exotic; //(This changes the colour of the glyph - bad bc it overrides trimps and looks bad against corruption etc) $cell.style.textShadow = '0px 0px 10px #fb753f'; } - - else if(M["fightinfo"].powerful.indexOf(cell.name) > -1) // Powerful imp + else if (M["fightinfo"].powerful.indexOf(cell.name) > -1) // Powerful imp { if(cell.special.length === 0) $cell.innerHTML = " "; $cell.title = cell.name; - //$cell.style.color = M["fightinfo"].colors.powerful; //(This changes the colour of the glyph - bad bc it overrides trimps and looks bad against corruption etc) $cell.style.textShadow = '0px 0px 10px #8c0000'; } - - else if(M["fightinfo"].fast.indexOf(cell.name) > -1) // Fast imp + else if (M["fightinfo"].fast.indexOf(cell.name) > -1) // Fast imp { - //if(cell.special.length === 0) - $cell.innerHTML = " "; + $cell.innerHTML = " "; $cell.title = cell.name; - //$cell.style.color = M["fightinfo"].colors.fast; //(This changes the colour of the glyph - bad bc it overrides trimps and looks bad against corruption etc) $cell.style.textShadow = '0px 0px 10px #ffffff'; } - //This shit doesn't work and I don't know why (What is the celltitle??? is it the name of the nature? Imps are labelled Toxic/Gusty/Frozen but that didin't work either) - if(cell.name.toLowerCase().indexOf('poison') > -1) // Poison Token cell + //?? Imps are labelled Toxic/Gusty/Frozen but that didin't work either ?? + if (cell.name.toLowerCase().indexOf('poison') > -1) // Poison Token cell { - if(cell.special.length === 0) + if (cell.special.length === 0) $cell.innerHTML = " "; $cell.title = cell.name; - //$cell.style.color = M["fightinfo"].colors.exotic; //(This changes the colour of the glyph - bad bc it overrides trimps and looks bad against corruption etc) $cell.style.textShadow = '0px 0px 10px #ffffff'; } - if(cell.name.toLowerCase().indexOf('wind') > -1) // Wind Token cell + if (cell.name.toLowerCase().indexOf('wind') > -1) // Wind Token cell { - if(cell.special.length === 0) + if (cell.special.length === 0) $cell.innerHTML = " "; $cell.title = cell.name; - //$cell.style.color = M["fightinfo"].colors.exotic; //(This changes the colour of the glyph - bad bc it overrides trimps and looks bad against corruption etc) $cell.style.textShadow = '0px 0px 10px #ffffff'; } - if(cell.name.toLowerCase().indexOf('ice') > -1) // Ice Token cell + if (cell.name.toLowerCase().indexOf('ice') > -1) // Ice Token cell { - if(cell.special.length === 0) + if (cell.special.length === 0) $cell.innerHTML = " "; $cell.title = cell.name; - //$cell.style.color = M["fightinfo"].colors.exotic; //(This changes the colour of the glyph - bad bc it overrides trimps and looks bad against corruption etc) $cell.style.textShadow = '0px 0px 10px #ffffff'; } }