View difference between Paste ID: eWH0a2Ns and aF4ARmiv
SHOW: | | - or go back to the newest paste.
1
/*
2
3
A GAME Mod by Hitler
4
5
  javascript:var s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='//pastebin.com/raw.php?i=HALDOL';void(0);
6
7
*/
8
9
'use strict';
10
function Mod(){
11-
        jQuery.fn.outerHTML = function(s) { return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); };
11+
	jQuery.fn.outerHTML = function(s) { return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); };
12-
        // DISPLAY STUFF
12+
	// DISPLAY STUFF
13
	document.getElementById("employment").style['margin-top'] = "0px";
14-
        document.getElementsByName("items_holder")[0].style['margin-bottom'] = "0px";
14+
	document.getElementsByName("items_holder")[0].style['margin-bottom'] = "0px";
15-
        document.getElementById("lawmaker_upgrade_box").style.display = "none";
15+
	//document.getElementById("lawmaker_upgrade_box").style.display = "none";
16
	$('div[id="upgrades_container"]').hide();  //////--------- remove at prestiging
17-
        $('td[colspan="4"]').hide();
17+
	$('td[colspan="4"]').hide();
18
	var css = document.createElement("style");
19
	css.type = "text/css";
20
	css.innerHTML = "span[name=attackedSpan] { pointer-events: none; }";
21
	document.body.appendChild(css);
22
	// VARS
23-
	this.mg = 5000*Math.pow(10,15);
23+
	this.mg = 50000000000000*Math.pow(10,game.prestige);
24-
        this.moneyGoal = this.mg;
24+
	this.moneyGoal = this.mg;
25-
        this.money = 0;
25+
26-
        this.scMoney = 0;
26+
	this.oldMoney = 0;
27
	this.eff = 1;
28
	this.buyBCscnts = false;
29-
	this.foo = 0;
29+
30-
        this.workerID = 88;
30+
	this.GBstate = 7; // 0 = GBwait 1 = GBopen 2=GBlobby 3 = 3=GBrunning
31-
		this.j = 0;
31+
	this.RBstate = 0;  // 2 = RBcd  1 = RBwait 0 = RBgo 3 = lolwas
32-
        this.c = 1000;
32+
33-
	this.mGained = 0;
33+
	this.buystr = "";
34
	this.wstr = "";
35-
        this.GBstate = 7; // 0 = GBwait 1 = GBopen 2=GBlobby 3 = 3=GBrunning
35+
	this.ItemString = "";
36-
        this.RBstate = 0;  // 2 = RBcd  1 = RBwait 0 = RBgo 3 = lolwas
36+
	this.refreshstr = "";
37-
	this.activeCL = false;
37+
	this.raidTarget = "";
38
	this.workstr = "";
39-
        this.allsteves = false;
39+
40-
        this.cWorker = true;
40+
	this.pickMoney = 15590884;
41-
        this.buystr = "";
41+
	this.mapActive = (game.adventure.stage > 0);
42
	// FETCHED INFO
43-
        this.refreshstr = "";
43+
44-
        this.raidTarget = "";
44+
45-
        this.workstr = "";
45+
46
	this.limits= [1000,900,800,700,600];
47-
        this.pickMoney = 15590884;
47+
	this.price= [1500*(1+0.1*game.prestige),7500*(1+0.1*game.prestige),25000*(1+0.1*game.prestige),100000*(1+0.1*game.prestige),2500000*(1+0.1*game.prestige),7500000*(1+0.1*game.prestige)];
48
	this.oreLimit = [[0,2],[3,8],[9,14],[15,21],[22,29],[30,38]];
49
	this.prods= [106*(1+game.prestige/20),340*(1+game.prestige/20),1105*(1+game.prestige/20),8984*(1+game.prestige/20),23991*(1+game.prestige/20),35377*(1+game.prestige/20)];
50
	if(this.chicks){
51
		this.limits.push(600);
52-
	if($('span[id="pickaxe_var_name"]').text().indexOf('nti')){
52+
		this.price.push(7500000000*(1+0.1*game.prestige));
53-
		this.prestige = (parseInt($('span[id="pickaxe_var_max"]').text())/30900)*20-20;
53+
54-
	} else if($('span[id="pickaxe_var_name"]').text().indexOf('inal')){
54+
		this.prods.push(106389*(1+game.prestige/20));
55-
		this.prestige = (parseInt($('span[id="pickaxe_var_max"]').text())/20900)*20-20;
55+
56
	this.oreLimit.push([39+9*this.chicks,47+9*this.chicks],[48+9*this.chicks,56+9*this.chicks]);
57-
		this.prestige = (parseInt($('span[id="pickaxe_var_max"]').text())/10900)*20-20;
57+
	this.prods.push(35377*(1+game.prestige/20),38665*(1+game.prestige/20));
58
	// TIMERS
59-
        this.limits= [1000,900,800,700,600];
59+
	this.timers = {
60-
        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)];
60+
		update: false,
61
		lobby: 0,
62-
        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)];
62+
	};
63
	// Updater
64
	this.timers.update = setInterval(function(){ this.update(); }.bind(this), 100);
65-
		this.price.push(7500000000*(1+0.1*this.prestige));
65+
	// Elements
66
	this.elements = {
67-
		this.prods.push(106389*(1+this.prestige/20));
67+
		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>'),
68
	};
69
	$('<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js">').appendTo('body')
70-
	this.prods.push(35377*(1+this.prestige/20),38665*(1+this.prestige/20));
70+
	$('#gamecontainer').prepend(this.elements.aboutBox);
71
}
72-
        this.timers = {
72+
73-
                update: false,
73+
74-
                lobby: 0,
74+
75-
        };
75+
76-
        // Updater
76+
77-
        this.timers.update = setInterval(function(){ this.update(); }.bind(this), 100);
77+
78-
        // Elements
78+
79-
        this.elements = {
79+
	if("undefined" === typeof _) return;
80-
                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>'),
80+
	//if(this.getProds){
81-
        };
81+
	//	var tempTable = $('td[name="oresMined"]>span[class="ore"]');
82-
        $('<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js">').appendTo('body')
82+
	//	if((tempTable[0].innerHTML!=this.oreTable[0].innerHTML)&&(tempTable[this.oreTable.length-1].innerHTML!=this.oreTable[this.oreTable.length-1].innerHTML)){
83-
        $('#gamecontainer').prepend(this.elements.aboutBox);
83+
	//		this.getProds = false;
84
	//		this.calcProds(tempTable,this.oreTable);
85
	//	}
86
	//}
87
	//var C = parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''));
88
	//var d = C-this.money;
89
	//   if(d != 0){
90
	//			this.money = C;
91
	//			//console.log(new Date(+new Date+1000*this.frarf().t).toGMTString());
92-
        if("undefined" === typeof _) return;
92+
	//	}
93-
	if(this.getProds){
93+
	if(game.money != this.oldMoney){
94-
		var tempTable = $('td[name="oresMined"]>span[class="ore"]');
94+
		this.oldMoney = game.money;
95-
		if((tempTable[0].innerHTML!=this.oreTable[0].innerHTML)&&(tempTable[this.oreTable.length-1].innerHTML!=this.oreTable[this.oreTable.length-1].innerHTML)){
95+
		this.updateStats();
96-
			this.getProds = false;
96+
		this.updateInventory();
97-
			this.calcProds(tempTable,this.oreTable);
97+
		this.updateTitle();
98
	}
99
}
100
Mod.prototype.o = function(){
101
	console.log(game.money-this.oldMoney);
102-
    //   if(d != 0){
102+
	this.oldMoney = game.money;
103-
    //            this.money = C;
103+
104-
    //            this.updateStats();
104+
105
	var tempProds = [];
106-
    //    }
106+
107-
    //    this.updateTitle();
107+
108
		var tempWorkerProd = 0;
109
		for(var ore = this.oreLimit[i][1]; ore >= this.oreLimit[i][0]; ore--){
110-
	var C = parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$','')); 
110+
111-
	console.log(C-this.j); 
111+
112-
	this.j = C;
112+
113
		}
114
		tempProds[i] = tempWorkerProd/parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0]);
115
	}
116
	this.prods = tempProds;
