May 20th 2015, 4:36:15
INSTALLATION STEPS AT BOTTOM OF THIS POST UNDER 'SETUP'
What it does ================================================
Score Board: http://tcpm.mrlazyinc.com/..._monkey_script_scores.PNG
Portal Leader Boards: http://tcpm.mrlazyinc.com/...monkey_script_leaders.PNG
Market (v2): http://tcpm.mrlazyinc.com/..._monkey_script_market.PNG
Research (v3): http://tcpm.mrlazyinc.com/...onkey_script_research.PNG
Browser Tab Title (v3): http://tcpm.mrlazyinc.com/..._script_browser_title.PNG
Buildings (v4): http://tcpm.mrlazyinc.com/...nkey_script_buildings.PNG
Building Percentage (v6.8): http://tcpm.mrlazyinc.com/...key_script_build_perc.PNG
Spy (v6): http://tcpm.mrlazyinc.com/...y_script_spy_military.PNG
NEW: -- Turns Left (v6.5): http://tcpm.mrlazyinc.com/...key_script_turns_left.PNG
NEW: -- Attacker defending news summary (7.5): LINK INC.
New:
This script will automate a lot of tedious tasks and do a lot of calculations for you on the fly.
Additionally to the above screen shots:
This script calculates networth per acre of the people around you in the scores page. It then displays this number to you and also highlights some players that might be of interest to you, for either attacking or defending from. Check out the screen shots below for details. Remember to put your player name into the script.
Player GOV type is moved next to the players name
Latest Changes ================================================
Version 7.8 (Oct 2022):
-Proud to say you no longer have to click on the 'defending' link to show the news summary, with some fun code this is now available on your main page immediately
-Colour coding has begun in the news summary, next up: total units exchanged for each player
Version 7.6 (Oct 2022):
-Added the number of attacks a player has done to news summary of land lost.
Version 7.5 (Oct 2022):
-New featured start: News summary. This will show you all the players who have attacked you and the amount of land they took total for this round.
Note: This will ONLY show when you are looking at news for your country, for best results click on "Defending" in the news links so that the script can see all attacks and not just for one day.
Version 7.1 (Sept 2022):
-Fixed turns lefts: no more decimals
Version 7.0 (Sept 2022):
-remake of the 'turns left' calculation on 'main menu' (now shows remaining turns correctly for the round)
Version 6.97 (Sept 2022):
-Fixed market tax calculation issue for Democracy (no market tax)
Version 6.95:
-Explore automatically adds '1' to field instead of default of '0'
Version 6.9:
-minor fix for building percentages (total count was off)
Version 6.8:
-New feature: in building page you will now see the percentage each building type occupies on your land.
--Total land is now displayed above the percentages column (see pic)
Version 6.5:
-"Turns Left" added to main page (picture above)
--based on the server you are playing on, the script will try to estimate how many turns you can expect in the future from this moment on.
!Version 6.1:
-fixed calculations to show:
--Defence Points
--Minimum Jets to send
Version 6:
-SPY Page:
--When you've spied on a country a new field should show up at the end of the 'Military Forces' called 'Min. Attack'
--This is a VERY simple calculation, troops /2 + turrets + tanks *4
--NOT PART OF THE CALCULATION: Gov type and weapon research
--------------------------------------------
Version 5.5 - Recent updates and Market click fix:
-When hovering in market, you will see total cost of the units you hovered over.
Now:
Clicking will populate the buy field with the amount you just hovered over ( so if you hovered over 200,000 turrets, the cost will show up, then when you click it 200,000 will get populated into the buy field)
-Minor updates to scores display
--net/acre that are nearly half of your net/acre will show up in red too
Version 4:
-The buildings page now has the same functionality as the research page in version 3.
Version 3 - Research and more:
-Research tools have been created
-Both market and scores pages refresh on a 1 minute basis now
-Some changes to how the title displays in the browser, now shows: R:[Rank] (if available) T:(Turns) M:$Money
-Minor bug fixes
Version 2 - Market Additions:
When you mouse over the yellow columns, for any product, that amount is multiplied by the market value and displayed to you in the input field on the right. (i have stretched the field to fit billion dollar figures)
This applies to:
-Buy goods
-Buy Tech
Setup / Installation ================================================
Required:
Browser (like chrome) with a javascript auto execute add on (like 'TamperMonkey', google it) or equvilent
add on needs to support including jQuery library
What you need to do:
Lets say you use tamperMonkey and chrome.
-Open the dashboard for tampermonkey
-start a new script
-copy the script from below into the new page.
Script (last update: Aug 26, 2015):
What it does ================================================
Score Board: http://tcpm.mrlazyinc.com/..._monkey_script_scores.PNG
Portal Leader Boards: http://tcpm.mrlazyinc.com/...monkey_script_leaders.PNG
Market (v2): http://tcpm.mrlazyinc.com/..._monkey_script_market.PNG
Research (v3): http://tcpm.mrlazyinc.com/...onkey_script_research.PNG
Browser Tab Title (v3): http://tcpm.mrlazyinc.com/..._script_browser_title.PNG
Buildings (v4): http://tcpm.mrlazyinc.com/...nkey_script_buildings.PNG
Building Percentage (v6.8): http://tcpm.mrlazyinc.com/...key_script_build_perc.PNG
Spy (v6): http://tcpm.mrlazyinc.com/...y_script_spy_military.PNG
NEW: -- Turns Left (v6.5): http://tcpm.mrlazyinc.com/...key_script_turns_left.PNG
NEW: -- Attacker defending news summary (7.5): LINK INC.
New:
This script will automate a lot of tedious tasks and do a lot of calculations for you on the fly.
Additionally to the above screen shots:
This script calculates networth per acre of the people around you in the scores page. It then displays this number to you and also highlights some players that might be of interest to you, for either attacking or defending from. Check out the screen shots below for details. Remember to put your player name into the script.
Player GOV type is moved next to the players name
Latest Changes ================================================
Version 7.8 (Oct 2022):
-Proud to say you no longer have to click on the 'defending' link to show the news summary, with some fun code this is now available on your main page immediately
-Colour coding has begun in the news summary, next up: total units exchanged for each player
Version 7.6 (Oct 2022):
-Added the number of attacks a player has done to news summary of land lost.
Version 7.5 (Oct 2022):
-New featured start: News summary. This will show you all the players who have attacked you and the amount of land they took total for this round.
Note: This will ONLY show when you are looking at news for your country, for best results click on "Defending" in the news links so that the script can see all attacks and not just for one day.
Version 7.1 (Sept 2022):
-Fixed turns lefts: no more decimals
Version 7.0 (Sept 2022):
-remake of the 'turns left' calculation on 'main menu' (now shows remaining turns correctly for the round)
Version 6.97 (Sept 2022):
-Fixed market tax calculation issue for Democracy (no market tax)
Version 6.95:
-Explore automatically adds '1' to field instead of default of '0'
Version 6.9:
-minor fix for building percentages (total count was off)
Version 6.8:
-New feature: in building page you will now see the percentage each building type occupies on your land.
--Total land is now displayed above the percentages column (see pic)
Version 6.5:
-"Turns Left" added to main page (picture above)
--based on the server you are playing on, the script will try to estimate how many turns you can expect in the future from this moment on.
!Version 6.1:
-fixed calculations to show:
--Defence Points
--Minimum Jets to send
Version 6:
-SPY Page:
--When you've spied on a country a new field should show up at the end of the 'Military Forces' called 'Min. Attack'
--This is a VERY simple calculation, troops /2 + turrets + tanks *4
--NOT PART OF THE CALCULATION: Gov type and weapon research
--------------------------------------------
Version 5.5 - Recent updates and Market click fix:
-When hovering in market, you will see total cost of the units you hovered over.
Now:
Clicking will populate the buy field with the amount you just hovered over ( so if you hovered over 200,000 turrets, the cost will show up, then when you click it 200,000 will get populated into the buy field)
-Minor updates to scores display
--net/acre that are nearly half of your net/acre will show up in red too
Version 4:
-The buildings page now has the same functionality as the research page in version 3.
Version 3 - Research and more:
-Research tools have been created
-Both market and scores pages refresh on a 1 minute basis now
-Some changes to how the title displays in the browser, now shows: R:[Rank] (if available) T:(Turns) M:$Money
-Minor bug fixes
Version 2 - Market Additions:
When you mouse over the yellow columns, for any product, that amount is multiplied by the market value and displayed to you in the input field on the right. (i have stretched the field to fit billion dollar figures)
This applies to:
-Buy goods
-Buy Tech
Setup / Installation ================================================
Required:
Browser (like chrome) with a javascript auto execute add on (like 'TamperMonkey', google it) or equvilent
add on needs to support including jQuery library
What you need to do:
Lets say you use tamperMonkey and chrome.
-Open the dashboard for tampermonkey
-start a new script
-copy the script from below into the new page.
Script (last update: Aug 26, 2015):
// ==UserScript==
// @name EarthEmpires - Assit Tools and Calculations
// @namespace http://www.mrlazyinc.com/
// @version 7.8
// @author TheMafia
// @match *://*.earthempires.com/*
// @match *://earthempires.com/*
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
var currentPage = window.location.href;
var turns = jQuery(".topbar td:contains('Turns:')").last().text().replace("Turns: ", "");
var money = jQuery(".topbar td:contains('Money:')").last().text().replace("Money: ", "");
document.title = "T:("+ turns + ")" + "M:"+ money;
if ((currentPage.indexOf("scores") > 0 || (currentPage.indexOf("market") > 0 && currentPage.indexOf("sell") < 1)) && currentPage.indexOf("forum") <= 0) {
var intv = setTimeout(function(){
var curPage = window.location.href;
window.location = curPage;
}, 60000);
}
if (currentPage.indexOf("explore") > 0){
//Add 1 to field
jQuery("input[name='turns']").val(1);
}
if (currentPage.indexOf("spy") > 0){
//Check if spied
if (jQuery("th:contains('Military Forces')").length > 0){
var parentBody = jQuery("th:contains('Military Forces')").parent().parent();
jQuery(parentBody).append("<tr><td>Defence Points</td><td class='rt' id='forceCalc'></td></tr>");
jQuery(parentBody).append("<tr><td>Min Jets Hit:</td><td class='rt' id='jetCalc'></td></tr>");
var troops = parseInt(jQuery(parentBody).find("tr").eq(2).find("td").eq(1).text().replace(",","").replace(",","")) ;
var turrets = parseInt(jQuery(parentBody).find("tr").eq(4).find("td").eq(1).text().replace(",","").replace(",",""));
var tanks = parseInt(jQuery(parentBody).find("tr").eq(5).find("td").eq(1).text().replace(",","").replace(",",""));
console.log("1: "+ troops + " -2:"+ turrets +" -3:"+ tanks);
var attackMin = (troops) + turrets*2 + (tanks *4);
var jetMin = attackMin / 2;
jQuery("#forceCalc").text(attackMin);
jQuery("#jetCalc").text(jetMin);
}
}
if (currentPage.indexOf("main") > 0){
//Check if spied
var serverType = jQuery("td:contains('Server')").next("td").text();
var timeLeft = jQuery("#maintable").next().next().text();
var turnsLeft = 0;
var timeInterval = 1;
switch(serverType){
case "Express":
timeInterval = 4;
break;
case "Tournament":
timeInterval = 25;
break;
case "Primary":
timeInterval = 30;
break;
case "Team":
timeInterval = 15;
break;
case "Alliance":
timeInterval = 20;
break;
case "Free For All":
timeInterval = 20;
break;
}
if (timeLeft.indexOf("hours") > 0){
timeLeft = timeLeft.replace("The round ends in ", "");
timeLeft = timeLeft.replace("hours.", "");
turnsLeft = (60 * parseFloat(timeLeft)) / timeInterval;
}else if (timeLeft.indexOf("days") > 0){
timeLeft = timeLeft.replace("The round ends in ", "");
timeLeft = timeLeft.replace("days.", "");
turnsLeft = (60 * 24 *parseFloat(timeLeft)) / timeInterval;
}
jQuery("#maintable").next().next().append("<br>Turns left: "+ Math.round(turnsLeft));
jQuery("body").append("<div id='newsSummary' style='position:fixed; top:20px; right: 20px; color:white'></div><div id='newsPull' display='none'></div>");
var tempHTML = jQuery.parseHTML("");
if(jQuery(".recentnewsitem").length == 0){
var defUrl = jQuery("#content a:contains('Defending')").attr("href");
console.log(defUrl);
var ajDefending = jQuery.ajax({
url:defUrl, async:true, cache:false, method: "GET"})
.always(function(){
}).done(function(data){
tempHTML = jQuery.parseHTML(data);
//console.log(jQuery(tempHTML).find(".recentnewsitem").html());
//jQuery("#newsPull").html(jQuery(tempHTML).find(".recentnewsitem").html());
var attackers = [];
var playerCount = 0;
jQuery(tempHTML).find(".recentnewscontent:contains('A brigade from')").each(function(){
console.log("tesT");
var sStart = jQuery(this).text().indexOf("A brigade from") + 15;
var sEnd = jQuery(this).text().indexOf(" has invaded your lands");
var attackerName = jQuery(this).text().slice(sStart, sEnd);
var regNum = /\(#(.+?)\)/g;
var attackerNum = jQuery(this).text().match(regNum)[0].replace("(#", "").replace(")", "");
var curIndex = -1;
for(var i = 0; i < attackers.length; i++){
if(attackers[i].attackerNum == attackerNum){
curIndex = i;
break;
}
}
var lostContainer = jQuery(this).find("div:contains('Acres')");
regNum = /.+? Acres/g;
var landLost = parseInt(lostContainer.text().match(regNum)[0].replace(" Acres", ""));
if(curIndex > -1){
attackers[curIndex].land = attackers[curIndex].land + landLost;
attackers[curIndex].attCnt = attackers[curIndex].attCnt + 1;
}else{
attackers[attackers.length] = {attackerName: attackerName, attackerNum: attackerNum, land: landLost, attCnt: 1};
}
});
for(var i = 0; i < attackers.length; i++){
var colour = "white";
if (attackers[i].attCnt > 1){
colour = "yellow";
}
jQuery("#newsSummary").append("<div class='attackerInfo' style='text-align:right; color:"+ colour +"'>"+ attackers[i].attackerName + " "+ attackers[i].attCnt +" times, took: "+ attackers[i].land +"</div>");
}
}).fail(function(){
});
}else{
var attackers = [];
var playerCount = 0;
jQuery(document).find(".recentnewscontent:contains('A brigade from')").each(function(){
console.log("tesT");
var sStart = jQuery(this).text().indexOf("A brigade from") + 15;
var sEnd = jQuery(this).text().indexOf(" has invaded your lands");
var attackerName = jQuery(this).text().slice(sStart, sEnd);
var regNum = /\(#(.+?)\)/g;
var attackerNum = jQuery(this).text().match(regNum)[0].replace("(#", "").replace(")", "");
var curIndex = -1;
for(var i = 0; i < attackers.length; i++){
if(attackers[i].attackerNum == attackerNum){
curIndex = i;
break;
}
}
var lostContainer = jQuery(this).find("div:contains('Acres')");
regNum = /.+? Acres/g;
var landLost = parseInt(lostContainer.text().match(regNum)[0].replace(" Acres", ""));
if(curIndex > -1){
attackers[curIndex].land = attackers[curIndex].land + landLost;
attackers[curIndex].attCnt = attackers[curIndex].attCnt + 1;
}else{
attackers[attackers.length] = {attackerName: attackerName, attackerNum: attackerNum, land: landLost, attCnt: 1};
}
});
for(var i = 0; i < attackers.length; i++){
var colour = "white";
if (attackers[i].attCnt > 1){
colour = "yellow";
}
jQuery("#newsSummary").append("<div class='attackerInfo' style='text-align:right; color:"+ colour +"'>"+ attackers[i].attackerName + " "+ attackers[i].attCnt +" times, took: "+ attackers[i].land +"</div>");
}
}
}
if (currentPage.indexOf("market") > 0){
//Init settings
jQuery("table.contenttable tr").children("td:nth-child(7)").find("input").css({"width":"95px"});
jQuery("table.contenttable tr").children("td:nth-child(1)").each(function(){
jQuery(this).html(jQuery(this).html().replace("Military", "Mil."));
});
//jQuery(this).closest("tr").children("td:nth-child(7)").find("input").css({"width":"90px"});
var tempNum = 0;
var tempVal = 0;
var cashAmount = "";
var taxAdditive = 0;
if (jQuery(".mTax").length > 0){
taxAdditive = (jQuery(".mTax").html().replace("%", "").toLocaleString() / 100);
}else{
taxAdditive = 0;
}
var tax = 1 + taxAdditive;
jQuery("table.contenttable tr").has("td.lt").each(function(){
jQuery(this).find("td:nth-child(5), td:nth-child(6), td:nth-child(2)").hover(
function(){
tempNum = jQuery(this).html();
tempVal = jQuery(this).closest("tr").children("td:nth-child(7)").find("input").val();
cashAmount = "$" + Math.ceil((Math.round(jQuery(this).closest("tr").children("td:nth-child(3)").find("input").val()) * Math.round(jQuery(this).html().replace(",", "").replace(",", "").replace("$", "")) * tax)).toLocaleString();
//jQuery(this).html(cashAmount);
jQuery(this).closest("tr").children("td:nth-child(7)").find("input").val(cashAmount);
}, function(){
//jQuery(this).html(tempNum);
jQuery(this).closest("tr").children("td:nth-child(7)").find("input").val(tempVal);
}
).click(function(){
tempVal = jQuery(this).html(); //jQuery(this).closest("tr").children("td:nth-child(7)").find("input").val();
});
});
}
if (currentPage.indexOf("scores") > 0 || currentPage.indexOf("ranks") > 0 || currentPage.indexOf("clans") > 0){
var self = jQuery("td.c-own").html().split("(")[1].replace(")","");
var land = 0;
var networth = 0;
var perAcre = 0;
var rank = 0;
var selfPer = 0;
var selfLand = 0;
var selfNet = 0;
var selfRank = 0;
jQuery("p:contains('server.')").append(" <a target='_blank' href='http://www.eestats.com/';;;;;;;>EeStats</a>");
jQuery(".lt").each(function(){
if(jQuery(this).html().indexOf(self) > 1){
jQuery(this).css({"color":jQuery(this).find("td:nth-child(2)").css("color")});
selfRank = Math.round(jQuery(this).find("td:first").html());
document.title = "R:["+ selfRank +"]" + document.title;
jQuery(this).find(".rt").each(function(){
if (land === 0){
land = Math.round(jQuery(this).html().replace(",", "").replace(",", ""));
}else{
networth = Math.round(jQuery(this).html().replace(",", "").replace(",", "").replace("$", ""));
}
});
selfPer = Math.round(networth / land);
selfLand = Math.round(land);
selfNet = Math.round(networth);
}
});
jQuery(".lt").each(function(){
land = 0;
networth = 0;
perAcre = 0;
rank = 0;
jQuery(this).find("td:nth-child(2)").append(" ["+ jQuery(this).find(".ct").html() +"]");
rank = Math.round(jQuery(this).find("td:first").html());
jQuery(this).find(".rt").each(function(){
if (land === 0){
land = Math.round(jQuery(this).html().replace(",", "").replace(",", ""));
}else{
networth = Math.round(jQuery(this).html().replace(",", "").replace(",", "").replace("$", ""));
}
});
perAcre = Math.round(networth / land);
jQuery(this).find(".ct").html(perAcre);
if ((networth / 2) <= selfNet && (selfNet / 2) <= networth){
jQuery(this).find(".rt:eq(1)").css({"color":"yellow"});
//console.log(jQuery(this).find(".rt:eq(1)").html());
}
if (selfPer > (perAcre * 1.5)){
jQuery(this).find(".ct").css({"color":"red"});
}else if (selfPer > perAcre){
jQuery(this).find(".ct").css({"color":"yellow"});
}
if (((selfLand > land) && (selfRank > rank)) || ((selfLand < land) && (selfRank < rank))){
jQuery(this).find(".rt:first").css({"color":"red"});
}
});
}
if (currentPage.indexOf("research") > 0){
var tpt = Math.round(jQuery(".TPT").html().replace(/,/g, ''));
var curVal = 0.0;
var newVal = 0.0;
var tCount = 0;
jQuery(".turntable tr:nth-child(13)").find("td").append("<div id='tSpent' style='display:inline'></div>");
jQuery(".turntable tr.ct").each(function(){
if (jQuery(this).find("td input[value='Research Technology']").length == 0){
jQuery(this).find("td:nth-child(1)").click(function(evt){
curVal = Math.round(jQuery(this).closest("tr").find("input:text").val());
if(evt.ctrlKey){
mult = 5;
}else if(evt.altKey){
mult = 0.5;
}else{
mult = 1;
}
newVal = Math.floor(curVal + (tpt * mult));
tCount = tCount + mult;
jQuery(this).closest("tr").find("input:text").val(newVal);
jQuery("#tSpent").html(" ("+ tCount + ")");
});
}
});
}
if (currentPage.indexOf("build") > 0){
var bpt = Math.round(jQuery(".BPT").html());
var curVal = 0.0;
var newVal = 0.0;
var tCount = 0;
jQuery(".contenttable tr:nth-child(11)").find("td").append("<div id='tSpent' style='display:inline'></div>");
jQuery(".contenttable tr.rt").each(function(){
if (jQuery(this).find("td input[value='Construct Buildings']").length == 0){
jQuery(this).find("td:nth-child(1)").click(function(evt){
curVal = Math.round(jQuery(this).closest("tr").find("input:text").val());
if(evt.ctrlKey){
mult = 5;
}else if(evt.altKey){
mult = 0.5;
}else{
mult = 1;
}
newVal = Math.floor(curVal + (bpt * mult));
tCount = tCount + mult;
jQuery(this).closest("tr").find("input:text").val(newVal);
jQuery("#tSpent").html(" ("+ tCount + ")");
});
}
});
var totLand = 0;
jQuery(jQuery(".contenttable td.lt").next("td")).each(function(){
totLand += parseInt(jQuery(this).text());
});
totLand += parseInt(jQuery(".contenttable td:contains('Unused Land Area')").next("td").text().replace(" Acres","").replace(",","").replace(",",""));
jQuery(".contenttable").find("tr").each(function(i){
if (jQuery(this).find("th").length < 1){
jQuery(this).append("<td class='b"+ i +"'></td>");
}else{
jQuery(this).append("<th>"+ totLand +"</th>");
}
});
jQuery(jQuery(".contenttable td.lt, .contenttable td:contains('Unused Land Area')").next("td")).each(function(i){
if(parseInt(jQuery(this).text().replace(" Acres","").replace(",","").replace(",","")) > 0){
percB = (parseInt(jQuery(this).text().replace(" Acres","").replace(",","").replace(",","")) / totLand) * 100;
percB = percB.toFixed(2);
jQue