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 | $('<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js">').appendTo('body')
| |
| 12 | jQuery.fn.outerHTML = function(s) { return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); };
| |
| 13 | this.version = 433; | |
| 14 | window.document.title='| A GAME'; | |
| 15 | - | //document.getElementById("lawmaker_upgrade_box").style.display = "none";
|
| 15 | + | this.initTimer = setInterval(function(){ this.checkInit(); }.bind(this), 20);
|
| 16 | } | |
| 17 | ||
| 18 | Mod.prototype.checkInit = function(){
| |
| 19 | if(typeof(game) != "undefined"){
| |
| 20 | if(game.loaded){
| |
| 21 | if(game.adventure.stage > 0){console.log(game.adventure.stages - game.adventure.stage + " stages left");}
| |
| 22 | clearInterval(this.initTimer); | |
| 23 | - | this.mg = 50000000000000*Math.pow(10,game.prestige); |
| 23 | + | this.init(); |
| 24 | - | this.moneyGoal = this.mg; |
| 24 | + | |
| 25 | - | this.oldROPM = 0; |
| 25 | + | |
| 26 | - | this.oldMoney = 0; |
| 26 | + | |
| 27 | ||
| 28 | - | this.buyBCscnts = false; |
| 28 | + | Mod.prototype.init = function(){
|
| 29 | - | this.orePrice = [50,3,7,30,120,240,2250,3250,7000] |
| 29 | + | console.log("VERSION " + this.version);
|
| 30 | // DISPLAY STUFF | |
| 31 | $('div[name="character"]').show();
| |
| 32 | - | this.getProds = false; |
| 32 | + | |
| 33 | document.getElementById("employment").style['margin-bottom'] = "150px";
| |
| 34 | - | this.wstr = ""; |
| 34 | + | |
| 35 | $('div[id="upgrades_container"]').hide(); //////--------- remove at prestiging
| |
| 36 | - | this.refreshstr = ""; |
| 36 | + | |
| 37 | - | this.raidTarget = ""; |
| 37 | + | |
| 38 | - | this.workstr = ""; |
| 38 | + | |
| 39 | - | this.buildstr = ""; |
| 39 | + | |
| 40 | - | this.pickMoney = 15590884; |
| 40 | + | |
| 41 | - | this.mapActive = (game.adventure.stage > 0); |
| 41 | + | |
| 42 | - | // FETCHED INFO |
| 42 | + | |
| 43 | - | this.oreTable = $('td[name="oresMined"]>span[class="ore"]');
|
| 43 | + | |
| 44 | - | this.chicks = $('tr[name="chickenfarmer"]').length;
|
| 44 | + | |
| 45 | - | this.w = (5 + this.chicks); |
| 45 | + | this.advarmy = 987654321000; |
| 46 | - | this.limits= [1000,900,800,700,600]; |
| 46 | + | |
| 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)]; |
| 47 | + | |
| 48 | - | this.oreLimit = [[0,2],[3,8],[9,14],[15,21],[22,29],[30,38]]; |
| 48 | + | this.forcedReward = this.getKeks("forcedReward");
|
| 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)]; |
| 49 | + | this.retrying = this.getKeks("#retrying");
|
| 50 | - | if(this.chicks){
|
| 50 | + | this.forcedWhisper = 2; // where 1 is built and 2 is equally |
| 51 | - | this.limits.push(600); |
| 51 | + | this.rewardDiff = 88; |
| 52 | - | this.price.push(7500000000*(1+0.1*game.prestige)); |
| 52 | + | this.donateMax = Math.pow(10,21)-65537; |
| 53 | - | this.oreLimit.push([39,47]); |
| 53 | + | this.donateOpt = 48516519540978990000; |
| 54 | - | this.prods.push(106389*(1+game.prestige/20)); |
| 54 | + | this.mapstr = ""; |
| 55 | this.newVilDelta = this.getKeks("newVilDelta");
| |
| 56 | - | this.oreLimit.push([39+9*this.chicks,47+9*this.chicks],[48+9*this.chicks,56+9*this.chicks]); |
| 56 | + | this.oldmists = game.villages[game.currentVillage].employed.adv_miner[0]; |
| 57 | - | this.prods.push(35377*(1+game.prestige/20),38665*(1+game.prestige/20)); |
| 57 | + | this.oldGBM = game.villages[game.currentVillage].employed.gb_capturedminion[0]; |
| 58 | this.savedMaps = 0; | |
| 59 | this.startAdv = false; | |
| 60 | this.waitForSave = false; | |
| 61 | this.advStarted = false; | |
| 62 | this.activateCL = false; | |
| 63 | this.removeAttackBoost = false; | |
| 64 | this.attackBoostLife = 0; | |
| 65 | this.saveDiff = game.lastMine - game.lastSave; | |
| 66 | this.mapState = (game.adventure.reward > 0) ? 2 : ((game.adventure.stage > 0) ? 1 : 0); | |
| 67 | // TIMERS | |
| 68 | this.timers = {
| |
| 69 | update: false, | |
| 70 | lobby: 0, | |
| 71 | GB: 0, | |
| 72 | }; | |
| 73 | - | Mod.prototype.checkProd = function(){
|
| 73 | + | |
| 74 | - | this.getProds = true; |
| 74 | + | |
| 75 | - | this.oreTable = $('td[name="oresMined"]>span[class="ore"]');
|
| 75 | + | |
| 76 | - | this.update(); |
| 76 | + | |
| 77 | 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>'),
| |
| 78 | }; | |
| 79 | $('#gamecontainer').prepend(this.elements.aboutBox);
| |
| 80 | - | //if(this.getProds){
|
| 80 | + | |
| 81 | - | // var tempTable = $('td[name="oresMined"]>span[class="ore"]');
|
| 81 | + | |
| 82 | - | // if((tempTable[0].innerHTML!=this.oreTable[0].innerHTML)&&(tempTable[this.oreTable.length-1].innerHTML!=this.oreTable[this.oreTable.length-1].innerHTML)){
|
| 82 | + | |
| 83 | - | // this.getProds = false; |
| 83 | + | |
| 84 | - | // this.calcProds(tempTable,this.oreTable); |
| 84 | + | |
| 85 | - | // } |
| 85 | + | var newSaveDiff = game.lastMine - game.lastSave; |
| 86 | if(newSaveDiff < this.saveDiff){
| |
| 87 | - | //var C = parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''));
|
| 87 | + | this.waitForSave = false; |
| 88 | - | //var d = C-this.money; |
| 88 | + | console.log("saved at "+(new Date()).toGMTString());
|
| 89 | - | // if(d != 0){
|
| 89 | + | |
| 90 | - | // this.money = C; |
| 90 | + | this.saveDiff = newSaveDiff; |
| 91 | - | // //console.log(new Date(+new Date+1000*this.frarf().t).toGMTString()); |
| 91 | + | |
| 92 | - | // } |
| 92 | + | |
| 93 | this.updateInventory(); | |
| 94 | this.updateMap(); | |
| 95 | this.updateTitle(); | |
| 96 | var addmists = game.villages[game.currentVillage].employed.adv_miner[0] - this.oldmists; | |
| 97 | if((addmists > 0)&&(addmists < 21)){
| |
| 98 | clearInterval(this.timers.update); | |
| 99 | location.reload(); | |
| 100 | - | Mod.prototype.o = function(){
|
| 100 | + | |
| 101 | - | console.log(game.money-this.oldMoney); |
| 101 | + | if(game.villages[game.currentVillage].employed.gb_capturedminion[0] > this.oldGBM){
|
| 102 | - | this.oldMoney = game.money; |
| 102 | + | this.waitForSave = true; |
| 103 | } | |
| 104 | - | Mod.prototype.calcProds = function(t2,t1){
|
| 104 | + | this.oldGBM = game.villages[game.currentVillage].employed.gb_capturedminion[0]; |
| 105 | - | var tempProds = []; |
| 105 | + | this.oldmists = game.villages[game.currentVillage].employed.adv_miner[0]; |
| 106 | - | tempProds.length = this.oreLimit.length; |
| 106 | + | |
| 107 | - | for(var i = 0; i<tempProds.length; i++){
|
| 107 | + | |
| 108 | - | var tempWorkerProd = 0; |
| 108 | + | |
| 109 | - | for(var ore = this.oreLimit[i][1]; ore >= this.oreLimit[i][0]; ore--){
|
| 109 | + | |
| 110 | - | var oret2 = parseInt(t2[ore].innerHTML.slice(t2[ore].innerHTML.indexOf('x')+1,1337).replace(/,/g,""));
|
| 110 | + | |
| 111 | - | var oret1 = parseInt(t1[ore].innerHTML.slice(t1[ore].innerHTML.indexOf('x')+1,1337).replace(/,/g,""));
|
| 111 | + | var fact = (Math.pow(1.01,vil.buildings.library)-1)*(vil.setup.happiness/100) + 1; |
| 112 | - | tempWorkerProd += this.orePrice[this.oreLimit[i][1]-ore]*(oret2-oret1); |
| 112 | + | |
| 113 | var fontstr2 = ""; | |
| 114 | - | tempProds[i] = tempWorkerProd/parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0]);
|
| 114 | + | |
| 115 | if(($('span[name="item_details"]')[i].innerHTML.indexOf("Research Boost")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
| |
| 116 | - | this.prods = tempProds; |
| 116 | + | fact *= 2; |
| 117 | fontstr = "<font color='#00FF00'>"; | |
| 118 | fontstr2 = "</font>"; | |
| 119 | - | Mod.prototype.ev = function(L){
|
| 119 | + | |
| 120 | - | var ret = 0; |
| 120 | + | fact *= 2; |
| 121 | - | for(var i = 0; i < L.length; i++){
|
| 121 | + | |
| 122 | - | ret += (L[i] * this.prods[i]) |
| 122 | + | |
| 123 | } | |
| 124 | - | return ret; |
| 124 | + | |
| 125 | var scnts = (game.scientists+game.scientistsBC)*fact; | |
| 126 | - | Mod.prototype.m = function(a){
|
| 126 | + | |
| 127 | - | if (a==8) {
|
| 127 | + | var bossCurrency = Math.floor(game.bossCurrency); |
| 128 | - | this.moneyGoal = this.mg; |
| 128 | + | |
| 129 | var buy = Math.ceil((Math.ceil(scnts*(this.eff/Math.floor(this.eff)-1)) - bossCurrency)/fact); | |
| 130 | - | this.moneyGoal = this.price[a] * (Math.pow(1.025, parseInt($('span[name="owned"]')[a].innerHTML.split(" ")[0])))/this.hasCL();
|
| 130 | + | |
| 131 | var sas = 1000/(Math.floor(this.eff)*Math.ceil(this.eff)*game.scientistTime*fact); | |
| 132 | var suus = (sas>=0.75) ? "NEVAR!" : Math.ceil(10*buy/(3600*(0.75-sas)))/10+"h"; | |
| 133 | - | Mod.prototype.hasCL = function(){
|
| 133 | + | /* |
| 134 | - | var re = 1; |
| 134 | + | if(((buy<-133.7)||this.hasActive("cheap_labor"))&&(bossCurrency>0)) {
|
| 135 | - | for(var i = 0; i < $('span[name="item_details"]').length; i++){
|
| 135 | + | if(this.hasActive("cheap_labor")){
|
| 136 | - | if($('span[name="item_details"]')[i].innerHTML.indexOf("Cheap Labor")>-1) {
|
| 136 | + | this.buystr = "ยง"; |
| 137 | - | re = 2; |
| 137 | + | 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>";
|
| 138 | - | break; |
| 138 | + | |
| 139 | this.activateCL = true;} | |
| 140 | }else{
| |
| 141 | - | return re; |
| 141 | + | |
| 142 | this.buystr = ""; | |
| 143 | - | Mod.prototype.z = function(){
|
| 143 | + | 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>";
|
| 144 | - | return (parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''))/this.moneyGoal);
|
| 144 | + | |
| 145 | } | |
| 146 | - | Mod.prototype.frarf = function(){
|
| 146 | + | |
| 147 | - | var scnts = (game.scientists+game.scientistsBC); |
| 147 | + | |
| 148 | - | var S = (1000*game.workerOPMResearch/(game.scientistTime*scnts)); |
| 148 | + | |
| 149 | - | var r = Math.round(parseInt($('div[class="bar"]>span')[0].style['width'].replace(/%/g,""))*S/100);
|
| 149 | + | |
| 150 | - | S = Math.ceil(S); |
| 150 | + | var new_actives = {}
|
| 151 | - | if(r == S) {r -= 1; }
|
| 151 | + | new_actives.diminishing_research = this.hasActive("diminishing_research");
|
| 152 | - | var W = []; |
| 152 | + | new_actives.speed_research = this.hasActive("speed_research");
|
| 153 | - | for(var i = 0; i < (8 + this.chicks); i++){
|
| 153 | + | new_actives.godspear_fragment = this.hasActive("godspear_fragment");
|
| 154 | - | W.push(parseInt($('span[name="owned"]')[i].innerHTML));
|
| 154 | + | new_actives.attack_boost = this.hasActive("attack_boost");
|
| 155 | new_actives.ring_of_efficiency = this.hasActive("ring_of_efficiency");
| |
| 156 | - | return this.timeUntil(game.money,this.mg,game.workerOPMResearch,r,S,W,this.w); |
| 156 | + | new_actives.cheap_labor = this.hasActive("cheap_labor");
|
| 157 | new_actives.map = (this.mapState > 0); | |
| 158 | - | Mod.prototype.timeUntil = function(C,G,E,r,S,W,hW){
|
| 158 | + | var new_savedMaps = this.savedMaps; |
| 159 | - | var ret = {m:0, t:0, w:[]};
|
| 159 | + | |
| 160 | - | if(G > C){
|
| 160 | + | if($('[type="tab"]:visible').length){
|
| 161 | - | var x = this.reach(G-C,E,r,S,this.ev(W)); |
| 161 | + | if((this.removeAttackBoost && !this.hasActive("attack_boost"))||(this.getLife("attack_boost")>this.attackBoostLife)){
|
| 162 | - | ret.t = x.t+1; |
| 162 | + | if(this.attackBoostLife<66.6){
|
| 163 | - | ret.m = x.m; |
| 163 | + | this.attackBoostLife += 600; |
| 164 | - | var iT = 0, iW, iP, ibW, y, iM, ibT = ret.t; |
| 164 | + | |
| 165 | - | for(var i = hW; i>= 0; i--){
|
| 165 | + | this.removeAttackBoost = false; |
| 166 | - | if(W[i]<this.limits[i]){
|
| 166 | + | |
| 167 | - | iW = W.slice(); |
| 167 | + | |
| 168 | - | iP = this.price[i] * Math.pow(1.025,iW[i]); |
| 168 | + | |
| 169 | - | iW[i] += 1; |
| 169 | + | |
| 170 | - | if(C >= iP){
|
| 170 | + | |
| 171 | - | y = this.reach(iP+G-C,E,r,S,this.ev(iW)); |
| 171 | + | |
| 172 | - | if(y.t < ibT){
|
| 172 | + | if(this.activateCL && this.hasActive("cheap_labor")){this.activateCL = false;}
|
| 173 | - | ibW = i; |
| 173 | + | |
| 174 | - | ibT = y.t; |
| 174 | + | |
| 175 | - | iM = iP; |
| 175 | + | if(new_actives.diminishing_research){
|
| 176 | dels++; | |
| 177 | } else {
| |
| 178 | - | var z = this.timeUntil(C,iP,E,r,S,W,hW-1); |
| 178 | + | new_actives.diminishing_research = true; |
| 179 | - | y = this.reach(G+iP-(C+z.m),E + Math.floor((r+z.t)/S),(r+z.t)%S,S,this.ev(iW)); |
| 179 | + | |
| 180 | - | if((z.t+y.t) < ibT){
|
| 180 | + | |
| 181 | - | ibW = i; |
| 181 | + | |
| 182 | - | ibT = z.t+y.t; |
| 182 | + | |
| 183 | - | iT = z.t; |
| 183 | + | if(new_actives.speed_research){
|
| 184 | - | iM = iP - z.m; |
| 184 | + | dels++; |
| 185 | } else {
| |
| 186 | new_actives.speed_research = true; | |
| 187 | } | |
| 188 | items_activate = true; | |
| 189 | - | if(ibW != undefined){
|
| 189 | + | |
| 190 | - | var golo = W.slice(); |
| 190 | + | } else if(game.inventory[i].item == "map" && !new_actives.map){
|
| 191 | - | golo[ibW] += 1; |
| 191 | + | if(new_savedMaps > 0){
|
| 192 | - | ret = this.timeUntil(C-iM,G,E+Math.floor((r+iT)/S),(r+z.t)%S,S,golo,hW); |
| 192 | + | new_savedMaps--; |
| 193 | - | ret.t += iT; |
| 193 | + | |
| 194 | - | ret.m -= iM; |
| 194 | + | if((game.villages[game.currentVillage].employedSoldiers.knight >= Math.pow(10,12))&&(game.adventure.reward == 0)&&(game.adventure.stage == 0)){
|
| 195 | - | ret.w.unshift(ibW); |
| 195 | + | new_actives.map = true; |
| 196 | dels++; | |
| 197 | $('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
| |
| 198 | - | return ret; |
| 198 | + | |
| 199 | } | |
| 200 | - | Mod.prototype.reach = function(M,E,r,S,B){
|
| 200 | + | } else if(game.inventory[i].item == "cheap_labor" && this.activateCL && !new_actives.cheap_labor){
|
| 201 | - | var ret = {t: 0, m: 0};
|
| 201 | + | new_actives.cheap_labor = true; |
| 202 | - | var t = 0; |
| 202 | + | |
| 203 | - | var mg = 0; |
| 203 | + | |
| 204 | - | r = S - r; |
| 204 | + | } else if(game.inventory[i].item == "godspear_fragment" && (game.bossScenario.active || (game.adventure.stage > 0)) && !new_actives.godspear_fragment){
|
| 205 | - | var PRi = r * (B+this.pickMoney) - 75000000; |
| 205 | + | new_actives.godspear_fragment = true; |
| 206 | - | B = B/(1+E/50); |
| 206 | + | |
| 207 | - | if(PRi >= M){
|
| 207 | + | |
| 208 | - | ret.t = Math.Ceil(r * (M/PRi)); |
| 208 | + | |
| 209 | - | ret.m = PRi * (ret.t / r); |
| 209 | + | |
| 210 | items_delete = true; | |
| 211 | - | t = r; |
| 211 | + | |
| 212 | - | mg = PRi; |
| 212 | + | } else if((game.inventory[i].item == "attack_boost") && (Math.pow(this.GBstate-2.5,2)<0.5) && !new_actives.attack_boost){
|
| 213 | - | var Y = (S * (E + 50.5) + (50 / B) * (S * this.pickMoney - 75000000)); |
| 213 | + | new_actives.attack_boost = true; |
| 214 | - | var D = 100 * (M - mg) * (S/B); |
| 214 | + | |
| 215 | - | var tq = Math.floor(Math.pow((Y*Y+D),0.5) - Y); |
| 215 | + | |
| 216 | - | t += tq; |
| 216 | + | } else if((game.inventory[i].item == "attack_boost") && this.removeAttackBoost && game.inventory[i].activated){
|
| 217 | - | mg += tq*(tq+2*Y)*B/(100*S); |
| 217 | + | new_actives.attack_boost = false; |
| 218 | - | E += tq/S; |
| 218 | + | |
| 219 | - | var tr = Math.ceil((M - mg) / ((1 + E/50)*B+this.pickMoney)); |
| 219 | + | |
| 220 | - | ret.m = mg + tr * ((1+E/50)*B+this.pickMoney); |
| 220 | + | |
| 221 | - | ret.t = t + tr; |
| 221 | + | |
| 222 | if(game.inventory[i].activated){
| |
| 223 | - | return ret; |
| 223 | + | |
| 224 | } | |
| 225 | } | |
| 226 | ||
| 227 | - | var demo = (vil.setup.gov == "democracy"); |
| 227 | + | if((game.villages[game.currentVillage].employedSoldiers.knight < Math.pow(10,12))||(game.adventure.reward > 0)||(game.adventure.stage > 0)){
|
| 228 | - | var efffact = (Math.pow(1.01,Math.min((1+demo)*vil.buildings.house,vil.buildings.library))-1)*(vil.setup.happiness/100) + 1; |
| 228 | + | $('span[class="item"]:contains("territories") button:contains("Activate")').hide();
|
| 229 | }else{
| |
| 230 | $('span[class="item"]:contains("territories") button:contains("Activate")').show();
| |
| 231 | } | |
| 232 | $('span[class="item"]:contains("time by half") button:contains("Drop")').hide();
| |
| 233 | - | efffact *= 2; |
| 233 | + | $('span[class="item"]:contains("scientist research") button:contains("Drop")').hide();
|
| 234 | $('span[class="item"]:contains("Doubles all workers") button:contains("Drop")').hide();
| |
| 235 | $('span[class="item"]:contains("double the XP") button:contains("Activate")').hide();
| |
| 236 | $('span[class="item"]:contains("territories") button:contains("Drop")').hide();
| |
| 237 | - | efffact *= 2; |
| 237 | + | |
| 238 | if(game.bossScenario.active || ((this.GBstate > 0) && (this.GBstate < 6))){
| |
| 239 | var rest = game.inventory.length-dels; | |
| 240 | if(rest > 26){
| |
| 241 | var fall_a = rest +1 - $('span[name="item_details"]:contains("Godspear")').length;
| |
| 242 | - | var scnts = (game.scientists+game.scientistsBC)*efffact; |
| 242 | + | |
| 243 | if((fall_a < 27)||(fall_b < 27)){
| |
| 244 | - | if (ropm>this.oldROPM) {
|
| 244 | + | |
| 245 | - | this.oldROPM = ropm; |
| 245 | + | |
| 246 | - | //this.checkProd(); |
| 246 | + | |
| 247 | for(var i = 0; i < game.inventory.length; i++){
| |
| 248 | - | var bossCurrency = Math.floor(game.bossCurrency)/(3-this.hasCL()); |
| 248 | + | |
| 249 | items_activate = true; | |
| 250 | - | var buy = Math.ceil((Math.ceil(scnts*(this.eff/Math.floor(this.eff)-1)) - bossCurrency)/efffact); |
| 250 | + | |
| 251 | rest--; | |
| 252 | - | var sas = 1000/(Math.floor(this.eff)*Math.ceil(this.eff)*game.scientistTime*efffact); |
| 252 | + | |
| 253 | } | |
| 254 | - | if(((buy<-133.7)||(this.hasActive("cheap_labor")&&(bossCurrency>0)))&&this.buyBCscnts) {
|
| 254 | + | |
| 255 | - | this.buystr = ">"; |
| 255 | + | |
| 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;
|
| 256 | + | |
| 257 | rest += (1-this.hasActive("attack_boost"));
| |
| 258 | } | |
| 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;
|
| 259 | + | |
| 260 | if(game.inventory[i].item == "attack_boost" && !game.inventory[i].activated){
| |
| 261 | items_activate = true; | |
| 262 | $('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
| |
| 263 | rest--; | |
| 264 | if(rest < 27){ break; }
| |
| 265 | } | |
| 266 | } | |
| 267 | } | |
| 268 | } else {
| |
| 269 | for(var i = 0; i < game.inventory.length; i++){
| |
| 270 | if(game.inventory[i].item == "attack_boost"){
| |
| 271 | items_delete = true; | |
| 272 | $('span[name="item_details"]')[i].style.background = "rgb(255, 88, 88)";
| |
| 273 | rest--; | |
| 274 | - | if(this.hasActive(game.inventory[i].item)){ dels++;}
|
| 274 | + | |
| 275 | } | |
| 276 | if((fall_b < 28) && ($('span[name="item_details"]:contains("Godspear")').length > 1)){
| |
| 277 | for(var i = 0; i < game.inventory.length; i++){
| |
| 278 | - | if(this.hasActive(game.inventory[i].item)){ dels++;}
|
| 278 | + | |
| 279 | items_activate = true; | |
| 280 | $('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
| |
| 281 | - | } else if(game.inventory[i].item == "map" && game.inventory[i].activated){
|
| 281 | + | |
| 282 | } | |
| 283 | } else {
| |
| 284 | for(var i = 0; i < game.inventory.length; i++){
| |
| 285 | - | } else if(game.inventory[i].item == "godspear_fragment" && game.bossScenario.active && !this.hasActive("godspear_fragment")){
|
| 285 | + | |
| 286 | items_delete = true; | |
| 287 | $('span[name="item_details"]')[i].style.background = "rgb(255, 88, 88)";
| |
| 288 | rest--; | |
| 289 | } | |
| 290 | } | |
| 291 | if(rest > 26){
| |
| 292 | if($('span[name="item_details"]:contains("Ring")').length){
| |
| 293 | rest += (1-this.hasActive("ring_of_efficiency"));
| |
| 294 | } | |
| 295 | for(var i = 0; i < game.inventory.length; i++){
| |
| 296 | if(game.inventory[i].item == "ring_of_efficiency" && !game.inventory[i].activated){
| |
| 297 | items_activate = true; | |
| 298 | $('span[name="item_details"]')[i].style.background = "rgb(88, 255, 88)";
| |
| 299 | rest--; | |
| 300 | if(rest < 27){
| |
| 301 | break; | |
| 302 | } | |
| 303 | } | |
| 304 | } | |
| 305 | } | |
| 306 | } | |
| 307 | } | |
| 308 | } | |
| 309 | } | |
| 310 | if(items_activate && items_delete){
| |
| 311 | this.ItemString = "="; | |
| 312 | } else if(items_activate){
| |
| 313 | this.ItemString = "+"; | |
| 314 | } else if(items_delete){
| |
| 315 | this.ItemString = "-"; | |
| 316 | } | |
| 317 | } | |
| 318 | } | |
| 319 | ||
| 320 | ||
| 321 | Mod.prototype.updateTitle = function(){
| |
| 322 | //RB | |
| 323 | var RBstr = ''; | |
| 324 | if(game.bossScenario.active){
| |
| 325 | RBstr = "R1"; | |
| 326 | }else if($('span[name="timer"][style="font-size: 19px; display: inline;"').length){
| |
| 327 | RBstr = "R2"; | |
| 328 | } else {
| |
| 329 | RBstr = "R0"; | |
| 330 | } | |
| 331 | var popupHTML = $('div[id="popup"]')[0].innerHTML;
| |
| 332 | //GB | |
| 333 | if($('img[name="globalBossImg"]:visible').length){
| |
| 334 | this.GBstate = 3; | |
| 335 | } else if ($('img[src="game/img/icons/globalBoss_big.png"]:visible').length){
| |
| 336 | this.GBstate = 2; | |
| 337 | } else if (($('span[name="timeRemaining"]').text()==("JOINTHE FIGHT"))&&((this.GBstate==2)||(this.GBstate==0))){
| |
| 338 | if(this.GBstate==0){this.timers.lobby = +new Date;}
| |
| 339 | this.GBstate = 1; | |
| 340 | } else if (($('span[name="timeRemaining"]').text().indexOf("min")>-1)||($('span[name="timeRemaining"]').text().indexOf("sec")>-1)){
| |
| 341 | if((this.GBstate > 0) && this.hasActive("attack_boost") && (this.getLife("attack_boost")<666) && (this.GBstate < 7)){
| |
| 342 | this.removeAttackBoost = true; | |
| 343 | this.attackBoostLife = this.getLife("attack_boost");
| |
| 344 | } | |
| 345 | this.GBstate = 0; | |
| 346 | } else if ((popupHTML.indexOf("You cannot join the event lobby")>-1)||((this.GBstate>0)&&(this.GBstate<5)&&((+new Date-this.timers.lobby)>60000))){
| |
| 347 | this.GBstate = 6; | |
| 348 | } | |
| 349 | var GBstr = ''; | |
| 350 | if(this.GBstate==0){
| |
| 351 | GBstr = 'G0'; | |
| 352 | }else if(this.GBstate==1){
| |
| 353 | GBstr = 'G1'; | |
| 354 | if((+new Date-this.timers.lobby)>50000){GBstr='G3';}
| |
| 355 | }else if(this.GBstate==2){
| |
| 356 | GBstr = 'G2'; | |
| 357 | if((+new Date-this.timers.lobby)>50000){GBstr='G4';}
| |
| 358 | }else if(this.GBstate==3){
| |
| 359 | GBstr = 'G5'; | |
| 360 | }else if(this.GBstate==6){
| |
| 361 | GBstr = 'G6'; | |
| 362 | } | |
| 363 | //popup | |
| 364 | var vikings = game.villages[game.currentVillage].employedSoldiers.knight; | |
| 365 | var templars = game.villages[game.currentVillage].employedSoldiers.templar; | |
| 366 | var startAdv = false; | |
| 367 | if($('div[id="popup"]:visible').length==1){
| |
| 368 | if(popupHTML.indexOf("ll send to the adventure")>-1){
| |
| 369 | startAdv = true; | |
| 370 | if(($('input[id="advArmy-knight"]')[0].value!=this.advarmy)&&(vikings>=Math.pow(10,12))&&((this.forcedReward == 0)||(this.rewardDiff < 12))){
| |
| 371 | $('input[id="advArmy-knight"]')[0].value = this.advarmy;
| |
| 372 | } | |
| 373 | if(this.forcedReward > 0){
| |
| 374 | if(this.rewardDiff < 12){
| |
| 375 | $('p[name="title"]')[0].innerHTML = ("<font color='#00BB00'>" + this.rewardDiff + "</font>");
| |
| 376 | $('button:contains("Continue")').show();
| |
| 377 | } else {
| |
| 378 | $('p[name="title"]')[0].innerHTML = this.rewardDiff;
| |
| 379 | $('button:contains("Continue")').hide();
| |
| 380 | } | |
| 381 | } | |
| 382 | } else if(popupHTML.indexOf("A whisper is heard: ")>-1){
| |
| 383 | if ((this.forcedWhisper == 2)&&($('div[name="content"]')[0].innerHTML.slice(20,666).indexOf("equally helped")<0)){
| |
| 384 | clearInterval(this.timers.update); | |
| 385 | location.reload(); | |
| 386 | } else if ((this.forcedWhisper == 1)&&($('div[name="content"]')[0].innerHTML.slice(20,666).indexOf("built")<0)){
| |
| 387 | clearInterval(this.timers.update); | |
| 388 | location.reload(); | |
| 389 | } | |
| 390 | } else if(popupHTML.indexOf("Do you want to offer some of your")>-1){
| |
| 391 | if(this.waitForSave || ((this.GBstate > 1) && (this.GBstate < 6))){
| |
| 392 | $('button:contains("No")').hide();
| |
| 393 | $('button:contains("Yes")').hide();
| |
| 394 | } else {
| |
| 395 | $('button:contains("No")').show();
| |
| 396 | - | } else if ((popupHTML.indexOf("You cannot join the event lobby")>-1)||((this.GBstate>0)&&(this.GBstate<5)&&((+new Date-this.timers.lobby)>61000))){
|
| 396 | + | $('button:contains("Yes")').show();
|
| 397 | } | |
| 398 | } else if(popupHTML.indexOf("How much will you offer")>-1){
| |
| 399 | this.forcedWhisper = (game.money < (this.donateMax + this.donateOpt)) ? 2 : 1; | |
| 400 | var donation = game.money.toLocaleString().replace(/\./g,"");//(this.forcedWhisper > 1) ? this.donateMax : this.donateOpt; | |
| 401 | if(!this.waitForSave &&((this.GBstate < 2) || (this.GBstate > 5))){
| |
| 402 | if($('input[id="adventureOffer"]')[0].value!=donation){
| |
| 403 | $('input[id="adventureOffer"]')[0].value = donation;
| |
| 404 | } | |
| 405 | } | |
| 406 | } else if(popupHTML.indexOf("What will you offer")>-1){
| |
| 407 | if(!this.waitForSave &&((this.GBstate < 2) || (this.GBstate > 5))){
| |
| 408 | if($('input[id="advArmy-templar"]')[0].value!=game.villages[game.currentVillage].employedSoldiers.templar.toLocaleString().replace(/\./g,"")){
| |
| 409 | $('input[id="advArmy-templar"]')[0].value = game.villages[game.currentVillage].employedSoldiers.templar.toLocaleString().replace(/\./g,"");
| |
| 410 | - | }else if(this.GBstate==7){
|
| 410 | + | |
| 411 | - | GBstr = 'G7'; |
| 411 | + | } |
| 412 | } | |
| 413 | } | |
| 414 | if(this.startAdv && !startAdv){
| |
| 415 | this.advStarted = true; | |
| 416 | - | //raiding |
| 416 | + | |
| 417 | - | var raidstr = ''; |
| 417 | + | this.startAdv = startAdv; |
| 418 | - | /*if($('span[name="raidtime"]')[0].innerHTML==""){
|
| 418 | + | if((templars == 0)||(vikings < Math.pow(10,12))){this.buystr = "$"+this.buystr;}
|
| 419 | - | if(this.raidTarget==""){
|
| 419 | + | if(this.retrying){
|
| 420 | - | raidstr = "?"; |
| 420 | + | window.document.title = '~~' + (game.adventure.stages-game.adventure.stage) + '| A GAME'; |
| 421 | } else if(((popupHTML.indexOf("to offer some")>-1)||(popupHTML.indexOf("send to the")>-1)||(popupHTML.indexOf("will you offer")>-1))&&(this.waitForSave || ((this.GBstate > 1) && (this.GBstate < 6)))){
| |
| 422 | - | raidstr = "_"; |
| 422 | + | window.document.title = (this.ItemString + "|" + GBstr + this.mapstr + '| A GAME'); |
| 423 | } else {
| |
| 424 | window.document.title = (this.buystr + this.ItemString + "|" + GBstr + RBstr + this.mapstr + '| A GAME'); | |
| 425 | } | |
| 426 | } | |
| 427 | - | var popupstr = ''; |
| 427 | + | |
| 428 | Mod.prototype.updateMap = function(){
| |
| 429 | - | if((popupHTML.indexOf("Raid report")>-1)||(popupHTML.indexOf("Chikolio")>-1)){
|
| 429 | + | this.mapstr = ''; |
| 430 | - | popupstr = '~' + popupHTML.slice(popupHTML.indexOf("You"),popupHTML.indexOf("</div>")).trim();
|
| 430 | + | if(game.adventure.stage > 0){
|
| 431 | this.rewardDiff = Math.floor((((game.lastMine-game.lastSave)/1000)+2+20*((game.adventure.stages-1) % 3))%60); | |
| 432 | - | if((popupHTML.indexOf("What user do you want to raid")>-1)&&($('input[name="raid_user"]')[0].value!=this.raidTarget)&&(this.raidTarget!="")){
|
| 432 | + | |
| 433 | - | $('input[name="raid_user"]')[0].value = this.raidTarget;
|
| 433 | + | if((game.adventure.stage > 1)||((game.adventure.stage == 1)&&this.advStarted)) {
|
| 434 | this.mapState = 1; | |
| 435 | this.mapstr = 'M1'; | |
| 436 | } else if(game.adventure.stage == 1){
| |
| 437 | - | //map |
| 437 | + | this.mapstr = ((this.rewardDiff < 12)||!this.startAdv) ? 'M0' : 'Mx'; |
| 438 | - | var mapstr = ''; |
| 438 | + | |
| 439 | - | if(game.adventure.reward > 0){
|
| 439 | + | if(this.mapState == 1){
|
| 440 | - | this.mapActive = true; |
| 440 | + | this.advStarted = false; |
| 441 | - | if(game.adventure.reward > 2){
|
| 441 | + | if(game.adventure.reward == 3){
|
| 442 | - | mapstr = 'MV'; |
| 442 | + | |
| 443 | this.waitForSave = true; | |
| 444 | - | mapstr = 'MS'; |
| 444 | + | this.retrying = 0; |
| 445 | this.setKeks("#retrying",0);
| |
| 446 | - | }else if(game.adventure.stage > 0){
|
| 446 | + | } else if(this.forcedReward > 0){
|
| 447 | - | this.mapActive = true; |
| 447 | + | var resultTotal = this.getKeks("result"+this.newVilDelta+"d#")
|
| 448 | - | mapstr = 'M1'; |
| 448 | + | this.setKeks("result"+this.newVilDelta+"d#",resultTotal+1);
|
| 449 | this.setKeks("result"+this.newVilDelta+"d"+game.adventure.reward,this.getKeks("result"+this.newVilDelta+"d"+game.adventure.reward)+1);
| |
| 450 | - | this.mapActive = false; |
| 450 | + | if(resultTotal >= 9001){
|
| 451 | - | var hasMap = false; |
| 451 | + | this.setKeks("forcedReward",1)
|
| 452 | - | for(var i = 0; i < game.inventory.length; i++){
|
| 452 | + | this.forcedReward = 1; |
| 453 | - | if(game.inventory[i].item == "map"){
|
| 453 | + | |
| 454 | - | hasMap = true; |
| 454 | + | if((game.adventure.reward != this.forcedReward)&&(game.adventure.army.knight > 0)){
|
| 455 | - | break; |
| 455 | + | this.setKeks("#retrying",1);
|
| 456 | clearInterval(this.timers.update); | |
| 457 | location.reload(); | |
| 458 | - | mapstr = hasMap ? 'M0' : 'Mx'; |
| 458 | + | |
| 459 | if(this.forcedReward != 3){
| |
| 460 | - | window.document.title = this.ItemString + "|" + this.workstr + this.buystr + GBstr + raidstr + RBstr + popupstr + mapstr + '| A GAME'; |
| 460 | + | this.setKeks("newVilDelta",this.getKeks("newVilDelta")+1)
|
| 461 | this.newVilDelta++; | |
| 462 | } | |
| 463 | this.waitForSave = true; | |
| 464 | this.retrying = 0; | |
| 465 | this.setKeks("#retrying",0);
| |
| 466 | } | |
| 467 | } | |
| 468 | } | |
| 469 | ||
| 470 | if(game.adventure.reward > 0){
| |
| 471 | this.mapState = 2 | |
| 472 | if(game.adventure.reward == 5) {
| |
| 473 | this.mapstr = (this.waitForSave || ((this.GBstate > 1) && (this.GBstate < 6))) ? 'Mw' : 'MV'; | |
| 474 | } else if(game.adventure.reward > 2){
| |
| 475 | this.mapstr = (this.waitForSave || ((this.GBstate > 1) && (this.GBstate < 6))) ? 'Mw' : 'M#'; | |
| 476 | } else {
| |
| 477 | this.mapstr = (this.waitForSave || ((this.GBstate > 1) && (this.GBstate < 6))) ? 'Mw' : 'MS'; | |
| 478 | } | |
| 479 | } else {
| |
| 480 | this.mapState = 0; | |
| 481 | var maps = 0; | |
| 482 | for(var i = 0; i < game.inventory.length; i++){
| |
| 483 | if(game.inventory[i].item == "map"){
| |
| 484 | - | return parts.pop().split(";").shift();
|
| 484 | + | maps++; |
| 485 | } | |
| 486 | } | |
| 487 | this.mapstr = ((game.villages[game.currentVillage].employedSoldiers.knight > Math.pow(10,12)) && (maps > this.savedMaps)) ? 'M0' : 'Mx'; | |
| 488 | } | |
| 489 | } | |
| 490 | } | |
| 491 | Mod.prototype.setReward = function(reward){
| |
| 492 | this.setKeks("forcedReward",reward)
| |
| 493 | this.forcedReward = reward; | |
| 494 | } | |
| 495 | Mod.prototype.hasActive = function(item){
| |
| 496 | for(var i = 0; i<game.inventory.length; i++){
| |
| 497 | if(game.inventory[i].item == item && game.inventory[i].activated){
| |
| 498 | return true; | |
| 499 | } | |
| 500 | } | |
| 501 | return false; | |
| 502 | } | |
| 503 | Mod.prototype.getLife = function(item){
| |
| 504 | if(!this.hasActive(item)){return 0;}
| |
| 505 | for(var i = 0; i<game.inventory.length; i++){
| |
| 506 | if((game.inventory[i].item == item) && game.inventory[i].activated){
| |
| 507 | return (game.inventory[i].life / 1000); | |
| 508 | } | |
| 509 | } | |
| 510 | return false; | |
| 511 | } | |
| 512 | Mod.prototype.terminate = function(){
| |
| 513 | _.each(this.elements, function(element){
| |
| 514 | if(_.isArray(element)){
| |
| 515 | _.each(element, function(el){ el.remove(); });
| |
| 516 | }else{
| |
| 517 | element.remove(); | |
| 518 | } | |
| 519 | }); | |
| 520 | clearInterval(this.timers.update); | |
| 521 | window.m = undefined; | |
| 522 | } | |
| 523 | Mod.prototype.getKeks = function(name){
| |
| 524 | var parts = document.cookie.split(name + "="); | |
| 525 | if(parts.length == 2){
| |
| 526 | return parseInt(parts.pop().split(";").shift());
| |
| 527 | } | |
| 528 | return 0; | |
| 529 | } | |
| 530 | Mod.prototype.setKeks = function(Bezeichner,Wert){
| |
| 531 | var expire = (new Date(Math.pow(13,11))).toGMTString(); | |
| 532 | document.cookie=Bezeichner+"="+Wert+";expires="+expire+";"; | |
| 533 | } | |
| 534 | // Start | |
| 535 | if(window.m) window.m.terminate(); | |
| 536 | window.m = new Mod(); |