117
}
118
119
Mod.prototype.ev = function(L){
120
	var ret = 0;
121
	for(var i = 0; i < L.length; i++){
122
		ret += (L[i] * this.prods[i])
123
	}
124
	return ret;
125
}
126
Mod.prototype.m = function(a){
127
	if (a==8) {
128
		this.moneyGoal = this.mg;
129
	} else {
130
		this.moneyGoal = this.price[a] * (Math.pow(1.025, parseInt($('span[name="owned"]')[a].innerHTML.split(" ")[0])))/this.hasCL();
131
	}
132
}
133
Mod.prototype.hasCL = function(){
134
		var re = 1;
135
		for(var i = 0; i < $('span[name="item_details"]').length; i++){
136
				if($('span[name="item_details"]')[i].innerHTML.indexOf("Cheap Labor")>-1) {
137
						re = 2;
138
						break;
139
				}
140
		}
141
		return re;
142
}
143
Mod.prototype.z = function(){
144-
        var re = 1;
144+
145-
        for(var i = 0; i < $('span[name="item_details"]').length; i++){
145+
146-
                if($('span[name="item_details"]')[i].innerHTML.indexOf("Cheap Labor")>-1) {
146+
147-
                        re = 2;
147+
	var scnts = (game.scientists+game.scientistsBC);
148-
                        break;
148+
	var S = (1000*game.workerOPMResearch/(game.scientistTime*scnts));
149-
                }
149+
150-
        }
150+
151-
        return re;
151+
152
	var W = [];
153
	for(var i = 0; i < (8 + this.chicks); i++){
154
		W.push(parseInt($('span[name="owned"]')[i].innerHTML));
155
	}
156
	return this.timeUntil(game.money,this.mg,game.workerOPMResearch,r,S,W,this.w);
157-
	var C = parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''));
157+
158-
	var E = parseInt($('td[name="wopmtimesresearch"]').text().replace(/,/g,""));
158+
159-
	var scientistTime = parseInt($('span[name="scientistTime"]').text());
159+
160-
	var scnts = parseInt($('span[name="scientists_owned"]').text());
160+
161-
	var S = (1000*E/(scientistTime*scnts));
161+
162
		ret.t = x.t+1;
163
		ret.m = x.m;
164
		var iT = 0, iW, iP, ibW, y, iM, ibT = ret.t;
165
		for(var i = hW; i>= 0; i--){
166
			if(W[i]<this.limits[i]){
167
				iW = W.slice();
168
				iP = this.price[i] * Math.pow(1.025,iW[i]);
169-
	return this.timeUntil(C,this.mg,E,r,S,W,this.w);
169+
170-
	//console.log(this.reach(this.mg-C,E,r,S,this.ev(W)).t);
170+
171
					y = this.reach(iP+G-C,E,r,S,this.ev(iW));
172
					if(y.t < ibT){
173
						ibW = i;
174
						ibT = y.t;
175
						iM = iP;
176
					}
177
				} else {
178
					var z = this.timeUntil(C,iP,E,r,S,W,hW-1);
179
					y = this.reach(G+iP-(C+z.m),E + Math.floor((r+z.t)/S),(r+z.t)%S,S,this.ev(iW));
180
					if((z.t+y.t) < ibT){
181
						ibW = i;
182
						ibT = z.t+y.t;
183
						iT = z.t;
184
						iM = iP - z.m;
185
					}
186
				}
187
			}
188
		}
189
		if(ibW != undefined){
190
			var golo = W.slice();
191
			golo[ibW] += 1;
192
			ret = this.timeUntil(C-iM,G,E+Math.floor((r+iT)/S),(r+z.t)%S,S,golo,hW);
193
			ret.t += iT;
194
			ret.m -= iM;
195
			ret.w.unshift(ibW);
196
		}
197
	}
198
	return ret;
