Verified:

TheMafia Game profile

Member
63

May 20th 2015, 4:36:15

========================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

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

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

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 4:
-The buildings page now has the same functionality as the research page in version 3.

========================Setup==========================
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 and copy the script from below into the new page.
-Enter your player number into the line that says "var self = "#69";" (my number is '#69') the pound sign is required.

Script (last update: June 25):

// ==UserScript==
// @name EarthEmpires
// @namespace http://your.homepage/
// @version 2.5
// @description enter something useful
// @author You
// @match *://*.earthempires.com/*
// @match *://earthempires.com/*
// @grant none
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
var self = "#75"; //<---------------------------------------------- Your Player number here eg. "#69"

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("forum") <= 0) {
var intv = setTimeout(function(){
var curPage = window.location.href;
window.location = curPage;
}, 60000);
}

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 = "";
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();
console.log(jQuery(this).closest("tr").children("td:nth-child(3)").find("input").val());
cashAmount = "$" + (Math.round(jQuery(this).closest("tr").children("td:nth-child(3)").find("input").val()) * Math.round(jQuery(this).html().replace(",", "").replace(",", "").replace("$", ""))).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).closest("tr").children("td:nth-child(7)").find("input").val();
});
});
}

if (currentPage.indexOf("scores") > 0 || currentPage.indexOf("ranks") > 0){
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;
console.log(selfRank);
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){
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());
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 + ")");
});
}
});
}



Let me know if you have installed it and what you think of it, or if you have any bugs

Edited By: TheMafia on Jul 23rd 2015, 17:18:08
Back To Thread
See Original Post
See Subsequent Edit