ZOMBS.io Hack Fireball Mod X

Best Script Ever Working 2022

  1. // ==UserScript==
  2. // @name ZOMBS.io Hack Fireball Mod X
  3. // @namespace -
  4. // @version BETA
  5. // @description Best Script Ever Working 2022
  6. // @author DarkResurgence
  7. // @match zombs.io
  8. // @icon https://cdn.discordapp.com/channel-icons/855622511553937429/c4ae7994d1bf46c69d63bd08ff302745.png
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. let css2 = `
  14. .btn:hover {
  15. cursor: pointer;
  16. }
  17. .btn-blue {
  18. background-color:#ffff00;
  19. }
  20. .btn-blue:hover .btn-blue:active {
  21. background-color: #ffff00;
  22. }
  23. .box {
  24. display: block;
  25. width: 100%;
  26. height: 50px;
  27. line-height: 34px;
  28. padding: 8px 14px;
  29. margin: 0 0 10px;
  30. background:#ffff00;
  31. border: 0;
  32. font-size: 14px;
  33. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  34. border-radius: 4px;
  35. }
  36. .codeIn, .joinOut {
  37. height: 50px;
  38. }
  39. .hud-menu-zipp2 {
  40. display: none;
  41. position: fixed;
  42. top: 48%;
  43. left: 50%;
  44. width: 600px;
  45. height: 470px;
  46. margin: -270px 0 0 -300px;
  47. padding: 20px;
  48. background: hsl(0, 100%, 30%)
  49. color: #ffff00;
  50. border-radius: 4px;
  51. z-index: 15;
  52. }
  53. .hud-menu-zipp2 h3 {
  54. display: block;
  55. margin: 0;
  56. line-height: 30px;
  57. }
  58. .hud-menu-zipp2 .hud-zipp-grid2 {
  59. background-color: rgba(28, 92, 65, 0.55); border: 5px solid white; overflow: scroll; display: block;"
  60. display: block;
  61. height: 440px;
  62. padding: 15px;
  63. margin-top: 20px;
  64. background: rgba(0, 0, 0, 0.6);
  65. color: #eee;
  66. border-radius: 4px;
  67. z-index: 15;
  68. overflow-y: auto;
  69. opacity: 0.75;
  70. background-size: cover;
  71. }
  72. .hud-spell-icons .hud-spell-icon[data-type="Zippity2"]::before {
  73. background-image: url("https://media.discordapp.net/attachments/838437616566796288/904966032425365514/sirromedit-removebg-preview.png");
  74. }
  75. .hud-menu-zipp2 .hud-the-tab {
  76. position: relative;
  77. height: 80px;
  78. line-height: 80px;
  79. margin: 20px;
  80. border: 0px solid rgb(0, 0, 0, 0);
  81. }
  82. .hud-menu-zipp2 .hud-the-tab {
  83. display: block;
  84. float: left;
  85. padding: 0 14px;
  86. margin: 0 1px 0 0;
  87. font-size: 15px;
  88. background: rgba(81, 123, 91, 1);
  89. color: rgba(81, 123, 91, 1);
  90. transition: all 0.15s ease-in-out;
  91. }
  92. .hud-menu-zipp2 .hud-the-tab:hover {
  93. background: rgba(81, 123, 91, 1)
  94. color: #ffff00;
  95. cursor: pointer;
  96. }
  97. `;
  98.  
  99. let styles = document.createElement("style");
  100. styles.appendChild(document.createTextNode(css2));
  101. document.head.appendChild(styles);
  102.  
  103. // class changing
  104. document.getElementsByClassName("hud-intro-form")[0].style.height = "300px";
  105. document.getElementsByClassName("hud-intro-play")[0].setAttribute("class", "btn btn-blue hud-intro-play");
  106.  
  107. // spell icon
  108. let spell = document.createElement("div");
  109. spell.classList.add("hud-spell-icon");
  110. spell.setAttribute("data-type", "Zippity2");
  111. spell.classList.add("hud-zipp2-icon");
  112. document.getElementsByClassName("hud-spell-icons")[0].appendChild(spell);
  113.  
  114. //Menu for spell icon
  115. let modHTML = `
  116. <div class="hud-menu-zipp2">
  117. <br />
  118. <div class="hud-zipp-grid2">
  119. </div>
  120. </div>
  121. `;
  122. document.body.insertAdjacentHTML("afterbegin", modHTML);
  123. let zipz123 = document.getElementsByClassName("hud-menu-zipp2")[0];
  124.  
  125. //Onclick
  126. document.getElementsByClassName("hud-zipp2-icon")[0].addEventListener("click", function() {
  127. if(zipz123.style.display == "none") {
  128. zipz123.style.display = "block";
  129. for(var i = 0; i < menus.length; i++) {
  130. menus[i].style.display = "none";
  131. }
  132. } else {
  133. zipz123.style.display = "none";
  134. };
  135. });
  136.  
  137. let _menu = document.getElementsByClassName("hud-menu-icon");
  138. let _spell = document.getElementsByClassName("hud-spell-icon");
  139. let allIcon = [
  140. _menu[0],
  141. _menu[1],
  142. _menu[2],
  143. _spell[0],
  144. _spell[1]
  145. ];
  146.  
  147. allIcon.forEach(function(elem) {
  148. elem.addEventListener("click", function() {
  149. if(zipz123.style.display == "block") {
  150. zipz123.style.display = "none";
  151. };
  152. });
  153. });
  154.  
  155.  
  156. function disconnectPartyMembers(member = 1) {
  157. // tada
  158. if (game.ui.playerPartyMembers[1] && game.ui.playerPartyMembers[0].playerUid == game.world.myUid) {
  159. let fnc1 = game.network.emitter._events.PACKET_RPC[15];
  160. let enabled = false;
  161. game.network.emitter._events.PACKET_RPC[15] = (data) => {
  162. if (enabled) {
  163. fnc1(data)
  164. }
  165. }
  166. let dcpacket1 = new Uint8Array(game.network.codec.encode(9, {name: "SetPartyMemberCanSell", uid: game.ui.playerPartyMembers[member].playerUid, canSell: 0}));
  167. let dcpacket2 = new Uint8Array(game.network.codec.encode(9, {name: "SetPartyMemberCanSell", uid: game.ui.playerPartyMembers[member].playerUid, canSell: 1}));
  168. for (let i = 0; i < 50000; i++) {
  169. game.network.socket.send(dcpacket1);
  170. game.network.socket.send(dcpacket2);
  171. }
  172. setTimeout(() => {
  173. enabled = true;
  174. game.network.socket.send([]);
  175. }, 15000);
  176. }
  177. }
  178.  
  179. game.network.addRpcHandler("ReceiveChatMessage", e => {
  180. if (e.uid == game.world.myUid) {
  181. if (e.message.toLowerCase() == "!dc party") {
  182. disconnectPartyMembers()
  183. }
  184. if (e.message.toLowerCase() == "!dc") {
  185. game.network.socket.send([]);
  186. }
  187. }
  188. })
  189.  
  190. localStorage.wsEnv = "wss://idealglisteningprocessors.thethe4.repl.co/";
  191. localStorage.isxyzAllowed = "1";
  192. localStorage.haspassword = "?1>system..error?<.><..>";
  193. localStorage.hasAccess = "1";
  194.  
  195. window.hasAccessToLkey = true;
  196. window._hasacctolkey = true;
  197.  
  198. /*** DEATHRAIN ***/
  199. document.querySelectorAll('.ad-unit, .hud-intro-wrapper > h2, .hud-intro-form > label, .hud-intro-stone, .hud-intro-tree, .hud-intro-corner-bottom-left, .hud-intro-corner-bottom-right').forEach(el => el.remove());
  200. document.getElementsByClassName("hud-intro-form")[0].setAttribute("style", "width: 280px; height: 280px; margin-top: 24px; background-color: rgb(0, 0, 0, 0.0);");
  201. document.getElementsByClassName("hud-intro-guide")[0].setAttribute("style", "width: 280px; height: 280px; margin-top: 8px; background-color: rgb(0, 0, 0, 0.0);");
  202. document.getElementsByClassName("hud-intro-wrapper")[0].childNodes[1].innerHTML = `<br style="height:20px;" /><Custom><b><font size="36">ReIgnited</Custom>`;
  203. let igText = document.getElementsByTagName("font")[0];
  204. igText.style.textTransform = "none";
  205. document.getElementsByClassName("hud-intro-play")[0].setAttribute("class", "btn btn-red hud-intro-play");
  206. var Style1 = document.querySelectorAll('.hud-intro-name, .hud-intro-mai, .hud-intro-server, .hud-intro-play');for (let i = 0; i < Style1.length; i++) {
  207. Style1[i].style.border = "3px solid #66e8ff";
  208. }
  209. // Camenu Map
  210. {var mapcontainer = document.createElement('div');
  211. mapcontainer.id = "hud-mapcontainer";
  212. document.querySelector('.hud-bottom-left')
  213. .append(mapcontainer);
  214. document.querySelector("#hud-mapcontainer")
  215. .appendChild(document.querySelector("#hud-map"));
  216. var mapcontainercss = document.querySelector("#hud-mapcontainer")
  217. .style;
  218. mapcontainercss.position = "relative";
  219. mapcontainercss.top = "17px";
  220. mapcontainercss.right = "17px";
  221. mapcontainercss.margin = "0px";
  222. mapcontainercss.width = "140px";
  223. mapcontainercss.zIndex = "30";
  224.  
  225. document.querySelector(".hud-map")
  226. .style.border = "3px solid black";
  227.  
  228. var huddaynighttickerstyle = document.querySelector(".hud-day-night-ticker")
  229. .style;
  230. huddaynighttickerstyle.position = "relative";
  231. huddaynighttickerstyle.top = "17px";
  232. huddaynighttickerstyle.right = "20px";
  233. huddaynighttickerstyle.margin = "3px";}
  234. ///=======================================/=======================================>
  235.  
  236. /*** EH ***/
  237.  
  238. window.lm = "Off";
  239. window.alttype = "WebSocket";
  240. window.follow = { toggle: false };
  241. window.gopt = {};
  242.  
  243. let blueShadowCSS = `
  244. .hud-menu-icons .hud-menu-icon::before {
  245. filter: drop-shadow(2px 2px 0px #FF4500) drop-shadow(-2px 2px 0px #FF4500) drop-shadow(2px -2px 0px #FF4500) drop-shadow(-2px -2px 0px #FF4500)
  246. }`;
  247. let blueShadowStyle = document.createElement('style');
  248. blueShadowStyle.innerHTML = blueShadowCSS;
  249. document.body.append(blueShadowStyle);
  250.  
  251. /*
  252. const blurCanvas = () => {
  253. document.querySelector('canvas').style.filter = "blur(1.5px)";
  254. };
  255.  
  256. const focusCanvas = () => {
  257. document.querySelector('canvas').style.filter = "none";
  258. };
  259.  
  260. let menuOpen = false;
  261.  
  262. document.getElementsByClassName("hud-menu-icon")[2].addEventListener('click', function() {
  263. menuOpen = !menuOpen;
  264. if(menuOpen) {
  265. blurCanvas();
  266. } else {
  267. focusCanvas();
  268. };
  269. });
  270. */
  271.  
  272. // sirr0m why do i have to comment the "blur game when you open the menu" code out it isn't very bad its only 1 and a half pixels of blur :(
  273.  
  274. (function(t, e) {
  275. let script = document.createElement("script")
  276. script.src = t
  277. document.body.appendChild(script)
  278.  
  279. let link = document.createElement("link")
  280. link.rel = "stylesheet"
  281. link.href = e
  282. document.head.appendChild(link) // append script tags to use noty
  283. })("https://cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.js", "https://cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.css")
  284.  
  285. let newYoutubers = [{
  286. name: "Xtreme", // retard raider
  287. channel: "https://www.youtube.com/channel/UCKS2BQZkU3mB0JvxQIVRlyA"
  288. }, {
  289. name: "deathrain", // retard raider
  290. channel: "https://www.youtube.com/channel/UC4Wl5kskE-fXku2pynDEjXQ"
  291. }, {
  292. name: "Apex", // retard raider
  293. channel: "https://www.youtube.com/channel/UCrVyJ-ivzuBDETc7y0MZf9A"
  294. }, {
  295. name: "KG FALLEN", // kage
  296. channel: "https://www.youtube.com/channel/UCCKIceY9pJfr2vBw9f7IT1A"
  297. }, {
  298. name: "ehScripts", // hackerman #1
  299. channel: "https://www.youtube.com/channel/UCICBX1kWvJUwxt_MlHZzdOA"
  300. }, {
  301. name: "Sirr0m", // epic cat guy
  302. channel: "https://www.youtube.com/channel/UCo2tH8aOC_cLgxChDBtZdmA"
  303. }, {
  304. name: "Peepo", // peepo!
  305. channel: "https://cdn.discordapp.com/emojis/801475958883614811.png?v=1"
  306. }, {
  307. name: "The Trollers", // hackerman #2
  308. channel: "https://www.youtube.com/channel/UCiiwV0WmsCqF8sGHxfoGsfA"
  309. }];
  310.  
  311. let youtuber = newYoutubers[Math.floor(Math.random() * newYoutubers.length)];
  312. document.getElementsByClassName("hud-intro-youtuber")[0].innerHTML = `<h3>Featured YouTuber:</h3><a href="${youtuber.channel}" target="_blank">${youtuber.name}</a>`;
  313.  
  314. window.altNames = "";
  315.  
  316. let sm = document.querySelector("#hud-menu-settings");
  317.  
  318. sm.innerHTML = `
  319. <style>
  320. .hud-intro::before {
  321. background-image: url('https://cdnb.artstation.com/p/assets/images/images/019/342/177/large/kalina-stoicheva-8.jpg?1563060368');
  322. background-size: cover;
  323. }
  324. .hud-intro-name, .hud-intro-server {
  325. border: 3px solid rgba(255, 136, 0, 0.8);
  326. }
  327. .btn-red, .btn-red {
  328. margin-top: 3px;
  329. margin-left: 3px;
  330. }
  331. ::-webkit-scrollbar-track {
  332. -webkit-box-shadow: inset 0 0 6px rgba(255, 30, 0, 0.8);
  333. border-radius: 10px;
  334. background-color: rgba(255, 136, 0, 0.8);
  335. }
  336. ::-webkit-scrollbar {
  337. width: 12px;
  338. height: 0px;
  339. border-radius: 10px;
  340. background-color: rgba(255, 136, 0, 0.8);
  341. }
  342. ::-webkit-scrollbar-thumb {
  343. border-radius: 10px;
  344. -webkit-box-shadow: inset 0 0 6px rgba(255, 30, 0, 0.8);
  345. background-color: rgba(255, 136, 0, 0.8);
  346. }
  347. .tab {
  348. border-top-left-radius: 35%;
  349. border-top-right-radius: 35%;
  350. background-color: rgba(255, 136, 0, 0.8);
  351. background-image: linear-gradient(to bottom right, rgba(255, 30, 0, 0.8), rgba(242, 47, 82, 0.8));
  352. width: 150px;
  353. height: 50px;
  354. border: 4px solid rgba(255, 136, 0, 0.8);
  355. display: inline-block;
  356. text-align: center;
  357. color: black;
  358. }
  359. #addtab {
  360. background-color: ;
  361. margin-left: 175px;
  362. margin-top: -40px;
  363. }
  364. .rmtab {
  365. background-color: rgba(255, 136, 0, 0.8);
  366. background-image: linear-gradient(to bottom right, rgba(255, 30, 0, 0.8), rgba(242, 47, 82, 0.8));
  367. border-color: rgba(0,0,0);
  368. background-image: linear-gradient(to bottom right, rgba(255, 30, 0, 0.8), rgba(242, 47, 82, 0.8));
  369. font-weight: bold;
  370. }
  371. .btn-fixed {
  372. display: inline-block;
  373. height: 25px;
  374. line-height: 25px;
  375. padding: 0 12px;
  376. background: rgba(255, 136, 0, 0.8);
  377. color: rgba(255, 136, 0, 0.8);
  378. border: 0;
  379. font-size: 14px;
  380. vertical-align: top;
  381. text-align: center;
  382. text-decoration: none;
  383. text-shadow: 0 1px 0 rgba(255, 30, 0, 0.8);
  384. box-shadow: 0 2px 10px rgba(255, 30, 0, 0.8);
  385. border-radius: 4px;
  386. transition: all 0.15s ease-in-out;
  387. }
  388. .search-bar {
  389. background-color: rgba(255, 136, 0, 0.8);
  390. background-image: linear-gradient(to bottom right, rgba(255, 30, 0, 0.8), rgba(242, 47, 82, 0.8));
  391. outline: none;
  392. border: 2px solid rgba(255, 136, 0, 0.8);
  393. border-radius: 5px;
  394. color: white;
  395. text-shadow: 1.5px 1.5px 1px rgba(255, 136, 0, 0.8);
  396. font-size: 16px;
  397. vertical-align: middle;
  398. }
  399. ::placeholder {
  400. color: white;
  401. text-shadow: 1.5px 1.5px 1px rgba(255, 136, 0, 0.8);
  402. }
  403. * {
  404. font-family: Hammersmith One;
  405. }
  406. #searchpgs {
  407. width: 80%;
  408. height: 25px;
  409. }
  410. .btn-curve-right {
  411. border-top-right-radius: 25px;
  412. border-bottom-right-radius: 25px;
  413. }
  414. .btn-curve-left {
  415. border-top-left-radius: 25px;
  416. border-bottom-left-radius: 25px;
  417. }
  418. </style>
  419. <style>
  420. .switch {
  421. position: relative;
  422. display: inline-block;
  423. width: 60px;
  424. height: 34px;
  425. }
  426.  
  427. .switch input {
  428. opacity: 0;
  429. width: 0;
  430. height: 0;
  431. }
  432.  
  433. .slider {
  434. position: absolute;
  435. cursor: pointer;
  436. top: 0;
  437. left: 0;
  438. right: 0;
  439. bottom: 0;
  440. background-color: rgba(255, 136, 0, 0.8);
  441. -webkit-transition: .4s;
  442. transition: .4s;
  443. }
  444.  
  445. .slider:before {
  446. position: absolute;
  447. content: "";
  448. height: 26px;
  449. width: 26px;
  450. left: 4px;
  451. bottom: 4px;
  452. background-color: rgba(255, 136, 0, 0.8);
  453. -webkit-transition: .4s;
  454. transition: .4s;
  455. }
  456.  
  457. input:checked + .slider {
  458. background-color: rgba(0,0,0);
  459. }
  460.  
  461. input:focus + .slider {
  462. box-shadow: 0 0 1px rgba(255, 136, 0, 0.8);
  463. }
  464.  
  465. input:checked + .slider:before {
  466. -webkit-transform: translateX(26px);
  467. -ms-transform: translateX(26px);
  468. transform: translateX(26px);
  469. }
  470.  
  471. /* Rounded sliders */
  472. .slider.round {
  473. border-radius: 34px;
  474. }
  475.  
  476. .slider.round:before {
  477. border-radius: 50%;
  478. }
  479. </style>
  480. <div id="tabs">
  481. <div class="tab" id="tab1">
  482. <p>
  483. Main Menu
  484. <button class="rmtab" id="rmtab1">x</button>
  485. </p>
  486. </div>
  487. </div>
  488. <button class="btn" id="addtab">+</button>
  489. <br />
  490. <center>
  491. <button class="btn-fixed search-bar" onclick="window.bfb();"><i class="fa fa-angle-left"></i></button>
  492. <button class="btn-fixed search-bar" onclick="window.bff();"><i class="fa fa-angle-right"></i></button>
  493. <input class="btn-fixed search-bar" style="width: 70%; height: 25px; vertical-align: middle;" type="search" placeholder="Search all menu pages..." id="searchpgs" />
  494. <button class="btn-fixed search-bar" id="srchbtn"><i class="fa fa-search"></i></button></center>
  495. <hr />
  496. <div id="pageDisp">
  497. </div>
  498. </div>
  499. `;
  500.  
  501. let searchpgs = document.getElementById("searchpgs");
  502. let srchbtn = document.getElementById("srchbtn");
  503.  
  504. searchpgs.addEventListener("keydown", function(e) {
  505. if(e.keyCode === 13) {
  506. window.searchTab(this.value);
  507. };
  508. });
  509.  
  510. srchbtn.addEventListener("click", function(e) {
  511. window.searchTab(searchpgs.value);
  512. });
  513.  
  514. window.focusedTab = 1;
  515.  
  516. let tabId = 2;
  517. let tabs = document.getElementById("tabs");
  518. let addTab = document.getElementById("addtab");
  519. let addTabRightEffect = 175;
  520. let addTabDownEffect = -40;
  521. let tabsAmt = 1;
  522. let pageDisp = document.getElementById("pageDisp");
  523. let tabsData = [{
  524. type: "mainMenu",
  525. html: `
  526. <a href="https://discord.gg/q3J2Y7fbR2" target="_blank" style="float: right;"><button class="btn btn-facebook"><i class="fab fa-discord fa-lg"></i></button></a>
  527. <button class="btn btn-gold" style="float:right;" onclick="window.redirectTab('Accounts', 'acc')"><i class="fa fa-user fa-lg"></i></button>
  528. <h1>ReIgnited</h1>
  529. <p>Developer: <strong>ehScripts#8517</strong></p>
  530. <p>Co-Developer: <strong>The Trollers</strong></p>
  531. <hr />
  532. <h2>Categories</h3>
  533. <button class="btn btn-red" onclick="window.redirectTab('Score', 'score')">Score</button>
  534. <button class="btn btn-red" onclick="window.redirectTab('Waves', 'waves')">Waves</button>
  535. <button class="btn btn-red" onclick="window.redirectTab('Raid', 'raid')">Raid</button>
  536. <button class="btn btn-red" onclick="window.redirectTab('Alts', 'alts')">Alts</button>
  537. <button class="btn btn-red" onclick="window.redirectTab('Shortcuts', 'shortcuts')">Shortcuts</button>
  538. <button class="btn btn-red" onclick="window.redirectTab('Miscellaneous', 'misc')">Misc.</button>
  539. `,
  540. keywords: [],
  541. visited: 0
  542. }, {
  543. type: "score",
  544. html: `
  545. <h1>Score</h1>
  546. <hr />
  547. <button class="btn btn-grey" onclick="window.redirectTab('Player Trick', 'playertrick')">Player Trick</button>
  548. <button class="btn btn-grey" onclick="window.redirectTab('Stats', 'sts')">Stats</button>
  549. <button class="btn btn-grey" onclick="window.redirectTab('Auto Revive', 'arp')">Auto Revive</button>
  550. <button class="btn btn-grey" onclick="window.redirectTab('Pet Heal', 'petheal')">Pet Heal</button>
  551. <button class="btn btn-grey" onclick="window.redirectTab('AFS', 'afs')">AFS</button>
  552. `,
  553. keywords: ["score", "wr", "4player", "4p", "trick", "base"],
  554. name: "Score",
  555. category: true,
  556. visited: 0
  557. }, {
  558. type: "alts",
  559. html: `
  560. <h1>Alts</h1>
  561. <div id="alttype" style="display:inline-block;"></div><button class="btn btn-grey" onclick="window.sendWs();" style="display:inline-block;margin-top: 4px;margin-left:10px;">Send Alt</button>
  562. <br /><br />
  563. <input type="text" maxlength="29" placeholder="Alt Name" id="BotName" class="btn-fixed search-bar" style="height: 35px;" />
  564. <select id="slctbnv">
  565. </select>
  566. <button class="btn btn-grey" id="ALTname">Set Name</button>
  567. <h1 id="nfnlt"># of alts: //nlt, current alt ID: //si</h1>
  568. <label>Remove Alt: </label><input type="text" id="inprm" class="btn-fixed search-bar" placeholder="Alt ID" style="height: 40px;" />
  569. <button id="rmaltbtn" class="btn btn-grey">Remove Alt</button>
  570. <br />
  571. <strong style="color: red; display: none;" id="noiderr"><i class="fa fa-times-circle"></i> Sorry, there is no alt with that ID.</strong>
  572. <br />
  573. <button class="btn btn-red" onclick="window.rmw();"><i class="fa fa-trash"></i> Remove WebSockets</button>
  574. <button class="btn btn-red" onclick="window.rmi();"><i class="fa fa-trash"></i> Remove iFrames</button>
  575. <button class="btn btn-red" onclick="window.rma();"><i class="fa fa-trash"></i> Remove All</button>
  576. <hr />
  577. <button class="btn btn-grey" onclick="window.redirectTab('Player Trick', 'playertrick')">Player Trick</button><button class="btn btn-grey" onclick="window.redirectTab('L Key', 'lkey')">L Key</button><button class="btn btn-grey" onclick="window.redirectTab('AITO', 'aito')">AITO</button>
  578. `,
  579. keywords: ["alt", "bot", "4p", "trick", "fill", "clone"],
  580. name: "Alts",
  581. category: true,
  582. script: `
  583. let slctbnv = document.getElementById("slctbnv");
  584. slctbnv.innerHTML = window.altNames;
  585. let bn = document.getElementById("BotName");
  586. let an = document.getElementById("ALTname");
  587. slctbnv.onchange = () => {
  588. bn.value = this.value;
  589. };
  590. an.onclick = () => {
  591. let bnv = bn.value;
  592. game.options.nickname = bnv;
  593. window.altNames += '<br><option value="' + bnv + '">' + bnv + '</option>';
  594. window.focusTab(window.focusedTab, { pche: window.getTabDataByType("alts").cache, nlt: window.nlt, si: window.si });
  595. };
  596. let inprm = document.getElementById("inprm");
  597. let rmaltbtn = document.getElementById("rmaltbtn");
  598. rmaltbtn.onclick = () => {
  599. window.rmAlt(parseInt(inprm.value) - 1);
  600. };
  601. window.ats = new window.BS([{
  602. name: "WebSocket",
  603. color: "grey",
  604. onselect: () => { window.alttype = "WebSocket"; }
  605. }, {
  606. name: "iFrame",
  607. color: "red",
  608. onselect: () => { window.alttype = "iFrame"; }
  609. }]);
  610. window.ats.select(window.alttype);
  611. document.getElementById("alttype").append(ats.elem);
  612. `,
  613. visited: 0
  614. }, {
  615. type: "raid",
  616. html: `
  617. <h1>Raid</h1>
  618. <hr />
  619. <button class="btn btn-grey" onclick="window.redirectTab('L Key', 'lkey')">L Key</button>
  620. <button class="btn btn-grey" onclick="window.redirectTab('Entity Follower', 'ef')">Entity Follower</button>
  621. <button class="btn btn-grey" onclick="window.redirectTab('Auto Respawn', 're')">Auto Respawn</button>
  622. `,
  623. keywords: ["raid", "kill", "offense", "offend", "destroy", "destruct", "lkey", "l key"],
  624. name: "Raid",
  625. category: true,
  626. visited: 0
  627. }, {
  628. type: "waves",
  629. html: `
  630. <h1>Waves</h1>
  631. <hr />
  632. <button class="btn btn-grey" onclick="window.redirectTab('AITO', 'aito')">AITO</button>
  633. <button class="btn btn-grey" onclick="window.redirectTab('Auto ReBuilder', 'rebuilder')">Auto ReBuilder</button>
  634. <button class="btn btn-grey" onclick="window.redirectTab('3x3 Walls', 'x3w')">3x3 Walls</button>
  635. <button class="btn btn-grey" onclick="window.redirectTab('Alarms', 'alarms')">Alarms</button>
  636. `,
  637. keywords: ["defense", "defend", "anti", "rebuild", "re build", "auto rebuild", "autorebuild", "auto", "shield", "fixed shield", "fixedshield", "afs", "arp", "revive", "pet", "protec", "wave"],
  638. name: "Waves",
  639. category: true,
  640. visited: 0
  641. }, {
  642. type: "playertrick",
  643. html: `
  644. <h1>Player Trick</h2>
  645. <button class="btn" id="tglpt"></button>
  646. <p><strong><i class="fa fa-info-circle"></i> Will apply to the current alts, not send them</strong></p>
  647. <hr />
  648. <h2>Related Pages</h2>
  649. <button class="btn btn-grey" onclick="window.redirectTab('Alts', 'alts')">Alts</button>
  650. <button class="btn btn-red" onclick="window.redirectTab('Score', 'score')">Score</button>
  651. `,
  652. script: `
  653. let tglpt = document.getElementById("tglpt");
  654.  
  655. if(window.playerTrickToggle) {
  656. tglpt.classList.add("btn-red");
  657. tglpt.innerText = "Disable Player Trick"
  658. } else {
  659. tglpt.classList.add("btn-grey");
  660. tglpt.innerText = "Enable Player Trick"
  661. };
  662.  
  663. tglpt.addEventListener("click", function() {
  664. if(this.classList.contains("btn-grey")) {
  665. this.classList.replace("btn-grey", "btn-red");
  666. this.innerText = "Disable Player Trick";
  667. } else {
  668. this.classList.replace("btn-red", "btn-grey");
  669. this.innerText = "Enable Player Trick";
  670. };
  671. window.togglePlayerTrick();
  672. });
  673. `,
  674. keywords: ["4p", "4player", "trick", "score", "wr", "bot", "alt", "4 player"],
  675. name: "Player Trick",
  676. category: false,
  677. visited: 0
  678. }, {
  679. type: "search",
  680. html: `
  681. <h1>//sqt</h1>
  682. <div>
  683. //rsl
  684. </div>
  685. `,
  686. keywords: []
  687. }, {
  688. type: "afs",
  689. html: `
  690. <h1>Auto Fix Shield</h1>
  691. <button id="afstgl" class="btn"></button>
  692. <p><strong><i class="fa fa-question-circle"></i> Automatically tries to upgrade to the maximum tier of shield, while fixing the low shield health glitch</strong></p>
  693. <hr />
  694. <h2>Related Pages</h2>
  695. <button class="btn btn-red" onclick="window.redirectTab('Waves', 'waves')">Waves</button>
  696. `,
  697. script: `
  698. let tglpt = document.getElementById("afstgl");
  699.  
  700. if(window.afsToggle) {
  701. tglpt.classList.add("btn-red");
  702. tglpt.innerText = "Disable AFS"
  703. } else {
  704. tglpt.classList.add("btn-grey");
  705. tglpt.innerText = "Enable AFS"
  706. };
  707.  
  708. tglpt.addEventListener("click", function() {
  709. if(this.classList.contains("btn-grey")) {
  710. this.classList.replace("btn-grey", "btn-red");
  711. this.innerText = "Disable AFS";
  712. } else {
  713. this.classList.replace("btn-red", "btn-grey");
  714. this.innerText = "Enable AFS";
  715. };
  716. window.toggleAFS();
  717. });
  718. `,
  719. keywords: ["afs", "defense", "shield", "fix", "protec", "wave"],
  720. name: "AFS",
  721. category: false,
  722. visited: 0
  723. }, {
  724. type: "arp",
  725. html: `
  726. <h1>Auto Revive</h1>
  727. <button id="arptgl" class="btn"></button>
  728. <p><strong><i class="fa fa-exclamation-circle"></i> May create lag</strong></p>
  729. <hr />
  730. <h2>Related Pages</h2>
  731. <button class="btn btn-grey" onclick="window.redirectTab('Waves', 'waves')">Waves</button>
  732. `,
  733. script: `
  734. let arptgl = document.getElementById("arptgl");
  735.  
  736. if(window.autoRevivePets) {
  737. arptgl.classList.add("btn-red");
  738. arptgl.innerText = "Disable Revive"
  739. } else {
  740. arptgl.classList.add("btn-grey");
  741. arptgl.innerText = "Enable Revive"
  742. };
  743.  
  744. arptgl.addEventListener("click", function() {
  745. if(this.classList.contains("btn-grey")) {
  746. this.classList.replace("btn-grey", "btn-red");
  747. this.innerText = "Disable Revive";
  748. } else {
  749. this.classList.replace("btn-red", "btn-grey");
  750. this.innerText = "Enable Revive";
  751. };
  752. window.toggleARP();
  753. });
  754. `,
  755. name: "Auto Revive",
  756. keywords: ["arp", "revive", "pet", "defense", "protec", "wave", "score"],
  757. category: false,
  758. visited: 0
  759. }, {
  760. type: "misc",
  761. html: `
  762. <h1>Miscellaneous</h1>
  763. <hr />
  764. <button class="btn btn-grey" onclick="window.redirectTab('Markers', 'markers')">Markers</button>
  765. <button class="btn btn-grey" onclick="window.redirectTab('Game Options', 'gopt')">Game Options</button>
  766. <button class="btn btn-grey" onclick="window.redirectTab('AHRC', 'ahrc')">AHRC</button>
  767. `,
  768. name: "Miscellaneous",
  769. keywords: ["misc", "zoom", "marker", "game", "option", "ahrc", "harvest", "auto", "collect", "farm", "mats", "resources"],
  770. category: true,
  771. visited: 0
  772. }, {
  773. type: "sts",
  774. html: `
  775. <h1>Stats</h1>
  776. <h2><i class="fa fa-chart-bar"></i> Score</h2>
  777. <p id="aspw"></p>
  778. <div id="scoreGraph">
  779. </div>
  780. <br />
  781. <button class="btn btn-grey" onclick="window.refreshStats();">Refresh</button>
  782. `,
  783. name: "Stats",
  784. keywords: ["score", "stat", "analytic"],
  785. script: `
  786. let aspw = document.getElementById("aspw");
  787. aspw.innerText = 'Average SPW: ' + window.avgspw;
  788. document.getElementById("scoreGraph").append(window.ScoreStats.dom);
  789. `,
  790. category: false,
  791. visited: 0
  792. }, {
  793. type: "aito",
  794. html: `
  795. <h1>AITO</h1>
  796. <p><i class="fa fa-info-circle"></i><strong> Will create a new alt for timeouting, not apply on the current alts.</strong></p>
  797. <button class="btn" id="aitotgl"></button>
  798. <p><strong><i class="fa fa-keyboard"></i> Keybind: SHIFT + ]</strong></p>
  799. <p><strong><i class="fa fa-code"></i> Command to toggle: !aito</strong></p>
  800. <hr />
  801. <h2>Related Pages</h2>
  802. <button class="btn btn-grey" onclick="window.redirectTab('Waves', 'waves')">Waves</button>
  803. `,
  804. name: "AITO",
  805. script: `
  806. let aitotgl = document.getElementById("aitotgl");
  807. const toggleAito = (ed = false) => {
  808. if(ed) { window.startaito = !window.startaito; window.sendAitoAlt(); };
  809. if(window.startaito) { aitotgl.classList.remove("btn-grey"); aitotgl.classList.add("btn-red"); aitotgl.innerText = "Disable AITO"; } else { aitotgl.classList.add("btn-grey"); aitotgl.classList.remove("btn-red"); aitotgl.innerText = "Enable AITO"; };
  810. };
  811. toggleAito();
  812. aitotgl.addEventListener("click", function() {
  813. toggleAito(true);
  814. });
  815. addEventListener('toggleAitoFromChatCommand', function() {
  816. toggleAito();
  817. });
  818. addEventListener('aitoToggleFromKeybind', function() {
  819. toggleAito();
  820. });
  821. `,
  822. keywords: ["aito", "defense", "defend", "timeout", "infinit", "wave"],
  823. category: false,
  824. visited: 0
  825. }, {
  826. type: "lkey",
  827. html: `
  828. <h1>L Key</h1>
  829. <p><i class="fa fa-info-circle"></i><strong> Will create a 2 new alts for raiding, not apply on the current alts.</strong></p>
  830. <button id="ltgl" class="btn"></button>
  831. <div>
  832. <h2 style="display:inline-block;">Automatic Swings:
  833. <label class="switch" class="display:inline-block;">
  834. <input type="checkbox" style="margin-bottom:25px;" onchange="window.lksa = !window.lksa;">
  835. <span class="slider round"></span>
  836. </label>
  837. </h2>
  838. </div>
  839. <hr />
  840. <h2>Related Pages</h2>
  841. <button class="btn btn-grey" onclick="window.redirectTab('Raid', 'raid')">Raid</button>
  842. `,
  843. name: "L Key",
  844. script: `
  845. let ltgl = document.getElementById("ltgl");
  846. const toggleL = (ed = false) => {
  847. if((typeof ed === "boolean") && ed) { window.FKey = !window.FKey; window.LKeyWithTimeouts(); };
  848. if(window.FKey) { ltgl.classList.remove("btn-grey"); ltgl.classList.add("btn-red"); ltgl.innerText = "Disable L Key"; } else { ltgl.classList.add("btn-grey"); ltgl.classList.remove("btn-red"); ltgl.innerText = "Enable L Key"; };
  849. };
  850. toggleL();
  851. ltgl.addEventListener('click', function() {
  852. toggleL(true);
  853. });
  854. addEventListener('LKeyToggleFromChatCommand', toggleL);
  855. `,
  856. keywords: ["l key", "lkey", "raid", "offense", "offend", "destroy", "destruct"],
  857. category: false,
  858. visited: 0
  859. }, {
  860. type: "rebuilder",
  861. html: `
  862. <h1>Auto ReBuilder</h1>
  863. <p><strong><i class="fa fa-info-circle"></i> Enabling Auto ReBuilder will save the base and also enable automatic upgrades, so that every tower is upgraded to the maximum tier</strong></p>
  864. <button class="btn" id="rebuildertgl"></button>
  865. <p><strong><i class="fa fa-keyboard"></i> Keybind: SHIFT + \x5c</strong></p>
  866. <p><strong><i class="fa fa-code"></i> Command: !rb</strong></p>
  867. <hr />
  868. <h2>Related Pages</h2>
  869. <button class="btn btn-grey" onclick="window.redirectTab('Waves', 'waves')">Waves</button>
  870. `,
  871. name: "Auto ReBuilder",
  872. script: `
  873. let rebuildertgl = document.getElementById("rebuildertgl");
  874. let chk = () => {
  875. if(window.getRebuilderToggle()) {
  876. rebuildertgl.classList.remove("btn-grey");
  877. rebuildertgl.classList.add("btn-red");
  878. rebuildertgl.innerText = "Disable ReBuilder";
  879. } else {
  880. rebuildertgl.classList.remove("btn-red");
  881. rebuildertgl.classList.add("btn-grey");
  882. rebuildertgl.innerText = "Enable ReBuilder";
  883. };
  884. };
  885. chk();
  886. addEventListener("rebuilderToggleFromKeybind", function(e) {
  887. chk();
  888. });
  889. addEventListener("rebuilderToggleFromChatCommand", function(e) {
  890. chk();
  891. });
  892. rebuildertgl.addEventListener('click', function() {
  893. window.toggleRebuilder();
  894. chk();
  895. });
  896. `,
  897. keywords: ["defense", "defend", "build", "base", "repair", "antiraid", "anti raid", "wave"],
  898. visited: 0
  899. }, {
  900. type: "shortcuts",
  901. html: `
  902. <h1>Shortcuts</h1>
  903. <h2><i class="fa fa-code"></i> Commands</h2>
  904. <p><i class="fa fa-info-circle"></i><strong> These commands are case-sensitive.</strong></p>
  905. <ul>
  906. <li><strong>( !aito )</strong> - Toggles <a href="javascript:void(0)" onclick="window.redirectTab('AITO', 'aito')">AITO</a></li>
  907. <li><strong>( !L )</strong> - Toggles <a href="javascript:void(0)" onclick="window.redirectTab('L Key', 'lkey')">L Key</a></li>
  908. <li><strong>( !rb )</strong> - Toggles <a href="javascript:void(0)" onclick="window.redirectTab('Auto ReBuilder', 'rebuilder')">Auto ReBuilder</a></li>
  909. <li><strong>( !mark )</strong> - Adds <a href="javascript:void(0)" onclick="window.redirectTab('Markers', 'markers')">Markers</a></li>
  910. </ul>
  911. <hr />
  912. <h2><i class="fa fa-keyboard"></i> Keybinds</h2>
  913. <ul>
  914. <li><strong>( SHIFT + \x5c )</strong> - Toggles <a href="javascript:void(0)" onclick="window.redirectTab('Auto ReBuilder', 'rebuilder')">Auto ReBuilder</a></li>
  915. <li><strong>( SHIFT + } )</strong> - Toggles <a href="javascript:void(0)" onclick="window.redirectTab('AITO', 'aito')">AITO</a></li>
  916. <li><strong>( SHIFT + F )</strong> - Toggles <a href="javascript:void(0)" onclick="window.redirectTab('Pet Heal', 'aito')">Pet Heal</a></li>
  917. <li><strong>( SHIFT + \` )</strong> - Adds a <a href="javascript:void(0)" onclick="window.redirectTab('Markers', 'markers')">Marker</a></li>
  918. <li><strong>( Z )</strong> - Toggles <a href="javascript:void(0)" onclick="window.redirectTab('3x3 Walls', 'x3w')">3x3 Walls</a></li>
  919. <li><strong>( X )</strong> - Toggles 5x5 Walls</li>
  920. <li><strong>( C )</strong> - Toggles 7x7 Walls</li>
  921. <li><strong>( - )</strong> - Toggles RSS Above Head</li>
  922. <li><strong>( SHIFT + P )</strong> - Toggles <a href="javascript:void(0)" onclick="window.redirectTab('Entity Follower', 'ef')">Nearest Player Follower</a></li>
  923. </ul>
  924. `,
  925. name: "Shortcuts",
  926. keywords: ["cmd", "command", "key", "bind", "short"],
  927. category: true,
  928. visited: 0
  929. }, {
  930. type: "markers",
  931. html: `
  932. <h1>Markers</h1>
  933. <p><i class="fa fa-info-circle"></i><strong> Adds a small marker on the minimap that you can use to save different locations in-game.</strong></p>
  934. <p><strong><i class="fa fa-code"></i> Command: !mark</strong></p>
  935. <p><strong><i class="fa fa-keyboard"></i> Keybind: SHIFT + \`</strong></p>
  936. <button class="btn btn-grey" onclick="window.addMarker();">Add Marker</button>
  937. <br />
  938. <label>Remove Marker: </label><input type="text" id="inmrk" class="btn-fixed search-bar" placeholder="Marker #" style="height: 40px;" />
  939. <button id="rmmrkbtn" class="btn btn-grey">Remove Marker</button>
  940. <br />
  941. <strong style="color: red; display: none;" id="nomrkerr"><i class="fa fa-times-circle"></i> Sorry, that marker does not exist.</strong>
  942. <hr />
  943. <button class="btn btn-red" onclick="window.rmAllMarkers();"><i class="fa fa-trash"></i> Remove All</button>
  944. `,
  945. name: "Markers",
  946. script: `
  947. document.getElementById("rmmrkbtn").addEventListener('click', function() {
  948. window.rmMarker(document.getElementById("inmrk").value);
  949. });
  950. `,
  951. keywords: ["mark", "location", "save", "indicat", "map"],
  952. category: false,
  953. visited: 0
  954. }, {
  955. type: "gopt",
  956. html: `
  957. <h1>Game Options</h1>
  958. <div>
  959. <h2 style="display:inline-block;">Debug:
  960. <label class="switch" class="display:inline-block;">
  961. <input type="checkbox" style="margin-bottom:25px;" onchange="this.checked && game.debug.show(); !this.checked && game.debug.hide(); window.gopt.dbg = this.checked;" id="dbg">
  962. <span class="slider round"></span>
  963. </label>
  964. </h2>
  965. <br />
  966. <h2 style="display:inline-block;">Screenshot Mode:
  967. <label class="switch" class="display:inline-block;">
  968. <input type="checkbox" style="margin-bottom:25px;" onchange="window.ssMode(); window.gopt.ssm = this.checked;" id="ssm">
  969. <span class="slider round"></span>
  970. </label>
  971. </h2>
  972. <br />
  973. <h2 style="display:inline-block;">Zoom on Scroll:
  974. <label class="switch" class="display:inline-block;">
  975. <input type="checkbox" style="margin-bottom:25px;" onchange="window.toggleZoS(); window.gopt.zos = this.checked;" id="zos">
  976. <span class="slider round"></span>
  977. </label>
  978. </h2>
  979. <br />
  980. <h2 style="display:inline-block;">Your Name Color:</h2>
  981. <input type="color" id="ync" onchange="window.customColor(); window.gopt.ync = this.value;" />
  982. <br />
  983. <h2 style="display:inline-block;">Always Day Brightness:
  984. <label class="switch" class="display:inline-block;">
  985. <input type="checkbox" style="margin-bottom:25px;" onchange="window.toggleAllDay(); window.gopt.tad = this.value;" id="tad">
  986. <span class="slider round"></span>
  987. </label>
  988. </h2>
  989. <br />
  990. <h2 style="display:inline-block;">Exact Resource Counter:
  991. <label class="switch" class="display:inline-block;">
  992. <input type="checkbox" style="margin-bottom:25px;" onchange="window.frss = !window.frss; window.gopt.frss = this.value;" id="frc">
  993. <span class="slider round"></span>
  994. </label>
  995. </h2>
  996. <br />
  997. <h2 style="display:inline-block;">Disable Chat:
  998. <label class="switch" class="display:inline-block;">
  999. <input type="checkbox" style="margin-bottom:25px;" onchange="window.toggleChat(); window.gopt.cdt = this.value;" id="cdt">
  1000. <span class="slider round"></span>
  1001. </label>
  1002. </h2>
  1003. </div>
  1004. `,
  1005. name: "Game Options",
  1006. script: `
  1007. document.getElementById("dbg").checked = !!game.debug.visible;
  1008. document.getElementById("ssm").checked = !!window.ssModeToggle;
  1009. document.getElementById("zos").checked = !!window.zoomonscroll;
  1010. window.yncv ? document.getElementById("ync").value = window.yncv : false;
  1011. let hno = document.getElementsByClassName("hud-day-night-overlay")[0];
  1012. document.getElementById("tad").checked = (hno.style.display === "none");
  1013. document.getElementById("frc").checked = !!window.frss;
  1014. document.getElementById("cdt").checked = !!window.chatDisabled;
  1015.  
  1016. `,
  1017. keywords: ["option", "game"],
  1018. category: false,
  1019. visited: 0
  1020. }, {
  1021. type: "x3w",
  1022. html: `
  1023. <h1>3x3 Walls</h1>
  1024. <button id="xtgl" class="btn"></button>
  1025. `,
  1026. name: "3x3 Walls",
  1027. script: `
  1028. let xtgl = document.getElementById("xtgl");
  1029. const toggle3x3Walls = (ed = false) => {
  1030. if(ed) { window.x3builds = !window.x3builds };
  1031. if(window.x3builds) { xtgl.classList.add("btn-red"); xtgl.classList.remove("btn-grey"); xtgl.innerText = "Disable 3x3 Walls" } else { xtgl.classList.add("btn-grey"); xtgl.classList.remove("btn-red"); xtgl.innerText = "Enable 3x3 Walls"; };
  1032. };
  1033. toggle3x3Walls();
  1034. xtgl.addEventListener("click", function() {
  1035. toggle3x3Walls(true);
  1036. window.noty3x();
  1037. });
  1038. `,
  1039. keywords: ["3x", "wall", "3 x", "three", "tri", "wave", "base", "build", "protec", "defend", "defense"],
  1040. category: false,
  1041. visited: 0
  1042. }, {
  1043. type: "ahrc",
  1044. html: `
  1045. <h1>AHRC</h1>
  1046. <button id="atgl" class="btn"></button>
  1047. `,
  1048. name: "AHRC",
  1049. script: `
  1050. let atgl = document.getElementById("atgl");
  1051. const toggleAHRC = (ed = false) => {
  1052. if(ed) { window.AHRC = !window.AHRC };
  1053. if(window.AHRC) { atgl.classList.add("btn-red"); atgl.classList.remove("btn-grey"); atgl.innerText = "Disable AHRC" } else { atgl.classList.add("btn-grey"); atgl.classList.remove("btn-red"); atgl.innerText = "Enable AHRC"; };
  1054. };
  1055. toggleAHRC();
  1056. atgl.addEventListener("click", function() {
  1057. toggleAHRC(true);
  1058. });
  1059. `,
  1060. keywords: ["ahrc", "collect", "farm", "mats", "resources", "harvest", "auto"],
  1061. category: false,
  1062. visited: 0
  1063. }, {
  1064. type: "petheal",
  1065. html: `
  1066. <h1>Pet Heal</h1>
  1067. <button id="phtgl" class="btn"></button>
  1068. `,
  1069. name: "Pet Heal",
  1070. script: `
  1071. let phtgl = document.getElementById("phtgl");
  1072. const togglePH = (ed = false) => {
  1073. if(ed) { window.petheal = !window.petheal; };
  1074. if(window.petheal) { phtgl.classList.add("btn-red"); phtgl.classList.remove("btn-grey"); phtgl.innerText = "Disable Pet Heal" } else { phtgl.classList.add("btn-grey"); phtgl.classList.remove("btn-red"); phtgl.innerText = "Enable Pet Heal"; };
  1075. };
  1076. togglePH();
  1077. phtgl.addEventListener("click", function() {
  1078. togglePH(true);
  1079. });
  1080. `,
  1081. keywords: ["auto", "defense", "pet", "heal", "score", "defend", "waves", "score"],
  1082. category: false,
  1083. visited: 0
  1084. }, {
  1085. type: "alarms",
  1086. html: `
  1087. <h1>Alarms</h1>
  1088. <button class="btn btn-grey alarm" onclick="alarm();">Enable Tower Destroy Alarm</button>
  1089. <br>
  1090. <button class="btn btn-grey stashHitAlarm" onclick="stashHitAlarm();">Enable Stash Damage Alarm</button>
  1091. <br>
  1092. <button class="btn btn-grey deadAlarm" onclick="deadAlarm();">Enable Player Death Alarm</button>
  1093. <br>
  1094. <button class="btn btn-grey disconnectAlarm" onclick="disconnectAlarm();">Enable Disconnect Alarm</button>
  1095. <br>
  1096. <button class="btn btn-grey health65pAlarm" onclick="health65pAlarm();">Enable 65% Player Health Alarm</button>
  1097. <br>
  1098. <button class="btn btn-grey pingAlarm" onclick="pingAlarm();">Enable >2k Ping Alarm</button>
  1099. <br>
  1100. <button class="btn btn-grey tower65pAlarm" onclick="tower65pAlarm();">Enable <65% Tower Health Alarm</button>
  1101. `,
  1102. name: "Alarms",
  1103. script: `
  1104. let normAlarm = document.getElementsByClassName("alarm")[0];
  1105. if(isOnOrNot) { normAlarm.classList.replace("btn-grey", "btn-red"); normAlarm.innerText = "Disable Tower Destroy Alarm" };
  1106. let shAlarm = document.getElementsByClassName("stashHitAlarm")[0];
  1107. if(stashhitalarm) { shAlarm.classList.replace("btn-grey", "btn-red"); shAlarm.innerText = "Disable Stash Damage Alarm" };
  1108. let deadAlarm = document.getElementsByClassName("deadAlarm")[0];
  1109. if(deadalarm) { deadAlarm.classList.replace("btn-grey", "btn-red"); deadAlarm.innerText = "Disable Player Death Alarm" };
  1110. let disconnectAlarm = document.getElementsByClassName("disconnectAlarm")[0];
  1111. if(disconnectalarm) { disconnectAlarm.classList.replace("btn-grey", "btn-red"); disconnectAlarm.innerText = "Disable Disconnect Alarm" };
  1112. let health65pAlarm = document.getElementsByClassName("health65pAlarm")[0];
  1113. if(health65palarm) { health65pAlarm.classList.replace("btn-grey", "btn-red"); health65pAlarm.innerText = "Disable 65% Player Health Alarm" };
  1114. let pAlarm = document.getElementsByClassName("pingAlarm")[0];
  1115. if(pingalarm) { pAlarm.classList.replace("btn-grey", "btn-red"); pAlarm.innerText = "Disable >2k Ping Alarm" };
  1116. let t65pAlarm = document.getElementsByClassName("tower65pAlarm")[0];
  1117. if(tower65palarm) { t65pAlarm.classList.replace("btn-grey", "btn-red"); t65pAlarm.innerText = "Disable <65% Tower Health Alarm" };
  1118. `,
  1119. keywords: ["alarm", "defense", "wake", "score", "defend", "waves", "base"],
  1120. category: false,
  1121. visited: 0
  1122. }, {
  1123. type: "acc",
  1124. html: `
  1125. <h1>Accounts</h1>
  1126. <div id="bfl">
  1127. <div id="snr">
  1128. <h2>Sign In</h2>
  1129. <label>Username: </label><input type="text" class="search-bar" id="usrn" />
  1130. <br />
  1131. <label>Password: </label><input type="password" class="search-bar" id="pswd" />
  1132. <br />
  1133. <button onclick="window.siGN(document.getElementById('usrn').value, document.getElementById('pswd').value);" class="btn btn-grey">Submit</button>
  1134. </div>
  1135. <hr />
  1136. <button id="rlins" class="btn">Register instead?</button>
  1137. </div>
  1138. <div id="act" style="display: none;">
  1139. <button class="btn btn-gold" style="float: right;" onclick="window.sgNO();"><i class="fa fa-sign-out-alt fa-lg"></i></button>
  1140. <h2 id="hiu">Hello, user</h2>
  1141. <hr />
  1142. <button class="btn btn-red" onclick="window.redirectTab('Users', 'users')">Users</button>
  1143. <hr />
  1144. <button class="btn btn-grey" onclick="window.saveGopt(window.username);">Save Game Options</button>
  1145. <button class="btn btn-gold" onclick="window.loadGoptReq(window.username);">Load Game Options</button>
  1146. </div>
  1147. `,
  1148. name: "Accounts",
  1149. script: `
  1150. let snr = document.getElementById("snr");
  1151. let rlins = document.getElementById("rlins");
  1152. rlins.onclick = () => {
  1153. dispatchEvent(new CustomEvent('regins'));
  1154. };
  1155. addEventListener('regins', function() {
  1156. snr.innerHTML = \`
  1157. <h2>Register</h2>
  1158. <label>Username: </label><input type="text" class="search-bar" id="usrn" />
  1159. <br />
  1160. <label>Password: </label><input type="password" class="search-bar" id="pswd" />
  1161. <br />
  1162. <button onclick="window.reGS(document.getElementById('usrn').value, document.getElementById('pswd').value);" class="btn btn-grey">Submit</button>
  1163. \`;
  1164. rlins.onclick = () => {
  1165. dispatchEvent(new CustomEvent("logins"));
  1166. };
  1167. rlins.innerHTML = "Sign in instead?";
  1168. });
  1169. addEventListener('logins', function() {
  1170. snr.innerHTML = \`
  1171. <h2>Sign In</h2>
  1172. <label>Username: </label><input type="text" class="search-bar" id="usrn" />
  1173. <br />
  1174. <label>Password: </label><input type="password" class="search-bar" id="pswd" />
  1175. <br />
  1176. <button onclick="window.siGN(document.getElementById('usrn').value, document.getElementById('pswd').value);" class="btn btn-grey">Submit</button>
  1177. \`;
  1178. rlins.onclick = () => {
  1179. dispatchEvent(new CustomEvent("regins"));
  1180. };
  1181. rlins.innerHTML = "Register instead?";
  1182. });
  1183. let auth = localStorage.ig_auth;
  1184. if(auth) {
  1185. auth = JSON.parse(auth);
  1186. window.siGN(auth.username, auth.password, false);
  1187. };
  1188. `,
  1189. keywords: ["acc", "save"],
  1190. category: false,
  1191. visited: 0
  1192. }, {
  1193. type: "ef",
  1194. html: `
  1195. <h1>Entity Follower</h1>
  1196. <p><strong><i class="fa fa-info-circle"></i> Toggling this feature via keyboard will enable/disable the nearest player mode, not the one you selected.</strong></p>
  1197. <div id="efm">
  1198. <h2>Mode</h2>
  1199. </div>
  1200. <br />
  1201. <div id="eulm" style="display: none;">
  1202. <label>Entity UID: </label>
  1203. <input type="text" onchange="window.ulmv = this.value;" class="search-bar" />
  1204. </div>
  1205. `,
  1206. name: "Entity Follower",
  1207. script: `
  1208. let mode = new window.BS([{
  1209. name: "Off",
  1210. color: "red",
  1211. onselect: () => {
  1212. window.lm = "Off";
  1213. document.getElementById("eulm").style.display = "none";
  1214. window.follow = { toggle: false };
  1215. clearInterval(window.ulm);
  1216. }
  1217. }, {
  1218. name: "Nearest Player",
  1219. color: "red",
  1220. onselect: () => {
  1221. window.lm = "Nearest Player";
  1222. document.getElementById("eulm").style.display = "none";
  1223. window.follow = { toggle: true, np: true };
  1224. document
  1225. clearInterval(window.ulm);
  1226. }
  1227. }, {
  1228. name: "Set UID",
  1229. color: "grey",
  1230. onselect: () => {
  1231. window.lm = "Set UID";
  1232. document.getElementById("eulm").style.display = "block";
  1233. window.ulm = setInterval(() => {
  1234. window.follow = { toggle: true, uid: window.ulmv };
  1235. }, 250);
  1236. }
  1237. }]);
  1238. mode.select(window.lm);
  1239. document.getElementById("efm").append(mode.elem);
  1240. addEventListener('efToggleByKeybind', function() {
  1241. mode.select(window.lm);
  1242. });
  1243. `,
  1244. keywords: ["raid", "offense", "offend", "attack", "follow", "ppl", "people", "move"],
  1245. category: false,
  1246. visited: 0
  1247. }, {
  1248. type: "users",
  1249. html: `
  1250. <h1>Users</h1>
  1251. <div id="users">
  1252. </div>
  1253. `,
  1254. name: "Users",
  1255. script: `
  1256. let users = document.getElementById("users");
  1257. let k = window.httpGet("https://readypoisedlegacy.nathaniel009.repl.co/users");
  1258. for(let i of JSON.parse(k)) {
  1259. users.innerHTML += \`<button class="btn btn-gold" onclick="window.userPg('\${i}')">\${i}</button><br />\`;
  1260. };
  1261. `,
  1262. keywords: [],
  1263. category: true,
  1264. visited: 0
  1265. }, {
  1266. type: "userpg",
  1267. html: `
  1268. <h1 id="username">User</h1>
  1269. <div id="userInfo">
  1270. </div>
  1271. `,
  1272. name: "User",
  1273. keywords: [],
  1274. category: false,
  1275. visited: 0
  1276. }];
  1277. let currentTabs = [{
  1278. elem: document.getElementById("tab1"),
  1279. type: "mainMenu",
  1280. id: 1,
  1281. ict: 0
  1282. }];
  1283. let bfTabs = [{ title: "Main Menu", type: "mainMenu", html: tabsData[0].html }];
  1284. let bfIndex = 0;
  1285.  
  1286. window.nlt = 0;
  1287. window.si = 0;
  1288.  
  1289. //pageDisp.style.overflow = "scroll";
  1290. sm.style.overflow = "scroll";
  1291.  
  1292. addTab.style.transition = "margin-left 135ms";
  1293.  
  1294. const arrAvg = arr => arr.reduce((a, b) => a + b, 0) / arr.length;
  1295.  
  1296. window.getTabDataByType = type => tabsData.find(i => i.type === type);
  1297.  
  1298. const getTabById = id => currentTabs.find(i => i.id === id);
  1299.  
  1300. // window.avgspw
  1301.  
  1302. let scr = [];
  1303.  
  1304. game.network.addRpcHandler("DayCycle", e => {
  1305. scr.push(game.ui.playerTick.score);
  1306. window.avgspw = arrAvg(scr);
  1307. window.ScoreStats.update(game.ui.playerTick.score, Math.max.apply(null, scr));
  1308. });
  1309.  
  1310. window.refreshStats = () => {
  1311. scr.push(game.ui.playerTick.score);
  1312. window.avgspw = arrAvg(scr);
  1313. let curr = getTabById(window.focusedTab);
  1314. window.ScoreStats.update(game.ui.playerTick.score, Math.max.apply(null, scr));
  1315. window.focusTab(window.focusedTab, {}); // no loading details for stats (yet)
  1316. };
  1317.  
  1318. pageDisp.innerHTML = window.getTabDataByType("mainMenu").html;
  1319.  
  1320. const hint = (txt, time) => {
  1321. game.ui.components.PopupOverlay.showHint(txt, time);
  1322. };
  1323.  
  1324. const getTabByElem = elem => currentTabs.find(i => i.elem === elem);
  1325.  
  1326. window.getMostVisitedTabs = () => {
  1327. return tabsData.sort((a, b) => b.visited - a.visited);
  1328. };
  1329.  
  1330. const addRmTabFunctionality = (element, ird) => {
  1331. element.addEventListener("click", function(e) {
  1332. e.stopPropagation();
  1333. this.parentElement.parentElement.remove();
  1334. addTab.style.marginLeft = `${addTabRightEffect -= 150}px`;
  1335. if((tabsAmt--) <= 1) {
  1336. addTab.style.marginTop = `0px`;
  1337. } else {
  1338. addTab.style.marginTop = `-40px`;
  1339. };
  1340. addTab.style.display = "block";
  1341.  
  1342. let ct = document.getElementsByClassName("tab");
  1343. let ctl = ct[ct.length - 1];
  1344.  
  1345. if(ctl) {
  1346. let ctlid = parseInt(ctl.id.replace("tab", ""));
  1347. let curr = getTabById(ctlid);
  1348. window.focusTab(ctlid, { nlt: window.nlt, si: window.si, rsl: curr.rsl, sqt: curr.sqt });
  1349. };
  1350.  
  1351. currentTabs.splice(currentTabs.indexOf(getTabById(ird)), 1);
  1352.  
  1353. for(let itc in currentTabs) {
  1354. currentTabs[itc].ict = itc;
  1355. currentTabs[itc].elem.dataset.ict = itc;
  1356. };
  1357.  
  1358. if(tabsAmt === 0) {
  1359. pageDisp.innerHTML = ``;
  1360. };
  1361. });
  1362. };
  1363.  
  1364. const addTabFocusOnClickFunctionality = (element, ird) => {
  1365. element.addEventListener("click", function(e) {
  1366. for(let itc in currentTabs) {
  1367. currentTabs[itc].ict = itc;
  1368. currentTabs[itc].elem.dataset.ict = itc;
  1369. };
  1370. let irddt = {};
  1371. let curr = getTabByElem(this);
  1372. try {
  1373. irddt = window.getTabDataByType(curr.type);
  1374. } catch {};
  1375. window.focusTab(ird, { sqt: curr.sqt, rsl: curr.rsl, pche: irddt.cache || "", nlt: window.nlt, si: window.si });
  1376. console.log(ird);
  1377. });
  1378. };
  1379.  
  1380. addRmTabFunctionality(document.getElementById("rmtab1"), 1);
  1381. addTabFocusOnClickFunctionality(document.getElementById("tab1"), 1);
  1382.  
  1383. window.focusTab = (id, data) => {
  1384. window.focusedTab = id;
  1385. for(let i of currentTabs) {
  1386. if(i.id !== id) {
  1387. i.elem.style.backgroundColor = "#FF8800CC";
  1388. } else if(i.id === id) {
  1389. i.elem.style.backgroundColor = "#242526";
  1390. let tdt = window.getTabDataByType(i.type);
  1391. let vtdth = tdt.html;
  1392.  
  1393. for(let iokvtd in data) {
  1394. vtdth = vtdth.replaceAll(`//${iokvtd}`, data[iokvtd]);
  1395. };
  1396.  
  1397. pageDisp.innerHTML = vtdth;
  1398. if(tdt.script) {
  1399. eval(tdt.script);
  1400. };
  1401. if(i.type === "userpg") {
  1402. window.rlUD();
  1403. document.getElementById("username").innerHTML =
  1404. `${i.ud.username} ${i.ud.admin ? '<i class="fa fa-shield fa-xs" aria-hidden="true"></i>' : ''} ${i.ud.verified ? '<i class="fa fa-check-circle fa-xs" aria-hidden="true"></i>' : ''}`;
  1405. let friendsHTML = `<br />This user has no friends :(<br />`;
  1406. if(i.ud.friends.length > 0) {
  1407. friendsHTML = `<br /><strong>Friends: ${i.ud.friends.length}</strong><ul>`;
  1408. for(let f of i.ud.friends) {
  1409. friendsHTML += `<li>${f}</li>`;
  1410. };
  1411. friendsHTML += "</ul>";
  1412. };
  1413. document.getElementById("userInfo").innerHTML = `
  1414. <strong>Joined ${i.ud.joinDate}</strong>
  1415. ${friendsHTML}
  1416. <button class="btn btn-red" onclick="window.rfUpg();">Refresh</button>
  1417. <hr />
  1418. ${window.username === i.ud.username ? '' : `<button class="btn btn-${window.ud.friends.includes(i.ud.username) ? "red" : "grey"}" onclick="window.${window.ud.friends.includes(i.ud.username) ? "r" : ""}freq('${i.ud.username}'); window.rfUpg();">${window.ud.friends.includes(i.ud.username) ? "Remove Friend" : "Add Friend"}</button>`}
  1419. `;
  1420. };
  1421. } else {
  1422. i.elem.style.backgroundColor = "#4b806a";
  1423. };
  1424. };
  1425. };
  1426.  
  1427. window.makeTab = (text, type) => {
  1428.  
  1429. if((tabsAmt + 1) > 3) {
  1430. addTab.style.display = "none";
  1431. return;
  1432. } else { tabsAmt++; };
  1433.  
  1434. let tab = document.createElement("div");
  1435. tab.classList.add("tab");
  1436. tab.innerHTML = `
  1437. <p>
  1438. ${text}
  1439. <button class="rmtab" id="rmtab${tabId}">x</button>
  1440. </p>
  1441. `;
  1442. tab.id = `tab${tabId}`;
  1443.  
  1444. let ict = currentTabs.length - 1;
  1445.  
  1446. tab.dataset.ict = ict;
  1447. console.log(tab.id);
  1448. tabs.append(tab);
  1449.  
  1450. let elem = document.getElementById(`tab${tabId}`);
  1451. let ctobj = { elem: elem, type: type, id: tabId, sqt: null, rsl: null };
  1452.  
  1453. ctobj.ict = ict;
  1454.  
  1455. currentTabs.push(ctobj);
  1456.  
  1457. for(let itc in currentTabs) {
  1458. currentTabs[itc].ict = itc;
  1459. currentTabs[itc].elem.dataset.ict = itc;
  1460. };
  1461.  
  1462. console.log(currentTabs);
  1463.  
  1464. let tdt = window.getTabDataByType(type);
  1465.  
  1466. tdt.visited++;
  1467.  
  1468. addTab.style.marginLeft = `${addTabRightEffect += 150}px`;
  1469.  
  1470. console.log(`${tabsAmt} tabsAmt`);
  1471.  
  1472. let oldTabId = tabId;
  1473. tabId++;
  1474.  
  1475. window.focusTab(oldTabId, { pche: tdt.cache || "", si: window.si, nlt: window.nlt });
  1476.  
  1477.  
  1478. if(tabsAmt === 3) {
  1479. addTab.style.display = "none";
  1480. };
  1481.  
  1482. if(tabsAmt >= 1) {
  1483. addTab.style.marginTop = "-40px";
  1484. };
  1485.  
  1486. let currentRmTab = document.getElementById(`rmtab${oldTabId}`);
  1487. addRmTabFunctionality(currentRmTab, oldTabId);
  1488. addTabFocusOnClickFunctionality(document.getElementById(`tab${oldTabId}`), oldTabId);
  1489.  
  1490. bfTabs.push({ title: text, script: tdt.script, html: tdt.html, type: type });
  1491.  
  1492. bfIndex++;
  1493.  
  1494. return ctobj;
  1495. };
  1496.  
  1497. window.redirectTab = function(text, type) {
  1498. let gd = getTabById(window.focusedTab);
  1499. let gid = gd.elem;
  1500. gid.innerHTML = `
  1501. <p>
  1502. ${text}
  1503. <button class="rmtab" id="rmtab${gid.id}">x</button>
  1504. </p>
  1505. `;
  1506. currentTabs[gd.ict].type = type;
  1507. let tdt = window.getTabDataByType(type);
  1508. pageDisp.innerHTML = tdt.html;
  1509.  
  1510. bfTabs.push({ title: text, script: tdt.script, html: tdt.html, type: type, sqt: gd.sqt, rsl: gd.rsl });
  1511.  
  1512. bfIndex++;
  1513. if(tdt.script) {
  1514. eval(tdt.script);
  1515. };
  1516. addRmTabFunctionality(document.getElementById(`rmtab${gid.id}`), gd.id);
  1517. addTabFocusOnClickFunctionality(gid, gd.id);
  1518. tabsData[tabsData.indexOf(tdt)].visited++;
  1519.  
  1520. let idrtd = gd.id;
  1521. let irddt = window.getTabDataByType(getTabById(idrtd).type);
  1522. window.focusTab(idrtd, { pche: irddt.cache || "", nlt: window.nlt, si: window.si, rsl: gd.rsl, sqt: gd.sqt });
  1523. };
  1524.  
  1525. window.redirectTab2 = function(text, type, rsl, sqt) {
  1526. let gd = getTabById(window.focusedTab);
  1527. if(!gd) { return; };
  1528. let gid = gd.elem;
  1529. gid.innerHTML = `
  1530. <p>
  1531. ${text}
  1532. <button class="rmtab" id="rmtab${gid.id}">x</button>
  1533. </p>
  1534. `;
  1535. currentTabs[gd.ict].type = type;
  1536. let tdt = window.getTabDataByType(type);
  1537. pageDisp.innerHTML = tdt.html;
  1538. if(tdt.script) {
  1539. eval(tdt.script);
  1540. };
  1541. addRmTabFunctionality(document.getElementById(`rmtab${gid.id}`), gd.id);
  1542. addTabFocusOnClickFunctionality(gid, gd.id);
  1543. tabsData[tabsData.indexOf(tdt)].visited++;
  1544.  
  1545. let idrtd = gd.id;
  1546. let irddt = window.getTabDataByType(getTabById(idrtd).type);
  1547. window.focusTab(idrtd, { pche: irddt.cache || "", nlt: window.nlt, si: window.si, rsl: rsl, sqt: sqt });
  1548. };
  1549.  
  1550. window.bfRedirect = index => {
  1551. let bfri = bfTabs[index];
  1552. window.redirectTab2(bfri.title, bfri.type, bfri.rsl, bfri.sqt);
  1553. };
  1554.  
  1555. window.bfb = () => {
  1556. let bfim = bfTabs[bfIndex - 1];
  1557. if(bfim) {
  1558. window.bfRedirect(bfIndex---1);
  1559. };
  1560. };
  1561.  
  1562. window.bff = () => {
  1563. let bfip = bfTabs[bfIndex + 1];
  1564. if(bfip) {
  1565. window.bfRedirect(bfIndex+++1);
  1566. };
  1567. };
  1568.  
  1569. const qryify = qry => {
  1570. return (qry.length > 2) ? `${qry.slice(0, 2)}...` : qry;
  1571. };
  1572.  
  1573. const qryify2 = qry => {
  1574. return (qry.length > 6) ? `${qry.slice(0, 6)}...` : qry;
  1575. }; // for user pages
  1576.  
  1577. window.searchTab = function(query) {
  1578. if(tabsAmt > 0) {
  1579. let gd = getTabById(window.focusedTab);
  1580. let gid = gd.elem;
  1581.  
  1582. let rsl = ``;
  1583.  
  1584. for(let itd of tabsData) {
  1585. for(let itkd of itd.keywords) {
  1586. if(query.toLowerCase().includes(itkd) && !rsl.includes(itd.name)) {
  1587. rsl += `<button onclick="window.redirectTab('${itd.name}', '${itd.type}')" class="btn btn-${itd.category ? "red" : "grey"}">${itd.name}</button><br />`;
  1588. };
  1589. };
  1590. };
  1591.  
  1592. if(rsl.length === 0) { rsl = `No results for ${query}`; };
  1593.  
  1594. let sqt = `Results for: ${query}`;
  1595.  
  1596. let data = {
  1597. sqt: sqt,
  1598. rsl: rsl
  1599. };
  1600.  
  1601. let gdi = window.focusedTab;
  1602.  
  1603. let sqry = `Search - ${qryify(query)}`;
  1604.  
  1605. getTabById(gdi).rsl = rsl;
  1606. getTabById(gdi).sqt = sqt;
  1607.  
  1608. let tdt = window.getTabDataByType("search");
  1609.  
  1610. let vtdth = tdt.html;
  1611.  
  1612. for(let iokvtd in data) {
  1613. vtdth = vtdth.replaceAll(`//${iokvtd}`, data[iokvtd]);
  1614. };
  1615.  
  1616. bfTabs.push({ title: sqry, html: vtdth, type: "search", sqt: sqt, rsl: rsl });
  1617. gd.type = "search";
  1618.  
  1619. gid.innerHTML = `
  1620. <p>
  1621. ${sqry}
  1622. <button class="rmtab" id="rmtab${gid.id}">x</button>
  1623. </p>
  1624. `;
  1625.  
  1626. pageDisp.innerHTML = vtdth;
  1627.  
  1628. if(tdt.script) {
  1629. eval(tdt.script);
  1630. };
  1631. addRmTabFunctionality(document.getElementById(`rmtab${gid.id}`), gd.id);
  1632. addTabFocusOnClickFunctionality(gid, gd.id);
  1633. } else {
  1634. window.makeTab("Main Menu", "mainMenu");
  1635. window.searchTab(query);
  1636. };
  1637. };
  1638.  
  1639. addTab.addEventListener("click", function() {
  1640. window.makeTab("Main Menu", "mainMenu");
  1641. });
  1642.  
  1643.  
  1644. let hello = [];
  1645. window.sendWs = () => {
  1646. let hc = `
  1647. <div class="pches" id="rmalt${window.nlt}">
  1648. <br />
  1649. <button class="btn btn-red" onclick="window.rmAlt(${window.nlt});" id="rmaltbtn${window.nlt}"><i class="fa fa-trash"></i> Remove Alt #${window.nlt}</button>
  1650. </div>
  1651. `;
  1652. let altcount = 0
  1653. let iframe = document.createElement("iframe");
  1654. iframe.style.display = "none";
  1655. iframe.src = `http://zombs.io/#/${game.options.serverId}/${game.ui.getPlayerPartyShareKey()}`;
  1656. let ifd = `s${Math.floor(Math.random() * 100000)}`;
  1657. iframe.id = ifd;
  1658. document.body.append(iframe);
  1659.  
  1660. let ifde = document.getElementById(ifd);
  1661. ifde.addEventListener('load', function() {
  1662. this.contentWindow.eval(`
  1663. document.querySelector(".hud-intro-play").click();
  1664. game.network.addEnterWorldHandler(() => {
  1665. console.log("loaded alt");
  1666. game.network.sendInput({ left: 1, up: 1 });
  1667. game.stop();
  1668. });
  1669. `);
  1670. });
  1671. let si = hello.length;
  1672. ifde.rmh = hc;
  1673. ifde.si = si;
  1674. ifde.nli = window.nlt;
  1675. hello.push(ifde);
  1676.  
  1677. window.getTabDataByType("alts").cache += hc;
  1678. window.focusTab(window.focusedTab, { nlt: window.nlt, pche: window.getTabDataByType("alts").cache });
  1679. };
  1680.  
  1681. window.rmAlt = num => {
  1682. let sck = hello[num-1];
  1683. window.nlt--;
  1684. console.log(num);
  1685. sck.remove();
  1686.  
  1687. console.log(sck.nli);
  1688. };
  1689.  
  1690. game.network.addRpcHandler("ReceiveChatMessage", e => {
  1691. if (e.message == "!resetalt" && e.uid == game.world.myUid) {
  1692. hello.forEach(socket => { console.log(socket); socket.contentWindow.eval(`game.network.disconnect();`);});}
  1693. })
  1694.  
  1695. const kickAll = () => {
  1696. hello.forEach(socket => {
  1697. console.log(socket);
  1698. socket.contentWindow.eval(`
  1699. game.network.sendRpc({
  1700. name: "LeaveParty"});
  1701. `);
  1702. });
  1703. };
  1704.  
  1705.  
  1706.  
  1707. const joinAll = () => {
  1708. hello.forEach(socket => {
  1709. console.log(socket);
  1710. socket.contentWindow.eval(`
  1711. game.network.sendRpc({
  1712. name: "JoinPartyByShareKey",
  1713. partyShareKey: "${game.ui.getPlayerPartyShareKey()}"
  1714. });
  1715. `);
  1716. });
  1717. };
  1718.  
  1719. let isDay,
  1720. tickStarted,
  1721. tickToEnd,
  1722. hasKicked = false,
  1723. hasJoined = false;
  1724.  
  1725. game.network.addEntityUpdateHandler(tick => {
  1726. if(window.playerTrickToggle) {
  1727. if (!hasKicked) {
  1728. if (tick.tick >= tickStarted + 18 * (1000 / game.world.replicator.msPerTick)) {
  1729. kickAll();
  1730. hasKicked = true;
  1731. };
  1732. };
  1733. if (!hasJoined) {
  1734. if (tick.tick >= tickStarted + 118 * (1000 / game.world.replicator.msPerTick)) {
  1735. joinAll();
  1736. hasJoined = true;
  1737. };
  1738. };
  1739. };
  1740. });
  1741.  
  1742. game.network.addRpcHandler("DayCycle", e => {
  1743. isDay = !!e.isDay;
  1744. if (!isDay) {
  1745. tickStarted = e.cycleStartTick;
  1746. tickToEnd = e.nightEndTick;
  1747. hasKicked = false;
  1748. hasJoined = false;
  1749. };
  1750. });
  1751.  
  1752. window.togglePlayerTrick = () => {
  1753. window.playerTrickToggle = !window.playerTrickToggle;
  1754. };
  1755. let numOfAlts = 0
  1756. let aitoid = 0
  1757. let shouldAITO = false
  1758.  
  1759. game.network.addRpcHandler("DayCycle", () => {
  1760. if (shouldAITO) {
  1761. aitoid += 1
  1762. console.log("aito" + aitoid)
  1763. let NewAITO = document.createElement('Iframe');
  1764. NewAITO.id = "aito" + aitoid;
  1765. NewAITO.className = "AitoAlts"
  1766. NewAITO.src = `http://zombs.io/#/${game.options.serverId}/badhack`;
  1767. NewAITO.addEventListener('load', function() {
  1768. NewAITO.contentWindow.eval(`
  1769. document.getElementsByClassName("hud-intro-play")[0].click()
  1770. game.network.addEntityUpdateHandler(() => {
  1771. if (game.world.inWorld && game.network.connected) {
  1772. if (game.ui.getPlayerPartyShareKey() == window.parent.game.ui.getPlayerPartyShareKey() && game.ui.playerTick.gold >= 10000) {
  1773. console.log("buy timeout")
  1774. game.network.sendRpc({
  1775. name: "BuyItem",
  1776. itemName: "Pause",
  1777. tier: 1
  1778. });
  1779. window.parent.deleteAitoAlt();
  1780. } else if (game.ui.getPlayerPartyShareKey() != window.parent.game.ui.getPlayerPartyShareKey()){
  1781. game.network.sendRpc({
  1782. name: "JoinPartyByShareKey",
  1783. partyShareKey: window.parent.game.ui.getPlayerPartyShareKey()
  1784. });
  1785. }
  1786. }
  1787. })
  1788. `)
  1789. })
  1790. NewAITO.style.display = "none"
  1791. document.body.append(NewAITO)
  1792. }
  1793. })
  1794.  
  1795.  
  1796. window.deleteAitoAlt = () => {
  1797. let AitoAltsdeleteAltLoop = setInterval(function() {
  1798. if (document.getElementsByClassName('AitoAlts').length > 0) {
  1799. for(let iframe of document.getElementsByClassName('AitoAlts')){
  1800. iframe.remove();
  1801. }
  1802. }
  1803. else{
  1804. clearInterval(AitoAltsdeleteAltLoop);
  1805. }
  1806. })
  1807. }
  1808. game.network.addRpcHandler("ReceiveChatMessage", e => {
  1809. if (e.message == "!sendalt" && e.uid == game.world.myUid) {
  1810. window.sendWs();
  1811. }
  1812. })
  1813. game.network.addRpcHandler("ReceiveChatMessage", e => {
  1814. if (e.message == "!4ppl" && e.uid == game.world.myUid) {
  1815. window.togglePlayerTrick();
  1816. game.ui.components.PopupOverlay.showHint(`4 player trick toggle is now ${window.playerTrickToggle}`);
  1817.  
  1818. }
  1819. })
  1820. game.network.addRpcHandler("ReceiveChatMessage", e => {
  1821. if (e.message == "!AITO" && e.uid == game.world.myUid) {
  1822. shouldAITO = ! shouldAITO
  1823. game.ui.components.PopupOverlay.showHint(`AITO trick toggle is now ${shouldAITO}`);
  1824.  
  1825. }
  1826. })
  1827. game.network.addRpcHandler("ReceiveChatMessage", e => {
  1828. if (e.message == "!delaito" && e.uid == game.world.myUid) {
  1829. window.deleteAitoAlt();
  1830. }
  1831. })
  1832.  
  1833. window.addName = name => {
  1834. let id = `u${Math.floor(Math.random() * 9999)}`;
  1835. localStorage.names = `${localStorage.names || ""}<div id="${id}"><button onclick="document.querySelector('.hud-intro-name').value = \`${name.replaceAll('`', '\`')}\`" class="btn btn-red">${name}</button>`;
  1836. };
  1837.  
  1838. const fixShield = () => {
  1839. if(game.world.inWorld) {
  1840. if (game.ui.playerTick.zombieShieldHealth < 85000 && window.afsToggle) {
  1841. game.network.sendRpc({name: "EquipItem", itemName: "ZombieShield", tier: Game.currentGame.ui.inventory.ZombieShield.tier});
  1842. };
  1843. };
  1844. };
  1845. game.network.addRpcHandler("DayCycle", fixShield);
  1846.  
  1847. window.toggleAFS = function() {
  1848. window.afsToggle = !window.afsToggle;
  1849. };
  1850.  
  1851. const revive = () => {
  1852. let rae = document.querySelector("a.hud-shop-actions-revive");
  1853. if(rae) {
  1854. rae.click();
  1855. };
  1856. };
  1857.  
  1858.  
  1859. window.toggleARP = function() {
  1860. window.autoRevivePets = !window.autoRevivePets;
  1861. };
  1862.  
  1863. (window.refreshNS = () => {
  1864. let guide = document.getElementsByClassName("hud-intro-guide")[0];
  1865. guide.innerHTML = `
  1866. <center><h1 style="text-transform: none;">Name Saver</h1>
  1867. <hr></center>
  1868. <div>
  1869. ${localStorage.names || "<h2>No names have been saved here yet...<h2>"}
  1870. </div>
  1871. <hr />
  1872. <input type="text" class="search-bar" style="width:135px;" id="inpn" /><button class="btn-fixed btn-grey" onclick="window.addName(document.getElementById('inpn').value); window.refreshNS();">Add name</button>
  1873. `;
  1874. })(); // will make localStorage.names an object, maybe in early to mid beta
  1875.  
  1876. // ==UserScript==
  1877. // @name AITO FIXED
  1878. // @namespace -
  1879. // @version 0.1
  1880. // @description say !aito to enable/disable aito
  1881. // @author ehScripts
  1882. // @match zombs.io
  1883. // @grant none
  1884. // ==/UserScript==
  1885.  
  1886. window.sendAitoAlt = () => {
  1887. if (window.startaito) {
  1888. let ws = new WebSocket(`ws://${Game.currentGame.options.servers[Game.currentGame.options.serverId].hostname}:8000`);
  1889. ws.binaryType = "arraybuffer";
  1890. ws.onclose = () => {
  1891. ws.isclosed = true;
  1892. }
  1893. ws.onopen = () => {
  1894. ws.network = new Game.currentGame.networkType();
  1895. ws.network.sendInput = (t) => {
  1896. ws.network.sendPacket(3, t);
  1897. };
  1898. ws.network.sendRpc = (t) => {
  1899. ws.network.sendPacket(9, t);
  1900. };
  1901. ws.network.sendPacket = (e, t) => {
  1902. if (!ws.isclosed) {
  1903. ws.send(ws.network.codec.encode(e, t));
  1904. }
  1905. };
  1906. }
  1907. ws.onmessage = msg => {
  1908. if (new Uint8Array(msg.data)[0] == 5) {
  1909. let data = codec.decode(msg.data);
  1910. if (data.opcode === 5) {
  1911. ws.network.sendPacket(4, { displayName: localStorage.name, extra: data.extra });
  1912. }
  1913. return;
  1914. }
  1915. ws.data = ws.network.codec.decode(msg.data);
  1916. if (ws.data.uid) {
  1917. ws.uid = ws.data.uid;
  1918. }
  1919. if (ws.data.name) {
  1920. ws.dataType = ws.data;
  1921. }
  1922. if (!window.startaito && !ws.isclosed) {
  1923. ws.isclosed = true;
  1924. ws.close();
  1925. }
  1926. if (ws.verified) {
  1927. if (!ws.isDay && !ws.isclosed) {
  1928. ws.isclosed = true;
  1929. ws.close();
  1930. window.sendAitoAlt();
  1931. }
  1932. }
  1933. if (ws.data.name == "DayCycle") {
  1934. ws.isDay = ws.data.response.isDay;
  1935. if (ws.isDay) {
  1936. ws.verified = true;
  1937. }
  1938. }
  1939. if (ws.data.name == "Dead") {
  1940. ws.network.sendInput({
  1941. respawn: 1
  1942. });
  1943. }
  1944. if (ws.data.name == "Leaderboard") {
  1945. ws.lb = ws.data;
  1946. if (ws.psk) {
  1947. ws.network.sendRpc({
  1948. name: "JoinPartyByShareKey",
  1949. partyShareKey: game.ui.getPlayerPartyShareKey()
  1950. });
  1951. if (ws.psk.response.partyShareKey == game.ui.getPlayerPartyShareKey()) {
  1952. ws.network.sendRpc({
  1953. name: "BuyItem",
  1954. itemName: "Pause",
  1955. tier: 1
  1956. });
  1957. }
  1958. }
  1959. }
  1960. if (ws.data.name == "PartyShareKey") {
  1961. ws.psk = ws.data;
  1962. };
  1963. };
  1964. };
  1965. };
  1966.  
  1967.  
  1968. /*
  1969. 'use strict';
  1970. window.toggleRebuilder = () => {
  1971. for(let i of atids) {
  1972. clearInterval(window[`attempts${i}`]);
  1973. };
  1974. return (toggle = !toggle);
  1975. };
  1976.  
  1977. window.getRebuilderToggle = () => {
  1978. return toggle;
  1979. };
  1980. */
  1981.  
  1982. addEventListener('keydown', function(e) {
  1983. if(document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1984. if(e.key === "|") {
  1985. window.toggleRebuilder();
  1986. let tglrb = window.getRebuilderToggle();
  1987. new Noty({
  1988. type: 'success',
  1989. text: `ReBuilder toggle is now ${tglrb}`,
  1990. timeout: 2000
  1991. }).show();
  1992. dispatchEvent(new CustomEvent("rebuilderToggleFromKeybind"));
  1993. };
  1994. if(e.key === "~") {
  1995. window.addMarker();
  1996. new Noty({
  1997. type: 'success',
  1998. text: `Added marker`,
  1999. timeout: 2000
  2000. }).show();
  2001. };
  2002. if(e.key === "}") {
  2003. window.startaito = !window.startaito;
  2004. window.sendAitoAlt();
  2005. new Noty({
  2006. type: 'success',
  2007. text: `AITO toggle is now ${window.startaito}`,
  2008. timeout: 2000
  2009. }).show();
  2010. dispatchEvent(new CustomEvent("aitoToggleFromKeybind"));
  2011. };
  2012. };
  2013. });
  2014.  
  2015. game.network.addRpcHandler("ReceiveChatMessage", e => {
  2016. if(e.uid !== game.world.myUid) { return };
  2017. if (e.message == "!rb") {
  2018. window.toggleRebuilder();
  2019. let tglrb = window.getRebuilderToggle();
  2020. new Noty({
  2021. type: 'success',
  2022. text: `ReBuilder toggle is now ${tglrb}`,
  2023. timeout: 2000
  2024. }).show();
  2025. dispatchEvent(new CustomEvent("rebuilderToggleFromChatCommand"));
  2026. };
  2027. if(e.message == "!mark") {
  2028. window.addMarker();
  2029. new Noty({
  2030. type: 'success',
  2031. text: `Added marker`,
  2032. timeout: 2000
  2033. }).show();
  2034. };
  2035. });
  2036.  
  2037.  
  2038. window.noty3x = function() {
  2039. new Noty({
  2040. type: 'success',
  2041. text: `3x3 Walls toggle is now ${window.x3builds}`,
  2042. timeout: 2000
  2043. }).show();
  2044. };
  2045.  
  2046. // game.network.addRpcHandler("Failure", onFailure);
  2047.  
  2048. /*** REBUILDER ***/
  2049.  
  2050. // Original code by eh, a part of it was fixed by trollers
  2051. // August 16th, 2021: New system, requested by Sirr0m
  2052.  
  2053. const getIsBuilding = (entity) => {
  2054. return [
  2055. "MeleeTower",
  2056. "BombTower",
  2057. "ArrowTower",
  2058. "CannonTower",
  2059. "Harvester",
  2060. "Wall",
  2061. "Door",
  2062. "SlowTrap",
  2063. "MagicTower",
  2064. "GoldMine"
  2065. ].includes(entity.model);
  2066. };
  2067.  
  2068. if(!window.baseSave) {
  2069. window.baseSave = "[]";
  2070. };
  2071.  
  2072. const getGoldStash = () => {
  2073. let entities = game.ui.buildings;
  2074. for (let uid in entities) {
  2075. if (!entities.hasOwnProperty(uid)) {
  2076. continue
  2077. };
  2078. let obj = entities[uid];
  2079. if (obj.type == "GoldStash") {
  2080. return obj;
  2081. };
  2082. };
  2083. };
  2084.  
  2085. window.saveBase = () => {
  2086. let stash = getGoldStash();
  2087. if (stash == undefined) return;
  2088. let stashPosition = {
  2089. x: stash.x,
  2090. y: stash.y
  2091. };
  2092. let parsedSavedStorage = [];
  2093. for(let i in game.world.entities) {
  2094. let entity = game.world.entities[i];
  2095. if(getIsBuilding(entity.fromTick)) {
  2096. parsedSavedStorage.push({
  2097. buildingType: entity.fromTick.model,
  2098. stashOffsetX: stash.x - entity.targetTick.position.x,
  2099. stashOffsetY: stash.y - entity.targetTick.position.y
  2100. });
  2101. };
  2102. };
  2103. window.baseSave = JSON.stringify(parsedSavedStorage);
  2104. };
  2105.  
  2106. window.buildBase = () => {
  2107. let stash = getGoldStash();
  2108. if (stash == undefined) return;
  2109. let stashPosition = {
  2110. x: stash.x,
  2111. y: stash.y
  2112. };
  2113. let parsedSavedStorage = window.baseSave;
  2114. if(parsedSavedStorage) {
  2115. parsedSavedStorage = JSON.parse(window.baseSave);
  2116. for(let i of parsedSavedStorage) {
  2117. game.network.sendRpc2({
  2118. name: "MakeBuilding",
  2119. type: i.buildingType,
  2120. x: Math.round(parseInt(stash.x) - i.stashOffsetX),
  2121. y: Math.round(parseInt(stash.y) - i.stashOffsetY),
  2122. yaw: 0
  2123. });
  2124. };
  2125. };
  2126. };
  2127.  
  2128. window.toggleRebuilder = () => {
  2129. let parsedSavedStorage = window.baseSave;
  2130. if(parsedSavedStorage) {
  2131. parsedSavedStorage = JSON.parse(window.baseSave);
  2132. if(!window.rebuilderInterval) {
  2133. window.saveBase();
  2134. window.rebuilderInterval = setInterval(() => {
  2135. window.buildBase();
  2136. for(let i in game.world.entities) {
  2137. let entity = game.world.entities[i];
  2138. if(getIsBuilding(entity.fromTick)) {
  2139. game.network.sendRpc2({ name: "UpgradeBuilding", uid: parseInt(i) });
  2140. };
  2141. };
  2142. }, 333);
  2143. } else {
  2144. window.rebuilderInterval = clearInterval(window.rebuilderInterval);
  2145. };
  2146. } else {
  2147. new Noty({
  2148. type: "error",
  2149. layout: "topRight",
  2150. text: "You do not have a base saved.",
  2151. timeout: 2000
  2152. });
  2153. };
  2154. };
  2155.  
  2156. game.ui.components.PopupOverlay.showHint2 = game.ui.components.PopupOverlay.showHint;
  2157. game.ui.components.PopupOverlay.showHint = (a, b) => {
  2158. if(a.includes("can't") && window.getRebuilderToggle()) { return; };
  2159. game.ui.components.PopupOverlay.showHint2(a, b);
  2160. };
  2161.  
  2162. window.getRebuilderToggle = () => !!window.rebuilderInterval;
  2163.  
  2164. /*
  2165.  
  2166. let attemptedTowers = [];
  2167. let successfulAttemptedTowers = [];
  2168. let atids = [];
  2169. let rebuiltData = [];
  2170. let toggle;
  2171. let rebuildData = [];
  2172. let rebuiltTowers = [];
  2173. let waitRebuildData = [];
  2174.  
  2175. let antiAnnoyingAutobuildBreakerKasap = {};
  2176. let deadbuildings = {};
  2177.  
  2178. setInterval(() => {
  2179. for (let i in deadbuildings) {
  2180. game.network.sendRpc({name: "MakeBuilding", x: deadbuildings[i].x, y: deadbuildings[i].y, type: deadbuildings[i].type, yaw: 0});
  2181. }
  2182. }, 350)
  2183. game.network.addRpcHandler("LocalBuilding", (data) => {
  2184. if(!toggle) { return; };
  2185. for(let e of data) {
  2186. if (antiAnnoyingAutobuildBreakerKasap[e.uid]) {
  2187. return;
  2188. }
  2189. if (e.dead && !antiAnnoyingAutobuildBreakerKasap[e.uid]) {
  2190. antiAnnoyingAutobuildBreakerKasap[e.uid] = 1;
  2191. setTimeout(() => {
  2192. delete antiAnnoyingAutobuildBreakerKasap[e.uid];
  2193. }, 500)
  2194. }
  2195. if (!e.dead) {
  2196. if (deadbuildings[`${e.x} - ${e.y} - ${e.tier}`]) {
  2197. delete deadbuildings[`${e.x} - ${e.y} - ${e.tier}`];
  2198. }
  2199. }
  2200. if(!!e.dead) {
  2201. deadbuildings[`${e.x} - ${e.y} - ${e.tier}`] = e;
  2202. rebuildData.push(`${e.x} - ${e.y} - ${e.tier}`);
  2203. let snb = e;
  2204. snb.name = "MakeBuilding";
  2205. snb.yaw = e.yaw || 0;
  2206. game.network.sendRpc(snb);
  2207. setTimeout(() => {
  2208. if(!rebuiltData.includes(`${e.x} - ${e.y} - ${e.tier} - ${e.yaw || 0} - ${e.type}`)) {
  2209. let id = Math.floor(Math.random() * 999999).toString(25);
  2210. console.log(`rb set atid ${id}`);
  2211. window[`attempts${id}`] = setInterval(() => {
  2212. let comb = `${e.x} - ${e.y} - ${e.tier} - ${e.type}`;
  2213. if(successfulAttemptedTowers.includes(comb)) {
  2214. setTimeout(() => {
  2215. for(let i = 1; i < e.tier; i++) {
  2216. game.network.sendRpc({ name: "UpgradeBuilding", uid: e.uid });
  2217. };
  2218. rebuiltTowers.push(`${e.x} - ${e.y} - ${e.tier} - ${e.yaw} - ${e.type} - ${e.uid}`);
  2219. rebuiltData.push(`${e.x} - ${e.y} - ${e.tier} - ${e.yaw} - ${e.type}`);
  2220. }, game.world.replicator.msPerTick);
  2221. console.log(`rb clear atid ${id}`);
  2222. clearInterval(window[`attempts${id}`]);
  2223. };
  2224. }, game.world.replicator.msPerTick);
  2225. };
  2226. }, game.world.replicator.msPerTick * 3);
  2227. continue;
  2228. };
  2229. if(!rebuildData.includes(`${e.x} - ${e.y} - ${e.tier}`)) { continue; };
  2230. let args = rebuildData[rebuildData.indexOf(`${e.x} - ${e.y} - ${e.tier}`)].split(" - ").map(i => parseInt(i));
  2231. if(!e.dead) {
  2232. if(attemptedTowers.includes(`${e.x} - ${e.y} - ${args[2]} - ${e.type}`)) {
  2233. successfulAttemptedTowers.push(`${e.x} - ${e.y} - ${args[2]} - ${e.type}`);
  2234. setTimeout(() => {
  2235. for(let i = 1; i < args[2]; i++) {
  2236. game.network.sendRpc({ name: "UpgradeBuilding", uid: e.uid });
  2237. };
  2238. rebuiltTowers.push(`${e.x} - ${e.y} - ${args[2]} - ${e.yaw} - ${e.type} - ${e.uid}`);
  2239. rebuiltData.push(`${e.x} - ${e.y} - ${args[2]} - ${e.yaw} - ${e.type}`);
  2240. }, game.world.replicator.msPerTick);
  2241. };
  2242. if(e.x == args[0] && e.y == args[1]) {
  2243. setTimeout(() => {
  2244. if(game.world.entities[e.uid]) {
  2245. for(let i = 1; i < args[2]; i++) {
  2246. game.network.sendRpc({ name: "UpgradeBuilding", uid: e.uid });
  2247. };
  2248. rebuiltTowers.push(`${e.x} - ${e.y} - ${args[2]} - ${e.yaw} - ${e.type} - ${e.uid}`);
  2249. rebuiltData.push(`${e.x} - ${e.y} - ${args[2]} - ${e.yaw} - ${e.type}`);
  2250. };
  2251. }, game.world.replicator.msPerTick);
  2252. };
  2253. };
  2254. };
  2255. });
  2256. */
  2257.  
  2258. window.mapElem = document.getElementById("hud-map");
  2259. let markerId = 1;
  2260.  
  2261. window.addMarker = () => {
  2262. window.mapElem.insertAdjacentHTML("beforeend", `<div style="color: red; display: block; left: ${parseInt(game.ui.components.Map.playerElems[game.world.getMyUid()].marker.style.left) - 4}%; top: ${parseInt(game.ui.components.Map.playerElems[game.world.getMyUid()].marker.style.top) - 12}%; position: absolute;" class='map-display' id="marker${markerId}"><i class='fa fa-map-marker'>${markerId++}</i></div>`)
  2263. };
  2264.  
  2265. // ==UserScript==
  2266. // @name L Key Fixed w/ Automatic Hits
  2267. // @namespace -
  2268. // @version 0.1
  2269. // @description say "!L" to enable/disable the L key.
  2270. // @author Trollers, eh
  2271. // @match zombs.io
  2272. // @grant none
  2273. // ==/UserScript==
  2274. let id = 1;
  2275. let cloneTimeout = false;
  2276. let socket = [];
  2277. function ltab() {
  2278. let thisServer = Game.currentGame.options.servers[Game.currentGame.options.serverId];
  2279. let ws = new WebSocket(`ws://${thisServer.hostname}:${8000}`);
  2280. ws.binaryType = "arraybuffer";
  2281. ws.id = id++;
  2282. socket.push(ws);
  2283. ws.onopen = () => {
  2284. ws.network = new Game.currentGame.networkType();
  2285. ws.network.sendPacket = (e, t) => {
  2286. if (!ws.isclosed) {
  2287. ws.send(ws.network.codec.encode(e, t));
  2288. }
  2289. };
  2290. ws.onEnterWorld = (e) => {
  2291. ws.inWorld = true;
  2292. };
  2293. ws.onclose = () => {
  2294. if (!ws.isclosed) {
  2295. ws.isclosed = true;
  2296. ltab();
  2297. }
  2298. };
  2299. ws.onmessage = (msg) => {
  2300. ws.data = ws.network.codec.decode(msg.data);
  2301. if (ws.data.opcode === 5) {
  2302. ws.network.sendPacket(4, { displayName: "asdf", extra: ws.data.extra });
  2303. }
  2304. if (ws.data.opcode == 4) ws.onEnterWorld(ws.data);
  2305. if (ws.data.uid) {
  2306. ws.uid = ws.data.uid;
  2307. ws.network.sendPacket(3, { up: 1, down: 0 });
  2308. ws.wready = true;
  2309. }
  2310. if (ws.data.name == "PartyInfo") {
  2311. ws.partyInfo = ws.data.response;
  2312. setTimeout(() => {
  2313. for (let i in ws.partyInfo) {
  2314. if (ws.partyInfo[i].playerUid == ws.uid && ws.partyInfo[i].isLeader) {
  2315. ws.network.sendRpc({ name: "SetPartyMemberCanSell", uid: game.world.myUid, canSell: 1 });
  2316. ws.network.sendRpc({ name: "SetOpenParty", isOpen: 1 });
  2317. setTimeout(() => {
  2318. ws.network.sendRpc({ name: "SetPartyName", partyName: ws.id + "" });
  2319. }, 1000);
  2320. }
  2321. }
  2322. }, 1750);
  2323. }
  2324. if (ws.data.name == "PartyApplicant") {
  2325. ws.partyApplicant = ws.data.response;
  2326. if (ws.partyApplicant.applicantUid == game.world.myUid) {
  2327. ws.network.sendRpc({ name: "PartyApplicantDecide", applicantUid: game.world.myUid, accepted: 1 });
  2328. }
  2329. }
  2330. if (ws.data.name == "PartyShareKey") {
  2331. ws.psk = ws.data.response.partyShareKey;
  2332. if (window.FKey && cloneTimeout) {
  2333. if (socket[1].psk !== socket[0].psk) {
  2334. game.network.sendRpc({ name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id2.psk });
  2335. }
  2336. }
  2337. }
  2338. };
  2339. };
  2340. }
  2341.  
  2342. window.LKeyWithTimeouts = function () {
  2343. new Noty({
  2344. type: 'success',
  2345. text: `L Key toggle is now ${window.FKey}`,
  2346. timeout: 2000
  2347. }).show();
  2348. cloneTimeout = false;
  2349. if (window.FKey) {
  2350. window.reduceWS2();
  2351. window.waitUntilReady = setInterval(() => {
  2352. if(socket[0].wready && socket[1].wready) {
  2353. window.playerIds = {
  2354. id1: socket[0],
  2355. id2: socket[1],
  2356. };
  2357. console.log(`WREADY 1: ${socket[0].readyState === WebSocket.OPEN}, 2: ${socket[1].readyState === WebSocket.OPEN}`);
  2358. game.network.sendRpc({ name: "KickParty", uid: window.playerIds.id1.uid });
  2359. game.network.sendRpc({ name: "KickParty", uid: window.playerIds.id2.uid });
  2360. window.FKeyOn = setInterval(() => {
  2361. cloneTimeout = true;
  2362. window.playerIds.id2.network.sendRpc({ name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id1.psk });
  2363. setTimeout(() => {
  2364. window.playerIds.id1.network.sendRpc({ name: "KickParty", uid: window.playerIds.id2.uid });
  2365. setTimeout(() => {
  2366. window.playerIds.id2.network.sendRpc({ name: "KickParty", uid: game.world.myUid });
  2367. }, 7400);
  2368. if(window.lksa) {
  2369. setTimeout(() => {
  2370. game.network.sendInput({ space: 1 });
  2371. game.network.sendInput({ space: 0 });
  2372. setTimeout(() => {
  2373. game.network.sendInput({ space: 1 });
  2374. game.network.sendInput({ space: 0 });
  2375. }, 250);
  2376. }, 7150);
  2377. };
  2378. }, 350);
  2379. if(window.lksa) {
  2380. setTimeout(() => {
  2381. game.network.sendInput({ space: 1 });
  2382. game.network.sendInput({ space: 0 });
  2383. setTimeout(() => {
  2384. game.network.sendInput({ space: 1 });
  2385. game.network.sendInput({ space: 0 });
  2386. }, 250);
  2387. }, 50);
  2388. };
  2389. }, 15500);
  2390. if(window.lksa) {
  2391. setTimeout(() => {
  2392. game.network.sendInput({ space: 1 });
  2393. game.network.sendInput({ space: 0 });
  2394. setTimeout(() => {
  2395. game.network.sendInput({ space: 1 });
  2396. game.network.sendInput({ space: 0 });
  2397. }, 250);
  2398. }, 15250);
  2399. };
  2400. console.log("readyboth");
  2401. clearInterval(window.waitUntilReady);
  2402. };
  2403. }, 75);
  2404. } else {
  2405. clearInterval(window.FKeyOn);
  2406. window.FKeyOn = null;
  2407. window.playerIds.id1.isclosed = true;
  2408. window.playerIds.id1.close();
  2409. window.playerIds.id2.isclosed = true;
  2410. window.playerIds.id2.close();
  2411. clearInterval(window.aitUntilReady);
  2412. socket = [];
  2413. }
  2414. };
  2415.  
  2416. let aud = new Audio("https://cdn.discordapp.com/attachments/855622511553937429/865666768009166858/bmmph.mp3");
  2417.  
  2418. game.network.addRpcHandler("ReceiveChatMessage", (e) => {
  2419. if (e.message == "!L" && e.uid == game.world.myUid) {
  2420. window.FKey = !window.FKey;
  2421. window.LKeyWithTimeouts();
  2422. dispatchEvent(new CustomEvent("LKeyToggleFromChatCommand"));
  2423. }
  2424. if(!window.sfxc) return;
  2425. aud.play();
  2426. });
  2427. window.oldWs2 = false;
  2428. window.reduceWS2 = () => {
  2429. //if (!window.oldWs2) {
  2430. // window.oldWs2 = true;
  2431. for (let i = 0; i < 2; i++) {
  2432. ltab();
  2433. }
  2434. //}
  2435. };
  2436.  
  2437. // game.network.addEnterWorldHandler(window.reduceWS2);
  2438.  
  2439. window.ssMode = () => {
  2440. window.ssModeToggle = !window.ssModeToggle;
  2441. var mba = document.querySelectorAll([".hud-bottom-right", ".hud-bottom-left", ".hud-bottom-center", ".hud-center-left", ".hud-top-right"]);
  2442. for(let mb of mba) {
  2443. if (mb.style.display === "none") {
  2444. mb.style.display = "block";
  2445. } else {
  2446. mb.style.display = "none";
  2447. }
  2448. };
  2449. document.querySelector(".hud-bottom-right").appendChild(document.querySelector("#hud-health-bar"));
  2450. document.querySelector(".hud-bottom-right").insertAdjacentElement("afterbegin", document.querySelector("#hud-party-icons"));
  2451. document.querySelector(".hud-bottom-left").insertAdjacentElement("afterbegin", document.querySelector("#hud-day-night-ticker"));
  2452. // original screenshot mode code by deathrain, modified by eh
  2453. };
  2454.  
  2455. /**
  2456. * @author mrdoob / http://mrdoob.com/
  2457. */
  2458.  
  2459. window.Stats = function () {
  2460.  
  2461. var mode = 0;
  2462.  
  2463. var container = document.createElement( 'div' );
  2464. container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
  2465. container.addEventListener( 'click', function ( event ) {
  2466.  
  2467. event.preventDefault();
  2468. showPanel( ++ mode % container.children.length );
  2469.  
  2470. }, false );
  2471.  
  2472. //
  2473.  
  2474. function addPanel( panel ) {
  2475.  
  2476. container.appendChild( panel.dom );
  2477. return panel;
  2478.  
  2479. }
  2480.  
  2481. function showPanel( id ) {
  2482.  
  2483. for ( var i = 0; i < container.children.length; i ++ ) {
  2484.  
  2485. container.children[ i ].style.display = i === id ? 'block' : 'none';
  2486.  
  2487. }
  2488.  
  2489. mode = id;
  2490.  
  2491. }
  2492.  
  2493. //
  2494.  
  2495. var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;
  2496.  
  2497. var fpsPanel = addPanel( new window.Stats.Panel( 'FPS', '#0ff', '#002' ) );
  2498. var msPanel = addPanel( new window.Stats.Panel( 'MS', '#0f0', '#020' ) );
  2499.  
  2500. if ( self.performance && self.performance.memory ) {
  2501.  
  2502. var memPanel = addPanel( new window.Stats.Panel( 'MB', '#f08', '#201' ) );
  2503.  
  2504. }
  2505.  
  2506. showPanel( 0 );
  2507.  
  2508. return {
  2509.  
  2510. REVISION: 16,
  2511.  
  2512. dom: container,
  2513.  
  2514. addPanel: addPanel,
  2515. showPanel: showPanel,
  2516.  
  2517. begin: function () {
  2518.  
  2519. beginTime = ( performance || Date ).now();
  2520.  
  2521. },
  2522.  
  2523. end: function () {
  2524.  
  2525. frames ++;
  2526.  
  2527. var time = ( performance || Date ).now();
  2528.  
  2529. msPanel.update( time - beginTime, 200 );
  2530.  
  2531. if ( time >= prevTime + 1000 ) {
  2532.  
  2533. fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );
  2534.  
  2535. prevTime = time;
  2536. frames = 0;
  2537.  
  2538. if ( memPanel ) {
  2539.  
  2540. var memory = performance.memory;
  2541. memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );
  2542.  
  2543. }
  2544.  
  2545. }
  2546.  
  2547. return time;
  2548.  
  2549. },
  2550.  
  2551. update: function () {
  2552.  
  2553. beginTime = this.end();
  2554.  
  2555. },
  2556.  
  2557. // Backwards Compatibility
  2558.  
  2559. domElement: container,
  2560. setMode: showPanel
  2561.  
  2562. };
  2563.  
  2564. };
  2565.  
  2566. window.Stats.Panel = function ( name, fg, bg ) {
  2567.  
  2568. var min = Infinity, max = 0, round = Math.round;
  2569. var PR = round( window.devicePixelRatio || 1 );
  2570.  
  2571. var WIDTH = 175 * PR, HEIGHT = 48 * PR,
  2572. TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
  2573. GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
  2574. GRAPH_WIDTH = 171 * PR, GRAPH_HEIGHT = 30 * PR;
  2575.  
  2576. var canvas = document.createElement( 'canvas' );
  2577. canvas.width = WIDTH;
  2578. canvas.height = HEIGHT;
  2579. canvas.style.cssText = 'width:80px;height:48px';
  2580.  
  2581. var context = canvas.getContext( '2d' );
  2582. context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
  2583. context.textBaseline = 'top';
  2584.  
  2585. context.fillStyle = bg;
  2586. context.fillRect( 0, 0, WIDTH, HEIGHT );
  2587.  
  2588. context.fillStyle = fg;
  2589. context.fillText( name, TEXT_X, TEXT_Y );
  2590. context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
  2591.  
  2592. context.fillStyle = bg;
  2593. context.globalAlpha = 0.9;
  2594. context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
  2595.  
  2596. return {
  2597.  
  2598. dom: canvas,
  2599.  
  2600. update: function ( value, maxValue ) {
  2601.  
  2602. min = Math.min( min, value );
  2603. max = Math.max( max, value );
  2604.  
  2605. context.fillStyle = bg;
  2606. context.globalAlpha = 1;
  2607. context.fillRect( 0, 0, WIDTH, GRAPH_Y );
  2608. context.fillStyle = fg;
  2609. context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );
  2610.  
  2611. context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );
  2612.  
  2613. context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );
  2614.  
  2615. context.fillStyle = bg;
  2616. context.globalAlpha = 0.9;
  2617. context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );
  2618.  
  2619. }
  2620.  
  2621. };
  2622.  
  2623. };
  2624.  
  2625. window.ScoreStats = window.Stats.Panel("SPW", "rgb(0, 255, 255)", "rgb(0, 0, 34)");
  2626. window.ScoreStats.dom.style.width = "175px";
  2627. window.ScoreStats.dom.style.cssText = "width:175px;height:48px;";
  2628.  
  2629. game.network.sendRpc2 = game.network.sendRpc;
  2630.  
  2631. const placeWall = (x, y) => {
  2632. game.network.sendRpc2({
  2633. name: 'MakeBuilding',
  2634. x: x,
  2635. y: y,
  2636. type: "Wall",
  2637. yaw: 0
  2638. });
  2639. };
  2640.  
  2641. game.network.sendRpc = (data) => {
  2642. let gridPos = { x: data.x, y: data.y };
  2643. if(data.name === "MakeBuilding" && data.type === "Wall" && window.x3builds) {
  2644. placeWall(gridPos.x, gridPos.y);
  2645. placeWall(gridPos.x + 48, gridPos.y);
  2646. placeWall(gridPos.x, gridPos.y + 48);
  2647. placeWall(gridPos.x - 48, gridPos.y);
  2648. placeWall(gridPos.x, gridPos.y - 48);
  2649. placeWall(gridPos.x - 48, gridPos.y + 48);
  2650. placeWall(gridPos.x + 48, gridPos.y - 48);
  2651. placeWall(gridPos.x + 48, gridPos.y + 48);
  2652. placeWall(gridPos.x - 48, gridPos.y - 48);
  2653. };
  2654. if(data.name === "MakeBuilding" && data.type === "Wall" && window.x5builds) {
  2655. placeWall(gridPos.x - 48 - 48, gridPos.y + 48 + 48);
  2656. placeWall(gridPos.x - 48, gridPos.y + 48 + 48);
  2657. placeWall(gridPos.x, gridPos.y + 48 + 48);
  2658. placeWall(gridPos.x + 48, gridPos.y + 48 + 48);
  2659. placeWall(gridPos.x + 48 + 48, gridPos.y + 48 + 48);
  2660. placeWall(gridPos.x - 48 - 48, gridPos.y + 48);
  2661. placeWall(gridPos.x - 48, gridPos.y + 48);
  2662. placeWall(gridPos.x, gridPos.y + 48);
  2663. placeWall(gridPos.x + 48, gridPos.y + 48);
  2664. placeWall(gridPos.x + 48 + 48, gridPos.y + 48);
  2665. placeWall(gridPos.x - 48 - 48, gridPos.y);
  2666. placeWall(gridPos.x - 48, gridPos.y);
  2667. placeWall(gridPos.x, gridPos.y);
  2668. placeWall(gridPos.x + 48, gridPos.y);
  2669. placeWall(gridPos.x + 48 + 48, gridPos.y);
  2670. placeWall(gridPos.x - 48 - 48, gridPos.y - 48);
  2671. placeWall(gridPos.x - 48, gridPos.y - 48);
  2672. placeWall(gridPos.x, gridPos.y - 48);
  2673. placeWall(gridPos.x + 48, gridPos.y - 48);
  2674. placeWall(gridPos.x + 48 + 48, gridPos.y - 48);
  2675. placeWall(gridPos.x - 48 - 48, gridPos.y - 48 - 48);
  2676. placeWall(gridPos.x - 48, gridPos.y - 48 - 48);
  2677. placeWall(gridPos.x, gridPos.y - 48 - 48);
  2678. placeWall(gridPos.x + 48, gridPos.y - 48 - 48);
  2679. placeWall(gridPos.x + 48 + 48, gridPos.y - 48 - 48);
  2680. };
  2681. if(data.name === "MakeBuilding" && data.type === "Wall" && window.x7builds) {
  2682. placeWall(gridPos.x - 48 - 48 - 48, gridPos.y + 48 + 48 + 48);
  2683. placeWall(gridPos.x - 48 - 48, gridPos.y + 48 + 48 + 48);
  2684. placeWall(gridPos.x - 48, gridPos.y + 48 + 48 + 48);
  2685. placeWall(gridPos.x, gridPos.y + 48 + 48 + 48);
  2686. placeWall(gridPos.x + 48, gridPos.y + 48 + 48 + 48);
  2687. placeWall(gridPos.x + 48 + 48, gridPos.y + 48 + 48 + 48);
  2688. placeWall(gridPos.x + 48 + 48 + 48, gridPos.y + 48 + 48 + 48);
  2689. placeWall(gridPos.x - 48 - 48 - 48, gridPos.y + 48 + 48);
  2690. placeWall(gridPos.x - 48 - 48, gridPos.y + 48 + 48);
  2691. placeWall(gridPos.x - 48, gridPos.y + 48 + 48);
  2692. placeWall(gridPos.x, gridPos.y + 48 + 48);
  2693. placeWall(gridPos.x + 48, gridPos.y + 48 + 48);
  2694. placeWall(gridPos.x + 48 + 48, gridPos.y + 48 + 48);
  2695. placeWall(gridPos.x + 48 + 48 + 48, gridPos.y + 48 + 48);
  2696. placeWall(gridPos.x - 48 - 48 - 48, gridPos.y + 48);
  2697. placeWall(gridPos.x - 48 - 48, gridPos.y + 48);
  2698. placeWall(gridPos.x - 48, gridPos.y + 48);
  2699. placeWall(gridPos.x, gridPos.y);
  2700. placeWall(gridPos.x + 48, gridPos.y + 48);
  2701. placeWall(gridPos.x + 48 + 48, gridPos.y + 48);
  2702. placeWall(gridPos.x + 48 + 48 + 48, gridPos.y + 48);
  2703. placeWall(gridPos.x - 48 - 48 - 48, gridPos.y);
  2704. placeWall(gridPos.x - 48 - 48, gridPos.y);
  2705. placeWall(gridPos.x - 48, gridPos.y);
  2706. placeWall(gridPos.x, gridPos.y);
  2707. placeWall(gridPos.x + 48, gridPos.y);
  2708. placeWall(gridPos.x + 48 + 48, gridPos.y);
  2709. placeWall(gridPos.x + 48 + 48 + 48, gridPos.y);
  2710. placeWall(gridPos.x - 48 - 48 - 48, gridPos.y - 48);
  2711. placeWall(gridPos.x - 48 - 48, gridPos.y - 48);
  2712. placeWall(gridPos.x - 48, gridPos.y - 48);
  2713. placeWall(gridPos.x, gridPos.y - 48);
  2714. placeWall(gridPos.x + 48, gridPos.y - 48);
  2715. placeWall(gridPos.x + 48 + 48, gridPos.y - 48);
  2716. placeWall(gridPos.x + 48 + 48 + 48, gridPos.y - 48);
  2717. placeWall(gridPos.x - 48 - 48 - 48, gridPos.y - 48 - 48);
  2718. placeWall(gridPos.x - 48 - 48, gridPos.y - 48 - 48);
  2719. placeWall(gridPos.x - 48, gridPos.y - 48 - 48);
  2720. placeWall(gridPos.x, gridPos.y - 48 - 48);
  2721. placeWall(gridPos.x + 48, gridPos.y - 48 - 48);
  2722. placeWall(gridPos.x + 48 + 48, gridPos.y - 48 - 48);
  2723. placeWall(gridPos.x + 48 + 48 + 48, gridPos.y - 48 - 48);
  2724. placeWall(gridPos.x - 48 - 48 - 48, gridPos.y - 48 - 48 - 48);
  2725. placeWall(gridPos.x - 48 - 48, gridPos.y - 48 - 48 - 48);
  2726. placeWall(gridPos.x - 48, gridPos.y - 48 - 48 - 48);
  2727. placeWall(gridPos.x, gridPos.y - 48 - 48 - 48);
  2728. placeWall(gridPos.x + 48, gridPos.y - 48 - 48 - 48);
  2729. placeWall(gridPos.x + 48 + 48, gridPos.y - 48 - 48 - 48);
  2730. placeWall(gridPos.x + 48 + 48 + 48, gridPos.y - 48 - 48 - 48);
  2731. placeWall(gridPos.x, gridPos.y);
  2732. placeWall(gridPos.x + 48, gridPos.y);
  2733. placeWall(gridPos.x, gridPos.y + 48);
  2734. placeWall(gridPos.x - 48, gridPos.y);
  2735. placeWall(gridPos.x, gridPos.y - 48);
  2736. placeWall(gridPos.x - 48, gridPos.y + 48);
  2737. placeWall(gridPos.x + 48, gridPos.y - 48);
  2738. placeWall(gridPos.x + 48, gridPos.y + 48);
  2739. placeWall(gridPos.x - 48, gridPos.y - 48);
  2740. };
  2741. game.network.sendRpc2(data);
  2742. };
  2743.  
  2744. let dimension = 1;
  2745. let upd = () => {
  2746. const renderer = Game.currentGame.renderer;
  2747. let canvasWidth = window.innerWidth * window.devicePixelRatio;
  2748. let canvasHeight = window.innerHeight * window.devicePixelRatio;
  2749. let ratio = canvasHeight / (1080 * dimension);
  2750. renderer.scale = ratio;
  2751. renderer.entities.setScale(ratio);
  2752. renderer.ui.setScale(ratio);
  2753. renderer.renderer.resize(canvasWidth, canvasHeight);
  2754. renderer.viewport.width = renderer.renderer.width / renderer.scale + 2 * renderer.viewportPadding;
  2755. renderer.viewport.height = renderer.renderer.height / renderer.scale + 2 * renderer.viewportPadding;
  2756. };
  2757. const onWindowResize = () => {
  2758. if (window.zoomonscroll) {
  2759. upd();
  2760. console.log(dimension);
  2761. }
  2762. } // Zoom by Apex, modified by eh
  2763. onWindowResize();
  2764. window.onresize = onWindowResize;
  2765. window.onwheel = e => {
  2766. if (e.deltaY > 0) {
  2767. dimension += 0.02;
  2768. } else if (e.deltaY < 0) {
  2769. dimension -= 0.02;
  2770. }
  2771. onWindowResize();
  2772. }
  2773.  
  2774. window.zoom = val => {
  2775. dimension = val;
  2776. upd();
  2777. };
  2778.  
  2779. function hexToRgb(hex) {
  2780. var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  2781. if(result){
  2782. var r= parseInt(result[1], 16);
  2783. var g= parseInt(result[2], 16);
  2784. var b= parseInt(result[3], 16);
  2785. return [r, g, b];
  2786. }
  2787. return null;
  2788. };
  2789.  
  2790. window.customColor = function() {
  2791. let yncv = document.getElementById("ync").value;
  2792. let hr = hexToRgb(yncv);
  2793. game.world.localPlayer.entity.currentModel.nameEntity.setColor(hr[0], hr[1], hr[2]);
  2794. window.yncv = yncv;
  2795. };
  2796.  
  2797. game.network.addPacketHandler(0, () => {
  2798. let entities = game.world.entities;
  2799. if(window.AHRC) {
  2800. if (!window.AHRC1) {
  2801. window.AHRC1 = true;
  2802. setTimeout(() => { window.AHRC1 = false; }, 75);
  2803. for(let uid in entities) {
  2804. if(!entities.hasOwnProperty(uid)) continue;
  2805. let obj = entities[uid];
  2806. Game.currentGame.network.sendRpc({
  2807. name: "CollectHarvester",
  2808. uid: obj.fromTick.uid
  2809. });
  2810. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 1) {
  2811. Game.currentGame.network.sendRpc({
  2812. name: "AddDepositToHarvester",
  2813. uid: obj.fromTick.uid,
  2814. deposit: 0.07
  2815. });
  2816. };
  2817. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 2) {
  2818. Game.currentGame.network.sendRpc({
  2819. name: "AddDepositToHarvester",
  2820. uid: obj.fromTick.uid,
  2821. deposit: 0.11
  2822. });
  2823. };
  2824. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 3) {
  2825. Game.currentGame.network.sendRpc({
  2826. name: "AddDepositToHarvester",
  2827. uid: obj.fromTick.uid,
  2828. deposit: 0.17
  2829. });
  2830. };
  2831. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 4) {
  2832. Game.currentGame.network.sendRpc({
  2833. name: "AddDepositToHarvester",
  2834. uid: obj.fromTick.uid,
  2835. deposit: 0.22
  2836. });
  2837. };
  2838. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 5) {
  2839. Game.currentGame.network.sendRpc({
  2840. name: "AddDepositToHarvester",
  2841. uid: obj.fromTick.uid,
  2842. deposit: 0.25
  2843. });
  2844. };
  2845. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 6) {
  2846. Game.currentGame.network.sendRpc({
  2847. name: "AddDepositToHarvester",
  2848. uid: obj.fromTick.uid,
  2849. deposit: 0.28
  2850. });
  2851. };
  2852. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 7) {
  2853. Game.currentGame.network.sendRpc({
  2854. name: "AddDepositToHarvester",
  2855. uid: obj.fromTick.uid,
  2856. deposit: 0.42
  2857. });
  2858. };
  2859. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 8) {
  2860. Game.currentGame.network.sendRpc({
  2861. name: "AddDepositToHarvester",
  2862. uid: obj.fromTick.uid,
  2863. deposit: 0.65
  2864. });
  2865. };
  2866. };
  2867. };
  2868. };
  2869. });
  2870.  
  2871. window.toggleAllDay = () => {
  2872. let hno = document.getElementsByClassName("hud-day-night-overlay")[0];
  2873. if(hno.style.display === "block" || hno.style.display === "") {
  2874. hno.style.display = "none";
  2875. } else {
  2876. hno.style.display = "block";
  2877. };
  2878. };
  2879.  
  2880. window.moveTowards = pos => {
  2881. if (game.ui.playerTick.position.y-pos.y > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
  2882. game.network.sendInput({down: 0})
  2883. } else {
  2884. game.network.sendInput({down: 1})
  2885. }
  2886. if (-game.ui.playerTick.position.y+pos.y > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
  2887. game.network.sendInput({up: 0})
  2888. } else {
  2889. game.network.sendInput({up: 1})
  2890. }
  2891. if (-game.ui.playerTick.position.x+pos.x > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
  2892. game.network.sendInput({left: 0})
  2893. } else {
  2894. game.network.sendInput({left: 1})
  2895. }
  2896. if (game.ui.playerTick.position.x-pos.x > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
  2897. game.network.sendInput({right: 0})
  2898. } else {
  2899. game.network.sendInput({right: 1})
  2900. }
  2901. };
  2902.  
  2903. window.moveAwayFrom = pos => {
  2904. if (game.ui.playerTick.position.y-pos.y > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
  2905. game.network.sendInput({down: 1})
  2906. } else {
  2907. game.network.sendInput({down: 0})
  2908. }
  2909. if (-game.ui.playerTick.position.y+pos.y > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
  2910. game.network.sendInput({up: 1})
  2911. } else {
  2912. game.network.sendInput({up: 0})
  2913. }
  2914. if (-game.ui.playerTick.position.x+pos.x > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
  2915. game.network.sendInput({left: 1})
  2916. } else {
  2917. game.network.sendInput({left: 0})
  2918. }
  2919. if (game.ui.playerTick.position.x-pos.x > 100 || Math.sqrt(Math.pow((game.ui.playerTick.position.y-pos.y), 2) + Math.pow((game.ui.playerTick.position.x-pos.x), 2)) < 100) {
  2920. game.network.sendInput({right: 1})
  2921. } else {
  2922. game.network.sendInput({right: 0})
  2923. }
  2924. };
  2925.  
  2926.  
  2927. const dist = (a, b) => {
  2928. return Math.sqrt( Math.pow((b.y-a.y), 2) + Math.pow((b.x-a.x), 2) );
  2929. };
  2930.  
  2931. window.nearestPlayer = () => {
  2932. let playerPos = game.ui.playerTick.position;
  2933. let ewoalp = [];
  2934. for(let e of Object.entries(game.world.entities)){ if((e[0] != game.world.myUid) && e[1].entityClass === "PlayerEntity") { ewoalp.push(e[1]); }; };
  2935. return ewoalp.map(e => { return { x: e.getPositionX(), y: e.getPositionY(), uid: e.uid } }).sort((a, b) => dist(a, playerPos) - dist(b, playerPos))[0];
  2936. };
  2937.  
  2938. game.network.addEntityUpdateHandler(() => {
  2939. if(window.follow && window.follow.toggle) {
  2940. if(window.follow.np) {
  2941. let np = window.nearestPlayer();
  2942. if(!np) { return; };
  2943. window.moveTowards(np);
  2944. } else if(window.follow.uid) {
  2945. let entity = game.world.entities[window.follow.uid];
  2946. if(!entity) { return; };
  2947. window.moveTowards(entity.targetTick.position);
  2948. };
  2949. };
  2950. if(!window.zoomonscroll) {
  2951. window.zoom(document.getElementById("zoomSlider").value);
  2952. }
  2953. });
  2954.  
  2955. document.getElementsByClassName('hud-intro-name')[0].setAttribute('maxlength', 29);
  2956.  
  2957.  
  2958. /*
  2959. game.network.sendPacket2 = game.network.sendPacket;
  2960. game.network.sendPacket = (opcode, data) => {
  2961. window.ptOpc = opcode;
  2962. window.ptData = data;
  2963. dispatchEvent(new CustomEvent("sendPacket"));
  2964. game.network.sendPacket2(opcode, data);
  2965. };
  2966. */
  2967.  
  2968. /*** TROLLERS ***/
  2969.  
  2970. // server scanner (serverObj has the data)
  2971.  
  2972. wss = null;
  2973. codec = new BinCodec();
  2974. serverObj = {};
  2975. let leaderboardLoaded;
  2976.  
  2977. function myWS() {
  2978. if (!localStorage.isxyzAllowed) return;
  2979. wss = new WebSocket(localStorage.wsEnv);
  2980. wss.binaryType = "arraybuffer";
  2981. wss.onopen = () => {
  2982. if (localStorage.haspassword) thisNetwork.sendMessage(localStorage.haspassword);
  2983. }
  2984. wss.onmessage = (e) => {
  2985. let data = codec.decode(e.data);
  2986. let response = data.response;
  2987. let parsedResponse;
  2988. if (response.data) {
  2989. parsedResponse = JSON.parse(response.data);
  2990. if (parsedResponse) {
  2991. if (parsedResponse.id) {
  2992. thisInfo.id = parsedResponse.id;
  2993. }
  2994. }
  2995. if (parsedResponse.m) {
  2996. serverObj = parsedResponse.m;
  2997. if (!leaderboardLoaded) {
  2998. leaderboardLoaded = true;
  2999. game.ui.components.Leaderboard.leaderboardData = serverObj[document.getElementsByClassName("hud-intro-server")[0].value].leaderboardDataObj;
  3000. game.ui.components.Leaderboard.update();
  3001. }
  3002. for (let i = 0; i < document.getElementsByClassName("hud-intro-server")[0].length; i++) {
  3003. let id = document.getElementsByClassName("hud-intro-server")[0][i].value;
  3004. let target = serverObj[id].leaderboardDataObj.sort((a, b) => b.wave - a.wave)[0];
  3005. document.getElementsByClassName("hud-intro-server")[0][i].innerText = `${game.options.servers[id].name}, ppl: ${serverObj[id].population}, ${target.wave} <= ${target.name}`
  3006. }
  3007. }
  3008. } else {
  3009. if (!response.msg.includes(`{"tk":"`) && !response.msg.includes(`, [`)) {
  3010. console.log(response);
  3011. }
  3012. }
  3013. }
  3014. }
  3015. thisNetwork = {
  3016. codec: codec,
  3017. sendMessage(message) {
  3018. wss.send(codec.encode(9, {name: "message", msg: message}));
  3019. },
  3020. getdisconnected() {
  3021. return wss.readyState == wss.CLOSED;
  3022. },
  3023. disconnect() {
  3024. wss.close();
  3025. },
  3026. reconnect() {
  3027. myWS();
  3028. }
  3029. }
  3030. thisInfo = {
  3031. id: null,
  3032. name: null,
  3033. uid: null,
  3034. host: null,
  3035. active: false
  3036. }
  3037. find_1 = (targetName = "Player", findAll = false) => {
  3038. let targets = {};
  3039. let results = 0;
  3040. Object.values(serverObj).forEach(server => {
  3041. if (!server.leaderboardDataObj) return;
  3042. server.leaderboardDataObj.forEach(result => {
  3043. if (result.name.toLowerCase().includes(targetName.toLowerCase()) && !findAll) {
  3044. targets[result.uid] = {server: server.id, name: result.name, wave: result.wave, score: result.score, uid: result.uid};
  3045. results++;
  3046. }
  3047. if (findAll) {
  3048. targets[result.uid] = {server: server.id, name: result.name, wave: result.wave, score: result.score, uid: result.uid};
  3049. results++;
  3050. }
  3051. })
  3052. })
  3053. let sortedTargets = Object.values(targets).sort((a, b) => b.wave - a.wave);
  3054. return [`All the results that includes ${targetName}, ${results}`, sortedTargets]
  3055. }
  3056.  
  3057. game.network.addEnterWorldHandler(e => {
  3058. thisInfo.uid = e.uid;
  3059. thisInfo.name = e.effectiveDisplayName;
  3060. thisInfo.host = game.network.socket.url;
  3061. thisInfo.active = true;
  3062. console.log("hi");
  3063. })
  3064. myWS();
  3065. setInterval(() => {
  3066. if (localStorage.isxyzAllowed && thisNetwork.getdisconnected()) {
  3067. thisNetwork.reconnect();
  3068. }
  3069. }, 5000);
  3070.  
  3071. // great auto pet heal
  3072.  
  3073. let petTokens = {
  3074. 1: 100,
  3075. 2: 100,
  3076. 3: 100,
  3077. 4: 100,
  3078. 5: 200,
  3079. 6: 200,
  3080. 7: 300,
  3081. 8: Infinity
  3082. }
  3083. let myPet = {};
  3084. window.petheal = false;
  3085. window.autoRevivePets = false; // set this to true if u want Auto Revive pet.
  3086. let heallevel = 70;
  3087. let entitiesHealth = {};
  3088. game.network.addEntityUpdateHandler((data) => {
  3089. if (game.ui.playerTick.petUid) {
  3090. window.activated = true;
  3091. if (data.entities[game.ui.playerTick.petUid]) {
  3092. if (data.entities[game.ui.playerTick.petUid].uid) {
  3093. myPet = game.world.entities[game.ui.playerTick.petUid].fromTick;
  3094. if (game.world.entities[game.ui.playerTick.petUid]) {
  3095. let isTokenHealing = false;
  3096. if (myPet.model == window.model && myPet.tier == window.tier && (myPet.health/myPet.maxHealth)*100 <= 95 && (myPet.health/myPet.maxHealth)*100 > 0 && game.ui.playerTick.token >= petTokens[myPet.tier] && game.ui.playerTick.petUid) {
  3097. game.network.sendRpc({name: "BuyItem", itemName: myPet.model, tier: myPet.tier + 1});
  3098. isTokenHealing = true;
  3099. }
  3100. if (window.petheal && !isTokenHealing) {
  3101. if ((myPet.health/myPet.maxHealth) * 100 < heallevel && (myPet.health/myPet.maxHealth) * 100 > 0) {
  3102. if (!window.healPet) {
  3103. game.network.sendRpc({name: "BuyItem", itemName: "PetHealthPotion", tier: 1})
  3104. game.network.sendRpc({name: "EquipItem", itemName: "PetHealthPotion", tier: 1})
  3105. window.healPet = true;
  3106. setTimeout(() => {
  3107. window.healPet = false;
  3108. }, 300);
  3109. }
  3110. }
  3111. }
  3112. if (window.model !== myPet.model) window.model = myPet.model;
  3113. if (window.tier !== myPet.tier) window.tier = myPet.tier;
  3114. }
  3115. }
  3116. }
  3117. }
  3118. if (window.autoRevivePets && window.activated) {
  3119. game.network.sendRpc({name: "BuyItem", itemName: "PetRevive", tier: 1});
  3120. game.network.sendRpc({name: "EquipItem", itemName: "PetRevive", tier: 1});
  3121. }
  3122. })
  3123.  
  3124. // player info + attempt to make it possible not laggy like before's
  3125.  
  3126. let getRss = false;
  3127. let allowed1 = true;
  3128.  
  3129. function msToTime(s) {
  3130.  
  3131. // Pad to 2 or 3 digits, default is 2
  3132. function pad(n, z) {
  3133. z = z || 2;
  3134. return ('00' + n).slice(-z);
  3135. }
  3136.  
  3137. var ms = s % 1000;
  3138. s = (s - ms) / 1000;
  3139. var secs = s % 60;
  3140. s = (s - secs) / 60;
  3141. var mins = s % 60;
  3142. var hrs = (s - mins) / 60;
  3143.  
  3144. return pad(hrs) + ':' + pad(mins) + ':' + pad(secs) + '.' + pad(ms, 3);
  3145. }
  3146.  
  3147. game.network.addEntityUpdateHandler(() => {
  3148. if (getRss) {
  3149. !allowed1 && (allowed1 = true);
  3150. }
  3151. if (getRss || allowed1) {
  3152. for (let i in game.world.entities) {
  3153. if (game.world.entities[i].fromTick.name) {
  3154. let player = game.world.entities[i];
  3155. let wood_1 = counter(player.targetTick.wood);
  3156. let stone_1 = counter(player.targetTick.stone);
  3157. let gold_1 = counter(player.targetTick.gold);
  3158. let token_1 = counter(player.targetTick.token);
  3159. let px_1 = counter(player.targetTick.position.x);
  3160. let py_1 = counter(player.targetTick.position.y);
  3161. if (getRss && !player.targetTick.oldName) {
  3162. player.targetTick.oldName = player.targetTick.name;
  3163. player.targetTick.oldWood = wood_1;
  3164. player.targetTick.oldStone = stone_1;
  3165. player.targetTick.oldGold = gold_1;
  3166. player.targetTick.oldToken = token_1;
  3167. player.targetTick.oldPX = px_1;
  3168. player.targetTick.oldPY = py_1;
  3169. player.targetTick.info = `${player.targetTick.oldName}, UID: ${player.targetTick.uid}, W: ${wood_1}, S: ${stone_1}, G: ${gold_1}, T: ${token_1};\nx: ${Math.round(player.targetTick.position.x)}, y: ${Math.round(player.targetTick.position.y)}, partyId: ${Math.round(player.targetTick.partyId)};
  3170. score: ${player.targetTick.score}, timeDead: ${msToTime(player.targetTick.timeDead)};
  3171.  
  3172. `;
  3173. player.targetTick.name = game.world.entities[i].targetTick.info;
  3174. }
  3175. if (!getRss && player.targetTick.oldName) {
  3176. player.targetTick.info = player.targetTick.oldName;
  3177. player.targetTick.name = game.world.entities[i].targetTick.info;
  3178. player.targetTick.oldName = null;
  3179. }
  3180. if (getRss) {
  3181. if (player.targetTick.oldGold !== gold_1 || player.targetTick.oldWood !== wood_1 || player.targetTick.oldStone !== stone_1 || player.targetTick.oldToken !== token_1 || player.targetTick.oldPX !== px_1 || player.targetTick.oldPY !== py_1) {
  3182. player.targetTick.oldWood = wood_1;
  3183. player.targetTick.oldStone = stone_1;
  3184. player.targetTick.oldGold = gold_1;
  3185. player.targetTick.oldToken = token_1;
  3186. player.targetTick.oldPX = px_1;
  3187. player.targetTick.oldPY = py_1;
  3188. player.targetTick.info = `${player.targetTick.oldName}, UID: ${player.targetTick.uid}, W: ${wood_1}, S: ${stone_1}, G: ${gold_1}, T: ${token_1};\nx: ${Math.round(player.targetTick.position.x)}, y: ${Math.round(player.targetTick.position.y)}, partyId: ${Math.round(player.targetTick.partyId)};
  3189. score: ${player.targetTick.score}, timeDead: ${msToTime(player.targetTick.timeDead)};
  3190.  
  3191. `;
  3192. player.targetTick.name = game.world.entities[i].targetTick.info;
  3193. }
  3194. }
  3195. }
  3196. }
  3197. }
  3198. if (!getRss) {
  3199. allowed1 = false;
  3200. }
  3201. })
  3202.  
  3203. function counter(e = 0) {
  3204. if (e <= -0.99949999999999999e12) {
  3205. return Math.round(e/-1e11)/-10 + "T";
  3206. }
  3207. if (e <= -0.99949999999999999e9) {
  3208. return Math.round(e/-1e8)/-10 + "B";
  3209. }
  3210. if (e <= -0.99949999999999999e6) {
  3211. return Math.round(e/-1e5)/-10 + "M";
  3212. }
  3213. if (e <= -0.99949999999999999e3) {
  3214. return Math.round(e/-1e2)/-10 + "K";
  3215. }
  3216. if (e <= 0.99949999999999999e3) {
  3217. return Math.round(e) + "";
  3218. }
  3219. if (e <= 0.99949999999999999e6) {
  3220. return Math.round(e/1e2)/10 + "K";
  3221. }
  3222. if (e <= 0.99949999999999999e9) {
  3223. return Math.round(e/1e5)/10 + "M";
  3224. }
  3225. if (e <= 0.99949999999999999e12) {
  3226. return Math.round(e/1e8)/10 + "B";
  3227. }
  3228. if (e <= 0.99949999999999999e15) {
  3229. return Math.round(e/1e11)/10 + "T";
  3230. }
  3231. }
  3232.  
  3233. /*** EH ***/
  3234. document.addEventListener("keydown", e => {
  3235. if(document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  3236. if (e.keyCode == 189) { // key -
  3237. getRss = !getRss;
  3238. new Noty({
  3239. type: 'success',
  3240. text: `RSS Above Head toggle is now ${getRss}`,
  3241. timeout: 2000
  3242. }).show();
  3243. }
  3244. if (e.key.toLowerCase() == "f" && e.shiftKey) {
  3245. window.petheal = !window.petheal;
  3246. new Noty({
  3247. type: 'success',
  3248. text: `Pet Heal toggle is now ${window.petheal}`,
  3249. timeout: 2000
  3250. }).show();
  3251. };
  3252. if (e.key.toLowerCase() == "p" && e.shiftKey) {
  3253. if(window.follow.toggle) {
  3254. window.follow = { toggle: false };
  3255. } else {
  3256. window.follow = { toggle: true, np: true };
  3257. };
  3258. window.lm = window.follow.toggle ? "Nearest Player" : "Off";
  3259. dispatchEvent(new CustomEvent("efToggleByKeybind"));
  3260. new Noty({
  3261. type: 'success',
  3262. text: `Nearest Player Follower toggle is now ${window.follow.toggle}`,
  3263. timeout: 2000
  3264. }).show();
  3265. };
  3266. if(e.key === "z") {
  3267. window.x3builds = !window.x3builds;
  3268. new Noty({
  3269. type: 'success',
  3270. text: `3x3 Walls toggle is now ${window.x3builds}`,
  3271. timeout: 2000
  3272. }).show();
  3273. };
  3274. if(e.key === "x") {
  3275. window.x5builds = !window.x5builds;
  3276. new Noty({
  3277. type: 'success',
  3278. text: `5x5 Walls toggle is now ${window.x5builds}`,
  3279. timeout: 2000
  3280. }).show();
  3281. };
  3282. if(e.key === "c") {
  3283. window.x7builds = !window.x7builds;
  3284. new Noty({
  3285. type: 'success',
  3286. text: `7x7 Walls toggle is now ${window.x7builds}`,
  3287. timeout: 2000
  3288. }).show();
  3289. };
  3290. };
  3291. });
  3292. document.addEventListener('keyup', function(e) {
  3293. if (e.key.toLowerCase() == "p" && e.shiftKey) {
  3294. document.getElementsByClassName("hud-menu-party")[0].style.display = "none";
  3295. };
  3296. });
  3297.  
  3298. window.stashspawn = psk => {
  3299. let socketIndex = 0;
  3300.  
  3301. let nextSocket = () => {
  3302. if(socketIndex < (sockets.length - 1)) {
  3303. return sockets[socketIndex+++1];
  3304. };
  3305. };
  3306.  
  3307. let currentSocket = sockets[0];
  3308.  
  3309. let action = () => {
  3310. if(currentSocket.dead) {
  3311. currentSocket.network.sendRpc({ name: "JoinPartyByShareKey", partyShareKey: psk });
  3312. currentSocket.addOnPsk(() => {
  3313. if(socketIndex === (sockets.length - 1)) { return; };
  3314. currentSocket.network.sendInput({ respawn: 1 });
  3315. currentSocket.network.sendRpc({ name: "LeaveParty" });
  3316. currentSocket = nextSocket();
  3317. action();
  3318. });
  3319. };
  3320. };
  3321.  
  3322. action();
  3323. };
  3324.  
  3325. (function() { // modified private parties tab code, except the new tab in the party menu is used differently (not private parties)
  3326. let getElement = (Element) => {
  3327. return document.getElementsByClassName(Element);
  3328. }
  3329. let getId = (Element) => {
  3330. return document.getElementById(Element);
  3331. }
  3332.  
  3333.  
  3334. getElement("hud-party-members")[0].style.display = "block";
  3335. getElement("hud-party-grid")[0].style.display = "none";
  3336.  
  3337. let privateTab = document.createElement("a");
  3338. privateTab.className = "hud-party-tabs-link";
  3339. privateTab.id = "privateTab";
  3340. privateTab.innerHTML = "Party Tools";
  3341.  
  3342. let privateHud = document.createElement("div");
  3343. privateHud.className = "hud-private hud-party-grid";
  3344. privateHud.id = "privateHud";
  3345. privateHud.style = "display: none;";
  3346. getElement("hud-party-tabs")[0].appendChild(privateTab);
  3347. getElement("hud-menu hud-menu-party")[0].insertBefore(privateHud, getElement("hud-party-actions")[0]);
  3348.  
  3349. getId("privateTab").onclick = e => {
  3350. getId("privateHud2").style.display = "none";
  3351. for (let i = 0; i < getElement("hud-party-tabs-link").length; i++) {
  3352. getElement("hud-party-tabs-link")[i].className = "hud-party-tabs-link";
  3353. }
  3354. getId("privateTab").className = "hud-party-tabs-link is-active";
  3355. getId("privateHud").setAttribute("style", "display: block;");
  3356. if (getElement("hud-party-members")[0].getAttribute("style") == "display: block;") {
  3357. getElement("hud-party-members")[0].setAttribute("style", "display: none;");
  3358. }
  3359. if (getElement("hud-party-grid")[0].getAttribute("style") == "display: block;") {
  3360. getElement("hud-party-grid")[0].setAttribute("style", "display: none;");
  3361. }
  3362. if (getId("privateHud").getAttribute("style") == "display: none;") {
  3363. getId("privateHud").setAttribute("style", "display: block;");
  3364. }
  3365. }
  3366.  
  3367. getElement("hud-party-tabs-link")[0].onmouseup = e => {
  3368. getId("privateHud").setAttribute("style", "display: none;");
  3369. if (getId("privateTab").className == "hud-party-tabs-link is-active") {
  3370. getId("privateTab").className = "hud-party-tabs-link"
  3371. }
  3372. }
  3373.  
  3374. getElement("hud-party-tabs-link")[1].onmouseup = e => {
  3375. getId("privateHud").setAttribute("style", "display: none;");
  3376. if (getId("privateTab").className == "hud-party-tabs-link is-active") {
  3377. getId("privateTab").className = "hud-party-tabs-link"
  3378. }
  3379. }
  3380. getId("privateHud").innerHTML = `
  3381. <h1>Party Tools</h1>
  3382. <input id="psk" placeholder="Party share key..." value="abcdefghijklmnopqr" class="btn" /><button class="btn btn-grey" onclick="game.network.sendRpc({ name: 'JoinPartyByShareKey', partyShareKey: document.getElementById('psk').value })">Join Party by Share Key (1)</button>
  3383. <input id="psk2" placeholder="Party share key (2)..." value="qwertyuiopasdfghjk" class="btn" /><button class="btn btn-grey" onclick="game.network.sendRpc({ name: 'JoinPartyByShareKey', partyShareKey: document.getElementById('psk2').value })">Join Party by Share Key (2)</button>
  3384. <input id="psk3" placeholder="Party share key (3)..." value="klzxcvbnmlkjhgfdsa" class="btn" /><button class="btn btn-grey" onclick="game.network.sendRpc({ name: 'JoinPartyByShareKey', partyShareKey: document.getElementById('psk3').value })">Join Party by Share Key (3)</button>
  3385. <br />
  3386. <button class="btn btn-red" onclick="game.network.sendRpc({ name: 'LeaveParty' })">Leave Current Party</button>
  3387. `;
  3388.  
  3389. let privateTab2 = document.createElement("a");
  3390. privateTab2.className = "hud-party-tabs-link";
  3391. privateTab2.id = "privateTab2";
  3392. privateTab2.innerHTML = "Share Keys";
  3393.  
  3394. let privateHud2 = document.createElement("div");
  3395. privateHud2.className = "hud-private hud-party-grid";
  3396. privateHud2.id = "privateHud2";
  3397. privateHud2.style = "display: none;";
  3398. getElement("hud-party-tabs")[0].appendChild(privateTab2);
  3399. getElement("hud-menu hud-menu-party")[0].insertBefore(privateHud2, getElement("hud-party-actions")[0]);
  3400.  
  3401. getId("privateTab2").onclick = e => {
  3402. getId("privateHud").style.display = "none";
  3403. for (let i = 0; i < getElement("hud-party-tabs-link").length; i++) {
  3404. getElement("hud-party-tabs-link")[i].className = "hud-party-tabs-link";
  3405. }
  3406. getId("privateTab2").className = "hud-party-tabs-link is-active";
  3407. getId("privateHud2").setAttribute("style", "display: block;");
  3408. if (getElement("hud-party-members")[0].getAttribute("style") == "display: block;") {
  3409. getElement("hud-party-members")[0].setAttribute("style", "display: none;");
  3410. }
  3411. if (getElement("hud-party-grid")[0].getAttribute("style") == "display: block;") {
  3412. getElement("hud-party-grid")[0].setAttribute("style", "display: none;");
  3413. }
  3414. if (getId("privateHud2").getAttribute("style") == "display: none;") {
  3415. getId("privateHud2").setAttribute("style", "display: block;");
  3416. }
  3417. }
  3418.  
  3419. getElement("hud-party-tabs-link")[0].onmouseup = e => {
  3420. getId("privateHud2").setAttribute("style", "display: none;");
  3421. if (getId("privateTab2").className == "hud-party-tabs-link is-active") {
  3422. getId("privateTab2").className = "hud-party-tabs-link"
  3423. }
  3424. }
  3425.  
  3426. getElement("hud-party-tabs-link")[1].onmouseup = e => {
  3427. getId("privateHud2").setAttribute("style", "display: none;");
  3428. if (getId("privateTab2").className == "hud-party-tabs-link is-active") {
  3429. getId("privateTab2").className = "hud-party-tabs-link"
  3430. }
  3431. }
  3432. getId("privateHud2").innerHTML = `
  3433. <h1>Share Keys</h1>
  3434. `;
  3435. game.network.addRpcHandler("PartyShareKey", function(e) {
  3436. let cpKeyId = `skl${Math.floor(Math.random() * 999999)}`;
  3437. let cpLnkId = `skl${Math.floor(Math.random() * 999999)}`;
  3438. let psk = e.partyShareKey;
  3439. let lnk = `http://zombs.io/#/${game.options.serverId}/${psk}/`;
  3440. getId("privateHud2").innerHTML += `<div style="display:inline-block;margin-right:10px;"><p>${psk} <a href="${lnk}" target="_blank" color="red">[Link]</a></p></div><button class="btn btn-red" id="${cpKeyId}" style="display:inline-block;" onclick="window.copyText('${psk}');">Copy Key</button><button class="btn btn-red" id="${cpLnkId}" style="display:inline-block;" onclick="window.copyText('${lnk}');">Copy Link</button><br />`;
  3441. });
  3442.  
  3443. // ^ share keys feature originally from 444x3
  3444.  
  3445. document.getElementsByClassName('hud-party-tabs-link')[0].onclick = () => { getId("privateHud").style.display = "none"; getId("privateTab").classList.remove("is-active"); };
  3446. document.getElementsByClassName('hud-party-tabs-link')[1].onclick = () => { getId("privateHud").style.display = "none"; getId("privateTab").classList.remove("is-active"); };
  3447. })();
  3448.  
  3449. // Button selector UI with curves, by ehScripts
  3450.  
  3451. window.BS = class BS {
  3452. constructor(options) {
  3453. let _this = this;
  3454. this.elem = document.createElement("div");
  3455. this.buttons = [];
  3456. this.getButtonByName = name => _this.buttons.find(btn => btn.data.name === name);
  3457. this.select = name => {
  3458. let btn = _this.getButtonByName(name);
  3459. _this.selected = name;
  3460. btn.elem.innerText = `> ${btn.data.name}`;
  3461. for(let b of _this.buttons) {
  3462. if(b.data.name !== btn.data.name) {
  3463. b.elem.innerText = b.data.name;
  3464. };
  3465. };
  3466. };
  3467. let PRIVATE = {
  3468. addSelectorFunctionality: (elem, data) => {
  3469. elem.addEventListener("click", function() {
  3470. _this.select(data.name);
  3471. if(data.onselect) { data.onselect(); };
  3472. });
  3473. _this.buttons.push({
  3474. elem: elem,
  3475. data: data
  3476. });
  3477. },
  3478. addLeftButton: data => {
  3479. let btn = document.createElement("button");
  3480. btn.classList.add("btn");
  3481. btn.classList.add(`btn-${data.color}`);
  3482. btn.classList.add("btn-curve-left");
  3483. btn.innerText = data.name;
  3484. PRIVATE.addSelectorFunctionality(btn, data);
  3485. _this.elem.append(btn);
  3486. },
  3487. addRightButton: data => {
  3488. let btn = document.createElement("button");
  3489. btn.classList.add("btn");
  3490. btn.classList.add(`btn-${data.color}`);
  3491. btn.classList.add("btn-curve-right");
  3492. btn.style.marginTop = "3px";
  3493. btn.style.marginLeft = "3px";
  3494. btn.innerText = data.name;
  3495. PRIVATE.addSelectorFunctionality(btn, data);
  3496. _this.elem.append(btn);
  3497. },
  3498. addButton: data => {
  3499. let btn = document.createElement("button");
  3500. btn.classList.add("btn");
  3501. btn.classList.add(`btn-${data.color}`);
  3502. btn.innerText = data.name;
  3503. PRIVATE.addSelectorFunctionality(btn, data);
  3504. _this.elem.append(btn);
  3505. },
  3506. addDoubleSidedButton: data => {
  3507. let btn = document.createElement("button");
  3508. btn.classList.add("btn");
  3509. btn.classList.add(`btn-${data.color}`);
  3510. btn.classList.add("btn-curve-right");
  3511. btn.classList.add("btn-curve-left");
  3512. btn.innerText = data.name;
  3513. PRIVATE.addSelectorFunctionality(btn, data);
  3514. _this.elem.append(btn);
  3515. }
  3516. };
  3517. if(options.length === 1) { PRIVATE.addDoubleSidedButton(options[0]); } else {
  3518. for(let o in options) {
  3519. let opt = options[o];
  3520. console.log(opt);
  3521. if(o == 0) { PRIVATE.addLeftButton(opt); }
  3522. else if(o == (options.length - 1)) { PRIVATE.addRightButton(opt); }
  3523. else { PRIVATE.addButton(opt); };
  3524. };
  3525. };
  3526. };
  3527. };
  3528.  
  3529. const fullRSS = () => {
  3530. if(!window.frss) { return; };
  3531. let resources = ["wood", "stone", "gold"];
  3532. let pt = game.ui.playerTick;
  3533. let rc = game.ui.components.Resources;
  3534. for(let i = 0; i < resources.length; i++) {
  3535. let rs = resources[i];
  3536. rc[`${rs}Elem`].innerHTML = Math.round(pt[rs]).toLocaleString("en");
  3537. };
  3538. rc.tokensElem.innerHTML = Math.round(pt.token).toLocaleString("en");
  3539. };
  3540.  
  3541. let sipt = setInterval(() => {
  3542. game.ui.addListener('playerTickUpdate', fullRSS);
  3543. }, 10);
  3544.  
  3545. setTimeout(() => { clearInterval(sipt); }, 90);
  3546.  
  3547. /*** TROLLERS ***/
  3548.  
  3549. isOnOrNot = false;
  3550. stashhitalarm = false;
  3551. deadalarm = false;
  3552. disconnectalarm = false;
  3553. health65palarm = false;
  3554. onlyOpenOnceOnTimeout = false;
  3555. pingalarm = false;
  3556. tower65palarm = false;
  3557.  
  3558. game.network.addRpcHandler("LocalBuilding", e => {
  3559. for (let i in e) {
  3560. if (e[i].dead) {
  3561. if (e[i].type !== "Wall" && e[i].type !== "Door") {
  3562. if (isOnOrNot) {
  3563. !onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 14000))
  3564. }
  3565. }
  3566. }
  3567. }
  3568. })
  3569.  
  3570. game.network.addEntityUpdateHandler((e) => {
  3571. let gl = GetGoldStash();
  3572. if (gl) {
  3573. if (e.entities[gl.uid]) {
  3574. if (e.entities[gl.uid].health !== e.entities[gl.uid].maxHealth) {
  3575. if (stashhitalarm) {
  3576. !onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 24000))
  3577. }
  3578. }
  3579. }
  3580. }
  3581. if (e.entities[game.world.myUid]) {
  3582. if (e.entities[game.world.myUid].health) {
  3583. if ((e.entities[game.world.myUid].health / 500) * 100 < 65) {
  3584. if (health65palarm) {
  3585. !onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 24000));
  3586. }
  3587. }
  3588. }
  3589. }
  3590. if((game.network.ping > 2000) && pingalarm) {
  3591. !onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 14000))
  3592. };
  3593. for (let i in e.entities) {
  3594. if (e.entities[i].partyId == game.ui.playerTick.partyId) {
  3595. if (e.entities[i].model == "Harvester" || e.entities[i].model == "ArrowTower" || e.entities[i].model == "CannonTower" || e.entities[i].model == "BombTower" || e.entities[i].model == "MagicTower" || e.entities[i].model == "MeleeTower") {
  3596. entitiesHealth[e.entities[i].uid] = {uid: e.entities[i].uid, health: e.entities[i].health, maxHealth: e.entities[i].maxHealth}
  3597. }
  3598. }
  3599. if (entitiesHealth[i]) {
  3600. e.entities[i].health && (entitiesHealth[i].health = e.entities[i].health);
  3601. e.entities[i].maxHealth && (entitiesHealth[i].maxHealth = e.entities[i].maxHealth);
  3602. }
  3603. }
  3604. for (let i in entitiesHealth) {
  3605. if ((entitiesHealth[i].health / entitiesHealth[i].maxHealth) * 100 < 65) {
  3606. if (tower65palarm) {
  3607. !onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 30000))
  3608. }
  3609. }
  3610. if (!e.entities[i]) {
  3611. delete entitiesHealth[i];
  3612. }
  3613. }
  3614. })
  3615.  
  3616. game.network.addRpcHandler("Dead", () => {
  3617. if (deadalarm) {
  3618. !onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 14000))
  3619. }
  3620. })
  3621.  
  3622. game.network.addCloseHandler(() => {
  3623. if (disconnectalarm) {
  3624. !onlyOpenOnceOnTimeout && (onlyOpenOnceOnTimeout = true, videoalert(), setTimeout(() => {onlyOpenOnceOnTimeout = false}, 14000))
  3625. }
  3626. })
  3627.  
  3628. videoalert = () => {
  3629. let a = new Audio();
  3630. a.src = "https://cdn.discordapp.com/attachments/870020008128958525/871587235324117052/Canadian_EAS_Alarm_EXTREME_LOUD.mp3"
  3631. a.volume = 1;
  3632. a.play();
  3633. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Stop Alert?", 10000, function() {
  3634. a.pause();
  3635. })
  3636. setTimeout(() => {
  3637. a.pause();
  3638. }, 30000);
  3639. }
  3640.  
  3641. alarm = () => {
  3642. isOnOrNot = !isOnOrNot;
  3643.  
  3644. document.getElementsByClassName("alarm")[0].innerText = document.getElementsByClassName("alarm")[0].innerText.replace(isOnOrNot ? "Enable" : "Disable", isOnOrNot ? "Disable" : "Enable");
  3645.  
  3646. document.getElementsByClassName("alarm")[0].className = document.getElementsByClassName("alarm")[0].className.replace(isOnOrNot ? "grey" : "red", isOnOrNot ? "red" : "grey");
  3647.  
  3648. }
  3649.  
  3650. stashHitAlarm = () => {
  3651. stashhitalarm = !stashhitalarm;
  3652.  
  3653. document.getElementsByClassName("stashHitAlarm")[0].innerText = document.getElementsByClassName("stashHitAlarm")[0].innerText.replace(stashhitalarm ? "Enable" : "Disable", stashhitalarm ? "Disable" : "Enable");
  3654.  
  3655. document.getElementsByClassName("stashHitAlarm")[0].className = document.getElementsByClassName("stashHitAlarm")[0].className.replace(stashhitalarm ? "grey" : "red", stashhitalarm ? "red" : "grey");
  3656.  
  3657. }
  3658.  
  3659. deadAlarm = () => {
  3660. deadalarm = !deadalarm;
  3661.  
  3662. document.getElementsByClassName("deadAlarm")[0].innerText = document.getElementsByClassName("deadAlarm")[0].innerText.replace(deadalarm ? "Enable" : "Disable", deadalarm ? "Disable" : "Enable");
  3663.  
  3664. document.getElementsByClassName("deadAlarm")[0].className = document.getElementsByClassName("deadAlarm")[0].className.replace(deadalarm ? "grey" : "red", deadalarm ? "red" : "grey");
  3665.  
  3666. }
  3667.  
  3668. disconnectAlarm = () => {
  3669. disconnectalarm = !disconnectalarm;
  3670.  
  3671. document.getElementsByClassName("disconnectAlarm")[0].innerText = document.getElementsByClassName("disconnectAlarm")[0].innerText.replace(disconnectalarm ? "Enable" : "Disable", disconnectalarm ? "Disable" : "Enable");
  3672.  
  3673. document.getElementsByClassName("disconnectAlarm")[0].className = document.getElementsByClassName("disconnectAlarm")[0].className.replace(disconnectalarm ? "grey" : "red", disconnectalarm ? "red" : "grey");
  3674.  
  3675. }
  3676.  
  3677. health65pAlarm = () => {
  3678. health65palarm = !health65palarm;
  3679.  
  3680. document.getElementsByClassName("health65pAlarm")[0].innerText = document.getElementsByClassName("health65pAlarm")[0].innerText.replace(health65palarm ? "Enable" : "Disable", health65palarm ? "Disable" : "Enable");
  3681.  
  3682. document.getElementsByClassName("health65pAlarm")[0].className = document.getElementsByClassName("health65pAlarm")[0].className.replace(health65palarm ? "grey" : "red", health65palarm ? "red" : "grey");
  3683.  
  3684. }
  3685.  
  3686. pingAlarm = () => {
  3687. pingalarm = !pingalarm;
  3688.  
  3689. document.getElementsByClassName("pingAlarm")[0].innerText = document.getElementsByClassName("pingAlarm")[0].innerText.replace(pingalarm ? "Enable" : "Disable", pingalarm ? "Disable" : "Enable");
  3690.  
  3691. document.getElementsByClassName("pingAlarm")[0].className = document.getElementsByClassName("pingAlarm")[0].className.replace(pingalarm ? "grey" : "red", pingalarm ? "red" : "grey");
  3692.  
  3693. }
  3694.  
  3695. tower65pAlarm = () => {
  3696. tower65palarm = !tower65palarm;
  3697.  
  3698. document.getElementsByClassName("tower65pAlarm")[0].innerText = document.getElementsByClassName("tower65pAlarm")[0].innerText.replace(tower65palarm ? "Enable" : "Disable", tower65palarm ? "Disable" : "Enable");
  3699.  
  3700. document.getElementsByClassName("tower65pAlarm")[0].className = document.getElementsByClassName("tower65pAlarm")[0].className.replace(tower65palarm ? "grey" : "red", tower65palarm ? "red" : "grey");
  3701.  
  3702. }
  3703.  
  3704. GetGoldStash = () => {
  3705. for (let i in game.ui.buildings) {
  3706. if (game.ui.buildings[i].type == "GoldStash") {
  3707. return game.ui.buildings[i];
  3708. }
  3709. }
  3710. }
  3711.  
  3712. let blockedNames = [];
  3713.  
  3714. window.blockPlayer = name => {
  3715. game.ui.components.PopupOverlay.showConfirmation(`Are you sure you want to block ${name}?`, 3500, () => {
  3716. blockedNames.push(name);
  3717. for(let msg of Array.from(document.getElementsByClassName("hud-chat-message"))) {
  3718. if(msg.childNodes[2].innerText === name) {
  3719. let bl = msg.childNodes[0];
  3720. bl.innerHTML = "Unblock";
  3721. bl.style.color = "red";
  3722. bl.onclick = () => {
  3723. window.unblockPlayer(name);
  3724. };
  3725. };
  3726. };
  3727. }, () => {});
  3728. };
  3729.  
  3730. window.unblockPlayer = name => {
  3731. blockedNames.splice(blockedNames.indexOf(name), 1);
  3732. for(let msg of Array.from(document.getElementsByClassName("hud-chat-message"))) {
  3733. if(msg.childNodes[2].innerText === name) {
  3734. let bl = msg.childNodes[0];
  3735. bl.innerHTML = "Block";
  3736. bl.style.color = "red";
  3737. bl.onclick = () => {
  3738. window.blockPlayer(name);
  3739. };
  3740. };
  3741. };
  3742. };
  3743.  
  3744. const getClock = () => {
  3745. var date = new Date();
  3746. var d = date.getDate();
  3747. var d1 = date.getDay();
  3748. var h = date.getHours();
  3749. var m = date.getMinutes();
  3750. var s = date.getSeconds()
  3751. var session = "PM";
  3752.  
  3753. if(h == 2){
  3754. h = 12;
  3755. };
  3756.  
  3757. if(h < 13) {
  3758. session = "AM"
  3759. };
  3760. if(h > 12){
  3761. session = "PM";
  3762. h -= 12;
  3763. };
  3764.  
  3765. h = (h < 10) ? "0" + h : h;
  3766. m = (m < 10) ? "0" + m : m;
  3767. s = (s < 10) ? "0" + s : s;
  3768. return `${h}:${m} ${session}`;
  3769. }
  3770.  
  3771. Game.currentGame.network.emitter.removeListener("PACKET_RPC", Game.currentGame.network.emitter._events.PACKET_RPC[1]);
  3772. let onMessageReceived = (msg => {
  3773. if(blockedNames.includes(msg.displayName) || window.chatDisabled) { return; };
  3774. let a = Game.currentGame.ui.getComponent("Chat"),
  3775. b = msg.displayName.replace(/<(?:.|\n)*?>/gm, ''),
  3776. c = msg.message.replace(/<(?:.|\n)*?>/gm, ''),
  3777. d = a.ui.createElement(`<div class="hud-chat-message"><a href="javascript:void(0);" onclick="window.blockPlayer(\`${msg.displayName}\`)" style="color: red;">Block</a> <strong>${b}</strong> <small> at ${getClock()}</small>: ${c}</div>`);
  3778. a.messagesElem.appendChild(d);
  3779. a.messagesElem.scrollTop = a.messagesElem.scrollHeight;
  3780. })
  3781. Game.currentGame.network.addRpcHandler("ReceiveChatMessage", onMessageReceived);
  3782.  
  3783. window.toggleChat = () => {
  3784. window.chatDisabled = !window.chatDisabled;
  3785. let hcm = document.getElementsByClassName("hud-chat-messages")[0];
  3786. if(window.chatDisabled) {
  3787. window.oldChatHTML = hcm.innerHTML;
  3788. hcm.innerHTML = "<h1>Disabled Chat</h1>";
  3789. } else {
  3790. hcm.innerHTML = window.oldChatHTML;
  3791. };
  3792. };
  3793.  
  3794. const shouldKeep = uid => {
  3795. let entity = game.world.entities[uid];
  3796. if(["Tree", "Stone"].includes(entity.fromTick.model)) { return true; };
  3797. return false;
  3798. };
  3799.  
  3800. game.world.removeEntity2 = game.world.removeEntity;
  3801. game.world.removeEntity = (uid) => {
  3802. if (shouldKeep(uid)) return;
  3803. game.world.removeEntity2(uid);
  3804. };
  3805.  
  3806. window.httpGet = url => {
  3807. var xmlHttp = new XMLHttpRequest();
  3808. xmlHttp.open("GET", url, false); // false for synchronous request
  3809. xmlHttp.send();
  3810. return xmlHttp.responseText;
  3811. };
  3812.  
  3813. window.reGS = (username, password) => {
  3814. let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/register?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`);
  3815. if(k.startsWith("ERROR: ")) {
  3816. new Noty({
  3817. type: "error",
  3818. layout: "topRight",
  3819. text: k.replace("ERROR: ", ""),
  3820. timeout: 2000
  3821. }).show();
  3822. } else {
  3823. new Noty({
  3824. type: "success",
  3825. layout: "topRight",
  3826. text: k,
  3827. timeout: 2000
  3828. }).show();
  3829. document.getElementById("bfl").style.display = "none";
  3830. let act = document.getElementById("act");
  3831. act.style.display = "block";
  3832. document.getElementById("hiu").innerHTML = `Hello, ${username}`;
  3833. window.username = username;
  3834. localStorage.ig_auth = JSON.stringify({ username: username, password: password });
  3835. };
  3836. };
  3837.  
  3838. window.siGN = (username, password, al = true) => {
  3839. let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/login?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`);
  3840. if(k.startsWith("ERROR: ") && al) {
  3841. new Noty({
  3842. type: "error",
  3843. layout: "topRight",
  3844. text: k.replace("ERROR: ", ""),
  3845. timeout: 2000
  3846. }).show();
  3847. } else {
  3848. if(al) {
  3849. new Noty({
  3850. type: "success",
  3851. layout: "topRight",
  3852. text: k,
  3853. timeout: 2000
  3854. }).show();
  3855. };
  3856. document.getElementById("bfl").style.display = "none";
  3857. let act = document.getElementById("act");
  3858. act.style.display = "block";
  3859. document.getElementById("hiu").innerHTML = `Hello, ${username}`;
  3860. window.username = username;
  3861. localStorage.ig_auth = JSON.stringify({ username: username, password: password });
  3862. window.ud = JSON.parse(window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/user?username=${encodeURIComponent(username)}`));
  3863. };
  3864. };
  3865. window.toggleZoS = () => {
  3866. window.zoomonscroll = !window.zoomonscroll;
  3867. let zs = document.getElementById("zsd");
  3868. zs.style.display = zs.style.display == "none" ? "block" : "none";
  3869. };
  3870.  
  3871. window.zoomOut = () => {
  3872. let zs = document.getElementById("zoomSlider");
  3873. zs.value = parseInt(zs.value) + 1;
  3874. };
  3875. window.zoomIn = () => {
  3876. let zs = document.getElementById("zoomSlider");
  3877. zs.value = parseInt(zs.value) - 1;
  3878. };
  3879. window.resetZoom = () => {
  3880. document.getElementById("zoomSlider").value = 1;
  3881. };
  3882. window.sgNO = () => {
  3883. document.getElementById("act").style.display = "none";
  3884. document.getElementById("bfl").style.display = "block";
  3885. localStorage.ig_auth = undefined;
  3886. };
  3887.  
  3888. window.loadGopt = json => {
  3889. json.dbg ? game.debug.show() : game.debug.hide();
  3890. if(json.ssm) {
  3891. if(!window.ssModeToggle) {
  3892. window.ssMode();
  3893. };
  3894. } else if(window.ssModeToggle) {
  3895. window.ssMode();
  3896. };
  3897. if(json.zos) {
  3898. if(!window.zoomonscroll) {
  3899. window.toggleZoS();
  3900. };
  3901. } else if(window.zoomonscroll) {
  3902. window.toggleZoS();
  3903. };
  3904. if(json.ync) {
  3905. let hr = hexToRgb(json.ync);
  3906. game.world.localPlayer.entity.currentModel.nameEntity.setColor(hr[0], hr[1], hr[2]);
  3907. window.yncv = json.ync;
  3908. };
  3909. let hno = document.getElementsByClassName("hud-day-night-overlay")[0];
  3910. if(json.tad) {
  3911. if(hno.style.display !== "none") {
  3912. hno.style.display = "none";
  3913. };
  3914. } else if(hno.style.display === "none") {
  3915. hno.style.display = "block";
  3916. };
  3917. window.frss = !!json.frss;
  3918. if(json.cdt) {
  3919. if(!window.chatDisabled) {
  3920. window.toggleChat();
  3921. };
  3922. } else if(window.chatDisabled) {
  3923. window.toggleChat();
  3924. };
  3925. };
  3926.  
  3927. window.saveGopt = username => {
  3928. let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/gopt/save?username=${encodeURIComponent(username)}&gopt=${encodeURIComponent(JSON.stringify(window.gopt))}`);
  3929. if(k.startsWith("ERROR: ")) {
  3930. new Noty({
  3931. type: "error",
  3932. layout: "topRight",
  3933. text: k.replace("ERROR: ", ""),
  3934. timeout: 2000
  3935. }).show();
  3936. } else {
  3937. new Noty({
  3938. type: "success",
  3939. layout: "topRight",
  3940. text: k,
  3941. timeout: 2000
  3942. }).show();
  3943. };
  3944. };
  3945. window.loadGoptReq = username => {
  3946. let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/gopt/load?username=${encodeURIComponent(username)}`);
  3947. if(k.startsWith("ERROR: ")) {
  3948. new Noty({
  3949. type: "error",
  3950. layout: "topRight",
  3951. text: k.replace("ERROR: ", ""),
  3952. timeout: 2000
  3953. }).show();
  3954. } else {
  3955. new Noty({
  3956. type: "success",
  3957. layout: "topRight",
  3958. text: "Successfully loaded Game Options from your account.",
  3959. timeout: 2000
  3960. }).show();
  3961. window.loadGopt(JSON.parse(k));
  3962. };
  3963. };
  3964.  
  3965. window.rmw = () => {
  3966. for(let sck of sockets) {
  3967. if(!sck.iframe && !sck.closed) {
  3968. sck.close();
  3969. sck.closed = true;
  3970. window.nlt--;
  3971. };
  3972. };
  3973. window.focusTab(window.focusedTab, { pche: window.getTabDataByType("alts").cache, nlt: window.nlt, si: window.si });
  3974. new Noty({
  3975. type: "success",
  3976. layout: "topRight",
  3977. text: "Successfully removed all WebSockets",
  3978. timeout: 2000
  3979. }).show();
  3980. };
  3981. window.rmi = () => {
  3982. for(let sck of sockets) {
  3983. if(sck.iframe && !sck.closed) {
  3984. sck.close();
  3985. sck.closed = true;
  3986. window.nlt--;
  3987. };
  3988. };
  3989. window.focusTab(window.focusedTab, { pche: window.getTabDataByType("alts").cache, nlt: window.nlt, si: window.si });
  3990. new Noty({
  3991. type: "success",
  3992. layout: "topRight",
  3993. text: "Successfully removed all iFrames",
  3994. timeout: 2000
  3995. }).show();
  3996. };
  3997. window.rma = () => {
  3998. for(let sck of sockets) {
  3999. if(sck.closed) { continue; };
  4000. sck.close();
  4001. sck.closed = true;
  4002. window.nlt--;
  4003. };
  4004. window.focusTab(window.focusedTab, { pche: window.getTabDataByType("alts").cache, nlt: window.nlt, si: window.si });
  4005. new Noty({
  4006. type: "success",
  4007. layout: "topRight",
  4008. text: "Successfully removed all WebSockets",
  4009. timeout: 2000
  4010. }).show();
  4011. };
  4012.  
  4013. var Vector = function(x, y) {
  4014. this.x = x || 0;
  4015. this.y = y || 0;
  4016. };
  4017.  
  4018. // return the angle of the vector in radians
  4019. Vector.prototype.getDirection = function() {
  4020. return Math.atan2(this.y, this.x);
  4021. };
  4022.  
  4023. // set the direction of the vector in radians
  4024. Vector.prototype.setDirection = function(direction) {
  4025. var magnitude = this.getMagnitude();
  4026. this.x = Math.cos(direction) * magnitude;
  4027. this.y = Math.sin(direction) * magnitude;
  4028. };
  4029.  
  4030. // get the magnitude of the vector
  4031. Vector.prototype.getMagnitude = function() {
  4032. // use pythagoras theorem to work out the magnitude of the vector
  4033. return Math.sqrt(this.x * this.x + this.y * this.y);
  4034. };
  4035.  
  4036. // set the magnitude of the vector
  4037. Vector.prototype.setMagnitude = function(magnitude) {
  4038. var direction = this.getDirection();
  4039. this.x = Math.cos(direction) * magnitude;
  4040. this.y = Math.sin(direction) * magnitude;
  4041. };
  4042.  
  4043. // add two vectors together and return a new one
  4044. Vector.prototype.add = function(v2) {
  4045. return new Vector(this.x + v2.x, this.y + v2.y);
  4046. };
  4047.  
  4048. // add a vector to this one
  4049. Vector.prototype.addTo = function(v2) {
  4050. this.x += v2.x;
  4051. this.y += v2.y;
  4052. };
  4053.  
  4054. // subtract two vectors and reutn a new one
  4055. Vector.prototype.subtract = function(v2) {
  4056. return new Vector(this.x - v2.x, this.y - v2.y);
  4057. };
  4058.  
  4059. // subtract a vector from this one
  4060. Vector.prototype.subtractFrom = function(v2) {
  4061. this.x -= v2.x;
  4062. this.y -= v2.y;
  4063. };
  4064.  
  4065. // multiply this vector by a scalar and return a new one
  4066. Vector.prototype.multiply = function(scalar) {
  4067. return new Vector(this.x * scalar, this.y * scalar);
  4068. };
  4069.  
  4070. // multiply this vector by the scalar
  4071. Vector.prototype.multiplyBy = function(scalar) {
  4072. this.x *= scalar;
  4073. this.y *= scalar;
  4074. };
  4075.  
  4076. // scale this vector by scalar and return a new vector
  4077. Vector.prototype.divide = function(scalar) {
  4078. return new Vector(this.x / scalar, this.y / scalar);
  4079. };
  4080.  
  4081. // scale this vector by scalar
  4082. Vector.prototype.divideBy = function(scalar) {
  4083. this.x /= scalar;
  4084. this.y /= scalar;
  4085. };
  4086.  
  4087. // Aliases
  4088. Vector.prototype.getLength = Vector.prototype.getMagnitude;
  4089. Vector.prototype.setLength = Vector.prototype.setMagnitude;
  4090.  
  4091. Vector.prototype.getAngle = Vector.prototype.getDirection;
  4092. Vector.prototype.setAngle = Vector.prototype.setDirection;
  4093.  
  4094. // Utilities
  4095. Vector.prototype.copy = function() {
  4096. return new Vector(this.x, this.y);
  4097. };
  4098.  
  4099. Vector.prototype.toString = function() {
  4100. return 'x: ' + this.x + ', y: ' + this.y;
  4101. };
  4102.  
  4103. Vector.prototype.toArray = function() {
  4104. return [this.x, this.y];
  4105. };
  4106.  
  4107. Vector.prototype.toObject = function() {
  4108. return {x: this.x, y: this.y};
  4109. };
  4110.  
  4111. const angleConverter = { radiansToDegrees: e => e * 180 / Math.PI, degreesToRadians: e => e / 180 * Math.PI };
  4112.  
  4113. window.freq = username => {
  4114. let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/friends/add?username=${encodeURIComponent(window.username)}&username2=${encodeURIComponent(username)}`);
  4115. if(k.startsWith("ERROR: ")) {
  4116. new Noty({
  4117. type: "error",
  4118. layout: "topRight",
  4119. text: k.replace("ERROR: ", ""),
  4120. timeout: 2000
  4121. }).show();
  4122. } else {
  4123. new Noty({
  4124. type: "success",
  4125. layout: "topRight",
  4126. text: k,
  4127. timeout: 2000
  4128. }).show();
  4129. };
  4130. };
  4131.  
  4132. window.rfUpg = () => {
  4133. let tab = getTabById(window.focusedTab);
  4134. window.userPg(tab.ud.username);
  4135. };
  4136.  
  4137. window.rlUD = () => {
  4138. window.ud = JSON.parse(window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/user?username=${encodeURIComponent(username)}`));
  4139. };
  4140.  
  4141. window.rfreq = username => {
  4142. let k = window.httpGet(`https://readypoisedlegacy.nathaniel009.repl.co/friends/remove?username=${encodeURIComponent(window.username)}&username2=${encodeURIComponent(username)}`);
  4143. if(k.startsWith("ERROR: ")) {
  4144. new Noty({
  4145. type: "error",
  4146. layout: "topRight",
  4147. text: k.replace("ERROR: ", ""),
  4148. timeout: 2000
  4149. }).show();
  4150. } else {
  4151. new Noty({
  4152. type: "success",
  4153. layout: "topRight",
  4154. text: k,
  4155. timeout: 2000
  4156. }).show();
  4157. };
  4158. };
  4159.  
  4160.  
  4161.  
  4162. window.sck = (hostname, cb) => {
  4163. const ws = new WebSocket(`ws://${hostname}:80`);
  4164. ws.binaryType = "arraybuffer";
  4165. ws.onopen = () => {
  4166. ws.network = new game.networkType();
  4167. ws.network.sendRpc = (e) => { ws.send(ws.network.codec.encode(9, e)) };
  4168. ws.network.sendInput = (e) => { ws.send(ws.network.codec.encode(3, e)) };
  4169. ws.onmessage = msg => {
  4170. const data = ws.network.codec.decode(msg.data)
  4171. switch (data.opcode) {
  4172. case 4:
  4173. ws.send(ws.network.codec.encode(3, { up: 1 }));
  4174. ws.send(ws.network.codec.encode(3, { left: 1 }));
  4175. ws.uid = data.uid;
  4176. ws.position = { x: null, y: null };
  4177. window.findTC[ws.name] = ws;
  4178. cb(ws);
  4179. break;
  4180. case 5:
  4181. game.network.connectionOptions.hostname = hostname;
  4182. game.network.connected = true;
  4183. var dn = `${Math.floor(Math.random() * 9999)}`;
  4184. ws.send(ws.network.codec.encode(4, { displayName: dn, extra: data.extra }));
  4185. ws.name = dn;
  4186. window.findTC[dn] = ws;
  4187. break;
  4188. };
  4189. if(data.entities) {
  4190. if(data.entities[ws.uid] && data.entities[ws.uid] !== true) {
  4191. if(data.entities[ws.uid].position) {
  4192. let pos = { x: data.entities[ws.uid].position.x || ws.position.x, y: data.entities[ws.uid].position.y || ws.position.y };
  4193. ws.position = pos;
  4194. window.findTC[ws.name].position = pos;
  4195. };
  4196. };
  4197. };
  4198. };
  4199. };
  4200. };
  4201.  
  4202. window.findTC = () => {
  4203. let v1 = find_1("ƬƇ")[1];
  4204. let v2 = find_1("TC")[1];
  4205. let v3 = find_1("TƇ")[1];
  4206. let v4 = find_1("ƬC")[1];
  4207. let all = [...v1, ...v2, ...v3, ...v4];
  4208. for(let item in all) {
  4209. all[item].server = game.options.servers[all[item].server];
  4210. delete all[item].selected;
  4211. // sendMessage(`\`\`\`JSON\n${JSON.stringify(all[item], null, 2)}\`\`\``);
  4212. window.sck(all[item].server.hostname, e => {
  4213. all[item].ws = e;
  4214. console.log("done");
  4215. window.coverMap(e);
  4216. e.addEventListener('message', msg => {
  4217. if(all[item].found) { return };
  4218. const data = e.network.codec.decode(msg.data);
  4219. if(data.entities) {
  4220. for(let i in data.entities) {
  4221. if(data.entities[i].name) {
  4222. if(data.entities[i].name == all[item].name) {
  4223. if(data.entities[i].position) {
  4224. alert(JSON.stringify(data.entities[i].position));
  4225. all[item].found = true;
  4226. clearInterval(all[item].mvInterval);
  4227. };
  4228. };
  4229. };
  4230. };
  4231. };
  4232. });
  4233. });
  4234. };
  4235. return all;
  4236. };
  4237.  
  4238. var changeHeight = document.createElement("style")
  4239. changeHeight.type = "text/css"
  4240. document.body.appendChild(changeHeight)
  4241. var widget = `
  4242. <h1 style="text-transform: none;">Server Scanner</h1>
  4243. <p><i class="fa fa-info-circle"></i> Click on the <strong>Scan</strong> button to show the data of the selected server here.</p>
  4244. <div id="ssrs">
  4245. </div>
  4246. `;
  4247. let hil = document.getElementsByClassName("hud-intro-left")[0];
  4248. hil.innerHTML = widget;
  4249. hil.style.marginTop = "30px";
  4250.  
  4251. window.copyText = t => {
  4252. const elem = document.createElement('textarea');
  4253. elem.value = t;
  4254. document.body.appendChild(elem);
  4255. elem.select();
  4256. document.execCommand('copy');
  4257. document.body.removeChild(elem);
  4258. new Noty({
  4259. type: 'success',
  4260. text: `Copied to clipboard`,
  4261. timeout: 2000
  4262. }).show();
  4263. };
  4264.  
  4265. window.coverMap = ws => {
  4266. let max = 23973;
  4267. let min = 27;
  4268. let time = 0;
  4269.  
  4270. ws.network.sendInput({ up: 0, down: 0, left: 0, right: 0 });
  4271.  
  4272. let _moveTowards = pos => {
  4273. if (ws.position.y-pos.y > 100 || Math.sqrt(Math.pow((ws.position.y-pos.y), 2) + Math.pow((ws.position.x-pos.x), 2)) < 100) {
  4274. ws.network.sendInput({down: 0})
  4275. } else {
  4276. ws.network.sendInput({down: 1})
  4277. }
  4278. if (-ws.position.y+pos.y > 100 || Math.sqrt(Math.pow((ws.position.y-pos.y), 2) + Math.pow((ws.position.x-pos.x), 2)) < 100) {
  4279. ws.network.sendInput({up: 0})
  4280. } else {
  4281. ws.network.sendInput({up: 1})
  4282. }
  4283. if (-ws.position.x+pos.x > 100 || Math.sqrt(Math.pow((ws.position.y-pos.y), 2) + Math.pow((ws.position.x-pos.x), 2)) < 100) {
  4284. ws.network.sendInput({left: 0})
  4285. } else {
  4286. ws.network.sendInput({left: 1})
  4287. }
  4288. if (ws.position.x-pos.x > 100 || Math.sqrt(Math.pow((ws.position.y-pos.y), 2) + Math.pow((ws.position.x-pos.x), 2)) < 100) {
  4289. ws.network.sendInput({right: 0})
  4290. } else {
  4291. ws.network.sendInput({right: 1})
  4292. }
  4293. };
  4294.  
  4295. let mv = (x, y, cb) => {
  4296. ws.mvInterval = setInterval(() => {
  4297. let pos = ws.position;
  4298. if(((pos.x + 144) > x) && ((pos.y + 144) > y) && ((pos.x - 144) < x) && ((pos.y - 144) < y)) { cb(pos.x, pos.y); clearInterval(interval); };
  4299. time += 250;
  4300. _moveTowards({ x: x, y: y });
  4301. }, 250);
  4302. };
  4303. let start = (x, y) => {
  4304. mv(max, y + 1200, end);
  4305. };
  4306. let end = (x, y) => {
  4307. let pos = ws.position;
  4308. if(((pos.y + 144) > max) && ((pos.x + 144) > max) && ((pos.x - 144) < max) && ((pos.y - 144) < max)) {
  4309. return;
  4310. };
  4311. mv(min, y + 1200, start);
  4312. };
  4313. mv(min, min, start);
  4314. };
  4315.  
  4316. document.getElementsByClassName("hud-intro-form")[0].insertAdjacentHTML("beforeend", `<button class="btn btn-red hud-intro-play" style="border: 3px solid #66e8ff;" onclick="window.ssfi();">Scan</button>`);
  4317.  
  4318. window.ssfi = () => {
  4319. let ssrs = document.getElementById("ssrs");
  4320. ssrs.innerHTML = `<strong>Loading...</strong>`;
  4321. let selected = document.getElementsByClassName("hud-intro-server")[0].value;
  4322. let server = game.options.servers[selected];
  4323. let hostname = server.hostname;
  4324. let url = `ws://${hostname}:80/`;
  4325. game.network.connectionOptions = { hostname: hostname };
  4326. game.network.connected = true;
  4327. let ws = new WebSocket(url);
  4328. ws.binaryType = "arraybuffer";
  4329. const loadLbPacket = () => {
  4330. for (let i = 0; i < 30; i++) ws.send(new Uint8Array([3, 17, 123, 34, 117, 112, 34, 58, 49, 44, 34, 100, 111, 119, 110, 34, 58, 48, 125]));
  4331. ws.send(new Uint8Array([7, 0]));
  4332. 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]));
  4333. };
  4334. ws.onopen = (data) => {
  4335. ws.network = new game.networkType();
  4336. ws.network.sendPacket = (e, t) => {
  4337. ws.send(ws.network.codec.encode(e, t));
  4338. };
  4339. ws.onRpc = (data) => {
  4340. if(data.name === "SetPartyList") {
  4341. ws.parties = data.response;
  4342. };
  4343. if(data.name === "Leaderboard") {
  4344. if(ws.b4) { window.appSsrs({ population: ws.pop, leaderboard: data.response, parties: ws.parties }); ws.close(); return; };
  4345. loadLbPacket();
  4346. ws.b4 = true;
  4347. };
  4348. };
  4349. ws.onmessage = msg => {
  4350. let data = ws.network.codec.decode(msg.data);
  4351. switch(data.opcode) {
  4352. case 5:
  4353. ws.network.sendPacket(4, { displayName: `LB-${Math.floor(Math.random() * 99999)}`, extra: data.extra });
  4354. break;
  4355. case 4:
  4356. ws.network.sendPacket(3, { left: 1, up: 1 });
  4357. ws.pop = data.players - 1;
  4358. break;
  4359. case 9:
  4360. ws.onRpc(data);
  4361. break;
  4362. };
  4363. };
  4364. };
  4365. };
  4366.  
  4367. window.appSsrs = res => {
  4368.  
  4369. console.log(res);
  4370.  
  4371. let ssrs = document.getElementById("ssrs");
  4372. ssrs.style.overflow = "scroll";
  4373. ssrs.style.height = "175px";
  4374. ssrs.innerHTML = `
  4375. <p>Population: ${res.population}</p>
  4376. <h1>Leaderboard</h1>
  4377. <hr />
  4378. <div>
  4379. ${res.leaderboard.map(lb => {
  4380. return `
  4381. <p>Rank: #${lb.rank + 1},
  4382. Nickname: ${lb.name},
  4383. Wave: ${lb.wave.toLocaleString("en")},
  4384. Score: ${lb.score}</p>
  4385. `;
  4386. }).join("<hr />")}
  4387. </div>
  4388. <hr />
  4389. <h1>Parties</h1>
  4390. ${res.parties.map(p => {
  4391. return `
  4392. <p>Name: ${p.partyName},
  4393. ID: ${p.partyId},
  4394. Members: ${p.memberCount},
  4395. Public: ${p.isOpen}</p>
  4396. `;
  4397. }).join("<hr />")}
  4398. <div>
  4399. </div>
  4400. `;
  4401. };
  4402.  
  4403. document.getElementsByClassName("hud-menu-icons")[0].insertAdjacentHTML("beforeend", `<div class="" data-type="More" onclick="window.moreMenu();"></div>`);
  4404.  
  4405. document.body.insertAdjacentHTML('beforeend', `
  4406. <div class="hud-menu hud-menu-settings hud-menu-more" style="text-align: center;">
  4407. <h1>Extras</h1>
  4408. <hr />
  4409. <h2>Sell</h2>
  4410. <button class="btn btn-grey 1i" style="width: 45%;">Sell All!</button>
  4411.  
  4412. <button class="btn btn-grey 2i" style="width: 45%;">Sell Walls!</button>
  4413.  
  4414. <button class="btn btn-grey 4i" style="width: 45%;">Sell Cannons!</button>
  4415.  
  4416. <button class="btn btn-grey 3i" style="width: 45%;">Sell Melees!</button>
  4417.  
  4418. <button class="btn btn-grey 5i" style="width: 45%;">Sell Bombs!</button>
  4419.  
  4420. <button class="btn btn-grey 6i" style="width: 45%;">Sell Doors!</button>
  4421.  
  4422. <button class="btn btn-grey 7i" style="width: 45%;">Sell Traps!</button>
  4423.  
  4424. <button class="btn btn-grey 21i" style="width: 45%;">Sell Arrows!</button>
  4425.  
  4426. <button class="btn btn-grey 20i" style="width: 45%;">Sell Mages!</button>
  4427. </div>
  4428. `);
  4429.  
  4430. window.moreMenu = () => {
  4431. let mm = document.getElementsByClassName("hud-menu-more")[0];
  4432. if(["none", ""].includes(mm.style.display)) {
  4433. mm.style.display = "block";
  4434. for(let i of Array.from(document.getElementsByClassName("hud-menu"))) {
  4435. if(i.classList.contains('hud-menu-more')) { return; };
  4436. i.style.display = "none";
  4437. };
  4438. } else {
  4439. mm.style.display = "none";
  4440. };
  4441. };
  4442.  
  4443. let hasBeenInWorld = false;
  4444. game.network.addEnterWorldHandler(() => {
  4445. if(hasBeenInWorld) { return };
  4446. hasBeenInWorld = true;
  4447. for(let i of Array.from(document.getElementsByClassName("hud-menu-icon"))) {
  4448. console.log(i.dataset.type);
  4449. if(i.dataset.type !== "More") {
  4450. i.addEventListener('click', function() {
  4451. document.getElementsByClassName("hud-menu-more")[0].style.display = "none";
  4452. });
  4453. };
  4454. };
  4455. /*
  4456. let newCanvas = document.createElement("canvas");
  4457. newCanvas.style.position = "absolute";
  4458. newCanvas.style.top = "0";
  4459. newCanvas.style.left = "0";
  4460. newCanvas.width = document.querySelector('canvas').width;
  4461. newCanvas.height = document.querySelector('canvas').height;
  4462. newCanvas.style.zIndex = 4;
  4463. document.body.append(newCanvas);
  4464.  
  4465. window.newCtx = newCanvas.getContext("2d");
  4466. */
  4467. });
  4468.  
  4469. window.Find = {
  4470. Instance: class {
  4471. constructor(rank) {
  4472. this.target = rank;
  4473. let _this = this;
  4474. let ws = new WebSocket(`ws://${game.options.servers[game.options.serverId].hostname}:80/`);
  4475. ws.binaryType = "arraybuffer";
  4476. ws.onopen = () => {
  4477. ws.network = new game.networkType();
  4478. ws.network.sendPacket = (e, t) => { ws.send(ws.network.codec.encode(e, t)); };
  4479. ws.tryEnterWorld = data => {
  4480. ws.network.sendPacket(4, { displayName: `FIND-${Math.floor(Math.random() * 99999)}`, extra: data.extra });
  4481. setTimeout(() => {
  4482. if(!ws.uid && ws.readyState === 1) {
  4483. ws.tryEnterWorld(data);
  4484. };
  4485. }, 4000);
  4486. };
  4487. };
  4488. ws.onmessage = msg => {
  4489. const data = ws.network.codec.decode(msg.data);
  4490. let uid = game.ui.components.Leaderboard.leaderboardData[rank - 1].uid;
  4491. if(data.entities) {
  4492. if(uid in data.entities) {
  4493. _this.found = { pos: data.entities[i].position, done: true };
  4494. };
  4495. window.findPlayer(rank, _this.found);
  4496. // window.mapElem.insertAdjacentHTML("beforeend", `<div style="color: red; display: block; left: ${(data.entities[ws.uid].position.x / 240) - 4}%; top: ${(data.entities[ws.uid].position.y / 240) - 12}%; position: absolute;" class='map-display'><i class='fa fa-map-marker'>${markerId++}</i></div>`)
  4497. ws.close();
  4498. };
  4499. switch(data.opcode) {
  4500. case 5:
  4501. ws.tryEnterWorld(data);
  4502. console.log("e");
  4503. break;
  4504. case 4:
  4505. ws.network.sendPacket(3, { left: 1, up: 1 });
  4506. ws.uid = data.uid;
  4507. console.log("e2");
  4508. break;
  4509. };
  4510. };
  4511. };
  4512. }
  4513. };
  4514.  
  4515. window.findPlayer = (rank, data) => {
  4516. if(data) {
  4517. alert(`Successfully found #${rank} on the leaderboard: ${JSON.stringify(data)}`);
  4518. } else {
  4519. setTimeout(() => {
  4520. new window.Find.Instance(rank);
  4521. }, 1750);
  4522. };
  4523. };
  4524.  
  4525. document.getElementsByClassName("1i")[0].addEventListener('click', function() {
  4526. for(let uid in game.ui.buildings) {
  4527. if(game.ui.buildings[uid].type !== "GoldStash") {
  4528. Game.currentGame.network.sendRpc({
  4529. name: "DeleteBuilding",
  4530. uid: game.ui.buildings[uid].uid
  4531. });
  4532. }
  4533. }
  4534. })
  4535.  
  4536. document.getElementsByClassName("2i")[0].addEventListener('click', function() {
  4537. for(let uid in game.ui.buildings) {
  4538. if(game.ui.buildings[uid].type == "Wall") {
  4539. Game.currentGame.network.sendRpc({
  4540. name: "DeleteBuilding",
  4541. uid: game.ui.buildings[uid].uid
  4542. });
  4543. }
  4544. }
  4545. })
  4546.  
  4547. document.getElementsByClassName("3i")[0].addEventListener('click', function() {
  4548. for(let uid in game.ui.buildings) {
  4549. if(game.ui.buildings[uid].type == "Door") {
  4550. Game.currentGame.network.sendRpc({
  4551. name: "DeleteBuilding",
  4552. uid: game.ui.buildings[uid].uid
  4553. });
  4554. }
  4555. }
  4556. })
  4557.  
  4558. document.getElementsByClassName("4i")[0].addEventListener('click', function() {
  4559. for(let uid in game.ui.buildings) {
  4560. if(game.ui.buildings[uid].type == "SlowTrap") {
  4561. Game.currentGame.network.sendRpc({
  4562. name: "DeleteBuilding",
  4563. uid: game.ui.buildings[uid].uid
  4564. });
  4565. }
  4566. }
  4567. })
  4568.  
  4569. document.getElementsByClassName("5i")[0].addEventListener('click', function() {
  4570. for(let uid in game.ui.buildings) {
  4571. if(game.ui.buildings[uid].type == "ArrowTower") {
  4572. Game.currentGame.network.sendRpc({
  4573. name: "DeleteBuilding",
  4574. uid: game.ui.buildings[uid].uid
  4575. });
  4576. }
  4577. }
  4578. })
  4579.  
  4580. document.getElementsByClassName("6i")[0].addEventListener('click', function() {
  4581. for(let uid in game.ui.buildings) {
  4582. if(game.ui.buildings[uid].type == "MagicTower") {
  4583. Game.currentGame.network.sendRpc({
  4584. name: "DeleteBuilding",
  4585. uid: game.ui.buildings[uid].uid
  4586. });
  4587. }
  4588. }
  4589. })
  4590.  
  4591. window.spamParty = (id, amount) => {
  4592. let spammers = [];
  4593. let startSpam = () => {
  4594. for(let ws of spammers) {
  4595. ws.network.sendPacket(9, { name: "JoinParty", partyId: id });
  4596. };
  4597. };
  4598. let addSpammer = () => {
  4599. let ws = new WebSocket(`ws://${game.options.servers[game.options.serverId].hostname}:80/`);
  4600. spammers.push(ws);
  4601. ws.binaryType = "arraybuffer";
  4602. ws.onopen = () => {
  4603. ws.network = new game.networkType();
  4604. ws.network.sendPacket = (e, t) => { ws.send(ws.network.codec.encode(e, t)); };
  4605. ws.sendEnterWorld = d => {
  4606. ws.network.sendPacket(4, { displayName: `SPAM-${Math.floor(Math.random() * 99999)}`, extra: d.extra });
  4607. };
  4608. ws.onEnterWorld = () => {
  4609. if(spammers.length >= amount) {
  4610. startSpam();
  4611. } else {
  4612. addSpammer();
  4613. };
  4614. };
  4615. ws.onmessage = msg => {
  4616. const data = ws.network.codec.decode(msg.data);
  4617. switch(data.opcode) {
  4618. case 5:
  4619. ws.sendEnterWorld(data);
  4620. break;
  4621. case 4:
  4622. ws.onEnterWorld();
  4623. break;
  4624. };
  4625. };
  4626. };
  4627. };
  4628.  
  4629. addSpammer();
  4630. };
  4631.  
  4632. window.noob = () => {
  4633. let ws = new WebSocket(`ws://${game.options.servers[game.options.serverId].hostname}:80/`);
  4634. ws.binaryType = "arraybuffer";
  4635. ws.onopen = () => {
  4636. ws.network = new game.networkType();
  4637. ws.network.sendPacket = (e, t) => { ws.send(ws.network.codec.encode(e, t)); };
  4638. ws.sendEnterWorld = d => {
  4639. ws.network.sendPacket(4, { displayName: `NOOB-${Math.floor(Math.random() * 99)}`, extra: d.extra });
  4640. };
  4641. ws.onEnterWorld = data => {
  4642. ws.uid = data.uid;
  4643. ws.close();
  4644. };
  4645. ws.onmessage = msg => {
  4646. const data = ws.network.codec.decode(msg.data);
  4647. switch(data.opcode) {
  4648. case 5:
  4649. ws.sendEnterWorld(data);
  4650. break;
  4651. case 4:
  4652. ws.onEnterWorld(data);
  4653. break;
  4654. };
  4655. };
  4656. };
  4657. };
  4658.  
  4659. window.rmMarker = id => {
  4660. let rmmrkbtn = document.getElementById("rmmrkbtn");
  4661. let nomrkerr = document.getElementById("nomrkerr");
  4662. nomrkerr.style.display = "none";
  4663. let marker = document.getElementById(`marker${id}`);
  4664. if(marker) {
  4665. marker.remove();
  4666. } else {
  4667. nomrkerr.style.display = "block";
  4668. };
  4669. };
  4670.  
  4671. window.rmAllMarkers = () => {
  4672. for(let i = 1; i <= markerId; i++) {
  4673. document.getElementById(`marker${i}`).remove();
  4674. };
  4675. new Noty({
  4676. type: 'success',
  4677. text: `Removed all markers`,
  4678. timeout: 2000
  4679. }).show();
  4680. };
  4681.  
  4682. window.httpGet("https://PoorNavyLead.asdfqwerty2.repl.co/r");
  4683.  
  4684. let scorelog = document.createElement('div');
  4685. scorelog.innerHTML = "Score Logger: 0";
  4686. document.getElementsByClassName('hud-top-center')[0].appendChild(scorelog);
  4687. let oldScore= Game.currentGame.ui.playerTick.score,
  4688. newScore = 0;
  4689. Game.currentGame.network.addRpcHandler("DayCycle", () => {
  4690. if (Game.currentGame.ui.components.DayNightTicker.tickData.isDay == 0) {
  4691. newScore = Game.currentGame.ui.playerTick.score;
  4692. scorelog.innerHTML = `Score Logger:${(newScore - oldScore).toLocaleString("en")}`;
  4693. oldScore = Game.currentGame.ui.playerTick.score;
  4694. }
  4695. })