Skip to content

Commit

Permalink
Update fight-info.js clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
genbtc committed Nov 4, 2023
1 parent 50c12b2 commit fa39a97
Showing 1 changed file with 32 additions and 52 deletions.
84 changes: 32 additions & 52 deletions modules/fight-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
Expand All @@ -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 = "<span class=\"glyphicon glyphicon-italic\"></span> ";

$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 = "<span class=\"glyphicon glyphicon-sunglasses\"></span> ";

$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 = "<span class=\"glyphicon glyphicon-hazard\"></span> ";

$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 = "<span class=\"glyphicon glyphicon-forward\"></span> ";
$cell.innerHTML = "<span class=\"glyphicon glyphicon-forward\"></span> ";

$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 = "<span class=\"glyphicon glyphicon-flask\"></span> ";

$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 = "<span class=\"icomoon icon-air\"></span> ";

$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 = "<span class=\"glyphicon glyphicon-certificate\"></span> ";

$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';
}
}
Expand Down

0 comments on commit fa39a97

Please sign in to comment.