Zombs.io Bad Hack

The best public script for Zombs.io

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

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