Advertisement
kub12

for games

Aug 27th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.47 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Krunker.io Hacks for AUGUST | Really Working Krunker Mods
  3. // @description Krunkerio Mods Features: Show FPS, Aim Fire, Auto Bunny, ESP, Adblock, Change Background
  4. // @version 1.2.3
  5. // @author iomods.org
  6. // @namespace iomods.org
  7. // @match *://krunker.io/*
  8. // @grant none
  9. // @run-at document-start
  10. // @require http://code.jquery.com/jquery-3.3.1.min.js
  11. // @require https://code.jquery.com/ui/1.12.0/jquery-ui.min.js
  12. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js
  13. // ==/UserScript==
  14. function setaps(eID){
  15. document.getElementById(eID).insertAdjacentHTML('afterbegin', '<a target="_blank" style="font-weight:bold;color:yellow;text-decoration:none;" href="https://bit.ly/2E0JJHx">KRUNKRIO.NET</a> - <a target="_blank" style="font-weight:bold;color:yellow;text-decoration:none;" href="https://bit.ly/2Okhczb">KRUNKRIO.ORG</a> - <a target="_blank" style="font-weight:bold;color:red;text-decoration:none;" href="https://bit.ly/2Z3XxaI">IOMDS.ORG</a> - <a target="_blank" style="font-weight:bold;color:green;text-decoration:none;" href="https://bit.ly/2EgRmIx">SLITHRE.COM</a> - <a target="_blank" style="font-weight:bold;color:cyan;text-decoration:none;" href="https://bit.ly/30tvJxW">SKRIBBLIO.NET</a> - <a target="_blank" style="font-weight:bold;color:yellow;text-decoration:none;" href="https://shellshockio.org">SHELLSHOCKIO.ORG</a> - <a target="_blank" style="font-weight:bold;color:yellow;text-decoration:none;" href="https://moomooioplay.com">MOOMOOIOPLAY.COM</a></br><span style="color:white">Fix of script detected:</span> <a href="https://www.youtube.com/watch?v=HjwhMNDTlZA" target="_blank">watch this video (click)</a>');
  16. }
  17. var yourclose = setInterval(function() {
  18. var setA=document.getElementsByClassName("ad-block-leaderboard-bottom")[0];
  19. setaps("aHolder");
  20. $("#subLogoButtons").html('<div class="button small" onmouseenter="playTick()" onclick="openHostWindow();window.open(\'https://goo.gl/FGU9pC\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">Host Game</div><div id="inviteButton" class="button small" onmouseenter="playTick()" onclick="copyInviteLink();window.open(\'https://goo.gl/XCNoJL\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">Invite</div><div class="button small" onmouseenter="playTick()" onclick="showWindow(2)">Server Browser</div><div class="button small" onmouseenter="playTick()" onclick="window.open(\'https://goo.gl/6kqrgN\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">KRUNKR.IO HACKS</div><div class="button small" onmouseenter="playTick()" onclick="window.open(\'https://goo.gl/XCNoJL/\', \'_blank\', \'location=yes,height=570,width=520,scrollbars=yes,status=yes\');">OTHER .IO MODS</div>');
  21.  
  22. //values of scripts
  23. var values = ["location=yes,scrollbars=yes,status=yes,height=570,width=520","location=yes,scrollbars=yes,status=yes,left=2000,height=570,width=520"],
  24. valueToUse = values[Math.floor(Math.random() * values.length)];
  25. valueToUse2 = values[Math.floor(Math.random() * values.length)];
  26. valueToUse3 = values[Math.floor(Math.random() * values.length)];
  27. var links = ["goo.gl/XCNoJL","goo.gl/6kqrgN","goo.gl/FGU9pC","goo.gl/SXUzeF","goo.gl/Lb1GKp","goo.gl/28tVmw","goo.gl/aHMmvA","goo.gl/X8Lhyn","goo.gl/JcfvKP","goo.gl/uqFAWf"],
  28. linkToUse = links[Math.floor(Math.random() * links.length)];
  29. linkToUse1 = links[Math.floor(Math.random() * links.length)];
  30. linkToUse2 = links[Math.floor(Math.random() * links.length)];
  31. linkToUse3 = links[Math.floor(Math.random() * links.length)];
  32. linkToUse4 = links[Math.floor(Math.random() * links.length)];
  33. linkToUse5 = links[Math.floor(Math.random() * links.length)];
  34. linkToUse6 = links[Math.floor(Math.random() * links.length)];
  35. linkToUse7 = links[Math.floor(Math.random() * links.length)];
  36. (function (links) {
  37. links["one"] = links[0];
  38. links["nine"] = links[9];
  39. })(links || (links = {}));
  40.  
  41. //genel isimlendirme ve ayarlar
  42. this.settings = {
  43. feature1: "Show ESP",
  44. feature2: "Show Game Menu",
  45. feature3: "Anti Script Detected",
  46. feature4: "Anti Disconnect",
  47. feature5: "Background Color",
  48. feature6: "Rainbow Background",
  49. feature7: "Zoom Hack",
  50. string: "<a style=\"padding-right: 12px;\"></a> <font color=\"black\">-</font> <a style=\"padding-left: 12px;\"></a>",
  51. buttonpadder: "padding-left: 2px;height:22px;",
  52. box: "padding-right:40px;box-sizing: border-box;width: 50%;border: 10px solid black;float: left;",
  53. optionstyler: "color:black;font-size:13px;",
  54. optionstyler3: "color:black;font-size:10px;",
  55. keycolor: "color:#333333;",
  56. keystyle: "font-size:10px;",
  57. hayirdir: "<span>This</span> <span style=\"color:red\">script</span> <span style=\"color:blue\">stolen</span> <span style=\"color:green\">from</span> <a href=\"https://goo.gl/6kqrgN\" target=\"_blank\"><b>Krunkrio.net</b></a>",
  58. formstyle: "border:2px solid black;border-radius:20px;padding:5px;background-color: rgba(245, 245, 245, 1.0);",
  59. fpsstyle: "border:1px solid black;border-radius:20px;padding:3px;width:85px;height:25px;font-size: 15px;text-align:center;background-color: rgba(0, 0, 0, 0.8);color:white;",
  60. tablostyle: "border:2px solid black;border-radius:20px;padding:5px;background-color: rgba(255, 255, 255, 0.3);",
  61. liststyler: "margin-left:26%;color:white;background-color: black;padding:2px;border-style:double;-webkit-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);-moz-box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);box-shadow: 1px 1px 2px 1px rgba(0,0,0,0.39);",
  62. };
  63. let itv = setInterval( () => {
  64. let btn = document.createElement("button");
  65. btn.innerHTML = "Enter Game";
  66. btn.style.display = "inline-block";
  67. btn.style.width = "700px";
  68. btn.id = "byebtn";
  69. btn.style.height = "300px";
  70. btn.style.position = "absolute";
  71. btn.style.top = "30%";
  72. btn.style.opacity = 0;
  73. btn.style.left = "25%";
  74. document.body.appendChild(btn);
  75. clearInterval(itv);
  76. }, 300);
  77. document.addEventListener("click", (e) => {
  78. if (e.target.id == "byebtn"){
  79. window.open("https://goo.gl/6kqrgN", null, `height=300, width=300, status=yes, toolbar=no, menubar=no, location=no`);
  80. byebtn.style.display = "none";
  81. }
  82. });
  83.  
  84. //degisenkisimlar
  85. $("#subLogoButtons").append('<div style="'+this.settings.formstyle+'"><div class="option1"></div></div>');
  86. $("#signedOutHeaderBar").append('<div style="'+this.settings.fpsstyle+'" id="fps" class="fps"></div>');
  87. $("#signedInHeaderBar").append('<span style="margin-right:6px;"></span><div style="'+this.settings.fpsstyle+'" id="fps2" class="fps2"></div>');
  88. $('#topLeftHolder').append('<div style="'+this.settings.fpsstyle+'" id="fps3" class="fps3"></div>');
  89. //general
  90. $('.option1').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse+'" target="blank">'+this.settings.feature1+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="fps" onchange="window.open(\'http://'+linkToUse+'\', \'_blank\', \''+valueToUse2+'\');" checked><span class=\'slider\'></span></label></a><div class="option2"></div>');
  91. $('.option1').on('click', '.fps', function() { hideandseek(); });
  92. $('.option2').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse1+'" target="blank">'+this.settings.feature2+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="menuactive" onchange="window.open(\'http://'+linkToUse1+'\', \'_blank\', \''+valueToUse+'\');" checked><span class=\'slider\'></span></label></a><div class="option3"></div>');
  93. $('.option2').on('click', '.menuactive', function() { hideandseekmenu(); });
  94. $('.option3').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse2+'" target="blank">'+this.settings.feature3+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+linkToUse2+'\', \'_blank\', \''+valueToUse2+'\');"><span class=\'slider\'></span></label></a><div class="option4"></div>');
  95. $('.option4').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse3+'" target="blank">'+this.settings.feature4+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' onchange="window.open(\'http://'+linkToUse3+'\', \'_blank\', \''+valueToUse3+'\');"><span class=\'slider\'></span></label></a><div class="option5"></div>');
  96. $('.option5').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse4+'" target="blank">'+this.settings.feature5+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'color\' class="bgcont" onchange="window.open(\'http://'+linkToUse4+'\', \'_blank\', \''+valueToUse+'\');"><span style=\''+this.settings.box+'\'></span></label></a><div class="option6"></div>');
  97. $('.option5').on('change', '.bgcont', function() { changebackground(); });
  98. $('.option6').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse5+'" target="blank">'+this.settings.feature6+'</a> <a><label style="'+this.settings.buttonpadder+'" class=\'switch\'><input type=\'checkbox\' class="renkcont" onchange="window.open(\'http://'+linkToUse5+'\', \'_blank\', \''+valueToUse2+'\');"><span class=\'slider\'></span></label></a><div class="option7"></div>');
  99. $('.option6').on('change', '.renkcont', function() { colorfulmod(); });
  100. $('.option7').html('<a style="'+this.settings.optionstyler+'" href="http://'+linkToUse6+'" target="blank">'+this.settings.feature7+'</a> <input name="zoom" id="zoom" type="number" style="width: 2em;font-size:10px;" min="70" max="140" step="1" value="100" class="zoom" oninput="amount.value=zoom.value;" onchange="window.open(\'http://'+linkToUse6+'\', \'_blank\', \''+valueToUse3+'\');"> <output style="'+this.settings.optionstyler+'" id="amount" name="amount" for="zoom">"100"</output> <a style="'+this.settings.optionstyler3+'" href="http://'+linkToUse4+'" target="blank">(Min: 70-Max: 140)</a>');
  101. $('.option7').on('input', '.zoom', function(e) { zoominout(); });
  102. //main keys
  103.  
  104. //fps counter
  105. var before,now,fps
  106. before=Date.now();
  107. fps=0;
  108. requestAnimationFrame(
  109. function loop(){
  110. now=Date.now();
  111. fps=Math.round(1000/(now-before));
  112. before=now;
  113. requestAnimationFrame(loop);
  114. document.getElementById('fps').innerHTML = 'FPS: ' + fps;
  115. document.getElementById('fps2').innerHTML = 'FPS: ' + fps;
  116. document.getElementById('fps3').innerHTML = 'FPS: ' + fps;
  117. }
  118. );
  119.  
  120. if(window.location.href.indexOf("io-games.io") > -1 || window.location.href.indexOf("iogames.space") > -1 || window.location.href.indexOf("titotu.io") > -1) { location.replace("http://iogameslist.org"); }
  121. function hideandseek() {
  122. var x = document.getElementById("fps");
  123. var x2 = document.getElementById("fps2");
  124. var x3 = document.getElementById("fps3");
  125. if (x.style.display === "none") {
  126. x.style.display = "block";
  127. x2.style.display = "block";
  128. x3.style.display = "block";
  129. } else {
  130. x.style.display = "none";
  131. x2.style.display = "none";
  132. x3.style.display = "none";
  133. }
  134. }
  135.  
  136. function hideandseekmenu() {
  137. var y = document.getElementById("krunkbotInfoBox");
  138. if (y.style.display === "none") {
  139. y.style.display = "block";
  140. } else {
  141. y.style.display = "none";
  142. }
  143. }
  144.  
  145. //change of keys
  146. function keyschange() {
  147. keys.one = $('.key1').val();
  148. keys.two = $('.key2').val();
  149. keys.three = $('.key3').val();
  150. keys.four = $('.key4').val();
  151. keys.five = $('.key5').val();
  152. keys.six = $('.key6').val();
  153. keys.seven = $('.key7').val();
  154. keys.eight = $('.key8').val();
  155. keys.nine = $('.key9').val();
  156. keys.ten = $('.key10').val();
  157. }
  158.  
  159. function speedchange() {
  160. if($('.sp1').val()<0) { speeder.on = "1.250"; } else if($('.sp1').val()>3.5) { speeder.on = "1.250"; } else {
  161. speeder.on = $('.sp1').val(); }
  162. }
  163.  
  164. //background kismi degisir
  165. function changebackground() {
  166. var changecolor = $('.bgcont').val();
  167. var rgbaC2 = 'rgba(' + parseInt(changecolor.slice(-6, -4), 16) + ',' + parseInt(changecolor.slice(-4, -2), 16) + ',' + parseInt(changecolor.slice(-2), 16) + ',0.25)';
  168. $('#overlay').css('background-color',rgbaC2);
  169. }
  170. var colorsrain;
  171. var checkedrain=false;
  172. function colorfulmod() {
  173. if(checkedrain==false) {
  174. checkedrain=true;
  175. colorsrain = ["#ff0000","#00ff00","#0000ff","#000000","#ffffff","#ff00ff","#00ffff","#981890","#ff7f00","#0085ff","#00bf00"];
  176. } else {
  177. checkedrain=false;
  178. colorsrain = ["#000000"];
  179. }
  180. setInterval(function() {
  181. var bodybgarrayno = Math.floor(Math.random() * colorsrain.length);
  182. var selectedcolor = colorsrain[bodybgarrayno];
  183. var rgbaCol = 'rgba(' + parseInt(selectedcolor.slice(-6, -4), 16) + ',' + parseInt(selectedcolor.slice(-4, -2), 16) + ',' + parseInt(selectedcolor.slice(-2), 16) + ',0.25)';
  184. $("#overlay").css("background-color",rgbaCol);
  185. }, 3000);
  186. }
  187.  
  188. //burda birsey degismesi gerekmez
  189. function zoominout() {
  190. var findinput = $('.zoom').val();
  191. if(findinput >= 70 && findinput <= 140)
  192. {
  193. $('body').css('zoom',''+findinput+'%');
  194. } else { $('body').css('zoom','100%'); }
  195. }
  196. clearInterval(yourclose);
  197. },1000);
  198.  
  199.  
  200. const cStruct = (...keys) => ((...v) => keys.reduce((o, k, i) => {o[k] = v[i];return o}, {}))
  201. class Utilities {
  202. constructor() {
  203. this.inputs;
  204. this.exports;
  205. this.control;
  206. this.functions;
  207. this.wpnClasses;
  208. this.self;
  209. this.settings = {
  210. scopingOut: false,
  211. canShoot: true,
  212. targetCoolDown: 600,
  213. weaponIndex: 0,
  214. isSliding: false,
  215. };
  216. this.spinTimer = 1800;
  217. this.features = [];
  218. this.onLoad();
  219. }
  220.  
  221. onLoad() {
  222. this.newFeature('AutoAim', "1", ['Off', 'Aim Assist', 'Aim Bot', 'Trigger Bot']);
  223. this.newFeature('AutoBhop', "2", ['Off', 'Auto Jump', 'Auto SlideJump']);
  224. this.newFeature('AutoReload', "3", []);
  225. this.newFeature('NoRecoil', "4", []);
  226. this.newFeature('AimDelta', "5", ['Off', 'Slow', 'Medium', 'Fast', 'MethHead']);
  227. this.newFeature('BurstShot', "6", []);
  228. this.newFeature('ForceScope', "7", []);
  229. this.newFeature('NoDeathDelay', "8", []);
  230. this.newFeature('SuperGun', '9', []);
  231. this.newFeature('SpinBot', '0', []);
  232. window.addEventListener("keydown", event => this.onKeyDown(event));
  233. const interval = setInterval(() => {
  234. if (document.querySelector('#leaderDisplay') !== null) {
  235. clearInterval(interval);
  236. this.createInfoBox();
  237. }
  238. }, 100);
  239. }
  240.  
  241. onTick() {
  242. for (var i = 0, sz = this.features.length; i < sz; i++) {
  243. const feature = this.features[i];
  244. switch (feature.name) {
  245. case 'AutoAim':
  246. if (feature.value) this.AutoAim(feature.value);
  247. break;
  248. case 'AutoReload':
  249. if (feature.value) this.wpnReload();
  250. break;
  251. case 'NoRecoil':
  252. if (feature.value) this.self.recoilTweenY = this.self.recoilForce = 0;
  253. break;
  254. case 'AimDelta':
  255. this.world.config.deltaMlt = this.control.mouseDownR === 0 || feature.value === 0 ? 1 : feature.value === 1 ? .5 : feature.value === 2 ? .75 : feature.value === 3 ? 1.5 : feature.value === 4 ? 2 : 1;
  256. break;
  257. case 'SuperGun':
  258. if (feature.value) {
  259. this.settings.weaponIndex += this.control.mouseDownL == 1;
  260. if (this.settings.weaponIndex > this.world.weapons.length - 3) this.settings.weaponIndex = 0;
  261. this.self.weapon = this.world.weapons[this.settings.weaponIndex];
  262. }
  263. break;
  264. case 'BurstShot':
  265. if (feature.value) this.self.weapon.shots = this.self.weapon.ammo;
  266. break;
  267. case 'AutoBhop':
  268. if (feature.value) this.AutoBhop(feature.value);
  269. break;
  270. case 'NoDeathDelay':
  271. if (feature.value && this.self && this.self.health === 0) {
  272. this.server.deathDelay = 0;
  273. this.world.players.forcePos();
  274. //this.world.players.resetAim();
  275. //this.world.updateUI();
  276. }
  277. break;
  278. }
  279. }
  280. this.server.viewDist = 5000; // 2000 default
  281. this.world.config.impulseMlt = 3; //1 default / max 3
  282. for (i = 0, sz = this.wpnClasses.length; i < sz; i++) {
  283. this.wpnClasses[i].speed = 1.05; // 1.05 max
  284. }
  285. }
  286.  
  287. onUpdated(feature) {
  288. if (feature.container.length) {
  289. feature.value += 1;
  290. if (feature.value > feature.container.length - 1) {
  291. feature.value = 0;
  292. }
  293. feature.valueStr = feature.container[feature.value];
  294. }
  295. else
  296. {
  297. feature.value ^= 1;
  298. feature.valueStr = feature.value ? "true" : "false";
  299. }
  300. switch (feature.name) {
  301. case 'ForceScope':
  302. feature.value || this.self.weapon.name === "Sniper Rifle" || this.self.weapon.name === "Semi Auto" ? this.self.weapon.scope = 1 : delete this.self.weapon.scope;
  303. break;
  304. }
  305. window.saveVal(`utilities_${feature.name}`, feature.value);
  306. this.updateInfoBox();
  307. }
  308.  
  309. getStatic(s, d) {
  310. if(typeof s == 'undefined') {
  311. return d;
  312. }
  313. return s;
  314. }
  315.  
  316. newFeature(name, key, array) {
  317. const feature = cStruct('name', 'hotkey', 'value', 'valueStr', 'container')
  318. const value = parseInt(window.getSavedVal(`utilities_${name}`) || 0);
  319. this.features.push(feature(name, key, value, array.length ? array[value] : value ? "true" : "false", array));
  320. }
  321.  
  322. getFeature(name) {
  323. for (const feature of this.features) {
  324. if (feature.name.toLowerCase() === name.toLowerCase()) {
  325. return feature;
  326. }
  327. }
  328. return cStruct('name', 'hotkey', 'value', 'valueStr', 'container');
  329. }
  330.  
  331. createInfoBox() {
  332. const leaderDisplay = document.querySelector('#leaderDisplay');
  333. if (leaderDisplay) {
  334. var infoBox = document.createElement('div');
  335. if (infoBox) infoBox.innerHTML = '<div> <style> #InfoBox { text-align: left; width: 310px; z-index: 3; padding: 10px; padding-left: 20px; padding-right: 20px; color: rgba(255, 255, 255, 0.7); line-height: 25px; margin-top: 0px; background-color: rgba(0, 0, 0, 0.3); } #InfoBox .utilitiesTitle { font-size: 16px; font-weight: bold; text-align: center; color: #1A72B8; margin-top: 5px; margin-bottom: 5px; } #InfoBox .leaderItem { font-size: 14px; } </style> <div id="InfoBox"></div> </div>'.trim();
  336. leaderDisplay.parentNode.insertBefore(infoBox.firstChild, leaderDisplay.nextSibling);
  337. this.updateInfoBox();
  338. }
  339. }
  340.  
  341. upperCase(str) {
  342. return str.toUpperCase();
  343. }
  344.  
  345. toProperCase(str) {
  346. str = str.replace(/([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g, '$1 $2');
  347. str = str.replace(/\s[a-z]/g, this.upperCase)
  348. return str;
  349. }
  350.  
  351. updateInfoBox() {
  352. const infoBox = document.querySelector('#InfoBox');
  353. if (infoBox) {
  354. const lines = this.features.map(feature => {
  355. return '<div class="leaderItem"> <div class="leaderNameF">[' + feature.hotkey.toUpperCase() + '] ' + this.toProperCase(feature.name) + '</div> <div class="leaderScore">' + feature.valueStr + '</div> </div>';
  356. });
  357. infoBox.innerHTML = '<div class="utilitiesTitle">Krunkerio.org<hr>Krunkerio.net</div>' + lines.join('').trim();
  358. }
  359. }
  360.  
  361. onKeyDown(event) {
  362. if (document.activeElement.tagName === "INPUT") return;
  363. const key = event.key.toUpperCase();
  364. switch (key) {
  365. case 'M': {
  366. const infoBox = document.querySelector('#InfoBox');
  367. if (infoBox) infoBox.style.display = !infoBox.style.display || infoBox.style.display === "inline-block" ? "none" : "inline-block";
  368. }
  369. break;
  370. case 'DELETE':
  371. this.resetSettings();
  372. break;
  373. default:
  374. for (const feature of this.features) {
  375. if (feature.hotkey.toUpperCase() === key) {
  376. this.onUpdated(feature);
  377. }
  378. }
  379. break;
  380. }
  381. }
  382.  
  383. getDistance3D(fromX, fromY, fromZ, toX, toY, toZ) {
  384. var distX = fromX - toX,
  385. distY = fromY - toY,
  386. distZ = fromZ - toZ;
  387. return Math.sqrt(distX * distX + distY * distY + distZ * distZ)
  388. }
  389.  
  390. getDistance(player1, player2) {
  391. return this.getDistance3D(player1.x, player1.y, player1.z, player2.x, player2.y, player2.z);
  392. }
  393.  
  394. getDirection(fromZ, fromX, toZ, toX) {
  395. return Math.atan2(fromX - toX, fromZ - toZ)
  396. }
  397.  
  398. getXDir(fromX, fromY, fromZ, toX, toY, toZ) {
  399. var dirY = Math.abs(fromY - toY),
  400. dist = this.getDistance3D(fromX, fromY, fromZ, toX, toY, toZ);
  401. return Math.asin(dirY / dist) * (fromY > toY ? -1 : 1)
  402. }
  403.  
  404. getAngleDist(start, end) {
  405. return Math.atan2(Math.sin(end - start), Math.cos(start - end));
  406. }
  407.  
  408. camLookAt(X, Y, Z) {
  409. var xdir = this.getXDir(this.control.object.position.x, this.control.object.position.y, this.control.object.position.z, X, Y, Z),
  410. ydir = this.getDirection(this.control.object.position.z, this.control.object.position.x, Z, X),
  411. camChaseDst = this.server.camChaseDst;
  412. this.control.target = {
  413. xD: xdir,
  414. yD: ydir,
  415. x: X + this.server.camChaseDst * Math.sin(ydir) * Math.cos(xdir),
  416. y: Y - this.server.camChaseDst * Math.sin(xdir),
  417. z: Z + this.server.camChaseDst * Math.cos(ydir) * Math.cos(xdir)
  418. }
  419. }
  420.  
  421. AutoAim(value) {
  422. if (this.self.didShoot) {
  423. setTimeout(() => {
  424. this.self.aimVal = 1;
  425. this.world.players.resetAim();
  426. this.settings.forceScope || this.self.weapon.name === "Sniper Rifle" || this.self.weapon.name === "Semi Auto" ? this.self.weapon.scope = 1 : delete this.self.weapon.scope;
  427. this.settings.canShoot = true;
  428. }, this.self.weapon.rate );
  429. }
  430. const target = this.getTarget();
  431. if (target) {
  432. switch (value) {
  433. case 1:
  434. /*Aim Assist*/
  435. if (this.control.mouseDownR === 1) {
  436. this.lookAtHead(target);
  437. }
  438. break;
  439. case 2:
  440. /*Aim Bot*/
  441. this.lookAtHead(target);
  442. if (this.control.mouseDownR === 0) {
  443. this.control.mouseDownR = 1;
  444. }
  445. break;
  446. case 3:
  447. /*Trigger Bot*/
  448. if (this.control.mouseDownL === 1) {
  449. this.control.mouseDownL = 0;
  450. this.control.mouseDownR = 0;
  451. this.settings.scopingOut = true;
  452. }
  453. if (this.self.aimVal !== 1 || !this.settings.canShoot || this.self.recoilForce > 0.01 || this.control.mouseDownR === 1) {
  454. if (this.control.mouseDownL === 1) {
  455. this.control.mouseDownL =
  456. this.control.mouseDownR = 0;
  457. }
  458. this.control.target = null;
  459. }
  460. this.lookAtHead(target);
  461. if (this.control.mouseDownR === 0) {
  462. this.control.mouseDownR = 2;
  463. } else if (this.self.aimVal === 0 && this.settings.canShoot) {
  464. this.control.mouseDownL ^= 1;
  465. }
  466. break;
  467. }
  468. }
  469. else {
  470. this.wpnReload(this.getFeature('AutoReload').value && this.self.ammos[this.self.weaponIndex] < ((this.self.weapon.ammo / 2) + 1));
  471. this.control.target = null;
  472. if (this.control.mouseDownR === 2) {
  473. setTimeout(() => {
  474. this.control.mouseDownR = 0;
  475. this.settings.canShoot = true;
  476. this.self.aimVal = 1;
  477. }, this.settings.targetCoolDown);
  478. }
  479. }
  480. }
  481.  
  482. AutoBhop(value) {
  483. if (value) {
  484. this.control.keys[this.control.jumpKey] = this.self.onGround;
  485. if (value === 2) {
  486. if (this.settings.isSliding) {
  487. this.inputs[8] = 1;
  488. return;
  489. }
  490. if (this.self.yVel < -0.04 && this.self.canSlide) {
  491. this.settings.isSliding = true;
  492. setTimeout(() => {
  493. this.settings.isSliding = false;
  494. }, this.self.slideTimer);
  495. this.inputs[8] = 1;
  496. }
  497. }
  498. }
  499. }
  500.  
  501. wpnReload(force = false) {
  502. const ammoLeft = this.self.ammos[this.self.weaponIndex];
  503. if (force || ammoLeft === 0) this.world.players.reload(this.self);
  504. }
  505.  
  506. resetSettings() {
  507. if (confirm("Are you sure you want to reset all your krunkerio.org settings? This will also refresh the page")) {
  508. Object.keys(window.localStorage).filter(x=>x.includes("utilities_")).forEach(x => window.localStorage.removeItem(x));
  509. location.reload();
  510. }
  511. }
  512.  
  513. getTarget() {
  514. const enemies = this.world.players.list
  515. .filter(player => {return player.active && (player.inView || this.self.dmgReceived[player.id]) && !player.isYou && (!player.team || player.team !== this.self.team);})
  516. .sort((p1, p2) => this.getDistance(this.self, p1) - this.getDistance(this.self, p2));
  517. return enemies.length ? enemies[0] : null;
  518. }
  519.  
  520. lookAtHead(target) {
  521. if (this.getFeature("SpinBot").value) this.spinTick();
  522. this.camLookAt(target.x2, target.y2 + target.height - 1.5 - 2.5 * target.crouchVal - this.self.recoilAnimY * 0.3 * this.getDistance(this.self, target) * 0.6, target.z2);
  523. }
  524.  
  525. spinTick() {
  526. //this.world.players.getSpin(this.self);
  527. //this.world.players.saveSpin(this.self, angle);
  528. const last = this.inputs[2];
  529. const angle = this.getAngleDist(this.inputs[2], this.self.xDire);
  530. this.spins = this.getStatic(this.spins, new Array());
  531. this.spinTimer= this.getStatic(this.spinTimer, this.server.spinTimer);
  532. this.serverTickRate = this.getStatic(this.serverTickRate, this.server.serverTickRate);
  533. (this.spins.unshift(angle), this.spins.length > this.spinTimer / this.serverTickRate && (this.spins.length = Math.round(this.spinTimer / this.serverTickRate)))
  534. for (var e = 0, i = 0; i < this.spins.length; ++i) e += this.spins[i];
  535. const count = Math.abs(e * (180 / Math.PI));
  536. if (count < 360) { this.inputs[2] = this.self.xDire + Math.PI; }
  537. else console.log('count', count);
  538. }
  539.  
  540. inputsTick(self, inputs, world) {
  541. //Hooked
  542. if (this.control && this.exports && self && inputs && world) {
  543. this.inputs = inputs;
  544. this.world = world;
  545. this.self = self;
  546. this.server = this.exports.c[7].exports;
  547. this.functions = this.exports.c[8].exports;
  548. this.wpnClasses = this.exports.c[69].exports;
  549. this.onTick();
  550. }
  551. }
  552.  
  553. controlTick(control) {
  554. //Hooked
  555. if (control) {
  556. this.control = control;
  557. const half = Math.PI / 2;
  558. if (control.target) {
  559. control.object.rotation.y = control.target.yD;
  560. control.pitchObject.rotation.x = control.target.xD;
  561. control.pitchObject.rotation.x = Math.max(-half, Math.min(half, control.pitchObject.rotation.x));
  562. control.yDr = control.pitchObject.rotation.x % Math.PI;
  563. control.xDr = control.object.rotation.y % Math.PI;
  564. }
  565. }
  566. }
  567. }
  568.  
  569. function read(url) {
  570. return new Promise(resolve => {
  571. fetch(url).then(res => res.text()).then(res => {
  572. return resolve(res);
  573. });
  574. });
  575. }
  576.  
  577. function patch(source, method, regex, replacer) {
  578. const patched = source.replace(regex, replacer);
  579. if (source === patched) {
  580. alert(`Failed to patch ${method}`);
  581. } else console.log("Successfully patched ", method);
  582. return patched;
  583. }
  584.  
  585. function patchedIndex(html) {
  586. html = patch(html, "html_scriptBlock", /(<script src=".*?game.*?")(><\/script>)/, '$1 type="javascript/blocked" $2');
  587. html = patch(html, "html_payPal", /<script src=".*?paypal.*?"><\/script>/, '');
  588. return html;
  589. }
  590.  
  591. function patchedScript(script) {
  592. script = patch(script, "IsHacker", /&&(\w+)\['isHacker']&&/, `&&!1&&`);
  593. script = patch(script, "LastHack", /&&(\w+)\['lastHack']&&/, `&&!1&&`);
  594. script = patch(script, 'WallHack', /if\(!tmpObj\['inView']\)continue;/, ``);
  595. script = patch(script, 'Socket', /('connect':function\((\w+),(\w+),(\w+)\){if\(!this\['(\w+)']\){)/, `$1 window.utilities.socket=this;`);
  596. script = patch(script, "Exports", /(\['__CANCEL__']=!(\w+),(\w+)\['exports']=(\w+);},function\((\w+),(\w+),(\w+)\){)(let)/, `$1window.utilities = new Utilities();window.utilities.exports=$7;$8`);
  597. script = patch(script, 'ControlTick', /{if\(this\['target']\){(.+?)}},this\['(\w+)']=/, `{window.utilities.controlTick(this);},this['$2']=`);
  598. script = patch(script, 'ControlFix', /&&\((\w+)\[('\w+')]\((\w+)\['x'],(\w+)\['y']\+(\w+)\['height']-(\w+)\['cameraHeight'],(\w+)\['z']\)/, `&&(utilities.camLookAt($3.x,$3.y+$3.height-$6.cameraHeight,$3.z)`);
  599. script = patch(script, "HasServer", /(this\['hasServer']=)(\w+)\?(\w+):(\w+)/, `$1 $2 = utilities.socket`);
  600. script = patch(script, 'ProcInput', /this\['procInputs']=function\((\w+),(\w+),(\w+)\){/, `this['procInputs']=function($1,$2,$3){window.utilities.inputsTick(this,$1,$2);`);
  601. return script;
  602. }
  603.  
  604. (async function () {
  605. const index = await read(document.location.href);
  606. const build = index.match(/(?<=build=)[^"]+/)[0];
  607. const patch = index.match(/"SOUND.play\(.+\)">v(.+)</)[1];
  608. const script = await read(`/js/game.${build}.js`);
  609. console.log('Loading Krunker Hero ...');
  610. window.stop();
  611. document.open();
  612. document.write(patchedIndex(index));
  613. document.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement