Zombs.io Bad Hack

The best public script for zombs.io

安装此脚本
作者推荐脚本

您可能也喜欢Base Record & Rebuild

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