Advertisement
Golosomie

datmod MIIAAAUUUU

Apr 2nd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. A MAP GAME Mod by Rebin
  3.  
  4. javascript:var s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='//pastebin.com/raw.php?i=NgvJm66K';void(0);
  5. */
  6.  
  7. 'use strict';
  8. function Mod(){
  9.     $('<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js">').appendTo('body');
  10.     jQuery.fn.outerHTML = function(s) { return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); };
  11.     this.pow = this.getKeks("#lastPow");
  12.     this.max = this.getKeks(this.pow +"!max");
  13.     this.min = this.getKeks(this.pow +"!min");
  14.     this.oldmists = -1;
  15.     window.document.title='|MAP A GAME';
  16.     this.initTimer = setInterval(function(){ this.checkInit(); }.bind(this), 20);
  17. }
  18.  
  19. Mod.prototype.checkInit = function(){
  20.     if(typeof(game) != "undefined"){
  21.         if(game.loaded){
  22.             clearInterval(this.initTimer);
  23.             this.init();
  24.         }
  25.     }
  26. }
  27.  
  28. Mod.prototype.init = function(){
  29.     // TIMERS
  30.     this.timers = {
  31.         update: false,
  32.     };
  33.     // Updater
  34.     this.timers.update = setInterval(function(){ this.update(); }.bind(this), 42);
  35.     // check
  36.     if((this.max-this.min)<=100000){
  37.         this.pow--;
  38.         if(this.pow < 5){
  39.             window.document.title =  '>>> |MAP A GAME';
  40.             clearInterval(this.timers.update);
  41.         } else {
  42.             this.setKeks("#lastPow",this.pow);
  43.             this.max = this.getKeks(this.pow +"!max");
  44.             this.min = this.getKeks(this.pow +"!min");
  45.         }
  46.     }
  47.     this.advmoney = Math.floor((this.max+this.min)/2);
  48.     this.killstr = Math.ceil(-(Math.log10(this.max-this.min)-5)/Math.log10(0.5)) + " : " + this.pow + "m";
  49. }
  50. Mod.prototype.update = function(){
  51.     if("undefined" === typeof _) return;
  52.     var popupstr = "";
  53.     if(this.killstr != ">>>"){
  54.         if($('div[id="popup"]:visible').length==1){
  55.             var popupHTML = $('div[id="popup"]')[0].innerHTML;
  56.             if(popupHTML.indexOf("What will you offer")>-1){
  57.                 if(this.oldmists < 0){
  58.                     this.oldmists = game.villages[game.currentVillage].employed.adv_miner[0];
  59.                 }
  60.                 if($('input[id="advArmy-knight"]')[0].value!=this.advmoney){
  61.                     $('input[id="advArmy-knight"]')[0].value = this.advmoney;
  62.                 } else {
  63.                     popupstr = "+";
  64.                 }
  65.             } else if(popupHTML.indexOf("Do you want to offer some of your troops")>-1){
  66.                 popupstr = "+"
  67.             } else if(popupHTML.indexOf("A whisper is heard: ")>-1){
  68.                 var whisper = $('div[name="content"]')[0].innerHTML.slice(20,666)
  69.                 if (whisper.indexOf("built upon our efforts")>-1){
  70.                     var newmists = game.villages[game.currentVillage].employed.adv_miner[0] - this.oldmists;
  71.                     if(newmists == (this.pow - 1)){
  72.                         this.setKeks(this.pow +"!min", this.advmoney);
  73.                     } else if(newmists == this.pow){
  74.                         this.setKeks(this.pow +"!max", this.advmoney);
  75.                     }
  76.                     if(newmists > 0){
  77.                         clearInterval(this.timers.update);
  78.                         location.reload();
  79.                     }
  80.                 } else {
  81.                     clearInterval(this.timers.update);
  82.                     location.reload();
  83.                 }
  84.             }
  85.         }
  86.     }
  87.     window.document.title =  this.killstr + popupstr + '|MAP A GAME';
  88. }
  89. Mod.prototype.getKeks = function(name){
  90.     var parts = document.cookie.split(" " + name + "=");
  91.     if(parts.length == 2){
  92.         return parseInt(parts.pop().split(";").shift());
  93.     }
  94.     return 0;
  95. }
  96. Mod.prototype.setKeks = function(Bezeichner,Wert){
  97.     document.cookie=Bezeichner+"="+Wert+";expires=Fri, 16 Oct 2222 14:19:54 GMT;";
  98. }
  99. Mod.prototype.terminate = function(){
  100.         _.each(this.elements, function(element){
  101.                 if(_.isArray(element)){
  102.                         _.each(element, function(el){ el.remove(); });
  103.                 }else{
  104.                         element.remove();
  105.                 }
  106.         });
  107.         clearInterval(this.timers.update);
  108.         window.m = undefined;
  109. }
  110. // Start
  111. if(!window.m){window.m = new Mod();}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement