BadHack

very bad

当前为 2022-04-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name BadHack
  3. // @namespace https://tampermonkey.net/
  4. // @version 3.9.3
  5. // @description very bad
  6. // @author vn_Havy
  7. // @match http://zombs.io/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
  9. // ==/UserScript==
  10.  
  11. document.querySelectorAll('.ad-unit, .ad-unit-medrec, .hud-intro-guide-hints, .hud-intro-left, .hud-intro-youtuber, .hud-intro-footer, .hud-intro-stone, .hud-intro-tree, .hud-intro-social, .hud-intro-more-games, .hud-intro-guide, .hud-day-night-overlay, .hud-respawn-share, .hud-party-joining, .hud-respawn-corner-bottom-left').forEach(el => el.remove());
  12. document.getElementsByClassName('hud-intro-name')[0].setAttribute('maxlength', 29);
  13. document.getElementsByClassName('hud-party-tag')[0].setAttribute('maxlength', 49);
  14.  
  15. game.renderer.ground.setVisible(false) //(true) for ground
  16. game.renderer.projectiles.setVisible(false) //(true) for projectiles
  17.  
  18. document.getElementsByClassName("hud-top-center")[0].innerHTML = `
  19. <a id="shopshortcut1"><img src="http://zombs.io/asset/image/ui/inventory/inventory-pickaxe-t7.svg"></a>
  20. <a id="shopshortcut2"><img src="http://zombs.io/asset/image/ui/inventory/inventory-spear-t7.svg"></a>
  21. <a id="shopshortcut3"><img src="http://zombs.io/asset/image/ui/inventory/inventory-bow-t7.svg"></a>
  22. <a id="shopshortcut4"><img src="http://zombs.io/asset/image/ui/inventory/inventory-bomb-t7.svg"></a>
  23. <a id="shopshortcut5"><img src="http://zombs.io/asset/image/ui/inventory/inventory-health-potion.svg"></a>
  24. <a id="shopshortcut6"><img src="http://zombs.io/asset/image/ui/inventory/inventory-pet-health-potion.svg"></a>
  25. <a id="shopshortcut7"><img src="http://zombs.io/asset/image/ui/inventory/inventory-shield-t10.svg"></a>
  26. <a id="shopshortcut8"><img src="http://zombs.io/asset/image/ui/inventory/inventory-pet-ghost-t1.svg"></a>
  27. <a id="shopshortcut9"><img src="http://zombs.io/asset/image/ui/inventory/inventory-pet-ghost-t1.svg"></a>
  28. <a id="shopshortcut10"><img src="http://zombs.io/asset/image/ui/inventory/inventory-pet-miner-t8.svg"></a>
  29. <a id="shopshortcut11"><img src="http://zombs.io/asset/image/ui/inventory/inventory-pet-carl-t8.svg"></a>
  30. `;
  31.  
  32. document.getElementById('shopshortcut1').addEventListener('click', buyPickaxe);
  33. document.getElementById('shopshortcut2').addEventListener('click', buySpear);
  34. document.getElementById('shopshortcut3').addEventListener('click', buyBow);
  35. document.getElementById('shopshortcut4').addEventListener('click', buyBomb);
  36. document.getElementById('shopshortcut5').addEventListener('click', () => {shopShortcut("HealthPotion", 1)});
  37. document.getElementById('shopshortcut6').addEventListener('click', () => {shopShortcut("PetHealthPotion", 1)});
  38. document.getElementById('shopshortcut7').addEventListener('click', buyZombieShield);
  39. document.getElementById('shopshortcut8').addEventListener('click', () => {shopShortcut("PetRevive", 1)});
  40. document.getElementById('shopshortcut9').addEventListener('click', () => {Game.currentGame.network.sendRpc({name: "DeleteBuilding", uid: game.ui.getPlayerPetUid()})});
  41. document.getElementById('shopshortcut10').addEventListener('click', () => {buyPet("PetMiner", getPetTier(6))});
  42. document.getElementById('shopshortcut11').addEventListener('click', () => {buyPet("PetCARL", getPetTier(5))});
  43.  
  44. function buyPet(item, tier) {
  45. if (game.ui.getPlayerPetName() == item) {
  46. shopShortcut("PetRevive", 1)
  47. } else {
  48. let i = 0
  49. let j = setInterval(function() {
  50. console.log(i)
  51. shopShortcut(item, tier)
  52. i++
  53. if (i >= 25 || game.ui.getPlayerPetName() == item) {
  54. i = 0
  55. clearInterval(j)
  56. }
  57. },250);
  58. }
  59. }
  60.  
  61. function getPetTier(num) {
  62. if (document.querySelectorAll(".hud-shop-item-tier")[5].childNodes[0].textContent.match(/\d+/) != null) {
  63. let petLevel = document.querySelectorAll(".hud-shop-item-tier")[num].childNodes[0].textContent.match(/\d+/)[0]
  64. if (petLevel <= 8) return 1
  65. if (petLevel <= 16) return 2
  66. if (petLevel <= 24) return 3
  67. if (petLevel <= 32) return 4
  68. if (petLevel <= 48) return 5
  69. if (petLevel <= 64) return 6
  70. if (petLevel <= 96) return 7
  71. if (petLevel > 96) return 8
  72. } else return 8
  73. }
  74.  
  75. function equipItem(item, tier) {
  76. game.network.sendRpc({
  77. name: "EquipItem",
  78. itemName: item,
  79. tier: tier
  80. })
  81. };
  82.  
  83. function buyItem(item, tier) {
  84. game.network.sendRpc({
  85. name: "BuyItem",
  86. itemName: item,
  87. tier: tier
  88. })
  89. }
  90.  
  91. function shopShortcut(item, tier) {
  92. buyItem(item, tier)
  93. if (game.ui.playerWeaponName !== item) {
  94. equipItem(item, tier)
  95. }
  96. }
  97.  
  98.  
  99.  
  100. function buyPickaxe() {
  101. let gold = game.ui.playerTick.gold
  102. let pickaxe = game.ui.inventory.Pickaxe
  103. if (pickaxe.tier == 1 && gold >= 1000) {
  104. shopShortcut("Pickaxe", 2)
  105. return
  106. }
  107. if (pickaxe.tier == 2 && gold >= 3000) {
  108. shopShortcut("Pickaxe", 3);
  109. return
  110. }
  111. if (pickaxe.tier == 3 && gold >= 5000) {
  112. shopShortcut("Pickaxe", 4);
  113. return
  114. }
  115. if (pickaxe.tier == 4 && gold >= 8000) {
  116. shopShortcut("Pickaxe", 5);
  117. return
  118. }
  119. if (pickaxe.tier == 5 && gold >= 24000) {
  120. shopShortcut("Pickaxe", 6);
  121. return
  122. }
  123. if (pickaxe.tier == 6 && gold >= 90000) {
  124. shopShortcut("Pickaxe", 7);
  125. return
  126. } else if (game.ui.playerWeaponName !== "Pickaxe") {
  127. equipItem("Pickaxe", game.ui.inventory.Pickaxe.tier)
  128. }
  129. }
  130.  
  131. function buySpear() {
  132. let gold = game.ui.playerTick.gold
  133. let spear = game.ui.inventory.Spear
  134. if (!spear && gold >= 1400) {
  135. shopShortcut("Spear", 1)
  136. return
  137. }
  138. if (spear.tier == 1 && gold >= 2800) {
  139. shopShortcut("Spear", 2)
  140. return
  141. }
  142. if (spear.tier == 2 && gold >= 5600) {
  143. shopShortcut("Spear", 3)
  144. return
  145. }
  146. if (spear.tier == 3 && gold >= 11200) {
  147. shopShortcut("Spear", 4)
  148. return
  149. }
  150. if (spear.tier == 4 && gold >= 22500) {
  151. shopShortcut("Spear", 5)
  152. return
  153. }
  154. if (spear.tier == 5 && gold >= 45000) {
  155. shopShortcut("Spear", 6)
  156. return
  157. }
  158. if (spear.tier == 6 && gold >= 90000) {
  159. shopShortcut("Spear", 7)
  160. return
  161. } else if (game.ui.playerWeaponName !== "Spear"){
  162. equipItem("Spear", game.ui.inventory.Spear.tier)
  163. }
  164. }
  165.  
  166. function buyBow() {
  167. let gold = game.ui.playerTick.gold
  168. let bow = game.ui.inventory.Bow
  169. if (!bow && gold >= 100) {
  170. shopShortcut("Bow", 1)
  171. return
  172. }
  173. if (bow.tier == 1 && gold >= 400) {
  174. shopShortcut("Bow", 2)
  175. return
  176. }
  177. if (bow.tier == 2 && gold >= 2000) {
  178. shopShortcut("Bow", 3)
  179. return
  180. }
  181. if (bow.tier == 3 && gold >= 7000) {
  182. shopShortcut("Bow", 4)
  183. return
  184. }
  185. if (bow.tier == 4 && gold >= 24000) {
  186. shopShortcut("Bow", 5)
  187. return
  188. }
  189. if (bow.tier == 5 && gold >= 30000) {
  190. shopShortcut("Bow", 6)
  191. return
  192. }
  193. if (bow.tier == 6 && gold >= 90000) {
  194. shopShortcut("Bow", 7)
  195. return
  196. } else if (game.ui.playerWeaponName !== "Bow"){
  197. equipItem("Bow", game.ui.inventory.Bow.tier)
  198. }
  199. }
  200.  
  201. function buyBomb() {
  202. let gold = game.ui.playerTick.gold
  203. let bomb = game.ui.inventory.Bomb
  204. if (!bomb && gold >= 100) {
  205. shopShortcut("Bomb", 1)
  206. return
  207. }
  208. if (bomb.tier == 1 && gold >= 400) {
  209. shopShortcut("Bomb", 2)
  210. return
  211. }
  212. if (bomb.tier == 2 && gold >= 3000) {
  213. shopShortcut("Bomb", 3)
  214. return
  215. }
  216. if (bomb.tier == 3 && gold >= 5000) {
  217. shopShortcut("Bomb", 4)
  218. return
  219. }
  220. if (bomb.tier == 4 && gold >= 24000) {
  221. shopShortcut("Bomb", 5)
  222. return
  223. }
  224. if (bomb.tier == 5 && gold >= 50000) {
  225. shopShortcut("Bomb", 6)
  226. return
  227. }
  228. if (bomb.tier == 6 && gold >= 90000) {
  229. shopShortcut("Bomb", 7)
  230. return
  231. } else if (game.ui.playerWeaponName !== "Bomb"){
  232. equipItem("Bomb", game.ui.inventory.Bomb.tier)
  233. }
  234. }
  235.  
  236. function buyZombieShield() {
  237. let gold = game.ui.playerTick.gold
  238. let shield = game.ui.inventory.ZombieShield
  239. if (!shield && gold >= 1000) {
  240. buyItem("ZombieShield", 1)
  241. return
  242. }
  243. if (shield.tier == 1 && gold >= 3000) {
  244. buyItem("ZombieShield", 2)
  245. return
  246. }
  247. if (shield.tier == 2 && gold >= 7000) {
  248. buyItem("ZombieShield", 3)
  249. return
  250. }
  251. if (shield.tier == 3 && gold >= 14000) {
  252. buyItem("ZombieShield", 4)
  253. return
  254. }
  255. if (shield.tier == 4 && gold >= 18000) {
  256. buyItem("ZombieShield", 5)
  257. return
  258. }
  259. if (shield.tier == 5 && gold >= 22000) {
  260. buyItem("ZombieShield", 6)
  261. return
  262. }
  263. if (shield.tier == 6 && gold >= 24000) {
  264. buyItem("ZombieShield", 7)
  265. return
  266. }
  267. if (shield.tier == 7 && gold >= 30000) {
  268. buyItem("ZombieShield", 8)
  269. return
  270. }
  271. if (shield.tier == 8 && gold >= 45000) {
  272. buyItem("ZombieShield", 9)
  273. return
  274. }
  275. if (shield.tier == 9 && gold >= 70000) {
  276. buyItem("ZombieShield", 10)
  277. return
  278. }
  279. }
  280.  
  281. let mapTimeouts = [];
  282.  
  283. function createCoordinates() {
  284. let x = document.createElement('div')
  285. x.style = 'position: relative;top: 17px;right: 0px;font-weight: 600;font-family: "Hammersmith One";text-shadow: 1px 0 0 #fff, -1px 0 0 #fff, 0 1px 0 #fff, 0 -1px 0 #fff, 0.5px 0.5px #fff, -0.5px -0.5px 0 #fff, 0.5px -0.5px 0 #fff, -0.5px 0.5px 0 #fff;';
  286. x.innerHTML = `<p id="coords";">X: 0, Y: 0</p>`
  287. x.style.textAlign = "center"
  288. document.querySelector("#hud > div.hud-bottom-left").append(x)
  289. }
  290.  
  291. let mapMouseX;
  292. let mapMouseY;
  293. let hasBeenInWorld = false;
  294.  
  295. game.network.addEnterWorldHandler(function () {
  296. if(!hasBeenInWorld) {
  297. hasBeenInWorld = true
  298. setInterval(() => {
  299. document.querySelector("#coords")
  300. .innerText = `X: ${game.world.localPlayer.entity.targetTick.position.x}, Y: ${game.world.localPlayer.entity.targetTick.position.y}`
  301. }, 16)
  302. createCoordinates()
  303. }
  304. setTimeout(() => {
  305. document.querySelectorAll(".hud-shop-item-social")[0].childNodes[1].href = "javascript:void(0)"
  306. document.querySelectorAll(".hud-shop-item-social")[0].childNodes[1].removeAttribute('target')
  307. setTimeout(() => {
  308. document.querySelectorAll(".hud-shop-social-twitter.is-disabled")[0].click()
  309. },2000)
  310. }, 4000);
  311. })
  312.  
  313. var mousemove;
  314. addEventListener('mousemove', (e) => {
  315. mousemove = e;
  316. })
  317.  
  318. var isSpamming = 0;
  319.  
  320. function pauseChatSpam(e) {
  321. if (!isSpamming) {
  322. window.spammer = setInterval(() => {
  323. game.network.sendRpc({
  324. name: "SendChatMessage",
  325. channel: "Local",
  326. message: e
  327. })
  328. }, 100)
  329. } else if (isSpamming) {
  330. clearInterval(window.spammer)
  331. }
  332. isSpamming = !isSpamming
  333. }
  334.  
  335. var autoRespawn = false
  336.  
  337. game.network.addRpcHandler('ReceiveChatMessage', function(e) {
  338. if(e.uid == game.ui.playerTick.uid) {
  339. if(e.message == "!boss") {
  340. setTimeout(() => {
  341. game.network.sendRpc({
  342. name: "SendChatMessage",
  343. message: "9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 121",
  344. channel: "Local"
  345. });
  346. }, 1000);
  347. };
  348. if(e.message == "!marker") {
  349. var map = document.getElementById("hud-map");
  350. map.insertAdjacentHTML("beforeend", `<div style="color: red; display: block; left: ${parseInt(game.ui.components.Map.playerElems[game.world.getMyUid()].marker.style.left)}%; top: ${parseInt(game.ui.components.Map.playerElems[game.world.getMyUid()].marker.style.top)}%; position: absolute;" class='hud-map-player'></div>`)
  351. game.ui.components.PopupOverlay.showHint(`Added Marker`);
  352. };
  353. };
  354. });
  355.  
  356. function getEntitiesByModel(type) {
  357. let entities = []
  358. Object.entries(game.world.entities)
  359. .forEach((item => {
  360. if (item[1].targetTick.model == type) {
  361. entities.push(item)
  362. }
  363. }))
  364. return entities;
  365. }
  366.  
  367. function moveUp() {
  368. game.inputPacketScheduler.scheduleInput({
  369. down: 0,
  370. up: 1
  371. })
  372. }
  373.  
  374. function moveDown() {
  375. game.inputPacketScheduler.scheduleInput({
  376. up: 0,
  377. down: 1
  378. })
  379. }
  380.  
  381. function moveLeft() {
  382. game.inputPacketScheduler.scheduleInput({
  383. right: 0,
  384. left: 1
  385. })
  386. }
  387.  
  388. function moveRight() {
  389. game.inputPacketScheduler.scheduleInput({
  390. left: 0,
  391. right: 1
  392. })
  393. }
  394. var danceCounter = 0
  395. var danceRandom = true
  396. var botMode = false
  397. var danceInterval = setInterval(() => {
  398. if (botMode) {
  399. if (danceCounter < moves.length) {
  400. moves[danceCounter]()
  401. if (danceRandom) {
  402. danceCounter = Math.floor(Math.random() * moves.length)
  403. } else {
  404. danceCounter++
  405. }
  406. } else {
  407. danceCounter = 0;
  408. }
  409. }
  410. }, 500)
  411. var respawnInterval = setInterval(() => {
  412. if (document.querySelector('.hud-respawn').style.display == "block" && autoRespawn) {
  413. document.querySelector('.hud-respawn-btn').click()
  414. }
  415. }, 10)
  416. var moves = [moveUp, moveRight, moveDown, moveLeft]
  417.  
  418. window.useSamePI = false
  419. addEventListener('keyup', function (e) {
  420. if (e.key == "`" && !_isInChatbox) {
  421. game.inputManager.onKeyRelease({
  422. keyCode: 117
  423. })
  424. }
  425. })
  426.  
  427. window.showpriv = true
  428. if (game.world.inWorld === false) {
  429. game.network.addPreEnterWorldHandler(() => {
  430. setInterval(() => {
  431. document.getElementsByClassName('hud-party-grid')[0].innerHTML = '';
  432.  
  433. function checkStatus(party) {
  434. if (window.showpriv == true) {
  435. if(party.isOpen == 1) {
  436. return '<a style = "color: #00e700;opacity: 0.8;">[Open]<a/>';
  437. } else if(!party.isOpen == 1) {
  438. return '<a style = "color:red;opacity: 0.8;">[Private]<a/>';
  439. }
  440. } else {
  441. return '';
  442. }
  443. };
  444.  
  445.  
  446. let all_parties = game.ui.parties;
  447.  
  448. for(let i in all_parties) {
  449. let parties = all_parties[i];
  450. let tab = document.createElement('div');
  451. tab.classList.add('hud-party-link');
  452. tab.classList.add('custom-party');
  453. tab.id = parties.partyId;
  454. tab.isPublic = parties.isOpen;
  455. tab.name = parties.partyName;
  456. tab.members = parties.memberCount;
  457. tab.innerHTML = `
  458. <strong>${parties.partyName} ${checkStatus(parties)}<strong/>
  459. <small>id: ${parties.partyId}</small> <span>${parties.memberCount}/4<span/>
  460. `;
  461.  
  462. if(parties.memberCount == 4) {
  463. tab.classList.add('is-disabled');
  464. } else {
  465. tab.style.display = 'block';
  466. }
  467. if(parties.partyName == document.getElementsByClassName('hud-party-tag')[0].value) {
  468. tab.classList.add('is-active');
  469. }
  470. if (parties.isOpen !== 1 && window.showpriv == false) {
  471. tab.style.display = 'none';
  472. }
  473. //function for requesting
  474. tab.addEventListener('click', function() {
  475. let isJoining = true;
  476. if(tab.isPublic == 1 && tab.members < 4) {
  477. isJoining = true;
  478. game.network.sendRpc({
  479. name: 'JoinParty',
  480. partyId: Math.floor(tab.id)
  481. });
  482. } else if(!tab.isPublic == 1) {
  483. isJoining = false;
  484. game.ui.components.PopupOverlay.showHint("You can't request private parties!");
  485. }
  486. });
  487. document.getElementsByClassName('hud-party-grid')[0].appendChild(tab);
  488. };
  489. },5000);
  490. });
  491. }
  492.  
  493. window.isInMenu = false;
  494.  
  495. function movePlayer(e) {
  496. if (!_isInChatbox) {
  497. switch (e.toLowerCase()
  498. .replaceAll(' ', '')) {
  499. case "a":
  500. Game.currentGame.network.sendInput({
  501. left: 1
  502. })
  503. break;
  504. case "d":
  505. Game.currentGame.network.sendInput({
  506. right: 1
  507. })
  508. break;
  509. case "w":
  510. Game.currentGame.network.sendInput({
  511. up: 1
  512. })
  513. break;
  514. case "s":
  515. Game.currentGame.network.sendInput({
  516. down: 1
  517. })
  518. break;
  519. }
  520. }
  521. }
  522.  
  523. function ahrc1() { // 1 ahrc (collect and refuel), used in lpinterval
  524. var entities = Game.currentGame.world.entities
  525. for (let uid in entities) {
  526. if (!entities.hasOwnProperty(uid)) continue;
  527. let obj = entities[uid];
  528. Game.currentGame.network.sendRpc({
  529. name: "CollectHarvester",
  530. uid: obj.fromTick.uid
  531. });
  532. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 1) {
  533. Game.currentGame.network.sendRpc({
  534. name: "AddDepositToHarvester",
  535. uid: obj.fromTick.uid,
  536. deposit: 0.07
  537. });
  538. }
  539. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 2) {
  540. Game.currentGame.network.sendRpc({
  541. name: "AddDepositToHarvester",
  542. uid: obj.fromTick.uid,
  543. deposit: 0.11
  544. });
  545. }
  546. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 3) {
  547. Game.currentGame.network.sendRpc({
  548. name: "AddDepositToHarvester",
  549. uid: obj.fromTick.uid,
  550. deposit: 0.17
  551. });
  552. }
  553. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 4) {
  554. Game.currentGame.network.sendRpc({
  555. name: "AddDepositToHarvester",
  556. uid: obj.fromTick.uid,
  557. deposit: 0.22
  558. });
  559. }
  560. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 5) {
  561. Game.currentGame.network.sendRpc({
  562. name: "AddDepositToHarvester",
  563. uid: obj.fromTick.uid,
  564. deposit: 0.25
  565. });
  566. }
  567. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 6) {
  568. Game.currentGame.network.sendRpc({
  569. name: "AddDepositToHarvester",
  570. uid: obj.fromTick.uid,
  571. deposit: 0.28
  572. });
  573. }
  574. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 7) {
  575. Game.currentGame.network.sendRpc({
  576. name: "AddDepositToHarvester",
  577. uid: obj.fromTick.uid,
  578. deposit: 0.42
  579. });
  580. }
  581. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 8) {
  582. Game.currentGame.network.sendRpc({
  583. name: "AddDepositToHarvester",
  584. uid: obj.fromTick.uid,
  585. deposit: 0.65
  586. });
  587. }
  588. }
  589. }
  590. var lpinterval = setInterval(function () { // loaded player info, ahrc, isInMenu, noob = chatbot
  591. document.querySelector('#lpi')
  592. .innerText = "Loaded Player Info: " + JSON.stringify(window.loadedIDS())
  593. if (window.ahrc) {
  594. ahrc1()
  595. }
  596. window.isInMenu = document.querySelector('#hud-menu-settings')
  597. .style.display == "block" ? true : false
  598. }, 250)
  599.  
  600. window.addEventListener("keyup", e => {
  601. switch (e.keyCode) {
  602. case 27:
  603. var mb = document.getElementsByClassName("hud")[0];
  604. if (mb.style.display === "none") {
  605. mb.style.display = "block";
  606. } else {
  607. mb.style.display = "none";
  608. }
  609. break;
  610. }
  611. })
  612.  
  613. let settingsHTML = `
  614. <button class="btn btn-purple ehack-btn" style="border-radius:25%" id="lagspam-btn">Enable Lag Spam</button>
  615. <button class="btn btn-purple ehack-btn" style="border-radius:25%" id="spamchatbtn">Split Chat</button>
  616. <button class="btn btn-purple ehack-btn" style="border-radius:25%" id="togglespmch">Enable Chat Spam</button>
  617. <input type="text" id="spamchat" placeholder="Message" class="btn btn-white ehack-btn" style="border-radius:25%; width: 39%">
  618. <hr>
  619. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="clearchat-btn">Enable Auto Clear Chat</button>
  620. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="autoupgradeall-btn">Enable Auto Upgrade</button>
  621. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="togglebot">Enable Bot</button>
  622. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="togglespinner">Enable Spinner (WIP)</button>
  623. <hr>
  624. <button class="btn btn-red ehack-btn ehack-btn" style="border-radius:25%" id="toggleahrc">Enable AHRC</button>
  625. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="toggleswing">Enable Auto Swing</button>
  626. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="toggleresp">Enable Auto Respawn</button>
  627. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="togglerb">Enable Auto Rebuild (WIP)</button>
  628. <hr>
  629. <button class="btn btn-white ehack-btn" style="border-radius:25%" onclick="Game.currentGame.network.disconnect()">Disconnect</button>
  630. <button class="btn btn-gold ehack-btn" style="border-radius:25%" id="menu-leaveparty-btn">Leave Party</button>
  631. <button class="btn btn-gold ehack-btn" style="border-radius:25%" id="menu-jpbsk-btn" onclick='Game.currentGame.network.sendRpc({name:"JoinPartyByShareKey", partyShareKey: document.querySelector("#menu-jpbsk-input").value})'>Join Party</button>
  632. <input type="text" class="btn btn-white ehack-btn" id="menu-jpbsk-input" style="border-radius:25%; width: 27%" placeholder="Share Key">
  633. <button class="btn btn-gold ehack-btn" style="border-radius:25%" id="autoaccept-btn">Enable Auto Accept</button>
  634. <hr>
  635. <button class="btn btn-gold ehack-btn" style="border-radius:25%" id="spamallparty-btn">Enable Spam All Party</button>
  636. <button class="btn btn-gold ehack-btn" style="border-radius:25%" id="spampartybyid-btn">Enable Spam Party By ID</button>
  637. <input type="text" class="btn btn-white ehack-btn" id="party-id-input" style="border-radius:25%; width: 23%" placeholder="Party ID">
  638. <hr>
  639. <button id="healplayer" class="btn btn-red ehack-btn" style="border-radius:25%">Disable Heal</button>
  640. <input type="text" class="btn btn-white ehack-btn" value="20" id="healplayerinput" style="border-radius:25%; width: 8%">
  641. <button id="healpet" class="btn btn-red ehack-btn" style="border-radius:25%">Disable Heal Pet</button>
  642. <input type="text" class="btn btn-white ehack-btn" value="30" id="healpetinput" style="border-radius:25%; width: 8%">
  643. <button id="revivepet" class="btn btn-red ehack-btn" style="border-radius:25%">Disable Revive</button>
  644. <button id="evolvepet" class="btn btn-red ehack-btn" style="border-radius:25%">Disable Evolve</button>
  645. <hr>
  646. <button id="sellall" class="btn btn-green ehack-btn" style="border-radius:25%">Sell All Towers</button>
  647. <button id="sellwall" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Wall</button>
  648. <button id="selldoor" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Door</button>
  649. <button id="selltrap" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Slow Trap</button>
  650. <button id="sellharvester" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Harvester</button>
  651. <hr>
  652. <button id="sellarrow" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Arrow</button>
  653. <button id="sellcannon" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Cannon</button>
  654. <button id="sellbomb" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Bomb</button>
  655. <button id="sellmelee" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Melee</button>
  656. <button id="sellmagic" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Mage</button>
  657. <button id="sellminer" class="btn btn-green ehack-btn" style="border-radius:25%">Sell Gold Miner</button>
  658. <hr>
  659. <button id="hchat-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide Chat</button>
  660. <button id="hpop-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide Popup</button>
  661. <button id="hldb-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide Leaderboard</button>
  662. <button id="hmap-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide Map</button>
  663. <button id="hss-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide SS</button>
  664. <hr>
  665. <p style="font-size:10px;">Advanced Player Info?</p><input type="checkbox" id="advancedlpi">
  666. <br>
  667. <p style="font-size:10px;">Zoom On Scroll?</p><input type="checkbox" id="zos">
  668. <br>
  669. <p id="lpi">Loaded Player Info: </p>
  670. <style>
  671. .menu-textbox{
  672. border-radius:25%;
  673. background-color: rgba(171, 183, 183, 0.25);
  674. border: 2px solid black;
  675. color:white;
  676. }
  677. .ehack-btn:hover{
  678. border: 1px solid grey;
  679. }
  680. </style>
  681. `
  682. document.getElementsByClassName("hud-settings-grid")[0].innerHTML = settingsHTML;
  683.  
  684. let cssMain = `
  685. #hud-menu-shop {
  686. top: 58%;
  687. left: 51%;
  688. width: 690px;
  689. height: 450px;
  690. margin: -350px 0 0 -350px;
  691. padding: 20px 20px 20px 20px;
  692. }
  693. .hud-menu-shop .hud-shop-grid {
  694. height: 330px;
  695. }
  696. #hud-menu-settings {
  697. top: 55%;
  698. left: 48%;
  699. width: 780px;
  700. height: 500px;
  701. margin: -350px 0 0 -350px;
  702. padding: 20px 20px 20px 20px;
  703. }
  704. .hud-menu-settings .hud-settings-grid {
  705. width: 750px;
  706. height: 420px;
  707.  
  708. `;
  709.  
  710. let stylesMain = document.createElement("style");
  711. stylesMain.appendChild(document.createTextNode(cssMain));
  712. document.head.appendChild(stylesMain);
  713. stylesMain.type = "text/css";
  714.  
  715. document.getElementById('lagspam-btn').addEventListener('click', lagSpam)
  716. document.getElementById('lagspam-btn').addEventListener('click', lagSpambtn)
  717. document.getElementById("spamallparty-btn").addEventListener("click", spamAllParty);
  718. document.getElementById("spamallparty-btn").addEventListener("click", spamAllPartybtn);
  719. document.getElementById("autoupgradeall-btn").addEventListener("click", autoUpgradeAll);
  720. document.getElementById("autoupgradeall-btn").addEventListener("click", autoUpgradeAllbtn);
  721. document.getElementById("spampartybyid-btn").addEventListener("click", spamPartyByID);
  722. document.getElementById("spampartybyid-btn").addEventListener("click", spamPartyByIDbtn);
  723. document.getElementById("autoaccept-btn").addEventListener("click", autoAcceptParty);
  724. document.getElementById("autoaccept-btn").addEventListener("click", autoAcceptPartybtn);
  725. document.getElementById("togglerb").addEventListener("click", toggleRB);
  726. document.getElementById("togglerb").addEventListener("click", toggleRBbtn);
  727. document.getElementById("healplayer").addEventListener("click", toggleHealPlayer);
  728. document.getElementById("healpet").addEventListener("click", toggleHealPet);
  729. document.getElementById("revivepet").addEventListener("click", toggleRevivePet);
  730. document.getElementById("evolvepet").addEventListener("click", toggleEvolvePet);
  731. document.getElementById("sellwall").addEventListener('click', () => { sellAllByType("Wall") });
  732. document.getElementById("selldoor").addEventListener('click', () => { sellAllByType("Door") });
  733. document.getElementById("selltrap").addEventListener('click', () => { sellAllByType("SlowTrap") });
  734. document.getElementById("sellarrow").addEventListener('click', () => { sellAllByType("ArrowTower") });
  735. document.getElementById("sellcannon").addEventListener('click', () => { sellAllByType("CannonTower") });
  736. document.getElementById("sellmelee").addEventListener('click', () => { sellAllByType("MeleeTower") });
  737. document.getElementById("sellbomb").addEventListener('click', () => { sellAllByType("BombTower") });
  738. document.getElementById("sellmagic").addEventListener('click', () => { sellAllByType("MagicTower") });
  739. document.getElementById("sellminer").addEventListener('click', () => { sellAllByType("GoldMine") });
  740. document.getElementById("sellharvester").addEventListener('click', () => { sellAllByType("Harvester") });
  741.  
  742. document.querySelector('#clearchat-btn').addEventListener('click', clearChat)
  743. document.querySelector('#clearchat-btn').addEventListener('click', clearChatbtn)
  744. document.querySelector('#toggleswing').addEventListener('click', autoSwing)
  745. document.querySelector('#hchat-btn').addEventListener('click', hideChat)
  746. document.querySelector('#hpop-btn').addEventListener('click', hidePopupOverlay)
  747. document.querySelector('#hldb-btn').addEventListener('click', hideLeaderboard)
  748. document.querySelector('#hmap-btn').addEventListener('click', hideMap)
  749. document.querySelector('#hss-btn').addEventListener('click', hideShopShortcut)
  750. document.querySelector('#menu-leaveparty-btn').addEventListener('click', onLeaveParty)
  751. document.querySelector('#spamchatbtn').addEventListener('click', spamchatclick)
  752.  
  753.  
  754. function sellAllByType(type) {
  755. if (!game.ui.playerPartyCanSell) return;
  756.  
  757. let sellInterval = () => {
  758. let target = Object.values(game.ui.buildings).find(e => e.type == type);
  759. if (target !== undefined) {
  760. Game.currentGame.network.sendRpc({name: "DeleteBuilding", uid: target.uid});
  761. setTimeout(() => { sellInterval(); }, 100);
  762. }
  763. }
  764. sellInterval();
  765. };
  766.  
  767. document.getElementById("sellall").addEventListener('click', function() {
  768. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete all towers?", 1e4, function() {
  769. let sellInterval = () => {
  770. if (Object.keys(game.ui.buildings).length > 1 && game.ui.playerPartyCanSell) {
  771. Game.currentGame.network.sendRpc({name: "DeleteBuilding", uid: parseInt(Object.keys(game.ui.buildings)[1])});
  772. setTimeout(() => { sellInterval(); }, 100);
  773. }
  774. }
  775. sellInterval();
  776. })
  777. })
  778.  
  779. function onLeaveParty() {
  780. Game.currentGame.network.sendRpc({
  781. name: "LeaveParty"
  782. })
  783. }
  784.  
  785. function hidePopupOverlay() {
  786. if (document.getElementById("hud-popup-overlay").style.display === "none" && document.getElementById("hpop-btn").innerHTML == "Show Popup") {
  787. document.getElementById("hud-popup-overlay").style.display = "block";
  788. document.getElementById("hpop-btn").innerHTML = "Hide Popup";
  789. } else {
  790. document.getElementById("hud-popup-overlay").style.display = "none";
  791. document.getElementById("hpop-btn").innerHTML = "Show Popup";
  792. }
  793. }
  794.  
  795. function hideLeaderboard() {
  796. if (document.getElementById("hud-leaderboard").style.display === "none" && document.getElementById("hldb-btn").innerHTML == "Show Leaderboard") {
  797. document.getElementById("hud-leaderboard").style.display = "block";
  798. document.getElementById("hldb-btn").innerHTML = "Hide Leaderboard";
  799. } else {
  800. document.getElementById("hud-leaderboard").style.display = "none";
  801. document.getElementById("hldb-btn").innerHTML = "Show Leaderboard";
  802. }
  803. }
  804.  
  805.  
  806. function hideMap() {
  807. if (document.getElementsByClassName("hud-bottom-left")[0].style.display === "none" && document.getElementById("hmap-btn").innerHTML == "Show Map") {
  808. document.getElementsByClassName("hud-bottom-left")[0].style.display = "block";
  809. document.getElementById("hmap-btn").innerHTML = "Hide Map";
  810. } else {
  811. document.getElementsByClassName("hud-bottom-left")[0].style.display = "none";
  812. document.getElementById("hmap-btn").innerHTML = "Show Map";
  813. }
  814. }
  815.  
  816. function hideChat() {
  817. if (document.getElementsByClassName("hud-top-left")[0].style.display === "none" && document.getElementById("hchat-btn").innerHTML == "Show Chat"){
  818. document.getElementsByClassName("hud-top-left")[0].style.display = "block";
  819. document.getElementById("hchat-btn").innerHTML = "Hide Chat";
  820. } else {
  821. document.getElementsByClassName("hud-top-left")[0].style.display = "none";
  822. document.getElementById("hchat-btn").innerHTML = "Show Chat";
  823. }
  824. }
  825.  
  826. function hideShopShortcut() {
  827. if (document.getElementsByClassName("hud-top-center")[0].style.display === "none" && document.getElementById("hss-btn").innerHTML == "Show SS"){
  828. document.getElementsByClassName("hud-top-center")[0].style.display = "block";
  829. document.getElementById("hss-btn").innerHTML = "Hide SS";
  830. } else {
  831. document.getElementsByClassName("hud-top-center")[0].style.display = "none";
  832. document.getElementById("hss-btn").innerHTML = "Show SS";
  833. }
  834. }
  835.  
  836. function lagSpambtn() {
  837. if (document.getElementById("lagspam-btn").innerHTML == "Disable Lag Spam") {
  838. document.getElementById("lagspam-btn").innerHTML = "Enable Lag Spam";
  839. } else {
  840. document.getElementById("lagspam-btn").innerHTML = "Disable Lag Spam";
  841. }
  842. }
  843. let availableCharacters = ""
  844. let textLength = 70;
  845. fetch('https://raw.githubusercontent.com/bits/UTF-8-Unicode-Test-Documents/master/UTF-8_sequence_unseparated/utf8_sequence_0-0xffff_assigned_printable_unseparated.txt')
  846. .then(response => response.text())
  847. .then(data => {
  848. availableCharacters = data;
  849. });
  850.  
  851. var chatSpam = null;
  852. function lagSpam() {
  853. clearInterval(chatSpam);
  854. if (chatSpam !== null) {
  855. chatSpam = null;
  856. } else {
  857. chatSpam = setInterval(function() {
  858. let text = ""
  859. for (let i = 0; i < textLength; i++) text += availableCharacters[Math.floor(Math.random() * availableCharacters.length)];
  860. game.network.sendRpc({
  861. name: "SendChatMessage",
  862. channel: "Local",
  863. message: text
  864. });
  865. },1050);
  866. };
  867. };
  868.  
  869. function spamAllPartybtn() {
  870. if (document.getElementById("spamallparty-btn").innerHTML == "Disable Spam All Party") {
  871. document.getElementById("spamallparty-btn").innerHTML = "Enable Spam All Party";
  872. } else {
  873. document.getElementById("spamallparty-btn").innerHTML = "Disable Spam All Party";
  874. }
  875. }
  876. var partyspam = null;
  877. function spamAllParty() {
  878. clearInterval(partyspam);
  879. if (partyspam !== null) {
  880. partyspam = null;
  881. } else {
  882. partyspam = setInterval(function() {
  883. var party = document.getElementsByClassName('hud-party-link');
  884. for (var i = 0; i < party.length; i++) {
  885. var link = party[i];
  886. link.click();
  887. }
  888. var confirm = document.getElementsByClassName("btn btn-green hud-confirmation-accept");
  889. for (var j = 0; j < confirm.length; j++) {
  890. var accept = confirm[j];
  891. accept.click();
  892. }
  893. },10);
  894. }
  895. }
  896.  
  897. function autoAcceptPartybtn() {
  898. if (document.getElementById("autoaccept-btn").innerHTML == "Disable Auto Accept") {
  899. document.getElementById("autoaccept-btn").innerHTML = "Enable Auto Accept";
  900. } else {
  901. document.getElementById("autoaccept-btn").innerHTML = "Disable Auto Accept";
  902. }
  903. }
  904. var acceptparty = null;
  905. function autoAcceptParty() {
  906. clearInterval(acceptparty);
  907. if (acceptparty !== null) {
  908. acceptparty = null;
  909. } else {
  910. acceptparty = setInterval(function() {
  911. var confirm = document.getElementsByClassName("btn btn-green hud-confirmation-accept");
  912. for (var j = 0; j < confirm.length; j++) {
  913. confirm[j].click();
  914. }
  915. },10);
  916. }
  917. }
  918.  
  919. function autoUpgradeAllbtn() {
  920. if (document.getElementById("autoupgradeall-btn").innerHTML == "Disable Auto Upgrade") {
  921. document.getElementById("autoupgradeall-btn").innerHTML = "Enable Auto Upgrade";
  922. } else {
  923. document.getElementById("autoupgradeall-btn").innerHTML = "Disable Auto Upgrade";
  924. }
  925. }
  926. var autoupgradeall = null;
  927. function autoUpgradeAll() {
  928. clearInterval(autoupgradeall);
  929. if (autoupgradeall !== null) {
  930. autoupgradeall = null;
  931. } else {
  932. autoupgradeall = setInterval(function() {
  933. var entities = Game.currentGame.world.entities;
  934. for (var uid in entities) {
  935. if (!entities.hasOwnProperty(uid)) continue;
  936. var obj = entities[uid];
  937. Game.currentGame.network.sendRpc({
  938. name: "UpgradeBuilding",
  939. uid: obj.fromTick.uid
  940. })
  941. }
  942. },1000)
  943. }
  944. }
  945.  
  946. function spamPartyByIDbtn() {
  947. if (document.getElementById("spampartybyid-btn").innerHTML == "Disable Spam Party By ID") {
  948. document.getElementById("spampartybyid-btn").innerHTML = "Enable Spam Party By ID";
  949. } else {
  950. document.getElementById("spampartybyid-btn").innerHTML = "Disable Spam Party By ID";
  951. }
  952. }
  953. var spampartyid = null;
  954. function spamPartyByID() {
  955. clearInterval(spampartyid);
  956. if (spampartyid !== null) {
  957. spampartyid = null;
  958. } else {
  959. spampartyid = setInterval(function() {
  960. game.network.sendRpc({
  961. name: "JoinParty",
  962. partyId: parseInt(document.querySelector("#party-id-input").value)
  963. })
  964. },0)
  965. }
  966. }
  967.  
  968. function clearChatbtn() {
  969. if (document.getElementById("clearchat-btn").innerHTML == "Disable Auto Clear Chat") {
  970. document.getElementById("clearchat-btn").innerHTML = "Enable Auto Clear Chat";
  971. } else {
  972. document.getElementById("clearchat-btn").innerHTML = "Disable Auto Clear Chat";
  973. }
  974. }
  975. var shouldClearChat = null;
  976. function clearChat() {
  977. clearInterval(shouldClearChat);
  978. if (shouldClearChat !== null) {
  979. shouldClearChat = null;
  980. } else {
  981. shouldClearChat = setInterval(function () {
  982. document.querySelector('.hud-chat-messages').innerHTML = ""
  983. },500)
  984. }
  985. }
  986.  
  987. let shouldRebuild
  988. let rebuildData = [];
  989. let rebuiltTowers = [];
  990. function toggleRBbtn() {
  991. if (document.getElementById("togglerb").innerHTML == "Disable Auto Rebuild") {
  992. document.getElementById("togglerb").innerHTML = "Enable Auto Rebuild";
  993. shouldRebuild = false
  994. } else {
  995. document.getElementById("togglerb").innerHTML = "Disable Auto Rebuild";
  996. shouldRebuild = true
  997. }
  998. }
  999. function toggleRB() {}
  1000.  
  1001.  
  1002. function toggleHealPet () {
  1003. if (!shouldAutoHealPet) {
  1004. shouldAutoHealPet = true;
  1005. document.getElementById("healpet").innerHTML = "Disable Heal Pet";
  1006. } else {
  1007. shouldAutoHealPet = false;
  1008. document.getElementById("healpet").innerHTML = "Enable Heal Pet";
  1009. }
  1010. }
  1011. function toggleRevivePet () {
  1012. if (!shouldAutoRevivePet) {
  1013. shouldAutoRevivePet = true
  1014. document.getElementById("revivepet").innerHTML = "Disable Revive";
  1015. } else {
  1016. shouldAutoRevivePet = false
  1017. document.getElementById("revivepet").innerHTML = "Enable Revive";
  1018. }
  1019. }
  1020. function toggleEvolvePet () {
  1021. if (!shouldAutoEvolvePet) {
  1022. shouldAutoEvolvePet = true
  1023. document.getElementById("evolvepet").innerHTML = "Disable Evolve";
  1024. } else {
  1025. shouldAutoEvolvePet = false
  1026. document.getElementById("evolvepet").innerHTML = "Enable Evolve";
  1027. }
  1028. }
  1029. function toggleHealPlayer () {
  1030. if (!shouldAutoHealPlayer) {
  1031. shouldAutoHealPlayer = true
  1032. document.getElementById("healplayer").innerHTML = "Disable Heal"
  1033. } else {
  1034. shouldAutoHealPlayer = false
  1035. document.getElementById("healplayer").innerHTML = "Enable Heal"
  1036. }
  1037. }
  1038.  
  1039.  
  1040. let shouldAutoHealPet = true
  1041. let shouldAutoRevivePet = true
  1042. let shouldAutoEvolvePet = true
  1043. let shouldAutoHealPlayer = true
  1044. let petSpawned = false
  1045. let myPet = {};
  1046. let myPlayer = {};
  1047. game.network.addEntityUpdateHandler((data) => {
  1048. if (game.ui.playerTick.petUid !== 0) {
  1049. petSpawned = true;
  1050. if (game.world.entities[game.ui.playerTick.petUid]) {
  1051. let petHealth = (myPet.health/myPet.maxHealth) * 100
  1052. myPet = game.world.entities[game.ui.playerTick.petUid].fromTick;
  1053. if (shouldAutoHealPet && petHealth < document.getElementById("healpetinput").value && petHealth > 0 && game.ui.playerTick.gold >= 100 && shouldAutoHealPet) {
  1054. if (!window.healPet) {
  1055. shopShortcut("PetHealthPotion", 1)
  1056. window.healPet = true;
  1057. setTimeout(() => {
  1058. window.healPet = false;
  1059. }, 300);
  1060. }
  1061.  
  1062. }
  1063. if (shouldAutoEvolvePet && petHealth > 0 && game.world.entities[game.ui.playerTick.uid].fromTick.health > 0) {
  1064. let model = game.world.entities[game.ui.playerTick.petUid].fromTick.model
  1065. let tokens = document.querySelectorAll(".hud-shop-item-tokens")
  1066. let pToken = game.ui.playerTick.token
  1067. let evolvebtn = document.querySelectorAll(".hud-shop-actions-evolve")
  1068. if (!evolvebtn[0].classList[1] && pToken >= tokens[0].innerHTML && model == "PetCARL") {
  1069. buyItem("PetCARL", getPetTier(5))
  1070. }
  1071. if (!evolvebtn[1].classList[1] && pToken >= tokens[1].innerHTML && model == "PetMiner") {
  1072. buyItem("PetMiner", getPetTier(6))
  1073. }
  1074. }
  1075. }
  1076. }
  1077. if (petSpawned && shouldAutoRevivePet && !game.world.entities[game.ui.playerTick.petUid] && myPlayer.health > 0) {
  1078. shopShortcut("PetRevive", 1)
  1079. }
  1080. myPlayer = game.world.entities[game.ui.playerTick.uid].fromTick
  1081. let playerHealth = (myPlayer.health/myPlayer.maxHealth) * 100;
  1082. if (playerHealth <= document.getElementById("healplayerinput").value && playerHealth > 0 && game.ui.playerTick.gold >= 100 && shouldAutoHealPlayer) {
  1083. if (!window.playerTimeout_1) {
  1084. shopShortcut("HealthPotion", 1)
  1085. window.playerTimeout_1 = true;
  1086. setTimeout(() => {
  1087. window.playerTimeout_1 = false;
  1088. }, 300)
  1089. }
  1090. }
  1091. })
  1092.  
  1093. function loadedPlayers() { // loaded player names
  1094. var returns = []
  1095. Object.entries(Game.currentGame.world.entities)
  1096. .forEach((stuff => {
  1097. if (stuff[1].targetTick.entityClass == "PlayerEntity" && ((stuff[1].targetTick.uid !== Game.currentGame.world.entities[Game.currentGame.world.getMyUid()].targetTick.uid) || window.useSamePI)) {
  1098. returns.push(stuff[1].targetTick.name)
  1099. }
  1100. }))
  1101. return returns;
  1102. }
  1103. window.loadedIDS = function () {
  1104. var returns = []
  1105. Object.entries(Game.currentGame.world.entities)
  1106. .forEach((stuff => {
  1107. if (stuff[1].targetTick.entityClass == "PlayerEntity" && ((stuff[1].targetTick.uid !== Game.currentGame.world.entities[Game.currentGame.world.getMyUid()].targetTick.uid) || window.useSamePI)) {
  1108. var h = stuff[1].targetTick
  1109. if (document.querySelector('#advancedlpi')
  1110. .checked) {
  1111. returns.push(JSON.stringify(h))
  1112. } else {
  1113. returns.push(stuff[1].targetTick.name + " - Wood: " + Game.currentGame.world.entities[stuff[1].targetTick.uid].targetTick.wood +
  1114. ", Stone: " + Game.currentGame.world.entities[stuff[1].targetTick.uid].targetTick.stone + ", Gold: " + Game.currentGame
  1115. .world.entities[stuff[1].targetTick.uid].targetTick.gold)
  1116. }
  1117. }
  1118. }))
  1119. return returns;
  1120. }
  1121.  
  1122. function spamchatclick() { // used to be called spam chat, its split chat now
  1123. var user = document.querySelector('#spamchat')
  1124. .value
  1125. splitChatLength(user)
  1126. }
  1127.  
  1128. let dimension = 1;
  1129. const onWindowResize = () => {
  1130. if (!window.isInMenu && window.zoomonscroll) {
  1131. const renderer = Game.currentGame.renderer;
  1132. let canvasWidth = window.innerWidth * window.devicePixelRatio;
  1133. let canvasHeight = window.innerHeight * window.devicePixelRatio;
  1134. let ratio = canvasHeight / (1080 * dimension);
  1135. renderer.scale = ratio;
  1136. renderer.entities.setScale(ratio);
  1137. renderer.ui.setScale(ratio);
  1138. renderer.renderer.resize(canvasWidth, canvasHeight);
  1139. renderer.viewport.width = renderer.renderer.width / renderer.scale + 2 * renderer.viewportPadding;
  1140. renderer.viewport.height = renderer.renderer.height / renderer.scale + 2 * renderer.viewportPadding;
  1141. }
  1142. } // Zoom by Apex, modified by eh
  1143. onWindowResize();
  1144. var transparentMenu = false;
  1145. window.onresize = onWindowResize;
  1146. window.onwheel = e => {
  1147. if (e.deltaY > 0) {
  1148. dimension += 0.09;
  1149. onWindowResize();
  1150. } else if (e.deltaY < 0) {
  1151. dimension -= 0.09;
  1152. onWindowResize();
  1153. }
  1154. }
  1155. var _isInChatbox = false;
  1156.  
  1157. function doNewSend(sender) {
  1158. if (sender[0] == "ch") {
  1159. Game.currentGame.network.sendRpc({
  1160. name: "SendChatMessage",
  1161. channel: "Local",
  1162. message: sender[1][0]
  1163. })
  1164. }
  1165. }
  1166.  
  1167. function splitChatLength(text) {
  1168. let i = 0;
  1169. window.chatSetInterval = setInterval(function () {
  1170. if (i < text.length) {
  1171. doNewSend(['ch', [text.slice(i, i + 45)]])
  1172. i += 45;
  1173. } else {
  1174. clearInterval(window.chatSetInterval)
  1175. }
  1176. }, 1500)
  1177. }
  1178. addEventListener('keydown', function (e) {
  1179. if (!_isInChatbox && e.key == "/") {
  1180. document.querySelector("#hud-menu-settings")
  1181. .style.display = document.querySelector("#hud-menu-settings")
  1182. .style.display == "none" ? "block" : "none"
  1183. document.querySelector("#hud-menu-shop")
  1184. .style.display = "none"
  1185. document.querySelector("#hud-menu-party")
  1186. .style.display = "none"
  1187. } else if (e.key == "=" && !_isInChatbox) {
  1188. game.ui.getComponent("PopupOverlay").showHint(
  1189. 'Press [/] for menu, left click somewhere on the minimap to automatically move there, type !boss for boss wave, !marker to leave a mark on map.',
  1190. 1.5e4
  1191. )
  1192. }
  1193. })
  1194. document.querySelector('#toggleahrc')
  1195. .addEventListener('click', function () {
  1196. window.ahrc = !window.ahrc
  1197. document.querySelector('#toggleahrc')
  1198. .innerText = window.ahrc ? "Disable AHRC" : "Enable AHRC"
  1199. })
  1200.  
  1201. var isSwinging = false;
  1202. function autoSwing() {
  1203. if (isSwinging) {
  1204. isSwinging = false
  1205. clearInterval(window.swing)
  1206. } else {
  1207. isSwinging = true
  1208. window.swing = setInterval(function () {
  1209. game.network.sendInput({space: 0})
  1210. game.network.sendInput({space: 1})
  1211. }, 0);
  1212. }
  1213. document.querySelector('#toggleswing')
  1214. .innerText = isSwinging ? "Disable Auto Swing" : "Enable Auto Swing"
  1215. }
  1216.  
  1217. document.querySelector('#advancedlpi')
  1218. .addEventListener('change', function (e) {
  1219. var THIS_LPI_EVENT = this;
  1220. })
  1221. document.querySelector('#zos')
  1222. .addEventListener('change', function (e) {
  1223. var THIS_ZOS_EVENT = this;
  1224. window.zoomonscroll = THIS_ZOS_EVENT.checked
  1225. })
  1226.  
  1227. document.querySelector('#togglebot')
  1228. .addEventListener('click', function () {
  1229. botMode = !botMode
  1230. this.innerText = botMode ? "Disable Bot" : "Enable Bot"
  1231. })
  1232. document.querySelector('#toggleresp')
  1233. .addEventListener('click', function () {
  1234. autoRespawn = !autoRespawn
  1235. this.innerText = autoRespawn ? "Disable Auto Respawn" : "Enable Auto Respawn"
  1236. })
  1237. document.querySelector('#togglespmch')
  1238. .addEventListener('click', function () {
  1239. pauseChatSpam(document.querySelector('#spamchat').value)
  1240. this.innerText = isSpamming ? "Disable Spam Chat" : "Enable Spam Chat"
  1241. })
  1242.  
  1243. function moveNext(targetX, targetY) {
  1244. let player = game.world.localPlayer.entity.targetTick.position
  1245. if (player.x <= targetX && player.y <= targetY) {
  1246. game.network.sendInput({
  1247. right: 1,
  1248. left: 0,
  1249. up: 0,
  1250. down: 1
  1251. })
  1252. } else if (player.x >= targetX && player.y <= targetY) {
  1253. game.network.sendInput({
  1254. right: 0,
  1255. left: 1,
  1256. up: 0,
  1257. down: 1
  1258. })
  1259. } else if (player.x <= targetX && player.y >= targetY) {
  1260. game.network.sendInput({
  1261. right: 1,
  1262. left: 0,
  1263. up: 1,
  1264. down: 0
  1265. })
  1266. } else if (player.x >= targetX && player.y >= targetY) {
  1267. game.network.sendInput({
  1268. right: 0,
  1269. left: 1,
  1270. up: 1,
  1271. down: 0
  1272. })
  1273. }
  1274. }
  1275.  
  1276. function isXYCloseTo(x, y) {
  1277. let playerTargetTick = game.world.localPlayer.entity.targetTick.position;
  1278. const radius = 50;
  1279. return ((x <= (playerTargetTick.x + radius) && x >= (playerTargetTick.x - radius)) && (y <= (playerTargetTick.y + radius) && y >= (playerTargetTick.y - radius)));
  1280. }
  1281.  
  1282. let moveIsActive = false;
  1283.  
  1284. function goToPos(x, y) {
  1285. moveIsActive = true;
  1286. window.goToPosInterval = setInterval(() => {
  1287. moveNext(x, y)
  1288. }, 250)
  1289. window.checkPosInterval = setInterval(() => {
  1290. if (moveIsActive) {
  1291. if (isXYCloseTo(x, y)) {
  1292. game.network.sendInput({
  1293. left: 0,
  1294. right: 0,
  1295. up: 0,
  1296. down: 0
  1297. })
  1298. game.ui.getComponent('PopupOverlay')
  1299. .showHint('Finished moving!', 1e4)
  1300. moveIsActive = false;
  1301. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1302. clearInterval(window.goToPosInterval)
  1303. clearInterval(window.checkPosInterval)
  1304. }
  1305. } else {
  1306. game.network.sendInput({
  1307. left: 0,
  1308. right: 0,
  1309. up: 0,
  1310. down: 0
  1311. })
  1312. doNewSend(['ch', ['MapMover: Unexpectedly shut down']])
  1313. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1314. game.ui.getComponent('PopupOverlay')
  1315. .showHint('MapMover unexpectedly stopped', 1e4)
  1316. clearInterval(window.checkPosInterval)
  1317. }
  1318. }, 10)
  1319. let g = setTimeout(() => {
  1320. clearInterval(window.goToPosInterval)
  1321. game.ui.getComponent('PopupOverlay')
  1322. .showHint('It has been 4 minutes to move to the position on the map, so it has automatically stopped to prevent infinite loops.', 1e4)
  1323. moveIsActive = false;
  1324. game.network.sendInput({
  1325. left: 0,
  1326. right: 0,
  1327. up: 0,
  1328. down: 0
  1329. })
  1330. }, 240000)
  1331. mapTimeouts.push(g)
  1332. }
  1333. let mapContainer = document.createElement('div')
  1334.  
  1335. mapContainer.id = "hud-map-container"
  1336. document.querySelector('.hud-bottom-left')
  1337. .append(mapContainer)
  1338. $('#hud-map')
  1339. .appendTo(document.querySelector('#hud-map-container'))
  1340. document.querySelector("#hud-map-container")
  1341. .addEventListener('mousemove', function (e) {
  1342. var offset = $('#hud-map-container')
  1343. .offset();
  1344. // Then refer to
  1345. mapMouseX = e.pageX - offset.left;
  1346. mapMouseY = e.pageY - offset.top;
  1347. })
  1348.  
  1349. document.querySelector("#hud-map-container")
  1350. .addEventListener('click', function (e) {
  1351. if (!moveIsActive) {
  1352. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1353. let yn = "y"
  1354. game.ui.getComponent('PopupOverlay').showConfirmation('Are you sure you want to move to X:' + (mapMouseX * 170.4390625) + ",Y:" + (mapMouseY * 171.9977142857143) + '? You can right click the minimap to cancel this at any time.', 5e3, function() {
  1355. if (yn.toLowerCase() == "y") {
  1356. game.ui.getComponent('PopupOverlay').showHint('Starting MapMove...', 3e3)
  1357. let moveToMapX = (mapMouseX * 170.4390625)
  1358. let moveToMapY = (mapMouseY * 171.9977142857143)
  1359. goToPos(moveToMapX, moveToMapY)
  1360. }
  1361. }, function() {
  1362. game.ui.getComponent('PopupOverlay').showHint('OK, did not start MapMove', 3e3)
  1363. })
  1364. } else {
  1365. moveIsActive = false;
  1366. clearInterval(window.goToPosInterval)
  1367. clearInterval(window.checkPosInterval)
  1368. game.network.sendInput({
  1369. left: 0,
  1370. right: 0,
  1371. up: 0,
  1372. down: 0
  1373. })
  1374. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1375. game.ui.getComponent('PopupOverlay').showHint('MapMove is already in process. Restarting and moving to X:' + (mapMouseX * 170.4390625) + ",Y:" + (mapMouseY * 171.9977142857143) + '. You can right click the minimap to cancel this at any time.', 5e3)
  1376. let yn = "y"
  1377. if (yn.toLowerCase() == "y") {
  1378. let moveToMapX = (mapMouseX * 170.4390625)
  1379. let moveToMapY = (mapMouseY * 171.9977142857143)
  1380. goToPos(moveToMapX, moveToMapY)
  1381. }
  1382. }
  1383. })
  1384.  
  1385. document.querySelector('#hud-map-container').addEventListener('contextmenu', function(ev) {
  1386. ev.preventDefault();
  1387. if(moveIsActive) {
  1388. game.ui.getComponent('PopupOverlay').showConfirmation('Are you sure you want to cancel the current MapMove process?', 5e3, function() {
  1389. moveIsActive = false;
  1390. clearInterval(window.goToPosInterval)
  1391. clearInterval(window.checkPosInterval)
  1392. game.network.sendInput({
  1393. left: 0,
  1394. right: 0,
  1395. up: 0,
  1396. down: 0
  1397. })
  1398. game.ui.getComponent('PopupOverlay').showHint('Successfully stopped MapMover.', 3e3)
  1399. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1400. }, function() {
  1401. game.ui.getComponent('PopupOverlay').showHint('OK, did not stop MapMover.', 3e3)
  1402. })
  1403. } else {
  1404. game.ui.getComponent('PopupOverlay').showHint('You are not in a MapMover process right now. Left click somewhere on the minimap to start one.')
  1405. }
  1406. return false;
  1407. }, false);