Advertisement
Golosomie

datmod v8 NOVILLAGE

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