Advertisement
Golosomie

datmod v8

Apr 6th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.42 KB | None | 0 0
  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. 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";
  13. document.getElementsByName("items_holder")[0].style['margin-bottom'] = "0px";
  14. document.getElementById("vault_container").style.display = "none";
  15. document.getElementById("vault_display").style.display = "none";
  16. document.getElementById("upgrades_container").style.display = "none";
  17. document.getElementById("money_display").style.display = "none";
  18. $('div[name="characterIcon"]')[0].style.display="none";
  19. $('div[name="characterStats"]')[0].style.display="none";
  20. $('div[name="players"]')[0].style.display="none";
  21. $('h3:contains("Capacity")')[0].style.display="none";
  22. this.oldOPM = 0;
  23. this.buystr = "";
  24. this.refreshstr = "";
  25. this.raidTarget = "";
  26. this.money = 0;
  27. this.workstr = "";
  28. this.RBstate = 0; // 2 = RBcd 1 = RBwait 0 = RBgo 3 = lolwas
  29. this.workerID = 88;
  30. this.allsteves = false;
  31. this.c = 1000;
  32. this.limits= new Array(1000,900,800,700,600,600);
  33. this.price= new Array(3000,15000,50000,200000,5000000,15000000);
  34. this.diffs= new Array(6,29,28,0,91,119);
  35. this.oldScnts = 0;
  36. this.oldSaveDiff = 0;
  37. this.buildstr = "";
  38. this.scMoney = 0;
  39. this.cWorker = true;
  40. this.GBstate = 7; // 0 = GBwait 1 = GBopen 2=GBlobby 3 = 3=GBrunning
  41. this.timers = {
  42. update: false,
  43. lastUpdate: +new Date,
  44. oneSecondUpdate: 0,
  45. startTimer: +new Date,
  46. lobby: 0,
  47. };
  48. // Updater
  49. this.timers.update = setInterval(function(){ this.update(); }.bind(this), 100);
  50. // Elements
  51. this.elements = {
  52. 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>'),
  53. };
  54. $('<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js">').appendTo('body')
  55. $('#gamecontainer').prepend(this.elements.aboutBox);
  56. }
  57.  
  58.  
  59. Mod.prototype.update = function(){
  60. if("undefined" === typeof _) return;
  61. var delta = (+new Date - this.timers.lastUpdate);
  62. this.timers.oneSecondUpdate += delta;
  63. if(this.timers.oneSecondUpdate > 1000){
  64. this.timers.oneSecondUpdate = 0;
  65. //var timeInfo = $('span[name="time"]').text().split(" ");
  66. //if((timeInfo[1].indexOf('minute')>-1) && (parseInt(timeInfo[0])>=3) && ((+new Date-this.timers.startTimer)>90000)){
  67. // this.refreshstr = "RR";
  68. //}
  69. this.updateStats();
  70. this.calcWorkers();
  71. }
  72. this.updateTitle();
  73. this.timers.lastUpdate = +new Date;
  74. }
  75.  
  76. Mod.prototype.calcWorkers = function(){
  77. this.workstr = '';
  78. if(!this.allsteves){
  79. if(this.cWorker){
  80. var actualWorkers = new Array(0,0,0,0,0,0);
  81. for(var i = 0; i<6; i++){
  82. actualWorkers[i]=parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0])+this.diffs[i];
  83. }
  84. var smallest = 1337;
  85. for(var i = 5; i>=0; i--){
  86. if((actualWorkers[i]<smallest)&&(parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0])<this.limits[i])){
  87. smallest = actualWorkers[i];
  88. this.workerID = i;
  89. }
  90. }
  91. if(smallest==1337){
  92. this.allsteves=true;
  93. }
  94. }
  95. if(!this.allsteves){
  96. this.cWorker = false;
  97. if(parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''))>=(this.price[this.workerID] * (Math.pow(1.025, parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0]))))){
  98. this.cWorker = true;
  99. this.workstr = "#"+this.workerID;
  100. }else if(parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''))>=(0.5 * this.price[this.workerID] * (Math.pow(1.025, parseInt($('span[name="owned"]')[i].innerHTML.split(" ")[0]))))){
  101. this.cWorker = true;
  102. this.workstr = "$"+this.workerID;
  103. }
  104. }
  105. }
  106. }
  107.  
  108. Mod.prototype.updateStats = function(){
  109. var efffact = (Math.pow(1.01,parseInt($('span[name="owned"]')[12].innerHTML))-1)*parseFloat($('span[id="village-happiness"]')[0].innerHTML)/100+1;
  110. var fontstr = "";
  111. var fontstr2 = "";
  112. for(var i = 0; i < $('span[name="item_details"]').length; i++){
  113. if(($('span[name="item_details"]')[i].innerHTML.indexOf("Research Boost")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
  114. efffact *= 2;
  115. fontstr = "<font color='#00FF00'>";
  116. fontstr2 = "</font>";
  117. }else if(($('span[name="item_details"]')[i].innerHTML.indexOf("Diminishing Research")>-1) && ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1)) {
  118. efffact *= 2;
  119. fontstr = "<font color='#00FF00'>";
  120. fontstr2 = "</font>";
  121. }
  122. }
  123. var scnts = parseInt($('span[name="scientists_owned"]').text())*efffact;
  124. var ropm = parseInt($('td[name="wopmtimesresearch"]').text().replace(/,/g,""));
  125. var scientistTime = parseInt($('span[name="scientistTime"]').text());
  126. var bossCurrency = parseInt($('td[id="bc_display"]').text().replace(/,/g,""));
  127. var money = parseInt($('td[id="money_display"]').text().replace(/,/g,'').replace('$',''));
  128. //var
  129. if((ropm != this.oldOPM) || (scnts != this.oldScnts)){
  130. var eff = this.c*ropm/(scientistTime*scnts);
  131. var rtime = Math.floor((Math.floor(scientistTime * scnts * Math.ceil(eff) / this.c) - ropm) * Math.ceil(eff) / 60);
  132. //var ttime = Math.floor(100*(Math.pow(Math.ceil(eff),2)*27.5/this.c))/100;
  133. var buy = Math.ceil((Math.ceil(scnts*(eff/Math.floor(eff)-1)) - bossCurrency)/efffact);
  134. var sas = this.c/(Math.floor(eff)*Math.ceil(eff)*scientistTime*efffact);
  135. var suus = (sas>=0.75) ? "NEVAR!" : Math.ceil(10*buy/(3600*(0.75-sas)))/10+"h"
  136. if(buy<0){
  137. this.buystr = ">";
  138. document.getElementById("mod").innerHTML = "<br><br>" + fontstr + "eff: " + Math.round(100000*eff)/100000 + "s<br>" + fontstr2 + "<font color='#FF0000'>" + rtime + "min<br>KAUF MIT BC</font>";
  139. }else if((this.scMoney>0)&&(Math.ceil(2000*this.scMoney*(Math.pow(1.0005,buy)-1)-money)<0)){
  140. this.buystr = "<";
  141. document.getElementById("mod").innerHTML = "<br><br>" + fontstr + "eff: " + Math.round(100000*eff)/100000 + "s<br>" + fontstr2 + "<font color='#FF0000'>" + rtime + "min<br>"+buy+"\u262d - "+ suus + "<br>KAUF MIT $$$</font>";
  142. }else{
  143. this.buystr = "";
  144. document.getElementById("mod").innerHTML = "<br><br>" + fontstr + "eff: " + Math.round(100000*eff)/100000 + "s<br>" + fontstr2 + rtime + "min<br>"+buy+"\u262d - "+suus;
  145. }
  146. this.oldScnts = scnts;
  147. this.oldOPM = ropm;
  148. }
  149. if(this.buystr==""){
  150. if(money>(Math.pow(1.2,parseInt($('span[name="owned"]')[14].innerHTML))*800000000000)){
  151. this.buystr = ")";
  152. //}else if(money>(Math.pow(1.2,parseInt($('span[name="owned"]')[12].innerHTML))*560000000000)){
  153. // this.buystr = "(";
  154. } else if(parseInt($('span[name="owned"]')[8].innerHTML.replace(/,/g,""))<Math.pow(10,10)){
  155. this.buystr = "/";
  156. } else if(parseInt($('span[name="owned"]')[9].innerHTML.replace(/,/g,""))<Math.pow(10,9)){
  157. this.buystr = "\\";
  158. }
  159. }
  160. }
  161.  
  162. Mod.prototype.updateTitle = function(){
  163. //RB
  164. if($('span[name="timer"][style="font-size: 19px; display: inline;"').length==1){
  165. this.RBstate = 2;
  166. } else if((this.RBstate==2)&&($('div[id="popup"]:contains("SCENARIO")').length==1)) {
  167. this.RBstate = 3;
  168. } 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)"))) {
  169. this.RBstate = 1;
  170. } else if((this.RBstate==2)||(($('div[id="popup"]:contains("SCENARIO")').length==0)&&(this.RBstate==3))) {
  171. this.RBstate = 0;
  172. }
  173. var RBstr = '';
  174. if($('body')[0].style["background-color"]!=="rgb(15, 39, 41)"){
  175. RBstr = "PP";
  176. }else if((document.getElementById("mining_container").style.display!=="none")&&($('body')[0].style["background-color"]=="rgb(15, 39, 41)")){
  177. RBstr = "R3";
  178. }else if(this.RBstate==2){
  179. RBstr = "R2";
  180. } else if(this.RBstate==1){
  181. RBstr = "R1";
  182. } else if((this.RBstate==0)||(this.RBstate==3)){
  183. RBstr = "R0";
  184. }
  185. var popupHTML = $('div[id="popup"]')[0].innerHTML;
  186. //GB
  187. if($('img[name="globalBossImg"]:visible').length==1){
  188. this.GBstate = 3;
  189. } else if ($('img[src="game/img/icons/globalBoss_big.png"]:visible').length==1){
  190. this.GBstate = 2;
  191. } else if (($('span[name="timeRemaining"]').text()==("JOIN"||"LEAVE"))&&((this.GBstate==2)||(this.GBstate==0))){
  192. if(this.GBstate==0){this.timers.lobby = +new Date;}
  193. this.GBstate = 1;
  194. } else if (($('span[name="timeRemaining"]').text().indexOf("min")>-1)||($('span[name="timeRemaining"]').text().indexOf("sec")>-1)){
  195. this.GBstate = 0;
  196. } else if ((popupHTML.indexOf("You cannot join the event lobby")>-1)||((this.GBstate>0)&&(this.GBstate<5)&&((+new Date-this.timers.lobby)>61000))){
  197. this.GBstate = 6;
  198. }
  199. var GBstr = '';
  200. if(this.GBstate==0){
  201. GBstr = 'G0';
  202. }else if(this.GBstate==1){
  203. GBstr = 'G1';
  204. if((+new Date-this.timers.lobby)>54000){GBstr='G3';}
  205. }else if(this.GBstate==2){
  206. GBstr = 'G2';
  207. if((+new Date-this.timers.lobby)>54000){GBstr='G4';}
  208. }else if(this.GBstate==3){
  209. GBstr = 'G5';
  210. }else if(this.GBstate==7){
  211. GBstr = 'G7';
  212. }else if(this.GBstate==6){
  213. GBstr = 'G6';
  214. }
  215. //Inventory
  216. var ItemString = '';
  217. for(var i = 0; i < $('span[name="item_details"]').length; i++){
  218. var activated = ($('span[name="item_details"]')[i].innerHTML.indexOf("activate")==-1);
  219. if($('span[name="item_details"]')[i].innerHTML.indexOf("Ring of Efficiency")>-1) {
  220. ItemString += activated ? ':' : '.';
  221. }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Cheap Labor")>-1) {
  222. ItemString += activated ? 'I' : 'i';
  223. }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Double XP")>-1) {
  224. ItemString += '%';
  225. }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Attack Boost")>-1) {
  226. ItemString += '&';
  227. }else if($('span[name="item_details"]')[i].innerHTML.indexOf("Godspear Fragment")>-1) {
  228. ItemString += activated ? ',' : '*';
  229. }else{
  230. ItemString += activated ? ',' : '!';
  231. }
  232. }
  233. //raiding
  234. var raidstr = '';
  235. if($('span[name="raidtime"]')[0].innerHTML==""){
  236. if(this.raidTarget==""){
  237. raidstr = "?";
  238. } else {
  239. raidstr = "_";
  240. }
  241. }
  242. //popup
  243. var popupstr = '';
  244. if($('div[id="popup"]:visible').length==1){
  245. if(popupHTML.indexOf("Raid report")>-1){
  246. popupstr = '~' + popupHTML.slice(popupHTML.indexOf("You"),popupHTML.indexOf("</div>")).trim();
  247. } else {
  248. popupstr = '^';
  249. if(popupHTML.indexOf("You are already fighting a boss")>-1){
  250. this.RBstate==1;
  251. } else if((popupHTML.indexOf("What user do you want to raid")>-1)&&($('input[name="raid_user"]')[0].value!=this.raidTarget)&&(this.raidTarget!="")){
  252. $('input[name="raid_user"]')[0].value = this.raidTarget;
  253. }
  254. }
  255. }
  256. //scMoney
  257. var scstr = '';
  258. if($('span[name="scientists_price"]')[0].innerHTML.indexOf("$")==0){
  259. scstr = '@';
  260. this.scMoney = parseInt($('span[name="scientists_price"]').text().replace(/,/g,'').replace('$',''));
  261. } else if(this.scMoney==0){
  262. scstr = '=';
  263. }
  264. window.document.title = ItemString + "|" + this.refreshstr + this.workstr + scstr + this.buystr + GBstr + raidstr + RBstr + popupstr + '| A GAME';
  265. }
  266. Mod.prototype.terminate = function(){
  267. _.each(this.elements, function(element){
  268. if(_.isArray(element)){
  269. _.each(element, function(el){ el.remove(); });
  270. }else{
  271. element.remove();
  272. }
  273. });
  274. clearInterval(this.timers.update);
  275. window.mod = undefined;
  276. }
  277.  
  278. // Start
  279. if(window.mod) window.mod.terminate();
  280. window.mod = new Mod();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement