Advertisement
Guest User

Untitled

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