Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- A GAME Mod by Hitler
- javascript:var s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='//pastebin.com/raw.php?i=HALDOL';void(0);
- */
- 'use strict';
- function Mod(){
- jQuery.fn.outerHTML = function(s) { return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); };
- // DISPLAY STUFF
- document.getElementById("employment").style['margin-top'] = "0px";
- document.getElementsByName("items_holder")[0].style['margin-bottom'] = "0px";
- document.getElementById("lawmaker_upgrade_box").style.display = "none";
- $('div[id="upgrades_container"]').hide(); //////--------- remove at prestiging
- $('td[colspan="4"]').hide();
- var css = document.createElement("style");
- css.type = "text/css";
- css.innerHTML = "span[name=attackedSpan] { pointer-events: none; }";
- document.body.appendChild(css);
- // VARS
- this.mg = 5000*Math.pow(10,15);
- this.moneyGoal = this.mg;
- this.money = 0;
- this.scMoney = 0;
- this.oldROPM = 0;
- this.eff = 1;
- this.workerID = 88;
- this.c = 1000;
- this.mGained = 0;
- this.orePrice = [50,3,7,30,120,240,2250,3250,7000]
- this.GBstate = 7; // 0 = GBwait 1 = GBopen 2=GBlobby 3 = 3=GBrunning
- this.RBstate = 0; // 2 = RBcd 1 = RBwait 0 = RBgo 3 = lolwas
- this.activeCL = false;
- this.getProds = false;
- this.allsteves = false;
- this.cWorker = true;
- this.buystr = "";
- this.wstr = "";
- this.refreshstr = "";
- this.raidTarget = "";
- this.workstr = "";
- this.buildstr = "";
- // FETCHED INFO
- this.oreTable = $('td[name="oresMined"]>span[class="ore"]');
- this.chicks = $('tr[name="chickenfarmer"]').length;
- this.w = (5 + this.chicks);
- this.pickMoney = 324 * parseInt($('span[id="pickaxe_var_max"]').text());
- if($('span[id="pickaxe_var_name"]').text().indexOf('nti')){
- this.prestige = (parseInt($('span[id="pickaxe_var_max"]').text())/30900)*20-20;
- } else if($('span[id="pickaxe_var_name"]').text().indexOf('inal')){
- this.prestige = (parseInt($('span[id="pickaxe_var_max"]').text())/20900)*20-20;
- } else {
- this.prestige = (parseInt($('span[id="pickaxe_var_max"]').text())/10900)*20-20;
- }
- this.limits= [1000,900,800,700,600];
- this.price= [1500*(1+0.1*this.prestige),7500*(1+0.1*this.prestige),25000*(1+0.1*this.prestige),100000*(1+0.1*this.prestige),2500000*(1+0.1*this.prestige),7500000*(1+0.1*this.prestige)];
- this.oreLimit = [[0,2],[3,8],[9,14],[15,21],[22,29],[30,38]];
- this.prods= [106*(1+this.prestige/20),340*(1+this.prestige/20),1105*(1+this.prestige/20),8984*(1+this.prestige/20),23991*(1+this.prestige/20),35377*(1+this.prestige/20)];
- if(this.chicks){
- this.limits.push(600);
- this.price.push(7500000000*(1+0.1*this.prestige));
- this.oreLimit.push([39,47]);
- this.prods.push(106389*(1+this.prestige/20));
- }
- this.oreLimit.push([39+9*this.chicks,47+9*this.chicks],[48+9*this.chicks,56+9*this.chicks]);
- this.prods.push(35377*(1+this.prestige/20),38665*(1+this.prestige/20));
- // TIMERS
- this.timers = {
- update: false,
- lastUpdate: +new Date,
- oneSecondUpdate: 0,
- startTimer: +new Date,
- lobby: 0,
- };
- // Updater
- this.timers.update = setInterval(function(){ this.update(); }.bind(this), 100);
- // Elements
- this.elements = {
- aboutBox: $('<div style="float:left;width:250px"><h4><div style="display:inline-block;margin-left:3px;vertical-align:top;"></div><div id="mod"></div></h4></div>'),
- };
- $('<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js">').appendTo('body')
- $('#gamecontainer').prepend(this.elements.aboutBox);
- }
- Mod.prototype.checkProd = function(){
- this.getProds = true;
- this.oreTable = $('td[name="oresMined"]>span[class="ore"]');
- this.update();
- }
- Mod.prototype.update = function(){
- if("undefined" === typeof _) return;
- if(this.getProds){
- var tempTable = $('td[name="oresMined"]>span[class="ore"]');
- if((tempTable[0].innerHTML!=this.oreTable[0].innerHTML)&&(tempTable[65].innerHTML!=this.oreTable[65].innerHTML)){
- this.getProds = false;
- this.calcProds(tempTable,this.oreTable);
- }
- }
- var delta = (+new Date - this.timers.lastUpdate);
- this.timers.oneSecondUpdate += delta;
- if(this.timers.oneSecondUpdate > 1000){
- this.timers.oneSecondUpdate = 0;
- //var timeInfo = $('span[name="time"]').text().split(" ");
- //if((timeInfo[1].indexOf('minute')>-1) && (parseInt(timeInfo[0])>=3) && ((+new Date-this.timers.startTimer)>90000)){
- // this.refreshstr = "RR";
- //}
- this.updateStats();
- this.calcWorkers();
- }
- this.updateTitle();
- this.timers.lastUpdate = +new Date;
- }
- Mod.prototype.calcProds = function(t2,t1){
- var tempProds = [];
- tempProds.length = this.oreLimit.length;
- for(var i = 0; i<tempProds.length; i++){
- var tempWorkerProd = 0;
- for(var ore = this.oreLimit[i][1]; ore >= this.oreLimit[i][0]; ore--){
- var oret2 = parseInt(t2[ore].innerHTML.slice(t2[ore].innerHTML.indexOf('x')+1,1337).replace(/,/g,""));
- var oret1 = parseInt(t1[ore].innerHTML.slice(t1[ore].innerHTML.indexOf('x')+1,1337).replace(/,/g,""));
- tempWorkerProd += this.orePrice[this.oreLimit[i][1]-ore]*(oret2-oret1);
- }
- tempProds[i] = tempWorkerProd/parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0]);
- }
- this.prods = tempProds;
- }
- Mod.prototype.calcWorkers = function(){
- this.workstr = '';
- var mgoal = 0;
- var actualWorkers = new Array(0,0,0,0,0,0,0,0,0);
- var worker = 8;
- var prod = this.pickMoney-75000000/Math.ceil(this.eff);
- for(var i = 0; i<9; i++){
- actualWorkers[i]=parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0]);
- prod += actualWorkers[i]*this.prods[i];
- }
- if(this.moneyGoal>0){
- mgoal = this.moneyGoal;
- } else if(parseInt($('span[name="scientistTime"]').text())==10){
- mgoal = (5.9*Math.pow(10,12)-parseInt($('span[name="owned"]')[8].innerHTML.replace(/,/g,"")))*300 + Math.pow(10,15);
- } else {
- for(var i = this.w; i>=0; i--){
- if(parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0])<this.limits[i]){
- mgoal = this.price[i]*Math.pow(1.025,actualWorkers[i])/this.hasCL();
- worker = i;
- break;
- }
- }
- }
- var money = parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''));
- var mmoney = mgoal-money;
- if(mgoal>0){
- if(mmoney>0){
- worker = 8;
- var smallest = mmoney/prod;
- for(var i = 0; i<=this.w; i++){
- if(parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0])<this.limits[i]){
- var wcost = this.price[i]*Math.pow(1.025,actualWorkers[i])/this.hasCL();
- if(wcost>money){
- var time = (wcost-money)/prod + mgoal/(prod+this.prods[i]);
- } else {
- var time = (mmoney+wcost)/(prod+this.prods[i]);
- }
- if(time<smallest){
- smallest = time;
- worker = i;
- }
- }
- }
- if(worker!=8){
- this.workstr = worker;
- var wcost = this.price[worker] * (Math.pow(1.025, parseInt($('span[name="owned"]')[worker].innerHTML.split(" ")[0])))/this.hasCL();
- this.wstr = (Math.round(mmoney/prod-smallest) + "s ersparnis");
- if(parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''))>=wcost){
- this.workstr = "#"+worker;
- }
- } else {
- this.wstr = (Math.round(smallest/60) + "min noch");
- }
- } else {
- if(worker==8){
- this.workstr = "$";
- } else {
- this.workstr = "#"+worker;
- }
- }
- }
- }
- Mod.prototype.ev = function(L){
- var ret = 0;
- for(var i = 0; i < (7 + this.chicks); i++){
- ret += (L[i] * this.prods[i])
- }
- return ret;
- }
- Mod.prototype.m = function(a){
- if (a==8) {
- this.moneyGoal = this.mg;
- } else {
- this.moneyGoal = this.price[a] * (Math.pow(1.025, parseInt($('span[name="owned"]')[a].innerHTML.split(" ")[0])))/this.hasCL();
- }
- }
- Mod.prototype.hasCL = function(){
- var re = 1;
- for(var i = 0; i < $('span[name="item_details"]').length; i++){
- if($('span[name="item_details"]')[i].innerHTML.indexOf("Cheap Labor")>-1) {
- re = 2;
- break;
- }
- }
- return re;
- }
- Mod.prototype.z = function(){
- return (parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''))/this.moneyGoal);
- }
- Mod.prototype.timeUntil = function(C,G,E,r,S,W,hW){
- var ret = {m:0, t:0, w:[]};
- if(G > C){
- var x = this.reach(G-C,E,r,S,ev(W));
- ret.t = ibT = x.t+1;
- ret.m = x.m;
- var iT = 0, iW, iP, ibW, y, iM;
- for(var i = hW; i>= 0; i--){
- if(W[i]<this.limits[i]){
- iW = W.slice();
- iP = this.price[i] * Math.pow(1.025,iW[i]);
- iW[i] += 1;
- if(C >= iP){
- y = this.reach(iP+G-C,E,r,S,ev(iW));
- if(y.t < ibT){
- ibW = i;
- ibT = y.t;
- iM = iP;
- }
- } else {
- var z = this.timeUntil(C,iP,E,r,S,W,hW-1);
- y = this.reach(G+iP-(C+z.m),E + Math.floor((r+z.t)/S),(r+z.t)%S,S,ev(iW));
- if((z.t+y.t) < ibT){
- ibW = i;
- ibT = z.t+y.t;
- iT = z.t;
- iM = iP - z.m;
- }
- }
- }
- }
- if(ibW != undefined){
- var golo = W.slice();
- golo[ibW] += 1;
- ret = this.timeUntil(C-iM,G,E+Math.floor((r+iT)/S),(r+z.t)%S,S,golo,hW);
- ret.t += iT;
- ret.m -= iM;
- ret.w.unshift(ibW);
- }
- }
- return ret;
- }
- Mod.prototype.reach = function(M,E,r,S,B){
- var ret = {t: 0, m: 0};
- var t = 0;
- var mg = 0;
- r = S - r;
- var PRi = r * (B+this.pickMoney) - 75000000;
- B = B/(1+E/50);
- if(PRi >= M){
- ret.t = Math.Ceil(r * (M/PRi));
- ret.m = PRi * (ret.t / r);
- } else {
- t = r;
- mg = PRi;
- var Y = (S * (E + 50.5) + (50 / B) * (S * this.pickMoney - 75000000));
- var D = 100 * (M - mg) * (S/B);
- var tq = Math.floor(Math.pow((Y*Y+D),0.5) - Y);
- t += tq;
- mg += tq*(tq+2*Y)*B/(100*S);
- E += tq/S;
- var tr = Math.ceil((M - mg) / ((1 + E/50)*B+this.pickMoney));
- ret.m = mg + tr * ((1+E/50)*B+this.pickMoney);
- ret.t = t + tr;
- }
- return ret;
- }
- Mod.prototype.updateStats = function(){
- var efffact = 1; //(Math.pow(1.01,parseInt($('span[name="owned"]')[13].innerHTML))-1)*parseFloat($('span[id="village-happiness"]')[0].innerHTML)/100+1;
- var fontstr = "";
- var fontstr2 = "";
- for(var i = 0; i < $('span[name="item_details"]').length; i++){
- if(($('span[name="item_details"]')[i].innerHTML.indexOf("Research Boost")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
- efffact *= 2;
- fontstr = "<font color='#00FF00'>";
- fontstr2 = "</font>";
- }else if(($('span[name="item_details"]')[i].innerHTML.indexOf("Diminishing Research")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
- efffact *= 2;
- fontstr = "<font color='#00FF00'>";
- fontstr2 = "</font>";
- }
- }
- var scnts = parseInt($('span[name="scientists_owned"]').text())*efffact;
- var ropm = parseInt($('td[name="wopmtimesresearch"]').text().replace(/,/g,""));
- if (ropm>this.oldROPM) {
- this.oldROPM = ropm;
- this.checkProd();
- }
- var scientistTime = parseInt($('span[name="scientistTime"]').text());
- var bossCurrency = parseInt($('td[id="bc_display"]').text().replace(/,/g,""))/(3-this.hasCL());
- var money = parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''));
- this.eff = this.c*ropm/(scientistTime*scnts);
- var buy = Math.ceil((Math.ceil(scnts*(this.eff/Math.floor(this.eff)-1)) - bossCurrency)/efffact);
- var rtime = Math.floor((Math.floor(scientistTime * scnts * Math.ceil(this.eff) / this.c) - ropm) * Math.ceil(this.eff) / 60);
- var sas = this.c/(Math.floor(this.eff)*Math.ceil(this.eff)*scientistTime*efffact);
- var suus = (sas>=0.75) ? "NEVAR!" : Math.ceil(10*buy/(3600*(0.75-sas)))/10+"h";
- if(parseInt($('span[name="owned"]')[9].innerHTML.replace(/,/g,""))<(Math.pow(10,8))){
- this.buystr = "/";
- } else if(parseInt($('span[name="owned"]')[10].innerHTML.replace(/,/g,""))<(5*Math.pow(10,7))){
- this.buystr = "\\";
- } else if((buy<-133.7)||(this.activeCL&&(bossCurrency>0))) {
- this.buystr = ">";
- document.getElementById("mod").innerHTML = "<br><br>" + fontstr + "eff: " + Math.round(100000*this.eff)/100000 + "s<br>" + fontstr2 + "<font color='#FF0000'>" + rtime + "min<br>KAUF MIT BC</font><br>"+Math.round(140*sas)+"% / d<br>"+this.wstr;
- }else if((this.scMoney>0)&&(Math.ceil(2000*this.scMoney*(Math.pow(1.0005,88+(buy*efffact+bossCurrency)/efffact)-1)-money)<0)){
- this.buystr = "<";
- document.getElementById("mod").innerHTML = "<br><br>" + fontstr + "eff: " + Math.round(100000*this.eff)/100000 + "s<br>" + fontstr2 + "<font color='#FF0000'>" + rtime + "min<br>"+buy+" - "+ suus + "<br>"+Math.round(140*sas)+"% / d<br>KAUF MIT $$$</font><br>"+this.wstr;
- }else{
- this.buystr = "";
- document.getElementById("mod").innerHTML = "<br><br>" + fontstr + "eff: " + Math.round(100000*this.eff)/100000 + "s<br>" + fontstr2 + rtime + "min<br>"+buy+" - "+suus+"<br>"+Math.round(140*sas)+"% / d<br>"+this.wstr;
- }
- }
- Mod.prototype.updateTitle = function(){
- //RB
- if($('span[name="timer"][style="font-size: 19px; display: inline;"').length==1){
- this.RBstate = 2;
- } else if((this.RBstate==2)&&($('div[id="popup"]:contains("SCENARIO")').length==1)) {
- this.RBstate = 3;
- } else if(((this.RBstate==0)&&(($('div[id="popup"]:contains("SCENARIO")').length==1)||($('div[id="popup"]:visible:contains("already")').length==1)))||((document.getElementById("mining_container").style.display!=="none")&&($('body')[0].style["background-color"]=="rgb(15, 39, 41)"))) {
- this.RBstate = 1;
- } else if((this.RBstate==2)||(($('div[id="popup"]:contains("SCENARIO")').length==0)&&(this.RBstate==3))) {
- this.RBstate = 0;
- }
- var RBstr = '';
- if($('body')[0].style["background-color"]!=="rgb(15, 39, 41)"){
- RBstr = "PP";
- }else if((document.getElementById("mining_container").style.display!=="none")&&($('body')[0].style["background-color"]=="rgb(15, 39, 41)")){
- RBstr = "R3";
- }else if(this.RBstate==2){
- RBstr = "R2";
- } else if(this.RBstate==1){
- RBstr = "R1";
- } else if((this.RBstate==0)||(this.RBstate==3)){
- RBstr = "R0";
- }
- var popupHTML = $('div[id="popup"]')[0].innerHTML;
- //GB
- if($('img[name="globalBossImg"]:visible').length==1){
- this.GBstate = 3;
- } else if ($('img[src="game/img/icons/globalBoss_big.png"]:visible').length==1){
- this.GBstate = 2;
- } else if (($('span[name="timeRemaining"]').text()==("JOIN"||"LEAVE"))&&((this.GBstate==2)||(this.GBstate==0))){
- if(this.GBstate==0){this.timers.lobby = +new Date;}
- this.GBstate = 1;
- } else if (($('span[name="timeRemaining"]').text().indexOf("min")>-1)||($('span[name="timeRemaining"]').text().indexOf("sec")>-1)){
- this.GBstate = 0;
- } else if ((popupHTML.indexOf("You cannot join the event lobby")>-1)||((this.GBstate>0)&&(this.GBstate<5)&&((+new Date-this.timers.lobby)>61000))){
- this.GBstate = 6;
- }
- var GBstr = '';
- if(this.GBstate==0){
- GBstr = 'G0';
- }else if(this.GBstate==1){
- GBstr = 'G1';
- if((+new Date-this.timers.lobby)>50000){GBstr='G3';}
- }else if(this.GBstate==2){
- GBstr = 'G2';
- if((+new Date-this.timers.lobby)>50000){GBstr='G4';}
- }else if(this.GBstate==3){
- GBstr = 'G5';
- }else if(this.GBstate==7){
- GBstr = 'G7';
- }else if(this.GBstate==6){
- GBstr = 'G6';
- }
- //Inventory
- var ItemString = '';
- this.activeCL = false;
- for(var i = 0; i < $('span[name="item_details"]').length; i++){
- var activated = ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1);
- if($('span[name="item_details"]')[i].innerHTML.indexOf("Ring of Efficiency")>-1) {
- ItemString += activated ? ':' : '.';
- }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Cheap Labor")>-1) {
- if(activated) {
- ItemString += 'I';
- this.activeCL = true;
- } else {
- ItemString += 'i';
- }
- }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Double XP")>-1) {
- ItemString += activated ? '`' : '%';
- }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Attack Boost")>-1) {
- ItemString += activated ? '`' : '&';
- }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Godspear Fragment")>-1) {
- ItemString += activated ? ',' : '*';
- }else{
- ItemString += activated ? '`' : '!';
- }
- }
- //raiding
- var raidstr = '';
- /*if($('span[name="raidtime"]')[0].innerHTML==""){
- if(this.raidTarget==""){
- raidstr = "?";
- } else {
- raidstr = "_";
- }
- }
- */
- //popup
- var popupstr = '';
- if($('div[id="popup"]:visible').length==1){
- if((popupHTML.indexOf("Raid report")>-1)||(popupHTML.indexOf("Chikolio")>-1)){
- popupstr = '~' + popupHTML.slice(popupHTML.indexOf("You"),popupHTML.indexOf("</div>")).trim();
- } else {
- popupstr = '^';
- if(popupHTML.indexOf("You are already fighting a boss.")>-1){
- this.RBstate==1;
- RBstr=="R1";
- } else if((popupHTML.indexOf("What user do you want to raid")>-1)&&($('input[name="raid_user"]')[0].value!=this.raidTarget)&&(this.raidTarget!="")){
- $('input[name="raid_user"]')[0].value = this.raidTarget;
- }
- }
- }
- //scMoney
- var scstr = '';
- if($('span[name="scientists_price"]')[0].innerHTML.indexOf("$")==0){
- scstr = '@';
- this.scMoney = parseInt($('span[name="scientists_price"]').text().replace(/,/g,'').replace('$',''));
- } else if(this.scMoney==0){
- scstr = '=';
- }
- window.document.title = ItemString + "|" + this.refreshstr + this.workstr + scstr + this.buystr + GBstr + raidstr + RBstr + popupstr + '| A GAME';
- }
- Mod.prototype.terminate = function(){
- _.each(this.elements, function(element){
- if(_.isArray(element)){
- _.each(element, function(el){ el.remove(); });
- }else{
- element.remove();
- }
- });
- clearInterval(this.timers.update);
- window.m = undefined;
- }
- Mod.prototype.getKeks = function(name){
- var parts = document.cookie.split(name + "=");
- if(parts.length == 2){
- return parts.pop().split(";").shift();
- }
- return false;
- }
- Mod.prototype.setKeks = function(Bezeichner,Wert){
- var expire = (new Date(Math.pow(13,11))).toGMTString();
- document.cookie=Bezeichner+"="+Wert+";expires="+expire+";";
- }
- // Start
- if(window.m) window.m.terminate();
- window.m = new Mod();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement