Warehouse % Full Overview

Sparky

New Member
Reaction score
0
I know there's a script out there for this already, but it wasn't working and I wasn't a huge fan of it anyway. This calculates how full the warehouse is of each village on the production overview screen and adds a column showing the %. It also highlights each row based on how full it is. To use it, all you do is run it once on the production overview screen. I'm intending this to be private.

JavaScript:
javascript:$(document).ready(function(){
  var table = $("#production_table");
  var warehouseColIndex = table.find("thead tr th:contains('Warehouse')").index();
  table.find("thead tr").children().eq(warehouseColIndex).after("<th>% Full</th>");
 
  table.find("tbody tr").each(function(){
    var resources = $(this).find("td:eq(3) span.res, td:eq(3) span.warn");
    var maxResource = "";
    var maxAmount = 0;
    
    resources.each(function(){
      var amountStr = $(this).text().replace(/\./g,"");
      var amount = parseInt(amountStr);
      if(amount > maxAmount){
        maxAmount = amount;
        maxResource = $(this).attr("class").split(" ")[1];
      }
    });
    
    var warehouseStr = $(this).find("td:eq("+(warehouseColIndex)+")").text().replace(/\./g,"");
    var warehouse = parseInt(warehouseStr);
    var percentage = Math.round((maxAmount/warehouse)*100);
    $(this).children().eq(warehouseColIndex).after("<td>"+percentage+"% "+maxResource+"</td>");
    
    var color;
    if(percentage >= 90){
      color = "#ff5555"; // red
    }else if(percentage >= 70){
      color = "#ff8c00"; // orange
    }else if(percentage >= 50){
      color = "#ffd700"; // yellow
    }else{
      color = "#a8ff60"; // green
    }
    $(this).children().css("background-color", color);
  });
});
 

Deleted User - 419875

Guest
All questions regarding scripts are dealt with here : https://forum.tribalwars.us/forumdisplay.php?f=32
All approved scripts are to be found here .
https://forum.tribalwars.net/index.php?forums/scripts-independent-tools.61/

If the scripts that you are asking about are not on that list then they are probably not legal. Please check them to make sure they are still legal. and check to approve your scripts there also., once you gain approval screen shot the approval and send the screen shot to the ticket system so that we have proof that it was approved.
 
Top