Survev-KrityHack

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

目前为 2025-01-13 提交的版本,查看 最新版本

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