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