ImpulseYT

TAMPERMONKEY KRUNKER SCRIPT

Mar 18th, 2021 (edited)
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 77.04 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Krunker Dogeware - by The Gaming Gurus
  3. // @description The most advanced krunker cheat
  4. // @version 3.7.4
  5. // @author SkidLamer - From The Gaming Gurus
  6. // @supportURL https://skidlamer.github.io/wp
  7. // @homepage https://skidlamer.github.io/
  8. // @iconURL https://i.imgur.com/MqW6Ufx.png
  9. // @namespace https://greasyfork.org/users/704479
  10. // @match *://krunker.io/*
  11. // @exclude *://krunker.io/editor*
  12. // @exclude *://krunker.io/social*
  13. // @run-at document-start
  14. // @grant none
  15. // @noframes
  16. // ==/UserScript==
  17.  
  18. /* eslint-env es6 */
  19. /* eslint-disable curly, no-undef, no-loop-func, no-return-assign, no-sequences */
  20.  
  21. // Donations Accepted
  22. // BTC: 3CsDVq96KgmyPjktUe1YgVSurJVe7LT53G
  23. // ETH: 0x5dbF713F95F7777c84e6EFF5080e2f0e0724E8b1
  24. // ETC: 0xF59BEbe25ECe2ac3373477B5067E07F2284C70f3
  25.  
  26. (function(dogStr, dog) {
  27.  
  28. function Log() {
  29. this.info = (str, args = []) => this.log('info', str, args);
  30. this.warn = (str, args = []) => this.log('warn', str, args);
  31. this.error = (str, args = []) => this.log('error', str, args);
  32. this.log = (level, str, args) => {
  33. let colour = [];
  34. switch(level) {
  35. case 'info':colour=["#07a1d5", "#6e07d5"];break;
  36. case 'error':colour=["#d50707", "#d53a07"];break;
  37. case 'warn':colour=["#d56e07", "#d5d507"];break;
  38. }
  39. console.log('%c '.concat('[ ', level.toUpperCase(), ' ] '), [
  40. `background: linear-gradient(${colour[0]}, ${colour[1]})`
  41. , 'border: 1px solid #3E0E02'
  42. , 'color: white'
  43. , 'display: block'
  44. , 'text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3)'
  45. , 'box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 5px 3px -5px rgba(0, 0, 0, 0.5), 0 -13px 5px -10px rgba(255, 255, 255, 0.4) inset'
  46. , 'line-height: 12px'
  47. , 'text-align: center'
  48. , 'font-weight: bold'
  49. ].join(';'))
  50. if (args.length) console.log(str, args);
  51. else console.log(str);
  52. }
  53. } var log = new Log();
  54.  
  55. class Dogeware {
  56. constructor() {
  57. dog = this;
  58. this.token = null;
  59. this.gameJS = null;
  60. this.generated = false;
  61. console.dir(this);
  62. this.settings = Object.assign({}, {
  63. aimbot: 1,
  64. superSilent: true,
  65. AImbot: true,
  66. frustumCheck: false,
  67. weaponZoom: 1.0,
  68. wallbangs: true,
  69. alwaysAim: false,
  70. pitchHack: 0,
  71. thirdPerson: false,
  72. autoReload: false,
  73. speedHack: false,
  74. rangeCheck: false,
  75. alwaysTrail: false,
  76. spinAimFrames: 10,
  77. animatedBillboards: false,
  78. esp: 1,
  79. espFontSize: 10,
  80. tracers: false,
  81. showGuiButton: true,
  82. awtv: false,
  83. uwtv: false,
  84. forceUnsilent: false,
  85. bhop: 0,
  86. spinBot: false,
  87. markTarget: true,
  88. skinHack: false,
  89. aimOffset: 0,
  90. aimNoise: 0,
  91. keybinds: true,
  92. antikick: true,
  93. fovbox: false,
  94. drawFovbox: true,
  95. fovBoxSize: 1,
  96. guiOnMMB: false,
  97. hideAdverts: false,
  98. hideStreams: false,
  99. hideMerch: false,
  100. hideNewsConsole: false,
  101. hideCookieButton: false,
  102. chams: false,
  103. chamsCol: 1,
  104. wireframe: false,
  105. kpalCSS: true,
  106. customCSS: "",
  107. teamChams: false,
  108. autoNuke: false,
  109. chamsInterval: 500,
  110. preventMeleeThrowing: false,
  111. //autoSwap: false,
  112. forceNametagsOn: false,
  113. aimbotRange: 0,
  114. });
  115. this.state = Object.assign({}, {
  116. bindAimbotOn: true,
  117. quickscopeCanShoot: true,
  118. spinFrame: 0,
  119. pressedKeys: new Set(),
  120. spinCounter: 0,
  121. activeTab: 0,
  122. nameTags: false,
  123. frame: 0
  124. });
  125. this.gaybow = 0;
  126. this.colors = {
  127. White: "#FFFFFF",
  128. Black: "#000000",
  129. Purple: "#9400D3",
  130. Pink: "#FF1493",
  131. Blue: "#1E90FF",
  132. DarkBlue: "#0000FF",
  133. Aqua: "#00FFFF",
  134. Green: "#008000",
  135. Lime: "#7FFF00",
  136. Orange: "#FF8C00",
  137. Yellow: "#FFFF00",
  138. Red: "#FF0000",
  139. }
  140. this.vars = {};
  141. this.GUI = {};
  142. try {
  143. this.onLoad();
  144. } catch (e) {
  145. console.error(e);
  146. console.trace(e.stack);
  147. }
  148. }
  149.  
  150. onLoad() {
  151.  
  152. this.waitFor(_=>document.documentElement instanceof window.HTMLElement).then(_=>{
  153. this.iframe();
  154. })
  155. this.createObservers();
  156. this.defines();
  157. localStorage.kro_setngss_json ? Object.assign(this.settings, JSON.parse(localStorage.kro_setngss_json)) :
  158. localStorage.kro_setngss_json = JSON.stringify(this.settings);
  159. this.createListeners();
  160. this.waitFor(_=>this.token).then(_ => {
  161. if (!this.token) location.reload();
  162. this.version = /\['exports']\['gameVersion']='(\d+\.\d+\.\d+)',/.exec(this.gameJS)[1];
  163. if ( this.isElectron() || !this.isDefined(GM) ) {
  164. const loader = new Function("WP_fetchMMToken", "Module", this.gamePatch());
  165. loader(new Promise(res=>res(this.token)), { csv: async () => 0 });
  166. } else if (GM.info.script.version !== this.version) {
  167. alert("This Script Needs Updating by Skidlamer, visit The GamingGurus Discord");
  168. return window.location.assign("https://skidlamer.github.io/wp");
  169. } else {
  170. const loader = new Function("WP_fetchMMToken", "Module", this.gamePatch());
  171. loader(new Promise(res=>res(this.token)), { csv: async () => 0 });
  172. }
  173. return this.hooking();
  174. })
  175. }
  176.  
  177. isType(item, type) {
  178. return typeof item === type;
  179. }
  180.  
  181. isDefined(item) {
  182. return !this.isType(item, "undefined") && item !== null;
  183. }
  184.  
  185. objectHas(obj, arr) {
  186. return arr.some(prop => obj.hasOwnProperty(prop));
  187. }
  188.  
  189. createElement(type, html, id) {
  190. let newElement = document.createElement(type)
  191. if (id) newElement.id = id
  192. newElement.innerHTML = html
  193. return newElement
  194. }
  195.  
  196. getVersion() {
  197. //const elems = document.getElementsByClassName('terms');
  198. //const version = elems[elems.length - 1].innerText;
  199. return this.version//version;
  200. }
  201.  
  202. isElectron() {
  203. // Renderer process
  204. if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
  205. return true;
  206. }
  207.  
  208. // Main process
  209. if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
  210. return true;
  211. }
  212.  
  213. // Detect the user agent when the `nodeIntegration` option is set to true
  214. if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
  215. return true;
  216. }
  217.  
  218. return false;
  219. }
  220.  
  221. saveAs(name, data) {
  222. let blob = new Blob([data], {
  223. type: 'text/plain'
  224. });
  225. let el = window.document.createElement("a");
  226. el.href = window.URL.createObjectURL(blob);
  227. el.download = name;
  228. window.document.body.appendChild(el);
  229. el.click();
  230. window.document.body.removeChild(el);
  231. }
  232.  
  233. saveScript() {
  234. this.fetchScript().then(script => {
  235. this.saveAs("game_" + this.getVersion() + ".js", script)
  236. })
  237. }
  238.  
  239. gamePatch() {
  240. let entries = {
  241. inView: {
  242. regex: /(\w+\['(\w+)']\){if\(\(\w+=\w+\['\w+']\['position']\['clone']\(\))/,
  243. index: 2
  244. },
  245. procInputs: {
  246. regex: /this\['(\w+)']=function\((\w+),(\w+),\w+,\w+\){(this)\['recon']/,
  247. index: 1
  248. },
  249. aimVal: {
  250. regex: /this\['(\w+)']-=0x1\/\(this\['weapon']\['\w+']\/\w+\)/,
  251. index: 1
  252. },
  253. didShoot: {
  254. regex: /--,\w+\['(\w+)']=!0x0/,
  255. index: 1
  256. },
  257. nAuto: {
  258. regex: /'Single\\x20Fire','varN':'(\w+)'/,
  259. index: 1
  260. },
  261. crouchVal: {
  262. regex: /this\['(\w+)']\+=\w\['\w+']\*\w+,0x1<=this\['\w+']/,
  263. index: 1
  264. },
  265. ammos: {
  266. regex: /\['length'];for\(\w+=0x0;\w+<\w+\['(\w+)']\['length']/,
  267. index: 1
  268. },
  269. weaponIndex: {
  270. regex: /\['weaponConfig']\[\w+]\['secondary']&&\(\w+\['(\w+)']==\w+/,
  271. index: 1
  272. },
  273. objInstances: {
  274. regex: /\w+\['\w+']\(0x0,0x0,0x0\);if\(\w+\['(\w+)']=\w+\['\w+']/,
  275. index: 1
  276. },
  277. //reloadTimer: {regex: /this\['(\w+)']&&\(\w+\['\w+']\(this\),\w+\['\w+']\(this\)/, index: 1},
  278. reloadTimer: {
  279. regex: /0x0>=this\['(\w+')]&&0x0>=this\['swapTime']/,
  280. index: 1
  281. },
  282. recoilAnimY: {
  283. regex: /this\['(\w+)']\+=this\['\w+']\*\(/,
  284. index: 1
  285. },
  286. maxHealth: {
  287. regex: /this\['health']\/this\['(\w+)']\?/,
  288. index: 1
  289. },
  290. //xVel: { regex: /this\['x']\+=this\['(\w+)']\*\w+\['map']\['config']\['speedX']/, index: 1 },
  291. yVel: {
  292. regex: /this\['(\w+)']=this\['\w+'],this\['visible']/,
  293. index: 1
  294. },
  295. //zVel: { regex: /this\['z']\+=this\['(\w+)']\*\w+\['map']\['config']\['speedZ']/, index: 1 },
  296. // Patches
  297. socket: {
  298. regex: /\['onopen']=\(\)=>{/,
  299. patch: `$&${dogStr}.socket=this;`
  300. },
  301. //frustum: {regex: /(;const (\w+)=this\['frustum']\['containsPoint'];.*?return)!0x1/, patch: "$1 $2"},
  302. //videoAds: {regex: /!function\(\){var \w+=document\['createElement']\('script'\);.*?}\(\);/, patch: ""},
  303. anticheat1:{regex: /&&\w+\(\),window\['utilities']&&\(\w+\(null,null,null,!0x0\),\w+\(\)\)/, patch: ""},
  304. anticheat2:{regex: /(\[]instanceof Array;).*?(var)/, patch: "$1 $2"},
  305. anticheat3:{regex: /windows\['length'\]>\d+.*?0x25/, patch: `0x25`},
  306. //anticheat4:{regex: /(\w+\=)\(!menuItemContainer\['innerHTML']\['includes'].*?\);/, patch: `$1false;`},
  307. //anticheat4:{regex: /kro_utilities_/g, patch: `K_P_A_L__IS__A__G_A_Y__P_E_D_O`},
  308. //kpal:{regex: /1tWAEJx/g, patch: `K_P_A_L__IS__A__G_A_Y__P_E_D_O`},
  309. //kpal2:{regex: /jjkFpnV/g, patch: `K_P_A_L__IS__A__G_A_Y__P_E_D_O`},
  310.  
  311. writeable: {
  312. regex: /'writeable':!0x1/g,
  313. patch: "writeable:true"
  314. },
  315. configurable: {
  316. regex: /'configurable':!0x1/g,
  317. patch: "configurable:true"
  318. },
  319. typeError: {
  320. regex: /throw new TypeError/g,
  321. patch: "console.error"
  322. },
  323. error: {
  324. regex: /throw new Error/g,
  325. patch: "console.error"
  326. },
  327. //exports: {regex: /(this\['\w+']\['\w+']\(this\);};},function\(\w+,\w+,(\w+)\){)/, patch: `$1 ${dogStr}.exports=$2.c; ${dogStr}.modules=$2.m;`},
  328. inputs: {
  329. regex: /(\w+\['\w+']\[\w+\['\w+']\['\w+']\?'\w+':'push']\()(\w+)\),/,
  330. patch: `$1${dogStr}.inputs($2)),`
  331. },
  332. nametags: {
  333. regex: /&&(\w+\['\w+'])\){(if\(\(\w+=\w+\['\w+']\['\w+']\['\w+'])/,
  334. patch: `){if(!$1&&!${dogStr}.state.nameTags)continue;$2`
  335. },
  336. wallbangs: {
  337. regex: /!(\w+)\['transparent']/,
  338. patch: `${dogStr}.settings.wallbangs?!$1.penetrable : !$1.transparent`
  339. },
  340. thirdPerson: {
  341. regex: /(\w+)\[\'config\'\]\[\'thirdPerson\'\]/g,
  342. patch: `${dogStr}.settings.thirdPerson`
  343. },
  344. };
  345. let script = this.gameJS;
  346. for (let name in entries) {
  347. let object = entries[name];
  348. let found = object.regex.exec(script);
  349. if (object.hasOwnProperty('index')) {
  350. if (!found) {
  351. object.val = null;
  352. //alert("Failed to Find " + name);
  353. console.error("Failed to Find " + name);
  354. } else {
  355. object.val = found[object.index];
  356. console.log("Found ", name, ":", object.val);
  357. }
  358. Object.defineProperty(dog.vars, name, {
  359. configurable: false,
  360. value: object.val
  361. });
  362. } else if (found) {
  363. script = script.replace(object.regex, object.patch);
  364. console.log("Patched ", name);
  365. } else console.error("Failed to Patch " + name); //alert("Failed to Patch " + name);
  366. }
  367. return script;
  368. }
  369.  
  370. async fetchScript() {
  371. const data = await this.request("https://krunker.io/social.html", "text");
  372. const buffer = await this.request("https://krunker.io/pkg/krunker." + /\w.exports="(\w+)"/.exec(data)[1] + ".vries", "arrayBuffer");
  373. const array = Array.from(new Uint8Array(buffer));
  374. const xor = array[0] ^ '!'.charCodeAt(0);
  375. return array.map((code) => String.fromCharCode(code ^ xor)).join('');
  376. }
  377.  
  378. async request(url, type, opt = {}) {
  379. return fetch(url, opt).then(response => {
  380. if (!response.ok) {
  381. throw new Error("Network response from " + url + " was not ok")
  382. }
  383. return response[type]()
  384. })
  385. }
  386.  
  387. async waitFor(test, timeout_ms = 2e4, doWhile = null) {
  388. let sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
  389. return new Promise(async (resolve, reject) => {
  390. if (typeof timeout_ms != "number") reject("Timeout argument not a number in waitFor(selector, timeout_ms)");
  391. let result, freq = 100;
  392. while (result === undefined || result === false || result === null || result.length === 0) {
  393. if (doWhile && doWhile instanceof Function) doWhile();;
  394. if (timeout_ms % 10000 < freq) console.log("waiting for: ", test);
  395. if ((timeout_ms -= freq) < 0) {
  396. console.log("Timeout : ", test);
  397. resolve(false);
  398. return;
  399. }
  400. await sleep(freq);
  401. result = typeof test === "string" ? Function(test)() : test();
  402. }
  403. console.log("Passed : ", test);
  404. resolve(result);
  405. });
  406. };
  407.  
  408. async hooking() {
  409. await this.waitFor(_ => this.isDefined(this.socket))
  410. if (!this.isDefined(this.socket)) location.assign(location.origin);
  411. this.wsEvent = this.socket._dispatchEvent.bind(this.socket);
  412. this.wsSend = this.socket.send.bind(this.socket);
  413. this.socket.send = new Proxy(this.socket.send, {
  414. apply(target, that, args) {
  415. if (args[0] === "en") {
  416. //args[ args.length - 1 ] = true; // AntiPedo
  417. that.skinCache = {
  418. main: args[1][2][0],
  419. secondary: args[1][2][1],
  420. hat: args[1][3],
  421. body: args[1][4],
  422. knife: args[1][9],
  423. dye: args[1][14],
  424. waist: args[1][17],
  425. }
  426. }
  427. return Reflect.apply(...arguments);
  428. }
  429. })
  430. this.socket._dispatchEvent = new Proxy(this.socket._dispatchEvent, {
  431. apply(target, that, args) {
  432. if (dog.settings.skinHack && that.skinCache && args[0] === "0") {
  433. let pInfo = args[1][0];
  434. let pSize = 38;
  435. while (pInfo.length % pSize !== 0) pSize++;
  436. for (let i = 0; i < pInfo.length; i += pSize) {
  437. if (pInfo[i] === that.socketId || 0) {
  438. pInfo[i + 12] = [that.skinCache.main, that.skinCache.secondary];
  439. pInfo[i + 13] = that.skinCache.hat;
  440. pInfo[i + 14] = that.skinCache.body;
  441. pInfo[i + 19] = that.skinCache.knife;
  442. pInfo[i + 24] = that.skinCache.dye;
  443. pInfo[i + 33] = that.skinCache.waist;
  444. }
  445. }
  446. }
  447.  
  448. return target.apply(that, args);
  449. }
  450. })
  451.  
  452. await this.waitFor(_ => this.isDefined(this.overlay))
  453. this.ctx = this.overlay.canvas.getContext('2d');
  454. this.overlay.render = new Proxy(this.overlay.render, {
  455. apply(target, that, args) {
  456. ["scale", "game", "controls", "renderer", "me"].forEach((item, index) => {
  457. dog[item] = args[index]
  458. });
  459. Reflect.apply(...arguments);
  460. if (dog.me && dog.ctx) {
  461. dog.ctx.save();
  462. dog.ctx.scale(dog.scale, dog.scale);
  463. dog.render();
  464. dog.ctx.restore();
  465. }
  466. }
  467. })
  468.  
  469. this.cleanGUI();
  470. this.customCSS();
  471. await this.waitFor(_ => this.isDefined(window.windows));
  472. this.initGUI();
  473. }
  474.  
  475. defines() {
  476. const $origSkins = Symbol("origSkins"),
  477. $localSkins = Symbol("localSkins");
  478.  
  479. Object.defineProperties(Object.prototype, {
  480. //isFaceIT: {
  481. // get() { return true }
  482. //},
  483. canvas: {
  484. set(val) {
  485. this._value = val;
  486. },
  487. get() {
  488. let object = this;
  489. if (dog.objectHas(object, ["healthColE", "healthColT", "dmgColor"])) {
  490. dog.overlay = this;
  491. }
  492. return this._value;
  493. }
  494. },
  495. RENDER: {
  496. set(val) {
  497. this._value = val;
  498. dog.renderer = this._value;
  499.  
  500. Object.defineProperty(this._value, "adsFovMlt", {
  501. get() {
  502. return dog.settings.weaponZoom
  503. }
  504. })
  505.  
  506. dog.fxComposer = this;
  507. },
  508. get() {
  509. return this._value;
  510. }
  511. },
  512. OBJLoader: {
  513. set(val) {
  514. dog.three = this;
  515. this._value = val;
  516. },
  517. get() {
  518. return this._value;
  519. }
  520. },
  521. skins: {
  522. set(fn) {
  523. this[$origSkins] = fn;
  524. if (void 0 == this.localSkins || !this.localSkins.length) {
  525. this[$localSkins] = Array.apply(null, Array(5e3)).map((x, i) => {
  526. return {
  527. ind: i,
  528. cnt: 0x1,
  529. }
  530. })
  531. }
  532. return fn;
  533. },
  534. get() {
  535. return dog.settings.skinHack && this.stats ? this[$localSkins] : this[$origSkins];
  536. }
  537. },
  538. useLooseClient: {
  539. enumerable: false,
  540. get() {
  541. return this._ulc
  542. },
  543. set(v) {
  544. //dog.config = this
  545. // Increase the rate in which inView is updated to every frame, making aimbot way more responsive
  546. Object.defineProperty(this, "nameVisRate", {
  547. value: 0,
  548. writable: false,
  549. configurable: true,
  550. })
  551. this._ulc = v
  552. }
  553. },
  554. trail: { // All weapon tracers
  555. enumerable: false,
  556. get() {
  557. return dog.settings.alwaysTrail || this._trail
  558. },
  559. set(v) {
  560. this._trail = v
  561. }
  562. },
  563. showTracers: {
  564. enumerable: false,
  565. get() {
  566. return dog.settings.alwaysTrail || this._showTracers
  567. },
  568. set(v) {
  569. this._showTracers = v
  570. }
  571. },
  572. shaderId: { // Animated billboards
  573. enumerable: false,
  574. get() {
  575. if (this.src && this.src.startsWith("pubs/")) return dog.settings.animatedBillboards ? 1 : this.rshaderId;
  576. else return this.rshaderId
  577. },
  578. set(v) {
  579. this.rshaderId = v
  580. }
  581. },
  582. // Clientside prevention of inactivity kick
  583. idleTimer: {
  584. enumerable: false,
  585. get() {
  586. return dog.settings.antikick ? 0 : this._idleTimer
  587. },
  588. set(v) {
  589. this._idleTimer = v
  590. }
  591. },
  592. kickTimer: {
  593. enumerable: false,
  594. get() {
  595. return dog.settings.antikick ? Infinity : this._kickTimer
  596. },
  597. set(v) {
  598. this._kickTimer = v
  599. }
  600. },
  601. })
  602.  
  603. // disable audioparam errors
  604. Object.keys(AudioParam.prototype).forEach(name => {
  605. if (Object.getOwnPropertyDescriptor(AudioParam.prototype, name).get) return
  606. const old = AudioParam.prototype[name]
  607. AudioParam.prototype[name] = function() {
  608. try {
  609. return old.apply(this, arguments)
  610. } catch (e) {
  611. console.log("AudioParam error:\n" + e)
  612. return false
  613. }
  614. }
  615. })
  616. }
  617.  
  618. iframe() {
  619. const iframe = document.createElement('iframe');
  620. iframe.setAttribute('style', 'display:none');
  621. iframe.setAttribute("id", dogStr);
  622. iframe.src = location.origin;
  623. document.documentElement.appendChild(iframe);
  624.  
  625. const ifrWin = iframe.contentWindow;
  626. const ifrDoc = iframe.contentDocument?iframe.contentDocument:iframe.contentWindow.document;
  627.  
  628. let skidneySplizy = 0;
  629.  
  630. ifrWin.TextDecoder.prototype.decode = new Proxy(window.TextDecoder.prototype.decode, {
  631. apply: function(target, that, args) {
  632. let string = Reflect.apply(...arguments);
  633. if (string.length > 5e4) {
  634. log.warn("skidneySplizy = " + skidneySplizy);
  635. if (skidneySplizy == 0) {
  636. dog.gameJS = string;
  637. } else {
  638. dog.gameJS += string;
  639. } skidneySplizy ++;
  640. //console.log(string.length)
  641. /*
  642. if (!dog.gameJS) {
  643. dog.gameJS = string;
  644. console.log("1stSTR");
  645. } else {
  646. dog.gameJS += string;
  647. console.log("2ndSTR");
  648. }
  649. */
  650. } //else //console.log(string.length)
  651. if (string.includes("generate-token")) dog.generated = true;
  652. else if (string.length == 40||dog.generated) {
  653. dog.token = string;
  654. console.log("Token ", string);
  655. document.documentElement.removeChild(iframe);
  656. }
  657. return string;
  658. },
  659. });
  660. }
  661.  
  662. createObservers() {
  663.  
  664. let observer = new MutationObserver(mutations => {
  665. for (let mutation of mutations) {
  666. for (let node of mutation.addedNodes) {
  667. if (node.tagName === 'SCRIPT') {
  668. if (node.type === "text/javascript" && node.innerHTML.startsWith("*!", 1)) {
  669. node.innerHTML = "";
  670. observer.disconnect();
  671. } else if (node.src) {
  672. //console.log(node.src);
  673. }
  674. }
  675. }
  676. }
  677. });
  678. observer.observe(document, {
  679. childList: true,
  680. subtree: true
  681. });
  682. }
  683.  
  684. createListeners() {
  685.  
  686. window.addEventListener("mouseup", (e) => {
  687. if (e.which === 2 && dog.settings.guiOnMMB) {
  688. e.preventDefault()
  689. dog.showGUI()
  690. }
  691. })
  692. window.addEventListener("keyup", event => {
  693. if (this.state.pressedKeys.has(event.code)) this.state.pressedKeys.delete(event.code)
  694. if (!(document.activeElement.tagName === "INPUT" || !window.endUI && window.endUI.style.display) && dog.settings.keybinds) {
  695. switch (event.code) {
  696. case "KeyY":
  697. this.state.bindAimbotOn = !this.state.bindAimbotOn
  698. this.wsEvent("ch", [null, ("Aimbot " + (this.state.bindAimbotOn ? "on" : "off")), 1])
  699. break
  700. case "KeyH":
  701. this.settings.esp = (this.settings.esp + 1) % 4
  702. this.wsEvent("ch", [null, "ESP: " + ["disabled", "nametags", "box", "full"][this.settings.esp], 1])
  703. break
  704. }
  705. }
  706. })
  707. window.addEventListener("keydown", event => {
  708. if (event.code == "F1") {
  709. event.preventDefault();
  710. dog.showGUI();
  711. }
  712. if ('INPUT' == document.activeElement.tagName || !window.endUI && window.endUI.style.display) return;
  713. switch (event.code) {
  714. case 'NumpadSubtract':
  715. document.exitPointerLock();
  716. //console.log(document.exitPointerLock)
  717. console.dirxml(this)
  718. break;
  719. default:
  720. if (!this.state.pressedKeys.has(event.code)) this.state.pressedKeys.add(event.code);
  721. break;
  722. }
  723. })
  724. }
  725.  
  726. inputs(input) {
  727. const key = {
  728. frame: 0,
  729. delta: 1,
  730. xdir: 2,
  731. ydir: 3,
  732. moveDir: 4,
  733. shoot: 5,
  734. scope: 6,
  735. jump: 7,
  736. reload: 8,
  737. crouch: 9,
  738. weaponScroll: 10,
  739. weaponSwap: 11,
  740. moveLock: 12
  741. }
  742.  
  743. const moveDir = {
  744. leftStrafe: 0,
  745. forward: 1,
  746. rightStrafe: 2,
  747. right: 3,
  748. backwardRightStrafe: 4,
  749. backward: 5,
  750. backwardLeftStrafe: 6,
  751. left: 7
  752. }
  753.  
  754. this.state.frame = input[key.frame];
  755. this.state.nameTags = [1, 2].some(n => n == this.settings.esp) || this.settings.forceNametagsOn;
  756.  
  757. if (this.me) {
  758.  
  759. // AUTO NUKE
  760. if (this.settings.autoNuke && Object.keys(this.me.streaks).length) {
  761. this.wsSend("k", 0)
  762. }
  763.  
  764. //AUTO BHOP
  765. if (this.settings.bhop) {
  766. if (this.state.pressedKeys.has("Space") || this.settings.bhop % 2) {
  767. this.controls.keys[this.controls.binds.jumpKey.val] ^= 1;
  768. if (this.controls.keys[this.controls.binds.jumpKey.val]) {
  769. this.controls.didPressed[this.controls.binds.jumpKey.val] = 1;
  770. }
  771. if (this.state.pressedKeys.has("Space") || this.settings.bhop == 3) {
  772. if (this.me[this.vars.yVel] < -0.03 && this.me.canSlide) {
  773. setTimeout(() => {
  774. this.controls.keys[this.controls.binds.crouchKey.val] = 0;
  775. }, this.me.slideTimer || 325);
  776. this.controls.keys[this.controls.binds.crouchKey.val] = 1;
  777. this.controls.didPressed[this.controls.binds.crouchKey.val] = 1;
  778. }
  779. }
  780. }
  781. }
  782.  
  783. // Makes nametags show in custom games, where nametags are disabled
  784. if (this.settings.forceNametagsOn) {
  785. try {
  786. Object.defineProperty(this.game.config, "nameTags", {
  787. get() {
  788. return dog.settings.forceNametagsOn ? false : this.game._nametags
  789. },
  790. set(v) {
  791. this.game._nametags = v
  792. }
  793. })
  794. } catch (e) {}
  795. }
  796.  
  797.  
  798. if (this.settings.spinBot) {
  799. const rate = 1
  800. input[key.moveDir] !== -1 && (input[key.moveDir] = (input[key.moveDir] + this.state.spinCounter - Math.round(7 * (input[key.ydir] / (Math.PI * 2000)))) % 7)
  801. input[key.ydir] = this.state.spinCounter / 7 * (Math.PI * 2000)
  802. input[key.frame] % rate === 0 && (this.state.spinCounter = (this.state.spinCounter + 1) % 7)
  803. }
  804.  
  805. // AUTO SWAP (not working idk why)
  806. // if (this.settings.autoSwap && !this.me.weapon.secondary && this.me[this.vars.ammos][0] === 0 && this.me[this.vars.ammos][1] > 0 && !this.me.swapTime && !this.me[this.vars.reloadTimer]) {
  807. // input[key.weaponSwap] = 1
  808. //}
  809.  
  810. // AUTO RELOAD
  811. if (this.settings.autoReload && this.me[this.vars.ammos][this.me[this.vars.weaponIndex]] === 0) {
  812. input[key.reload] = 1
  813. }
  814.  
  815. // PITCH HACK
  816. if (this.settings.pitchHack) {
  817. switch (this.settings.pitchHack) {
  818. case 1:
  819. input[key.xdir] = -Math.PI * 500
  820. break
  821. case 2:
  822. input[key.xdir] = Math.PI * 500
  823. break
  824. case 3:
  825. input[key.xdir] = Math.sin(Date.now() / 50) * Math.PI * 500
  826. break
  827. case 4:
  828. input[key.xdir] = Math.sin(Date.now() / 250) * Math.PI * 500
  829. break
  830. case 5:
  831. input[key.xdir] = input[key.frame] % 2 ? Math.PI * 500 : -Math.PI * 500
  832. break
  833. case 6:
  834. input[key.xdir] = (Math.random() * Math.PI - Math.PI / 2) * 1000
  835. break
  836. }
  837. }
  838.  
  839. // Add the `pos` property to Players and AIs
  840. const getNoise = () => (Math.random() * 2 - 1) * this.settings.aimNoise
  841. this.game.players.list.forEach(v => {
  842. v.pos = {
  843. x: v.x,
  844. y: v.y,
  845. z: v.z
  846. };
  847. v.npos = {
  848. x: v.x + getNoise(),
  849. y: v.y + getNoise(),
  850. z: v.z + getNoise()
  851. };
  852. v.isTarget = false
  853. })
  854. if (this.game.AI.ais) {
  855. this.game.AI.ais.forEach(v => v.npos = v.pos = {
  856. x: v.x,
  857. y: v.y,
  858. z: v.z
  859. })
  860. }
  861.  
  862. // AIMBOT
  863. if (this.renderer && this.renderer.frustum && this.me.active) {
  864. this.controls.target = null
  865.  
  866. // Finds all the visible enemies
  867. let targets = this.game.players.list.filter(enemy => !enemy.isYTMP && enemy.hasOwnProperty('npos') && (!this.settings.frustumCheck || this.containsPoint(enemy.npos)) && ((this.me.team === null || enemy.team !== this.me.team) && enemy.health > 0 && enemy[this.vars.inView])).sort((e, e2) => this.getDistance(this.me.x, this.me.z, e.npos.x, e.npos.z) - this.getDistance(this.me.x, this.me.z, e2.npos.x, e2.npos.z));
  868. let target = targets[0];
  869.  
  870. // If there's a fov box, pick an enemy inside it instead (if there is)
  871. if (this.settings.fovbox) {
  872. const scale = this.scale || parseFloat(document.getElementById("uiBase").style.transform.match(/\((.+)\)/)[1])
  873. const width = innerWidth / scale,
  874. height = innerHeight / scale
  875.  
  876. let foundTarget = false
  877. for (let i = 0; i < targets.length; i++) {
  878. const t = targets[i]
  879. const sp = this.world2Screen(new this.three.Vector3(t.x, t.y, t.z), width, height, t.height / 2)
  880. let fovBox = [width / 3, height / 4, width * (1 / 3), height / 2]
  881. switch (this.settings.fovBoxSize) {
  882. // medium
  883. case 2:
  884. fovBox = [width * 0.4, height / 3, width * 0.2, height / 3]
  885. break
  886. // small
  887. case 3:
  888. fovBox = [width * 0.45, height * 0.4, width * 0.1, height * 0.2]
  889. break
  890. }
  891. if (sp.x >= fovBox[0] && sp.x <= (fovBox[0] + fovBox[2]) && sp.y >= fovBox[1] && sp.y < (fovBox[1] + fovBox[3])) {
  892. target = targets[i]
  893. foundTarget = true
  894. break
  895. }
  896. }
  897. if (!foundTarget) {
  898. target = void "kpal"
  899. }
  900. }
  901.  
  902. let isAiTarget = false
  903. if (this.game.AI.ais && this.settings.AImbot) {
  904. let aiTarget = this.game.AI.ais.filter(ent => ent.mesh && ent.mesh.visible && ent.health && ent.pos && ent.canBSeen).sort((p1, p2) => this.getDistance(this.me.x, this.me.z, p1.pos.x, p1.pos.z) - this.getDistance(this.me.x, this.me.z, p2.pos.x, p2.pos.z)).shift()
  905. if (!target || (aiTarget && this.getDistance(this.me.x, this.me.z, aiTarget.pos.x, aiTarget.pos.z) > this.getDistance(this.me.x, this.me.z, target.pos.x, target.pos.z))) {
  906. target = aiTarget
  907. isAiTarget = true
  908. }
  909. }
  910.  
  911. const isShooting = input[key.shoot]
  912. if (target && this.settings.aimbot &&
  913. this.state.bindAimbotOn &&
  914. (!this.settings.aimbotRange || this.getDistance3D(this.me.x, this.me.y, this.me.z, target.x, target.y, target.z) < this.settings.aimbotRange) &&
  915. (!this.settings.rangeCheck || this.getDistance3D(this.me.x, this.me.y, this.me.z, target.x, target.y, target.z) <= this.me.weapon.range) &&
  916. !this.me[this.vars.reloadTimer]) {
  917.  
  918. if (this.settings.awtv) {
  919. input[key.scope] = 1
  920. }
  921. target.isTarget = this.settings.markTarget
  922.  
  923. const yDire = (this.getDir(this.me.z, this.me.x, target.npos.z, target.npos.x) || 0) * 1000
  924. const xDire = isAiTarget ?
  925. ((this.getXDir(this.me.x, this.me.y, this.me.z, target.npos.x, target.npos.y - target.dat.mSize / 2, target.npos.z) || 0) - (0.3 * this.me[this.vars.recoilAnimY])) * 1000 :
  926. ((this.getXDir(this.me.x, this.me.y, this.me.z, target.npos.x, target.npos.y - target[this.vars.crouchVal] * 3 + this.me[this.vars.crouchVal] * 3 + this.settings.aimOffset, target.npos.z) || 0) - (0.3 * this.me[this.vars.recoilAnimY])) * 1000
  927.  
  928. // aimbot tweak
  929. if (this.settings.forceUnsilent) {
  930. this.controls.target = {
  931. xD: xDire / 1000,
  932. yD: yDire / 1000
  933. }
  934. this.controls.update(400)
  935. }
  936.  
  937. // Different aimbot modes can share the same code
  938. switch (this.settings.aimbot) {
  939. // quickscope, silent, trigger aim, silent on aim, aim correction, unsilent
  940. case 1:
  941. case 2:
  942. case 5:
  943. case 6:
  944. case 9:
  945. case 10: {
  946. let onAim = [5, 6, 9].some(n => n == this.settings.aimbot)
  947. if ((this.settings.aimbot === 5 && input[key.scope]) || this.settings.aimbot === 10) {
  948. this.controls.target = {
  949. xD: xDire / 1000,
  950. yD: yDire / 1000
  951. }
  952. this.controls.update(400)
  953. }
  954. if ([2, 10].some(n => n == this.settings.aimbot) || (this.settings.aimbot === 1 && this.me.weapon.id)) {
  955. !this.me.weapon.melee && (input[key.scope] = 1)
  956. }
  957. if (this.me[this.vars.didShoot]) {
  958. input[key.shoot] = 0
  959. this.state.quickscopeCanShoot = false
  960. setTimeout(() => {
  961. this.state.quickscopeCanShoot = true
  962. }, this.me.weapon.rate * .85)
  963. } else if (this.state.quickscopeCanShoot && (!onAim || input[key.scope])) {
  964. if (!this.me.weapon.melee) {
  965. input[key.scope] = 1
  966. }
  967. if (!this.settings.superSilent && this.settings.aimbot !== 9) {
  968. input[key.ydir] = yDire
  969. input[key.xdir] = xDire
  970. }
  971. if ((this.settings.aimbot !== 9 && (!this.me[this.vars.aimVal] || this.me.weapon.noAim || this.me.weapon.melee)) ||
  972. (this.settings.aimbot === 9 && isShooting)) {
  973. input[key.ydir] = yDire
  974. input[key.xdir] = xDire
  975. input[key.shoot] = 1
  976. }
  977. }
  978. }
  979. break
  980. // spin aim useless rn
  981. // case 3: {
  982. // if (me[dog.vars.didShoot]) {
  983. // input[key.shoot] = 0
  984. // dog.state.quickscopeCanShoot = false
  985. // setTimeout(() => {
  986. // dog.state.quickscopeCanShoot = true
  987. // }, me.weapon.rate)
  988. // } else if (dog.state.quickscopeCanShoot && !dog.state.spinFrame) {
  989. // dog.state.spinFrame = input[key.frame]
  990. // } else {
  991. // const fullSpin = Math.PI * 2000
  992. // const spinFrames = dog.settings.spinAimFrames
  993. // const currentSpinFrame = input[key.frame]-dog.state.spinFrame
  994. // if (currentSpinFrame < 0) {
  995. // dog.state.spinFrame = 0
  996. // }
  997. // if (currentSpinFrame > spinFrames) {
  998. // if (!dog.settings.superSilent) {
  999. // input[key.ydir] = yDire
  1000. // input[key.xdir] = xDire
  1001. // }
  1002. // if (!me[dog.vars.aimVal] || me.weapon.noAim || me.weapon.melee) {
  1003. // input[key.ydir] = yDire
  1004. // input[key.xdir] = xDire
  1005. // input[key.shoot] = 1
  1006. // dog.state.spinFrame = 0
  1007. // }
  1008. // } else {
  1009. // input[key.ydir] = currentSpinFrame/spinFrames * fullSpin
  1010. // if (!me.weapon.melee)
  1011. // input[key.scope] = 1
  1012. // }
  1013. // }
  1014. // } break
  1015.  
  1016. // aim assist, smooth on aim, smoother, easy aim assist
  1017. case 4:
  1018. case 7:
  1019. case 8:
  1020. case 11:
  1021. if (input[key.scope] || this.settings.aimbot === 11) {
  1022. this.controls.target = {
  1023. xD: xDire / 1000,
  1024. yD: yDire / 1000
  1025. }
  1026. this.controls.update(({
  1027. 4: 400,
  1028. 7: 110,
  1029. 8: 70,
  1030. 11: 400
  1031. })[this.settings.aimbot])
  1032. if ([4, 11].some(n => n == this.settings.aimbot)) {
  1033. input[key.xdir] = xDire
  1034. input[key.ydir] = yDire
  1035. }
  1036. if (this.me[this.vars.didShoot]) {
  1037. input[key.shoot] = 0
  1038. this.state.quickscopeCanShoot = false
  1039. setTimeout(() => {
  1040. this.state.quickscopeCanShoot = true
  1041. }, this.me.weapon.rate * 0.85)
  1042. } else if (this.state.quickscopeCanShoot) {
  1043. input[this.me.weapon.melee ? key.shoot : key.scope] = 1
  1044. }
  1045. } else {
  1046. this.controls.target = null
  1047. }
  1048. break
  1049. // trigger bot
  1050. case 12: {
  1051. if (!this.three ||
  1052. !this.renderer ||
  1053. !this.renderer.camera ||
  1054. !this.game ||
  1055. !this.game.players ||
  1056. !this.game.players.list.length ||
  1057. !input[key.scope] ||
  1058. this.me[this.vars.aimVal]) {
  1059. break
  1060. }
  1061. // Only create these once for performance
  1062. if (!this.state.raycaster) {
  1063. this.state.raycaster = new this.three.Raycaster()
  1064. this.state.mid = new this.three.Vector2(0, 0)
  1065. }
  1066. const playerMaps = []
  1067. for (let i = 0; i < this.game.players.list.length; i++) {
  1068. let p = this.game.players.list[i]
  1069. if (!p || !p[this.vars.objInstances] || p.isYTMP || !(this.me.team === null || p.team !== this.me.team) || !p[this.vars.inView]) {
  1070. continue
  1071. }
  1072. playerMaps.push(p[this.vars.objInstances])
  1073. }
  1074. const raycaster = this.state.raycaster
  1075. raycaster.setFromCamera(this.state.mid, this.renderer.camera)
  1076. if (raycaster.intersectObjects(playerMaps, true).length) {
  1077. input[key.shoot] = this.me[this.vars.didShoot] ? 0 : 1
  1078. }
  1079. }
  1080. break
  1081. }
  1082. } else {
  1083. if (this.settings.uwtv) {
  1084. input[key.scope] = 0
  1085. }
  1086. this.state.spinFrame = 0
  1087. }
  1088. }
  1089.  
  1090. if (this.settings.alwaysAim) {
  1091. input[key.scope] = 1
  1092. }
  1093. if (this.settings.preventMeleeThrowing && this.me.weapon.melee) {
  1094. input[key.scope] = 0
  1095. }
  1096. }
  1097. return input;
  1098. }
  1099.  
  1100. render() {
  1101.  
  1102. var scale = this.scale || parseFloat(document.getElementById("uiBase").style.transform.match(/\((.+)\)/)[1]);
  1103. let width = innerWidth / scale,
  1104. height = innerHeight / scale
  1105.  
  1106. let world2Screen = (pos, yOffset = 0) => {
  1107. pos.y += yOffset
  1108. pos.project(this.renderer.camera)
  1109. pos.x = (pos.x + 1) / 2
  1110. pos.y = (-pos.y + 1) / 2
  1111. pos.x *= width
  1112. pos.y *= height
  1113. return pos
  1114. }
  1115. let line = (x1, y1, x2, y2, lW, sS) => {
  1116. this.ctx.save()
  1117. this.ctx.lineWidth = lW + 2
  1118. this.ctx.beginPath()
  1119. this.ctx.moveTo(x1, y1)
  1120. this.ctx.lineTo(x2, y2)
  1121. this.ctx.strokeStyle = "rgba(0, 0, 0, 0.25)"
  1122. this.ctx.stroke()
  1123. this.ctx.lineWidth = lW
  1124. this.ctx.strokeStyle = sS
  1125. this.ctx.stroke()
  1126. this.ctx.restore()
  1127. }
  1128. let rect = (x, y, ox, oy, w, h, color, fill) => {
  1129. this.ctx.save()
  1130. this.ctx.translate(~~x, ~~y)
  1131. this.ctx.beginPath()
  1132. fill ? this.ctx.fillStyle = color : this.ctx.strokeStyle = color
  1133. this.ctx.rect(ox, oy, w, h)
  1134. fill ? this.ctx.fill() : this.ctx.stroke()
  1135. this.ctx.closePath()
  1136. this.ctx.restore()
  1137. }
  1138. let getTextMeasurements = (arr) => {
  1139. for (let i = 0; i < arr.length; i++) {
  1140. arr[i] = ~~this.ctx.measureText(arr[i]).width
  1141. }
  1142. return arr
  1143. }
  1144. let gradient = (x, y, w, h, colors) => {
  1145. const grad = this.ctx.createLinearGradient(x, y, w, h)
  1146. for (let i = 0; i < colors.length; i++) {
  1147. grad.addColorStop(i, colors[i])
  1148. }
  1149. return grad
  1150. }
  1151. let text = (txt, font, color, x, y) => {
  1152. this.ctx.save()
  1153. this.ctx.translate(~~x, ~~y)
  1154. this.ctx.fillStyle = color
  1155. this.ctx.strokeStyle = "rgba(0, 0, 0, 0.5)"
  1156. this.ctx.font = font
  1157. this.ctx.lineWidth = 1
  1158. this.ctx.strokeText(txt, 0, 0)
  1159. this.ctx.fillText(txt, 0, 0)
  1160. this.ctx.restore()
  1161. }
  1162.  
  1163. const padding = 2
  1164.  
  1165. for (const player of this.game.players.list.filter(v => (!v.isYTMP && v.active && (v.pos = {
  1166. x: v.x,
  1167. y: v.y,
  1168. z: v.z
  1169. })))) {
  1170. const pos = new this.three.Vector3(player.pos.x, player.pos.y, player.pos.z)
  1171. const screenR = world2Screen(pos.clone())
  1172. const screenH = world2Screen(pos.clone(), player.height)
  1173. const hDiff = ~~(screenR.y - screenH.y)
  1174. const bWidth = ~~(hDiff * 0.6)
  1175. const font = this.settings.espFontSize + "px GameFont"
  1176. const enemy = this.me.team === null || player.team !== this.me.team;
  1177.  
  1178. if (!this.containsPoint(player.pos)) {
  1179. continue
  1180. }
  1181.  
  1182. if (this.settings.tracers) {
  1183. line(width / 2, (dog.settings.tracers === 2 ? height / 2 : height - 1), screenR.x, screenR.y, 2, player.team === null ? "#FF4444" : player.team === this.me.team ? "#44AAFF" : "#FF4444")
  1184. }
  1185.  
  1186. // Chams
  1187. const obj = player[this.vars.objInstances];
  1188. if (this.isDefined(obj)) {
  1189. if (!obj.visible) {
  1190. Object.defineProperty(player[this.vars.objInstances], 'visible', {
  1191. value: true,
  1192. writable: false
  1193. });
  1194. } else {
  1195. let chamsEnabled = this.settings.chams;
  1196. if (dog.gaybow >= 360) dog.gaybow = 0; else dog.gaybow++;
  1197. obj.traverse(child => {
  1198. if (child && child.type == "Mesh" && this.isDefined(child.material)) {
  1199. if (!child.hasOwnProperty(dogStr)) {
  1200. child[dogStr] = child.material;
  1201. } else if (child.hasOwnProperty(dogStr)) {
  1202. Object.defineProperty(child, 'material', {
  1203. get(){
  1204. return !chamsEnabled||(!enemy && !dog.settings.teamChams) ? this[dogStr] : new dog.three.MeshBasicMaterial({
  1205. color: new dog.three.Color(dog.settings.chamsCol == 12 ? `hsl(${dog.gaybow},100%, 50%)` : Object.values(dog.colors)[dog.settings.chamsCol]),
  1206. depthTest: false,
  1207. transparent: true,
  1208. fog: false,
  1209. wireframe: dog.settings.wireframe
  1210. })
  1211. }
  1212. });
  1213. }
  1214. }
  1215. })
  1216. }
  1217. }
  1218.  
  1219. if (this.settings.esp > 1) {
  1220. if (player.isTarget) {
  1221. this.ctx.save()
  1222. const meas = getTextMeasurements(["TARGET"])
  1223. text("TARGET", font, "#FFFFFF", screenH.x - meas[0] / 2, screenH.y - this.settings.espFontSize * 1.5)
  1224.  
  1225. this.ctx.beginPath()
  1226.  
  1227. this.ctx.translate(screenH.x, screenH.y + Math.abs(hDiff / 2))
  1228. this.ctx.arc(0, 0, Math.abs(hDiff / 2) + 10, 0, Math.PI * 2)
  1229.  
  1230. this.ctx.strokeStyle = "#FFFFFF"
  1231. this.ctx.stroke()
  1232. this.ctx.closePath()
  1233. this.ctx.restore()
  1234. }
  1235.  
  1236. if (this.settings.esp === 2) {
  1237. this.ctx.save()
  1238. this.ctx.strokeStyle = (this.me.team === null || player.team !== this.me.team) ? "#FF4444" : "#44AAFF"
  1239. this.ctx.strokeRect(screenH.x - bWidth / 2, screenH.y, bWidth, hDiff)
  1240. this.ctx.restore()
  1241. continue
  1242. }
  1243.  
  1244. rect((screenH.x - bWidth / 2) - 7, ~~screenH.y - 1, 0, 0, 4, hDiff + 2, "#000000", false)
  1245. rect((screenH.x - bWidth / 2) - 7, ~~screenH.y - 1, 0, 0, 4, hDiff + 2, "#44FF44", true)
  1246. rect((screenH.x - bWidth / 2) - 7, ~~screenH.y - 1, 0, 0, 4, ~~((player[this.vars.maxHealth] - player.health) / player[this.vars.maxHealth] * (hDiff + 2)), "#000000", true)
  1247. this.ctx.save()
  1248. this.ctx.lineWidth = 4
  1249. this.ctx.translate(~~(screenH.x - bWidth / 2), ~~screenH.y)
  1250. this.ctx.beginPath()
  1251. this.ctx.rect(0, 0, bWidth, hDiff)
  1252. this.ctx.strokeStyle = "rgba(0, 0, 0, 0.25)"
  1253. this.ctx.stroke()
  1254. this.ctx.lineWidth = 2
  1255. this.ctx.strokeStyle = player.team === null ? '#FF4444' : this.me.team === player.team ? '#44AAFF' : '#FF4444'
  1256. this.ctx.stroke()
  1257. this.ctx.closePath()
  1258. this.ctx.restore()
  1259.  
  1260. const playerDist = ~~(this.getDistance3D(this.me.x, this.me.y, this.me.z, player.pos.x, player.pos.y, player.pos.z) / 10)
  1261. this.ctx.save()
  1262. this.ctx.font = font
  1263. const meas = getTextMeasurements(["[", playerDist, "m]", player.level, "©", player.name])
  1264. this.ctx.restore()
  1265. const grad2 = gradient(0, 0, meas[4] * 5, 0, ["rgba(0, 0, 0, 0.25)", "rgba(0, 0, 0, 0)"])
  1266. if (player.level) {
  1267. const grad = gradient(0, 0, (meas[4] * 2) + meas[3] + (padding * 3), 0, ["rgba(0, 0, 0, 0)", "rgba(0, 0, 0, 0.25)"])
  1268. 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)
  1269. text("" + player.level, font, '#FFFFFF', ~~(screenH.x - bWidth / 2) - 16 - meas[3], ~~screenH.y + meas[4] * 1)
  1270. }
  1271. rect(~~(screenH.x + bWidth / 2) + padding, ~~screenH.y - padding, 0, 0, (meas[4] * 5), (meas[4] * 4) + (padding * 2), grad2, true)
  1272. text(player.name, font, player.team === null ? '#FFCDB4' : this.me.team === player.team ? '#B4E6FF' : '#FFCDB4', (screenH.x + bWidth / 2) + 4, screenH.y + meas[4] * 1)
  1273. if (player.clan) text("[" + player.clan + "]", font, "#AAAAAA", (screenH.x + bWidth / 2) + 8 + meas[5], screenH.y + meas[4] * 1)
  1274. text(player.health + " HP", font, "#33FF33", (screenH.x + bWidth / 2) + 4, screenH.y + meas[4] * 2)
  1275. text(player.weapon.name, font, "#DDDDDD", (screenH.x + bWidth / 2) + 4, screenH.y + meas[4] * 3)
  1276. text("[", font, "#AAAAAA", (screenH.x + bWidth / 2) + 4, screenH.y + meas[4] * 4)
  1277. text("" + playerDist, font, "#DDDDDD", (screenH.x + bWidth / 2) + 4 + meas[0], screenH.y + meas[4] * 4)
  1278. text("m]", font, "#AAAAAA", (screenH.x + bWidth / 2) + 4 + meas[0] + meas[1], screenH.y + meas[4] * 4)
  1279. }
  1280.  
  1281. }
  1282.  
  1283. if (this.settings.fovbox && this.settings.drawFovbox) {
  1284. let fovBox = [width / 3, height / 4, width * (1 / 3), height / 2]
  1285. switch (this.settings.fovBoxSize) {
  1286. // medium
  1287. case 2:
  1288. fovBox = [width * 0.4, height / 3, width * 0.2, height / 3]
  1289. break
  1290. // small
  1291. case 3:
  1292. fovBox = [width * 0.45, height * 0.4, width * 0.1, height * 0.2]
  1293. break
  1294. }
  1295. this.ctx.save()
  1296. this.ctx.strokeStyle = "red"
  1297. this.ctx.strokeRect(...fovBox)
  1298. this.ctx.restore()
  1299. }
  1300. }
  1301.  
  1302. cleanGUI() {
  1303. let head = document.head || document.getElementsByTagName('head')[0] || 0,
  1304. css = this.createElement("style", "#aMerger, #endAMerger { display: none !important }");
  1305. head.appendChild(css);
  1306. window['onetrust-consent-sdk'].style.display = "none";
  1307. window.streamContainer.style.display = "none";
  1308. window.merchHolder.style.display = "none";
  1309. window.newsHolder.style.display = "none";
  1310. }
  1311.  
  1312. customCSS() {
  1313. if (!this.isDefined(this.CSSres) && this.settings.kpalCSS) {
  1314. let head = document.head || document.getElementsByTagName('head')[0] || 0
  1315. this.CSSres = document.createElement("link");
  1316. this.CSSres.rel = "stylesheet";
  1317. this.CSSres.href = "https://skidlamer.github.io/css/kpal.css"
  1318. this.CSSres.disabled = false;
  1319. head.appendChild(this.CSSres);
  1320. }
  1321. if (this.settings.customCSS.startsWith("http") && this.settings.customCSS.endsWith(".css")) {
  1322. //let head = document.head||document.getElementsByTagName('head')[0]||0
  1323. this.CSSres.href = this.settings.customCSS;
  1324. //head.appendChild(this.CSSres);
  1325. } else this.CSSres = undefined;
  1326. }
  1327.  
  1328. initGUI() {
  1329. function createButton(name, iconURL, fn) {
  1330. const menu = document.querySelector("#menuItemContainer"),
  1331. menuItem = document.createElement("div"),
  1332. menuItemIcon = document.createElement("div"),
  1333. menuItemTitle = document.createElement("div")
  1334.  
  1335. menuItem.className = "menuItem"
  1336. menuItemIcon.className = "menuItemIcon"
  1337. menuItemTitle.className = "menuItemTitle"
  1338.  
  1339. menuItemTitle.innerHTML = name
  1340. menuItemIcon.style.backgroundImage = `url("https://i.imgur.com/jjkFpnV.gif")`
  1341.  
  1342. menuItem.append(menuItemIcon, menuItemTitle)
  1343. menu.append(menuItem)
  1344.  
  1345. menuItem.addEventListener("click", fn)
  1346. }
  1347.  
  1348. dog.GUI.setSetting = function(setting, value) {
  1349. switch (setting) {
  1350. case "customCSS":
  1351. dog.settings.customCSS = value
  1352. dog.customCSS();
  1353. break
  1354.  
  1355. default:
  1356. console.log("SET ", setting, " ", value);
  1357. dog.settings[setting] = value
  1358. }
  1359. localStorage.kro_setngss_json = JSON.stringify(dog.settings);
  1360. }
  1361. dog.GUI.windowIndex = windows.length + 1
  1362. dog.GUI.settings = {
  1363. aimbot: {
  1364. val: this.settings.aimbot
  1365. }
  1366. }
  1367. dog.GUI.windowObj = {
  1368. header: "CH33T",
  1369. html: "",
  1370. gen() {
  1371. return dog.getGuiHtml()
  1372. }
  1373. }
  1374. Object.defineProperty(window.windows, windows.length, {
  1375. value: dog.GUI.windowObj
  1376. })
  1377.  
  1378. if (this.settings.showGuiButton) {
  1379. createButton("CH33TS", null, () => {
  1380. window.showWindow(dog.GUI.windowIndex)
  1381. })
  1382. }
  1383. }
  1384.  
  1385. showGUI() {
  1386. if (document.pointerLockElement || document.mozPointerLockElement) {
  1387. document.exitPointerLock()
  1388. }
  1389. window.showWindow(this.GUI.windowIndex)
  1390. }
  1391.  
  1392. getGuiHtml() {
  1393. const builder = {
  1394. checkbox: (name, settingName, description = "", needsRestart = false) => `<div class="settName" title="${description}">${name} ${needsRestart ? "<span style=\"color: #eb5656\">*</span>" : ""}<label class="switch" style="margin-left:10px"><input type="checkbox" onclick='${dogStr}.GUI.setSetting("${settingName}", this.checked)' ${dog.settings[settingName]?"checked":""}><span class="slider"></span></label></div>`,
  1395. client_setting: (name, settingName, description = "", needsRestart = true) => `<div class="settName" title="${description}">${name} ${needsRestart ? "<span style=\"color: #eb5656\">*</span>" : ""}<label class="switch" style="margin-left:10px"><input type="checkbox" onclick='doge_setsetting("${settingName}", this.checked?"1":"0")' ${dog.settings[settingName]?"checked":""}><span class="slider"></span></label></div>`,
  1396. select: (name, settingName, options, description = "", needsRestart = false) => {
  1397. let built = `<div class="settName" title="${description}">${name} ${needsRestart ? "<span style=\"color: #eb5656\">*</span>" : ""}<select onchange='${dogStr}.GUI.setSetting("${settingName}", parseInt(this.value))' class="inputGrey2">`
  1398. for (const option in options) {
  1399. if (options.hasOwnProperty(option))
  1400. built += `<option value="${options[option]}" ${dog.settings[settingName] == options[option]?"selected":""}>${option}</option>,`
  1401. }
  1402. return built + "</select></div>"
  1403. },
  1404. slider: (name, settingName, min, max, step, description = "") => `<div class="settName" title="${description}">${name} <input type="number" class="sliderVal" id="slid_input_${settingName}" min="${min}" max="${max}" value="${dog.settings[settingName]}" onkeypress="${dogStr}.GUI.setSetting('${settingName}', parseFloat(this.value.replace(',', '.')));document.querySelector('#slid_input_${settingName}').value=this.value" style="margin-right:0;border-width:0"><div class="slidecontainer" style=""><input type="range" id="slid_${settingName}" min="${min}" max="${max}" step="${step}" value="${dog.settings[settingName]}" class="sliderM" oninput="${dogStr}.GUI.setSetting('${settingName}', parseFloat(this.value));document.querySelector('#slid_input_${settingName}').value=this.value"></div></div>`,
  1405. input: (name, settingName, type, description, extra) => `<div class="settName" title="${description}">${name} <input type="${type}" name="${type}" id="slid_utilities_${settingName}"\n${'color' == type ? 'style="float:right;margin-top:5px"' : `class="inputGrey2" placeholder="${extra}"`}\nvalue="${dog.settings[settingName]}" oninput="${dogStr}.GUI.setSetting(\x27${settingName}\x27, this.value)"/></div>`,
  1406. label: (name, description) => "<br><span style='color: black; font-size: 20px; margin: 20px 0'>" + name + "</span> <span style='color: dimgrey; font-size: 15px'>" + (description || "") + "</span><br>",
  1407. nobrlabel: (name, description) => "<span style='color: black; font-size: 20px; margin: 20px 0'>" + name + "</span> <span style='color: dimgrey; font-size: 15px'>" + (description || "") + "</span><br>",
  1408. br: () => "<br>",
  1409. style: content => `<style>${content}</style>`,
  1410. };
  1411. let built = `<div id="settHolder">
  1412. <img src="https://i.imgur.com/tE0QUPv.png" width="90%">
  1413. <div class="imageButton discordSocial" onmouseenter="playTick()" onclick="openURL('https://skidlamer.github.io/wp/index.html')"><span style='display:inline'></span></div>`
  1414.  
  1415. // fix fugly looking 'built +=' before every builder call
  1416. Object.keys(builder).forEach(name => {
  1417. const o = builder[name]
  1418. builder[name] = function() {
  1419. return built += o.apply(this, arguments), ""
  1420. }
  1421. })
  1422.  
  1423. // Tabs stuff
  1424. const tabNames = ["Weapon", "Wallhack", "Visual", "Tweaks", "Movement", "Other"]
  1425. if (dog.isClient) {
  1426. tabNames.push("Client")
  1427. }
  1428. builder.style(`.cheatTabButton { color: black; background: #ddd; padding: 2px 7px; font-size: 15px; cursor: pointer; text-align: center; } .cheatTabActive { background: #bbb;}`)
  1429. this.GUI.changeTab = function(tabbtn) {
  1430. const tn = tabbtn.innerText
  1431. document.getElementById("cheat-tabbtn-" + tabNames[dog.state.activeTab]).classList.remove("cheatTabActive")
  1432. document.getElementById("cheat-tab-" + tabNames[dog.state.activeTab]).style.display = "none"
  1433. tabbtn.classList.add("cheatTabActive")
  1434. document.getElementById("cheat-tab-" + tn).style.display = "block"
  1435. dog.state.activeTab = tabNames.indexOf(tn)
  1436. }
  1437. built += `<table style="width: 100%; margin-bottom: 30px"><tr>`
  1438. for (let i = 0; i < tabNames.length; i++) {
  1439. const tab = tabNames[i]
  1440. built += `<td id="cheat-tabbtn-${tab}" onclick="${dogStr}.GUI.changeTab(this)" class="cheatTabButton ${tabNames[dog.state.activeTab] === tab ? 'cheatTabActive' : ''}">`
  1441. built += tab
  1442. built += `</td>`
  1443. }
  1444. built += `</table></tr>`
  1445.  
  1446. function tab(i, cb) {
  1447. built += `<div style="display: ${dog.state.activeTab === i ? 'block' : 'none'}" class="cheat-tab" id="cheat-tab-${tabNames[i]}">`
  1448. cb()
  1449. built += `</div>`
  1450. }
  1451.  
  1452. // build gui
  1453. tab(0, () => {
  1454. builder.select("Aimbot [Y]", "aimbot", {
  1455. "None": 0,
  1456. "Quickscope / Auto pick": 1,
  1457. "Silent aimbot": 2,
  1458. //"Spin aimbot": 3,
  1459. "Aim assist": 4,
  1460. "Easy aim assist": 11,
  1461. "SP Trigger bot": 12,
  1462. "Silent on aim": 6,
  1463. "Smooth": 7,
  1464. "Unsilent": 10,
  1465. "Unsilent on aim": 5,
  1466. "Aim correction": 9,
  1467. })
  1468. builder.select("Spin aimbot speed", "spinAimFrames", {
  1469. "1": 30,
  1470. "2": 20,
  1471. "3": 15,
  1472. "4": 10,
  1473. "5": 5,
  1474. })
  1475. builder.slider("Aim range", "aimbotRange", 0, 1000, 10, "Set above 0 to make the aimbot pick enemies only at the selected range")
  1476. builder.slider("Aim offset", "aimOffset", -4, 1, 0.1, "The lower it is, the lower the aimbot will shoot (0 - head, -4 - body)")
  1477. builder.slider("Aim noise", "aimNoise", 0, 2, 0.005, "The higher it is, the lower is the aimbot accuracy")
  1478. builder.checkbox("Supersilent aim", "superSilent", "Only works with quickscope and silent aim, makes it almost invisible that you're looking at somebody when you're shooting at him")
  1479. builder.checkbox("Aim at AIs", "AImbot", "Makes the aimbot shoot at NPCs")
  1480. builder.checkbox("FOV check", "frustumCheck", "Makes you only shoot at enemies that are in your field of view. Prevents 180 flicks")
  1481. builder.checkbox("FOV box", "fovbox", "Creates a box in which enemies can be targetted, enable with FOV check")
  1482. builder.select("FOV box size", "fovBoxSize", {
  1483. "Big": 1,
  1484. "Medium": 2,
  1485. "Small": 3,
  1486. })
  1487. builder.checkbox("Wallbangs", "wallbangs", "Makes the aimbot shoot enemies behind walls")
  1488. builder.checkbox("Aimbot range check", "rangeCheck", "Checks if the enemy is in range of your weapon before shooting it, disable for rocket launcher")
  1489. builder.checkbox("Auto reload", "autoReload", "Automatically reloads your weapon when it's out of ammo")
  1490. builder.checkbox("Prevent melee throwing", "preventMeleeThrowing", "Prevents you from throwing your knife")
  1491. //builder.checkbox("Auto swap", "autoSwap", "Automatically swaps the weapon when you're out of ammo")
  1492. })
  1493.  
  1494. tab(1, () => {
  1495. builder.select("ESP [H]", "esp", {
  1496. "None": 0,
  1497. "Nametags": 1,
  1498. "Box ESP": 2,
  1499. "Full ESP": 3,
  1500. })
  1501. builder.select("ESP Font Size", "espFontSize", {
  1502. "30px": 30,
  1503. "25px": 25,
  1504. "20px": 20,
  1505. "15px": 15,
  1506. "10px": 10,
  1507. "5px": 5,
  1508. })
  1509. builder.select("Tracers", "tracers", {
  1510. "None": 0,
  1511. "Bottom": 1,
  1512. "Middle": 2,
  1513. }, "Draws lines to players")
  1514. builder.checkbox("Mark aimbot target", "markTarget", "Shows who is the aimbot targetting at the time, useful for aim assist/aim correction")
  1515. builder.checkbox("Draw FOV box", "drawFovbox", "Draws the FOV box from aimbot settings")
  1516. builder.checkbox("Chams", "chams")
  1517. builder.select("Chams colour", "chamsCol", {
  1518. White: 0,
  1519. Black: 1,
  1520. Purple: 2,
  1521. Pink: 3,
  1522. Blue: 4,
  1523. DarkBlue: 5,
  1524. Aqua: 6,
  1525. Green: 7,
  1526. Lime: 8,
  1527. Orange: 9,
  1528. Yellow: 10,
  1529. Red: 11,
  1530. Gaybow: 12,
  1531. })
  1532. builder.checkbox("Friendly chams", "teamChams", "Show Chams for friendly players")
  1533. builder.checkbox("Wireframe", "wireframe")
  1534. builder.slider("RGB interval", "chamsInterval", 50, 1000, 50, "How fast will the RGB chams change colour")
  1535. })
  1536.  
  1537. tab(2, () => {
  1538. builder.checkbox("Third person mode", "thirdPerson")
  1539. builder.checkbox("Skin hack", "skinHack", "Makes you able to use any skin in game, only shows on your side")
  1540. builder.checkbox("Billboard shaders", "animatedBillboards", "Disable if you get fps drops")
  1541. builder.checkbox("Any weapon trail", "alwaysTrail")
  1542. builder.slider("Weapon Zoom", "weaponZoom", 0, 20, .1, "Weapon Zoom Multiplier Adjust")
  1543. })
  1544.  
  1545. tab(3, () => {
  1546. builder.checkbox("Always aim", "alwaysAim", "Makes you slower and jump lower, but the aimbot can start shooting at enemies faster. Only use if ur good at bhopping")
  1547. builder.checkbox("Aim when target visible", "awtv")
  1548. builder.checkbox("Unaim when no target visible", "uwtv")
  1549. builder.checkbox("Force unsilent", "forceUnsilent")
  1550. })
  1551.  
  1552. tab(4, () => {
  1553. builder.select("Auto bhop", "bhop", {
  1554. "None": 0,
  1555. "Auto Jump": 1,
  1556. "Key Jump": 2,
  1557. "Auto Slide": 3,
  1558. "Key Slide": 4,
  1559. })
  1560. builder.label("Only use with silent aim")
  1561. builder.select("Pitch hax", "pitchHack", {
  1562. "Disabled": 0,
  1563. "Downward": 1,
  1564. "Upward": 2,
  1565. "sin(time)": 3,
  1566. "sin(time/5)": 4,
  1567. "double": 5,
  1568. "random": 6,
  1569. }, "Only use with aimbot on")
  1570. builder.checkbox("Spin bot", "spinBot")
  1571. })
  1572.  
  1573. tab(5, () => {
  1574. builder.checkbox("Show GUI button", "showGuiButton", "Disable if you don't want the dog under settings to be visible")
  1575. builder.checkbox("GUI on middle mouse button", "guiOnMMB", "Makes it possible to open this menu by clicking the mouse wheel")
  1576. builder.checkbox("Keybinds", "keybinds", "Turn keybinds on/off, Aimbot - Y, ESP - H")
  1577. builder.checkbox("No inactivity kick", "antikick", "Disables the 'Kicked for inactivity' message (client side, but works)")
  1578. builder.checkbox("Auto nuke", "autoNuke", "Automatically nukes when you are able to")
  1579. builder.checkbox("Force nametags on", "fgno", "Use in custom games with disabled nametags")
  1580. builder.checkbox("Use Kpal CSS", "kpalCSS", "Use the kpal CSS when no custom CSS is Applied")
  1581. builder.input("Custom CSS", "customCSS", "url", "", "URL to CSS file")
  1582. })
  1583.  
  1584. if (dog.isClient) {
  1585. tab(6, () => {
  1586. builder.nobrlabel("Restart is required after changing any of these settings")
  1587. builder.br()
  1588. builder.client_setting("Uncap FPS", "uncap_fps", "Disables V-Sync")
  1589. builder.client_setting("Adblock", "adblock", "Disables ads")
  1590. })
  1591. }
  1592.  
  1593. built += "</div>"
  1594.  
  1595. return built;
  1596. }
  1597.  
  1598. getDistance(x1, y1, x2, y2) {
  1599. return Math.sqrt((x2 -= x1) * x2 + (y2 -= y1) * y2);
  1600. }
  1601.  
  1602. getDistance3D(x1, y1, z1, x2, y2, z2) {
  1603. let dx = x1 - x2;
  1604. let dy = y1 - y2;
  1605. let dz = z1 - z2;
  1606. return Math.sqrt(dx * dx + dy * dy + dz * dz);
  1607. }
  1608.  
  1609. getXDir(x1, y1, z1, x2, y2, z2) {
  1610. let h = Math.abs(y1 - y2);
  1611. let dst = this.getDistance3D(x1, y1, z1, x2, y2, z2);
  1612. return (Math.asin(h / dst) * ((y1 > y2) ? -1 : 1));
  1613. }
  1614.  
  1615. getDir(x1, y1, x2, y2) {
  1616. return Math.atan2(y1 - y2, x1 - x2);
  1617. }
  1618.  
  1619. getAngleDist(a, b) {
  1620. return Math.atan2(Math.sin(b - a), Math.cos(a - b));
  1621. }
  1622.  
  1623. containsPoint(point) {
  1624. let planes = this.renderer.frustum.planes;
  1625. for (let i = 0; i < 6; i++) {
  1626. if (planes[i].distanceToPoint(point) < 0) {
  1627. return false;
  1628. }
  1629. }
  1630. return true;
  1631. }
  1632.  
  1633. world2Screen(pos, width, height, yOffset = 0) {
  1634. pos.y += yOffset
  1635. pos.project(this.renderer.camera)
  1636. pos.x = (pos.x + 1) / 2
  1637. pos.y = (-pos.y + 1) / 2
  1638. pos.x *= width
  1639. pos.y *= height
  1640. return pos
  1641. }
  1642. };
  1643.  
  1644. window[dogStr] = new Dogeware();
  1645.  
  1646. })([...Array(8)].map(_ => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' [~~(Math.random() * 52)]).join(''));
Add Comment
Please, Sign In to add comment