Advertisement
similogia

Krunker.io Skid

Nov 11th, 2019
2,226
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 BRAEDYNS HACK
  3. // @namespace https://github.com/skidlamer
  4. // @author SkidLamer
  5. // @version 1.8.8
  6. // @description A cheat for krunker.io
  7. // @downloadURL https://skidlamer.github.io/js/krunker_skid.user.js
  8. // @supportURL https://github.com/skidlamer/skidlamer.github.io
  9. // @icon https://krunker.io/img/favicon.png
  10. // @match *://krunker.io/*
  11. // @require https://skidlamer.github.io/js/FileSaver.js
  12. // @run-at document-start
  13. // @grant none
  14. // ==/UserScript==
  15. // Please Do not copy and paste this script to greasy fork and pretend you made it its lame/r I can and will give you the hose again
  16. // Discord Krunker Heros - https://discord.gg/Emkf5by
  17. // hook - credit to @lemons - https://github.com/Lemons1337
  18. // esp - credit to @techy - https://www.gitmemory.com/Tehchy
  19. // game - credit to @sidney - https://twitter.com/sidney_de_vries?lang=en
  20. // other excellent krunker cheat script developers:
  21. // @lemons - https://github.com/Lemons1337
  22. // @funk - https://github.com/funk
  23. // @masterP - https://github.com/MasterP-kr
  24. // @Nathan - for Krunkers Failed Anti cheat I hear McDonalds Is Hiring.
  25. class Utilities {
  26. constructor() {
  27. this.exports;
  28. this.ui;
  29. this.me;
  30. this.world;
  31. this.inputs;
  32. this.socket;
  33. this.server;
  34. this.downKeys = new Set();
  35. this.upKeys = new Set();
  36. this.menus = new Map();
  37. this.features = [];
  38. this.colors = {
  39. aqua: '#7fdbff',
  40. blue: '#0074d9',
  41. lime: '#01ff70',
  42. navy: '#001f3f',
  43. teal: '#39cccc',
  44. olive: '#3d9970',
  45. green: '#2ecc40',
  46. red: '#ff4136',
  47. maroon: '#85144b',
  48. orange: '#ff851b',
  49. purple: '#b10dc9',
  50. yellow: '#ffdc00',
  51. fuchsia: '#f012be',
  52. greyDark: '#808080',
  53. greyMed: '#a9a9a9',
  54. greyLight: '#d3d3d3',
  55. white: '#ffffff',
  56. black: '#000000',
  57. silver: '#dddddd',
  58. hostile: '#eb5656',
  59. friendly: '#9eeb56',
  60. };
  61. this.settings = {
  62. showMenu: true,
  63. autoAimWalls: 0,
  64. aimOffset: -0.6,
  65. espMode: 4,
  66. espFontSize: 100,
  67. canShoot: true,
  68. scopingOut: false,
  69. isSliding: false,
  70. delta:1,
  71. }
  72. this.activeMenuIndex = 0;
  73. this.activeLineIndex = 0;
  74. this.canvas = null;
  75. this.ctx = null;
  76. let interval_ui = setInterval(() => {
  77. if (document.getElementById("inGameUI") !== null) {
  78. clearInterval(interval_ui);
  79. this.onLoad();
  80. }
  81. }, 100);
  82. }
  83.  
  84. onLoad() {
  85. this.menus
  86. .set('Krunker Skid', [this.newFeature('Self', []), this.newFeature('Weapon', []), this.newFeature('Visual', []), this.newFeature('Settings', [])])
  87. .set('Self', [this.newFeature('AutoBhop', ['Off', 'Auto Jump', 'Key Jump', 'Auto Slide', 'Key Slide']), this.newFeature('SkidSettings', ['Off', 'On'])])
  88. .set('Weapon', [this.newFeature('AutoAim', ['Off', 'Aim Assist', 'Aim Bot', 'Trigger Bot']), this.newFeature('AutoReload', ['Off', 'On']), this.newFeature('Aim Through Walls', ['Off', 'On']), this.newFeature('UseDeltaForce', ['Off', 'On'])])
  89. .set('Visual', [this.newFeature('EspMode', ['Off', 'Full', '2d', 'Walls']), this.newFeature('Tracers', ['Off', 'On'])])
  90. .set('Settings', [this.newFeature('Reset', [], this.resetSettings), this.newFeature('Save game.js', [], _=>{self.saveAs(new Blob([self.GameScript], {type: "text/plain;charset=utf-8"}), `game.js`)})])
  91. // EventListeners and Hooks ...
  92. addEventListener("keydown", e => {
  93. if ("INPUT" == window.document.activeElement.tagName) return;
  94. const key = e.key.toUpperCase();
  95. const code = e.code;
  96. if (!this.downKeys.has(code)) this.downKeys.add(code);
  97. });
  98. addEventListener("keyup", e => {
  99. const key = e.key.toUpperCase();
  100. const code = e.code;
  101. if (this.downKeys.has(code)) this.downKeys.delete(code);
  102. if (!this.upKeys.has(code)) this.upKeys.add(code);
  103.  
  104. if (key === "L") {
  105. console.dir(self);
  106. console.dir(this.me);
  107. console.dir(this.world);
  108. console.dir(this.server);
  109. this.server.serverConfig[23].def === "false" ? this.server.serverConfig[23].def = "true" : this.server.serverConfig[23].def = "false";
  110. }
  111. })
  112. window.$.Vector3 = (x, y, z) => { this.x = x || 0; this.y = y || 0; this.z = z || 0; return this; }
  113. }
  114.  
  115. keyDown(code) {
  116. return this.downKeys.has(code);
  117. }
  118.  
  119. keyUp(code) {
  120. if (this.upKeys.has(code)) {
  121. this.upKeys.delete(code);
  122. return true;
  123. }
  124. return false;
  125. }
  126.  
  127. byte2Hex(n) {
  128. var chars = "0123456789ABCDEF";
  129. return String(chars.substr((n >> 4) & 0x0F,1)) + chars.substr(n & 0x0F,1);
  130. }
  131.  
  132. rgba2hex(r,g,b,a = 255) {
  133. return ("#").concat(this.byte2Hex(r),this.byte2Hex(g),this.byte2Hex(b),this.byte2Hex(a));
  134. }
  135.  
  136. onTick(player, world) {
  137. if (world && player && player.isYou && player.active) {
  138. this.world = world;
  139. this.me = player;
  140. this.server=this.exports.c[7].exports;
  141. this.me.weapon.range = Infinity;
  142. this.me.weapon.pierce = Infinity;
  143.  
  144. for (let i = 0, sz = this.features.length; i < sz; i++) {
  145. const feature = this.features[i];
  146. switch (feature.name) {
  147. case 'AutoAim':
  148. this.autoAim(feature.value);
  149. break;
  150. case 'AutoReload':
  151. if (feature.value) this.wpnReload();
  152. break;
  153. case 'AutoBhop':
  154. this.autoBhop(feature.value);
  155. break;
  156. case 'EspMode':
  157. this.settings.espMode = feature.value;
  158. break;
  159. case 'SkidSettings':
  160. if (feature.value) new Map([ ["fov", 85], ["fpsFOV", 85], ["weaponBob", 3], ["weaponLean", 6], ["weaponOffX", 2], ["weaponOffY", 2], ["weaponOffZ", 2] ]).forEach(function(value, key, map) { window.setSetting(key, value) });
  161. break;
  162. case 'UseDeltaForce':
  163. this.settings.delta = feature.value ? 5 : 1;
  164. break;
  165. }
  166. }
  167. }
  168. }
  169.  
  170. resetSettings() {
  171. if (confirm("Are you sure you want to reset all your skid settings? This will also refresh the page")) {
  172. Object.keys(window.localStorage).filter(x => x.includes("utilities_")).forEach(x => window.localStorage.removeItem(x));
  173. window.location.reload();
  174. }
  175. }
  176.  
  177. newFeature(name, array, myFunction = null) {
  178. const cStruct = (...keys) => ((...v) => keys.reduce((o, k, i) => {
  179. o[k] = v[i];
  180. return o
  181. }, {}));
  182. var item = [];
  183. const myStruct = cStruct('name', 'value', 'valueStr', 'container', 'myFunction')
  184. const value = parseInt(window.getSavedVal("utilities_" + name) || 0);
  185. const feature = myStruct(name, value, array.length ? array[value] : '', array, myFunction);
  186. if (array.length||myFunction) this.features.push(feature);
  187. item.push(feature);
  188. return item;
  189. }
  190.  
  191. getFeature(name) {
  192. for (const feature of this.features) {
  193. if (feature.name.toLowerCase() === name.toLowerCase()) {
  194. return feature;
  195. }
  196. }
  197. return null;
  198. }
  199.  
  200. onUpdated(feature) {
  201. if (feature.container.length) {
  202. feature.value += 1;
  203. if (feature.value > feature.container.length - 1) {
  204. feature.value = 0;
  205. }
  206. feature.valueStr = feature.container[feature.value];
  207. window.saveVal("utilities_" + feature.name, feature.value);
  208. }
  209. if (feature.container.length == 2 && feature.container[0] == 'Off' && feature.container[1] == 'On') {
  210. console.log(feature.name, " is now ", feature.valueStr);
  211. switch (feature.name) {
  212. case 'Aim Through Walls': this.settings.autoAimWalls = feature.value;
  213. break;
  214. }
  215. }
  216. }
  217.  
  218. getDistance3D(fromX, fromY, fromZ, toX, toY, toZ) {
  219. var distX = fromX - toX,
  220. distY = fromY - toY,
  221. distZ = fromZ - toZ;
  222. return Math.sqrt(distX * distX + distY * distY + distZ * distZ);
  223. }
  224.  
  225. getDistance(player1, player2) {
  226. return this.getDistance3D(player1.x, player1.y, player1.z, player2.x, player2.y, player2.z);
  227. }
  228.  
  229. getDirection(fromZ, fromX, toZ, toX) {
  230. return Math.atan2(fromX - toX, fromZ - toZ);
  231. }
  232.  
  233. getXDir(fromX, fromY, fromZ, toX, toY, toZ) {
  234. var dirY = Math.abs(fromY - toY),
  235. dist = this.getDistance3D(fromX, fromY, fromZ, toX, toY, toZ);
  236. return Math.asin(dirY / dist) * (fromY > toY ? -1 : 1);
  237. }
  238.  
  239. getAngleDist(start, end) {
  240. return Math.atan2(Math.sin(end - start), Math.cos(start - end));
  241. }
  242.  
  243. camLookAt(pos) {
  244. const camChaseDst = this.server.camChaseDst;
  245. var xdir = this.getXDir(this.world.controls.object.position.x, this.world.controls.object.position.y, this.world.controls.object.position.z, pos.x, pos.y, pos.z),
  246. ydir = this.getDirection(this.world.controls.object.position.z, this.world.controls.object.position.x, pos.z, pos.x);
  247. this.world.controls.target = {
  248. xD: xdir,
  249. yD: ydir,
  250. x: pos.x + camChaseDst * Math.sin(ydir) * Math.cos(xdir),
  251. y: pos.y - camChaseDst * Math.sin(xdir),
  252. z: pos.z + camChaseDst * Math.cos(ydir) * Math.cos(xdir)
  253. }
  254. }
  255.  
  256. getStatic(s, d) {
  257. if (typeof s == 'undefined') {
  258. return d;
  259. }
  260. return s;
  261. }
  262.  
  263. teamColor(player) {
  264. return player.team === null ? '#FF4444' : this.me.team === player.team ? '#44AAFF' : '#FF4444';
  265. }
  266.  
  267. autoAim(value) {
  268. if (!value) return;
  269. if (this.me.didShoot) {
  270. this.inputs[5] = 0;
  271. this.settings.canShoot = false;
  272. setTimeout(()=>{ this.settings.canShoot = true; }, this.me.weapon.rate / 1.75);
  273. } else if (!this.me.aimVal) {
  274. this.inputs[6] = this.world.controls.mouseDownL;
  275. this.inputs[5] = this.world.controls.mouseDownR;
  276. } else {
  277. this.inputs[6] = this.world.controls.mouseDownR;
  278. }
  279.  
  280. const enemies = this.world.players.list.filter(x => { return x.active && x.cnBSeen && !x.isYou && (!x.team || x.team !== this.me.team); }).sort((p1, p2) => this.getDistance(this.me, p1) - this.getDistance(this.me, p2));
  281. const target = enemies.shift();
  282. if (target !== undefined) {
  283. switch (value) {
  284. case 1:
  285. /*Aim Assist*/
  286. if (this.world.controls.mouseDownR > 0) {
  287. this.world.config.deltaMlt = this.settings.delta;
  288. this.camLookAt(target.x2, target.y2 + target.height + this.settings.aimOffset - this.server.cameraHeight - this.server.crouchDst * target.crouchVal - this.server.recoilMlt * this.me.recoilAnimY * this.me.recoilForce, target.z2);
  289. this.world.config.deltaMlt = 1;
  290. }
  291. break;
  292. case 2:
  293. /*Aim Bot*/
  294. this.Aimbot(target, false);
  295. break;
  296. case 3:
  297. /*Trigger Bot*/
  298. this.Aimbot(target, true);
  299. break;
  300. default: break;
  301. }
  302. }
  303. else {
  304. this.world.controls.target = null;
  305. this.world.config.deltaMlt = 1;
  306. if (this.world.controls.mouseDownR > 1) this.world.controls.mouseDownR = 0;
  307. }
  308. }
  309.  
  310. Aimbot(target, autoShoot) {
  311.  
  312. if (this.world.controls.mouseDownL > 0) {
  313. this.world.controls.mouseDownL = 0;
  314. this.world.controls.mouseDownR = 0;
  315. this.settings.scopingOut = true;
  316. }
  317.  
  318. if (this.me.aimVal === 1) {
  319. this.settings.scopingOut = false;
  320. }
  321.  
  322. if (this.me.recoilForce > 0) {
  323. this.me.recoilTween = new self.TWEEN.Tween(this.me).to({ recoilTweenY: 0, recoilTweenYM: 0, recoilTweenZ: 0 });
  324. }
  325.  
  326. if (this.settings.scopingOut || !this.settings.canShoot) {
  327. return;
  328. }
  329.  
  330. this.world.config.deltaMlt = this.settings.delta;
  331.  
  332. let pos = self.$.Vector3(target.x2, target.y2 + this.server.playerHeight - this.server.headScale / 2 - target.crouchVal * this.server.crouchDst, target.z2);
  333. let xDr = this.getXDir(this.world.controls.object.position.x, this.world.controls.object.position.y, this.world.controls.object.position.z, target.x2, pos.y, target.z2);
  334. let yDr = this.getDirection(this.world.controls.object.position.z, this.world.controls.object.position.x, target.z2, target.x2);
  335. this.inputs[2] = yDr;
  336. this.inputs[3] = xDr;
  337. if (autoShoot) {
  338. this.camLookAt(pos);
  339. this.world.controls.mouseDownR = 2;
  340. if (this.me.aimVal < 0.2) {
  341. this.world.controls.mouseDownL ^= 1;
  342. }
  343. }
  344. else {
  345. this.world.config.deltaMlt = this.settings.delta;
  346. this.camLookAt(pos);
  347. if (target.cnBSeen) this.world.controls.mouseDownR = 2;
  348. }
  349.  
  350. this.world.config.deltaMlt = 1;
  351. }
  352.  
  353. autoBhop(value) {
  354. if (!value) return;
  355. if (this.keyDown("Space") || value == 1 || value == 3) {
  356. this.world.controls.keys[this.world.controls.jumpKey] = !this.world.controls.keys[this.world.controls.jumpKey];
  357. if (value > 2) {
  358. if (this.settings.isSliding) {
  359. this.world.controls.keys[this.world.controls.crouchKey] = 1;
  360. return;
  361. }
  362. if (this.me.yVel < -0.04 && this.me.canSlide) {
  363. this.settings.isSliding = true;
  364. setTimeout(() => {
  365. this.settings.isSliding = false;
  366. this.world.controls.keys[this.world.controls.crouchKey] = 0;
  367. }, 350);
  368. this.world.controls.keys[this.world.controls.crouchKey] = 1;
  369. }
  370. }
  371. }
  372. }
  373.  
  374. wpnReload(force = false) {
  375. //(inputs[9] = me.ammos[me.weaponIndex] === 0);
  376. const ammoLeft = this.me.ammos[this.me.weaponIndex];
  377. if (force || ammoLeft === 0) {
  378. this.world.players.reload(this.me);
  379. if (ammoLeft) this.world.players.endReload(this.me.weapon);
  380. }
  381. }
  382.  
  383. world2Screen(camera, pos3d, aY = 0) {
  384. let pos = pos3d.clone();
  385. pos.y += aY;
  386. pos.project(camera);
  387. pos.x = (pos.x + 1) / 2;
  388. pos.y = (-pos.y + 1) / 2;
  389. pos.x *= this.canvas.width || innerWidth;
  390. pos.y *= this.canvas.height || innerHeight;
  391. return pos;
  392. }
  393.  
  394. pixelTranslate(ctx, x, y) {
  395. ctx.translate(~~x, ~~y);
  396. }
  397.  
  398. text(txt, font, color, x, y) {
  399. this.ctx.save();
  400. this.pixelTranslate(this.ctx, x, y);
  401. this.ctx.fillStyle = color;
  402. this.ctx.strokeStyle = "rgba(0, 0, 0, 0.5)";
  403. this.ctx.font = font;
  404. this.ctx.lineWidth = 1;
  405. this.ctx.strokeText(txt, 0, 0);
  406. this.ctx.fillText(txt, 0, 0);
  407. this.ctx.restore();
  408. }
  409.  
  410. rect(x, y, ox, oy, w, h, color, fill) {
  411. this.ctx.save();
  412. this.pixelTranslate(this.ctx, x, y);
  413. this.ctx.beginPath();
  414. fill ? this.ctx.fillStyle = color : this.ctx.strokeStyle = color;
  415. this.ctx.rect(ox, oy, w, h);
  416. fill ? this.ctx.fill() : this.ctx.stroke();
  417. this.ctx.closePath();
  418. this.ctx.restore();
  419. }
  420.  
  421. roundRect(x, y, width, height, radius, fill, stroke, color) {
  422. var cornerRadius = {
  423. upperLeft: 0,
  424. upperRight: 0,
  425. lowerLeft: 0,
  426. lowerRight: 0
  427. };
  428. if (typeof stroke == "undefined") {
  429. stroke = true;
  430. }
  431. if (typeof radius === "object") {
  432. for (var side in radius) {
  433. cornerRadius[side] = radius[side];
  434. }
  435. }
  436. this.ctx.save();
  437. this.pixelTranslate(this.ctx, x, y);
  438. this.ctx.beginPath();
  439. this.ctx.moveTo(x + cornerRadius.upperLeft, y);
  440. this.ctx.lineTo(x + width - cornerRadius.upperRight, y);
  441. this.ctx.quadraticCurveTo(x + width, y, x + width, y + cornerRadius.upperRight);
  442. this.ctx.lineTo(x + width, y + height - cornerRadius.lowerRight);
  443. this.ctx.quadraticCurveTo(x + width, y + height, x + width - cornerRadius.lowerRight, y + height);
  444. this.ctx.lineTo(x + cornerRadius.lowerLeft, y + height);
  445. this.ctx.quadraticCurveTo(x, y + height, x, y + height - cornerRadius.lowerLeft);
  446. this.ctx.lineTo(x, y + cornerRadius.upperLeft);
  447. this.ctx.quadraticCurveTo(x, y, x + cornerRadius.upperLeft, y);
  448. this.ctx.closePath();
  449. if (stroke) {
  450. this.ctx.strokeStyle = color;
  451. this.ctx.stroke();
  452. }
  453. if (fill) {
  454. this.ctx.fillStyle = color;
  455. this.ctx.fill();
  456. }
  457. this.ctx.restore();
  458. }
  459.  
  460. line(x1, y1, x2, y2, lW, sS) {
  461. this.ctx.save();
  462. this.ctx.lineWidth = lW + 2;
  463. this.ctx.beginPath();
  464. this.ctx.moveTo(x1, y1);
  465. this.ctx.lineTo(x2, y2);
  466. this.ctx.strokeStyle = "rgba(0, 0, 0, 0.25)";
  467. this.ctx.stroke();
  468. this.ctx.lineWidth = lW;
  469. this.ctx.strokeStyle = sS;
  470. this.ctx.stroke();
  471. this.ctx.restore();
  472. }
  473.  
  474. image(x, y, img, ox, oy, w, h) {
  475. this.ctx.save();
  476. this.ctx.translate(x, y);
  477. this.ctx.beginPath();
  478. this.ctx.drawImage(img, ox, oy, w, h);
  479. this.ctx.closePath();
  480. this.ctx.restore();
  481. }
  482.  
  483. gradient(x, y, w, h, colors) {
  484. let grad = this.ctx.createLinearGradient(x, y, w, h);
  485. for (let i = 0; i < colors.length; i++) {
  486. grad.addColorStop(i, colors[i]);
  487. }
  488. return grad;
  489. }
  490.  
  491. getTextMeasurements(arr) {
  492. for (let i = 0; i < arr.length; i++) {
  493. arr[i] = ~~this.ctx.measureText(arr[i]).width;
  494. }
  495. return arr;
  496. }
  497.  
  498. drawEsp(ui, world, myself) {
  499. const me = ui.camera.getWorldPosition()
  500. const font = this.settings.espFontSize + 'px Sans-serif';
  501. const setting = this.getFeature('EspMode').container[this.settings.espMode];
  502. for (const entity of world.players.list.filter(x => !x.isYou && x.active)) {
  503. //if (!entity.rankIcon && entity.level > 0) {
  504. // let rankVar = entity.level > 0 ? Math.ceil(entity.level / 3) * 3 : entity.level < 0 ? Math.floor(entity.level / 3) * 3 : entity.level;
  505. // let rankId = Math.max(Math.min(100, rankVar - 2), 0);
  506. // entity.rankIcon = new Image();
  507. // entity.rankIcon.src = `./img/levels/${rankId}.png`;
  508. //}
  509. const target = entity.objInstances.position.clone();
  510.  
  511. if (ui.frustum.containsPoint(target)) {
  512. let screenR = this.world2Screen(ui.camera, entity.objInstances.position.clone());
  513. let screenH = this.world2Screen(ui.camera, entity.objInstances.position.clone(), entity.height);
  514. let hDiff = ~~(screenR.y - screenH.y);
  515. let bWidth = ~~(hDiff * 0.6);
  516.  
  517. if (setting !== 'Walls') {
  518. /*healthBar*/
  519. let health = entity.health;
  520. this.rect((screenH.x - bWidth / 2) - 7, ~~screenH.y - 1, 0, 0, 4, hDiff + 2, this.colors.black, false);
  521. this.rect((screenH.x - bWidth / 2) - 7, ~~screenH.y - 1, 0, 0, 4, hDiff + 2, health > 75 ? this.colors.green : health > 50 ? this.colors.orange : this.colors.red, true);
  522. this.rect((screenH.x - bWidth / 2) - 7, ~~screenH.y - 1, 0, 0, 4, ~~((entity.maxHealth - entity.health) / entity.maxHealth * (hDiff + 2)), this.colors.black, true);
  523. /*2d*/
  524. this.ctx.save();
  525. this.ctx.lineWidth = 4;
  526. this.pixelTranslate(this.ctx, screenH.x - bWidth / 2, screenH.y);
  527. this.ctx.beginPath();
  528. this.ctx.rect(0, 0, bWidth, hDiff);
  529. this.ctx.strokeStyle = "rgba(0, 0, 0, 0.25)";
  530. this.ctx.stroke();
  531. this.ctx.lineWidth = 2;
  532. this.ctx.strokeStyle = entity.team === null ? '#FF4444' : myself.team === entity.team ? '#44AAFF' : '#FF4444';
  533. this.ctx.stroke();
  534. this.ctx.closePath();
  535. this.ctx.restore();
  536. if (setting === 'Full') {
  537. /*healthBar*/
  538. let playerDist = parseInt(this.getDistance3D(me.x, me.y, me.z, target.x, target.y, target.z) / 10);
  539. this.ctx.save();
  540. //this.ctx.font = font;
  541. let meas = this.getTextMeasurements([" ", playerDist, "m ", entity.level, "©", entity.name]);
  542. this.ctx.restore();
  543. let grad2 = this.gradient(0, 0, meas[4] * 5, 0, ["rgba(0, 0, 0, 0.25)", "rgba(0, 0, 0, 0)"]);
  544. let padding = 2;
  545. //if (entity.rankIcon && entity.rankIcon.complete) {
  546. // let grad = this.gradient(0, 0, (meas[4] * 2) + meas[3] + (padding * 3), 0, ["rgba(0, 0, 0, 0)", "rgba(0, 0, 0, 0.25)"]);
  547. // this.rect(~~(screenH.x - bWidth / 2) - 12 - (meas[4] * 2) - meas[3] - (padding * 3), ~~screenH.y - padding, 0, 0, (meas[4] * 2) + meas[3] + (padding * 3), meas[4] + (padding * 2), grad, true);
  548. // this.ctx.drawImage(entity.rankIcon, ~~(screenH.x - bWidth / 2) - 16 - (meas[4] * 2) - meas[3], ~~screenH.y - (meas[4] * 0.5), entity.rankIcon.width * ((meas[4] * 2) / entity.rankIcon.width), entity.rankIcon.height * ((meas[4] * 2) / entity.rankIcon.height));
  549. // this.text(`${entity.level}`, `${this.settings.espFontSize}px GameFont`, '#FFFFFF', ~~(screenH.x - bWidth / 2) - 16 - meas[3], ~~screenH.y + meas[4] * 1);
  550. //}
  551. this.rect(~~(screenH.x + bWidth / 2) + padding, ~~screenH.y - padding, 0, 0, (meas[4] * 5), (meas[4] * 4) + (padding * 2), grad2, true);
  552. this.text(entity.name, font, entity.team === null ? '#FFCDB4' : myself.team === entity.team ? '#B4E6FF' : '#FFCDB4', (screenH.x + bWidth / 2) + 4, screenH.y + meas[4] * 1)
  553. if (entity.clan) this.text('['+entity.clan+']', font, '#AAAAAA', (screenH.x + bWidth / 2) + 8 + meas[5], screenH.y + meas[4] * 1)
  554. this.text(entity.health+' HP', font, "#33FF33", (screenH.x + bWidth / 2) + 4, screenH.y + meas[4] * 2)
  555. this.text(entity.weapon.name, font, "#DDDDDD", (screenH.x + bWidth / 2) + 4, screenH.y + meas[4] * 3)
  556. this.text("[", font, "#AAAAAA", (screenH.x + bWidth / 2) + 4, screenH.y + meas[4] * 4)
  557. this.text(playerDist, font, "#DDDDDD", (screenH.x + bWidth / 2) + 4 + meas[0], screenH.y + meas[4] * 4)
  558. this.text("m]", font, "#AAAAAA", (screenH.x + bWidth / 2) + 4 + meas[0] + meas[1], screenH.y + meas[4] * 4)
  559. }
  560. }
  561. const tracers = this.getFeature('Tracers');
  562. if (tracers && tracers.value) if (this.settings.espMode === 1 || this.settings.espMode === 2) this.line(innerWidth / 2, innerHeight - 1, screenR.x, screenR.y, 2, entity.team === null ? '#FF4444' : myself.team === entity.team ? '#44AAFF' : '#FF4444');
  563. }
  564. }
  565. }
  566.  
  567. drawMenuLine(item, lineWidth, lineHeight, lineTop, lineLeft, textLeft, active, title, rescaleText = true)
  568. {
  569. // default values
  570. let text_col = [255, 255, 255, 255],
  571. rect_col = [0, 0, 0, 120],
  572. text_scale = 20,
  573. font = 'px sans-serif';
  574.  
  575. // active line values
  576. if (active) {
  577. text_col[0] = 0;
  578. text_col[1] = 0;
  579. text_col[2] = 0;
  580. rect_col[0] = 231;
  581. rect_col[1] = 231;
  582. rect_col[2] = 231;
  583. if (rescaleText) text_scale = 21;
  584. }
  585.  
  586. // title values
  587. if (title)
  588. {
  589. rect_col[0] = 70;
  590. rect_col[1] = 90;
  591. rect_col[2] = 90;
  592. rect_col[3] = 255;
  593. if (rescaleText) text_scale = 20;
  594. font = 'px GameFont';
  595. textLeft = lineWidth / 2 - this.getTextMeasurements([item.name]);
  596. }
  597.  
  598. // rect
  599. this.rect(lineLeft, lineTop, 0, 0, lineWidth, (lineHeight * 2), this.rgba2hex(rect_col[0],rect_col[1],rect_col[2],rect_col[3]), true);
  600.  
  601. // text
  602. this.text(item.name, text_scale+font, this.rgba2hex(text_col[0],text_col[1],text_col[2]), textLeft, lineTop + lineHeight + lineHeight/2);
  603.  
  604. // value
  605. this.text(item.valueStr, text_scale+font, item.valueStr == "On" ? "#B2F252" : item.valueStr == "Off" ? "#FF4444" : active ? "#333333" : "#999EA5", lineWidth - textLeft * 1.5 - this.getTextMeasurements([item.valueStr]), lineTop + lineHeight + lineHeight/2);
  606. }
  607.  
  608. drawMenuItem(caption) {
  609. const top = 280;
  610. const left = 20;
  611. const lineWidth = 320;
  612. const items = this.menus.get(caption);
  613. if (!items.length) return;
  614. if (this.activeLineIndex > items.length -1) this.activeLineIndex = 0;
  615.  
  616. // draw menu
  617. this.drawMenuLine({name:caption,valueStr:''}, lineWidth, 22, top + 18, left, left + 5, false, true);
  618. for (var i = 0; i < items.length; i++) {
  619. if (i != this.activeLineIndex) this.drawMenuLine(items[i][0], lineWidth, 19, top + 60 + i * 36, left, left + 9, false, false);
  620. this.drawMenuLine(items[this.activeLineIndex][0], lineWidth, 19, top + 60 + this.activeLineIndex * 36, left, left + 9, true, false);
  621. }
  622.  
  623. // process buttons
  624. if (this.keyUp("Numpad5")||this.keyUp("ArrowRight")) {
  625. self.SOUND.play('tick_0',0.1)
  626. const feature = items[this.activeLineIndex][0];
  627. if (feature) {
  628. if (feature.container.length) this.onUpdated(feature);
  629. else if (typeof feature.myFunction === "function") feature.myFunction();
  630. else this.activeMenuIndex = this.activeLineIndex + 1;
  631. }
  632. } else if (this.keyUp("Numpad0")||this.keyUp("ArrowLeft")) {
  633. self.SOUND.play('tick_0',0.1);
  634. if (this.activeMenuIndex > 0) this.activeMenuIndex = 0;
  635. else this.settings.showMenu = false;
  636. return;
  637. } else if (this.keyUp("Numpad8")||this.keyUp("ArrowUp")) {
  638. self.SOUND.play('tick_0',0.1)
  639. if (this.activeLineIndex == 0) this.activeLineIndex = items.length;
  640. this.activeLineIndex--;
  641. } else if (this.keyUp("Numpad2")||this.keyUp("ArrowDown")) {
  642. self.SOUND.play('tick_0',0.1)
  643. this.activeLineIndex++;
  644. if (this.activeLineIndex == items.length) this.activeLineIndex = 0;
  645. }
  646. }
  647.  
  648. drawMenu() {
  649. if (this.settings.showMenu) {
  650. switch(this.activeMenuIndex) {
  651. case 0: this.drawMenuItem('Krunker Skid'); break;
  652. case 1: this.drawMenuItem('Self'); break;
  653. case 2: this.drawMenuItem('Weapon'); break;
  654. case 3: this.drawMenuItem('Visual'); break;
  655. case 4: this.drawMenuItem('Settings'); break;
  656. default: break;
  657. }
  658. }
  659. else if (this.keyUp("Numpad0")||this.keyUp("ArrowLeft")) {
  660. self.SOUND.play('tick_0',0.1)
  661. this.settings.showMenu = true;
  662. }
  663. }
  664.  
  665. onRender(uiConfig, scale, world, ui, me, scale2) {
  666. if (uiConfig)
  667. {
  668. uiConfig.crosshairAlways = true;
  669. this.settings.espFontSize = uiConfig.dmgScale * 0.25;
  670. this.canvas = uiConfig.canvas || document.getElementById("game-overlay");
  671. this.ctx = this.canvas.getContext("2d");
  672. this.ctx.save();
  673. this.ctx.clearRect(0, 0, this.canvas.width || innerWidth, this.canvas.height || innerHeight);
  674. if (world && ui && me )
  675. {
  676. if ('none' == self.menuHolder.style.display && 'none' == self.endUI.style.display) {
  677. if (this.settings.espMode > 0) this.drawEsp(ui, world, me);
  678. this.drawMenu();
  679. }
  680. }
  681. this.ctx.restore();
  682. }
  683. }
  684. }
  685.  
  686. function patchGame(source) {
  687. window.GameScript = source;
  688. source = Utilities.toString().concat(source);
  689. const patches = new Map()
  690. // replace obfuscated strings
  691. .set("procInputs", [/igKRxJyx/gm, 'procInputs'])
  692. .set("objInstances", [/eKoEYKcC/gm, 'objInstances'])
  693. .set("isYou", [/OFnPTTpe/gm, 'isYou'])
  694. .set("cnBSeen", [/lhYWIWew/gm, 'cnBSeen'])
  695. .set("canSee", [/BwftfwWS/gm, 'canSee'])
  696. //.set("playerHeight", [/CRMPwyVw/gm, 'playerHeight'])
  697. //.set("playerScale", [/playerScale/gm, 'playerScale'])
  698. .set("getD3D", [/OmPMwAzs/gm, 'getD3D'])
  699. .set("getDistance", [/kwpNBTcj/gm, 'getDistance'])
  700. .set("getXDire", [/SbPUccYE/gm, 'getXDire'])
  701. .set("getDir", [/ujHYahTl/gm, 'getDir'])
  702. .set("socket", [/eXZfoTjts/gm, 'socket'])
  703. .set("mouseDownR", [/hhLaRzBY/gm, 'mouseDownR'])
  704. .set("mouseDownL", [/sMTFGWrl/gm, 'mouseDownL'])
  705. .set("pitchObject", [/vKPtJVFI/gm, 'pitchObject'])
  706. .set("recoilAnimY", [/psKrGopm/gm, 'recoilAnimY'])
  707.  
  708. .set("exports", [/(\['__CANCEL__']=.*?\(\w+,\w+,(\w+)\){)(let)/, '$1window.utilities=new Utilities();utilities.exports=$2;$3'])
  709. .set("controlView", [/(if\(this\['target']\){)/, '$1this.object.rotation.y=this.target.yD;this.pitchObject.rotation.x=this.target.xD;const half=Math.PI/2;this.yDr=Math.max(-half,Math.min(half,this.target.xD))%Math.PI;this.xDr=this.target.yD%Math.PI;'])
  710. .set("Update", [/(this\['update']=function\((\w+),(\w+)\){if\(this\['active']\){)/, '$1utilities.onTick(this,$2);'])
  711. .set("ui", [/(this,\w+={};this\['frustum'])/, 'utilities.ui=$1'])
  712. .set("fixHowler", [/(Howler\['orientation'](.+?)\)\),)/, ``])
  713. .set("clearRec", [/(if\(\w+\['save']\(\),\w+\['scale']\(\w+,\w+\),)\w+\['clearRect']\(0x0,0x0,\w+,\w+\),(\w+\['showDMG']\))/, '$1$2'])
  714. .set("onRender", [/((\w+)\['render']=function\((\w+,\w+,\w+,\w+,\w+)\){)/, '$1utilities.onRender($2,$3);'])
  715. .set("Inputs", [/(!\w+\['moveLock']&&\w+\['tmpInpts']\['push']\((\w+)\))/, "utilities.inputs=$2,$1"])
  716. .set("pInfo", [/(if\((\w+)\['isYou']\|\|!\w+\['objInstances']\)continue;)/, 'if(utilities.settings.espMode==1||utilities.settings.espMode==0)continue;$1'])
  717. .set("wallhack", [/(\(((\w+))=this\['map']\['manager']\['objects']\[(\w+)]\))(.+?)\)/, '$1.penetrable&&$2.active&&!utilities.settings.autoAimWalls)'])
  718. .set("Nathan Is A Fag", [/\['send']\('rt'\)/, ""])
  719.  
  720. for (const [name, item] of patches) {
  721. const patched = source.replace(item[0], item[1]);
  722. if (source === patched) {
  723. alert(`Failed to patch ${name}`);
  724. continue;
  725. } else console.log("Successfully patched ", name);
  726. source = patched;
  727. }
  728.  
  729. return source;
  730. }
  731.  
  732. // Hook - Lemons1337 - Nathan Is NOT 1337
  733. const decode = TextDecoder.prototype.decode;
  734. TextDecoder.prototype.decode = function() {
  735. var code = decode.apply(this, arguments);
  736.  
  737. if (code.length > /*Lemons*/1337 && code[0] === '!') {
  738. code = patchGame(code);
  739. TextDecoder.prototype.decode = decode;
  740. }
  741.  
  742. return code;
  743. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement