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