Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- A MAP GAME Mod by Rebin
- javascript:var s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='//pastebin.com/raw.php?i=NgvJm66K';void(0);
- */
- 'use strict';
- function Mod(){
- $('<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js">').appendTo('body');
- jQuery.fn.outerHTML = function(s) { return s ? this.before(s).remove() : jQuery("<p>").append(this.eq(0).clone()).html(); };
- this.pow = this.getKeks("#lastPow");
- this.max = this.getKeks(this.pow +"!max");
- this.min = this.getKeks(this.pow +"!min");
- this.oldmists = -1;
- window.document.title='|MAP A GAME';
- this.initTimer = setInterval(function(){ this.checkInit(); }.bind(this), 20);
- }
- Mod.prototype.checkInit = function(){
- if(typeof(game) != "undefined"){
- if(game.loaded){
- clearInterval(this.initTimer);
- this.init();
- }
- }
- }
- Mod.prototype.init = function(){
- // TIMERS
- this.timers = {
- update: false,
- };
- // Updater
- this.timers.update = setInterval(function(){ this.update(); }.bind(this), 42);
- // check
- if((this.max-this.min)<=100000){
- this.pow--;
- if(this.pow < 5){
- window.document.title = '>>> |MAP A GAME';
- clearInterval(this.timers.update);
- } else {
- this.setKeks("#lastPow",this.pow);
- this.max = this.getKeks(this.pow +"!max");
- this.min = this.getKeks(this.pow +"!min");
- }
- }
- this.advmoney = Math.floor((this.max+this.min)/2);
- this.killstr = Math.ceil(-(Math.log10(this.max-this.min)-5)/Math.log10(0.5)) + " : " + this.pow + "m";
- }
- Mod.prototype.update = function(){
- if("undefined" === typeof _) return;
- var popupstr = "";
- if(this.killstr != ">>>"){
- if($('div[id="popup"]:visible').length==1){
- var popupHTML = $('div[id="popup"]')[0].innerHTML;
- if(popupHTML.indexOf("What will you offer")>-1){
- if(this.oldmists < 0){
- this.oldmists = game.villages[game.currentVillage].employed.adv_miner[0];
- }
- if($('input[id="advArmy-knight"]')[0].value!=this.advmoney){
- $('input[id="advArmy-knight"]')[0].value = this.advmoney;
- } else {
- popupstr = "+";
- }
- } else if(popupHTML.indexOf("Do you want to offer some of your troops")>-1){
- popupstr = "+"
- } else if(popupHTML.indexOf("A whisper is heard: ")>-1){
- var whisper = $('div[name="content"]')[0].innerHTML.slice(20,666)
- if (whisper.indexOf("built upon our efforts")>-1){
- var newmists = game.villages[game.currentVillage].employed.adv_miner[0] - this.oldmists;
- if(newmists == (this.pow - 1)){
- this.setKeks(this.pow +"!min", this.advmoney);
- } else if(newmists == this.pow){
- this.setKeks(this.pow +"!max", this.advmoney);
- }
- if(newmists > 0){
- clearInterval(this.timers.update);
- location.reload();
- }
- } else {
- clearInterval(this.timers.update);
- location.reload();
- }
- }
- }
- }
- window.document.title = this.killstr + popupstr + '|MAP A GAME';
- }
- Mod.prototype.getKeks = function(name){
- var parts = document.cookie.split(" " + name + "=");
- if(parts.length == 2){
- return parseInt(parts.pop().split(";").shift());
- }
- return 0;
- }
- Mod.prototype.setKeks = function(Bezeichner,Wert){
- document.cookie=Bezeichner+"="+Wert+";expires=Fri, 16 Oct 2222 14:19:54 GMT;";
- }
- Mod.prototype.terminate = function(){
- _.each(this.elements, function(element){
- if(_.isArray(element)){
- _.each(element, function(el){ el.remove(); });
- }else{
- element.remove();
- }
- });
- clearInterval(this.timers.update);
- window.m = undefined;
- }
- // Start
- if(!window.m){window.m = new Mod();}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement