Zombs.io Bad Hack

The best public script for zombs.io

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

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