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