Advertisement
Golosomie

datmod v6

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