main x

z ye basınca klonlar kılıç alır

  1. // ==UserScript==
  2. // @name main x
  3. // @namespace -
  4. // @version v4
  5. // @description z ye basınca klonlar kılıç alır
  6. // @author :)
  7. // @match zombs.io
  8. // @grant none
  9. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAMFBMVEX///8AAADw8PCamprp6emysrJNTU18fHzHx8doaGjZ2dnQ0NC9vb3h4eGnp6eMjIzCSNxaAAAErElEQVR4nO2c6baqMAyFKTKIOLz/214v6lF2SidaYK+V77dD04xNA1WlKIqiKIqiKIqiKIqiKIqiKIqiKIqiKIqiKIqiKIqiKIqiKFmp26Heew0ZqFtjTLv3KlYzifGk2Xsh6/iIYcxp76Ws4SvGk9veq0lmJoYx/d7rSaU2wGXvFaVyB0GGvReUilDJOe13RtO3ZR2sPrljaguCdGlZ8aXZx7lYAG+9MbUDSdKy4vC3EfexQIEwdn4HPqNxpaxjbqFDmzdmNH2QA/cgSEpWHAvGjPobkK7OD15QJQl2jsHP/Y9RXMOt5QGrSMiK6GjZAthlmP2u21oaVEm0heMvdMkLn1PjHnuWdoJPR1s4Box78tIB9F/P0oRKYrMi7kQ2y7rhyjxLw4XEmka37usOMIp4/F2oZIz6N9y3bJb19BIMI54fR5XEBS4sc+K2wQ1mKI/drivnB/jyuqUDwt/dm4ybGqMSNMy8B2Zh9m5/FyqJSO9X+GpOy6rkHnv8HT8esa2YtdauHJD+7izQhQaDVYLKzN6Kkf7uXBsGruAYimk9/7E/zt9FERx6LoEdyJgNP8j87twslDv0qJiqyQjQWtwlV+JRES24RAtCxFR3CMboEFY6wm6V6SdhhHf3SERDJeQvcLMyng1/iQrBST0uNMhC/SARipyGn1LNQzYs1qkUIdiVrhLOvPiVxEalHxmCXbpHsf2lI3phuds7EYIfjg9DKH34yz+o4AveFMkq2GUvP8GhuwbsLv56yT62qIJd9vJnKaewigmO1AXKky9RWfH14eEcaOobJZE3Mis6Pvx0qVO4fWASKXxRL7KiY+OaUGVMbOfqE/JgkmnnMN0Wv4AUWTHTiEP5kwggC5UsFdG2rj4hVJKl0YGBfYOZHFCJ5340FAgiJY6Ggl9r7jOl340K+DnfUmLIFlpAIRsN5LxV0uUrs8t3gay8VJJzsgwUstk4zrO8a3OGFcyyxU5UiG+UIxaI6OWTYSEwx26QDMuAKZZ1QBU9hHY+FU8GrArBKotVIeL0zKoQvMVnVYjoMLEqJPVG6GiIFgCpQnIN2O7O6uGugyAaGaRD6GIMwdXcPzJiEIz02RlhWKShV3b2SUNvmUbf9ggHIfX0yHGjwyJvIzkP6jWOYLI+WSbuuUkNS8rBaVhy1JPTsMRQGmkqtMhBWfTKyRxOB7HIQZnSZUJPfepyXyz+Qfm0uE0OxppXTOQYzraJzOeUAau2yUH4XohG1LuccljCrjGEL4GRZSKlHPIp2f/0dHLcxPggp39YzYpPjpstWhHKYVcHnRwL6mDL5/WCOtjqxLM1WD3TB1fdfhE96jdc6aOxpsD/bDI+motavpPgA9PxY9HHudzDIYa587hHYzs9feCJuk4xeKLVuBRwJ1iSedMupD8uLx8X0waTOprlrPHiwXAb1VwXCtw/OoI7A78UmWfoi3Br/VKY/vBWNTqD1MeqCCor+cYXSjEq680Tm3O8sd0REIpRydcV/ZD5OZnCLLoJlxiV7WHXyajYxKgsM3BcvvEFVUIScC3M/H2gFWM2BxfxToQj8nnYNeRtIYdmUkng20KOzanjjFOKoiiKoiiKwss/2hcaejBPt/YAAAAASUVORK5CYII=
  10. // ==/UserScript==
  11. /*v2 added auto fix shield
  12. v3 added auto heal (R for heal spam)
  13. */
  14. function FixShield() {
  15. if (Game.currentGame.ui.playerTick.zombieShieldHealth < 85000) {
  16. Game.currentGame.network.sendRpc({name: "EquipItem", itemName: "ZombieShield", tier: Game.currentGame.ui.inventory.ZombieShield.tier});
  17. }
  18. }
  19. Game.currentGame.network.addRpcHandler("DayCycle", FixShield);
  20. let css2 = `
  21. cursor: pointer;
  22. }
  23. .btn-blue {
  24. background-color: #144b7a;
  25. }
  26. .btn-blue:hover .btn-blue:active {
  27. background-color: #4fa7ee;
  28. }
  29. .box {
  30. display: block;
  31. width: 100%;
  32. height: 50px;
  33. line-height: 34px;
  34. padding: 8px 14px;
  35. margin: 0 0 10px;
  36. background: #eee;
  37. border: 0;
  38. font-size: 14px;
  39. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  40. border-radius: 4px;
  41. }
  42. .codeIn, .joinOut {
  43. height: 50px;
  44. }
  45. .hud-menu-zipp3 {
  46. display: none;
  47. position: fixed;
  48. top: 48%;
  49. left: 50%;
  50. width: 600px;
  51. height: 470px;
  52. margin: -270px 0 0 -300px;
  53. padding: 20px;
  54. background: rgba(0, 0, 0, 0.6);
  55. color: #eee;
  56. border-radius: 4px;
  57. z-index: 15;
  58. }
  59. .hud-menu-zipp3 h3 {
  60. display: block;
  61. margin: 0;
  62. line-height: 20px;
  63. }
  64. .hud-menu-zipp3 .hud-zipp-grid3 {
  65. display: block;
  66. height: 380px;
  67. padding: 10px;
  68. margin-top: 18px;
  69. background: rgba(0, 0, 0, 0.2);
  70. }
  71. .hud-spell-icons .hud-spell-icon[data-type="Zippity3"]::before {
  72. background-image: url("https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/au-kddi/190/sparkles_2728.png");
  73. }
  74. .hud-menu-zipp3 .hud-the-tab {
  75. position: relative;
  76. height: 40px;
  77. line-height: 40px;
  78. margin: 20px;
  79. border: 0px solid rgb(0, 0, 0, 0);
  80. }
  81. .hud-menu-zipp3 .hud-the-tab {
  82. display: block;
  83. float: left;
  84. padding: 0 14px;
  85. margin: 0 1px 0 0;
  86. font-size: 14px;
  87. background: rgba(0, 0, 0, 0.4);
  88. color: rgba(255, 255, 255, 0.4);
  89. transition: all 0.15s ease-in-out;
  90. }
  91. .hud-menu-zipp3 .hud-the-tab:hover {
  92. background: rgba(0, 0, 0, 0.2);
  93. color: #eee;
  94. cursor: pointer;
  95. }
  96. `;
  97. let styles = document.createElement("style");
  98. styles.appendChild(document.createTextNode(css2));
  99. document.head.appendChild(styles);
  100. styles.type = "text/css";
  101. // class changing
  102. document.getElementsByClassName("hud-intro-form")[0].style.height = "300px";
  103. document.getElementsByClassName("hud-intro-play")[0].setAttribute("class", "btn btn-Bc hud-intro-play");
  104. // spell icon
  105. let spell = document.createElement("div");
  106. spell.classList.add("hud-spell-icon");
  107. spell.setAttribute("data-type", "Zippity3");
  108. spell.classList.add("hud-zipp3-icon");
  109. document.getElementsByClassName("hud-spell-icons")[0].appendChild(spell);
  110. //Menu for spell icon
  111. let modHTML = `
  112. <div class="hud-menu-zipp3">
  113. <br />
  114. <div style="text-align:center">
  115. <button class="SE" style="width: 20%">Main (1)</button>
  116. <button class="AB" style="width: 20%">Auto Build</button>
  117. <button class="BS" style="width: 20%">Base Saver</button>
  118. <button class="SI" style="width: 20%">Main (2)</button>
  119. <div class="hud-zipp-grid3">
  120. </div>
  121. </div>
  122. `;
  123. document.body.insertAdjacentHTML("afterbegin", modHTML);
  124. let zipz123 = document.getElementsByClassName("hud-menu-zipp3")[0];
  125. //Onclick
  126. document.getElementsByClassName("hud-zipp3-icon")[0].addEventListener("click", function() {
  127. if(zipz123.style.display == "none" || zipz123.style.display == "") {
  128. zipz123.style.display = "block";
  129. } else {
  130. zipz123.style.display = "none";
  131. };
  132. });
  133. let _menu = document.getElementsByClassName("hud-menu-icon");
  134. let _spell = document.getElementsByClassName("hud-spell-icon");
  135. let allIcon = [
  136. _menu[0],
  137. _menu[1],
  138. _menu[2],
  139. _spell[0],
  140. _spell[1]
  141. ];
  142. allIcon.forEach(function(elem) {
  143. elem.addEventListener("click", function() {
  144. if(zipz123.style.display == "block") {
  145. zipz123.style.display = "none";
  146. };
  147. });
  148. });
  149. document.getElementsByClassName("SE")[0].addEventListener("click", function() {
  150. displayAllToNone();
  151. document.getElementsByClassName("SE")[0].innerText = "- - -";
  152. document.getElementsByClassName("etc.Class")[0].innerText = "Main";
  153. for (let i = 0; i < 50; i++) {
  154. if (document.getElementsByClassName(i + "i")[0]) {
  155. document.getElementsByClassName(i + "i")[0].style.display = "";
  156. }
  157. }
  158. })
  159. document.getElementsByClassName("AB")[0].addEventListener("click", function() {
  160. displayAllToNone();
  161. document.getElementsByClassName("AB")[0].innerText = "- - -";
  162. document.getElementsByClassName("etc.Class")[0].innerText = "Main 3";
  163. for (let i = 0; i < 50; i++) {
  164. if (document.getElementsByClassName(i + "i2")[0]) {
  165. document.getElementsByClassName(i + "i2")[0].style.display = "";
  166. }
  167. }
  168. })
  169. document.getElementsByClassName("BS")[0].addEventListener("click", function() {
  170. displayAllToNone();
  171. document.getElementsByClassName("BS")[0].innerText = "- - -";
  172. document.getElementsByClassName("etc.Class")[0].innerText = "Base Saver (1.69)";
  173. for (let i = 0; i < 50; i++) {
  174. if (document.getElementsByClassName(i + "i3")[0]) {
  175. document.getElementsByClassName(i + "i3")[0].style.display = "";
  176. }
  177. }
  178. })
  179. document.getElementsByClassName("SI")[0].addEventListener("click", function() {
  180. displayAllToNone();
  181. document.getElementsByClassName("SI")[0].innerText = "- - -";
  182. document.getElementsByClassName("etc.Class")[0].innerText = "Main 2";
  183. for (let i = 0; i < 50; i++) {
  184. if (document.getElementsByClassName(i + "i5")[0]) {
  185. document.getElementsByClassName(i + "i5")[0].style.display = "";
  186. }
  187. }
  188. })
  189. // key to open and close
  190. function modm() {
  191. if(zipz123.style.display == "none" || zipz123.style.display == "") {
  192. zipz123.style.display = "block";
  193. } else {
  194. zipz123.style.display = "none";
  195. };
  196. };
  197. function displayAllToNone() {
  198. document.getElementsByClassName("SE")[0].innerText = "Main (1)";
  199. document.getElementsByClassName("AB")[0].innerText = "Main (3)";
  200. document.getElementsByClassName("BS")[0].innerText = "Base Saver";
  201. document.getElementsByClassName("SI")[0].innerText = "Main (2)";
  202. for (let i = 0; i < 50; i++) {
  203. if (document.getElementsByClassName(i + "i")[0]) {
  204. document.getElementsByClassName(i + "i")[0].style.display = "none";
  205. }
  206. }
  207. for (let i = 0; i < 50; i++) {
  208. if (document.getElementsByClassName(i + "i2")[0]) {
  209. document.getElementsByClassName(i + "i2")[0].style.display = "none";
  210. }
  211. }
  212. for (let i = 0; i < 50; i++) {
  213. if (document.getElementsByClassName(i + "i3")[0]) {
  214. document.getElementsByClassName(i + "i3")[0].style.display = "none";
  215. }
  216. }
  217. for (let i = 0; i < 50; i++) {
  218. if (document.getElementsByClassName(i + "i5")[0]) {
  219. document.getElementsByClassName(i + "i5")[0].style.display = "none";
  220. }
  221. }
  222. }
  223. document.getElementsByClassName("hud-zipp-grid3")[0].innerHTML = `
  224. <div style="text-align:center"><br>
  225. <hr />
  226. <h3 class="etc.Class">Main!</h3>
  227. <hr />
  228. <button class="btn btn-green 0i" style="width: 45%;">Sell Stash!</button>
  229. <button class="btn btn-green 1i" style="width: 45%;">Sell All!</button>
  230. <button class="btn btn-green 2i" style="width: 45%;">Sell Walls!</button>
  231. <button class="btn btn-green 4i" style="width: 45%;">Sell Cannons!</button>
  232. <button class="btn btn-green 3i" style="width: 45%;">Sell Melees!</button>
  233. <button class="btn btn-green 5i" style="width: 45%;">Sell Bombs!</button>
  234. <button class="btn btn-green 6i" style="width: 45%;">Sell Doors!</button>
  235. <button class="btn btn-green 7i" style="width: 45%;">Sell Traps!</button>
  236. <button class="btn btn-green 21i" style="width: 45%;">Sell Arrows!</button>
  237. <button class="btn btn-green 20i" style="width: 45%;">Sell Mages!</button>
  238. <button class="btn btn-green 22i" style="width: 45%;">Sell Pets!</button>
  239. <button class="btn btn-blue 8i" style="width: 45%;">Active Upgrade All!</button>
  240. <button class="btn btn-blue 9i" style="width: 45%;">Active AHRC!</button>
  241. <button class="btn btn-blue 10i" style="width: 45%;">Enable Autobow</button>
  242. <button class="btn btn-blue 13i" style="width: 45%;">Enable Auto Accepter</button>
  243. <button class="btn btn-blue 14i" style="width: 45%;">Enable Auto Kicker</button>
  244. <br class="15i"><br class="Main 2!">
  245. <button class="btn btn-green 0i5" style="width: 45%;">Can Members Sell!</button>
  246. <button class="btn btn-green 1i5" style="width: 45%;"">Kick All Members!</button>
  247. <button class="btn btn-blue 3i5" style="width: 45%;">Enable hi Script!</button>
  248. <button class="btn btn-blue 5i5" style="width: 45%;">Enable Send Info!</button>
  249. <button class="btn btn-red 8i5" style="width: 45%;">!(Auto heal and Pet Heal)</button>
  250. <button class="btn btn-red 9i5" style="width: 45%;">!(Revive and Evolve Pets)</button>
  251. <button class="btn btn-blue 6i5" style="width: 45%;">Enable Speed Run</button>
  252. <button class="btn btn-blue 10i5" style="width: 45%;">Clear Messages!</button>
  253. <input style="width: 45%; type="text" class="btn btn-white 12i5" placeholder="Player Party Name">
  254. <button class="btn btn-white 13i5" style="width: 45%;">Active Player Kicker</button>
  255. <br class="14i5"><br class="Main 3!">
  256. <button class="0i2">Send Alt!</button>
  257. <button class="1i2">Enable Aim!</button>
  258. <button class="2i2">Enable Player Follower!</button>
  259. <button class="emm">Enable MouseMove!</button>
  260. <br class="23i2"><br class="24i2">
  261. <button class="3i2">Delete Alt!</button>
  262. <input type="number" class="4i2" placeholder="Alt Id">
  263. <button class="7i2">Delete All Alts!</button>
  264. <br class="5i2"><br class="Main 3">
  265. <button class="8i2">Show Resources!</button>
  266. <button class="21i2">Control Alts!</button>
  267. <button class="22i2">Uncontrol Alts!</button>
  268. <br class="9i2"><br class="Main 2">
  269. <button class="11i2">Start Aito!</button>
  270. <button class="12i2">Active 4 Player Trick</button>
  271. <button class="13i2">Enable L Key!</button>
  272. <br class="14i2"><br class="Main 3!">
  273. <input type="text" value="1" class="16i2" placeholder="Player Rank" style="width: 25%;">
  274. <button class="18i2">Active Player Finder</button>
  275. <button class="25i2">Follow Position</button> &nbsp;
  276. <br class="19i2"><br class="Normal Scripts!">
  277. <button class="0i3" onclick="RecordBase();">Record Base!</button>
  278. <button class="1i3" onclick="buildRecordedBase();">Build Recorded Base!</button>
  279. <button class="2i3" onclick="DeleteRecordedbase();">Delete Recorded Base!</button>
  280. <br class="3i3"><br class="4i3">
  281. <button class="5i3" onclick="RecordBase2();">Record Base (2)!</button>
  282. <button class="6i3" onclick="buildRecordedBase2();">Build Recorded Base (2)!</button>
  283. <button class="7i3" onclick="DeleteRecordedbase2();">Delete Recorded Base (2)!</button>
  284. <br class="8i3"><br class="9i3">
  285. <button class="10i3" onclick="RecordBase3();">Record Base (3)!</button>
  286. <button class="11i3" onclick="buildRecordedBase3();">Build Recorded Base (3)!</button>
  287. <button class="12i3" onclick="DeleteRecordedbase3();">Delete Recorded Base (3)!</button>
  288. <br class="13i3"><br class="14i3">
  289. <button class="15i3" onclick="saveBase();">Save Towers!</button>
  290. <button class="16i3" onclick="buildSavedBase();">Build Saved Towers!</button>
  291. <br class="17i3"><br class="18i3">
  292. <button class="21i3" onclick="autobuildtoggle();">Enable Auto Build Saved Towers!</button>
  293. <button class="26i3" onclick="upgradealltoggle();">Enable Upgrade All!</button>
  294. <br class="28i3"><br class="29i3">
  295. <input type="text" class="30i3" placeholder='Click "Save Towers!" and build your favorite base to get their codes.' style="width: 100%" disabled="true">
  296. <br class="31i3"><br class="32i3">
  297. `;
  298. let Main1Keys = true;
  299. let Main2Keys = true;
  300. let Main3Keys = true;
  301. displayAllToNone();
  302. let upgradeAll = false;
  303. let AHRC = false;
  304. let autobow = false;
  305. let accept = false;
  306. let kick = false;
  307. let run = false;
  308. let heal = true;
  309. let revive = true;
  310. let clearMsgs = false;
  311. let kick1p = false;
  312. let autobuild = false;
  313. let upgradeAll2 = false;
  314. let petTimeout = false;
  315. let myPlayer;
  316. let myPet;
  317. let shouldHealPet;
  318. let autohi;
  319. let autorss;
  320. let uid;
  321. let entities = {};
  322. let players = {};
  323. let buildings = {};
  324. let msg;
  325. let packets = {
  326. 0: "PACKET_ENTITY_UPDATE",
  327. 1: "PACKET_PLAYER_COUNTER_UPDATE",
  328. 2: "PACKET_SET_WORLD_DIMENSIONS",
  329. 3: "PACKET_INPUT",
  330. 4: "PACKET_ENTER_WORLD",
  331. 7: "PACKET_PING",
  332. 9: "PACKET_RPC",
  333. PACKET_ENTER_WORLD: 4,
  334. PACKET_ENTITY_UPDATE: 0,
  335. PACKET_INPUT: 3,
  336. PACKET_PING: 7,
  337. PACKET_PLAYER_COUNTER_UPDATE: 1,
  338. PACKET_RPC: 9,
  339. PACKET_SET_WORLD_DIMENSIONS: 2
  340. }
  341. game.network.addPacketHandler = function (event, callback) {
  342. console.log(packets[event], callback);
  343. game.network.emitter.on(packets[event], callback);
  344. }
  345. game.network.emitter.removeListener('PACKET_ENTITY_UPDATE', game.network.emitter._events.PACKET_ENTITY_UPDATE);
  346. game.network.addPacketHandler(0, function(e) {
  347. msg = e;
  348. interval();
  349. })
  350. for (let i = 0; i < 10; i++) {
  351. game.network.addPacketHandler(i, function(e) {
  352. msg = e;
  353. interval();
  354. })
  355. }
  356. let interval = () => {
  357. if (msg.uid) {
  358. uid = msg.uid;
  359. players = {};
  360. entities = {};
  361. buildings = {};
  362. window.message = 0;
  363. }
  364. if (msg.entities) {
  365. if (window.message == 0) {
  366. game.world.replicator.onEntityUpdate(msg);
  367. }
  368. if (msg.entities[uid].name) {
  369. myPlayer = msg.entities[uid];
  370. }
  371. for (let g in myPlayer) {
  372. if (myPlayer[g] !== msg.entities[uid][g] && msg.entities[uid][g] !== undefined) {
  373. myPlayer[g] = msg.entities[uid][g];
  374. }
  375. }
  376. if (myPlayer.petUid) {
  377. if (msg.entities[myPlayer.petUid]) {
  378. if (msg.entities[myPlayer.petUid].model) {
  379. myPet = msg.entities[myPlayer.petUid];
  380. shouldHealPet = false;
  381. }
  382. }
  383. for (let g in myPet) {
  384. if (msg.entities[myPlayer.petUid]) {
  385. if (myPet[g] !== msg.entities[myPlayer.petUid][g] && msg.entities[myPlayer.petUid][g] !== undefined) {
  386. myPet[g] = msg.entities[myPlayer.petUid][g]
  387. }
  388. }
  389. }
  390. }
  391. for (let i in msg.entities) {
  392. if (msg.entities[i].name) {
  393. players[i] = msg.entities[i];
  394. if (autohi) {
  395. game.network.sendRpc({name: "SendChatMessage", channel: "Local", message: "Hello there, " + msg.entities[i].name})
  396. }
  397. if (autorss) {
  398. game.network.sendRpc({name: "SendChatMessage", channel: "Local", message: msg.entities[i].name + ", W: " + counter(msg.entities[i].wood) + ", S: " + counter(msg.entities[i].stone) + ", G: " + counter(msg.entities[i].gold) + ", T: " + Math.floor(msg.entities[i].token) + ";"})
  399. }
  400. }
  401. }
  402. for (let i in players) {
  403. if (!msg.entities[i]) {
  404. delete players[i];
  405. }
  406. for (let g in players[i]) {
  407. if (players[i][g] !== msg.entities[i][g] && msg.entities[i][g] !== undefined) {
  408. players[i][g] = msg.entities[i][g];
  409. }
  410. }
  411. }
  412. }
  413. if (game.world.inWorld) {
  414. let entities = Game.currentGame.world.entities;
  415. if (upgradeAll) {
  416. if (!window.upgradeAll1) {
  417. window.upgradeAll1 = true;
  418. setTimeout(() => { window.upgradeAll1 = false; }, 100);
  419. for(let uid in entities) {
  420. if(entities[uid].fromTick.tier !== 8 || entities[uid].fromTick.tier !== GetGoldStash().uid) {
  421. Game.currentGame.network.sendRpc({
  422. name: "UpgradeBuilding",
  423. uid: game.world.entities[uid].fromTick.uid
  424. });
  425. }
  426. }
  427. }
  428. }
  429. if (AHRC) {
  430. if (!window.AHRC1) {
  431. window.AHRC1 = true;
  432. setTimeout(() => { window.AHRC1 = false; }, 75);
  433. for(let uid in entities) {
  434. if(!entities.hasOwnProperty(uid)) continue;
  435. let obj = entities[uid];
  436. Game.currentGame.network.sendRpc({
  437. name: "CollectHarvester",
  438. uid: obj.fromTick.uid
  439. });
  440. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 1) {
  441. Game.currentGame.network.sendRpc({
  442. name: "AddDepositToHarvester",
  443. uid: obj.fromTick.uid,
  444. deposit: 0.07
  445. });
  446. }
  447. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 2) {
  448. Game.currentGame.network.sendRpc({
  449. name: "AddDepositToHarvester",
  450. uid: obj.fromTick.uid,
  451. deposit: 0.11
  452. });
  453. }
  454. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 3) {
  455. Game.currentGame.network.sendRpc({
  456. name: "AddDepositToHarvester",
  457. uid: obj.fromTick.uid,
  458. deposit: 0.17
  459. });
  460. }
  461. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 4) {
  462. Game.currentGame.network.sendRpc({
  463. name: "AddDepositToHarvester",
  464. uid: obj.fromTick.uid,
  465. deposit: 0.22
  466. });
  467. }
  468. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 5) {
  469. Game.currentGame.network.sendRpc({
  470. name: "AddDepositToHarvester",
  471. uid: obj.fromTick.uid,
  472. deposit: 0.25
  473. });
  474. }
  475. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 6) {
  476. Game.currentGame.network.sendRpc({
  477. name: "AddDepositToHarvester",
  478. uid: obj.fromTick.uid,
  479. deposit: 0.28
  480. });
  481. }
  482. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 7) {
  483. Game.currentGame.network.sendRpc({
  484. name: "AddDepositToHarvester",
  485. uid: obj.fromTick.uid,
  486. deposit: 0.42
  487. });
  488. }
  489. if(obj.fromTick.model == "Harvester" && obj.fromTick.tier == 8) {
  490. Game.currentGame.network.sendRpc({
  491. name: "AddDepositToHarvester",
  492. uid: obj.fromTick.uid,
  493. deposit: 0.65
  494. });
  495. }
  496. }
  497. }
  498. }
  499. if (autobow) {
  500. game.network.sendInput({space: 0})
  501. game.network.sendInput({space: 1})
  502. }
  503. if (accept) {
  504. for (let i2 = 0; i2 < document.getElementsByClassName("btn btn-green hud-confirmation-accept").length; i2++) {
  505. document.getElementsByClassName("btn btn-green hud-confirmation-accept")[i2].click();
  506. }
  507. }
  508. if (kick) {
  509. for (let i in Game.currentGame.ui.playerPartyMembers) {
  510. Game.currentGame.network.sendRpc({
  511. name: "KickParty",
  512. uid: Game.currentGame.ui.playerPartyMembers[i].playerUid
  513. })
  514. }
  515. }
  516. if (run) {
  517. for (let i = 0; i < document.getElementsByClassName("hud-shop-actions-equip").length; i++) {
  518. document.getElementsByClassName("hud-shop-actions-equip")[i].click();
  519. }
  520. }
  521. if (revive) {
  522. if (!window.reviver) {
  523. window.reviver = true;
  524. setTimeout(() => { window.reviver = false; }, 1000);
  525. let element1 = document.getElementsByClassName("hud-shop-actions-revive");
  526. for (let i=0;i<element1.length;i++) {
  527. element1[i].click();
  528. }
  529. let element2 = document.getElementsByClassName("hud-shop-actions-evolve");
  530. for (let i=0;i<element2.length;i++) {
  531. element2[i].click();
  532. }
  533. }
  534. }
  535. if (clearMsgs) {
  536. for (let i = 0; i < document.getElementsByClassName('hud-chat-message').length; i++) {
  537. document.getElementsByClassName('hud-chat-message')[i].remove();
  538. }
  539. }
  540. if (kick1p) {
  541. let player = document.getElementsByClassName("12i5")[0].value;
  542. for (let i in Game.currentGame.ui.playerPartyMembers) {
  543. if (Game.currentGame.ui.playerPartyMembers[i].displayName == player) {
  544. Game.currentGame.network.sendRpc({
  545. name: "KickParty",
  546. uid: Game.currentGame.ui.playerPartyMembers[i].playerUid
  547. })
  548. }
  549. }
  550. }
  551. if (autobuild) {
  552. if (!window.autobuildtimeout) {
  553. window.autobuildtimeout = true;
  554. setTimeout(() => { window.autobuildtimeout = false; }, 1250)
  555. if (GetGoldStash !== undefined) {
  556. window.buildSavedBase();
  557. }
  558. }
  559. }
  560. if (upgradeAll2) {
  561. if (!window.upgradeAll2) {
  562. window.upgradeAll2 = true;
  563. setTimeout(() => { window.upgradeAll2 = false; }, 500);
  564. for(let uid in entities) {
  565. if(entities[uid].fromTick.tier !== 8 || entities[uid].fromTick.tier !== GetGoldStash().uid) {
  566. Game.currentGame.network.sendRpc({
  567. name: "UpgradeBuilding",
  568. uid: game.world.entities[uid].fromTick.uid
  569. });
  570. }
  571. }
  572. }
  573. }
  574. if (heal) {
  575. if (myPlayer) {
  576. let playerHealth = (myPlayer.health/myPlayer.maxHealth) * 100;
  577. if (playerHealth <= 70) {
  578. healPlayer();
  579. }
  580. }
  581. }
  582. if (heal) {
  583. if (myPet) {
  584. let petHealth = (myPet.health/myPet.maxHealth) * 100;
  585. if (petHealth <= 70) {
  586. if (!petTimeout) {
  587. petTimeout = true;
  588. setTimeout(() => { petTimeout = false; }, 300);
  589. game.network.sendRpc({"name": "BuyItem", "itemName": "PetHealthPotion", "tier": 1})
  590. game.network.sendRpc({"name": "EquipItem", "itemName": "PetHealthPotion", "tier": 1})
  591. }
  592. }
  593. }
  594. }
  595. if (window.findPlayer) {
  596. if (myPlayer.position.y-window.playerY > 100 || Math.sqrt(Math.pow((myPlayer.position.y-window.playerY), 2) + Math.pow((myPlayer.position.x-window.playerX), 2)) < 100) {
  597. game.network.sendInput({down: 0})
  598. } else {
  599. game.network.sendInput({down: 1})
  600. }
  601. if (-myPlayer.position.y+window.playerY > 100 || Math.sqrt(Math.pow((myPlayer.position.y-window.playerY), 2) + Math.pow((myPlayer.position.x-window.playerX), 2)) < 100) {
  602. game.network.sendInput({up: 0})
  603. } else {
  604. game.network.sendInput({up: 1})
  605. }
  606. if (-myPlayer.position.x+window.playerX > 100 || Math.sqrt(Math.pow((myPlayer.position.y-window.playerY), 2) + Math.pow((myPlayer.position.x-window.playerX), 2)) < 100) {
  607. game.network.sendInput({left: 0})
  608. } else {
  609. game.network.sendInput({left: 1})
  610. }
  611. if (myPlayer.position.x-window.playerX > 100 || Math.sqrt(Math.pow((myPlayer.position.y-window.playerY), 2) + Math.pow((myPlayer.position.x-window.playerX), 2)) < 100) {
  612. game.network.sendInput({right: 0})
  613. } else {
  614. game.network.sendInput({right: 1})
  615. }
  616. }
  617. }
  618. }
  619. document.getElementsByClassName("emm")[0].addEventListener('click', function() {
  620. window.mousemove = !window.mousemove;
  621. this.innerText = window.mousemove ? "Disable MouseMove!" : "Enable MouseMove!"
  622. })
  623. document.getElementsByClassName("0i")[0].addEventListener('click', function() {
  624. for(let uid in game.ui.buildings) {
  625. if(game.ui.buildings[uid].type == "GoldStash") {
  626. Game.currentGame.network.sendRpc({
  627. name: "DeleteBuilding",
  628. uid: game.ui.buildings[uid].uid
  629. });
  630. }
  631. }
  632. })
  633. document.getElementsByClassName("1i")[0].addEventListener('click', function() {
  634. for(let uid in game.ui.buildings) {
  635. if(game.ui.buildings[uid].type !== "GoldStash") {
  636. Game.currentGame.network.sendRpc({
  637. name: "DeleteBuilding",
  638. uid: game.ui.buildings[uid].uid
  639. });
  640. }
  641. }
  642. })
  643. document.getElementsByClassName("2i")[0].addEventListener('click', function() {
  644. for(let uid in game.ui.buildings) {
  645. if(game.ui.buildings[uid].type == "Wall") {
  646. Game.currentGame.network.sendRpc({
  647. name: "DeleteBuilding",
  648. uid: game.ui.buildings[uid].uid
  649. });
  650. }
  651. }
  652. })
  653. document.getElementsByClassName("3i")[0].addEventListener('click', function() {
  654. for(let uid in game.ui.buildings) {
  655. if(game.ui.buildings[uid].type == "Door") {
  656. Game.currentGame.network.sendRpc({
  657. name: "DeleteBuilding",
  658. uid: game.ui.buildings[uid].uid
  659. });
  660. }
  661. }
  662. })
  663. document.getElementsByClassName("4i")[0].addEventListener('click', function() {
  664. for(let uid in game.ui.buildings) {
  665. if(game.ui.buildings[uid].type == "SlowTrap") {
  666. Game.currentGame.network.sendRpc({
  667. name: "DeleteBuilding",
  668. uid: game.ui.buildings[uid].uid
  669. });
  670. }
  671. }
  672. })
  673. document.getElementsByClassName("5i")[0].addEventListener('click', function() {
  674. for(let uid in game.ui.buildings) {
  675. if(game.ui.buildings[uid].type == "ArrowTower") {
  676. Game.currentGame.network.sendRpc({
  677. name: "DeleteBuilding",
  678. uid: game.ui.buildings[uid].uid
  679. });
  680. }
  681. }
  682. })
  683. document.getElementsByClassName("6i")[0].addEventListener('click', function() {
  684. for(let uid in game.ui.buildings) {
  685. if(game.ui.buildings[uid].type == "MagicTower") {
  686. Game.currentGame.network.sendRpc({
  687. name: "DeleteBuilding",
  688. uid: game.ui.buildings[uid].uid
  689. });
  690. }
  691. }
  692. })
  693. document.getElementsByClassName("7i")[0].addEventListener('click', function() {
  694. for(let uid in game.world.entities) {
  695. if(game.world.entities[uid].fromTick.model == "PetCARL" || game.world.entities[uid].fromTick.model == "PetMiner") {
  696. Game.currentGame.network.sendRpc({
  697. name: "DeleteBuilding",
  698. uid: game.world.entities[uid].fromTick.uid
  699. });
  700. }
  701. }
  702. })
  703. document.getElementsByClassName("8i")[0].addEventListener('click', function() {
  704. upgradeAll = !upgradeAll;
  705. document.getElementsByClassName("8i")[0].className = "btn btn-blue 8i";
  706. document.getElementsByClassName("8i")[0].innerText = "Active Upgrade All!";
  707. if (upgradeAll) {
  708. document.getElementsByClassName("8i")[0].className = "btn btn-red 8i";
  709. document.getElementsByClassName("8i")[0].innerText = "Inactive Upgrade All!";
  710. }
  711. })
  712. document.getElementsByClassName("10i")[0].addEventListener('click', function() {
  713. autobow = !autobow;
  714. let playerWeapon = game.ui.playerTick.weaponName;
  715. document.getElementsByClassName("10i")[0].className = "btn btn-blue 10i";
  716. document.getElementsByClassName("10i")[0].innerText = "Enable Autobow";
  717. if (autobow) {
  718. document.getElementsByClassName("10i")[0].className = "btn btn-red 10i";
  719. document.getElementsByClassName("10i")[0].innerText = "Disable Autobow";
  720. if (game.ui.inventory.Spear) {
  721. game.network.sendRpc({name: "EquipItem", itemName: "Bow", tier: game.ui.inventory.Bow.tier})
  722. } else {
  723. game.network.sendRpc({name: "BuyItem", itemName: "Bow", tier: 1})
  724. game.network.sendRpc({name: "EquipItem", itemName: "Bow", tier: 1})
  725. }
  726. } else {
  727. game.network.sendRpc({name: "EquipItem", itemName: playerWeapon, tier: game.ui.inventory[playerWeapon].tier})
  728. }
  729. })
  730. document.getElementsByClassName("13i")[0].addEventListener('click', function() {
  731. accept = !accept;
  732. document.getElementsByClassName("13i")[0].className = "btn btn-blue 13i";
  733. document.getElementsByClassName("13i")[0].innerText = "Enable Auto Accepter";
  734. if (accept) {
  735. document.getElementsByClassName("13i")[0].className = "btn btn-red 13i";
  736. document.getElementsByClassName("13i")[0].innerText = "Disable Auto Accepter";
  737. }
  738. })
  739. document.getElementsByClassName("14i")[0].addEventListener('click', function() {
  740. kick = !kick;
  741. document.getElementsByClassName("14i")[0].className = "btn btn-blue 14i";
  742. document.getElementsByClassName("14i")[0].innerText = "Enable Auto Kicker";
  743. if (kick) {
  744. document.getElementsByClassName("14i")[0].className = "btn btn-red 14i";
  745. document.getElementsByClassName("14i")[0].innerText = "Disable Auto Kicker";
  746. }
  747. })
  748. document.getElementsByClassName("0i5")[0].addEventListener('click', function() {
  749. for (let i in game.ui.playerPartyMembers) {
  750. game.network.sendRpc({name: "SetPartyMemberCanSell", uid: game.ui.playerPartyMembers[i].playerUid, canSell: 1})
  751. }
  752. })
  753. document.getElementsByClassName("1i5")[0].addEventListener('click', function() {
  754. for (let i in game.ui.playerPartyMembers) {
  755. game.network.sendRpc({name: "KickParty", uid: game.ui.playerPartyMembers[i].playerUid})
  756. }
  757. })
  758. document.getElementsByClassName("6i5")[0].addEventListener('click', function() {
  759. run = !run;
  760. document.getElementsByClassName("6i5")[0].className = "btn btn-blue 6i5";
  761. document.getElementsByClassName("6i5")[0].innerText = "Enable Speed Run";
  762. if (run) {
  763. document.getElementsByClassName("6i5")[0].className = "btn btn-red 6i5";
  764. document.getElementsByClassName("6i5")[0].innerText = "Disable Speed Run";
  765. }
  766. })
  767. document.getElementsByClassName("8i5")[0].addEventListener('click', function() {
  768. heal = !heal;
  769. document.getElementsByClassName("8i5")[0].className = "btn btn-green 8i5";
  770. document.getElementsByClassName("8i5")[0].innerText = "Auto heal and Pet Heal";
  771. if (heal) {
  772. document.getElementsByClassName("8i5")[0].className = "btn btn-red 8i5";
  773. document.getElementsByClassName("8i5")[0].innerText = "!(Auto heal and Pet Heal)";
  774. }
  775. })
  776. document.getElementsByClassName("9i5")[0].addEventListener('click', function() {
  777. revive = !revive;
  778. document.getElementsByClassName("9i5")[0].className = "btn btn-green 9i5";
  779. document.getElementsByClassName("9i5")[0].innerText = "Revive and Evolve Pets";
  780. if (revive) {
  781. document.getElementsByClassName("9i5")[0].className = "btn btn-red 9i5";
  782. document.getElementsByClassName("9i5")[0].innerText = "!(Revive and Evolve Pets)";
  783. }
  784. })
  785. document.getElementsByClassName("10i5")[0].addEventListener('click', function() {
  786. clearMsgs = !clearMsgs;
  787. document.getElementsByClassName("10i5")[0].className = "btn btn-blue 10i5";
  788. document.getElementsByClassName("10i5")[0].innerText = "Clear Messages";
  789. if (clearMsgs) {
  790. document.getElementsByClassName("10i5")[0].className = "btn btn-red 10i5";
  791. document.getElementsByClassName("10i5")[0].innerText = "!(Clear Messages)";
  792. }
  793. })
  794. document.getElementsByClassName("13i5")[0].addEventListener('click', function() {
  795. kick1p = !kick1p;
  796. document.getElementsByClassName("13i5")[0].className = "btn btn-white 13i5";
  797. document.getElementsByClassName("13i5")[0].innerText = "Active Player Kicker";
  798. if (kick1p) {
  799. document.getElementsByClassName("13i5")[0].className = "btn btn-red 13i5";
  800. document.getElementsByClassName("13i5")[0].innerText = "!(Active Player Kicker)";
  801. }
  802. })
  803. document.getElementsByClassName("12i2")[0].addEventListener('click', function() {
  804. window.shouldStartScript = !window.shouldStartScript;
  805. document.getElementsByClassName("12i2")[0].innerText = "Active 4 Player Trick";
  806. if (window.shouldStartScript) {
  807. document.getElementsByClassName("12i2")[0].innerText = "!(Active 4 Player Trick)";
  808. }
  809. })
  810. document.getElementsByClassName("13i2")[0].addEventListener('click', function() {
  811. window.startaito7 = !window.startaito7;
  812. LKeyWithTimeouts();
  813. document.getElementsByClassName("13i2")[0].innerText = "Enable L Key!";
  814. if (window.startaito7) {
  815. document.getElementsByClassName("13i2")[0].innerText = "Disable L Key!";
  816. }
  817. })
  818. document.getElementsByClassName("0i2")[0].addEventListener('click', function() {
  819. window.sendWs();
  820. })
  821. document.getElementsByClassName("1i2")[0].addEventListener('click', function() {
  822. setTimeout(() => {
  823. if (window.aim) {
  824. document.getElementsByClassName("1i2")[0].innerText = "Disable Aim!";
  825. } else {
  826. document.getElementsByClassName("1i2")[0].innerText = "Enable Aim!";
  827. }
  828. }, 100)
  829. })
  830. document.getElementsByClassName("2i2")[0].addEventListener('click', function() {
  831. setTimeout(() => {
  832. if (window.move) {
  833. document.getElementsByClassName("2i2")[0].innerText = "Disable Player Follower!";
  834. } else {
  835. document.getElementsByClassName("2i2")[0].innerText = "Enable Player Follower!";
  836. }
  837. }, 100)
  838. })
  839. document.getElementsByClassName("11i2")[0].addEventListener('click', function() {
  840. window.startaito = !window.startaito;
  841. window.sendAitoAlt();
  842. if (window.startaito) {
  843. document.getElementsByClassName("11i2")[0].innerText = "Stop Aito!";
  844. } else {
  845. document.getElementsByClassName("11i2")[0].innerText = "Start Aito!";
  846. }
  847. });
  848. document.getElementsByClassName("3i2")[0].addEventListener('click', function() {
  849. let id = Math.floor(document.getElementsByClassName("4i2")[0].value);
  850. window.allSockets[id-1].close();
  851. })
  852. game.network.sendInput = (e) => {
  853. let i = e;
  854. if (!i.mouseDown && !i.mouseUp) {
  855. game.network.sendPacket(3, e);
  856. }
  857. }
  858. document.getElementsByClassName('hud')[0].addEventListener('mousedown', e => {
  859. if (!e.button) {
  860. game.network.sendPacket(3, {mouseDown: game.inputPacketCreator.screenToYaw(e.clientX, e.clientY)})
  861. }
  862. })
  863. document.getElementsByClassName('hud')[0].addEventListener('mouseup', e => {
  864. if (!e.button) {
  865. game.network.sendPacket(3, {mouseUp: 1})
  866. }
  867. })
  868. window.RecordBase = function(baseName) {
  869. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() {
  870. game.ui.components.PopupOverlay.showHint("Successfully recorded!");
  871. let buildings = Game.currentGame.ui.buildings;
  872. let base = "";
  873. let stash = GetGoldStash();
  874. if (stash == undefined) {
  875. return
  876. }
  877. let stashPosition = {
  878. x: stash.x,
  879. y: stash.y
  880. }
  881. for (var uid in buildings) {
  882. if (!buildings.hasOwnProperty(uid)) {
  883. continue
  884. }
  885. let obj = buildings[uid]
  886. let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x
  887. let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y
  888. let building = Game.currentGame.ui.buildings[obj.uid].type
  889. let yaw = 180;
  890. base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");"
  891. }
  892. localStorage.RecordedBase1 = base
  893. })
  894. }
  895. window.buildRecordedBase = function() {
  896. let waitForGoldStash = setInterval(function() {
  897. if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") {
  898. stash = GetGoldStash();
  899. if (stash == undefined) return
  900. stashPosition = {
  901. x: stash.x,
  902. y: stash.y
  903. }
  904. clearInterval(waitForGoldStash)
  905. game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!");
  906. var basecode = localStorage.RecordedBase1
  907. basecode = new Function(basecode)
  908. return basecode()
  909. }
  910. }, 275)
  911. }
  912. window.DeleteRecordedbase = function() {
  913. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() {
  914. game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!");
  915. localStorage.RecordedBase1 = null;
  916. })
  917. }
  918. window.RecordBase2 = function(baseName) {
  919. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() {
  920. game.ui.components.PopupOverlay.showHint("Successfully recorded!");
  921. let buildings = Game.currentGame.ui.buildings;
  922. let base = "";
  923. let stash = GetGoldStash();
  924. if (stash == undefined) {
  925. return
  926. }
  927. let stashPosition = {
  928. x: stash.x,
  929. y: stash.y
  930. }
  931. for (var uid in buildings) {
  932. if (!buildings.hasOwnProperty(uid)) {
  933. continue
  934. }
  935. let obj = buildings[uid]
  936. let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x
  937. let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y
  938. let building = Game.currentGame.ui.buildings[obj.uid].type
  939. let yaw = 180;
  940. base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");"
  941. }
  942. localStorage.RecordedBase2 = base
  943. })
  944. }
  945. window.buildRecordedBase2 = function() {
  946. var waitForGoldStash = setInterval(function() {
  947. if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") {
  948. stash = GetGoldStash();
  949. if (stash == undefined) return
  950. stashPosition = {
  951. x: stash.x,
  952. y: stash.y
  953. }
  954. clearInterval(waitForGoldStash)
  955. game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!");
  956. var basecode = localStorage.RecordedBase2
  957. basecode = new Function(basecode)
  958. return basecode()
  959. }
  960. }, 275)
  961. }
  962. window.DeleteRecordedbase2 = function() {
  963. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() {
  964. game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!");
  965. localStorage.RecordedBase2 = null;
  966. })
  967. }
  968. window.RecordBase3 = function(baseName) {
  969. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to record base? If you recorded it twice, the first recorded base will be deleted.", 1e4, function() {
  970. game.ui.components.PopupOverlay.showHint("Successfully recorded!");
  971. let buildings = Game.currentGame.ui.buildings;
  972. let base = "";
  973. let stash = GetGoldStash();
  974. if (stash == undefined) {
  975. return
  976. }
  977. let stashPosition = {
  978. x: stash.x,
  979. y: stash.y
  980. }
  981. for (var uid in buildings) {
  982. if (!buildings.hasOwnProperty(uid)) {
  983. continue
  984. }
  985. let obj = buildings[uid]
  986. let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x
  987. let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y
  988. let building = Game.currentGame.ui.buildings[obj.uid].type
  989. let yaw = 180;
  990. base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");"
  991. }
  992. localStorage.RecordedBase3 = base
  993. })
  994. }
  995. window.buildRecordedBase3 = function() {
  996. var waitForGoldStash = setInterval(function() {
  997. if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") {
  998. stash = GetGoldStash();
  999. if (stash == undefined) return
  1000. stashPosition = {
  1001. x: stash.x,
  1002. y: stash.y
  1003. }
  1004. clearInterval(waitForGoldStash)
  1005. game.ui.components.PopupOverlay.showHint("Successfully recorded base were built!");
  1006. var basecode = localStorage.RecordedBase3
  1007. basecode = new Function(basecode)
  1008. return basecode()
  1009. }
  1010. }, 275)
  1011. }
  1012. window.DeleteRecordedbase3 = function() {
  1013. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete recorded base?", 1e4, function() {
  1014. game.ui.components.PopupOverlay.showHint("Successfully recorded base has been deleted!");
  1015. localStorage.RecordedBase3 = null;
  1016. })
  1017. }
  1018. window.buildSavedBase = function() {
  1019. var waitForGoldStash = setInterval(function() {
  1020. if (document.querySelectorAll("[data-building]")[10].classList[1] == "is-disabled") {
  1021. stash = GetGoldStash();
  1022. if (stash == undefined) return
  1023. stashPosition = {
  1024. x: stash.x,
  1025. y: stash.y
  1026. }
  1027. clearInterval(waitForGoldStash)
  1028. game.ui.components.PopupOverlay.showHint("Successfully saved base were built!");
  1029. var basecode = document.getElementsByClassName("30i3")[0].value;
  1030. basecode = new Function(basecode)
  1031. return basecode()
  1032. }
  1033. }, 275)
  1034. }
  1035. window.saveBase = () => {
  1036. game.ui.components.PopupOverlay.showHint("Successfully saved!");
  1037. let buildings = Game.currentGame.ui.buildings;
  1038. let base = "";
  1039. let stash = GetGoldStash();
  1040. if (stash == undefined) {
  1041. return
  1042. }
  1043. let stashPosition = {
  1044. x: stash.x,
  1045. y: stash.y
  1046. }
  1047. for (var uid in buildings) {
  1048. if (!buildings.hasOwnProperty(uid)) {
  1049. continue
  1050. }
  1051. let obj = buildings[uid]
  1052. let x = Game.currentGame.ui.buildings[obj.uid].x - stashPosition.x
  1053. let y = Game.currentGame.ui.buildings[obj.uid].y - stashPosition.y
  1054. let building = Game.currentGame.ui.buildings[obj.uid].type
  1055. let yaw = 180;
  1056. base += "PlaceBuilding(stashPosition.x + " + x + ", stashPosition.y + " + y + ", '" + building + "', " + yaw + ");";
  1057. }
  1058. document.getElementsByClassName("30i3")[0].value = base;
  1059. }
  1060. window.upgradealltoggle = () => {
  1061. upgradeAll2 = !upgradeAll2;
  1062. document.getElementsByClassName("26i3")[0].innerText = "Enable Upgrade All!";
  1063. if (upgradeAll2) {
  1064. document.getElementsByClassName("26i3")[0].innerText = "Disable Upgrade All!";
  1065. }
  1066. }
  1067. function GetGoldStash() {
  1068. for (let i in game.ui.buildings) {
  1069. if (game.ui.buildings[i].type == "GoldStash") {
  1070. return game.ui.buildings[i];
  1071. }
  1072. }
  1073. }
  1074. window.PlaceBuilding = function(x, y, building, yaw) {
  1075. Game.currentGame.network.sendRpc({
  1076. name: "MakeBuilding",
  1077. x: x,
  1078. y: y,
  1079. type: building,
  1080. yaw: yaw
  1081. })
  1082. }
  1083. function counter(e = 0) {
  1084. if (e <= -0.99949999999999999e24) {
  1085. return Math.round(e/-1e23)/-10 + "TT";
  1086. }
  1087. if (e <= -0.99949999999999999e21) {
  1088. return Math.round(e/-1e20)/-10 + "TB";
  1089. }
  1090. if (e <= -0.99949999999999999e18) {
  1091. return Math.round(e/-1e17)/-10 + "TM";
  1092. }
  1093. if (e <= -0.99949999999999999e15) {
  1094. return Math.round(e/-1e14)/-10 + "TK";
  1095. }
  1096. if (e <= -0.99949999999999999e12) {
  1097. return Math.round(e/-1e11)/-10 + "T";
  1098. }
  1099. if (e <= -0.99949999999999999e9) {
  1100. return Math.round(e/-1e8)/-10 + "B";
  1101. }
  1102. if (e <= -0.99949999999999999e6) {
  1103. return Math.round(e/-1e5)/-10 + "M";
  1104. }
  1105. if (e <= -0.99949999999999999e3) {
  1106. return Math.round(e/-1e2)/-10 + "K";
  1107. }
  1108. if (e <= 0.99949999999999999e3) {
  1109. return Math.round(e) + "";
  1110. }
  1111. if (e <= 0.99949999999999999e6) {
  1112. return Math.round(e/1e2)/10 + "K";
  1113. }
  1114. if (e <= 0.99949999999999999e9) {
  1115. return Math.round(e/1e5)/10 + "M";
  1116. }
  1117. if (e <= 0.99949999999999999e12) {
  1118. return Math.round(e/1e8)/10 + "B";
  1119. }
  1120. if (e <= 0.99949999999999999e15) {
  1121. return Math.round(e/1e11)/10 + "T";
  1122. }
  1123. if (e <= 0.99949999999999999e18) {
  1124. return Math.round(e/1e14)/10 + "TK";
  1125. }
  1126. if (e <= 0.99949999999999999e21) {
  1127. return Math.round(e/1e17)/10 + "TM";
  1128. }
  1129. if (e <= 0.99949999999999999e24) {
  1130. return Math.round(e/1e20)/10 + "TB";
  1131. }
  1132. if (e <= 0.99949999999999999e27) {
  1133. return Math.round(e/1e+23)/10 + "TT";
  1134. }
  1135. if (e >= 0.99949999999999999e27) {
  1136. return Math.round(e/1e+23)/10 + "TT";
  1137. }
  1138. }
  1139. function healPlayer() {
  1140. if (!game.ui.components.PlacementOverlay.buildingId && !game.ui.components.BuildingOverlay.buildingId) {
  1141. Game.currentGame.network.sendRpc({
  1142. "name": "BuyItem",
  1143. "itemName": "HealthPotion",
  1144. "tier": 1
  1145. })
  1146. Game.currentGame.network.sendRpc({
  1147. "name": "EquipItem",
  1148. "itemName": "HealthPotion",
  1149. "tier": 1
  1150. })
  1151. }
  1152. }
  1153. window.allSockets = [];
  1154. window.FKey = false;
  1155. window.FKeyOn = null;
  1156. window.socketId1 = 1;
  1157. window.socketId2 = 2;
  1158. var cloneTimeout = false;
  1159. window.sendWs = () => {
  1160. let mousePosition3;
  1161. let isOnControl = true;
  1162. let isTrue = true;
  1163. let ws = new WebSocket(`ws://${game.options.servers[game.options.serverId].hostname}:8000`);
  1164. if (!window.allSockets[window.allSockets.length]) {
  1165. ws.cloneId = window.allSockets.length + 1;
  1166. window.allSockets[window.allSockets.length] = ws;
  1167. }
  1168. ws.binaryType = "arraybuffer";
  1169. ws.aimingYaw = 1;
  1170. ws.onclose = () => {
  1171. ws.isclosed = true;
  1172. }
  1173. ws.onopen = () => {
  1174. ws.network = new Game.currentGame.networkType();
  1175. ws.network.sendInput = (t) => { ws.network.sendPacket(3, t); };
  1176. ws.network.sendRpc = (t) => { ws.network.sendPacket(9, t); };
  1177. ws.network.sendPacket = (e, t) => { if (!ws.isclosed) { ws.send(ws.network.codec.encode(e, t)); } };
  1178. }
  1179. ws.onEnterWorld = () => {
  1180. // useless
  1181. }
  1182. ws.onmessage = msg => {
  1183. ws.data = ws.network.codec.decode(msg.data);
  1184. switch (ws.data.opcode) {
  1185. case 5:
  1186. ws.send(ws.network.codec.encode(4, { displayName: game.options.nickname, extra: ws.data.extra }));
  1187. break;
  1188. }
  1189. if (isTrue) {
  1190. isTrue = !isTrue;
  1191. if (ws.psk) {
  1192. ws.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: Game.currentGame.ui.getPlayerPartyShareKey() + ""});
  1193. } else {
  1194. setTimeout(() => {
  1195. if (ws.psk) {
  1196. ws.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: Game.currentGame.ui.getPlayerPartyShareKey() + ""});
  1197. }
  1198. }, 250)
  1199. }
  1200. ws.network.sendInput({up: 1});
  1201. ws.mouseUp = 1;
  1202. ws.mouseDown = 0;
  1203. ws.f = false;
  1204. function mouseMoved(e, x, y, d) {
  1205. ws.aimingYaw = e;
  1206. if (ws.mouseDown && !ws.mouseUp) {
  1207. ws.network.sendInput({mouseMovedWhileDown: e, worldX: x, worldY: y, distance: d});
  1208. }
  1209. if (!ws.mouseDown && ws.mouseUp) {
  1210. ws.network.sendInput({mouseMoved: e, worldX: x, worldY: y, distance: d});
  1211. }
  1212. }
  1213. document.addEventListener('mousemove', mousemove => {
  1214. if (isOnControl) {
  1215. if (!ws.isclosed) {
  1216. mousePosition3 = game.renderer.screenToWorld(mousemove.clientX, mousemove.clientY);
  1217. if (ws.myPlayer) {
  1218. if (ws.myPlayer.position) {
  1219. mouseMoved(game.inputPacketCreator.screenToYaw((-ws.myPlayer.position.x + mousePosition3.x)*100, (-ws.myPlayer.position.y + mousePosition3.y)*100), Math.floor(mousePosition3.x), Math.floor(mousePosition3.y), Math.floor(game.inputPacketCreator.distanceToCenter((-ws.myPlayer.position.x + mousePosition3.x)*100, (-ws.myPlayer.position.y + mousePosition3.y)*100)/100));
  1220. }
  1221. }
  1222. }
  1223. }
  1224. })
  1225. let SendRpc = ws.network.sendRpc;
  1226. let SendInput = ws.network.sendInput;
  1227. document.addEventListener('keydown', e => {
  1228. if (!ws.isclosed) {
  1229. if (isOnControl) {
  1230. if (e.keyCode == 81 && document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1231. setTimeout(() => {
  1232. var nextWeapon = 'Pickaxe';
  1233. var weaponOrder = ['Pickaxe', 'Spear', 'Bow', 'Bomb'];
  1234. var foundCurrent = false;
  1235. for (let i in weaponOrder) {
  1236. if (foundCurrent) {
  1237. if (ws.inventory[weaponOrder[i]]) {
  1238. nextWeapon = weaponOrder[i];
  1239. break;
  1240. }
  1241. }
  1242. else if (weaponOrder[i] == ws.myPlayer.weaponName) {
  1243. foundCurrent = true;
  1244. }
  1245. }
  1246. ws.network.sendRpc({name: 'EquipItem', itemName: nextWeapon, tier: ws.inventory[nextWeapon].tier});
  1247. }, 100);
  1248. }
  1249. if (e.keyCode == 72 && document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1250. ws.network.sendRpc({name: 'LeaveParty'});
  1251. }
  1252. if (e.keyCode == 74 && document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1253. ws.network.sendRpc({name: 'JoinPartyByShareKey', partyShareKey: game.ui.playerPartyShareKey});
  1254. }
  1255. if (e.keyCode == 32 && document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1256. setTimeout(() => {
  1257. ws.network.sendInput({space: 0});
  1258. ws.network.sendInput({space: 1});
  1259. }, 100);
  1260. }
  1261. if (e.keyCode == 82) {
  1262. if (document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1263. for (let i in game.ui.buildings) {
  1264. if (game.ui.components.BuildingOverlay.shouldUpgradeAll && game.ui.buildings[i].type == game.ui.components.BuildingOverlay.buildingId && game.ui.buildings[i].tier == game.ui.components.BuildingOverlay.buildingTier) {
  1265. ws.network.sendRpc({name: "UpgradeBuilding", uid: game.ui.buildings[i].uid});
  1266. }
  1267. }
  1268. }
  1269. }
  1270. if (e.keyCode == 46) {
  1271. if (document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1272. if (ws.myPet) {
  1273. ws.network.sendRpc({name: "DeleteBuilding", uid: ws.myPet.uid});
  1274. }
  1275. }
  1276. }
  1277. if (e.keyCode == 82) {
  1278. if (document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1279. if (!game.ui.components.BuildingOverlay.shouldUpgradeAll && game.ui.components.BuildingOverlay.buildingUid) {
  1280. ws.network.sendRpc({name: "UpgradeBuilding", uid: game.ui.components.BuildingOverlay.buildingUid});
  1281. }
  1282. }
  1283. }
  1284. if (e.keyCode == 89) {
  1285. if (document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1286. for (let i in game.ui.buildings) {
  1287. if (game.ui.components.BuildingOverlay.buildingUid && game.ui.components.BuildingOverlay.shouldUpgradeAll && game.ui.buildings[i].type == game.ui.components.BuildingOverlay.buildingId && game.ui.buildings[i].tier == game.ui.components.BuildingOverlay.buildingTier && game.ui.components.BuildingOverlay.buildingId !== "GoldStash") {
  1288. ws.network.sendRpc({name: "DeleteBuilding", uid: game.ui.buildings[i].uid})
  1289. }
  1290. }
  1291. }
  1292. }
  1293. if (e.keyCode == 84) {
  1294. if (document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1295. for (var i in game.ui.buildings) {
  1296. if (game.ui.components.BuildingOverlay.buildingUid && game.ui.components.BuildingOverlay.shouldUpgradeAll && game.ui.buildings[i].type == game.ui.components.BuildingOverlay.buildingId && game.ui.buildings[i].tier == game.ui.components.BuildingOverlay.buildingTier && game.ui.components.BuildingOverlay.buildingId !== "GoldStash") {
  1297. game.network.sendRpc({name: "DeleteBuilding", uid: game.ui.buildings[i].uid});
  1298. }
  1299. }
  1300. }
  1301. }
  1302. if (e.keyCode == 89) {
  1303. if (document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1304. if (!game.ui.components.BuildingOverlay.shouldUpgradeAll && game.ui.components.BuildingOverlay.buildingId !== "GoldStash" && game.ui.components.BuildingOverlay.buildingUid) {
  1305. ws.network.sendRpc({name: "DeleteBuilding", uid: game.ui.components.BuildingOverlay.buildingUid})
  1306. }
  1307. }
  1308. }
  1309. let KeyCode = e.keyCode;
  1310. if (document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1311. if (!ws.automove) {
  1312. if (KeyCode == 76) {
  1313. ws.network.sendInput({up: 1, down: 0});
  1314. }
  1315. if (KeyCode == 191) {
  1316. ws.network.sendInput({right: 1, left: 0});
  1317. }
  1318. if (KeyCode == 190) {
  1319. ws.network.sendInput({down: 1, up: 0});
  1320. }
  1321. if (KeyCode == 188) {
  1322. ws.network.sendInput({left: 1, right: 0});
  1323. }
  1324. if (KeyCode == 87) {
  1325. ws.network.sendInput({up: 1, down: 0});
  1326. }
  1327. if (KeyCode == 68) {
  1328. SendInput({right: 1, left: 0});
  1329. }
  1330. if (KeyCode == 83) {
  1331. ws.network.sendInput({down: 1, up: 0});
  1332. }
  1333. if (KeyCode == 65) {
  1334. ws.network.sendInput({left: 1, right: 0});
  1335. }
  1336. }
  1337. if (e.keyCode == 82) {
  1338. ws.network.sendRpc({name: "BuyItem", itemName: "HealthPotion", tier: 1})
  1339. ws.network.sendRpc({name: "EquipItem", itemName: "HealthPotion", tier: 1})
  1340. }
  1341. if (KeyCode == 78) {
  1342. ws.network.sendRpc({
  1343. "name": "EquipItem",
  1344. "itemName": "HatHorns",
  1345. "tier": 1
  1346. })
  1347. ws.network.sendRpc({
  1348. "name": "EquipItem",
  1349. "itemName": "PetCARL",
  1350. "tier": ws.inventory.PetCARL.tier
  1351. })
  1352. ws.network.sendRpc({
  1353. "name": "EquipItem",
  1354. "itemName": "PetMiner",
  1355. "tier": ws.inventory.PetMiner.tier
  1356. })
  1357. }
  1358. if (KeyCode == 77) {
  1359. ws.network.sendRpc({
  1360. "name": "BuyItem",
  1361. "itemName": "PetRevive",
  1362. "tier": 1
  1363. })
  1364. ws.network.sendRpc({
  1365. "name": "EquipItem",
  1366. "itemName": "PetRevive",
  1367. "tier": 1
  1368. })
  1369. ws.network.sendRpc({
  1370. "name": "BuyItem",
  1371. "itemName": "PetCARL",
  1372. "tier": ws.inventory.PetCARL.tier + 1
  1373. })
  1374. ws.network.sendRpc({
  1375. "name": "BuyItem",
  1376. "itemName": "PetMiner",
  1377. "tier": ws.inventory.PetMiner.tier + 1
  1378. })
  1379. }
  1380. if (KeyCode == 221) {
  1381. game.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: ws.psk.response.partyShareKey})
  1382. }
  1383. }
  1384. }
  1385. }
  1386. })
  1387. document.addEventListener('keyup', e => {
  1388. if (!ws.isclosed) {
  1389. if (isOnControl) {
  1390. let KeyCode = e.keyCode;
  1391. if (document.activeElement.tagName.toLowerCase() !== "input" && document.activeElement.tagName.toLowerCase() !== "textarea") {
  1392. if (!ws.automove) {
  1393. if (KeyCode == 76) {
  1394. ws.network.sendInput({up: 0});
  1395. }
  1396. if (KeyCode == 191) {
  1397. ws.network.sendInput({right: 0});
  1398. }
  1399. if (KeyCode == 190) {
  1400. ws.network.sendInput({down: 0});
  1401. }
  1402. if (KeyCode == 188) {
  1403. ws.network.sendInput({left: 0});
  1404. }
  1405. if (KeyCode == 87) {
  1406. ws.network.sendInput({up: 0});
  1407. }
  1408. if (KeyCode == 68) {
  1409. ws.network.sendInput({right: 0});
  1410. }
  1411. if (KeyCode == 83) {
  1412. ws.network.sendInput({down: 0});
  1413. }
  1414. if (KeyCode == 65) {
  1415. ws.network.sendInput({left: 0});
  1416. }
  1417. }
  1418. }
  1419. }
  1420. }
  1421. })
  1422. document.getElementsByClassName("hud")[0].addEventListener("mousedown", function(e) {
  1423. if (!ws.isclosed) {
  1424. if (isOnControl) {
  1425. if (!e.button) {
  1426. ws.mouseDown = 1;
  1427. ws.mouseUp = 0;
  1428. ws.network.sendInput({mouseDown: ws.aimingYaw, worldX: Math.floor(mousePosition3.x), worldY: Math.floor(mousePosition3.y), distance: Math.floor(game.inputPacketCreator.distanceToCenter((-ws.myPlayer.position.x + mousePosition3.x)*100, (-ws.myPlayer.position.y + mousePosition3.y)*100)/100)});
  1429. }
  1430. }
  1431. }
  1432. });
  1433. document.getElementsByClassName("hud")[0].addEventListener("mouseup", function(e) {
  1434. if (!ws.isclosed) {
  1435. if (isOnControl) {
  1436. if (!e.button) {
  1437. ws.mouseUp = 1;
  1438. ws.mouseDown = 0;
  1439. ws.network.sendInput({mouseUp: 1, worldX: Math.floor(mousePosition3.x), worldY: Math.floor(mousePosition3.y), distance: Math.floor(game.inputPacketCreator.distanceToCenter((-ws.myPlayer.position.x + mousePosition3.x)*100, (-ws.myPlayer.position.y + mousePosition3.y)*100)/100)});
  1440. }
  1441. }
  1442. }
  1443. });
  1444. document.getElementsByClassName("hud-shop-item")[0].addEventListener('click', function() {
  1445. ws.network.sendRpc({name: "BuyItem", itemName: "Pickaxe", tier: ws.inventory.Pickaxe.tier+1});
  1446. });
  1447. document.getElementsByClassName("hud-shop-item")[1].addEventListener('click', function() {
  1448. if (!ws.inventory.Spear) {
  1449. ws.network.sendRpc({name: "BuyItem", itemName: "Spear", tier: 1});
  1450. } else {
  1451. ws.network.sendRpc({name: "BuyItem", itemName: "Spear", tier: ws.inventory.Spear.tier+1});
  1452. }
  1453. });
  1454. document.getElementsByClassName("hud-shop-item")[2].addEventListener('click', function() {
  1455. if (!ws.inventory.Bow) {
  1456. ws.network.sendRpc({name: "BuyItem", itemName: "Bow", tier: 1});
  1457. } else {
  1458. ws.network.sendRpc({name: "BuyItem", itemName: "Bow", tier: ws.inventory.Bow.tier+1});
  1459. }
  1460. });
  1461. document.getElementsByClassName("hud-shop-item")[3].addEventListener('click', function() {
  1462. if (!ws.inventory.Bomb) {
  1463. ws.network.sendRpc({name: "BuyItem", itemName: "Bomb", tier: 1});
  1464. } else {
  1465. ws.network.sendRpc({name: "BuyItem", itemName: "Bomb", tier: ws.inventory.Bomb.tier+1});
  1466. }
  1467. });
  1468. document.getElementsByClassName("hud-shop-item")[4].addEventListener('click', function() {
  1469. ws.network.sendRpc({name: "BuyItem", itemName: "ZombieShield", tier: 1});
  1470. });
  1471. document.getElementsByClassName("hud-toolbar-item")[0].addEventListener('mouseup', function(e) {
  1472. if (!e.button) {
  1473. ws.network.sendRpc({name: "EquipItem", itemName: "Pickaxe", tier: ws.inventory.Pickaxe.tier});
  1474. }
  1475. });
  1476. document.getElementsByClassName("hud-toolbar-item")[1].addEventListener('mouseup', function(e) {
  1477. if (!e.button) {
  1478. ws.network.sendRpc({name: "EquipItem", itemName: "Spear", tier: ws.inventory.Spear.tier});
  1479. }
  1480. });
  1481. document.getElementsByClassName("hud-toolbar-item")[2].addEventListener('mouseup', function(e) {
  1482. if (!e.button) {
  1483. ws.network.sendRpc({name: "EquipItem", itemName: "Bow", tier: ws.inventory.Bow.tier});
  1484. }
  1485. });
  1486. document.getElementsByClassName("hud-toolbar-item")[3].addEventListener('mouseup', function(e) {
  1487. if (!e.button) {
  1488. ws.network.sendRpc({name: "EquipItem", itemName: "Bomb", tier: ws.inventory.Bomb.tier});
  1489. }
  1490. });
  1491. document.getElementsByClassName("hud-toolbar-item")[4].addEventListener('mouseup', function(e) {
  1492. if (!e.button) {
  1493. ws.network.sendRpc({name: "EquipItem", itemName: "HealthPotion", tier: 1});
  1494. }
  1495. });
  1496. document.getElementsByClassName("hud-toolbar-item")[5].addEventListener('mouseup', function(e) {
  1497. if (!e.button) {
  1498. ws.network.sendRpc({name: "EquipItem", itemName: "PetHealthPotion", tier: 1});
  1499. }
  1500. });
  1501. document.getElementsByClassName("hud-toolbar-item")[6].addEventListener("mouseup", function(e) {
  1502. if (!e.button) {
  1503. ws.network.sendRpc({name: "RecallPet"});
  1504. ws.network.sendInput({respawn: 1});
  1505. ws.automove = !ws.automove;
  1506. if (ws.automove) {
  1507. window.move = true;
  1508. } else {
  1509. window.move = false;
  1510. }
  1511. }
  1512. });
  1513. document.getElementsByClassName("10i")[0].addEventListener('click', () => {
  1514. ws.activebow = !ws.activebow;
  1515. ws.playerWeapon = ws.myPlayer.weaponName;
  1516. if (ws.activebow) {
  1517. if (ws.inventory.Spear) {
  1518. ws.network.sendRpc({name: "EquipItem", itemName: "Spear", tier: ws.inventory.Spear.tier})
  1519. } else {
  1520. ws.network.sendRpc({name: "BuyItem", itemName: "Spear", tier: 1})
  1521. ws.network.sendRpc({name: "EquipItem", itemName: "Spear", tier: 1})
  1522. }
  1523. } else {
  1524. ws.network.sendRpc({name: "EquipItem", itemName: ws.playerWeapon, tier: ws.inventory[ws.playerWeapon].tier})
  1525. }
  1526. })
  1527. if (window.aim) {
  1528. ws.autoaim = true;
  1529. }
  1530. if (window.move) {
  1531. ws.automove = true;
  1532. }
  1533. if (window.autohiBot) {
  1534. ws.autohi = true;
  1535. }
  1536. document.getElementsByClassName("1i2")[0].addEventListener('click', () => {
  1537. ws.autoaim = !ws.autoaim;
  1538. if (ws.autoaim) {
  1539. window.aim = true;
  1540. } else {
  1541. window.aim = false;
  1542. }
  1543. })
  1544. document.getElementsByClassName("2i2")[0].addEventListener('click', () => {
  1545. ws.automove = !ws.automove;
  1546. if (ws.automove) {
  1547. window.move = true;
  1548. } else {
  1549. window.move = false;
  1550. }
  1551. })
  1552. document.getElementsByClassName("7i2")[0].addEventListener('click', () => {
  1553. ws.close();
  1554. })
  1555. document.getElementsByClassName("8i2")[0].addEventListener('click', () => {
  1556. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `${ws.players[ws.uid].name}, W: ${counter(ws.players[ws.uid].wood)}, S: ${counter(ws.players[ws.uid].stone)}, G: ${counter(ws.players[ws.uid].gold)}, ID: ${ws.cloneId};`})
  1557. })
  1558. document.getElementsByClassName("21i2")[0].addEventListener('click', () => {
  1559. isOnControl = true;
  1560. })
  1561. document.getElementsByClassName("22i2")[0].addEventListener('click', () => {
  1562. isOnControl = false;
  1563. })
  1564. window.playerIds = {
  1565. id1: allSockets[window.socketId1 - 1],
  1566. id2: allSockets[window.socketId2 - 1]
  1567. }
  1568. }
  1569. if (window.testing) {
  1570. ws.network.sendRpc({name: "SetOpenParty", isOpen: 0})
  1571. ws.network.sendRpc({name: "SetPartyName", partyName: ws.cloneId + ''})
  1572. }
  1573. if (ws.data.uid) {
  1574. ws.uid = ws.data.uid;
  1575. ws.dataInfo = ws.data;
  1576. ws.players = {};
  1577. ws.inventory = {};
  1578. ws.buildings = {};
  1579. ws.parties = {};
  1580. ws.lb = {}
  1581. ws.playerUid = game.world.myUid;
  1582. ws.network.sendInput({space: 1});
  1583. ws.network.sendRpc({name: "BuyItem", itemName: "HatHorns", tier: 1})
  1584. ws.network.sendRpc({name: "BuyItem", itemName: "PetCARL", tier: 1})
  1585. ws.network.sendRpc({name: "BuyItem", itemName: "PetMiner", tier: 1})
  1586. }
  1587. if (ws.data.entities) {
  1588. if (window.message == ws.cloneId) {
  1589. game.world.replicator.onEntityUpdate(ws.data);
  1590. }
  1591. if (ws.data.entities[ws.uid].name) {
  1592. ws.myPlayer = ws.data.entities[ws.uid];
  1593. }
  1594. for (let g in ws.myPlayer) {
  1595. if (ws.myPlayer[g] !== ws.data.entities[ws.uid][g] && ws.data.entities[ws.uid][g] !== undefined) {
  1596. ws.myPlayer[g] = ws.data.entities[ws.uid][g];
  1597. }
  1598. }
  1599. if (ws.myPlayer.petUid) {
  1600. if (ws.data.entities[ws.myPlayer.petUid]) {
  1601. if (ws.data.entities[ws.myPlayer.petUid].model) {
  1602. ws.myPet = ws.data.entities[ws.myPlayer.petUid];
  1603. ws.shouldHealPet = false;
  1604. }
  1605. }
  1606. for (let g in ws.myPet) {
  1607. if (ws.data.entities[ws.myPlayer.petUid]) {
  1608. if (ws.myPet[g] !== ws.data.entities[ws.myPlayer.petUid][g] && ws.data.entities[ws.myPlayer.petUid][g] !== undefined) {
  1609. ws.myPet[g] = ws.data.entities[ws.myPlayer.petUid][g]
  1610. }
  1611. }
  1612. }
  1613. }
  1614. for (let i in ws.data.entities) {
  1615. if (ws.data.entities[i].name) {
  1616. ws.players[i] = ws.data.entities[i];
  1617. }
  1618. }
  1619. for (let i in ws.players) {
  1620. if (!ws.data.entities[i]) {
  1621. delete ws.players[i];
  1622. }
  1623. for (let g in ws.players[i]) {
  1624. if (ws.players[i][g] !== ws.data.entities[i][g] && ws.data.entities[i][g] !== undefined) {
  1625. ws.players[i][g] = ws.data.entities[i][g];
  1626. }
  1627. }
  1628. ws.playerTick = ws.players[ws.playerUid];
  1629. }
  1630. }
  1631. if (ws.data.name == "DayCycle") {
  1632. ws.tickData = ws.data.response;
  1633. ws.isDay = ws.data.response.isDay;
  1634. }
  1635. if (ws.data.tick) {
  1636. var currentTick = ws.data.tick;
  1637. var msPerTick = 50;
  1638. var dayRatio = 0;
  1639. var nightRatio = 0;
  1640. var barWidth = 130;
  1641. if (ws.tickData) {
  1642. if (ws.tickData.dayEndTick) {
  1643. if (ws.tickData.dayEndTick > 0) {
  1644. var dayLength = ws.tickData.dayEndTick - ws.tickData.cycleStartTick;
  1645. var dayTicksRemaining = ws.tickData.dayEndTick - currentTick;
  1646. dayRatio = 1 - dayTicksRemaining / dayLength;
  1647. }
  1648. }
  1649. else if (ws.tickData.nightEndTick > 0) {
  1650. var nightLength = ws.tickData.nightEndTick - ws.tickData.cycleStartTick;
  1651. var nightTicksRemaining = ws.tickData.nightEndTick - currentTick;
  1652. dayRatio = 1;
  1653. nightRatio = 1 - nightTicksRemaining / nightLength;
  1654. }
  1655. var currentPosition = (dayRatio * 1 / 2 + nightRatio * 1 / 2) * -barWidth;
  1656. var offsetPosition = currentPosition + barWidth / 2;
  1657. if (offsetPosition) {
  1658. ws.dayTicker = Math.round(offsetPosition);
  1659. }
  1660. }
  1661. }
  1662. if (ws.data.name == "PartyInfo") {
  1663. ws.partyInfo = ws.data.response;
  1664. setTimeout(() => {
  1665. for (let i in ws.partyInfo) {
  1666. if (ws.partyInfo[i].playerUid == ws.uid && ws.partyInfo[i].isLeader) {
  1667. ws.network.sendRpc({name: "SetPartyMemberCanSell", uid: game.world.myUid, canSell: 1});
  1668. ws.network.sendRpc({name: "SetOpenParty", isOpen: 1});
  1669. setTimeout(() => {
  1670. ws.network.sendRpc({name: "SetPartyName", partyName: ws.id + ""});
  1671. }, 1000);
  1672. }
  1673. }
  1674. }, 1750);
  1675. }
  1676. if (ws.data.name == "PartyApplicant") {
  1677. ws.partyApplicant = ws.data.response;
  1678. if (ws.partyApplicant.applicantUid == game.world.myUid) {
  1679. ws.network.sendRpc({name: "PartyApplicantDecide", applicantUid: game.world.myUid, accepted: 1})
  1680. }
  1681. }
  1682. if (ws.data.name == "PartyShareKey") {
  1683. ws.psk = ws.data.response.partyShareKey;
  1684. if (window.FKey && cloneTimeout) {
  1685. if (allSockets[1].psk !== allSockets[0].psk) {
  1686. game.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id2.psk});
  1687. }
  1688. }
  1689. }
  1690. if (ws.data.name == "ReceiveChatMessage") {
  1691. ws.message = ws.data;
  1692. if (ws.message.response.message == "!move" && ws.message.response.uid == game.world.myUid) {
  1693. ws.automove = true;
  1694. }
  1695. if (ws.message.response.message == "!unmove" && ws.message.response.uid == game.world.myUid) {
  1696. ws.automove = false;
  1697. }
  1698. if (ws.message.response.message[0] == `#` && ws.message.response.uid == game.world.myUid) {
  1699. let word = ws.message.response.message;
  1700. let uid = '';
  1701. for (let i = 0; i < 30; i++) {
  1702. if (Math.round(word[i] == 0 || word[i] == 1 || word[i] == 2 || word[i] == 3 || word[i] == 4 || word[i] == 5 || word[i] == 6 || word[i] == 7 || word[i] == 8 || word[i] == 9)) {
  1703. uid += word[i]
  1704. }
  1705. uid = Math.round(uid);
  1706. ws.playerUid = uid;
  1707. }
  1708. }
  1709. if (ws.message.response.message == "!aim" && ws.message.response.uid == game.world.myUid) {
  1710. ws.autoaim = true;
  1711. }
  1712. if (ws.message.response.message == "!unaim" && ws.message.response.uid == game.world.myUid) {
  1713. ws.autoaim = false;
  1714. }
  1715. if (ws.message.response.message == "!control" && ws.message.response.uid == game.world.myUid) {
  1716. isOnControl = true;
  1717. }
  1718. if (ws.message.response.message == "!uncontrol" && ws.message.response.uid == game.world.myUid) {
  1719. isOnControl = false;
  1720. }
  1721. if (window.allSockets[ws.cloneId-1]) {
  1722. window.allSockets[ws.cloneId-1] = ws;
  1723. }
  1724. if (ws.message.response.message == `!psk ${ws.uid}` && ws.message.response.uid == game.world.myUid) {
  1725. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `${ws.psk.response.partyShareKey}`})
  1726. }
  1727. if (ws.message.response.message == `!crash ${ws.cloneId}` && ws.message.response.uid == game.world.myUid) {
  1728. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `Successfully crashed ${ws.uid}!`})
  1729. }
  1730. if (ws.message.response.message == "hi") {
  1731. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: ` hi `})
  1732. }
  1733. if (ws.message.response.message == "!space") {
  1734. ws.network.sendInput({space: 0})
  1735. ws.network.sendInput({space: 1})
  1736. }
  1737. if (ws.message.response.message == "!stats") {
  1738. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `${ws.players[ws.message.response.uid].name}, W: ${counter(ws.players[ws.message.response.uid].wood)}, S: ${counter(ws.players[ws.message.response.uid].stone)}, G: ${counter(ws.players[ws.message.response.uid].gold)}, T: ${Math.floor(ws.players[ws.message.response.uid].token)};`})
  1739. }
  1740. if (ws.message.response.message == "!s" && ws.message.response.uid == game.world.myUid) {
  1741. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `${ws.players[ws.uid].name}, W: ${counter(ws.players[ws.uid].wood)}, S: ${counter(ws.players[ws.uid].stone)}, G: ${counter(ws.players[ws.uid].gold)}, ID: ${ws.cloneId};`})
  1742. }
  1743. if (ws.message.response.message == "!h" && ws.message.response.uid == game.world.myUid) {
  1744. ws.autohi = !ws.autohi;
  1745. if (ws.autohi) {
  1746. window.autohiBot = true;
  1747. } else {
  1748. window.autohiBot = false;
  1749. }
  1750. }
  1751. if (ws.message.response.message == "!ahrc" && ws.message.response.uid == game.world.myUid) {
  1752. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `ahrc is active!`})
  1753. ws.ahrc = true;
  1754. }
  1755. if (ws.message.response.message == `!ahrc ${ws.cloneId}` && ws.message.response.uid == game.world.myUid) {
  1756. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `ahrc is active!`})
  1757. ws.ahrc = true;
  1758. }
  1759. if (ws.message.response.message == "!!ahrc" && ws.message.response.uid == game.world.myUid) {
  1760. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `ahrc is inactive!`})
  1761. ws.ahrc = false;
  1762. }
  1763. if (ws.message.response.message == `!!ahrc ${ws.cloneId}` && ws.message.response.uid == game.world.myUid) {
  1764. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `ahrc is inactive!`})
  1765. ws.ahrc = false;
  1766. }
  1767. if (ws.message.response.message == "!upgrade" && ws.message.response.uid == game.world.myUid) {
  1768. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: "successfully upgraded the base!"});
  1769. for (let i in ws.buildings) {
  1770. if (ws.buildings[i].type == "GoldMine") {
  1771. ws.network.sendRpc({name: "UpgradeBuilding", uid: ws.buildings[i].uid})
  1772. }
  1773. setTimeout(() => {
  1774. ws.network.sendRpc({name: "UpgradeBuilding", uid: ws.buildings[i].uid})
  1775. }, 100);
  1776. }
  1777. }
  1778. if (ws.message.response.message == "!up" && ws.message.response.uid == game.world.myUid) {
  1779. ws.network.sendRpc({name: "BuyItem", itemName: ws.buildings[i].uid})
  1780. }
  1781. if (ws.message.response.message == "!upgradeStash" && ws.message.response.uid == game.world.myUid) {
  1782. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: "successfully upgraded the stash!"});
  1783. for (let i in ws.buildings) {
  1784. if (ws.buildings[i].type == "GoldStash") {
  1785. ws.network.sendRpc({name: "UpgradeBuilding", uid: ws.buildings[i].uid})
  1786. }
  1787. }
  1788. }
  1789. if (ws.message.response.message == "a" && ws.message.response.uid == game.world.myUid) {
  1790. ws.network.sendInput({left: 1});
  1791. ws.network.sendInput({right: 0});
  1792. }
  1793. if (ws.message.response.message == "d" && ws.message.response.uid == game.world.myUid) {
  1794. ws.network.sendInput({right: 1});
  1795. ws.network.sendInput({left: 0});
  1796. }
  1797. if (ws.message.response.message == "w" && ws.message.response.uid == game.world.myUid) {
  1798. ws.network.sendInput({up: 1});
  1799. ws.network.sendInput({down: 0});
  1800. }
  1801. if (ws.message.response.message == "s" && ws.message.response.uid == game.world.myUid) {
  1802. ws.network.sendInput({down: 1});
  1803. ws.network.sendInput({up: 0});
  1804. }
  1805. if (ws.message.response.message == "f" && ws.message.response.uid == game.world.myUid) {
  1806. ws.network.sendInput({left: 0});
  1807. ws.network.sendInput({right: 0});
  1808. ws.network.sendInput({down: 0});
  1809. ws.network.sendInput({up: 0});
  1810. }
  1811. }
  1812. if (ws.autohi) {
  1813. if (ws.data.entities) {
  1814. for (let i in ws.data.entities) {
  1815. if (ws.data.entities[i].name) {
  1816. ws.network.sendRpc({name: "SendChatMessage", channel: "Local", message: `hi ${ws.data.entities[i].name}`});
  1817. }
  1818. }
  1819. }
  1820. }
  1821. if (ws.data.name == "Leaderboard") {
  1822. for (let i in ws.data.response) {
  1823. ws.lb[ws.data.response[i].rank + 1] = ws.data.response[i];
  1824. }
  1825. if (ws.ahrc) {
  1826. for(let uid in ws.buildings) {
  1827. let obj = ws.buildings[uid];
  1828. ws.network.sendRpc({name: "CollectHarvester",uid: obj.uid});
  1829. if(obj.type == "Harvester" && obj.tier == 1) {
  1830. ws.network.sendRpc({name: "AddDepositToHarvester",uid: obj.uid,deposit: 20/2});
  1831. }
  1832. if(obj.type == "Harvester" && obj.tier == 2) {
  1833. ws.network.sendRpc({name: "AddDepositToHarvester",uid: obj.uid,deposit: 30/2});
  1834. }
  1835. if(obj.type == "Harvester" && obj.tier == 3) {
  1836. ws.network.sendRpc({name: "AddDepositToHarvester",uid: obj.uid,deposit: 35/2});
  1837. }
  1838. if(obj.type == "Harvester" && obj.tier == 4) {
  1839. ws.network.sendRpc({name: "AddDepositToHarvester",uid: obj.uid,deposit: 50/2});
  1840. }
  1841. if(obj.type == "Harvester" && obj.tier == 5) {
  1842. ws.network.sendRpc({name: "AddDepositToHarvester",uid: obj.uid,deposit: 60/2});
  1843. }
  1844. if(obj.type == "Harvester" && obj.tier == 6) {
  1845. ws.network.sendRpc({name: "AddDepositToHarvester",uid: obj.uid,deposit: 70/2});
  1846. }
  1847. if(obj.type == "Harvester" && obj.tier == 7) {
  1848. ws.network.sendRpc({name: "AddDepositToHarvester",uid: obj.uid,deposit: 120/2});
  1849. }
  1850. if(obj.type == "Harvester" && obj.tier == 8) {
  1851. ws.network.sendRpc({name: "AddDepositToHarvester",uid: obj.uid,deposit: 150/2});
  1852. }
  1853. }
  1854. }
  1855. }
  1856. if (ws.data.name == "LocalBuilding") {
  1857. for (let i in ws.data.response) {
  1858. ws.buildings[ws.data.response[i].uid] = ws.data.response[i];
  1859. if (ws.buildings[ws.data.response[i].uid].dead) {
  1860. delete ws.buildings[ws.data.response[i].uid];
  1861. }
  1862. }
  1863. }
  1864. if (ws.data.name == "AddParty") {
  1865. if (ws.addparties) {
  1866. ws.parties[ws.data.response.partyId] = ws.data.response;
  1867. }
  1868. }
  1869. if (ws.data.name == "RemoveParty") {
  1870. if (ws.addparties) {
  1871. if (ws.parties[ws.data.response.partyId].partyId) {
  1872. delete ws.parties[ws.data.response.partyId];
  1873. }
  1874. }
  1875. }
  1876. if (ws.data.name == "PartyShareKey") {
  1877. ws.psk = ws.data;
  1878. if (window.FKey && cloneTimeout) {
  1879. if (window.playerIds.id2.psk.response.partyShareKey !== window.playerIds.id1.psk.response.partyShareKey) {
  1880. game.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id2.psk.response.partyShareKey});
  1881. setTimeout(() => {
  1882. game.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id2.psk.response.partyShareKey});
  1883. }, 500);
  1884. setTimeout(() => {
  1885. game.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id2.psk.response.partyShareKey});
  1886. }, 1000);
  1887. }
  1888. }
  1889. }
  1890. if (ws.data.name == "Dead") {
  1891. ws.network.sendRpc({name: "BuyItem", itemName: "HatHorns", tier: 1});
  1892. if (cloneTimeout) {
  1893. game.network.sendInput({respawn: 1});
  1894. }
  1895. }
  1896. if(window.mousemove) {
  1897. let mousePos = game.renderer.screenToWorld(game.ui.mousePosition.x, game.ui.mousePosition.y);
  1898. if (ws.myPlayer.position.y-mousePos.y > 100 || Math.sqrt(Math.pow((ws.myPlayer.position.y-mousePos.y), 2) + Math.pow((ws.myPlayer.position.x-mousePos.x), 2)) < 100) {
  1899. ws.network.sendInput({down: 0})
  1900. } else {
  1901. ws.network.sendInput({down: 1})
  1902. }
  1903. if (-ws.myPlayer.position.y+mousePos.y > 100 || Math.sqrt(Math.pow((ws.myPlayer.position.y-mousePos.y), 2) + Math.pow((ws.myPlayer.position.x-mousePos.x), 2)) < 100) {
  1904. ws.network.sendInput({up: 0})
  1905. } else {
  1906. ws.network.sendInput({up: 1})
  1907. }
  1908. if (-ws.myPlayer.position.x+mousePos.x > 100 || Math.sqrt(Math.pow((ws.myPlayer.position.y-mousePos.y), 2) + Math.pow((ws.myPlayer.position.x-mousePos.x), 2)) < 100) {
  1909. ws.network.sendInput({left: 0})
  1910. } else {
  1911. ws.network.sendInput({left: 1})
  1912. }
  1913. if (ws.myPlayer.position.x-mousePos.x > 100 || Math.sqrt(Math.pow((ws.myPlayer.position.y-mousePos.y), 2) + Math.pow((ws.myPlayer.position.x-mousePos.x), 2)) < 100) {
  1914. ws.network.sendInput({right: 0})
  1915. } else {
  1916. ws.network.sendInput({right: 1})
  1917. }
  1918. };
  1919. if (ws.autoaim) {
  1920. if (ws.playerTick) {
  1921. ws.network.sendInput({mouseMoved: game.inputPacketCreator.screenToYaw((-ws.myPlayer.position.x + ws.playerTick.position.x)*100, (-ws.myPlayer.position.y + ws.playerTick.position.y)*100)})
  1922. }
  1923. }
  1924. if (window.shouldStartScript) {
  1925. if (getbosswaves() && getIsZombiesActive() && game.ui.playerPartyMembers.length !== 1) {
  1926. if (inull) {
  1927. inull = false;
  1928. document.getElementsByClassName("1i5")[0].click();
  1929. ws.network.sendRpc({name: "LeaveParty"});
  1930. setTimeout(() => { inull = true; }, 250);
  1931. }
  1932. }
  1933. if (ws.dayTicker < -18 && ws.dayTicker >= -23 && !ws.isDay && getIsZombiesActive() && game.ui.playerPartyMembers.length !== 1) {
  1934. if (i1) {
  1935. i1 = false;
  1936. document.getElementsByClassName("1i5")[0].click();
  1937. ws.network.sendRpc({name: "LeaveParty"});
  1938. setTimeout(() => { i1 = true; }, 250);
  1939. }
  1940. }
  1941. if (!getIsZombiesActive() && game.ui.playerPartyMembers.length !== 4 && !getactiveCommingbosswaves()) {
  1942. if (i2) {
  1943. i2 = false;
  1944. ws.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: Game.currentGame.ui.getPlayerPartyShareKey() + ""});
  1945. setTimeout(() => { i2 = true; }, 250);
  1946. }
  1947. }
  1948. if (ws.dayTicker > 18 && ws.dayTicker <= 23 && getIsZombiesActive() && ws.isDay && game.ui.playerPartyMembers.length !== 4) {
  1949. if (i3) {
  1950. i3 = false;
  1951. document.getElementsByClassName("1i5")[0].click();
  1952. ws.network.sendRpc({name: "LeaveParty"});
  1953. setTimeout(() => { i3 = true; }, 250)
  1954. }
  1955. }
  1956. }
  1957. if (heal) {
  1958. if (ws.myPlayer) {
  1959. let playerHealth = (ws.myPlayer.health/ws.myPlayer.maxHealth) * 100;
  1960. if (playerHealth <= 70) {
  1961. ws.network.sendRpc({name: "BuyItem", itemName: "HealthPotion", tier: 1})
  1962. ws.network.sendRpc({name: "EquipItem", itemName: "HealthPotion", tier: 1})
  1963. }
  1964. }
  1965. if (ws.myPet) {
  1966. let petHealth = (ws.myPet.health/ws.myPet.maxHealth) * 100;
  1967. if (petHealth <= 70) {
  1968. if (!ws.shouldHealPet) {
  1969. ws.shouldHealPet = true;
  1970. setTimeout(() => {ws.shouldHealPet = false;}, 300)
  1971. ws.network.sendRpc({name: "BuyItem", itemName: "PetHealthPotion", tier: 1})
  1972. ws.network.sendRpc({name: "EquipItem", itemName: "PetHealthPotion", tier: 1})
  1973. }
  1974. }
  1975. }
  1976. }
  1977. if (ws.activebow) {
  1978. ws.network.sendInput({space: 0})
  1979. ws.network.sendInput({space: 1})
  1980. }
  1981. switch(ws.data.opcode) {
  1982. case 4:
  1983. ws.onEnterWorld(ws.data);
  1984. break;
  1985. }
  1986. }
  1987. }
  1988. window.sendAitoAlt = () => {
  1989. if (window.startaito) {
  1990. let ws = new WebSocket(`ws://${Game.currentGame.options.servers[Game.currentGame.options.serverId].hostname}:8000`);
  1991. ws.binaryType = "arraybuffer";
  1992. ws.onclose = () => {
  1993. ws.isclosed = true;
  1994. }
  1995. ws.onopen = () => {
  1996. ws.network = new Game.currentGame.networkType();
  1997. ws.network.sendInput = (t) => {
  1998. ws.network.sendPacket(3, t);
  1999. };
  2000. ws.network.sendRpc = (t) => {
  2001. ws.network.sendPacket(9, t);
  2002. };
  2003. ws.network.sendPacket = (e, t) => {
  2004. if (!ws.isclosed) {
  2005. ws.send(ws.network.codec.encode(e, t));
  2006. }
  2007. };
  2008. }
  2009. ws.onEnterWorld = () => {
  2010. // useless
  2011. }
  2012. ws.onmessage = msg => {
  2013. ws.data = ws.network.codec.decode(msg.data);
  2014. if(ws.data.opcode === 5) {
  2015. ws.network.sendPacket(4, { displayName: localStorage.name, extra: ws.data.extra });
  2016. };
  2017. if (ws.data.uid) {
  2018. ws.uid = ws.data.uid;
  2019. }
  2020. if (ws.data.name) {
  2021. ws.dataType = ws.data;
  2022. }
  2023. if (!window.startaito && !ws.isclosed) {
  2024. ws.isclosed = true;
  2025. ws.close();
  2026. }
  2027. if (ws.verified) {
  2028. if (!ws.isDay && !ws.isclosed) {
  2029. ws.isclosed = true;
  2030. ws.close();
  2031. window.sendAitoAlt();
  2032. }
  2033. }
  2034. if (ws.data.name == "DayCycle") {
  2035. ws.isDay = ws.data.response.isDay;
  2036. if (ws.isDay) {
  2037. ws.verified = true;
  2038. }
  2039. }
  2040. if (ws.data.name == "Dead") {
  2041. ws.network.sendInput({
  2042. respawn: 1
  2043. });
  2044. }
  2045. if (ws.data.name == "Leaderboard") {
  2046. ws.lb = ws.data;
  2047. if (ws.psk) {
  2048. ws.network.sendRpc({
  2049. name: "JoinPartyByShareKey",
  2050. partyShareKey: game.ui.getPlayerPartyShareKey()
  2051. });
  2052. if (ws.psk.response.partyShareKey == game.ui.getPlayerPartyShareKey()) {
  2053. ws.network.sendRpc({
  2054. name: "BuyItem",
  2055. itemName: "Pause",
  2056. tier: 1
  2057. });
  2058. }
  2059. }
  2060. }
  2061. if (ws.data.name == "PartyShareKey") {
  2062. ws.psk = ws.data;
  2063. }
  2064. switch (ws.data.opcode) {
  2065. case 4:
  2066. ws.onEnterWorld(ws.data);
  2067. break;
  2068. }
  2069. }
  2070. }
  2071. }
  2072. game.network.addRpcHandler("ReceiveChatMessage", e => {
  2073. if (e.message == "!aito" && e.uid == game.world.myUid) {
  2074. window.startaito = !window.startaito;
  2075. window.sendAitoAlt();
  2076. }
  2077. })
  2078. var LKeyWithTimeouts = function() {
  2079. window.FKey = !window.FKey;
  2080. cloneTimeout = false;
  2081. window.playerIds = {
  2082. id1: allSockets[window.socketId1 - 1],
  2083. id2: allSockets[window.socketId2 - 1]
  2084. }
  2085. if (window.FKey) {
  2086. game.network.sendRpc({name: "KickParty", uid: window.playerIds.id1.uid})
  2087. game.network.sendRpc({name: "KickParty", uid: window.playerIds.id2.uid})
  2088. window.FKeyOn = setInterval(() => {
  2089. cloneTimeout = true;
  2090. window.playerIds.id2.network.sendRpc({name: "JoinPartyByShareKey", partyShareKey: window.playerIds.id1.psk.response.partyShareKey});
  2091. setTimeout(() => {
  2092. window.playerIds.id1.network.sendRpc({name: "KickParty", uid: window.playerIds.id2.uid});
  2093. setTimeout(() => {
  2094. window.playerIds.id2.network.sendRpc({name: "KickParty", uid: game.world.myUid});
  2095. }, 7400);
  2096. }, 350);
  2097. }, 15500);
  2098. } else {
  2099. clearInterval(window.FKeyOn);
  2100. window.FKeyOn = null;
  2101. }
  2102. }
  2103. game.network.addRpcHandler("ReceiveChatMessage", e => {
  2104. if (e.message == "!L" && e.uid == game.world.myUid) {
  2105. LKeyWithTimeouts()
  2106. }
  2107. })
  2108. var getIsZombiesActive = function () {
  2109. let isZombiesActive = false;
  2110. for (let i in game.world.entities) {
  2111. if (game.world.entities[i].fromTick.model !== "NeutralTier1") {
  2112. if (game.world.entities[i].fromTick.entityClass == "Npc") {
  2113. isZombiesActive = true;
  2114. }
  2115. }
  2116. }
  2117. return isZombiesActive;
  2118. };
  2119. var getactiveCommingbosswaves = function () {
  2120. let activeCommingbosswave = false;
  2121. let aftercommingbosswaves = [48, 56, 64, 72, 80, 88, 96, 104, 120];
  2122. for (let i = 0; i < aftercommingbosswaves.length; i++) {
  2123. if (game.ui.playerTick.wave == aftercommingbosswaves[i]) {
  2124. activeCommingbosswave = true;
  2125. }
  2126. }
  2127. return activeCommingbosswave;
  2128. };
  2129. var getbosswaves = function () {
  2130. let activebosswave = false;
  2131. let allbosswaves = [9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105, 121];
  2132. for (let i = 0; i < allbosswaves.length; i++) {
  2133. if (game.ui.playerTick.wave == allbosswaves[i]) {
  2134. activebosswave = true;
  2135. }
  2136. }
  2137. return activebosswave;
  2138. };
  2139. let server = -1;
  2140. for (let i in game.options.servers) {
  2141. server += 1;
  2142. document.getElementsByClassName("hud-intro-server")[0][server].innerHTML = game.options.servers[i].name + ", Players: [" + Math.round(game.options.servers[i].population/3.125) + "/32]";
  2143. }
  2144. var inull = true;
  2145. var i1 = true;
  2146. var i2 = true;
  2147. var i3 = true;
  2148. document.addEventListener("keydown", (e) => {
  2149. if (document.activeElement.tagName.toLowerCase() == "input" || document.activeElement.tagName.toLowerCase() == "textarea") {
  2150. Main1Keys = false;
  2151. Main2Keys = false;
  2152. Main3Keys = false;
  2153. } else {
  2154. Main1Keys = true;
  2155. Main2Keys = true;
  2156. Main3Keys = true;
  2157. }
  2158. if (Main1Keys) {
  2159. switch (e.code) {
  2160. case "Insert":
  2161. document.getElementsByClassName("1i")[0].click();
  2162. break;
  2163. case "KeyX":
  2164. document.getElementsByClassName("8i")[0].click();
  2165. break;
  2166. case "KeyZ":
  2167. document.getElementsByClassName("10i")[0].click();
  2168. break;
  2169. case "KeyU":
  2170. document.getElementsByClassName("13i")[0].click();
  2171. break;
  2172. case "KeyR":
  2173. healPlayer();
  2174. break;
  2175. case "Delete":
  2176. document.getElementsByClassName("7i")[0].click();
  2177. break;
  2178. }
  2179. }
  2180. if (Main2Keys) {
  2181. switch (e.code) {
  2182. case "KeyK":
  2183. document.getElementsByClassName("10i5")[0].click();
  2184. break;
  2185. case "KeyN":
  2186. document.getElementsByClassName("6i5")[0].click();
  2187. break;
  2188. case "Minus":
  2189. game.ui.components.PlacementOverlay.startPlacing("GoldStash");
  2190. break;
  2191. case "KeyM":
  2192. game.network.sendRpc({
  2193. "name": "BuyItem",
  2194. "itemName": "PetRevive",
  2195. "tier": 1
  2196. })
  2197. game.network.sendRpc({
  2198. "name": "EquipItem",
  2199. "itemName": "PetRevive",
  2200. "tier": 1
  2201. })
  2202. break;
  2203. }
  2204. }
  2205. if (Main3Keys) {
  2206. switch (e.code) {
  2207. case "Backslash":
  2208. LKeyWithTimeouts();
  2209. break;
  2210. case "BracketLeft":
  2211. game.network.sendRpc({name: "LeaveParty"})
  2212. break;
  2213. }
  2214. }
  2215. });
  2216. // ==UserScript==
  2217. // @name background
  2218. // @namespace http://tampermonkey.net/
  2219. // @version 0.1
  2220. // @description Makes the ZOMBS.io ui look better!
  2221. // @author tw | tw@1039
  2222. // @match zombs.io
  2223. // @grant none
  2224. // ==/UserScript==
  2225. // addEventListener('load', function(e){
  2226. // })
  2227. // $("body")
  2228. // .css('cursor', 'url(https://ani.cursors-4u.net/cursors/cur-13/cur1163.png), default');
  2229. // ==UserScript==
  2230. // @name background
  2231. // @namespace http://tampermonkey.net/
  2232. // @version 0.1
  2233. // @description A background for the ZoGUI menus, and some other stuff.
  2234. // @author :)
  2235. // @match http://zombs.io/
  2236. // @grant none
  2237. // ==/UserScript==
  2238. var css;
  2239. var style;
  2240. if (localStorage.loadReminder == undefined) {
  2241. localStorage.loadReminder = true;
  2242. alert(
  2243. 'enjoy my hack :)'
  2244. )
  2245. } else if (Math.floor(Math.random() * 3) === 2) {
  2246. alert(
  2247. 'enjoy my hack :)'
  2248. )
  2249. }
  2250. setTimeout(() => {
  2251. document.querySelector("#hud-intro > div.hud-intro-wrapper > h2")
  2252. .innerHTML = ":)"
  2253. document.querySelector("#hud-intro > div.hud-intro-wrapper > h1 > small")
  2254. .remove()
  2255. document.querySelector("#hud-intro > div.hud-intro-wrapper > h1")
  2256. .innerHTML = "🔮★シ𝔐𝙤໓✔🔮<small>.</small>"
  2257. document.querySelector("#hud-intro > div.hud-intro-wrapper > h1")
  2258. .style.color = "rgba(128, 0, 128, 0.75)"
  2259. css =
  2260. '.hud-intro::after { background: url(\'https://cutewallpaper.org/21/wallpaper-gif-1920x1080/Gif-Background-Space-1920x1080-Backgrounds-For-Html-Gif-.gif\'); background-size: cover; }';
  2261. style = document.createElement('style');
  2262. style.appendChild(document.createTextNode(css));
  2263. document.head.appendChild(style);
  2264. css =
  2265. '.hud-intro-footer { background: url(\'https://cutewallpaper.org/21/wallpaper-gif-1920x1080/Gif-Background-Space-1920x1080-Backgrounds-For-Html-Gif-.gif\'); background-size: cover; }';
  2266. style = document.createElement('style');
  2267. style.appendChild(document.createTextNode(css));
  2268. document.head.appendChild(style);
  2269. document.querySelector("#hud-intro > div.hud-intro-corner-bottom-right > div")
  2270. .remove()
  2271. document.querySelector("#hud-intro > div.hud-intro-corner-top-left > div > a")
  2272. .remove()
  2273. document.querySelector("#hud-intro > div.hud-intro-corner-top-left > div > h3")
  2274. .innerText = "by :)"
  2275. document.querySelector("#hud-intro > div.hud-intro-corner-top-right > div")
  2276. .style.opacity = "0.55"
  2277. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > input")
  2278. .style.backgroundColor = "rgba(255, 255, 255, 0.80)"
  2279. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > select")
  2280. .style.backgroundColor = "rgba(255, 255, 255, 0.80)"
  2281. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > input")
  2282. .style.border = "2px solid grey"
  2283. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > select")
  2284. .style.border = "2px solid grey"
  2285. }, 100)
  2286. let serverCapacity;
  2287. let capacity = new XMLHttpRequest();
  2288. capacity.open("GET", "http://zombs.io/capacity", true);
  2289. capacity.onreadystatechange = () => {
  2290. if(capacity.readyState === 4) {
  2291. if(capacity.status === 200) {
  2292. serverCapacity = JSON.parse(capacity.responseText);
  2293. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > select > optgroup:nth-child(1)").label = `US East [${serverCapacity.regions["US East"].players} / ${serverCapacity.regions["US East"].capacity}]`;
  2294. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > select > optgroup:nth-child(2)").label = `US West [${serverCapacity.regions["US West"].players} / ${serverCapacity.regions["US West"].capacity}]`;
  2295. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > select > optgroup:nth-child(3)").label = `Europe [${serverCapacity.regions["Europe"].players} / ${serverCapacity.regions["Europe"].capacity}]`;
  2296. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > select > optgroup:nth-child(4)").label = `Asia [${serverCapacity.regions["Asia"].players} / ${serverCapacity.regions["Asia"].capacity}]`;
  2297. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > select > optgroup:nth-child(5)").label = `Australia [${serverCapacity.regions["Australia"].players} / ${serverCapacity.regions["Australia"].capacity}]`;
  2298. document.querySelector("#hud-intro > div.hud-intro-wrapper > div.hud-intro-main > div.hud-intro-form > select > optgroup:nth-child(6)").label = `South America [${serverCapacity.regions["South America"].players} / ${serverCapacity.regions["South America"].capacity}]`;
  2299. };
  2300. };
  2301. };
  2302. capacity.send();
  2303. const lololololol = `ッ hax`
  2304. let mapTimeouts = [];
  2305. function createCoordinates() {
  2306. let x = document.createElement('div')
  2307. x.innerHTML = `<p id="coords" style="color:black;"X: 0, Y: 0</p>
  2308. `
  2309. x.style.textAlign = "center"
  2310. document.querySelector("#hud > div.hud-bottom-left").append(x)
  2311. }
  2312. let mapMouseX;
  2313. let mapMouseY;
  2314. let hasBeenInWorld = false;
  2315. const uAgent = navigator.userAgent;
  2316. const isChromeOS = uAgent.includes('CrOS');
  2317. const isMac = uAgent.includes('Macintosh');
  2318. const isWindows = uAgent.includes('Windows');
  2319. function blurText(path) {
  2320. document.querySelector(path)
  2321. .style.color = "transparent";
  2322. document.querySelector(path)
  2323. .style.textShadow = "0 0 5px rgba(0,0,0,0.5)";
  2324. }
  2325. function focusText(path, originalColor) {
  2326. document.querySelector(path)
  2327. .style.color = originalColor;
  2328. document.querySelector(path)
  2329. .style.textShadow = "none";
  2330. }
  2331. setInterval(() => {
  2332. try {
  2333. if (window.isInMenu) {
  2334. blurText('#scorelog')
  2335. blurCanvas()
  2336. } else {
  2337. focusText('#scorelog', 'black')
  2338. focusCanvas()
  2339. }
  2340. } catch (err) {
  2341. // console.log('Cannot blur or focus canvas. This is most likely because the score logger has not been loaded yet. Error: ' + err);
  2342. }
  2343. _isInChatbox = document.querySelector('.hud-chat')
  2344. .classList.contains('is-focused')
  2345. if (botMode) {
  2346. if (parseInt((getEntitiesByModel('Tree')[0][1].targetTick.position.x - game.world.getEntityByUid(game.world.getMyUid())
  2347. .targetTick.position.x)
  2348. .toString()
  2349. .replaceAll('-', '')) < 250) {
  2350. game.network.sendRpc({
  2351. name: "SendChatMessage",
  2352. channel: "Local",
  2353. message: "Tree @ Angle (in radians): " + getNearestTreeAngle()
  2354. })
  2355. danceRandom = false;
  2356. } else {
  2357. danceRandom = true;
  2358. }
  2359. if (parseInt((getEntitiesByModel('Stone')[0][1].targetTick.position.x - game.world.getEntityByUid(game.world.getMyUid())
  2360. .targetTick.position.x)
  2361. .toString()
  2362. .replaceAll('-', '')) < 250) {
  2363. game.network.sendRpc({
  2364. name: "SendChatMessage",
  2365. channel: "Local",
  2366. message: "Stone @ Angle (in radians): " + getNearestStoneAngle()
  2367. })
  2368. }
  2369. }
  2370. }, 2.5)
  2371. function blurCanvas() {
  2372. document.querySelector('canvas')
  2373. .style.filter = "blur(8px)";
  2374. }
  2375. function focusCanvas() {
  2376. document.querySelector('canvas')
  2377. .style.filter = "none";
  2378. }
  2379. const version = "2.4.6";
  2380. const authors = ":)";
  2381. document.getElementsByClassName('hud-intro-name')[0].setAttribute('maxlength', 29);
  2382. console.log('%ceHaxx', 'color: green; background: yellow; font-size: 30px');
  2383. game.network.addEnterWorldHandler(function () {
  2384. setTimeout(() => {
  2385. game.network.sendRpc({
  2386. name: "SendChatMessage",
  2387. channel: "Local",
  2388. message: "ッ hax v" + version + " (✓) made by " + authors
  2389. })
  2390. }, 500)
  2391. document.querySelector("#hud > div.hud-bottom-center").style.textAlign = "center"
  2392. document.querySelector("#hud > div.hud-bottom-center").style.color = "rgba(192, 192, 192, 0.75)"
  2393. document.querySelector("#hud > div.hud-bottom-center").style.fontSize = "30px"
  2394. setInterval(() => {
  2395. document.querySelector("#hud > div.hud-top-right")
  2396. .style.backgroundColor = "rgba(0, 0, 0, 0.25)";
  2397. document.querySelector("#hud > div.hud-top-right")
  2398. .style.border = "5px solid rgba(0, 0, 0, 0.30)";
  2399. document.querySelector("#hud-spell-icons")
  2400. .style.border = "5px solid rgba(0, 0, 0, 0.30)";
  2401. document.querySelector("#hud-menu-icons")
  2402. .style.border = "5px solid rgba(0, 0, 0, 0.30)";
  2403. document.querySelector("#hud-menu-icons")
  2404. .childNodes.forEach((item) => (item.innerHTML = ""));
  2405. document.querySelectorAll(".hud-toolbar-building")
  2406. .forEach((item) => {
  2407. (item.style.border = "5px solid rgba(0, 0, 0, 0.30)"), (item.style.babsdsd = "25%");
  2408. });
  2409. document.querySelector("#hud-debug")
  2410. .style.color = "grey";
  2411. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(1)")
  2412. .style.backgroundColor = "rgba(0, 0, 0, 0.45)";
  2413. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(2)")
  2414. .style.backgroundColor = "rgba(0, 0, 0, 0.45)";
  2415. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(3)")
  2416. .style.backgroundColor = "rgba(0, 0, 0, 0.45)";
  2417. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(4)")
  2418. .style.backgroundColor = "rgba(0, 0, 0, 0.45)";
  2419. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(5)")
  2420. .style.backgroundColor = "rgba(0, 0, 0, 0.45)";
  2421. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(6)")
  2422. .style.backgroundColor = "rgba(0, 0, 0, 0.25)";
  2423. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(1)")
  2424. .style.border = "3px solid lightBlue";
  2425. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(2)")
  2426. .style.border = "3px solid lightBlue";
  2427. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(3)")
  2428. .style.border = "3px solid lightBlue";
  2429. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(4)")
  2430. .style.border = "3px solid lightBlue";
  2431. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(5)")
  2432. .style.border = "3px solid lightBlue";
  2433. document.querySelector("#hud-toolbar > div.hud-toolbar-inventory > a:nth-child(6)")
  2434. .style.border = "3px solid lightBlue";
  2435. if (isChromeOS) {
  2436. document.querySelector("#hud-menu-icons")
  2437. .style.marginBottom = "120px";
  2438. }
  2439. document.querySelector("#hud-map")
  2440. .style.backgroundColor = "rgba(0, 0, 0, 0.25)";
  2441. document.querySelector("#hud-map")
  2442. .style.border = "5px solid rgba(0, 0, 0, 0.40)";
  2443. }, 250);
  2444. setTimeout(() => {
  2445. if (!hasBeenInWorld) {
  2446. var scoreLogged = 0;
  2447. if(!hasBeenInWorld) {
  2448. hasBeenInWorld = true
  2449. setInterval(() => {
  2450. document.querySelector('#scorelog')
  2451. .innerText = `Score in Last Wave: ${scoreLogged}`
  2452. document.querySelector("#coords")
  2453. .innerText = `X: ${game.world.localPlayer.entity.targetTick.position.x}, Y: ${game.world.localPlayer.entity.targetTick.position.y}`
  2454. }, 100)
  2455. createCoordinates()
  2456. }
  2457. hasBeenInWorld = true;
  2458. document.querySelector("#hud > div.hud-bottom-center").append('ッ hax ')
  2459. var oldScore = Game.currentGame.ui.playerTick.score,
  2460. newScore = 0;
  2461. Game.currentGame.network.addRpcHandler("DayCycle", () => {
  2462. newScore = Game.currentGame.ui.playerTick.score;
  2463. scoreLogged = ((newScore - oldScore)
  2464. .toLocaleString("en"));
  2465. oldScore = Game.currentGame.ui.playerTick.score;
  2466. });
  2467. const topCenter = document.querySelector("#hud > div.hud-top-center");
  2468. let logElem;
  2469. logElem = document.createElement('div');
  2470. logElem.innerHTML = `<h1 id="scorelog" style="color:white;">Score in Last Wave: 0</h1>`;
  2471. topCenter.append(logElem);
  2472. }
  2473. }, 500)
  2474. })
  2475. let dimension = 1;
  2476. const onWindowResize = () => {
  2477. const renderer = Game.currentGame.renderer;
  2478. let canvasWidth = window.innerWidth * window.devicePixelRatio;
  2479. let canvasHeight = window.innerHeight * window.devicePixelRatio;
  2480. let ratio = Math.max(canvasWidth / (1920 * dimension), canvasHeight / (1080 * dimension));
  2481. renderer.scale = ratio;
  2482. renderer.entities.setScale(ratio);
  2483. renderer.ui.setScale(ratio);
  2484. renderer.renderer.resize(canvasWidth, canvasHeight);
  2485. renderer.viewport.width = renderer.renderer.width / renderer.scale + 2 * renderer.viewportPadding;
  2486. renderer.viewport.height = renderer.renderer.height / renderer.scale + 2 * renderer.viewportPadding;
  2487. }
  2488. onWindowResize();
  2489. window.onresize = onWindowResize;
  2490. window.onwheel = e => {
  2491. if (e.deltaY > 0) {
  2492. dimension = Math.min(1.35, dimension + 0.01);
  2493. onWindowResize();
  2494. } else if (e.deltaY < 0) {
  2495. dimension = Math.max(0.1, dimension - 0.01);
  2496. onWindowResize();
  2497. }
  2498. }
  2499. addEventListener('keydown', function (e) {
  2500. if (!_isInChatbox && e.key == "/") {
  2501. document.querySelector("#hud-menu-settings")
  2502. .style.display = document.querySelector("#hud-menu-settings")
  2503. .style.display == "none" ? "block" : "none"
  2504. document.querySelector("#hud-menu-shop")
  2505. .style.display = "none"
  2506. document.querySelector("#hud-menu-party")
  2507. .style.display = "none"
  2508. }
  2509. if (!_isInChatbox && e.key == "]") {
  2510. Game.currentGame.network.sendRpc({
  2511. name: "BuyItem",
  2512. itemName: "Crossbow",
  2513. tier: 1
  2514. });
  2515. Game.currentGame.network.sendRpc({
  2516. name: "EquipItem",
  2517. itemName: "Crossbow",
  2518. tier: 1
  2519. });
  2520. }
  2521. addEventListener('keydown', function(e){
  2522. if(e.key == "]"){
  2523. Game.currentGame.network.sendRpc({ name: "BuyItem", itemName: "Crossbow", tier: 1});
  2524. Game.currentGame.network.sendRpc({ name: "EquipItem", itemName: "Crossbow", tier: 1});
  2525. console.log('invisable')
  2526. }
  2527. })
  2528. if (e.key == "u" && !_isInChatbox) {
  2529. transparentMenu = !transparentMenu
  2530. console.log('done')
  2531. } else if (e.key == "=" && !_isInChatbox) {
  2532. game.ui.getComponent("PopupOverlay").showHint(
  2533. 'Press ] for invisible bow,press = for instructions,R for heal spam.There is a button under timeout is hacks.',
  2534. 1.5e4
  2535. )
  2536. }
  2537. })
  2538. var changeChat = true;
  2539. var hoverOver;
  2540. var mousemove;
  2541. addEventListener('mousemove', (e) => {
  2542. mousemove = e;
  2543. })
  2544. function roundTenThousands(x) {
  2545. if (x > 10000) {
  2546. return x.toString()
  2547. .slice(0, 3) + "00"
  2548. } else {
  2549. return x.toString()
  2550. }
  2551. }
  2552. function roundMyPosition(e) {
  2553. return {
  2554. x: roundTenThousands(e.getPositionX()),
  2555. y: roundTenThousands(e.getPositionY())
  2556. }
  2557. }
  2558. var mouseOverInterval = setInterval(() => {
  2559. if (game.world.inWorld) {
  2560. Object.entries(game.world.entities)
  2561. .forEach((item => {
  2562. if (roundMyPosition(item[1])
  2563. .x == parseInt(roundTenThousands(game.renderer.screenToWorld(mousemove.clientX, mousemove.clientY)
  2564. .x)) && roundMyPosition(item[1])
  2565. .y == parseInt(roundTenThousands(game.renderer.screenToWorld(mousemove.clientX, mousemove.clientY)
  2566. .y))) {
  2567. hoverOver = 'Hovering over entity: ' + JSON.stringify(item[1].targetTick)
  2568. } else {
  2569. hoverOver = 'Hovering over no entities.'
  2570. }
  2571. }))
  2572. document.querySelector('#hoverOver')
  2573. .innerText = hoverOver;
  2574. }
  2575. }, 100)
  2576. var isSpamming = 0;
  2577. function pauseChatSpam(e) {
  2578. if (!isSpamming) {
  2579. if (e == "") {
  2580. //:) hax
  2581. e = lololololol
  2582. }
  2583. window.spammer = setInterval(() => {
  2584. game.network.sendRpc({
  2585. name: "SendChatMessage",
  2586. channel: "Local",
  2587. message: e
  2588. })
  2589. }, 100)
  2590. } else if (isSpamming) {
  2591. clearInterval(window.spammer)
  2592. }
  2593. isSpamming = !isSpamming
  2594. }
  2595. window.rainbowwww = false;
  2596. function degreesToYaw(deg) {
  2597. let ans;
  2598. if ((deg - 90) < 90) {
  2599. ans = deg - 90
  2600. } else if (deg == 90) {
  2601. ans = deg + 90
  2602. } else if (deg > 90) {
  2603. ans = deg + 90
  2604. }
  2605. if (ans < 0) {
  2606. ans = Math.abs(ans)
  2607. }
  2608. }
  2609. if (localStorage.timesEhacked == undefined) {
  2610. localStorage.timesEhacked = 1;
  2611. } else {
  2612. localStorage.timesEhacked++;
  2613. }
  2614. document.title = "ッ hax | Times Played: " + localStorage.timesEhacked
  2615. var autoRespawn = false
  2616. let hue = 10
  2617. var settingsRainbow = document.querySelector("#hud-menu-settings")
  2618. function changeHue() {
  2619. if (window.rainbowwww) {
  2620. hue -= 20
  2621. }
  2622. }
  2623. function getEntitiesByModel(type) {
  2624. let entities = []
  2625. Object.entries(game.world.entities)
  2626. .forEach((item => {
  2627. if (item[1].targetTick.model == type) {
  2628. entities.push(item)
  2629. }
  2630. }))
  2631. return entities;
  2632. }
  2633. function moveUp() {
  2634. game.inputPacketScheduler.scheduleInput({
  2635. down: 0,
  2636. up: 1
  2637. })
  2638. }
  2639. function moveDown() {
  2640. game.inputPacketScheduler.scheduleInput({
  2641. up: 0,
  2642. down: 1
  2643. })
  2644. }
  2645. function moveLeft() {
  2646. game.inputPacketScheduler.scheduleInput({
  2647. right: 0,
  2648. left: 1
  2649. })
  2650. }
  2651. function moveRight() {
  2652. game.inputPacketScheduler.scheduleInput({
  2653. left: 0,
  2654. right: 1
  2655. })
  2656. }
  2657. var danceCounter = 0
  2658. var danceRandom = true
  2659. var botMode = false
  2660. var danceInterval = setInterval(() => {
  2661. if (botMode) {
  2662. if (danceCounter < moves.length) {
  2663. moves[danceCounter]()
  2664. if (danceRandom) {
  2665. danceCounter = Math.floor(Math.random() * moves.length)
  2666. } else {
  2667. danceCounter++
  2668. }
  2669. } else {
  2670. danceCounter = 0;
  2671. }
  2672. }
  2673. }, 500)
  2674. var respawnInterval = setInterval(() => {
  2675. if (document.querySelector('.hud-respawn')
  2676. .style.display == "block" && autoRespawn) {
  2677. game.inputPacketScheduler.scheduleInput({
  2678. respawn: 1
  2679. })
  2680. document.querySelector('.hud-respawn')
  2681. .style.display = "none"
  2682. }
  2683. }, 10)
  2684. var moves = [moveUp, moveRight, moveDown, moveLeft]
  2685. function getNearestStoneAngle() {
  2686. let stoneEntities = getEntitiesByModel('Stone');
  2687. let firstStone = stoneEntities[0][1].targetTick;
  2688. let player = game.world.localPlayer.entity.targetTick
  2689. return Math.atan2(player.position.y - firstStone.position.y / 2,
  2690. player.position.x - firstStone.position.x)
  2691. }
  2692. function getNearestTreeAngle() {
  2693. return Math.atan2(game.world.entities[game.world.getMyUid()].targetTick.position.y - getEntitiesByModel('Tree')[0][1].targetTick.position.y / 2, game.world
  2694. .entities[game.world.getMyUid()].targetTick.position.x - getEntitiesByModel('Tree')[0][1].targetTick.position.x)
  2695. }
  2696. function scanServer() {
  2697. var current = []
  2698. Object.entries(game.ui.getComponent('Leaderboard')
  2699. .playerNames)
  2700. .forEach((item => {
  2701. current.push(item)
  2702. }))
  2703. return JSON.stringify(current)
  2704. }
  2705. var leaveChats = ['POP', 'BING', 'TONG', 'RIIING', 'POOF']
  2706. function leaveChat() {
  2707. let counter = 0;
  2708. window.leaveChatInterval = setInterval(() => {
  2709. if (counter < leaveChats.length) {
  2710. doNewSend(['ch', [leaveChats[counter]]]);
  2711. counter++;
  2712. } else {
  2713. counter = 0;
  2714. clearInterval(window.leaveChatInterval);
  2715. Game.currentGame.network.disconnect();
  2716. };
  2717. }, 1500);
  2718. };
  2719. window.startaito = false;
  2720. window.useSamePI = false
  2721. addEventListener('keyup', function (e) {
  2722. if (e.key == "`" && !_isInChatbox) {
  2723. game.inputManager.onKeyRelease({
  2724. keyCode: 117
  2725. })
  2726. }
  2727. }) // debug info
  2728. var bw1 = "😈 Boss Waves [1/2]: 9, 17, 25, 33, 41, 49, 57, 65, 73, 81 😈"
  2729. var bw2 = "😈 Boss Waves [2/2]: 89, 97, 105, 121 😈"
  2730. window.ajsd = Math.random()
  2731. .toString()
  2732. .slice(0, 6)
  2733. console.log(window.ajsd)
  2734. var users = [
  2735. {
  2736. "name": "☬ 𝑒𝒽 ✨ ツ ✓",
  2737. "roles": ['Owner', 'Admin']
  2738. }
  2739. , {
  2740. "name": "u7🤗ツ✔",
  2741. "roles": ['Co-Owner', 'Admin']
  2742. }
  2743. , {
  2744. "name": "☢₦Ʉ₵ⱠɆ₳Ɽ☣✔",
  2745. "roles": ['Co-Owner', 'Admin']
  2746. }
  2747. , {
  2748. "name": "⦕NR⦖☬𝑒𝒽✨ツ✓",
  2749. "roles": ['Owner', 'Admin']
  2750. }
  2751. , {
  2752. "name": "Potato Bot",
  2753. "roles": ['Admin', 'Leaker']
  2754. }
  2755. , {
  2756. "name": "⦕NR⦖ F3AR ツ",
  2757. "roles": ['Admin', 'Official']
  2758. }
  2759. , {
  2760. "name": "Yazeet",
  2761. "roles": ['Stealer']
  2762. }
  2763. ]
  2764. var q = [
  2765. {
  2766. word: "is",
  2767. answers: ['Naw', 'Yup.'],
  2768. random: true
  2769. }
  2770. , {
  2771. word: "will",
  2772. answers: ['Outlook good.', 'Perhaps.', 'Yup.', 'Naw'],
  2773. random: true
  2774. }
  2775. , {
  2776. word: "when",
  2777. answers: ['Soon.', 'Never.'],
  2778. random: true
  2779. }
  2780. , {
  2781. word: "are",
  2782. answers: ['Yup.', 'Naw', 'Perhaps.'],
  2783. random: true
  2784. }]
  2785. let ppInterval = setInterval(() => { // show private parties
  2786. if (document.querySelector('#showpp')
  2787. .checked) {
  2788. document.querySelectorAll('.hud-party-link')
  2789. .forEach((elem => {
  2790. if (elem.style.display == "none") {
  2791. elem.style.display = "block"
  2792. elem.childNodes[0].innerText = elem.childNodes[0].innerText + "[PRIVATE]"
  2793. elem.addEventListener('click', function () {
  2794. game.ui.getComponent('PopupOverlay')
  2795. .showHint('Cannot join this party as it is private', 1e4)
  2796. })
  2797. }
  2798. }))
  2799. }
  2800. }, 3000) // show private parties
  2801. window.lpSave = []
  2802. const altSpace = " " // alternate space character
  2803. String.prototype.multiChatSpaces = function () {
  2804. return this.replaceAll(' ', altSpace)
  2805. }
  2806. var chatAnims = {
  2807. makeRect: [
  2808. "________________________"
  2809. , "| &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |"
  2810. , "________________________"
  2811. ],
  2812. makeCircle: [
  2813. " ╱‾‾‾‾‾╲"
  2814. , " / \\"
  2815. , " | |"
  2816. , " \\ /"
  2817. , " ╲_____╱"
  2818. ]
  2819. } // :D
  2820. window.use_di = true;
  2821. window.isInMenu = false;
  2822. function doorWall() {
  2823. var stashPosition = getGoldStash()
  2824. PlaceBuilding(stashPosition.x + 0, stashPosition.y + 0, 'GoldStash', 180);
  2825. PlaceBuilding(stashPosition.x + -96, stashPosition.y + -96, 'GoldMine', 180);
  2826. PlaceBuilding(stashPosition.x + 0, stashPosition.y + -96, 'GoldMine', 180);
  2827. PlaceBuilding(stashPosition.x + 96, stashPosition.y + -96, 'GoldMine', 180);
  2828. PlaceBuilding(stashPosition.x + 96, stashPosition.y + -192, 'GoldMine', 180);
  2829. PlaceBuilding(stashPosition.x + 0, stashPosition.y + -192, 'GoldMine', 180);
  2830. PlaceBuilding(stashPosition.x + -96, stashPosition.y + -192, 'GoldMine', 180);
  2831. PlaceBuilding(stashPosition.x + -96, stashPosition.y + -288, 'GoldMine', 180);
  2832. PlaceBuilding(stashPosition.x + -24, stashPosition.y + -840, 'Door', 180);
  2833. PlaceBuilding(stashPosition.x + -72, stashPosition.y + -840, 'Door', 180);
  2834. PlaceBuilding(stashPosition.x + -120, stashPosition.y + -840, 'Door', 180);
  2835. PlaceBuilding(stashPosition.x + -168, stashPosition.y + -840, 'Door', 180);
  2836. PlaceBuilding(stashPosition.x + -216, stashPosition.y + -840, 'Door', 180);
  2837. PlaceBuilding(stashPosition.x + -264, stashPosition.y + -840, 'Door', 180);
  2838. PlaceBuilding(stashPosition.x + -312, stashPosition.y + -840, 'Door', 180);
  2839. PlaceBuilding(stashPosition.x + -360, stashPosition.y + -840, 'Door', 180);
  2840. PlaceBuilding(stashPosition.x + -408, stashPosition.y + -840, 'Door', 180);
  2841. PlaceBuilding(stashPosition.x + -456, stashPosition.y + -840, 'Door', 180);
  2842. PlaceBuilding(stashPosition.x + -504, stashPosition.y + -840, 'Door', 180);
  2843. PlaceBuilding(stashPosition.x + -552, stashPosition.y + -840, 'Door', 180);
  2844. PlaceBuilding(stashPosition.x + 24, stashPosition.y + -840, 'Door', 180);
  2845. PlaceBuilding(stashPosition.x + 72, stashPosition.y + -840, 'Door', 180);
  2846. PlaceBuilding(stashPosition.x + 120, stashPosition.y + -840, 'Door', 180);
  2847. PlaceBuilding(stashPosition.x + 168, stashPosition.y + -840, 'Door', 180);
  2848. PlaceBuilding(stashPosition.x + 216, stashPosition.y + -840, 'Door', 180);
  2849. PlaceBuilding(stashPosition.x + 264, stashPosition.y + -840, 'Door', 180);
  2850. PlaceBuilding(stashPosition.x + -600, stashPosition.y + -840, 'Door', 180);
  2851. PlaceBuilding(stashPosition.x + -648, stashPosition.y + -840, 'Door', 180);
  2852. PlaceBuilding(stashPosition.x + -696, stashPosition.y + -840, 'Door', 180);
  2853. PlaceBuilding(stashPosition.x + -744, stashPosition.y + -840, 'Door', 180);
  2854. PlaceBuilding(stashPosition.x + -792, stashPosition.y + -840, 'Door', 180);
  2855. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -840, 'Door', 180);
  2856. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -792, 'Door', 180);
  2857. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -744, 'Door', 180);
  2858. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -696, 'Door', 180);
  2859. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -648, 'Door', 180);
  2860. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -600, 'Door', 180);
  2861. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -552, 'Door', 180);
  2862. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -504, 'Door', 180);
  2863. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -456, 'Door', 180);
  2864. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -408, 'Door', 180);
  2865. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -360, 'Door', 180);
  2866. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -312, 'Door', 180);
  2867. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -264, 'Door', 180);
  2868. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -216, 'Door', 180);
  2869. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -168, 'Door', 180);
  2870. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -120, 'Door', 180);
  2871. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -72, 'Door', 180);
  2872. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -24, 'Door', 180);
  2873. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 24, 'Door', 180);
  2874. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 72, 'Door', 180);
  2875. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 120, 'Door', 180);
  2876. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 168, 'Door', 180);
  2877. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 216, 'Door', 180);
  2878. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 264, 'Door', 180);
  2879. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 312, 'Door', 180);
  2880. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 360, 'Door', 180);
  2881. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 408, 'Door', 180);
  2882. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 456, 'Door', 180);
  2883. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 504, 'Door', 180);
  2884. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 552, 'Door', 180);
  2885. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 600, 'Door', 180);
  2886. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 648, 'Door', 180);
  2887. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 696, 'Door', 180);
  2888. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 744, 'Door', 180);
  2889. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 792, 'Door', 180);
  2890. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 840, 'Door', 180);
  2891. PlaceBuilding(stashPosition.x + -792, stashPosition.y + 840, 'Door', 180);
  2892. PlaceBuilding(stashPosition.x + -744, stashPosition.y + 840, 'Door', 180);
  2893. PlaceBuilding(stashPosition.x + -696, stashPosition.y + 840, 'Door', 180);
  2894. PlaceBuilding(stashPosition.x + -648, stashPosition.y + 840, 'Door', 180);
  2895. PlaceBuilding(stashPosition.x + -600, stashPosition.y + 840, 'Door', 180);
  2896. PlaceBuilding(stashPosition.x + -552, stashPosition.y + 840, 'Door', 180);
  2897. PlaceBuilding(stashPosition.x + -504, stashPosition.y + 840, 'Door', 180);
  2898. PlaceBuilding(stashPosition.x + -456, stashPosition.y + 840, 'Door', 180);
  2899. PlaceBuilding(stashPosition.x + -408, stashPosition.y + 840, 'Door', 180);
  2900. PlaceBuilding(stashPosition.x + -360, stashPosition.y + 840, 'Door', 180);
  2901. PlaceBuilding(stashPosition.x + -216, stashPosition.y + 840, 'Door', 180);
  2902. PlaceBuilding(stashPosition.x + -168, stashPosition.y + 840, 'Door', 180);
  2903. PlaceBuilding(stashPosition.x + -72, stashPosition.y + 840, 'Door', 180);
  2904. PlaceBuilding(stashPosition.x + 24, stashPosition.y + 840, 'Door', 180);
  2905. PlaceBuilding(stashPosition.x + -312, stashPosition.y + 840, 'Door', 180);
  2906. PlaceBuilding(stashPosition.x + -264, stashPosition.y + 840, 'Door', 180);
  2907. PlaceBuilding(stashPosition.x + -120, stashPosition.y + 840, 'Door', 180);
  2908. PlaceBuilding(stashPosition.x + -24, stashPosition.y + 840, 'Door', 180);
  2909. PlaceBuilding(stashPosition.x + 72, stashPosition.y + 840, 'Door', 180);
  2910. PlaceBuilding(stashPosition.x + 120, stashPosition.y + 840, 'Door', 180);
  2911. PlaceBuilding(stashPosition.x + 168, stashPosition.y + 840, 'Door', 180);
  2912. PlaceBuilding(stashPosition.x + 216, stashPosition.y + 840, 'Door', 180);
  2913. PlaceBuilding(stashPosition.x + 264, stashPosition.y + 840, 'Door', 180);
  2914. PlaceBuilding(stashPosition.x + 312, stashPosition.y + 840, 'Door', 180);
  2915. PlaceBuilding(stashPosition.x + 360, stashPosition.y + 840, 'Door', 180);
  2916. PlaceBuilding(stashPosition.x + 456, stashPosition.y + 840, 'Door', 180);
  2917. PlaceBuilding(stashPosition.x + 408, stashPosition.y + 840, 'Door', 180);
  2918. PlaceBuilding(stashPosition.x + 504, stashPosition.y + 840, 'Door', 180);
  2919. PlaceBuilding(stashPosition.x + 552, stashPosition.y + 840, 'Door', 180);
  2920. PlaceBuilding(stashPosition.x + 600, stashPosition.y + 840, 'Door', 180);
  2921. PlaceBuilding(stashPosition.x + 648, stashPosition.y + 840, 'Door', 180);
  2922. PlaceBuilding(stashPosition.x + 696, stashPosition.y + 840, 'Door', 180);
  2923. PlaceBuilding(stashPosition.x + 744, stashPosition.y + 840, 'Door', 180);
  2924. PlaceBuilding(stashPosition.x + 792, stashPosition.y + 840, 'Door', 180);
  2925. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 840, 'Door', 180);
  2926. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 792, 'Door', 180);
  2927. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 744, 'Door', 180);
  2928. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 696, 'Door', 180);
  2929. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 648, 'Door', 180);
  2930. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 600, 'Door', 180);
  2931. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 552, 'Door', 180);
  2932. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 504, 'Door', 180);
  2933. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 456, 'Door', 180);
  2934. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 408, 'Door', 180);
  2935. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 360, 'Door', 180);
  2936. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 312, 'Door', 180);
  2937. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 264, 'Door', 180);
  2938. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 216, 'Door', 180);
  2939. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 168, 'Door', 180);
  2940. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 120, 'Door', 180);
  2941. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 72, 'Door', 180);
  2942. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 24, 'Door', 180);
  2943. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -24, 'Door', 180);
  2944. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -72, 'Door', 180);
  2945. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -168, 'Door', 180);
  2946. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -264, 'Door', 180);
  2947. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -312, 'Door', 180);
  2948. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -360, 'Door', 180);
  2949. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -408, 'Door', 180);
  2950. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -456, 'Door', 180);
  2951. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -504, 'Door', 180);
  2952. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -552, 'Door', 180);
  2953. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -600, 'Door', 180);
  2954. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -648, 'Door', 180);
  2955. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -216, 'Door', 180);
  2956. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -120, 'Door', 180);
  2957. PlaceBuilding(stashPosition.x + 312, stashPosition.y + -840, 'Door', 180);
  2958. PlaceBuilding(stashPosition.x + 360, stashPosition.y + -840, 'Door', 180);
  2959. PlaceBuilding(stashPosition.x + 408, stashPosition.y + -840, 'Door', 180);
  2960. PlaceBuilding(stashPosition.x + 456, stashPosition.y + -840, 'Door', 180);
  2961. PlaceBuilding(stashPosition.x + 504, stashPosition.y + -840, 'Door', 180);
  2962. PlaceBuilding(stashPosition.x + 552, stashPosition.y + -840, 'Door', 180);
  2963. PlaceBuilding(stashPosition.x + 600, stashPosition.y + -840, 'Door', 180);
  2964. PlaceBuilding(stashPosition.x + 648, stashPosition.y + -840, 'Door', 180);
  2965. PlaceBuilding(stashPosition.x + 696, stashPosition.y + -840, 'Door', 180);
  2966. PlaceBuilding(stashPosition.x + 744, stashPosition.y + -840, 'Door', 180);
  2967. PlaceBuilding(stashPosition.x + 792, stashPosition.y + -840, 'Door', 180);
  2968. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -840, 'Door', 180);
  2969. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -792, 'Door', 180);
  2970. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -744, 'Door', 180);
  2971. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -696, 'Door', 180);
  2972. }
  2973. var animChat = {
  2974. makeRect: function () {
  2975. let counter = 0;
  2976. let rectInterval = setInterval(() => {
  2977. if (counter < chatAnims.makeRect.length) {
  2978. doNewSend(['ch', [chatAnims.makeRect[counter].multiChatSpaces()]])
  2979. counter++
  2980. } else {
  2981. counter = 0
  2982. clearInterval(rectInterval)
  2983. }
  2984. }, 3000)
  2985. },
  2986. makeCircle: function () {
  2987. let counter = 0;
  2988. let circleInterval = setInterval(() => {
  2989. if (counter < chatAnims.makeCircle.length) {
  2990. doNewSend(['ch', [chatAnims.makeCircle[counter].multiChatSpaces()]])
  2991. counter++
  2992. } else {
  2993. counter = 0
  2994. clearInterval(circleInterval)
  2995. }
  2996. }, 3000)
  2997. }
  2998. }
  2999. function btnChatCircle() {
  3000. animChat.makeCircle()
  3001. }
  3002. function btnChatRect() {
  3003. animChat.makeRect()
  3004. }
  3005. function upgradeall() {
  3006. var entities = Game.currentGame.world.entities;
  3007. for (var uid in entities) {
  3008. if (!entities.hasOwnProperty(uid)) continue;
  3009. var obj = entities[uid];
  3010. Game.currentGame.network.sendRpc({
  3011. name: "UpgradeBuilding",
  3012. uid: obj.fromTick.uid
  3013. })
  3014. }
  3015. doNewSend(['ch', ['♦️ Upgraded All! ♦️']])
  3016. }
  3017. function movePlayer(e) {
  3018. if (!_isInChatbox) {
  3019. switch (e.toLowerCase()
  3020. .replaceAll(' ', '')) {
  3021. case "a":
  3022. Game.currentGame.network.sendInput({
  3023. left: 1
  3024. })
  3025. break;
  3026. case "d":
  3027. Game.currentGame.network.sendInput({
  3028. right: 1
  3029. })
  3030. break;
  3031. case "w":
  3032. Game.currentGame.network.sendInput({
  3033. up: 1
  3034. })
  3035. break;
  3036. case "s":
  3037. Game.currentGame.network.sendInput({
  3038. down: 1
  3039. })
  3040. break;
  3041. }
  3042. }
  3043. }
  3044. var emojis = [
  3045. {
  3046. text: ":happy:",
  3047. char: "😄"
  3048. }
  3049. , {
  3050. text: ":sad:",
  3051. char: "😥"
  3052. }
  3053. , {
  3054. text: ":angry:",
  3055. char: "😠"
  3056. }
  3057. , {
  3058. text: ":laughing:",
  3059. char: "😂"
  3060. }
  3061. , {
  3062. text: ":stop:",
  3063. char: "🛑"
  3064. }
  3065. , {
  3066. text: ":revenge:",
  3067. char: "😈"
  3068. }
  3069. , {
  3070. text: ":smiley:",
  3071. char: "ヅ"
  3072. }
  3073. , {
  3074. text: ":pog:",
  3075. char: "ÌŠ<ÌŠ"
  3076. }]
  3077. function Heal() {
  3078. Game.currentGame.network.sendRpc({
  3079. "name": "BuyItem",
  3080. "itemName": "HealthPotion",
  3081. "tier": 1
  3082. })
  3083. Game.currentGame.network.sendRpc({
  3084. "name": "EquipItem",
  3085. "itemName": "HealthPotion",
  3086. "tier": 1
  3087. })
  3088. Game.currentGame.network.sendRpc({
  3089. "name": "BuyItem",
  3090. "itemName": "PetHealthPotion",
  3091. "tier": 1
  3092. })
  3093. Game.currentGame.network.sendRpc({
  3094. "name": "EquipItem",
  3095. "itemName": "PetHealthPotion",
  3096. "tier": 1
  3097. })
  3098. }
  3099. function getGoldStash() {
  3100. let entities = Game.currentGame.ui.buildings
  3101. for (let uid in entities) {
  3102. if (!entities.hasOwnProperty(uid)) {
  3103. continue
  3104. }
  3105. let obj = entities[uid]
  3106. if (obj.type == "GoldStash") {
  3107. return obj
  3108. }
  3109. }
  3110. }
  3111. function PlaceBuilding(x, y, building, yaw) {
  3112. Game.currentGame.network.sendRpc({
  3113. name: "MakeBuilding",
  3114. x: x,
  3115. y: y,
  3116. type: building,
  3117. yaw: yaw
  3118. })
  3119. }
  3120. var isBowing = false;
  3121. var slotChars = [
  3122. {
  3123. char: "7️⃣",
  3124. value: 33
  3125. }
  3126. , {
  3127. char: "🍎",
  3128. value: 10
  3129. }
  3130. , {
  3131. char: "🍔",
  3132. value: 25
  3133. }
  3134. , {
  3135. char: "🥓",
  3136. value: 15
  3137. }
  3138. , {
  3139. char: "âš½",
  3140. value: 12
  3141. }
  3142. , {
  3143. char: "🐾",
  3144. value: 10
  3145. }
  3146. , {
  3147. char: "1️⃣",
  3148. value: 27
  3149. }
  3150. , {
  3151. char: "💡",
  3152. value: 30
  3153. }]
  3154. console.log(slotChars)
  3155. window.generateSlots = function () { // fp is the returned array, fs is the joined | fp string, pp is the score
  3156. let fp = [];
  3157. let fs = "";
  3158. let pp = 0;
  3159. var f1 = slotChars[Math.floor(Math.random() * slotChars.length)]
  3160. fp.push(f1.char)
  3161. pp += f1.value
  3162. var f2 = slotChars[Math.floor(Math.random() * slotChars.length)]
  3163. fp.push(f2.char)
  3164. pp += f2.value
  3165. var f3 = slotChars[Math.floor(Math.random() * slotChars.length)]
  3166. fp.push(f3.char)
  3167. pp += f3.value
  3168. fs = [fp.join('|'), pp + " / 99"]
  3169. return fs;
  3170. }
  3171. function ahrc1() { // 1 ahrc (collect and refuel), used in lpinterval
  3172. var entities = Game.currentGame.world.entities
  3173. for (let uid in entities) {
  3174. if (!entities.hasOwnProperty(uid)) continue;
  3175. let obj = entities[uid];
  3176. Game.currentGame.network.sendRpc({
  3177. name: "CollectHarvester",
  3178. uid: obj.fromTick.uid
  3179. });
  3180. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 1) {
  3181. Game.currentGame.network.sendRpc({
  3182. name: "AddDepositToHarvester",
  3183. uid: obj.fromTick.uid,
  3184. deposit: 0.07
  3185. });
  3186. }
  3187. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 2) {
  3188. Game.currentGame.network.sendRpc({
  3189. name: "AddDepositToHarvester",
  3190. uid: obj.fromTick.uid,
  3191. deposit: 0.11
  3192. });
  3193. }
  3194. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 3) {
  3195. Game.currentGame.network.sendRpc({
  3196. name: "AddDepositToHarvester",
  3197. uid: obj.fromTick.uid,
  3198. deposit: 0.17
  3199. });
  3200. }
  3201. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 4) {
  3202. Game.currentGame.network.sendRpc({
  3203. name: "AddDepositToHarvester",
  3204. uid: obj.fromTick.uid,
  3205. deposit: 0.22
  3206. });
  3207. }
  3208. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 5) {
  3209. Game.currentGame.network.sendRpc({
  3210. name: "AddDepositToHarvester",
  3211. uid: obj.fromTick.uid,
  3212. deposit: 0.25
  3213. });
  3214. }
  3215. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 6) {
  3216. Game.currentGame.network.sendRpc({
  3217. name: "AddDepositToHarvester",
  3218. uid: obj.fromTick.uid,
  3219. deposit: 0.28
  3220. });
  3221. }
  3222. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 7) {
  3223. Game.currentGame.network.sendRpc({
  3224. name: "AddDepositToHarvester",
  3225. uid: obj.fromTick.uid,
  3226. deposit: 0.42
  3227. });
  3228. }
  3229. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 8) {
  3230. Game.currentGame.network.sendRpc({
  3231. name: "AddDepositToHarvester",
  3232. uid: obj.fromTick.uid,
  3233. deposit: 0.65
  3234. });
  3235. }
  3236. }
  3237. }
  3238. var lpinterval = setInterval(function () { // loaded player info, ahrc, isInMenu, noob = chatbot
  3239. document.querySelector('#lpi')
  3240. .innerText = "Loaded Player Info: " + JSON.stringify(window.loadedIDS())
  3241. if (window.ahrc) {
  3242. ahrc1()
  3243. }
  3244. window.isInMenu = document.querySelector('#hud-menu-settings')
  3245. .style.display == "block" ? true : false
  3246. if ((window.lpSave[window.lpSave.length - 1] !== loadedPlayers()[loadedPlayers()
  3247. .length - 1]) && document.querySelector('#noobchat')
  3248. .checked) {
  3249. doNewSend(['ch', ['NOOB = ' + loadedPlayers()[Math.floor(Math.random() * loadedPlayers()
  3250. .length)]]])
  3251. window.lpSave = loadedPlayers()
  3252. }
  3253. document.querySelector("#hud-menu-party > div.hud-party-grid > div.hud-party-joining")
  3254. .style.display = "none"
  3255. }, 250)
  3256. // enable/disable chat
  3257. // 🟩 🟥
  3258. function enDisAbleEmj(bool, txt) {
  3259. return bool ? "🟩 " + txt + " Enabled 🟩" : "🟥 " + txt + " Disabled 🟥"
  3260. }
  3261. // disable enable in chat
  3262. window.cmdsEnabled = true
  3263. // these are all button event listeners --->
  3264. function toggleCmds() {
  3265. window.cmdsEnabled = !window.cmdsEnabled
  3266. if (changeChat) {
  3267. doNewSend(['ch', [enDisAbleEmj(window.cmdsEnabled, "Commands")]])
  3268. }
  3269. document.querySelector('#togglecmd')
  3270. .innerText = window.cmdsEnabled ? "Disable Commands" : "Enable Commands"
  3271. }
  3272. function sellAll() {
  3273. var entities = Game.currentGame.world.entities;
  3274. for (var uid in entities) {
  3275. if (!entities.hasOwnProperty(uid)) continue;
  3276. var obj = entities[uid];
  3277. if (obj.fromTick.model !== "GoldStash") {
  3278. Game.currentGame.network.sendRpc({
  3279. name: "DeleteBuilding",
  3280. uid: obj.fromTick.uid
  3281. });
  3282. }
  3283. }
  3284. doNewSend(['ch', ['💰 Sold All 💰']])
  3285. }
  3286. function sellWalls() {
  3287. var entities = Game.currentGame.world.entities;
  3288. for (var uid in entities) {
  3289. if (!entities.hasOwnProperty(uid)) continue;
  3290. var obj = entities[uid];
  3291. if (obj.fromTick.model == "Wall") {
  3292. Game.currentGame.network.sendRpc({
  3293. name: "DeleteBuilding",
  3294. uid: obj.fromTick.uid
  3295. })
  3296. }
  3297. }
  3298. doNewSend(['ch', ['💰 Sold Walls 💰']])
  3299. }
  3300. function sellBombTowers() {
  3301. var entities = Game.currentGame.world.entities;
  3302. for (var uid in entities) {
  3303. if (!entities.hasOwnProperty(uid)) continue;
  3304. var obj = entities[uid];
  3305. if (obj.fromTick.model == "BombTower") {
  3306. Game.currentGame.network.sendRpc({
  3307. name: "DeleteBuilding",
  3308. uid: obj.fromTick.uid
  3309. });
  3310. }
  3311. }
  3312. doNewSend(['ch', ['💰 Sold Bomb Towers 💰']])
  3313. }
  3314. function sellGoldMines() {
  3315. var entities = Game.currentGame.world.entities;
  3316. for (var uid in entities) {
  3317. if (!entities.hasOwnProperty(uid)) continue;
  3318. var obj = entities[uid];
  3319. if (obj.fromTick.model == "GoldMine") {
  3320. Game.currentGame.network.sendRpc({
  3321. name: "DeleteBuilding",
  3322. uid: obj.fromTick.uid
  3323. });
  3324. }
  3325. }
  3326. doNewSend(['ch', ['💰 Sold Gold Mines 💰']])
  3327. }
  3328. function sellArrowTowers() {
  3329. var entities = Game.currentGame.world.entities;
  3330. for (var uid in entities) {
  3331. if (!entities.hasOwnProperty(uid)) continue;
  3332. var obj = entities[uid];
  3333. if (obj.fromTick.model == "ArrowTower") {
  3334. Game.currentGame.network.sendRpc({
  3335. name: "DeleteBuilding",
  3336. uid: obj.fromTick.uid
  3337. });
  3338. }
  3339. }
  3340. doNewSend(['ch', ['💰 Sold Arrow Towers 💰']])
  3341. }
  3342. function sellSlowTraps() {
  3343. var entities = Game.currentGame.world.entities;
  3344. for (var uid in entities) {
  3345. if (!entities.hasOwnProperty(uid)) continue;
  3346. var obj = entities[uid];
  3347. if (obj.fromTick.model == "SlowTrap") {
  3348. Game.currentGame.network.sendRpc({
  3349. name: "DeleteBuilding",
  3350. uid: obj.fromTick.uid
  3351. });
  3352. }
  3353. }
  3354. doNewSend(['ch', ['💰 Sold Slow Traps 💰']])
  3355. }
  3356. function sellCannonTowers() {
  3357. var entities = Game.currentGame.world.entities;
  3358. for (var uid in entities) {
  3359. if (!entities.hasOwnProperty(uid)) continue;
  3360. var obj = entities[uid];
  3361. if (obj.fromTick.model == "CannonTower") {
  3362. Game.currentGame.network.sendRpc({
  3363. name: "DeleteBuilding",
  3364. uid: obj.fromTick.uid
  3365. });
  3366. }
  3367. }
  3368. doNewSend(['ch', ['💰 Sold Cannon Towers 💰']])
  3369. }
  3370. function sellMageTowers() {
  3371. var entities = Game.currentGame.world.entities;
  3372. for (var uid in entities) {
  3373. if (!entities.hasOwnProperty(uid)) continue;
  3374. var obj = entities[uid];
  3375. if (obj.fromTick.model == "MagicTower") {
  3376. Game.currentGame.network.sendRpc({
  3377. name: "DeleteBuilding",
  3378. uid: obj.fromTick.uid
  3379. });
  3380. }
  3381. }
  3382. doNewSend(['ch', ['💰 Sold Mage Towers 💰']])
  3383. }
  3384. function sellMeleeTowers() {
  3385. var entities = Game.currentGame.world.entities;
  3386. for (var uid in entities) {
  3387. if (!entities.hasOwnProperty(uid)) continue;
  3388. var obj = entities[uid];
  3389. if (obj.fromTick.model == "MeleeTower") {
  3390. Game.currentGame.network.sendRpc({
  3391. name: "DeleteBuilding",
  3392. uid: obj.fromTick.uid
  3393. });
  3394. }
  3395. }
  3396. doNewSend(['ch', ['💰 Sold Melee Towers 💰']])
  3397. }
  3398. function sellHarvesters() {
  3399. var entities = Game.currentGame.world.entities;
  3400. for (var uid in entities) {
  3401. if (!entities.hasOwnProperty(uid)) continue;
  3402. var obj = entities[uid];
  3403. if (obj.fromTick.model == "Harvester") {
  3404. Game.currentGame.network.sendRpc({
  3405. name: "DeleteBuilding",
  3406. uid: obj.fromTick.uid
  3407. });
  3408. }
  3409. }
  3410. doNewSend(['ch', ['💰 Sold Harvesters 💰']])
  3411. }
  3412. function sellDoors() {
  3413. var entities = Game.currentGame.world.entities;
  3414. for (var uid in entities) {
  3415. if (!entities.hasOwnProperty(uid)) continue;
  3416. var obj = entities[uid];
  3417. if (obj.fromTick.model == "Door") {
  3418. Game.currentGame.network.sendRpc({
  3419. name: "DeleteBuilding",
  3420. uid: obj.fromTick.uid
  3421. });
  3422. }
  3423. }
  3424. doNewSend(['ch', ['💰 Sold Doors 💰']])
  3425. }
  3426. // <--- end of button event listeners
  3427. //
  3428. document.querySelector('.hud-chat-input')
  3429. .addEventListener('keypress', function (e) {
  3430. emojis.forEach((item => {
  3431. this.value = this.value.replaceAll(item.text, item.char)
  3432. }))
  3433. if (e.keyCode == 13) { // exclude commands and html entities
  3434. this.value = this.value.replaceAll('fuck', 'fuc‌k')
  3435. .replaceAll('FUCK', 'FUC‌K')
  3436. .replaceAll('shit', 'shi‌t')
  3437. .replaceAll('SHIT', 'SHI‌T')
  3438. .replaceAll('bitch', 'bit‌ch')
  3439. .replaceAll('BITCH', 'BIT‌CH')
  3440. .replaceAll('ass', 'as‌s')
  3441. .replaceAll('ASS', 'AS‌S')
  3442. .replaceAll('dick', 'dic‌k')
  3443. .replaceAll('DICK', "DIC‌K")
  3444. .slice(0, 63) // anti censor C:
  3445. if (this.value.toLowerCase()
  3446. .includes('nigg') || this.value.toLowerCase()
  3447. .includes('niga') || this.value.toLowerCase()
  3448. .includes('nig ') || this.value.toLowerCase()
  3449. .includes('nige')) {
  3450. this.value = "I am a building, don't be racist"
  3451. }
  3452. }
  3453. })
  3454. var insults = ["you smooth brained potato", "you rotten pumpkin brain", "you soggy zuicini", "you watered down banana"
  3455. , "you're orange juice toothpaste flavored"] // just an array of insults
  3456. // menu stuff (defining & appending) --->
  3457. var settingsHTML = `
  3458. <h3>𝓮𝓗𝓪𝔁𝔁</h3>
  3459. <hr>
  3460. <input type="text" id="spamchat" placeholder="Message" class="menu-textbox">
  3461. <br>
  3462. <button class="btn btn-purple ehack-btn" style="border-radius:25%" id="spamchatbtn">Split Chat</button>
  3463. <br>
  3464. <input type="text" id="spmchinput" placeholder="Message" class="menu-textbox">
  3465. <br>
  3466. <button class="btn btn-purple ehack-btn" style="border-radius:25%" id="togglespmch">Enable Chat Spam</button>
  3467. <hr>
  3468. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="clearchatbtn">Clear Chat</button>
  3469. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="upgradeallbtn">Upgrade All</button>
  3470. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="mainxaito">Enable Aito</button>
  3471. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="walldoor">Wall of Doors</button>
  3472. <hr>
  3473. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="idkbtn33">Chat Leave Sounds</button>
  3474. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="idkbtn22">Chat Rectangle</button>
  3475. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="idkbtn11">Chat Circle</button>
  3476. <hr>
  3477. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="resetinsultsbtn">Reset Insults</button>
  3478. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="togglecmd">Disable Commands</button>
  3479. <button class="btn btn-red ehack-btn ehack-btn" style="border-radius:25%" id="toggleahrc">Enable AHRC</button>
  3480. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="toggleab">Enable AutoBow</button>
  3481. <hr>
  3482. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="togglebot">Enable Bot Mode</button>
  3483. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="toggleresp">Enable Auto Respawn</button>
  3484. <hr>
  3485. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellall">Sell All</button>
  3486. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellwalls">Sell Walls</button>
  3487. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="selldoors">Sell Doors</button>
  3488. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="selltraps">Sell Traps</button>
  3489. <hr>
  3490. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellmines">Sell Gold Mines</button>
  3491. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellarrows">Sell Arrows</button>
  3492. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellcannons">Sell Cannons</button>
  3493. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellmelees">Sell Melees</button>
  3494. <hr>
  3495. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellbombs">Sell Bombs</button>
  3496. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellmages">Sell Mages</button>
  3497. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellharvesters">Sell Harvesters</button>
  3498. <hr>
  3499. <button class="btn btn-gold ehack-btn" style="border-radius:25%" id="menu-leaveparty-btn">Leave Party</button>
  3500. <br>
  3501. <input type="text" class="menu-textbox" id="menu-jpbsk-input" placeholder="Party share key">
  3502. <br>
  3503. <button class="btn btn-gold ehack-btn" style="border-radius:25%" id="menu-jpbsk-btn" onclick='Game.currentGame.network.sendRpc({name:"JoinPartyByShareKey", partyShareKey: document.querySelector("#menu-jpbsk-input").value})'>Join Party By Share Key</button>
  3504. <hr>
  3505. <button class="btn btn-white ehack-btn" style="border-radius:25%" onclick="Game.currentGame.network.disconnect()">Disconnect</button>
  3506. <hr>
  3507. <p style="font-size:10px;">Use default insults?</p><input type="checkbox" id="use-di" checked>
  3508. <br>
  3509. <p style="font-size:10px;">Show private parties?</p><input type="checkbox" id="showpp" checked>
  3510. <br>
  3511. <p style="font-size:10px;">Noob chat?</p><input type="checkbox" id="noobchat">
  3512. <br>
  3513. <p style="font-size:10px;">Advanced Player Info?</p><input type="checkbox" id="advancedlpi">
  3514. <br>
  3515. <p style="font-size:10px;">Zoom On Scroll?</p><input type="checkbox" id="zos">
  3516. <br>
  3517. <p style="font-size:10px;">CopyCat?</p><input type="checkbox" id="copycat">
  3518. <br>
  3519. <p style="font-size:10px;">Death Chat?</p><input type="checkbox" id="deadchat">
  3520. <br>
  3521. <p style="font-size:10px;">Enable/Disable Chat?</p><input type="checkbox" id="apexmode" checked>
  3522. <hr>
  3523. <p id="lpi">Loaded Player Info: </p>
  3524. <style>
  3525. .menu-textbox{
  3526. border-radius:25%;
  3527. background-color: rgba(171, 183, 183, 0.25);
  3528. border: 2px solid black;
  3529. color:white;
  3530. }
  3531. .ehack-btn:hover{
  3532. border: 3px solid grey;
  3533. }
  3534. </style>
  3535. ` // aka mod menu
  3536. settingsHTML.id = "modmenu"
  3537. document.getElementsByClassName("hud-settings-grid")[0].innerHTML = settingsHTML;
  3538. document.querySelector('#clearchatbtn')
  3539. .addEventListener('click', function () {
  3540. document.querySelector('.hud-chat-messages')
  3541. .innerHTML = ""
  3542. console.clear()
  3543. Game.currentGame.network.sendRpc({
  3544. name: "SendChatMessage",
  3545. channel: "Local",
  3546. message: "✨ Cleared Chat ✨"
  3547. })
  3548. })
  3549. document.querySelector('#sellbombs')
  3550. .addEventListener('click', sellBombTowers)
  3551. document.querySelector('#sellarrows')
  3552. .addEventListener('click', sellArrowTowers)
  3553. document.querySelector('#sellcannons')
  3554. .addEventListener('click', sellCannonTowers)
  3555. document.querySelector('#sellmages')
  3556. .addEventListener('click', sellMageTowers)
  3557. document.querySelector('#sellall')
  3558. .addEventListener('click', sellAll)
  3559. document.querySelector('#selltraps')
  3560. .addEventListener('click', sellSlowTraps)
  3561. document.querySelector('#selldoors')
  3562. .addEventListener('click', sellDoors)
  3563. document.querySelector('#sellmines')
  3564. .addEventListener('click', sellGoldMines)
  3565. document.querySelector('#sellwalls')
  3566. .addEventListener('click', sellWalls)
  3567. document.querySelector('#sellmelees')
  3568. .addEventListener('click', sellMeleeTowers)
  3569. document.querySelector('#sellharvesters')
  3570. .addEventListener('click', sellHarvesters)
  3571. function onLeaveParty() {
  3572. Game.currentGame.network.sendRpc({
  3573. name: "LeaveParty"
  3574. })
  3575. }
  3576. document.querySelector('#use-di')
  3577. .addEventListener('change', function () {
  3578. var THIS_DI_EVENT = this
  3579. game.ui.getComponent('PopupOverlay')
  3580. .showConfirmation('Are you sure you want to change default insults? This will reset all custom insults', 1e4, function () {
  3581. if (THIS_DI_EVENT.checked) {
  3582. insults = ["you smooth brained potato", "you rotten pumpkin brain", "you soggy zuicini", "you watered down banana"
  3583. , "you're orange juice toothpaste flavored"]
  3584. game.ui.getComponent('PopupOverlay')
  3585. .showHint('Successfully activated default insults.', 1e4)
  3586. window.use_di = true
  3587. if (changeChat) {
  3588. doNewSend(['ch', ['⚙️ Activated Use Default Insults ⚙️']])
  3589. }
  3590. } else {
  3591. insults = ["There are no insults, use !addinsult to add one!"]
  3592. game.ui.getComponent('PopupOverlay')
  3593. .showHint('Successfully deactivated default insults.', 1e4)
  3594. window.use_di = false
  3595. if (changeChat) {
  3596. doNewSend(['ch', ['⚙️ Deactivated Use Default Insults ⚙️']])
  3597. }
  3598. }
  3599. }, function () {
  3600. game.ui.getComponent('PopupOverlay')
  3601. .showHint('OK!', 1e4)
  3602. })
  3603. })
  3604. document.querySelector('#menu-leaveparty-btn')
  3605. .addEventListener('click', onLeaveParty)
  3606. document.querySelector('#showpp')
  3607. .addEventListener('change', function () {
  3608. var THIS_PP_EVENT = this;
  3609. if (THIS_PP_EVENT.checked) {
  3610. if (changeChat) {
  3611. doNewSend(['ch', ['⚙️ Activated Show Private Parties ⚙️']])
  3612. }
  3613. } else {
  3614. if (changeChat) {
  3615. doNewSend(['ch', ['⚙️ Deactivated Show Private Parties ⚙️']])
  3616. }
  3617. }
  3618. })
  3619. document.querySelector('#copycat')
  3620. .addEventListener('change', function () {
  3621. var THIS_CC_EVENT = this;
  3622. if (THIS_CC_EVENT.checked) {
  3623. if (changeChat) {
  3624. doNewSend(['ch', ['⚙️ Activated CopyCat ⚙️']])
  3625. }
  3626. } else {
  3627. if (changeChat) {
  3628. doNewSend(['ch', ['⚙️ Deactivated CopyCat ⚙️']])
  3629. }
  3630. }
  3631. })
  3632. document.querySelector('#deadchat')
  3633. .addEventListener('change', function () {
  3634. var THIS_DC_EVENT = this;
  3635. if (THIS_DC_EVENT.checked) {
  3636. if (changeChat) {
  3637. doNewSend(['ch', ['⚙️ Activated Death Chat ⚙️']])
  3638. }
  3639. } else {
  3640. if (changeChat) {
  3641. doNewSend(['ch', ['⚙️ Deactivated Death Chat ⚙️']])
  3642. }
  3643. }
  3644. })
  3645. document.querySelector('#noobchat')
  3646. .addEventListener('change', function () {
  3647. var THIS_NC_EVENT = this;
  3648. if (THIS_NC_EVENT.checked) {
  3649. if (changeChat) {
  3650. doNewSend(['ch', ['⚙️ Activated Noob Chat ⚙️']])
  3651. }
  3652. } else {
  3653. if (changeChat) {
  3654. doNewSend(['ch', ['⚙️ Deactivated Noob Chat ⚙️']])
  3655. }
  3656. }
  3657. })
  3658. // <--- end of menu stuff (defining & appending)
  3659. // also event listeners on the menu forgot to add that at start of script
  3660. var removeDeleted = function (e) { // remove deleted/empty/undefined/null items in an array
  3661. let fp = []
  3662. for (let i = 0; i < e.length; i++) {
  3663. if (e[i] !== undefined) {
  3664. fp.push(e[i])
  3665. }
  3666. }
  3667. return fp;
  3668. }
  3669. function loadedPlayers() { // loaded player names
  3670. var returns = []
  3671. Object.entries(Game.currentGame.world.entities)
  3672. .forEach((stuff => {
  3673. if (stuff[1].targetTick.entityClass == "PlayerEntity" && ((stuff[1].targetTick.uid !== Game.currentGame.world.entities[Game.currentGame
  3674. .world.getMyUid()].targetTick.uid) || window.useSamePI)) {
  3675. returns.push(stuff[1].targetTick.name)
  3676. }
  3677. }))
  3678. return returns;
  3679. }
  3680. window.loadedIDS = function () {
  3681. var returns = []
  3682. Object.entries(Game.currentGame.world.entities)
  3683. .forEach((stuff => {
  3684. if (stuff[1].targetTick.entityClass == "PlayerEntity" && ((stuff[1].targetTick.uid !== Game.currentGame.world.entities[Game.currentGame
  3685. .world.getMyUid()].targetTick.uid) || window.useSamePI)) {
  3686. var h = stuff[1].targetTick
  3687. if (document.querySelector('#advancedlpi')
  3688. .checked) {
  3689. returns.push(JSON.stringify(h))
  3690. } else {
  3691. returns.push(stuff[1].targetTick.name + " - Wood: " + Game.currentGame.world.entities[stuff[1].targetTick.uid].targetTick.wood +
  3692. ", Stone: " + Game.currentGame.world.entities[stuff[1].targetTick.uid].targetTick.stone + ", Gold: " + Game.currentGame
  3693. .world.entities[stuff[1].targetTick.uid].targetTick.gold)
  3694. }
  3695. }
  3696. }))
  3697. return returns;
  3698. }
  3699. function spamchatclick() { // used to be called spam chat, its split chat now
  3700. var user = document.querySelector('#spamchat')
  3701. .value
  3702. splitChatLength(user)
  3703. }
  3704. document.querySelector('#spamchatbtn')
  3705. .addEventListener('click', spamchatclick)
  3706. document.querySelector('#resetinsultsbtn')
  3707. .addEventListener('click', resetInsults)
  3708. function resetInsults() {
  3709. if (window.use_di) {
  3710. insults = ["you smooth brained potato", "you rotten pumpkin brain", "you soggy zuicini", "you watered down banana"
  3711. , "you're orange juice toothpaste flavored"]
  3712. } else {
  3713. insults = ["There are no insults, use !addinsult to add one!"]
  3714. }
  3715. doNewSend(['ch', ["✅ Successfully reset insults ✅"]])
  3716. }
  3717. document.querySelector('#togglecmd')
  3718. .addEventListener('click', toggleCmds)
  3719. var balls = ["Outlook good.", "Really?", "Perhaps.", "Definitely not.", "Yup.", "Are you retarded?", "Naw", "Yup.", "Yup."]
  3720. var breadEaten = 0
  3721. var cmdInterval = setInterval(function () {
  3722. if (game.world.isInWorld) {
  3723. if (window.cmdsEnabled) {
  3724. var playerName = Game.currentGame.world.entities[Game.currentGame.world.getMyUid()].targetTick.name
  3725. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3726. .length - 1].innerText.split(':')[1].slice(1, 4) == "!ch") {
  3727. Game.currentGame.network.sendRpc({
  3728. name: "SendChatMessage",
  3729. channel: "Local",
  3730. message: document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3731. .length - 1].innerText.split(':')[1].slice(4)
  3732. })
  3733. }
  3734. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3735. .length - 1].innerText.split(':')[1].slice(1, 7) == "!bread") {
  3736. breadEaten++;
  3737. Game.currentGame.network.sendRpc({
  3738. name: "SendChatMessage",
  3739. channel: "Local",
  3740. message: "🍞🍞🍞 @" + document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3741. .length - 1].innerText.split(':')[0] + " has eaten bread! " + breadEaten + " people have eaten bread! 🍞🍞🍞"
  3742. })
  3743. }
  3744. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3745. .length - 1].innerText.split(':')[1].slice(1, 13) == "!willigetagf") {
  3746. Game.currentGame.network.sendRpc({
  3747. name: "SendChatMessage",
  3748. channel: "Local",
  3749. message: "💐 The chances of you getting a girlfriend are " + Math.floor(Math.random() * 10) + "%! @" + document
  3750. .querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3751. .length - 1].innerText.split(':')[0] + " 💐"
  3752. })
  3753. }
  3754. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3755. .length - 1].innerText.split(':')[1].slice(1, 9) == "!insults") {
  3756. var insultCounteRz = 1;
  3757. var innsultSInterval = setInterval(() => {
  3758. if (insultCounteRz <= (insults.length)) {
  3759. doNewSend(['ch', ['📖 Insults [' + insultCounteRz + "/" + (insults.length) + "]: " + insults[insultCounteRz - 1] +
  3760. " 📖"]])
  3761. insultCounteRz++;
  3762. } else {
  3763. insultCounteRz = 0;
  3764. clearInterval(innsultSInterval)
  3765. }
  3766. }, 1500)
  3767. }
  3768. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3769. .length - 1].innerText.split(':')[1].slice(1)
  3770. .includes('**')) {
  3771. Game.currentGame.network.sendRpc({
  3772. name: "SendChatMessage",
  3773. channel: "Local",
  3774. message: "❌ Don't fuc‌king swear you bitc‌h @" + document.querySelectorAll('.hud-chat-message')[document.querySelectorAll(
  3775. '.hud-chat-message')
  3776. .length - 1].innerText.split(':')[0] + " ❌"
  3777. })
  3778. }
  3779. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3780. .length - 1].innerText.toLowerCase()
  3781. .split(':')[1].slice(1, 7) == "!8ball") {
  3782. q.forEach((item => {
  3783. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3784. .length - 1].innerText.toLowerCase()
  3785. .split(':')[1].includes(item.word)) {
  3786. window.ball = item.answers[Math.floor(Math.random() * item.answers.length)]
  3787. } else {
  3788. window.ball = balls[Math.floor(Math.random() * balls.length)]
  3789. }
  3790. }))
  3791. Game.currentGame.network.sendRpc({
  3792. name: "SendChatMessage",
  3793. channel: "Local",
  3794. message: "🎱 Magic 8Ball answered with " + window.ball + " 🎱"
  3795. })
  3796. }
  3797. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3798. .length - 1].innerText.toLowerCase()
  3799. .split(':')[1].slice(1, 10) == "!commands") {
  3800. Game.currentGame.network.sendRpc({
  3801. name: "SendChatMessage",
  3802. channel: "Local",
  3803. message: "💻 Commands [1/3]: !8ball,!ch,!bread,!insult,!addinsult 💻"
  3804. })
  3805. setTimeout(function () {
  3806. Game.currentGame.network.sendRpc({
  3807. name: "SendChatMessage",
  3808. channel: "Local",
  3809. message: "💻 Commands [2/3]: !willigetagf, !slots, !boss, !insults 💻"
  3810. })
  3811. }, 1500)
  3812. setTimeout(function () {
  3813. Game.currentGame.network.sendRpc({
  3814. name: "SendChatMessage",
  3815. channel: "Local",
  3816. message: "💻 Commands [3/3]: none 💻"
  3817. })
  3818. }, 3000)
  3819. }
  3820. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3821. .length - 1].innerText.toLowerCase()
  3822. .split(':')[1].slice(1, 6) == "!boss") {
  3823. Game.currentGame.network.sendRpc({
  3824. name: "SendChatMessage",
  3825. channel: "Local",
  3826. message: bw1
  3827. })
  3828. setTimeout(function () {
  3829. Game.currentGame.network.sendRpc({
  3830. name: "SendChatMessage",
  3831. channel: "Local",
  3832. message: bw2
  3833. })
  3834. }, 1500)
  3835. }
  3836. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3837. .length - 1].innerText.toLowerCase()
  3838. .split(':')[1].slice(1, 11) == "!addinsult") {
  3839. if (!insults.includes(document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3840. .length - 1].innerText.toLowerCase()
  3841. .split(':')[1].slice(11))) {
  3842. if (window.use_di) {
  3843. insults.push(document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3844. .length - 1].innerText.toLowerCase()
  3845. .split(':')[1].slice(11))
  3846. } else {
  3847. insults = []
  3848. insults.push(document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3849. .length - 1].innerText.toLowerCase()
  3850. .split(':')[1].slice(11))
  3851. }
  3852. Game.currentGame.network.sendRpc({
  3853. name: "SendChatMessage",
  3854. channel: "Local",
  3855. message: "📝 Added to insults 📝"
  3856. })
  3857. } else {
  3858. Game.currentGame.network.sendRpc({
  3859. name: "SendChatMessage",
  3860. channel: "Local",
  3861. message: "❌ That insult already exists ❌"
  3862. })
  3863. }
  3864. }
  3865. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3866. .length - 1].innerText.toLowerCase()
  3867. .split(':')[1].slice(1, 8) == "!insult" && document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3868. .length - 1].innerText.split(':')[1].slice(1, 9) !== "!insults") {
  3869. Game.currentGame.network.sendRpc({
  3870. name: "SendChatMessage",
  3871. channel: "Local",
  3872. message: "📝 " + insults[Math.floor(Math.random() * insults.length)] + " @" + loadedPlayers()[Math.floor(Math.random() *
  3873. loadedPlayers()
  3874. .length)] + " 📝"
  3875. })
  3876. }
  3877. if (document.querySelector('#hud-respawn')
  3878. .style.display == "block" && document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3879. .length - 1].innerText.split(':')[1] !== (playerName + " thinks that whoever killed them is an idiot!") && document.querySelector(
  3880. '#deadchat')
  3881. .checked) {
  3882. Game.currentGame.network.sendRpc({
  3883. name: "SendChatMessage",
  3884. channel: "Local",
  3885. message: (playerName + " thinks that whoever killed them is an idiot!")
  3886. })
  3887. }
  3888. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3889. .length - 1].innerText.split(':')[1].slice(1, 7) == "!slots") {
  3890. var f = window.generateSlots()
  3891. Game.currentGame.network.sendRpc({
  3892. name: "SendChatMessage",
  3893. channel: "Local",
  3894. message: "🎰 @" + document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3895. .length - 1].innerText.split(':')[0] + " Your slots results are: " + f[0] + " with a score of " + f[1] + "! 🎰"
  3896. })
  3897. }
  3898. function getUserRoles(s) {
  3899. users.forEach((item => {
  3900. if (item.name == s) {
  3901. return item.roles
  3902. } else {
  3903. return []
  3904. }
  3905. }))
  3906. }
  3907. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3908. .length - 1].innerText.split(':')[1].includes('!disconnect ' + window.ajsd) && (users[0].name == document.querySelectorAll(
  3909. '.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3910. .length - 1].innerText.split(':')[0] || users[1].name == document.querySelectorAll('.hud-chat-message')[document
  3911. .querySelectorAll('.hud-chat-message')
  3912. .length - 1].innerText.split(':')[0] || users[2].name == document.querySelectorAll('.hud-chat-message')[document
  3913. .querySelectorAll('.hud-chat-message')
  3914. .length - 1].innerText.split(':')[0] || users[3].name == document.querySelectorAll('.hud-chat-message')[document
  3915. .querySelectorAll('.hud-chat-message')
  3916. .length - 1].innerText.split(':')[0] || document.querySelectorAll('.hud-chat-message')[document.querySelectorAll(
  3917. '.hud-chat-message')
  3918. .length - 1].innerText.split(':')[0].toLowerCase()
  3919. .includes('pot') || users[4].name == document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3920. .length - 1].innerText.toLowerCase()
  3921. .split(':')[0])) {
  3922. document.querySelector('.hud-chat-messages')
  3923. .innerHTML = ""
  3924. console.clear()
  3925. doNewSend(['ch', ['Bye have a great day!']])
  3926. Game.currentGame.network.disconnect()
  3927. }
  3928. if (document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3929. .length - 1].innerText.split(':')[1].includes('!eid') && (users[0].name == document.querySelectorAll('.hud-chat-message')[document
  3930. .querySelectorAll('.hud-chat-message')
  3931. .length - 1].innerText.split(':')[0] || users[1].name == document.querySelectorAll('.hud-chat-message')[document
  3932. .querySelectorAll('.hud-chat-message')
  3933. .length - 1].innerText.split(':')[0] || users[2].name == document.querySelectorAll('.hud-chat-message')[document
  3934. .querySelectorAll('.hud-chat-message')
  3935. .length - 1].innerText.split(':')[0] || users[3].name == document.querySelectorAll('.hud-chat-message')[document
  3936. .querySelectorAll('.hud-chat-message')
  3937. .length - 1].innerText.split(':')[0] || document.querySelectorAll('.hud-chat-message')[document.querySelectorAll(
  3938. '.hud-chat-message')
  3939. .length - 1].innerText.split(':')[0].toLowerCase()
  3940. .includes('pot') || users[4].name == document.querySelectorAll('.hud-chat-message')[document.querySelectorAll('.hud-chat-message')
  3941. .length - 1].innerText.toLowerCase()
  3942. .split(':')[0])) {
  3943. doNewSend(['ch', [window.ajsd]])
  3944. }
  3945. }
  3946. }
  3947. }, 750)
  3948. document.querySelector('#toggleahrc')
  3949. .addEventListener('click', function () {
  3950. window.ahrc = !window.ahrc
  3951. document.querySelector('#toggleahrc')
  3952. .innerText = window.ahrc ? "Disable AHRC" : "Enable AHRC"
  3953. if (changeChat) {
  3954. doNewSend(['ch', [enDisAbleEmj(window.ahrc, 'AHRC')]])
  3955. }
  3956. })
  3957. function autoBow() {
  3958. if (isBowing) {
  3959. isBowing = false
  3960. clearInterval(window.bow)
  3961. } else {
  3962. isBowing = true
  3963. if (Game.currentGame.ui.inventory.Bow) {
  3964. Game.currentGame.network.sendRpc({
  3965. name: "EquipItem",
  3966. itemName: "Bow",
  3967. tier: Game.currentGame.ui.inventory.Bow.tier
  3968. })
  3969. window.bow = setInterval(function () {
  3970. Game.currentGame.inputPacketScheduler.scheduleInput({
  3971. space: 1
  3972. })
  3973. Game.currentGame.inputPacketScheduler.scheduleInput({
  3974. space: 0
  3975. })
  3976. Game.currentGame.inputPacketScheduler.scheduleInput({
  3977. space: 0
  3978. })
  3979. }, 0);
  3980. }
  3981. }
  3982. document.querySelector('#toggleab')
  3983. .innerText = isBowing ? "Disable AutoBow" : "Enable AutoBow"
  3984. doNewSend(['ch', [isBowing ? "🟩 Enabled AutoBow 🟩" : "🟥 Disabled AutoBow 🟥"]])
  3985. }
  3986. document.querySelector('#toggleab')
  3987. .addEventListener('click', autoBow)
  3988. document.querySelector('#upgradeallbtn')
  3989. .addEventListener('click', upgradeAll)
  3990. function onChangePP() {
  3991. game.ui.getComponent('PopupOverlay')
  3992. .showHint('This may take a bit to apply, so be patient')
  3993. }
  3994. document.querySelector('#showpp')
  3995. .addEventListener('change', onChangePP)
  3996. document.querySelector('#idkbtn11')
  3997. .addEventListener('click', btnChatCircle)
  3998. document.querySelector('#idkbtn22')
  3999. .addEventListener('click', btnChatRect)
  4000. document.querySelector('#advancedlpi')
  4001. .addEventListener('change', function (e) {
  4002. var THIS_LPI_EVENT = this;
  4003. if (THIS_LPI_EVENT.checked) {
  4004. doNewSend(['ch', ['⚙️ Activated Advanced Player Info ⚙️']])
  4005. } else {
  4006. doNewSend(['ch', ['⚙️ Deactivated Advanced Player Info ⚙️']])
  4007. }
  4008. })
  4009. document.querySelector('#zos')
  4010. .addEventListener('change', function (e) {
  4011. var THIS_ZOS_EVENT = this;
  4012. window.zoomonscroll = THIS_ZOS_EVENT.checked
  4013. if (THIS_ZOS_EVENT.checked) {
  4014. doNewSend(['ch', ['⚙️ Activated Zoom On Scroll ⚙️']])
  4015. } else {
  4016. doNewSend(['ch', ['⚙️ Deactivated Zoom On Scroll ⚙️']])
  4017. }
  4018. })
  4019. window.sendAitoAlt = () => {
  4020. if (window.startaito) {
  4021. let ws = new WebSocket(`ws://${Game.currentGame.options.servers[Game.currentGame.options.serverId].hostname}:8000`);
  4022. ws.binaryType = "arraybuffer";
  4023. ws.onclose = () => {
  4024. ws.isclosed = true;
  4025. }
  4026. ws.onopen = () => {
  4027. ws.network = new Game.currentGame.networkType();
  4028. ws.network.sendEnterWorldAndDisplayName = (t) => {
  4029. ws.network.sendPacket(4, {
  4030. displayName: t
  4031. });
  4032. };
  4033. ws.network.sendInput = (t) => {
  4034. ws.network.sendPacket(3, t);
  4035. };
  4036. ws.network.sendRpc = (t) => {
  4037. ws.network.sendPacket(9, t);
  4038. };
  4039. ws.network.sendPacket = (e, t) => {
  4040. if (!ws.isclosed) {
  4041. ws.send(ws.network.codec.encode(e, t));
  4042. }
  4043. };
  4044. ws.network.sendEnterWorldAndDisplayName(localStorage.name);
  4045. }
  4046. ws.onEnterWorld = () => {
  4047. // useless
  4048. }
  4049. ws.onmessage = msg => {
  4050. ws.data = ws.network.codec.decode(msg.data);
  4051. if (ws.data.uid) {
  4052. ws.uid = ws.data.uid;
  4053. }
  4054. if (ws.data.name) {
  4055. ws.dataType = ws.data;
  4056. }
  4057. if (!window.startaito && !ws.isclosed) {
  4058. ws.isclosed = true;
  4059. ws.close();
  4060. }
  4061. if (ws.verified) {
  4062. if (!ws.isDay && !ws.isclosed) {
  4063. ws.isclosed = true;
  4064. ws.close();
  4065. window.sendAitoAlt();
  4066. }
  4067. }
  4068. if (ws.data.name == "DayCycle") {
  4069. ws.isDay = ws.data.response.isDay;
  4070. if (ws.isDay) {
  4071. ws.verified = true;
  4072. }
  4073. }
  4074. if (ws.data.name == "Dead") {
  4075. ws.network.sendInput({
  4076. respawn: 1
  4077. });
  4078. }
  4079. if (ws.data.name == "Leaderboard") {
  4080. ws.lb = ws.data;
  4081. if (ws.psk) {
  4082. ws.network.sendRpc({
  4083. name: "JoinPartyByShareKey",
  4084. partyShareKey: game.ui.getPlayerPartyShareKey()
  4085. });
  4086. if (ws.psk.response.partyShareKey == game.ui.getPlayerPartyShareKey()) {
  4087. ws.network.sendRpc({
  4088. name: "BuyItem",
  4089. itemName: "Pause",
  4090. tier: 1
  4091. });
  4092. }
  4093. }
  4094. }
  4095. if (ws.data.name == "PartyShareKey") {
  4096. ws.psk = ws.data;
  4097. }
  4098. switch (ws.data.opcode) {
  4099. case 4:
  4100. ws.onEnterWorld(ws.data);
  4101. break;
  4102. }
  4103. }
  4104. }
  4105. }
  4106. function toggleAito() {
  4107. if (window.startaito) {
  4108. window.startaito = false;
  4109. } else {
  4110. window.startaito = true;
  4111. window.sendAitoAlt()
  4112. }
  4113. doNewSend(['ch', [window.startaito ? "🟩 Enabled Aito 🟩" : "🟥 Disabled Aito 🟥"]])
  4114. document.querySelector('#mainxaito')
  4115. .innerText = window.startaito ? "Disable Aito" : "Enable Aito"
  4116. }
  4117. document.querySelector('#mainxaito')
  4118. .addEventListener('click', toggleAito)
  4119. document.querySelector('#idkbtn33')
  4120. .addEventListener('click', leaveChat)
  4121. Game.currentGame.network.addRpcHandler('ReceiveChatMessage', (e) => {
  4122. if (e.uid !== game.world.getMyUid() && document.querySelector('#copycat')
  4123. .checked) {
  4124. Game.currentGame.network.sendRpc({
  4125. name: "SendChatMessage",
  4126. channel: "Local",
  4127. message: e.message
  4128. })
  4129. }
  4130. if (e.message.toLowerCase()
  4131. .includes('ligma')) {
  4132. doNewSend(['ch', ['LIGMA BALLS BITCH AHAHA @' + e.displayName]])
  4133. }
  4134. })
  4135. document.querySelector('#togglebot')
  4136. .addEventListener('click', function () {
  4137. botMode = !botMode
  4138. this.innerText = botMode ? "Disable Bot Mode" : "Enable Bot Mode"
  4139. if (changeChat) {
  4140. doNewSend(['ch', [enDisAbleEmj(botMode, "Bot Mode")]])
  4141. }
  4142. })
  4143. document.querySelector('#toggleresp')
  4144. .addEventListener('click', function () {
  4145. autoRespawn = !autoRespawn
  4146. this.innerText = autoRespawn ? "Disable Auto Respawn" : "Enable Auto Respawn"
  4147. if (changeChat) {
  4148. doNewSend(['ch', [enDisAbleEmj(autoRespawn, "Auto Respawn")]])
  4149. }
  4150. })/*
  4151. window.lol = setInterval(changeHue, 50)
  4152. window.rainbow = setInterval(() => {
  4153. if (!transparentMenu) {
  4154. settingsRainbow.style.backgroundColor = `hsla(${hue}, 25%, 30%, 0.45)`
  4155. document.querySelector("#hud-menu-settings > div")
  4156. .style.backgroundColor = `rgba(0, 0, 0, 0.25)`
  4157. } else {
  4158. settingsRainbow.style.backgroundColor = `rgba(0, 0, 0, 0)`
  4159. document.querySelector("#hud-menu-settings > div")
  4160. .style.backgroundColor = `rgba(0, 0, 0, 0)`
  4161. }
  4162. }, 10)*/
  4163. document.querySelector('#togglespmch')
  4164. .addEventListener('click', function () {
  4165. pauseChatSpam(document.querySelector('#spmchinput')
  4166. .value)
  4167. if (changeChat) {
  4168. doNewSend(['ch', [enDisAbleEmj(isSpamming, "Chat Spam")]])
  4169. }
  4170. this.innerText = isSpamming ? "Disable Spam Chat" : "Enable Spam Chat"
  4171. })
  4172. document.querySelector('#walldoor')
  4173. .addEventListener('click', doorWall)
  4174. document.querySelector('#apexmode')
  4175. .addEventListener('change', function () {
  4176. changeChat = this.checked
  4177. })
  4178. //instructions