Survev-KrityHack

Aimbot, xray, tracer, better zoom, smoke/obstacle opacity, autoloot, player names...

2025-01-14 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name Survev-KrityHack
  3. // @namespace https://github.com/Drino955/survev-krityhack
  4. // @version 0.2.1
  5. // @description Aimbot, xray, tracer, better zoom, smoke/obstacle opacity, autoloot, player names...
  6. // @author KrityTeam
  7. // @license GPL3
  8. // @match *://survev.io/*
  9. // @match *://resurviv.biz/*
  10. // @icon https://www.google.com/s2/favicons?domain=survev.io
  11. // @grant none
  12. // @run-at document-start
  13. // @webRequest [{"selector":"*app-*.js","action":"cancel"}]
  14. // @webRequest [{"selector":"*shared-*.js","action":"cancel"}]
  15. // @homepageURL https://github.com/Drino955/survev-krityhack
  16. // @supportURL https://github.com/Drino955/survev-krityhack/issues
  17. // ==/UserScript==
  18.  
  19.  
  20. console.log('Script injecting...')
  21.  
  22. window.gameOptimization = true;
  23. window.ping = {};
  24.  
  25. // cannot insert through tampermonkey require cause "Cannot use import statement outside a module"
  26. const appScript = document.createElement('script');
  27. appScript.type = 'module';
  28.  
  29. if (window.location.hostname === 'survev.io') {
  30. console.log('Survev.io detected');
  31. appScript.src = '//cdn.jsdelivr.net/gh/drino955/survev-krityhack@621cbd2bb8a2c9b9c4fbe11f892574a9af1dd9dc/survev/app.js';
  32. } else if(window.location.hostname === 'resurviv.biz') {
  33. console.log('Resurviv.biz detected');
  34. appScript.src = '//cdn.jsdelivr.net/gh/drino955/survev-krityhack@621cbd2bb8a2c9b9c4fbe11f892574a9af1dd9dc/resurviv/app.js';
  35. }
  36.  
  37. appScript.onload = () => console.log('app.js loaded');
  38. appScript.onerror = (err) => console.error('Error in app.js loading:', err);
  39.  
  40.  
  41. const pixiScript = document.createElement('script');
  42. pixiScript.src = 'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/7.0.3/pixi.min.js';
  43. pixiScript.onload = () => console.log('pixi.js loaded');
  44. pixiScript.onerror = (err) => console.error('Error in pixi.js loading:', err);
  45. let aimBotEnabled = true;
  46. let zoomEnabled = true;
  47. let meleeAttackEnabled = true;
  48. let spinBot = false;
  49. let autoSwitchEnabled = true;
  50.  
  51. let espEnabled = true;
  52. let xrayEnabled = true;
  53. let focusedEnemy = null;
  54.  
  55. const version = GM_info.script.version;
  56.  
  57.  
  58. const overlay = document.createElement('div');
  59. overlay.className = 'krity-overlay';
  60.  
  61. const krityTitle = document.createElement('h3');
  62. krityTitle.className = 'krity-title';
  63. krityTitle.innerText = `KrityHack ${version}`;
  64.  
  65. const styles = document.createElement('style');
  66. styles.innerHTML = `
  67. .krity-overlay{
  68. position: absolute;
  69. top: 128px;
  70. left: 0px;
  71. width: 100%;
  72. pointer-events: None;
  73. color: #fff;
  74. font-family: monospace;
  75. text-shadow: 0 0 5px rgba(0, 0, 0, .5);
  76. z-index: 1;
  77. }
  78.  
  79. .krity-title{
  80. text-align: center;
  81. margin-top: 10px;
  82. margin-bottom: 10px;
  83. font-size: 25px;
  84. text-shadow: 0 0 10px rgba(0, 0, 0, .9);
  85. color: #fff;
  86. font-family: monospace;
  87. pointer-events: None;
  88. }
  89.  
  90. .krity-control{
  91. text-align: center;
  92. margin-top: 3px;
  93. margin-bottom: 3px;
  94. font-size: 18px;
  95. }
  96.  
  97. .aimbotDot{
  98. position: absolute;
  99. top: 0;
  100. left: 0;
  101. width: 10px;
  102. height: 10px;
  103. background-color: red;
  104. transform: translateX(-50%) translateY(-50%);
  105. display: none;
  106. }
  107.  
  108. #news-current ul{
  109. margin-left: 20px;
  110. padding-left: 6px;
  111. }
  112. `;
  113.  
  114. const fontAwesome = document.createElement('link');
  115. fontAwesome.rel = "stylesheet";
  116. fontAwesome.href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css";
  117.  
  118. const aimbotDot = document.createElement('div')
  119. aimbotDot.className = 'aimbotDot';
  120.  
  121. keybinds();
  122. removeCeilings();
  123. autoLoot();
  124. bootLoader(); // init game every time()
  125.  
  126. function keybinds(){
  127. window.addEventListener('keyup', function (event) {
  128. if (!window?.game?.ws) return;
  129.  
  130. const validKeys = ['B', 'Z', 'M', 'Y', 'T'];
  131. if (!validKeys.includes(String.fromCharCode(event.keyCode))) return;
  132. switch (String.fromCharCode(event.keyCode)) {
  133. case 'B':
  134. aimBotEnabled = !aimBotEnabled;
  135. aimbotDot.style.display = 'None';
  136. window.lastAimPos = null;
  137. window.aimTouchMoveDir = null;
  138. break;
  139. case 'Z': zoomEnabled = !zoomEnabled; break;
  140. case 'M':
  141. meleeAttackEnabled = !meleeAttackEnabled;
  142. window.aimTouchMoveDir = null;
  143. event.stopImmediatePropagation()
  144. event.stopPropagation();
  145. event.preventDefault();
  146. break;
  147. case 'Y': spinBot = !spinBot; break;
  148. case 'T':
  149. if(focusedEnemy){
  150. focusedEnemy = null;
  151. }else{
  152. if (!enemyAimBot?.active || enemyAimBot?.netData?.dead) break;
  153. focusedEnemy = enemyAimBot;
  154. }
  155. break;
  156. // case 'P': autoStopEnabled = !autoStopEnabled; break;
  157. // case 'U': autoSwitchEnabled = !autoSwitchEnabled; break;
  158. // case 'O': window.gameOptimization = !window.gameOptimization; break;
  159. }
  160. updateOverlay();
  161. });
  162. window.addEventListener('keydown', function (event) {
  163. if (!window?.game?.ws) return;
  164.  
  165. const validKeys = ['M', 'T'];
  166. if (!validKeys.includes(String.fromCharCode(event.keyCode))) return;
  167. switch (String.fromCharCode(event.keyCode)) {
  168. case 'M':
  169. event.stopImmediatePropagation()
  170. event.stopPropagation();
  171. event.preventDefault();
  172. break;
  173. case 'T':
  174. event.stopImmediatePropagation()
  175. event.stopPropagation();
  176. event.preventDefault();
  177. break;
  178. }
  179. });
  180.  
  181. window.addEventListener('mousedown', function (event) {
  182. if (event.button !== 1) return; // Only proceed if middle mouse button is clicked
  183.  
  184. const mouseX = event.clientX;
  185. const mouseY = event.clientY;
  186.  
  187. const players = window.game.playerBarn.playerPool.pool;
  188. const me = window.game.activePlayer;
  189. const meTeam = getTeam(me);
  190.  
  191. let enemy = null;
  192. let minDistanceToEnemyFromMouse = Infinity;
  193.  
  194. players.forEach((player) => {
  195. // We miss inactive or dead players
  196. if (!player.active || player.netData.dead || player.downed || me.__id === player.__id || getTeam(player) == meTeam) return;
  197.  
  198. const screenPlayerPos = window.game.camera.pointToScreen({x: player.pos._x, y: player.pos._y});
  199. const distanceToEnemyFromMouse = (screenPlayerPos.x - mouseX) ** 2 + (screenPlayerPos.y - mouseY) ** 2;
  200.  
  201. if (distanceToEnemyFromMouse < minDistanceToEnemyFromMouse) {
  202. minDistanceToEnemyFromMouse = distanceToEnemyFromMouse;
  203. enemy = player;
  204. }
  205. });
  206.  
  207. if (enemy) {
  208. const enemyIndex = friends.indexOf(enemy.nameText._text);
  209. if (~enemyIndex) {
  210. friends.splice(enemyIndex, 1);
  211. console.log(`Removed player with name ${enemy.nameText._text} from friends.`);
  212. }else {
  213. friends.push(enemy.nameText._text);
  214. console.log(`Added player with name ${enemy.nameText._text} to friends.`);
  215. }
  216. }
  217. });
  218. }
  219.  
  220. function removeCeilings(){
  221. Object.defineProperty( Object.prototype, 'textureCacheIds', {
  222. set( value ) {
  223. this._textureCacheIds = value;
  224. if ( Array.isArray( value ) ) {
  225. const scope = this;
  226. value.push = new Proxy( value.push, {
  227. apply( target, thisArgs, args ) {
  228. // console.log(args[0], scope, scope?.baseTexture?.cacheId);
  229. // console.log(scope, args[0]);
  230. if (args[0].includes('ceiling') && !args[0].includes('map-building-container-ceiling-05') || args[0].includes('map-snow-')) {
  231. Object.defineProperty( scope, 'valid', {
  232. set( value ) {
  233. this._valid = value;
  234. },
  235. get() {
  236. return xrayEnabled ? false : this._valid;
  237. }
  238. });
  239. }
  240. return Reflect.apply( ...arguments );
  241. }
  242. });
  243. }
  244. },
  245. get() {
  246. return this._textureCacheIds;
  247. }
  248. });
  249. }
  250.  
  251. function autoLoot(){
  252. Object.defineProperty(window, 'basicDataInfo', {
  253. get () {
  254. return this._basicDataInfo;
  255. },
  256. set(value) {
  257. this._basicDataInfo = value;
  258. if (!value) return;
  259. Object.defineProperty(window.basicDataInfo, 'isMobile', {
  260. get () {
  261. return true;
  262. },
  263. set(value) {
  264. }
  265. });
  266. Object.defineProperty(window.basicDataInfo, 'useTouch', {
  267. get () {
  268. return true;
  269. },
  270. set(value) {
  271. }
  272. });
  273. }
  274. });
  275. }
  276.  
  277. function bootLoader(){
  278. Object.defineProperty(window, 'game', {
  279. get () {
  280. return this._game;
  281. },
  282. set(value) {
  283. this._game = value;
  284. if (!value) return;
  285. initGame();
  286. }
  287. });
  288. }
  289.  
  290. function overrideMousePos() {
  291. Object.defineProperty(window.game.input.mousePos, 'x', {
  292. get() {
  293. if (window.game.input.mouseButtons['0'] && window.lastAimPos && window.game.activePlayer.localData.curWeapIdx != 3) {
  294. return window.lastAimPos.clientX;
  295. }
  296. if (!window.game.input.mouseButtons['0'] && !window.game.input.mouseButtons['2'] && window.game.activePlayer.localData.curWeapIdx != 3 && spinBot) {
  297. spinAngle += spinSpeed;
  298. return Math.cos(degreesToRadians(spinAngle)) * radius + window.innerWidth / 2;
  299. }
  300. return this._x;
  301. },
  302. set(value) {
  303. this._x = value;
  304. }
  305. });
  306.  
  307. Object.defineProperty(window.game.input.mousePos, 'y', {
  308. get() {
  309. if (window.game.input.mouseButtons['0'] && window.lastAimPos && window.game.activePlayer.localData.curWeapIdx != 3) {
  310. return window.lastAimPos.clientY;
  311. }
  312. if (!window.game.input.mouseButtons['0'] && !window.game.input.mouseButtons['2'] && window.game.activePlayer.localData.curWeapIdx != 3 && spinBot) {
  313. return Math.sin(degreesToRadians(spinAngle)) * radius + window.innerHeight / 2;
  314. }
  315. return this._y;
  316. },
  317. set(value) {
  318. this._y = value;
  319. }
  320. });
  321. }
  322.  
  323. let tickerOneTime = false;
  324. function initGame() {
  325. console.log('init game...........');
  326.  
  327. window.lastAimPos = null;
  328. window.aimTouchMoveDir = null;
  329. enemyAimBot = null;
  330. focusedEnemy = null;
  331. friends = [];
  332. lastFrames = {};
  333.  
  334. const tasks = [
  335. {isApplied: false, condition: () => window.game?.input?.mouseButtonsOld, action: bumpFire},
  336. {isApplied: false, condition: () => window.game?.input?.mousePos, action: overrideMousePos},
  337. {isApplied: false, condition: () => window.game?.activePlayer?.localData, action: betterZoom},
  338. {isApplied: false, condition: () => Array.prototype.push === window.game?.smokeBarn?.particles.push, action: smokeOpacity},
  339. {isApplied: false, condition: () => Array.prototype.push === window.game?.playerBarn?.playerPool?.pool.push, action: visibleNames},
  340. {isApplied: false, condition: () => window.game?.pixi?._ticker && window.game?.activePlayer?.container && window.game?.activePlayer?.pos, action: () => { if (!tickerOneTime) { tickerOneTime = true; initTicker(); } } },
  341. ];
  342.  
  343. (function checkLocalData(){
  344. if(!window?.game?.ws) return;
  345.  
  346. console.log('Checking local data')
  347.  
  348. console.log(
  349. window.game?.activePlayer?.localData,
  350. window.game?.map?.obstaclePool?.pool,
  351. window.game?.smokeBarn?.particles,
  352. window.game?.playerBarn?.playerPool?.pool
  353. );
  354.  
  355. tasks.forEach(task => console.log(task.action, task.isApplied))
  356. tasks.forEach(task => {
  357. if (task.isApplied || !task.condition()) return;
  358. task.action();
  359. task.isApplied = true;
  360. });
  361. if (tasks.some(task => !task.isApplied)) setTimeout(checkLocalData, 5);
  362. else console.log('All functions applied, stopping loop.');
  363. })();
  364.  
  365. updateOverlay();
  366. }
  367.  
  368. function initTicker(){
  369. window.game?.pixi?._ticker?.add(esp);
  370. window.game?.pixi?._ticker?.add(aimBot);
  371. window.game?.pixi?._ticker?.add(autoSwitch);
  372. window.game?.pixi?._ticker?.add(obstacleOpacity);
  373. window.game?.pixi?._ticker?.add(grenadeTimer);
  374. }
  375.  
  376. function bumpFire(){
  377. Object.defineProperty( window.game.input, 'mouseButtonsOld', {
  378. set( value ) {
  379. // console.log(value);
  380. // console.table(value);
  381. value[0] = false;
  382. this._value = value;
  383. },
  384. get() {
  385. return this._value || {};
  386. }
  387. });
  388. }
  389.  
  390. function betterZoom(){
  391. Object.defineProperty(window.game.camera, 'zoom', {
  392. get() {
  393. return Math.max(window.game.camera.targetZoom - (zoomEnabled ? 0.45 : 0), 0.35);
  394. },
  395. set(value) {
  396. }
  397. });
  398.  
  399. let oldScope = window.game.activePlayer.localData.scope;
  400. Object.defineProperty(window.game.camera, 'targetZoom', {
  401. get(){
  402. return this._targetZoom;
  403. },
  404. set(value) {
  405. const newScope = window.game.activePlayer.localData.scope;
  406. const inventory = window.game.activePlayer.localData.inventory;
  407.  
  408. const scopes = ['1xscope', '2xscope', '4xscope', '8xscope', '15xscope']
  409.  
  410. // console.log(value, oldScope, newScope, newScope == oldScope, (inventory['2xscope'] || inventory['4xscope'] || inventory['8xscope'] || inventory['15xscope']));
  411. if ( (newScope == oldScope) && (inventory['2xscope'] || inventory['4xscope'] || inventory['8xscope'] || inventory['15xscope']) && value >= this._targetZoom
  412. || scopes.indexOf(newScope) > scopes.indexOf(oldScope) && value >= this._targetZoom
  413. ) return;
  414.  
  415. oldScope = window.game.activePlayer.localData.scope;
  416.  
  417. this._targetZoom = value;
  418. }
  419. });
  420. }
  421.  
  422. function smokeOpacity(){
  423. console.log('smokeopacity')
  424. const particles = window.game.smokeBarn.particles;
  425. console.log('smokeopacity', particles, window.game.smokeBarn.particles)
  426. particles.push = new Proxy( particles.push, {
  427. apply( target, thisArgs, args ) {
  428. console.log('smokeopacity', args[0]);
  429. const particle = args[0];
  430.  
  431. Object.defineProperty(particle.sprite, 'alpha', {
  432. get() {
  433. return 0.12;
  434. },
  435. set(value) {
  436. }
  437. });
  438.  
  439. return Reflect.apply( ...arguments );
  440.  
  441. }
  442. });
  443.  
  444. particles.forEach(particle => {
  445. Object.defineProperty(particle.sprite, 'alpha', {
  446. get() {
  447. return 0.12;
  448. },
  449. set(value) {
  450. }
  451. });
  452. });
  453. }
  454.  
  455. function obstacleOpacity(){
  456. window.game.map.obstaclePool.pool.forEach(obstacle => {
  457. if (!['bush', 'tree', 'table', 'stairs'].some(substring => obstacle.type.includes(substring))) return;
  458. obstacle.sprite.alpha = 0.45
  459. });
  460. }
  461.  
  462. function getTeam(player) {
  463. return Object.keys(game.playerBarn.teamInfo).find(team => game.playerBarn.teamInfo[team].playerIds.includes(player.__id));
  464. }
  465.  
  466. const GREEN = 0x00ff00;
  467. const BLUE = 0x00f3f3;
  468. const RED = 0xff0000;
  469. const WHITE = 0xffffff;
  470. function visibleNames(){
  471. const pool = window.game.playerBarn.playerPool.pool;
  472.  
  473. console.log('visibleNames', pool)
  474.  
  475. pool.push = new Proxy( pool.push, {
  476. apply( target, thisArgs, args ) {
  477. const player = args[0];
  478. Object.defineProperty(player.nameText, 'visible', {
  479. get(){
  480. const me = window.game.activePlayer;
  481. const meTeam = getTeam(me);
  482. const playerTeam = getTeam(player);
  483. // console.log('visible', player?.nameText?._text, playerTeam === meTeam ? BLUE : RED, player, me, playerTeam, meTeam)
  484. this.tint = playerTeam === meTeam ? BLUE : friends.includes(player.nameText._text) ? GREEN : RED;
  485. player.nameText.style.fontSize = 40;
  486. return true;
  487. },
  488. set(value){
  489. }
  490. });
  491.  
  492. return Reflect.apply( ...arguments );
  493. }
  494. });
  495.  
  496. pool.forEach(player => {
  497. Object.defineProperty(player.nameText, 'visible', {
  498. get(){
  499. const me = window.game.activePlayer;
  500. const meTeam = getTeam(me);
  501. const playerTeam = getTeam(player);
  502. // console.log('visible', player?.nameText?._text, playerTeam === meTeam ? BLUE : RED, player, me, playerTeam, meTeam)
  503. this.tint = playerTeam === meTeam ? BLUE : RED;
  504. player.nameText.style.fontSize = 40;
  505. return true;
  506. },
  507. set(value){
  508. }
  509. });
  510. });
  511. }
  512.  
  513. let laserDrawerEnabled = true,
  514. lineDrawerEnabled = true,
  515. nadeDrawerEnabled = true;
  516. let friends = [];
  517. function esp(){
  518. const pixi = window.game.pixi;
  519. const me = window.game.activePlayer;
  520. const players = window.game.playerBarn.playerPool.pool;
  521.  
  522. // We check if there is an object of Pixi, otherwise we create a new
  523. if (!pixi || me?.container == undefined) {
  524. // console.error("PIXI object not found in game.");
  525. return;
  526. }
  527.  
  528. const meX = me.pos.x;
  529. const meY = me.pos.y;
  530.  
  531. const meTeam = getTeam(me);
  532. try{
  533.  
  534. // lineDrawer
  535. if (lineDrawerEnabled){
  536. if (!me.container.lineDrawer) {
  537. me.container.lineDrawer = new PIXI.Graphics();
  538. me.container.addChild(me.container.lineDrawer);
  539. }
  540. const lineDrawer = me.container.lineDrawer;
  541. lineDrawer.clear(); // Cleaning previous lines
  542. // For each player
  543. players.forEach((player) => {
  544. // We miss inactive or dead players
  545. if (!player.active || player.netData.dead || me.__id == player.__id) return;
  546. const playerX = player.pos.x;
  547. const playerY = player.pos.y;
  548. const playerTeam = getTeam(player);
  549. // We calculate the color of the line (for example, red for enemies)
  550. const lineColor = playerTeam === meTeam ? BLUE : friends.includes(player.nameText._text) ? GREEN : me.layer === player.layer && !player.downed ? RED : WHITE;
  551. // We draw a line from the current player to another player
  552. lineDrawer.lineStyle(2, lineColor, 1);
  553. lineDrawer.moveTo(0, 0); // Container Container Center
  554. lineDrawer.lineTo(
  555. (playerX - meX) * 16,
  556. (meY - playerY) * 16
  557. );
  558. });
  559. }
  560.  
  561. // nadeDrawer
  562. if (nadeDrawerEnabled){
  563. if (!me.container.nadeDrawer) {
  564. me.container.nadeDrawer = new PIXI.Graphics();
  565. me.container.addChild(me.container.nadeDrawer);
  566. }
  567. const nadeDrawer = me.container.nadeDrawer;
  568. nadeDrawer.clear();
  569. Object.values(window.game.objectCreator.idToObj)
  570. .filter(obj => {
  571. const isValid = ( obj.__type === 9 && obj.type !== "smoke" )
  572. || (
  573. obj.smokeEmitter &&
  574. window.objects[obj.type].explosion);
  575. return isValid;
  576. })
  577. .forEach(obj => {
  578. if(obj.layer !== me.layer) {
  579. nadeDrawer.beginFill(0xffffff, 0.3);
  580. } else {
  581. nadeDrawer.beginFill(0xff0000, 0.2);
  582. }
  583. nadeDrawer.drawCircle(
  584. (obj.pos.x - meX) * 16,
  585. (meY - obj.pos.y) * 16,
  586. (window.explosions[
  587. window.throwable[obj.type]?.explosionType ||
  588. window.objects[obj.type].explosion
  589. ].rad.max +
  590. 1) *
  591. 16
  592. );
  593. nadeDrawer.endFill();
  594. });
  595. }
  596.  
  597. // flashlightDrawer(laserDrawer)
  598. if (laserDrawerEnabled) {
  599. const curWeapon = findWeap(me);
  600. const curBullet = findBullet(curWeapon);
  601. if ( !me.container.laserDrawer ) {
  602. me.container.laserDrawer = new PIXI.Graphics();
  603. me.container.addChildAt(me.container.laserDrawer, 0);
  604. }
  605. const laserDrawer = me.container.laserDrawer;
  606. laserDrawer.clear();
  607. function laserPointer(
  608. curBullet,
  609. curWeapon,
  610. acPlayer,
  611. color = 0x0000ff,
  612. opacity = 0.3,
  613. ) {
  614. const { pos: acPlayerPos, posOld: acPlayerPosOld } = acPlayer;
  615. const dateNow = performance.now();
  616. if ( !(acPlayer.__id in lastFrames) ) lastFrames[acPlayer.__id] = [];
  617. lastFrames[acPlayer.__id].push([dateNow, { ...acPlayerPos }]);
  618. if (lastFrames[acPlayer.__id].length < 10) return;
  619. if (lastFrames[acPlayer.__id].length > 10){
  620. lastFrames[acPlayer.__id].shift();
  621. }
  622. const deltaTime = (dateNow - lastFrames[acPlayer.__id][0][0]) / 1000; // Time since last frame in seconds
  623. const acPlayerVelocity = {
  624. x: (acPlayerPos._x - lastFrames[acPlayer.__id][0][1]._x) / deltaTime,
  625. y: (acPlayerPos._y - lastFrames[acPlayer.__id][0][1]._y) / deltaTime,
  626. };
  627. let lasic = {};
  628. let isMoving = !!(acPlayerVelocity.x || acPlayerVelocity.y);
  629. if(curBullet) {
  630. lasic.active = true;
  631. lasic.range = curBullet.distance * 16.25;
  632. let atan;
  633. if (acPlayer == me && !window.game.input.mouseButtons['0']){
  634. //local rotation
  635. atan = Math.atan2(
  636. window.game.input.mousePos._y - window.innerHeight / 2,
  637. window.game.input.mousePos._x - window.innerWidth / 2,
  638. );
  639. }else{
  640. atan = Math.atan2(
  641. acPlayer.dir.x,
  642. acPlayer.dir.y
  643. )
  644. -
  645. Math.PI / 2;
  646. }
  647. lasic.direction = atan;
  648. lasic.angle =
  649. ((curWeapon.shotSpread +
  650. (isMoving ? curWeapon.moveSpread : 0)) *
  651. 0.01745329252) /
  652. 2;
  653. } else {
  654. lasic.active = false;
  655. }
  656. if(!lasic.active) {
  657. return;
  658. }
  659. const center = {
  660. x: (acPlayerPos._x - me.pos._x) * 16,
  661. y: (me.pos._y - acPlayerPos._y) * 16,
  662. };
  663. const radius = lasic.range;
  664. let angleFrom = lasic.direction - lasic.angle;
  665. let angleTo = lasic.direction + lasic.angle;
  666. angleFrom =
  667. angleFrom > Math.PI * 2
  668. ? angleFrom - Math.PI * 2
  669. : angleFrom < 0
  670. ? angleFrom + Math.PI * 2
  671. : angleFrom;
  672. angleTo =
  673. angleTo > Math.PI * 2
  674. ? angleTo - Math.PI * 2
  675. : angleTo < 0
  676. ? angleTo + Math.PI * 2
  677. : angleTo;
  678. laserDrawer.beginFill(color, opacity);
  679. laserDrawer.moveTo(center.x, center.y);
  680. laserDrawer.arc(center.x, center.y, radius, angleFrom, angleTo);
  681. laserDrawer.lineTo(center.x, center.y);
  682. laserDrawer.endFill();
  683. }
  684. laserPointer(
  685. curBullet,
  686. curWeapon,
  687. me,
  688. );
  689. players
  690. .filter(player => player.active || !player.netData.dead || me.__id !== player.__id || me.layer === player.layer || getTeam(player) != meTeam)
  691. .forEach(enemy => {
  692. const enemyWeapon = findWeap(enemy);
  693. laserPointer(
  694. findBullet(enemyWeapon),
  695. enemyWeapon,
  696. enemy,
  697. "0",
  698. 0.2,
  699. )
  700. });
  701. };
  702.  
  703. }catch(err){
  704. console.error('esp', err)
  705. }
  706. }
  707.  
  708. const inputCommands = {
  709. Cancel: 6,
  710. Count: 36,
  711. CycleUIMode: 30,
  712. EmoteMenu: 31,
  713. EquipFragGrenade: 15,
  714. EquipLastWeap: 19,
  715. EquipMelee: 13,
  716. EquipNextScope: 22,
  717. EquipNextWeap: 17,
  718. EquipOtherGun: 20,
  719. EquipPrevScope: 21,
  720. EquipPrevWeap: 18,
  721. EquipPrimary: 11,
  722. EquipSecondary: 12,
  723. EquipSmokeGrenade: 16,
  724. EquipThrowable: 14,
  725. Fire: 4,
  726. Fullscreen: 33,
  727. HideUI: 34,
  728. Interact: 7,
  729. Loot: 10,
  730. MoveDown: 3,
  731. MoveLeft: 0,
  732. MoveRight: 1,
  733. MoveUp: 2,
  734. Reload: 5,
  735. Revive: 8,
  736. StowWeapons: 27,
  737. SwapWeapSlots: 28,
  738. TeamPingMenu: 32,
  739. TeamPingSingle: 35,
  740. ToggleMap: 29,
  741. Use: 9,
  742. UseBandage: 23,
  743. UseHealthKit: 24,
  744. UsePainkiller: 26,
  745. UseSoda: 25,
  746. };
  747.  
  748. let inputs = [];
  749. window.initGameControls = function(gameControls){
  750. for (const command of inputs){
  751. gameControls.addInput(inputCommands[command]);
  752. }
  753. inputs = [];
  754.  
  755. // autoMelee
  756. if (window.game.input.mouseButtons['0'] && window.aimTouchMoveDir) {
  757. if (window.aimTouchDistanceToEnemy < 4) gameControls.addInput(inputCommands['EquipMelee']);
  758. gameControls.touchMoveActive = true;
  759. gameControls.touchMoveLen = 255;
  760. gameControls.touchMoveDir.x = window.aimTouchMoveDir.x;
  761. gameControls.touchMoveDir.y = window.aimTouchMoveDir.y;
  762. }
  763.  
  764. return gameControls
  765. }
  766.  
  767. function degreesToRadians(degrees) {
  768. return degrees * (Math.PI / 180);
  769. }
  770.  
  771.  
  772. let spinAngle = 0;
  773. const radius = 100; // The radius of the circle
  774. const spinSpeed = 37.5; // Rotation speed (increase for faster speed)
  775. let date = performance.now();
  776. let enemyAimBot = null;
  777. function aimBot() {
  778.  
  779. if (!aimBotEnabled) return;
  780.  
  781. const players = window.game.playerBarn.playerPool.pool;
  782. const me = window.game.activePlayer;
  783.  
  784. try {
  785. const meTeam = getTeam(me);
  786.  
  787. let enemy = null;
  788. let minDistanceToEnemyFromMouse = Infinity;
  789. if (focusedEnemy && focusedEnemy.active && !focusedEnemy.netData.dead) {
  790. enemy = focusedEnemy;
  791. }else{
  792. if (focusedEnemy){
  793. focusedEnemy = null;
  794. updateOverlay();
  795. }
  796.  
  797. players.forEach((player) => {
  798. // We miss inactive or dead players
  799. if (!player.active || player.netData.dead || player.downed || me.__id === player.__id || me.layer !== player.layer || getTeam(player) == meTeam || friends.includes(player.nameText._text)) return;
  800. const screenPlayerPos = window.game.camera.pointToScreen({x: player.pos._x, y: player.pos._y});
  801. // const distanceToEnemyFromMouse = Math.hypot(screenPlayerPos.x - window.game.input.mousePos._x, screenPlayerPos.y - window.game.input.mousePos._y);
  802. const distanceToEnemyFromMouse = (screenPlayerPos.x - window.game.input.mousePos._x) ** 2 + (screenPlayerPos.y - window.game.input.mousePos._y) ** 2;
  803. if (distanceToEnemyFromMouse < minDistanceToEnemyFromMouse) {
  804. minDistanceToEnemyFromMouse = distanceToEnemyFromMouse;
  805. enemy = player;
  806. }
  807. });
  808. }
  809.  
  810. if (enemy) {
  811. const meX = me.pos._x;
  812. const meY = me.pos._y;
  813. const enemyX = enemy.pos._x;
  814. const enemyY = enemy.pos._y;
  815.  
  816. const distanceToEnemy = Math.hypot(meX - enemyX, meY - enemyY);
  817. // const distanceToEnemy = (meX - enemyX) ** 2 + (meY - enemyY) ** 2;
  818.  
  819. if (enemy != enemyAimBot) {
  820. enemyAimBot = enemy;
  821. lastFrames[enemy.__id] = [];
  822. }
  823.  
  824. const predictedEnemyPos = calculatePredictedPosForShoot(enemy, me);
  825.  
  826. if (!predictedEnemyPos) return;
  827.  
  828. window.lastAimPos = {
  829. clientX: predictedEnemyPos.x,
  830. clientY: predictedEnemyPos.y,
  831. }
  832. // AutoMelee
  833. if(meleeAttackEnabled && distanceToEnemy <= 8) {
  834. const moveAngle = calcAngle(enemy.pos, me.pos) + Math.PI;
  835. window.gameControls.touchMoveActive = true;
  836. window.aimTouchMoveDir = {
  837. x: Math.cos(moveAngle),
  838. y: Math.sin(moveAngle),
  839. }
  840. window.aimTouchDistanceToEnemy = distanceToEnemy;
  841. }else{
  842. window.aimTouchMoveDir = null;
  843. window.aimTouchDistanceToEnemy = null;
  844. }
  845.  
  846. if (aimbotDot.style.left !== predictedEnemyPos.x + 'px' || aimbotDot.style.top !== predictedEnemyPos.y + 'px') {
  847. aimbotDot.style.left = predictedEnemyPos.x + 'px';
  848. aimbotDot.style.top = predictedEnemyPos.y + 'px';
  849. aimbotDot.style.display = 'block';
  850. }
  851. }else{
  852. window.aimTouchMoveDir = null;
  853. window.lastAimPos = null;
  854. aimbotDot.style.display = 'none';
  855. }
  856.  
  857. date = performance.now();
  858. } catch (error) {
  859. console.error("Error in aimBot:", error);
  860. }
  861. }
  862.  
  863. function calcAngle(playerPos, mePos){
  864. const dx = mePos._x - playerPos._x;
  865. const dy = mePos._y - playerPos._y;
  866.  
  867. return Math.atan2(dy, dx);
  868. }
  869.  
  870. window.lastFrames = {};
  871. function calculatePredictedPosForShoot(enemy, curPlayer) {
  872. if (!enemy || !curPlayer) {
  873. console.log("Missing enemy or player data");
  874. return null;
  875. }
  876. const { pos: enemyPos } = enemy;
  877. const { pos: curPlayerPos } = curPlayer;
  878.  
  879. const dateNow = performance.now();
  880.  
  881. if ( !(enemy.__id in lastFrames) ) lastFrames[enemy.__id] = [];
  882. lastFrames[enemy.__id].push([dateNow, { ...enemyPos }]);
  883.  
  884. if (lastFrames[enemy.__id].length < 10) {
  885. console.log("Insufficient data for prediction, using current position");
  886. return window.game.camera.pointToScreen({x: enemyPos._x, y: enemyPos._y});
  887. }
  888.  
  889. if (lastFrames[enemy.__id].length > 10){
  890. lastFrames[enemy.__id].shift();
  891. }
  892.  
  893. const deltaTime = (dateNow - lastFrames[enemy.__id][0][0]) / 1000; // Time since last frame in seconds
  894.  
  895. const enemyVelocity = {
  896. x: (enemyPos._x - lastFrames[enemy.__id][0][1]._x) / deltaTime,
  897. y: (enemyPos._y - lastFrames[enemy.__id][0][1]._y) / deltaTime,
  898. };
  899.  
  900. const weapon = findWeap(curPlayer);
  901. const bullet = findBullet(weapon);
  902.  
  903. let bulletSpeed;
  904. if (!bullet) {
  905. bulletSpeed = 1000;
  906. }else{
  907. bulletSpeed = bullet.speed;
  908. }
  909.  
  910.  
  911. // Quadratic equation for time prediction
  912. const vex = enemyVelocity.x;
  913. const vey = enemyVelocity.y;
  914. const dx = enemyPos._x - curPlayerPos._x;
  915. const dy = enemyPos._y - curPlayerPos._y;
  916. const vb = bulletSpeed;
  917.  
  918. const a = vb ** 2 - vex ** 2 - vey ** 2;
  919. const b = -2 * (vex * dx + vey * dy);
  920. const c = -(dx ** 2) - (dy ** 2);
  921.  
  922. let t;
  923.  
  924. if (Math.abs(a) < 1e-6) {
  925. console.log('Linear solution bullet speed is much greater than velocity')
  926. t = -c / b;
  927. } else {
  928. const discriminant = b ** 2 - 4 * a * c;
  929.  
  930. if (discriminant < 0) {
  931. console.log("No solution, shooting at current position");
  932. return window.game.camera.pointToScreen({x: enemyPos._x, y: enemyPos._y});
  933. }
  934.  
  935. const sqrtD = Math.sqrt(discriminant);
  936. const t1 = (-b - sqrtD) / (2 * a);
  937. const t2 = (-b + sqrtD) / (2 * a);
  938.  
  939. t = Math.min(t1, t2) > 0 ? Math.min(t1, t2) : Math.max(t1, t2);
  940. }
  941.  
  942.  
  943. if (t < 0) {
  944. console.log("Negative time, shooting at current position");
  945. return window.game.camera.pointToScreen({x: enemyPos._x, y: enemyPos._y});
  946. }
  947.  
  948. // console.log(`A bullet with the enemy will collide through ${t}`)
  949.  
  950. const predictedPos = {
  951. x: enemyPos._x + vex * t,
  952. y: enemyPos._y + vey * t,
  953. };
  954.  
  955. return window.game.camera.pointToScreen(predictedPos);
  956. }
  957.  
  958. function findWeap(player) {
  959. const weapType = player.netData.activeWeapon;
  960. return weapType && window.guns[weapType] ? window.guns[weapType] : null;
  961. }
  962.  
  963. function findBullet(weapon) {
  964. return weapon ? window.bullets[weapon.bulletType] : null;
  965. }
  966.  
  967.  
  968. function updateOverlay() {
  969. overlay.innerHTML = ``;
  970.  
  971. const controls = [
  972. [ '[B] AimBot:', aimBotEnabled, aimBotEnabled ? 'ON' : 'OFF' ],
  973. [ '[Z] Zoom:', zoomEnabled, zoomEnabled ? 'ON' : 'OFF' ],
  974. [ '[M] MeleeAtk:', meleeAttackEnabled, meleeAttackEnabled ? 'ON' : 'OFF' ],
  975. [ '[Y] SpinBot:', spinBot, spinBot ? 'ON' : 'OFF' ],
  976. [ '[T] FocusedEnemy:', focusedEnemy, focusedEnemy?.nameText?._text ? focusedEnemy?.nameText?._text : 'OFF' ],
  977. // [ '[O] gameOptimization:', gameOptimization ],
  978. ];
  979.  
  980. controls.forEach((control, index) => {
  981. let [name, isEnabled, optionalText] = control;
  982. text = `${name} ${optionalText}`;
  983.  
  984. const line = document.createElement('p');
  985. line.className = 'krity-control';
  986. line.style.opacity = isEnabled ? 1 : 0.5;
  987. line.textContent = text;
  988. overlay.appendChild(line);
  989. });
  990. }
  991.  
  992.  
  993. const ammo = [
  994. {
  995. name: "",
  996. ammo: null,
  997. lastShotDate: Date.now()
  998. },
  999. {
  1000. name: "",
  1001. ammo: null,
  1002. lastShotDate: Date.now()
  1003. },
  1004. {
  1005. name: "",
  1006. ammo: null,
  1007. },
  1008. {
  1009. name: "",
  1010. ammo: null,
  1011. },
  1012. ]
  1013. function autoSwitch(){
  1014. if (!autoSwitchEnabled) return;
  1015.  
  1016. try {
  1017. const curWeapIdx = window.game.activePlayer.localData.curWeapIdx;
  1018. const weaps = window.game.activePlayer.localData.weapons;
  1019. const curWeap = weaps[curWeapIdx];
  1020. const shouldSwitch = gun => {
  1021. let s = false;
  1022. try {
  1023. s =
  1024. (window.guns[gun].fireMode === "single"
  1025. || window.guns[gun].fireMode === "burst")
  1026. && window.guns[gun].fireDelay >= 0.45;
  1027. }
  1028. catch (e) {
  1029. }
  1030. return s;
  1031. }
  1032. weapsEquip = ['EquipPrimary', 'EquipSecondary']
  1033. if(curWeap.ammo !== ammo[curWeapIdx].ammo) {
  1034. otherWeapIdx = (curWeapIdx == 0) ? 1 : 0
  1035. otherWeap = weaps[otherWeapIdx]
  1036. if ((curWeap.ammo < ammo[curWeapIdx].ammo || (ammo[curWeapIdx].ammo === 0 && curWeap.ammo > ammo[curWeapIdx].ammo && window.game.input.mouseButtons['0'])) && shouldSwitch(curWeap.type) && curWeap.type == ammo[curWeapIdx].type) {
  1037. ammo[curWeapIdx].lastShotDate = Date.now();
  1038. console.log("Switching weapon due to ammo change");
  1039. if ( shouldSwitch(otherWeap.type) && otherWeap.ammo) { inputs.push(weapsEquip[otherWeapIdx]); } // && ammo[curWeapIdx].ammo !== 0
  1040. else if ( otherWeap.type !== "" ) { inputs.push(weapsEquip[otherWeapIdx]); inputs.push(weapsEquip[curWeapIdx]); }
  1041. else { inputs.push('EquipMelee'); inputs.push(weapsEquip[curWeapIdx]); }
  1042. }
  1043. ammo[curWeapIdx].ammo = curWeap.ammo
  1044. ammo[curWeapIdx].type = curWeap.type
  1045. }
  1046. }catch(err){}
  1047. }
  1048.  
  1049. document.addEventListener('DOMContentLoaded', () => {
  1050. document.head.append(fontAwesome);
  1051. document.head.append(styles);
  1052. document.head.append(appScript);
  1053. document.head.append(pixiScript);
  1054. document.querySelector('#ui-game').append(overlay);
  1055. document.querySelector('#ui-top-left').insertBefore(krityTitle, document.querySelector('#ui-top-left').firstChild);
  1056. document.querySelector('#ui-game').append(aimbotDot);
  1057.  
  1058. new GameMod(); // AlguenClient
  1059. });
  1060.  
  1061. let colors = {
  1062. container_06: 14934793,
  1063. barn_02: 14934793,
  1064. stone_02: 1654658,
  1065. tree_03: 16777215,
  1066. stone_04: 0xeb175a,
  1067. stone_05: 0xeb175a,
  1068. bunker_storm_01: 14934793,
  1069. },
  1070. sizes = {
  1071. stone_02: 4,
  1072. tree_03: 2,
  1073. stone_04: 2,
  1074. stone_05: 2,
  1075. };
  1076.  
  1077. window.mapColorizing = map => {
  1078. map.forEach(object => {
  1079. if ( !colors[object.obj.type] ) return;
  1080. object.shapes.forEach(shape => {
  1081. shape.color = colors[object.obj.type];
  1082. console.log(object);
  1083. if ( !sizes[object.obj.type] ) return;
  1084. shape.scale = sizes[object.obj.type];
  1085. console.log(object);
  1086. });
  1087. });
  1088. }
  1089.  
  1090.  
  1091.  
  1092. let lastTime = Date.now();
  1093. let showing = false;
  1094. let timer = null;
  1095. function grenadeTimer(){
  1096. try{
  1097. let elapsed = (Date.now() - lastTime) / 1000;
  1098. const player = window.game.activePlayer;
  1099. const activeItem = player.netData.activeWeapon;
  1100.  
  1101. if (3 !== window.game.activePlayer.localData.curWeapIdx
  1102. || player.throwableState !== "cook"
  1103. || (!activeItem.includes('frag') && !activeItem.includes('mirv') && !activeItem.includes('martyr_nade'))
  1104. )
  1105. return (
  1106. (showing = false),
  1107. timer && timer.destroy(),
  1108. (timer = false)
  1109. );
  1110. const time = 4;
  1111.  
  1112. if(elapsed > time) {
  1113. showing = false;
  1114. }
  1115. if(!showing) {
  1116. if(timer) {
  1117. timer.destroy();
  1118. }
  1119. timer = new window.pieTimerClass();
  1120. window.game.pixi.stage.addChild(timer.container);
  1121. timer.start("Grenade", 0, time);
  1122. showing = true;
  1123. lastTime = Date.now();
  1124. return;
  1125. }
  1126. timer.update(elapsed - timer.elapsed, window.game.camera);
  1127. }catch(err){}
  1128. }
  1129.  
  1130.  
  1131. // alguen client
  1132. window.GameMod = class GameMod { // metka mod
  1133. constructor() {
  1134. this.lastFrameTime = performance.now();
  1135. this.frameCount = 0;
  1136. this.fps = 0;
  1137. this.kills = 0;
  1138. this.setAnimationFrameCallback();
  1139. this.isFpsVisible = true;
  1140. this.isPingVisible = true;
  1141. this.isKillsVisible = true;
  1142. this.isMenuVisible = true;
  1143. this.isClean = false;
  1144.  
  1145.  
  1146. this.initCounter("fpsCounter", "isFpsVisible", this.updateFpsVisibility.bind(this));
  1147. this.initCounter("pingCounter", "isPingVisible", this.updatePingVisibility.bind(this));
  1148. this.initCounter("killsCounter", "isKillsVisible", this.updateKillsVisibility.bind(this));
  1149.  
  1150. this.initMenu();
  1151. this.initRules();
  1152. this.loadBackgroundFromLocalStorage();
  1153. this.loadLocalStorage();
  1154. this.startUpdateLoop();
  1155. this.setupWeaponBorderHandler();
  1156. this.setupKeyListeners();
  1157. }
  1158.  
  1159. initCounter(id, visibilityKey, updateVisibilityFn) {
  1160. this[id] = document.createElement("div");
  1161. this[id].id = id;
  1162. Object.assign(this[id].style, {
  1163. color: "white",
  1164. backgroundColor: "rgba(0, 0, 0, 0.2)",
  1165. padding: "5px 10px",
  1166. marginTop: "10px",
  1167. borderRadius: "5px",
  1168. fontFamily: "Arial, sans-serif",
  1169. fontSize: "14px",
  1170. zIndex: "10000",
  1171. pointerEvents: "none",
  1172. });
  1173.  
  1174. const uiTopLeft = document.getElementById("ui-top-left");
  1175. if (uiTopLeft) {
  1176. uiTopLeft.appendChild(this[id]);
  1177. }
  1178.  
  1179. updateVisibilityFn();
  1180. }
  1181.  
  1182. updateFpsVisibility() {
  1183. this.updateVisibility("fpsCounter", this.isFpsVisible);
  1184. }
  1185.  
  1186. updatePingVisibility() {
  1187. this.updateVisibility("pingCounter", this.isPingVisible);
  1188. }
  1189.  
  1190. updateKillsVisibility() {
  1191. this.updateVisibility("killsCounter", this.isKillsVisible);
  1192. }
  1193.  
  1194.  
  1195. updateVisibility(id, isVisible) {
  1196. if (this[id]) {
  1197. this[id].style.display = isVisible ? "block" : "none";
  1198. this[id].style.backgroundColor = isVisible
  1199. ? "rgba(0, 0, 0, 0.2)"
  1200. : "transparent";
  1201. }
  1202. }
  1203.  
  1204. toggleFpsDisplay() {
  1205. this.isFpsVisible = !this.isFpsVisible;
  1206. this.updateFpsVisibility();
  1207. }
  1208. setAnimationFrameCallback() {
  1209. this.animationFrameCallback = (callback) => setTimeout(callback, 1);
  1210. }
  1211.  
  1212.  
  1213. togglePingDisplay() {
  1214. this.isPingVisible = !this.isPingVisible;
  1215. this.updatePingVisibility();
  1216. }
  1217.  
  1218. toggleKillsDisplay() {
  1219. this.isKillsVisible = !this.isKillsVisible;
  1220. this.updateKillsVisibility();
  1221. }
  1222.  
  1223. getKills() {
  1224. const killElement = document.querySelector(
  1225. ".ui-player-kills.js-ui-player-kills",
  1226. );
  1227. if (killElement) {
  1228. const kills = parseInt(killElement.textContent, 10);
  1229. return isNaN(kills) ? 0 : kills;
  1230. }
  1231. return 0;
  1232. }
  1233.  
  1234. getRegionFromLocalStorage() {
  1235. let config = localStorage.getItem("surviv_config");
  1236. if (config) {
  1237. let configObject = JSON.parse(config);
  1238. return configObject.region;
  1239. }
  1240. return null;
  1241. }
  1242.  
  1243. startPingTest() {
  1244. const currentUrl = window.location.href;
  1245. const isSpecialUrl = /\/#\w+/.test(currentUrl);
  1246.  
  1247. const teamSelectElement = document.getElementById("team-server-select");
  1248. const mainSelectElement = document.getElementById("server-select-main");
  1249.  
  1250. const region =
  1251. isSpecialUrl && teamSelectElement
  1252. ? teamSelectElement.value
  1253. : mainSelectElement
  1254. ? mainSelectElement.value
  1255. : null;
  1256.  
  1257. if (region && region !== this.currentServer) {
  1258. this.currentServer = region;
  1259. this.resetPing();
  1260.  
  1261. let servers;
  1262.  
  1263. if (window.location.hostname === 'resurviv.biz'){
  1264. servers = [
  1265. { region: "NA", url: "resurviv.biz:8001" },
  1266. { region: "EU", url: "217.160.224.171:8001" },
  1267. ];
  1268. }else if (window.location.hostname === 'survev.io'){
  1269. servers = [
  1270. { region: "NA", url: "usr.mathsiscoolfun.com:8001" },
  1271. { region: "EU", url: "eur.mathsiscoolfun.com:8001" },
  1272. { region: "Asia", url: "asr.mathsiscoolfun.com:8001" },
  1273. { region: "SA", url: "sa.mathsiscoolfun.com:8001" },
  1274. ];
  1275. }
  1276.  
  1277.  
  1278. const selectedServer = servers.find(
  1279. (server) => region.toUpperCase() === server.region.toUpperCase(),
  1280. );
  1281.  
  1282. if (selectedServer) {
  1283. this.pingTest = new PingTest(selectedServer);
  1284. this.pingTest.startPingTest();
  1285. } else {
  1286. this.resetPing();
  1287. }
  1288. }
  1289. }
  1290.  
  1291. resetPing() {
  1292. if (this.pingTest && this.pingTest.test.ws) {
  1293. this.pingTest.test.ws.close();
  1294. this.pingTest.test.ws = null;
  1295. }
  1296. this.pingTest = null;
  1297. }
  1298.  
  1299.  
  1300. saveBackgroundToLocalStorage(url) {
  1301. localStorage.setItem("lastBackgroundUrl", url);
  1302. }
  1303.  
  1304. saveBackgroundToLocalStorage(image) {
  1305. if (typeof image === "string") {
  1306. localStorage.setItem("lastBackgroundType", "url");
  1307. localStorage.setItem("lastBackgroundValue", image);
  1308. } else {
  1309. localStorage.setItem("lastBackgroundType", "local");
  1310. const reader = new FileReader();
  1311. reader.onload = () => {
  1312. localStorage.setItem("lastBackgroundValue", reader.result);
  1313. };
  1314. reader.readAsDataURL(image);
  1315. }
  1316. }
  1317.  
  1318. loadBackgroundFromLocalStorage() {
  1319. const backgroundType = localStorage.getItem("lastBackgroundType");
  1320. const backgroundValue = localStorage.getItem("lastBackgroundValue");
  1321.  
  1322. const backgroundElement = document.getElementById("background");
  1323. if (backgroundElement && backgroundType && backgroundValue) {
  1324. if (backgroundType === "url") {
  1325. backgroundElement.style.backgroundImage = `url(${backgroundValue})`;
  1326. } else if (backgroundType === "local") {
  1327. backgroundElement.style.backgroundImage = `url(${backgroundValue})`;
  1328. }
  1329. }
  1330. }
  1331. loadLocalStorage() {
  1332. const savedSettings = JSON.parse(localStorage.getItem("userSettings"));
  1333. if (savedSettings) {
  1334. this.isFpsVisible = savedSettings.isFpsVisible ?? this.isFpsVisible;
  1335. this.isPingVisible = savedSettings.isPingVisible ?? this.isPingVisible;
  1336. this.isKillsVisible = savedSettings.isKillsVisible ?? this.isKillsVisible;
  1337. this.isClean = savedSettings.isClean ?? this.isClean;
  1338. }
  1339.  
  1340. this.updateKillsVisibility();
  1341. this.updateFpsVisibility();
  1342. this.updatePingVisibility();
  1343. }
  1344.  
  1345. updateHealthBars() {
  1346. const healthBars = document.querySelectorAll("#ui-health-container");
  1347. healthBars.forEach((container) => {
  1348. const bar = container.querySelector("#ui-health-actual");
  1349. if (bar) {
  1350. const width = Math.round(parseFloat(bar.style.width));
  1351. let percentageText = container.querySelector(".health-text");
  1352.  
  1353. if (!percentageText) {
  1354. percentageText = document.createElement("span");
  1355. percentageText.classList.add("health-text");
  1356. Object.assign(percentageText.style, {
  1357. width: "100%",
  1358. textAlign: "center",
  1359. marginTop: "5px",
  1360. color: "#333",
  1361. fontSize: "20px",
  1362. fontWeight: "bold",
  1363. position: "absolute",
  1364. zIndex: "10",
  1365. });
  1366. container.appendChild(percentageText);
  1367. }
  1368.  
  1369. percentageText.textContent = `${width}%`;
  1370. }
  1371. });
  1372. }
  1373.  
  1374. updateBoostBars() {
  1375. const boostCounter = document.querySelector("#ui-boost-counter");
  1376. if (boostCounter) {
  1377. const boostBars = boostCounter.querySelectorAll(
  1378. ".ui-boost-base .ui-bar-inner",
  1379. );
  1380.  
  1381. let totalBoost = 0;
  1382. const weights = [25, 25, 40, 10];
  1383.  
  1384. boostBars.forEach((bar, index) => {
  1385. const width = parseFloat(bar.style.width);
  1386. if (!isNaN(width)) {
  1387. totalBoost += width * (weights[index] / 100);
  1388. }
  1389. });
  1390.  
  1391. const averageBoost = Math.round(totalBoost);
  1392. let boostDisplay = boostCounter.querySelector(".boost-display");
  1393.  
  1394. if (!boostDisplay) {
  1395. boostDisplay = document.createElement("div");
  1396. boostDisplay.classList.add("boost-display");
  1397. Object.assign(boostDisplay.style, {
  1398. position: "absolute",
  1399. bottom: "75px",
  1400. right: "335px",
  1401. color: "#FF901A",
  1402. backgroundColor: "rgba(0, 0, 0, 0.4)",
  1403. padding: "5px 10px",
  1404. borderRadius: "5px",
  1405. fontFamily: "Arial, sans-serif",
  1406. fontSize: "14px",
  1407. zIndex: "10",
  1408. textAlign: "center",
  1409. });
  1410.  
  1411. boostCounter.appendChild(boostDisplay);
  1412. }
  1413.  
  1414. boostDisplay.textContent = `AD: ${averageBoost}%`;
  1415. }
  1416. }
  1417.  
  1418. setupWeaponBorderHandler() {
  1419. const weaponContainers = Array.from(
  1420. document.getElementsByClassName("ui-weapon-switch"),
  1421. );
  1422. weaponContainers.forEach((container) => {
  1423. if (container.id === "ui-weapon-id-4") {
  1424. container.style.border = "3px solid #2f4032";
  1425. } else {
  1426. container.style.border = "3px solid #FFFFFF";
  1427. }
  1428. });
  1429. const weaponNames = Array.from(
  1430. document.getElementsByClassName("ui-weapon-name"),
  1431. );
  1432. weaponNames.forEach((weaponNameElement) => {
  1433. const weaponContainer = weaponNameElement.closest(".ui-weapon-switch");
  1434. const observer = new MutationObserver(() => {
  1435. const weaponName = weaponNameElement.textContent.trim();
  1436. let border = "#FFFFFF";
  1437. switch (weaponName.toUpperCase()) {
  1438. //yellow
  1439. case "CZ-3A1": case "G18C": case "M9": case "M93R": case "MAC-10": case "MP5": case "P30L": case "DUAL P30L": case "UMP9": case "VECTOR": case "VSS": case "FLAMETHROWER": border = "#FFAE00"; break;
  1440. //blue
  1441. case "AK-47": case "OT-38": case "OTS-38": case "M39 EMR": case "DP-28": case "MOSIN-NAGANT": case "SCAR-H": case "SV-98": case "M1 GARAND": case "PKP PECHENEG": case "AN-94": case "BAR M1918": case "BLR 81": case "SVD-63": case "M134": case "GROZA": case "GROZA-S": border = "#007FFF"; break;
  1442. //green
  1443. case "FAMAS": case "M416": case "M249": case "QBB-97": case "MK 12 SPR": case "M4A1-S": case "SCOUT ELITE": case "L86A2": border = "#0f690d"; break;
  1444. //red
  1445. case "M870": case "MP220": case "SAIGA-12": case "SPAS-12": case "USAS-12": case "SUPER 90": case "LASR GUN": case "M1100": border = "#FF0000"; break;
  1446. //purple
  1447. case "MODEL 94": case "PEACEMAKER": case "VECTOR (.45 ACP)": case "M1911": case "M1A1": border = "#800080"; break;
  1448. //black
  1449. case "DEAGLE 50": case "RAINBOW BLASTER": border = "#000000"; break;
  1450. //olive
  1451. case "AWM-S": case "MK 20 SSR": border = "#808000"; break;
  1452. //brown
  1453. case "POTATO CANNON": case "SPUD GUN": border = "#A52A2A"; break;
  1454. //other Guns
  1455. case "FLARE GUN": border = "#FF4500"; break; case "M79": border = "#008080"; break; case "HEART CANNON": border = "#FFC0CB"; break;
  1456. default: border = "#FFFFFF"; break; }
  1457. if (weaponContainer.id !== "ui-weapon-id-4") {
  1458. weaponContainer.style.border = `3px solid ${border}`;
  1459. }
  1460. });
  1461. observer.observe(weaponNameElement, {
  1462. childList: true,
  1463. characterData: true,
  1464. subtree: true,
  1465. });
  1466. });
  1467. }
  1468.  
  1469. updateUiElements() {
  1470. const currentUrl = window.location.href;
  1471.  
  1472. const isSpecialUrl = /\/#\w+/.test(currentUrl);
  1473.  
  1474. const playerOptions = document.getElementById("player-options");
  1475. const teamMenuContents = document.getElementById("team-menu-contents");
  1476. const startMenuContainer = document.querySelector(
  1477. "#start-menu .play-button-container",
  1478. );
  1479.  
  1480. if (!playerOptions) return;
  1481.  
  1482. if (
  1483. isSpecialUrl &&
  1484. teamMenuContents &&
  1485. playerOptions.parentNode !== teamMenuContents
  1486. ) {
  1487. teamMenuContents.appendChild(playerOptions);
  1488. } else if (
  1489. !isSpecialUrl &&
  1490. startMenuContainer &&
  1491. playerOptions.parentNode !== startMenuContainer
  1492. ) {
  1493. const firstChild = startMenuContainer.firstChild;
  1494. startMenuContainer.insertBefore(playerOptions, firstChild);
  1495. }
  1496. const teamMenu = document.getElementById("team-menu");
  1497. if (teamMenu) {
  1498. teamMenu.style.height = "355px";
  1499. }
  1500. const menuBlocks = document.querySelectorAll(".menu-block");
  1501. menuBlocks.forEach((block) => {
  1502. block.style.maxHeight = "355px";
  1503. });
  1504. const leftColumn = document.getElementById("left-column");
  1505. const newsBlock = document.getElementById("news-block");
  1506. //scalable?
  1507. }
  1508.  
  1509. updateCleanMode() {
  1510. const leftColumn = document.getElementById("left-column");
  1511. const newsBlock = document.getElementById("news-block");
  1512.  
  1513. if (this.isClean) {
  1514. if (leftColumn) leftColumn.style.display = "none";
  1515. if (newsBlock) newsBlock.style.display = "none";
  1516. } else {
  1517. if (leftColumn) leftColumn.style.display = "block";
  1518. if (newsBlock) newsBlock.style.display = "block";
  1519. }
  1520. }
  1521.  
  1522. updateMenuButtonText() {
  1523. const hideButton = document.getElementById("hideMenuButton");
  1524. hideButton.textContent = this.isMenuVisible
  1525. ? "Hide Menu [P]"
  1526. : "Show Menu [P]";
  1527. }
  1528.  
  1529. setupKeyListeners() {
  1530. document.addEventListener("keydown", (event) => {
  1531. if (event.key.toLowerCase() === "p") {
  1532. this.toggleMenuVisibility();
  1533. }
  1534. });
  1535. }
  1536. //menu
  1537. initMenu() {
  1538. const middleRow = document.querySelector("#start-row-top");
  1539. Object.assign(middleRow.style, {
  1540. display: "flex",
  1541. flexDirection: "row",
  1542. });
  1543.  
  1544.  
  1545. const menu = document.createElement("div");
  1546. menu.id = "KrityHack";
  1547. Object.assign(menu.style, {
  1548. backgroundColor: "rgba(0, 0, 0, 0.5)",
  1549. padding: "15px",
  1550. borderRadius: "10px",
  1551. boxShadow: "0 4px 10px rgba(0, 0, 0, 0.3)",
  1552. fontFamily: "Arial, sans-serif",
  1553. fontSize: "18px",
  1554. color: "#fff",
  1555. maxWidth: "300px",
  1556. height: "100%",
  1557. // maxHeight: "320px",
  1558. overflowY: "auto",
  1559. // marginTop: "20px",
  1560. marginRight: "30px",
  1561. boxSizing: "border-box",
  1562. });
  1563.  
  1564. const title = document.createElement("h2");
  1565. title.textContent = "Social networks";
  1566. title.className = 'news-header';
  1567. Object.assign(title.style, {
  1568. margin: "0 0 10px",
  1569. fontSize: "20px",
  1570. });
  1571. menu.append(title);
  1572.  
  1573. const description = document.createElement("p");
  1574. description.className = "news-paragraph";
  1575. description.style.fontSize = "14px";
  1576. description.innerHTML = `⭐ Star us on GitHub<br>📢 Join our Telegram group<br>🎮 Join our Discord server`
  1577. menu.append(description);
  1578. const createSocialLink = (text) => {
  1579. const a = document.createElement("a");
  1580. a.textContent = `${text}`;
  1581. a.target = "_blank";
  1582. Object.assign(a.style, {
  1583. display: "block",
  1584. border: "none",
  1585. color: "#fff",
  1586. padding: "10px",
  1587. borderRadius: "5px",
  1588. marginBottom: "10px",
  1589. fontSize: "15px",
  1590. lineHeight: "14px",
  1591. cursor: "pointer",
  1592. textAlign: "center",
  1593. textDecoration: "none",
  1594. });
  1595. return a;
  1596. };
  1597. const githubLink = createSocialLink("");
  1598. githubLink.style.backgroundColor = "#0c1117";
  1599. githubLink.href = "https://github.com/Drino955/survev-krityhack";
  1600. githubLink.innerHTML = `<i class="fa-brands fa-github"></i> KrityHack`;
  1601. menu.append(githubLink);
  1602. const telegramLink = createSocialLink("");
  1603. telegramLink.style.backgroundColor = "#00a8e6";
  1604. telegramLink.href = "https://t.me/krityteam";
  1605. telegramLink.innerHTML = `<i class="fa-brands fa-telegram-plane"></i> KrityTeam`;
  1606. menu.append(telegramLink);
  1607.  
  1608. const discordLink = createSocialLink("");
  1609. discordLink.style.backgroundColor = "#5865F2";
  1610. discordLink.href = "https://discord.gg/wPuvEySg3E";
  1611. discordLink.innerHTML = `<i class="fa-brands fa-discord"></i> [HACK] League of Hackers`;
  1612. menu.append(discordLink);
  1613.  
  1614. const additionalDescription = document.createElement("p");
  1615. additionalDescription.className = "news-paragraph";
  1616. additionalDescription.style.fontSize = "14px";
  1617. additionalDescription.innerHTML = `Your support helps us develop the project and provide better updates!`
  1618. menu.append(additionalDescription);
  1619.  
  1620. const leftColumn = document.querySelector('#left-column');
  1621. leftColumn.innerHTML = ``;
  1622. leftColumn.style.marginTop = "10px";
  1623. leftColumn.style.marginBottom = "27px";
  1624. leftColumn.append(menu);
  1625. this.menu = menu;
  1626. }
  1627.  
  1628. initRules() {
  1629. const newsBlock = document.querySelector("#news-block");
  1630. newsBlock.innerHTML = `
  1631. <h3 class="news-header">KrityHack v0.2.1</h3>
  1632. <div id="news-current">
  1633. <small class="news-date">January 13, 2025</small>
  1634. <h2>How to use the cheat in the game 🚀</h2>
  1635. <p class="news-paragraph">After installing the cheat, you can use the following features and hotkeys:</p>
  1636.  
  1637. <h3>Hotkeys:</h3>
  1638. <ul>
  1639. <li><strong>[B]</strong> - Toggle AimBot</li>
  1640. <li><strong>[Z]</strong> - Toggle Zoom</li>
  1641. <li><strong>[M]</strong> - Toggle Melee Attack</li>
  1642. <li><strong>[Y]</strong> - Toggle SpinBot</li>
  1643. <li><strong>[T]</strong> - Focus on enemy</li>
  1644. </ul>
  1645.  
  1646. <h3>Features:</h3>
  1647. <ul>
  1648. <li>By clicking the middle mouse button, you can add a player to friends. AimBot will not target them, green lines will go to them, and their name will turn green.</li>
  1649. <li><strong>AutoMelee:</strong> If the enemy is close enough (4 game coordinates), AutoMelee will automatically move towards and attack them when holding down the left mouse button. If you equip a melee weapon, AutoMelee will work at a distance of 8 game coordinates.</li>
  1650. <li><strong>AutoSwitch:</strong> Quickly switch weapons to avoid cooldown after shooting.</li>
  1651. <li><strong>BumpFire:</strong> Shoot without constant clicking.</li>
  1652. <li>Some ESP features can be disabled by changing their values in the code:
  1653. <pre>let laserDrawerEnabled = true;
  1654. let lineDrawerEnabled = true;
  1655. let nadeDrawerEnabled = true;
  1656. </pre>
  1657. Set them to <code>false</code> to disable.
  1658. </li>
  1659. <li>AimBot activates when holding down the left mouse button.</li>
  1660. <li><strong>FocusedEnemy:</strong> Press <strong>[T]</strong> to focus on an enemy. AimBot will continuously target the focused enemy. Press <strong>[T]</strong> again to reset.</li>
  1661. </ul>
  1662.  
  1663. <h3>Recommendations:</h3>
  1664. <ul>
  1665. <li>Play smart and don't rush headlong, as the cheat does not provide immortality.</li>
  1666. <li>Use adrenaline to the max to heal and run fast.</li>
  1667. <li>The map is color-coded: white circle - Mosin, gold container - SV98, etc.</li>
  1668. </ul>
  1669.  
  1670. <p class="news-paragraph">For more details, visit the <a href="https://github.com/Drino955/survev-krityhack">GitHub page</a> and join our <a href="https://t.me/krityteam">Telegram group</a> or <a href="https://discord.gg/wPuvEySg3E">Discord</a>.</p></div>`;
  1671. }
  1672.  
  1673. toggleMenuVisibility() {
  1674. const isVisible = this.menu.style.display !== "none";
  1675. this.menu.style.display = isVisible ? "none" : "block";
  1676. }
  1677.  
  1678. startUpdateLoop() {
  1679. const now = performance.now();
  1680. const delta = now - this.lastFrameTime;
  1681.  
  1682. this.frameCount++;
  1683.  
  1684. if (delta >= 1000) {
  1685. this.fps = Math.round((this.frameCount * 1000) / delta);
  1686. this.frameCount = 0;
  1687. this.lastFrameTime = now;
  1688.  
  1689. this.kills = this.getKills();
  1690.  
  1691. if (this.isFpsVisible && this.fpsCounter) {
  1692. this.fpsCounter.textContent = `FPS: ${this.fps}`;
  1693. }
  1694.  
  1695. if (this.isKillsVisible && this.killsCounter) {
  1696. this.killsCounter.textContent = `Kills: ${this.kills}`;
  1697. }
  1698.  
  1699. if (this.isPingVisible && this.pingCounter && this.pingTest) {
  1700. const result = this.pingTest.getPingResult();
  1701. this.pingCounter.textContent = `PING: ${result.ping} ms`;
  1702. }
  1703. }
  1704.  
  1705. this.startPingTest();
  1706. this.animationFrameCallback(() => this.startUpdateLoop());
  1707. this.updateUiElements();
  1708. this.updateCleanMode();
  1709. this.updateBoostBars();
  1710. this.updateHealthBars();
  1711. }
  1712. }
  1713.  
  1714. window.PingTest = class PingTest {
  1715. constructor(selectedServer) {
  1716. this.ptcDataBuf = new ArrayBuffer(1);
  1717. this.test = {
  1718. region: selectedServer.region,
  1719. url: `wss://${selectedServer.url}/ptc`,
  1720. ping: 9999,
  1721. ws: null,
  1722. sendTime: 0,
  1723. retryCount: 0,
  1724. };
  1725. }
  1726.  
  1727. startPingTest() {
  1728. if (!this.test.ws) {
  1729. const ws = new WebSocket(this.test.url);
  1730. ws.binaryType = "arraybuffer";
  1731.  
  1732. ws.onopen = () => {
  1733. this.sendPing();
  1734. this.test.retryCount = 0;
  1735. };
  1736.  
  1737. ws.onmessage = () => {
  1738. const elapsed = (Date.now() - this.test.sendTime) / 1e3;
  1739. this.test.ping = Math.round(elapsed * 1000);
  1740. this.test.retryCount = 0;
  1741. setTimeout(() => this.sendPing(), 200);
  1742. };
  1743.  
  1744. ws.onerror = () => {
  1745. this.test.ping = "Error";
  1746. this.test.retryCount++;
  1747. if (this.test.retryCount < 5) {
  1748. setTimeout(() => this.startPingTest(), 2000);
  1749. } else {
  1750. this.test.ws.close();
  1751. this.test.ws = null;
  1752. }
  1753. };
  1754.  
  1755. ws.onclose = () => {
  1756. this.test.ws = null;
  1757. };
  1758.  
  1759. this.test.ws = ws;
  1760. }
  1761. }
  1762.  
  1763. sendPing() {
  1764. if (this.test.ws.readyState === WebSocket.OPEN) {
  1765. this.test.sendTime = Date.now();
  1766. this.test.ws.send(this.ptcDataBuf);
  1767. }
  1768. }
  1769.  
  1770. getPingResult() {
  1771. return {
  1772. region: this.test.region,
  1773. ping: this.test.ping,
  1774. };
  1775. }
  1776. }
  1777.  
  1778.  
  1779. console.log('Script injected')