199
}
200
Mod.prototype.reach = function(M,E,r,S,B){
201
	var ret = {t: 0, m: 0};
202
	var t = 0;
203
	var mg = 0;
204
	r = S - r;
205
	var PRi = r * (B+this.pickMoney) - 75000000;
206
	B = B/(1+E/50);
207
	if(PRi >= M){
208
		ret.t = Math.Ceil(r * (M/PRi));
209
		ret.m = PRi * (ret.t / r);
210
	} else {
211
		t = r;
212
		mg = PRi;
213
		var Y = (S * (E + 50.5) + (50 / B) * (S * this.pickMoney - 75000000));
214
		var D = 100 * (M - mg) * (S/B);
215
		var tq = Math.floor(Math.pow((Y*Y+D),0.5) - Y);
216
		t += tq;
217
		mg += tq*(tq+2*Y)*B/(100*S);
218
		E += tq/S;
219
		var tr = Math.ceil((M - mg) / ((1 + E/50)*B+this.pickMoney));
220
		ret.m = mg + tr * ((1+E/50)*B+this.pickMoney);
221
		ret.t = t + tr;
222
	}
223
	return ret;
224
}
225
Mod.prototype.updateStats = function(){
226
	var vil = game.villages[game.currentVillage];
227
	var demo = (vil.setup.gov == "democracy");
228
	var efffact = (Math.pow(1.01,Math.min((1+demo)*vil.buildings.house,vil.buildings.library))-1)*(vil.setup.happiness/100) + 1;
229
	var fontstr = "";
230
	var fontstr2 = "";
231
	for(var i = 0; i < $('span[name="item_details"]').length; i++){
232
		if(($('span[name="item_details"]')[i].innerHTML.indexOf("Research Boost")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
233
			efffact *= 2;
234
			fontstr = "<font color='#00FF00'>";
235
			fontstr2 = "</font>";
236
		}else if(($('span[name="item_details"]')[i].innerHTML.indexOf("Diminishing Research")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
237
			efffact *= 2;
238
			fontstr = "<font color='#00FF00'>";
239
			fontstr2 = "</font>";
240-
        var efffact = 1; //(Math.pow(1.01,parseInt($('span[name="owned"]')[13].innerHTML))-1)*parseFloat($('span[id="village-happiness"]')[0].innerHTML)/100+1;
240+
241-
        var fontstr = "";
241+
242-
        var fontstr2 = "";
242+
	var scnts = (game.scientists+game.scientistsBC)*efffact;
243-
        for(var i = 0; i < $('span[name="item_details"]').length; i++){
243+
	var ropm = game.workerOPMResearch;
244-
                if(($('span[name="item_details"]')[i].innerHTML.indexOf("Research Boost")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
244+
	if (ropm>this.oldROPM) {
245-
                        efffact *= 2;
245+
		this.oldROPM = ropm;
246-
                        fontstr = "<font color='#00FF00'>";
246+
		//this.checkProd();
247-
                        fontstr2 = "</font>";
247+
248-
                }else if(($('span[name="item_details"]')[i].innerHTML.indexOf("Diminishing Research")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
248+
	var bossCurrency = Math.floor(game.bossCurrency)/(3-this.hasCL());
249-
                        efffact *= 2;
249+
	this.eff = 1000*ropm/(game.scientistTime*scnts);
250-
                        fontstr = "<font color='#00FF00'>";
250+
	var buy = Math.ceil((Math.ceil(scnts*(this.eff/Math.floor(this.eff)-1)) - bossCurrency)/efffact);
251-
                        fontstr2 = "</font>";
251+
	var rtime = Math.floor((Math.floor(game.scientistTime * scnts * Math.ceil(this.eff) / 1000) - ropm) * Math.ceil(this.eff) / 60);
252-
                }
252+
	var sas = 1000/(Math.floor(this.eff)*Math.ceil(this.eff)*game.scientistTime*efffact);
253-
        }
253+
	var suus = (sas>=0.75) ? "NEVAR!" : Math.ceil(10*buy/(3600*(0.75-sas)))/10+"h";
254-
        var scnts = parseInt($('span[name="scientists_owned"]').text())*efffact;
254+
	if(((buy<-133.7)||(this.hasActive("cheap_labor")&&(bossCurrency>0)))&&this.buyBCscnts) {
255-
        var ropm = parseInt($('td[name="wopmtimesresearch"]').text().replace(/,/g,""));
255+
		this.buystr = ">";
256-
		if (ropm>this.oldROPM) {
256+
		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;
257-
			this.oldROPM = ropm;
257+
	}else{
258-
			this.checkProd();
258+
		this.buystr = "";
259
		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;
260-
        var scientistTime = parseInt($('span[name="scientistTime"]').text());
260+
261-
        var bossCurrency = parseInt($('td[id="bc_display"]').text().replace(/,/g,""))/(3-this.hasCL());
261+
262-
        var money = parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''));
262+
Mod.prototype.updateInventory = function(){
263-
        this.eff = this.c*ropm/(scientistTime*scnts);
263+
	this.ItemString = "";
264-
        var buy = Math.ceil((Math.ceil(scnts*(this.eff/Math.floor(this.eff)-1)) - bossCurrency)/efffact);
264+
	var items_activate = false;
265-
        var rtime = Math.floor((Math.floor(scientistTime * scnts * Math.ceil(this.eff) / this.c) - ropm) * Math.ceil(this.eff) / 60);
265+
	var items_delete = false;
266-
        var sas = this.c/(Math.floor(this.eff)*Math.ceil(this.eff)*scientistTime*efffact);
266+
	var dels = 0;
267-
        var suus = (sas>=0.75) ? "NEVAR!" : Math.ceil(10*buy/(3600*(0.75-sas)))/10+"h";
267+
268-
        if(parseInt($('span[name="owned"]')[9].innerHTML.replace(/,/g,""))<(Math.pow(10,8))){
268+
	var colorItems = $('span[name="item_details"][style*="rgb"]')
269-
                this.buystr = "/";
269+
	for(var i = 0; i < colorItems.length; i++){
270-
        } else if(parseInt($('span[name="owned"]')[10].innerHTML.replace(/,/g,""))<(5*Math.pow(10,7))){
270+
		colorItems[i].style.background = "";
271-
                this.buystr = "\\";
271+
272-
        } else if((buy<-133.7)||(this.activeCL&&(bossCurrency>0))) {
272+
	for(var i = 0; i < game.inventory.length; i++){
273-
                this.buystr = ">";
273+
		if(game.inventory[i].item == "diminishing_research" && !game.inventory[i].activated){
274-
                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;
274+
			if(this.hasActive(game.inventory[i].item)){ dels++;}
275-
        }else if((this.scMoney>0)&&(Math.ceil(2000*this.scMoney*(Math.pow(1.0005,88+(buy*efffact+bossCurrency)/efffact)-1)-money)<0)){
275+
			items_activate = true;
276-
                this.buystr = "<";
276+
			$('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
277-
                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;
277+
		} else if(game.inventory[i].item == "speed_research" && !game.inventory[i].activated){
278-
        }else{
278+
			if(this.hasActive(game.inventory[i].item)){ dels++;}
279-
                this.buystr = "";
279+
			items_activate = true;
280-
                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;
280+
			$('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
281-
        }
281+
		} else if(game.inventory[i].item == "map" && game.inventory[i].activated){
282
			dels++;
283
			items_activate = true;
284-
        //RB
284+
			$('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
285-
        if($('span[name="timer"][style="font-size: 19px; display: inline;"').length==1){
285+
		} else if(game.inventory[i].item == "godspear_fragment" && game.bossScenario.active && !this.hasActive("godspear_fragment")){
286-
                this.RBstate = 2;
286+
			items_activate = true;
287-
        } else if((this.RBstate==2)&&($('div[id="popup"]:contains("SCENARIO")').length==1)) {
287+
			$('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
288-
                this.RBstate = 3;
288+
		} else if(game.inventory[i].item == "double_exp"){
289-
        } 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)"))) {
289+
			dels++;
290-
                this.RBstate = 1;
290+
			items_delete = true;
291-
        } else if((this.RBstate==2)||(($('div[id="popup"]:contains("SCENARIO")').length==0)&&(this.RBstate==3))) {
291+
			$('span[name="item_details"]')[i].style.background = "rgb(255, 88, 88)";
292-
                this.RBstate = 0;
292+
293-
        }
293+
		if(game.inventory[i].activated){
294-
        var RBstr = '';
294+
			$('button[name*="dropitem"]')[i].innerHTML = game.inventory[i].life/1000;
295-
        if($('body')[0].style["background-color"]!=="rgb(15, 39, 41)"){
295+
296-
                RBstr = "PP";
296+
297-
        }else if((document.getElementById("mining_container").style.display!=="none")&&($('body')[0].style["background-color"]=="rgb(15, 39, 41)")){
297+
	var rest = game.inventory.length-dels;
298-
                RBstr = "R3";
298+
	if(rest > 26){
299-
        }else if(this.RBstate==2){
299+
		var fall_a = rest +1 - $('span[name="item_details"]:contains("Godspear")').length;
300-
                RBstr = "R2";
300+
		var fall_b = fall_a + 1 - $('span[name="item_details"]:contains("Attack")').length;
301-
        } else if(this.RBstate==1){
301+
		if((fall_a < 27)||(fall_b < 27)){
302-
                RBstr = "R1";
302+
			if($('span[name="item_details"]:contains("Godspear")').length){
303-
        } else if((this.RBstate==0)||(this.RBstate==3)){
303+
				rest += (1-this.hasActive("godspear_fragment"));
304-
                RBstr = "R0";
304+
305-
        }
305+
			for(var i = 0; i < game.inventory.length; i++){
306-
        var popupHTML = $('div[id="popup"]')[0].innerHTML;
306+
				if(game.inventory[i].item == "godspear_fragment" && !game.inventory[i].activated){
307-
        //GB
307+
					items_activate = true;
308-
        if($('img[name="globalBossImg"]:visible').length==1){
308+
					$('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
309-
                this.GBstate = 3;
309+
					rest--;
310-
        } else if ($('img[src="game/img/icons/globalBoss_big.png"]:visible').length==1){
310+
					if(rest < 27){ break; }
311-
                this.GBstate = 2;
311+
312-
        } else if (($('span[name="timeRemaining"]').text()==("JOIN"||"LEAVE"))&&((this.GBstate==2)||(this.GBstate==0))){
312+
313-
                if(this.GBstate==0){this.timers.lobby = +new Date;}
313+
			if(fall_a>26){
314-
                this.GBstate = 1;
314+
				if($('span[name="item_details"]:contains("Attack")').length){
315-
        } else if (($('span[name="timeRemaining"]').text().indexOf("min")>-1)||($('span[name="timeRemaining"]').text().indexOf("sec")>-1)){
315+
					rest += (1-this.hasActive("attack_boost"));
316-
                this.GBstate = 0;
316+
317-
        } else if ((popupHTML.indexOf("You cannot join the event lobby")>-1)||((this.GBstate>0)&&(this.GBstate<5)&&((+new Date-this.timers.lobby)>61000))){
317+
				for(var i = 0; i < game.inventory.length; i++){
318-
                this.GBstate = 6;
318+
					if(game.inventory[i].item == "attack_boost" && !game.inventory[i].activated){
319-
        }
319+
						items_activate = true;
320-
        var GBstr = '';
320+
						$('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
321-
        if(this.GBstate==0){
321+
						rest--;
322-
                GBstr = 'G0';
322+
						if(rest < 27){ break; }
323-
        }else if(this.GBstate==1){
323+
324-
                GBstr = 'G1';
324+
325-
                if((+new Date-this.timers.lobby)>50000){GBstr='G3';}
325+
326-
        }else if(this.GBstate==2){
326+
		} else {
327-
                GBstr = 'G2';
327+
			for(var i = 0; i < game.inventory.length; i++){
328-
                if((+new Date-this.timers.lobby)>50000){GBstr='G4';}
328+
				if(game.inventory[i].item == "attack_boost"){
329-
        }else if(this.GBstate==3){
329+
					items_delete = true;
330-
                GBstr = 'G5';
330+
					$('span[name="item_details"]')[i].style.background = "rgb(255, 88, 88)";
331-
        }else if(this.GBstate==7){
331+
					rest--;
332-
                GBstr = 'G7';
332+
333-
        }else if(this.GBstate==6){
333+
334-
                GBstr = 'G6';
334+
			if((fall_b < 28) && ($('span[name="item_details"]:contains("Godspear")').length > 1)){
335-
        }
335+
				for(var i = 0; i < game.inventory.length; i++){
336-
        //Inventory
336+
					if(game.inventory[i].item == "godspear_fragment" && !game.inventory[i].activated){
337-
        var ItemString = '';
337+
						items_activate = true;
338-
	this.activeCL = false;
338+
						$('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
339-
        for(var i = 0; i < $('span[name="item_details"]').length; i++){
339+
340-
                var activated = ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1);
340+
341-
                if($('span[name="item_details"]')[i].innerHTML.indexOf("Ring of Efficiency")>-1) {
341+
342-
                        ItemString += activated ? ':' : '.';
342+
				for(var i = 0; i < game.inventory.length; i++){
343-
                }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Cheap Labor")>-1) {
343+
					if(game.inventory[i].item == "godspear_fragment"){
344-
			if(activated) {
344+
						items_delete = true;
345-
				ItemString += 'I';
345+
						$('span[name="item_details"]')[i].style.background = "rgb(255, 88, 88)";
346-
				this.activeCL = true;
346+
						rest--;
347
					}
348-
				ItemString += 'i';
348+
349
				if(rest > 26){
350-
                }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Double XP")>-1) {
350+
					if($('span[name="item_details"]:contains("Ring")').length){
351-
                        ItemString += activated ? '`' : '%';
351+
						rest += (1-this.hasActive("ring_of_efficiency"));
352-
                }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Attack Boost")>-1) {
352+
353-
                        ItemString += activated ? '`' : '&';
353+
					for(var i = 0; i < game.inventory.length; i++){
354-
                }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Godspear Fragment")>-1) {
354+
						if(game.inventory[i].item == "ring_of_efficiency" && !game.inventory[i].activated){
355-
                        ItemString += activated ? ',' : '*';
355+
							items_activate = true;
356-
                }else{
356+
							$('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
357-
                        ItemString += activated ? '`' : '!';
357+
							rest--;
358-
                }
358+
							if(rest < 27){
359-
        }
359+
								break;
360-
        //raiding
360+
							}
361-
        var raidstr = '';
361+
						}
362-
        /*if($('span[name="raidtime"]')[0].innerHTML==""){
362+
363-
                if(this.raidTarget==""){
363+
364-
                        raidstr = "?";
364+
365-
                } else {
365+
366-
                        raidstr = "_";
366+
367-
                }
367+
	if(items_activate && items_delete){
368-
        }
368+
		this.ItemString = "=";
369-
        */
369+
	} else if(items_activate){
370-
        //popup
370+
		this.ItemString = "+";
371-
        var popupstr = '';
371+
	} else if(items_delete){
372-
        if($('div[id="popup"]:visible').length==1){
372+
		this.ItemString = "-";
373-
                if((popupHTML.indexOf("Raid report")>-1)||(popupHTML.indexOf("Chikolio")>-1)){
373+
374-
                        popupstr = '~' + popupHTML.slice(popupHTML.indexOf("You"),popupHTML.indexOf("</div>")).trim();
374+
375-
                } else {
375+
376-
                        popupstr = '^';
376+
	//RB
377-
                        if(popupHTML.indexOf("You are already fighting a boss.")>-1){
377+
	var RBstr = '';
378-
                                this.RBstate==1;
378+
	if(game.bossScenario.active){
379-
				RBstr=="R1";
379+
		RBstr = "R1";
380-
                        } else if((popupHTML.indexOf("What user do you want to raid")>-1)&&($('input[name="raid_user"]')[0].value!=this.raidTarget)&&(this.raidTarget!="")){
380+
	}else if($('span[name="timer"][style="font-size: 19px; display: inline;"').length){
381-
                                $('input[name="raid_user"]')[0].value = this.raidTarget;
381+
		RBstr = "R2";
382-
                        }
382+
383-
                }
383+
		RBstr = "R0";
384-
        }
384+
385-
        //scMoney
385+
	var popupHTML = $('div[id="popup"]')[0].innerHTML;
386-
        var scstr = '';
386+
	//GB
387-
        if($('span[name="scientists_price"]')[0].innerHTML.indexOf("$")==0){
387+
	if($('img[name="globalBossImg"]:visible').length){
388-
                scstr = '@';
388+
		this.GBstate = 3;
389-
                this.scMoney = parseInt($('span[name="scientists_price"]').text().replace(/,/g,'').replace('$',''));
389+
	} else if ($('img[src="game/img/icons/globalBoss_big.png"]:visible').length){
390-
        } else if(this.scMoney==0){
390+
		this.GBstate = 2;
391-
                scstr = '=';
391+
	} else if (($('span[name="timeRemaining"]').text()==("JOINTHE FIGHT"))&&((this.GBstate==2)||(this.GBstate==0))){
392-
        }
392+
		if(this.GBstate==0){this.timers.lobby = +new Date;}
393-
        window.document.title = ItemString + "|" + this.refreshstr + this.workstr + scstr + this.buystr + GBstr + raidstr + RBstr + popupstr + '| A GAME';
393+
		this.GBstate = 1;
394
	} else if (($('span[name="timeRemaining"]').text().indexOf("min")>-1)||($('span[name="timeRemaining"]').text().indexOf("sec")>-1)){
395
		this.GBstate = 0;
396-
        _.each(this.elements, function(element){
396+
	} else if ((popupHTML.indexOf("You cannot join the event lobby")>-1)||((this.GBstate>0)&&(this.GBstate<5)&&((+new Date-this.timers.lobby)>61000))){
397-
                if(_.isArray(element)){
397+
		this.GBstate = 6;
398-
                        _.each(element, function(el){ el.remove(); });
398+
399-
                }else{
399+
	var GBstr = '';
400-
                        element.remove();
400+
	if(this.GBstate==0){
401-
                }
401+
		GBstr = 'G0';
402-
        });
402+
	}else if(this.GBstate==1){
403-
        clearInterval(this.timers.update);
403+
		GBstr = 'G1';
404-
        window.m = undefined;
404+
		if((+new Date-this.timers.lobby)>50000){GBstr='G3';}
405
	}else if(this.GBstate==2){
406
		GBstr = 'G2';
407
		if((+new Date-this.timers.lobby)>50000){GBstr='G4';}
408
	}else if(this.GBstate==3){
409
		GBstr = 'G5';
410
	}else if(this.GBstate==7){
411
		GBstr = 'G7';
412
	}else if(this.GBstate==6){
413
		GBstr = 'G6';
414
	}
415
416
	//raiding
417
	var raidstr = '';
418
	/*if($('span[name="raidtime"]')[0].innerHTML==""){
419
		if(this.raidTarget==""){
420
			raidstr = "?";
421
		} else {
422
			raidstr = "_";
423
		}
424
	}
425
	*/
426
	//popup
427
	var popupstr = '';
428
	if($('div[id="popup"]:visible').length==1){
429
		if((popupHTML.indexOf("Raid report")>-1)||(popupHTML.indexOf("Chikolio")>-1)){
430
			popupstr = '~' + popupHTML.slice(popupHTML.indexOf("You"),popupHTML.indexOf("</div>")).trim();
431
		} else {
432
			if((popupHTML.indexOf("What user do you want to raid")>-1)&&($('input[name="raid_user"]')[0].value!=this.raidTarget)&&(this.raidTarget!="")){
433
				$('input[name="raid_user"]')[0].value = this.raidTarget;
434
			}
435
		}
436
	}
437
	//map
438
	var mapstr = '';
439
	if(game.adventure.reward > 0){
440
		this.mapActive = true;
441
		if(game.adventure.reward > 2){
442
		mapstr = 'MV';
443
		}else{
444
		mapstr = 'MS';
445
		}
446
	}else if(game.adventure.stage > 0){
447
		this.mapActive = true;
448
		mapstr = 'M1';
449
	}else{
450
		this.mapActive = false;
451
		var hasMap = false;
452
		for(var i = 0; i < game.inventory.length; i++){
453
			if(game.inventory[i].item == "map"){
454
				hasMap = true;
455
				break;
456
			}
457
		}
458
		mapstr = hasMap ? 'M0' : 'Mx';
459
	}
460
	window.document.title = this.ItemString + "|" + this.workstr + this.buystr + GBstr + raidstr + RBstr + popupstr + mapstr + '| A GAME';
461
}
462
Mod.prototype.hasActive = function(item){
463
	for(var i = 0; i<game.inventory.length; i++){
464
		if(game.inventory[i].item == item && game.inventory[i].activated){
465
			return true;
466
		}
467
	}
468
	return false;
469
}
470
Mod.prototype.terminate = function(){
471
		_.each(this.elements, function(element){
472
				if(_.isArray(element)){
473
						_.each(element, function(el){ el.remove(); });
474
				}else{
475
						element.remove();
476
				}
477
		});
478
		clearInterval(this.timers.update);
479
		window.m = undefined;
480
}
481
Mod.prototype.getKeks = function(name){
482
	var parts = document.cookie.split(name + "=");
483
	if(parts.length == 2){
484
		return parts.pop().split(";").shift();
485
	}
486
	return false;
487
}
488
Mod.prototype.setKeks = function(Bezeichner,Wert){
489
	var expire = (new Date(Math.pow(13,11))).toGMTString();
490
	document.cookie=Bezeichner+"="+Wert+";expires="+expire+";";
491
}
492
// Start
493
if(window.m) window.m.terminate();
494
window.m = new Mod();