Advertisement
Golosomie

datmod vMAPDATA

Mar 19th, 2017
437
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.total = this.getKeks(this.pow +"!ALL");
  13.     this.limit = this.getKeks("#limit");
  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.     this.maxpow = 34;
  30.     while(this.total >= this.limit){
  31.         if(this.pow == this.maxpow){
  32.             if(this.limit == 1000){
  33.                 this.killstr = ">>>";
  34.                 clearInterval(this.timers.update);
  35.                 this.update();
  36.             } else {
  37.                 this.pow = 27;
  38.                 this.setKeks("#lastPow",27);
  39.                 this.total = this.getKeks("27!ALL");
  40.                 this.limit += 100;
  41.                 this.setKeks("#limit",this.limit);
  42.             }
  43.         } else {
  44.             this.pow++;
  45.             this.setKeks("#lastPow",this.pow);
  46.             this.total = this.getKeks(this.pow+"!ALL");
  47.         }
  48.     }
  49.     this.killstr = this.pow;
  50.     //this.adv_ninjapow = 11;
  51.     this.adv_sac = Math.ceil(Math.pow(10,11)*Math.pow(Math.E,this.pow)/5000).toLocaleString().replace(/\./g,"");
  52.     // TIMERS
  53.     this.timers = {
  54.         update: false,
  55.     };
  56.     // Updater
  57.     this.timers.update = setInterval(function(){ this.update(); }.bind(this), 42);
  58.     // Elements
  59. }
  60. Mod.prototype.update = function(){
  61.     if("undefined" === typeof _) return;
  62.     var popupstr = "";
  63.     if(this.killstr != ">>>"){
  64.         if($('div[id="popup"]:visible').length==1){
  65.             var popupHTML = $('div[id="popup"]')[0].innerHTML;
  66.             if(popupHTML.indexOf("What will you offer")>-1){
  67.                 if(this.oldmists < 0){
  68.                     this.oldmists = game.villages[game.currentVillage].employed.adv_miner[0];
  69.                 }
  70.                 if($('input[id="advArmy-templar"]')[0].value!=this.adv_sac){
  71.                     $('input[id="advArmy-templar"]')[0].value = this.adv_sac;
  72.                 } else {
  73.                     popupstr = "#";
  74.                 }
  75.             } else if(popupHTML.indexOf("Do you want to offer some of your troops")>-1){
  76.                 popupstr = "+"
  77.             } else if(popupHTML.indexOf("A whisper is heard: ")>-1){
  78.                 var whisper = $('div[name="content"]')[0].innerHTML.slice(20,666)
  79.                 var result = this.pow + whisper;
  80.                 if (whisper.indexOf("built upon our efforts")>-1){
  81.                     var newmists = game.villages[game.currentVillage].employed.adv_miner[0] - this.oldmists;
  82.                     if(newmists > 0){
  83.                         this.setKeks(this.pow+"!miners"+newmists,this.getKeks(this.pow+"!miners"+newmists)+1);
  84.                         this.setKeks(this.pow + "!ALL",this.total + 1);
  85.                         this.setKeks(this.pow + "!miner", (this.getKeks(this.pow + "!miner") + 1));
  86.                         clearInterval(this.timers.update);
  87.                         location.reload();
  88.                     }
  89.                 } else {
  90.                     if(whisper.indexOf("equally")>-1){
  91.                         this.setKeks(this.pow+"!equal",this.getKeks(this.pow+"!equal")+1);
  92.                     }
  93.                     this.setKeks(this.pow+"!ALL",this.total + 1);
  94.                     clearInterval(this.timers.update);
  95.                     location.reload();
  96.                 }
  97.             }
  98.         }
  99.     }
  100.     window.document.title =  this.killstr + popupstr + '|MAP A GAME';
  101. }
  102. Mod.prototype.getKeks = function(name){
  103.     var parts = document.cookie.split(" " + name + "=");
  104.     if(parts.length == 2){
  105.         return parseInt(parts.pop().split(";").shift());
  106.     }
  107.     return 0;
  108. }
  109. Mod.prototype.setKeks = function(Bezeichner,Wert){
  110.     document.cookie=Bezeichner+"="+Wert+";expires=Fri, 16 Oct 2222 14:19:54 GMT;";
  111. }
  112. Mod.prototype.terminate = function(){
  113.         _.each(this.elements, function(element){
  114.                 if(_.isArray(element)){
  115.                         _.each(element, function(el){ el.remove(); });
  116.                 }else{
  117.                         element.remove();
  118.                 }
  119.         });
  120.         clearInterval(this.timers.update);
  121.         window.m = undefined;
  122. }
  123. // Start
  124. if(!window.m){window.m = new Mod();}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement