BadHack

very bad

目前為 2022-04-01 提交的版本,檢視 最新版本

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址