Zombs.io Haxx :D

Remove broken and toxic stuff || Added Spam Party & More

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

  1. // ==UserScript==
  2. // @name Zombs.io Haxx :D
  3. // @namespace https://tampermonkey.net/
  4. // @version 3.2
  5. // @description Remove broken and toxic stuff || Added Spam Party & More
  6. // @author ehScripts, modified by vn_Havy
  7. // @match zombs.io/*
  8. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
  9. // ==/UserScript==
  10.  
  11. document.querySelectorAll('.ad-unit, .ad-unit-medrec, .hud-intro-guide-hints, .hud-intro-left, .hud-intro-youtuber, .hud-intro-footer, .hud-intro-stone, .hud-intro-tree, .hud-intro-social, .hud-intro-more-games, .hud-intro-guide, .hud-day-night-overlay, .hud-respawn-share, .hud-party-joining, .hud-respawn-corner-bottom-left').forEach(el => el.remove());
  12. document.getElementsByClassName('hud-intro-name')[0].setAttribute('maxlength', 29);
  13. document.getElementsByClassName('hud-party-tag')[0].setAttribute('maxlength', 49);
  14. game.renderer.ground.setVisible(false) //set to true for ground
  15. game.renderer.projectiles.setVisible(false) //set to true for projectiles
  16. //Disable ground and projectiles, help improve FPS if you have a 2000s computer, feel free to enable if you want.
  17. let mapTimeouts = [];
  18.  
  19. function createCoordinates() {
  20. let x = document.createElement('div')
  21. x.style = 'position: relative;top: 17px;right: 0px;font-weight: 600;font-family: "Hammersmith One";text-shadow: 1px 0 0 #fff, -1px 0 0 #fff, 0 1px 0 #fff, 0 -1px 0 #fff, 0.5px 0.5px #fff, -0.5px -0.5px 0 #fff, 0.5px -0.5px 0 #fff, -0.5px 0.5px 0 #fff;';
  22. x.innerHTML = `<p id="coords";">X: 0, Y: 0</p>`
  23. x.style.textAlign = "center"
  24. document.querySelector("#hud > div.hud-bottom-left").append(x)
  25. }
  26.  
  27. let mapMouseX;
  28. let mapMouseY;
  29. let hasBeenInWorld = false;
  30. const uAgent = navigator.userAgent;
  31. const isChromeOS = uAgent.includes('CrOS');
  32. const isMac = uAgent.includes('Macintosh');
  33. const isWindows = uAgent.includes('Windows');
  34.  
  35. setInterval(() => {
  36. _isInChatbox = document.querySelector('.hud-chat')
  37. .classList.contains('is-focused')
  38. if (botMode) {
  39. if (parseInt((getEntitiesByModel('Tree')[0][1].targetTick.position.x - game.world.getEntityByUid(game.world.getMyUid())
  40. .targetTick.position.x)
  41. .toString()
  42. .replaceAll('-', '')) < 250) {
  43. game.network.sendRpc({
  44. name: "SendChatMessage",
  45. channel: "Local",
  46. message: "Tree @ Angle (in radians): " + getNearestTreeAngle()
  47. })
  48. danceRandom = false;
  49. } else {
  50. danceRandom = true;
  51. }
  52. if (parseInt((getEntitiesByModel('Stone')[0][1].targetTick.position.x - game.world.getEntityByUid(game.world.getMyUid())
  53. .targetTick.position.x)
  54. .toString()
  55. .replaceAll('-', '')) < 250) {
  56. game.network.sendRpc({
  57. name: "SendChatMessage",
  58. channel: "Local",
  59. message: "Stone @ Angle (in radians): " + getNearestStoneAngle()
  60. })
  61. }
  62. }
  63. }, 2.5)
  64.  
  65. game.network.addEnterWorldHandler(function () {
  66. if(!hasBeenInWorld) {
  67. hasBeenInWorld = true
  68. setInterval(() => {
  69. document.querySelector("#coords")
  70. .innerText = `X: ${game.world.localPlayer.entity.targetTick.position.x}, Y: ${game.world.localPlayer.entity.targetTick.position.y}`
  71. }, 200)
  72. createCoordinates()
  73. }
  74. })
  75.  
  76. var changeChat = true;
  77. var hoverOver;
  78. var mousemove;
  79. addEventListener('mousemove', (e) => {
  80. mousemove = e;
  81. })
  82.  
  83. function roundTenThousands(x) {
  84. if (x > 10000) {
  85. return x.toString()
  86. .slice(0, 3) + "00"
  87. } else {
  88. return x.toString()
  89. }
  90. }
  91.  
  92. function roundMyPosition(e) {
  93. return {
  94. x: roundTenThousands(e.getPositionX()),
  95. y: roundTenThousands(e.getPositionY())
  96. }
  97. }
  98.  
  99. var isSpamming = 0;
  100.  
  101. function pauseChatSpam(e) {
  102. if (!isSpamming) {
  103. window.spammer = setInterval(() => {
  104. game.network.sendRpc({
  105. name: "SendChatMessage",
  106. channel: "Local",
  107. message: e
  108. })
  109. }, 100)
  110. } else if (isSpamming) {
  111. clearInterval(window.spammer)
  112. }
  113. isSpamming = !isSpamming
  114. }
  115. window.rainbowwww = false;
  116.  
  117. function degreesToYaw(deg) {
  118. let ans;
  119. if ((deg - 90) < 90) {
  120. ans = deg - 90
  121. } else if (deg == 90) {
  122. ans = deg + 90
  123. } else if (deg > 90) {
  124. ans = deg + 90
  125. }
  126. if (ans < 0) {
  127. ans = Math.abs(ans)
  128. }
  129. }
  130. var autoRespawn = false
  131. let hue = 10
  132. var settingsRainbow = document.querySelector("#hud-menu-settings")
  133.  
  134. function changeHue() {
  135. if (window.rainbowwww) {
  136. hue -= 20
  137. }
  138. }
  139.  
  140. function getEntitiesByModel(type) {
  141. let entities = []
  142. Object.entries(game.world.entities)
  143. .forEach((item => {
  144. if (item[1].targetTick.model == type) {
  145. entities.push(item)
  146. }
  147. }))
  148. return entities;
  149. }
  150.  
  151. function moveUp() {
  152. game.inputPacketScheduler.scheduleInput({
  153. down: 0,
  154. up: 1
  155. })
  156. }
  157.  
  158. function moveDown() {
  159. game.inputPacketScheduler.scheduleInput({
  160. up: 0,
  161. down: 1
  162. })
  163. }
  164.  
  165. function moveLeft() {
  166. game.inputPacketScheduler.scheduleInput({
  167. right: 0,
  168. left: 1
  169. })
  170. }
  171.  
  172. function moveRight() {
  173. game.inputPacketScheduler.scheduleInput({
  174. left: 0,
  175. right: 1
  176. })
  177. }
  178. var danceCounter = 0
  179. var danceRandom = true
  180. var botMode = false
  181. var danceInterval = setInterval(() => {
  182. if (botMode) {
  183. if (danceCounter < moves.length) {
  184. moves[danceCounter]()
  185. if (danceRandom) {
  186. danceCounter = Math.floor(Math.random() * moves.length)
  187. } else {
  188. danceCounter++
  189. }
  190. } else {
  191. danceCounter = 0;
  192. }
  193. }
  194. }, 500)
  195. var respawnInterval = setInterval(() => {
  196. if (document.querySelector('.hud-respawn')
  197. .style.display == "block" && autoRespawn) {
  198. game.inputPacketScheduler.scheduleInput({
  199. respawn: 1
  200. })
  201. document.querySelector('.hud-respawn')
  202. .style.display = "none"
  203. }
  204. }, 10)
  205. var moves = [moveUp, moveRight, moveDown, moveLeft]
  206.  
  207. function getNearestStoneAngle() {
  208. let stoneEntities = getEntitiesByModel('Stone');
  209. let firstStone = stoneEntities[0][1].targetTick;
  210. let player = game.world.localPlayer.entity.targetTick
  211.  
  212. return Math.atan2(player.position.y - firstStone.position.y / 2,
  213. player.position.x - firstStone.position.x)
  214. }
  215.  
  216. function getNearestTreeAngle() {
  217. return Math.atan2(game.world.entities[game.world.getMyUid()].targetTick.position.y - getEntitiesByModel('Tree')[0][1].targetTick.position.y / 2, game.world
  218. .entities[game.world.getMyUid()].targetTick.position.x - getEntitiesByModel('Tree')[0][1].targetTick.position.x)
  219. }
  220.  
  221. window.startaito = false;
  222. window.useSamePI = false
  223. addEventListener('keyup', function (e) {
  224. if (e.key == "`" && !_isInChatbox) {
  225. game.inputManager.onKeyRelease({
  226. keyCode: 117
  227. })
  228. }
  229. }) // debug info
  230. var bw1 = "Boss Waves [1/2]: 9, 17, 25, 33, 41, 49, 57, 65, 73, 81"
  231. var bw2 = "Boss Waves [2/2]: 89, 97, 105, 121"
  232. window.ajsd = Math.random()
  233. .toString()
  234. .slice(0, 6)
  235. console.log(window.ajsd)
  236.  
  237. let ppInterval = setInterval(() => { // show private parties
  238. if (document.querySelector('#showpp')
  239. .checked) {
  240. document.querySelectorAll('.hud-party-link')
  241. .forEach((elem => {
  242. if (elem.style.display == "none") {
  243. elem.style.display = "block"
  244. elem.childNodes[0].innerText = elem.childNodes[0].innerText + " [Private]"
  245. elem.addEventListener('click', function () {
  246. game.ui.getComponent('PopupOverlay')
  247. .showHint('Cannot join this party as it is private', 1e4)
  248. })
  249. }
  250. }))
  251. }
  252. }, 3000) // show private parties
  253.  
  254. window.lpSave = []
  255.  
  256. window.use_di = true;
  257. window.isInMenu = false;
  258.  
  259. function doorWall() {
  260. var stashPosition = getGoldStash()
  261. PlaceBuilding(stashPosition.x + 0, stashPosition.y + 0, 'GoldStash', 180);
  262. PlaceBuilding(stashPosition.x + -96, stashPosition.y + -96, 'GoldMine', 180);
  263. PlaceBuilding(stashPosition.x + 0, stashPosition.y + -96, 'GoldMine', 180);
  264. PlaceBuilding(stashPosition.x + 96, stashPosition.y + -96, 'GoldMine', 180);
  265. PlaceBuilding(stashPosition.x + 96, stashPosition.y + -192, 'GoldMine', 180);
  266. PlaceBuilding(stashPosition.x + 0, stashPosition.y + -192, 'GoldMine', 180);
  267. PlaceBuilding(stashPosition.x + -96, stashPosition.y + -192, 'GoldMine', 180);
  268. PlaceBuilding(stashPosition.x + -96, stashPosition.y + -288, 'GoldMine', 180);
  269. PlaceBuilding(stashPosition.x + -24, stashPosition.y + -840, 'Door', 180);
  270. PlaceBuilding(stashPosition.x + -72, stashPosition.y + -840, 'Door', 180);
  271. PlaceBuilding(stashPosition.x + -120, stashPosition.y + -840, 'Door', 180);
  272. PlaceBuilding(stashPosition.x + -168, stashPosition.y + -840, 'Door', 180);
  273. PlaceBuilding(stashPosition.x + -216, stashPosition.y + -840, 'Door', 180);
  274. PlaceBuilding(stashPosition.x + -264, stashPosition.y + -840, 'Door', 180);
  275. PlaceBuilding(stashPosition.x + -312, stashPosition.y + -840, 'Door', 180);
  276. PlaceBuilding(stashPosition.x + -360, stashPosition.y + -840, 'Door', 180);
  277. PlaceBuilding(stashPosition.x + -408, stashPosition.y + -840, 'Door', 180);
  278. PlaceBuilding(stashPosition.x + -456, stashPosition.y + -840, 'Door', 180);
  279. PlaceBuilding(stashPosition.x + -504, stashPosition.y + -840, 'Door', 180);
  280. PlaceBuilding(stashPosition.x + -552, stashPosition.y + -840, 'Door', 180);
  281. PlaceBuilding(stashPosition.x + 24, stashPosition.y + -840, 'Door', 180);
  282. PlaceBuilding(stashPosition.x + 72, stashPosition.y + -840, 'Door', 180);
  283. PlaceBuilding(stashPosition.x + 120, stashPosition.y + -840, 'Door', 180);
  284. PlaceBuilding(stashPosition.x + 168, stashPosition.y + -840, 'Door', 180);
  285. PlaceBuilding(stashPosition.x + 216, stashPosition.y + -840, 'Door', 180);
  286. PlaceBuilding(stashPosition.x + 264, stashPosition.y + -840, 'Door', 180);
  287. PlaceBuilding(stashPosition.x + -600, stashPosition.y + -840, 'Door', 180);
  288. PlaceBuilding(stashPosition.x + -648, stashPosition.y + -840, 'Door', 180);
  289. PlaceBuilding(stashPosition.x + -696, stashPosition.y + -840, 'Door', 180);
  290. PlaceBuilding(stashPosition.x + -744, stashPosition.y + -840, 'Door', 180);
  291. PlaceBuilding(stashPosition.x + -792, stashPosition.y + -840, 'Door', 180);
  292. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -840, 'Door', 180);
  293. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -792, 'Door', 180);
  294. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -744, 'Door', 180);
  295. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -696, 'Door', 180);
  296. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -648, 'Door', 180);
  297. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -600, 'Door', 180);
  298. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -552, 'Door', 180);
  299. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -504, 'Door', 180);
  300. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -456, 'Door', 180);
  301. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -408, 'Door', 180);
  302. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -360, 'Door', 180);
  303. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -312, 'Door', 180);
  304. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -264, 'Door', 180);
  305. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -216, 'Door', 180);
  306. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -168, 'Door', 180);
  307. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -120, 'Door', 180);
  308. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -72, 'Door', 180);
  309. PlaceBuilding(stashPosition.x + -840, stashPosition.y + -24, 'Door', 180);
  310. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 24, 'Door', 180);
  311. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 72, 'Door', 180);
  312. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 120, 'Door', 180);
  313. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 168, 'Door', 180);
  314. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 216, 'Door', 180);
  315. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 264, 'Door', 180);
  316. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 312, 'Door', 180);
  317. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 360, 'Door', 180);
  318. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 408, 'Door', 180);
  319. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 456, 'Door', 180);
  320. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 504, 'Door', 180);
  321. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 552, 'Door', 180);
  322. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 600, 'Door', 180);
  323. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 648, 'Door', 180);
  324. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 696, 'Door', 180);
  325. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 744, 'Door', 180);
  326. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 792, 'Door', 180);
  327. PlaceBuilding(stashPosition.x + -840, stashPosition.y + 840, 'Door', 180);
  328. PlaceBuilding(stashPosition.x + -792, stashPosition.y + 840, 'Door', 180);
  329. PlaceBuilding(stashPosition.x + -744, stashPosition.y + 840, 'Door', 180);
  330. PlaceBuilding(stashPosition.x + -696, stashPosition.y + 840, 'Door', 180);
  331. PlaceBuilding(stashPosition.x + -648, stashPosition.y + 840, 'Door', 180);
  332. PlaceBuilding(stashPosition.x + -600, stashPosition.y + 840, 'Door', 180);
  333. PlaceBuilding(stashPosition.x + -552, stashPosition.y + 840, 'Door', 180);
  334. PlaceBuilding(stashPosition.x + -504, stashPosition.y + 840, 'Door', 180);
  335. PlaceBuilding(stashPosition.x + -456, stashPosition.y + 840, 'Door', 180);
  336. PlaceBuilding(stashPosition.x + -408, stashPosition.y + 840, 'Door', 180);
  337. PlaceBuilding(stashPosition.x + -360, stashPosition.y + 840, 'Door', 180);
  338. PlaceBuilding(stashPosition.x + -216, stashPosition.y + 840, 'Door', 180);
  339. PlaceBuilding(stashPosition.x + -168, stashPosition.y + 840, 'Door', 180);
  340. PlaceBuilding(stashPosition.x + -72, stashPosition.y + 840, 'Door', 180);
  341. PlaceBuilding(stashPosition.x + 24, stashPosition.y + 840, 'Door', 180);
  342. PlaceBuilding(stashPosition.x + -312, stashPosition.y + 840, 'Door', 180);
  343. PlaceBuilding(stashPosition.x + -264, stashPosition.y + 840, 'Door', 180);
  344. PlaceBuilding(stashPosition.x + -120, stashPosition.y + 840, 'Door', 180);
  345. PlaceBuilding(stashPosition.x + -24, stashPosition.y + 840, 'Door', 180);
  346. PlaceBuilding(stashPosition.x + 72, stashPosition.y + 840, 'Door', 180);
  347. PlaceBuilding(stashPosition.x + 120, stashPosition.y + 840, 'Door', 180);
  348. PlaceBuilding(stashPosition.x + 168, stashPosition.y + 840, 'Door', 180);
  349. PlaceBuilding(stashPosition.x + 216, stashPosition.y + 840, 'Door', 180);
  350. PlaceBuilding(stashPosition.x + 264, stashPosition.y + 840, 'Door', 180);
  351. PlaceBuilding(stashPosition.x + 312, stashPosition.y + 840, 'Door', 180);
  352. PlaceBuilding(stashPosition.x + 360, stashPosition.y + 840, 'Door', 180);
  353. PlaceBuilding(stashPosition.x + 456, stashPosition.y + 840, 'Door', 180);
  354. PlaceBuilding(stashPosition.x + 408, stashPosition.y + 840, 'Door', 180);
  355. PlaceBuilding(stashPosition.x + 504, stashPosition.y + 840, 'Door', 180);
  356. PlaceBuilding(stashPosition.x + 552, stashPosition.y + 840, 'Door', 180);
  357. PlaceBuilding(stashPosition.x + 600, stashPosition.y + 840, 'Door', 180);
  358. PlaceBuilding(stashPosition.x + 648, stashPosition.y + 840, 'Door', 180);
  359. PlaceBuilding(stashPosition.x + 696, stashPosition.y + 840, 'Door', 180);
  360. PlaceBuilding(stashPosition.x + 744, stashPosition.y + 840, 'Door', 180);
  361. PlaceBuilding(stashPosition.x + 792, stashPosition.y + 840, 'Door', 180);
  362. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 840, 'Door', 180);
  363. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 792, 'Door', 180);
  364. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 744, 'Door', 180);
  365. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 696, 'Door', 180);
  366. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 648, 'Door', 180);
  367. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 600, 'Door', 180);
  368. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 552, 'Door', 180);
  369. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 504, 'Door', 180);
  370. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 456, 'Door', 180);
  371. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 408, 'Door', 180);
  372. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 360, 'Door', 180);
  373. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 312, 'Door', 180);
  374. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 264, 'Door', 180);
  375. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 216, 'Door', 180);
  376. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 168, 'Door', 180);
  377. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 120, 'Door', 180);
  378. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 72, 'Door', 180);
  379. PlaceBuilding(stashPosition.x + 840, stashPosition.y + 24, 'Door', 180);
  380. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -24, 'Door', 180);
  381. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -72, 'Door', 180);
  382. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -168, 'Door', 180);
  383. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -264, 'Door', 180);
  384. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -312, 'Door', 180);
  385. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -360, 'Door', 180);
  386. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -408, 'Door', 180);
  387. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -456, 'Door', 180);
  388. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -504, 'Door', 180);
  389. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -552, 'Door', 180);
  390. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -600, 'Door', 180);
  391. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -648, 'Door', 180);
  392. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -216, 'Door', 180);
  393. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -120, 'Door', 180);
  394. PlaceBuilding(stashPosition.x + 312, stashPosition.y + -840, 'Door', 180);
  395. PlaceBuilding(stashPosition.x + 360, stashPosition.y + -840, 'Door', 180);
  396. PlaceBuilding(stashPosition.x + 408, stashPosition.y + -840, 'Door', 180);
  397. PlaceBuilding(stashPosition.x + 456, stashPosition.y + -840, 'Door', 180);
  398. PlaceBuilding(stashPosition.x + 504, stashPosition.y + -840, 'Door', 180);
  399. PlaceBuilding(stashPosition.x + 552, stashPosition.y + -840, 'Door', 180);
  400. PlaceBuilding(stashPosition.x + 600, stashPosition.y + -840, 'Door', 180);
  401. PlaceBuilding(stashPosition.x + 648, stashPosition.y + -840, 'Door', 180);
  402. PlaceBuilding(stashPosition.x + 696, stashPosition.y + -840, 'Door', 180);
  403. PlaceBuilding(stashPosition.x + 744, stashPosition.y + -840, 'Door', 180);
  404. PlaceBuilding(stashPosition.x + 792, stashPosition.y + -840, 'Door', 180);
  405. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -840, 'Door', 180);
  406. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -792, 'Door', 180);
  407. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -744, 'Door', 180);
  408. PlaceBuilding(stashPosition.x + 840, stashPosition.y + -696, 'Door', 180);
  409. }
  410.  
  411. function upgradeAll() {
  412. var entities = Game.currentGame.world.entities;
  413. for (var uid in entities) {
  414. if (!entities.hasOwnProperty(uid)) continue;
  415. var obj = entities[uid];
  416. Game.currentGame.network.sendRpc({
  417. name: "UpgradeBuilding",
  418. uid: obj.fromTick.uid
  419. })
  420. }
  421. }
  422.  
  423. function movePlayer(e) {
  424. if (!_isInChatbox) {
  425. switch (e.toLowerCase()
  426. .replaceAll(' ', '')) {
  427. case "a":
  428. Game.currentGame.network.sendInput({
  429. left: 1
  430. })
  431. break;
  432. case "d":
  433. Game.currentGame.network.sendInput({
  434. right: 1
  435. })
  436. break;
  437. case "w":
  438. Game.currentGame.network.sendInput({
  439. up: 1
  440. })
  441. break;
  442. case "s":
  443. Game.currentGame.network.sendInput({
  444. down: 1
  445. })
  446. break;
  447. }
  448. }
  449. }
  450.  
  451. function getGoldStash() {
  452. let entities = Game.currentGame.ui.buildings
  453. for (let uid in entities) {
  454. if (!entities.hasOwnProperty(uid)) {
  455. continue
  456. }
  457. let obj = entities[uid]
  458. if (obj.type == "GoldStash") {
  459. return obj
  460. }
  461. }
  462. }
  463.  
  464. function PlaceBuilding(x, y, building, yaw) {
  465. Game.currentGame.network.sendRpc({
  466. name: "MakeBuilding",
  467. x: x,
  468. y: y,
  469. type: building,
  470. yaw: yaw
  471. })
  472. }
  473.  
  474. function jpbsk() {}
  475. function ahrc1() { // 1 ahrc (collect and refuel), used in lpinterval
  476. var entities = Game.currentGame.world.entities
  477. for (let uid in entities) {
  478. if (!entities.hasOwnProperty(uid)) continue;
  479. let obj = entities[uid];
  480. Game.currentGame.network.sendRpc({
  481. name: "CollectHarvester",
  482. uid: obj.fromTick.uid
  483. });
  484. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 1) {
  485. Game.currentGame.network.sendRpc({
  486. name: "AddDepositToHarvester",
  487. uid: obj.fromTick.uid,
  488. deposit: 0.07
  489. });
  490. }
  491. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 2) {
  492. Game.currentGame.network.sendRpc({
  493. name: "AddDepositToHarvester",
  494. uid: obj.fromTick.uid,
  495. deposit: 0.11
  496. });
  497. }
  498. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 3) {
  499. Game.currentGame.network.sendRpc({
  500. name: "AddDepositToHarvester",
  501. uid: obj.fromTick.uid,
  502. deposit: 0.17
  503. });
  504. }
  505. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 4) {
  506. Game.currentGame.network.sendRpc({
  507. name: "AddDepositToHarvester",
  508. uid: obj.fromTick.uid,
  509. deposit: 0.22
  510. });
  511. }
  512. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 5) {
  513. Game.currentGame.network.sendRpc({
  514. name: "AddDepositToHarvester",
  515. uid: obj.fromTick.uid,
  516. deposit: 0.25
  517. });
  518. }
  519. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 6) {
  520. Game.currentGame.network.sendRpc({
  521. name: "AddDepositToHarvester",
  522. uid: obj.fromTick.uid,
  523. deposit: 0.28
  524. });
  525. }
  526. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 7) {
  527. Game.currentGame.network.sendRpc({
  528. name: "AddDepositToHarvester",
  529. uid: obj.fromTick.uid,
  530. deposit: 0.42
  531. });
  532. }
  533. if (obj.fromTick.model == "Harvester" && obj.fromTick.tier == 8) {
  534. Game.currentGame.network.sendRpc({
  535. name: "AddDepositToHarvester",
  536. uid: obj.fromTick.uid,
  537. deposit: 0.65
  538. });
  539. }
  540. }
  541. }
  542. var lpinterval = setInterval(function () { // loaded player info, ahrc, isInMenu, noob = chatbot
  543. document.querySelector('#lpi')
  544. .innerText = "Loaded Player Info: " + JSON.stringify(window.loadedIDS())
  545. if (window.ahrc) {
  546. ahrc1()
  547. }
  548. window.isInMenu = document.querySelector('#hud-menu-settings')
  549. .style.display == "block" ? true : false
  550. }, 250)
  551.  
  552. function sellAll() {
  553. Game.currentGame.ui.getComponent("PopupOverlay").showConfirmation("Are you sure you want to delete all towers?", 1e4, function() {
  554. for(let uid in game.ui.buildings) {
  555. if(game.ui.buildings[uid].type !== "GoldStash") {
  556. Game.currentGame.network.sendRpc({
  557. name: "DeleteBuilding",
  558. uid: game.ui.buildings[uid].uid
  559. });
  560. }
  561. }
  562. game.ui.components.PopupOverlay.showHint("Sold all.");
  563. })
  564. }
  565.  
  566. function sellWalls() {
  567. var entities = Game.currentGame.world.entities;
  568. for (var uid in entities) {
  569. if (!entities.hasOwnProperty(uid)) continue;
  570. var obj = entities[uid];
  571. if (obj.fromTick.model == "Wall") {
  572. Game.currentGame.network.sendRpc({
  573. name: "DeleteBuilding",
  574. uid: obj.fromTick.uid
  575. })
  576. }
  577. }
  578. }
  579.  
  580. function sellBombTowers() {
  581. var entities = Game.currentGame.world.entities;
  582. for (var uid in entities) {
  583. if (!entities.hasOwnProperty(uid)) continue;
  584. var obj = entities[uid];
  585. if (obj.fromTick.model == "BombTower") {
  586. Game.currentGame.network.sendRpc({
  587. name: "DeleteBuilding",
  588. uid: obj.fromTick.uid
  589. });
  590. }
  591. }
  592. }
  593.  
  594. function sellGoldMines() {
  595. var entities = Game.currentGame.world.entities;
  596. for (var uid in entities) {
  597. if (!entities.hasOwnProperty(uid)) continue;
  598. var obj = entities[uid];
  599. if (obj.fromTick.model == "GoldMine") {
  600. Game.currentGame.network.sendRpc({
  601. name: "DeleteBuilding",
  602. uid: obj.fromTick.uid
  603. });
  604. }
  605. }
  606. }
  607.  
  608. function sellArrowTowers() {
  609. var entities = Game.currentGame.world.entities;
  610. for (var uid in entities) {
  611. if (!entities.hasOwnProperty(uid)) continue;
  612. var obj = entities[uid];
  613. if (obj.fromTick.model == "ArrowTower") {
  614. Game.currentGame.network.sendRpc({
  615. name: "DeleteBuilding",
  616. uid: obj.fromTick.uid
  617. });
  618. }
  619. }
  620. }
  621.  
  622. function sellSlowTraps() {
  623. var entities = Game.currentGame.world.entities;
  624. for (var uid in entities) {
  625. if (!entities.hasOwnProperty(uid)) continue;
  626. var obj = entities[uid];
  627. if (obj.fromTick.model == "SlowTrap") {
  628. Game.currentGame.network.sendRpc({
  629. name: "DeleteBuilding",
  630. uid: obj.fromTick.uid
  631. });
  632. }
  633. }
  634. }
  635.  
  636. function sellCannonTowers() {
  637. var entities = Game.currentGame.world.entities;
  638. for (var uid in entities) {
  639. if (!entities.hasOwnProperty(uid)) continue;
  640. var obj = entities[uid];
  641. if (obj.fromTick.model == "CannonTower") {
  642. Game.currentGame.network.sendRpc({
  643. name: "DeleteBuilding",
  644. uid: obj.fromTick.uid
  645. });
  646. }
  647. }
  648. }
  649.  
  650. function sellMageTowers() {
  651. var entities = Game.currentGame.world.entities;
  652. for (var uid in entities) {
  653. if (!entities.hasOwnProperty(uid)) continue;
  654. var obj = entities[uid];
  655. if (obj.fromTick.model == "MagicTower") {
  656. Game.currentGame.network.sendRpc({
  657. name: "DeleteBuilding",
  658. uid: obj.fromTick.uid
  659. });
  660. }
  661. }
  662. }
  663.  
  664. function sellMeleeTowers() {
  665. var entities = Game.currentGame.world.entities;
  666. for (var uid in entities) {
  667. if (!entities.hasOwnProperty(uid)) continue;
  668. var obj = entities[uid];
  669. if (obj.fromTick.model == "MeleeTower") {
  670. Game.currentGame.network.sendRpc({
  671. name: "DeleteBuilding",
  672. uid: obj.fromTick.uid
  673. });
  674. }
  675. }
  676. }
  677.  
  678. function sellHarvesters() {
  679. var entities = Game.currentGame.world.entities;
  680. for (var uid in entities) {
  681. if (!entities.hasOwnProperty(uid)) continue;
  682. var obj = entities[uid];
  683. if (obj.fromTick.model == "Harvester") {
  684. Game.currentGame.network.sendRpc({
  685. name: "DeleteBuilding",
  686. uid: obj.fromTick.uid
  687. });
  688. }
  689. }
  690. }
  691.  
  692. function sellDoors() {
  693. var entities = Game.currentGame.world.entities;
  694. for (var uid in entities) {
  695. if (!entities.hasOwnProperty(uid)) continue;
  696. var obj = entities[uid];
  697. if (obj.fromTick.model == "Door") {
  698. Game.currentGame.network.sendRpc({
  699. name: "DeleteBuilding",
  700. uid: obj.fromTick.uid
  701. });
  702. }
  703. }
  704. }
  705.  
  706. function sellpet() {
  707. for(let uid in game.world.entities) {
  708. if(game.world.entities[uid].fromTick.model == "PetCARL" || game.world.entities[uid].fromTick.model == "PetMiner") {
  709. Game.currentGame.network.sendRpc({
  710. name: "DeleteBuilding",
  711. uid: game.world.entities[uid].fromTick.uid
  712. });
  713. }
  714. }
  715. }
  716. // <--- end of button event listeners
  717.  
  718. var settingsHTML = `
  719. <button class="btn btn-purple ehack-btn" style="border-radius:25%" id="spamchatbtn">Split Chat</button>
  720. <button class="btn btn-purple ehack-btn" style="border-radius:25%" id="togglespmch">Enable Chat Spam</button>
  721. <input type="text" id="spamchat" placeholder="Message" class="btn btn-white ehack-btn" style="border-radius:25%">
  722. <hr>
  723. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="clearchatbtn">Clear Chat</button>
  724. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="upgradeallbtn">Upgrade All</button>
  725. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="mainxaito">Enable Aito</button>
  726. <button class="btn btn-blue ehack-btn" style="border-radius:25%" id="walldoor">Wall of Doors</button>
  727. <hr>
  728. <button class="btn btn-red ehack-btn ehack-btn" style="border-radius:25%" id="toggleahrc">Enable AHRC</button>
  729. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="toggleab">Enable AutoBow</button>
  730. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="toggleresp">Enable Auto Respawn</button>
  731. <hr>
  732. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="togglebot">Enable Bot Mode</button>
  733. <button class="btn btn-red ehack-btn" style="border-radius:25%" id="spamparty-btn">Enable Spam Sparty</button>
  734. <hr>
  735. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellall">Sell All</button>
  736. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellwalls">Sell Walls</button>
  737. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="selldoors">Sell Doors</button>
  738. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="selltraps">Sell Traps</button>
  739. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellpet">Sell Pets</button>
  740. <hr>
  741. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellmines">Sell Gold Mines</button>
  742. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellarrows">Sell Arrows</button>
  743. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellcannons">Sell Cannons</button>
  744. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellmelees">Sell Melees</button>
  745. <hr>
  746. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellbombs">Sell Bombs</button>
  747. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellmages">Sell Mages</button>
  748. <button class="btn btn-green ehack-btn" style="border-radius:25%" id="sellharvesters">Sell Harvesters</button>
  749. <button class="btn btn-white ehack-btn" style="border-radius:25%" onclick="Game.currentGame.network.disconnect()">Disconnect</button>
  750. <hr>
  751. <button class="btn btn-gold ehack-btn" style="border-radius:25%" id="menu-leaveparty-btn">Leave Party</button>
  752. <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</button>
  753. <input type="text" class="btn btn-white ehack-btn" id="menu-jpbsk-input" style="border-radius:25%" placeholder="Party share key">
  754. <hr>
  755. <button id="hchat-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide Chat</button>
  756. <button id="hpop-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide Popup</button>
  757. <button id="hldb-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide Leaderboard</button>
  758. <button id="hmap-btn" class="btn btn-purple ehack-btn" style="border-radius:25%">Hide Map</button>
  759. <hr>
  760. <p style="font-size:10px;">Show private parties?</p><input type="checkbox" id="showpp" checked>
  761. <br>
  762. <p style="font-size:10px;">Advanced Player Info?</p><input type="checkbox" id="advancedlpi">
  763. <br>
  764. <p style="font-size:10px;">Zoom On Scroll?</p><input type="checkbox" id="zos">
  765. <br>
  766. <p style="font-size:10px;">Death Chat?</p><input type="checkbox" id="deadchat">
  767. <br>
  768. <p id="lpi">Loaded Player Info: </p>
  769. <style>
  770. .menu-textbox{
  771. border-radius:25%;
  772. background-color: rgba(171, 183, 183, 0.25);
  773. border: 2px solid black;
  774. color:white;
  775. }
  776. .ehack-btn:hover{
  777. border: 3px solid grey;
  778. }
  779. </style>
  780. ` // aka mod menu
  781. settingsHTML.id = "modmenu"
  782. document.getElementsByClassName("hud-settings-grid")[0].innerHTML = settingsHTML;
  783. document.querySelector('#clearchatbtn')
  784. .addEventListener('click', function () {
  785. document.querySelector('.hud-chat-messages')
  786. .innerHTML = ""
  787. console.clear()
  788. })
  789. document.querySelector('#sellbombs')
  790. .addEventListener('click', sellBombTowers)
  791. document.querySelector('#sellarrows')
  792. .addEventListener('click', sellArrowTowers)
  793. document.querySelector('#sellcannons')
  794. .addEventListener('click', sellCannonTowers)
  795. document.querySelector('#sellmages')
  796. .addEventListener('click', sellMageTowers)
  797. document.querySelector('#sellall')
  798. .addEventListener('click', sellAll)
  799. document.querySelector('#selltraps')
  800. .addEventListener('click', sellSlowTraps)
  801. document.querySelector('#selldoors')
  802. .addEventListener('click', sellDoors)
  803. document.querySelector('#sellmines')
  804. .addEventListener('click', sellGoldMines)
  805. document.querySelector('#sellwalls')
  806. .addEventListener('click', sellWalls)
  807. document.querySelector('#sellmelees')
  808. .addEventListener('click', sellMeleeTowers)
  809. document.querySelector('#sellharvesters')
  810. .addEventListener('click', sellHarvesters)
  811. document.querySelector('#sellpet')
  812. .addEventListener('click', sellpet)
  813. document.querySelector('#hchat-btn')
  814. .addEventListener('click', hideChat)
  815. document.querySelector('#hpop-btn')
  816. .addEventListener('click', hidePopupOverlay)
  817. document.querySelector('#hldb-btn')
  818. .addEventListener('click', hideLeaderboard)
  819. document.querySelector('#hmap-btn')
  820. .addEventListener('click', hideMap)
  821.  
  822. function onLeaveParty() {
  823. Game.currentGame.network.sendRpc({
  824. name: "LeaveParty"
  825. })
  826. }
  827.  
  828. document.querySelector('#menu-leaveparty-btn')
  829. .addEventListener('click', onLeaveParty)
  830. document.querySelector('#showpp')
  831. .addEventListener('change', function () {
  832. var THIS_PP_EVENT = this;
  833. })
  834. document.querySelector('#deadchat')
  835. .addEventListener('change', function () {
  836. var THIS_DC_EVENT = this;
  837. })
  838.  
  839. // <--- end of menu stuff (defining & appending)
  840. // also event listeners on the menu forgot to add that at start of script
  841. var removeDeleted = function (e) { // remove deleted/empty/undefined/null items in an array
  842. let fp = []
  843. for (let i = 0; i < e.length; i++) {
  844. if (e[i] !== undefined) {
  845. fp.push(e[i])
  846. }
  847. }
  848. return fp;
  849. }
  850.  
  851. function hidePopupOverlay() {
  852. if (document.getElementById("hud-popup-overlay").style.display === "none" && document.getElementById("hpop-btn").innerHTML == "Show Popup") {
  853. document.getElementById("hud-popup-overlay").style.display = "block";
  854. document.getElementById("hpop-btn").innerHTML = "Hide Popup";
  855. } else {
  856. document.getElementById("hud-popup-overlay").style.display = "none";
  857. document.getElementById("hpop-btn").innerHTML = "Show Popup";
  858. }
  859. }
  860.  
  861. function hideLeaderboard() {
  862. if (document.getElementById("hud-leaderboard").style.display === "none" && document.getElementById("hldb-btn").innerHTML == "Show Leaderboard") {
  863. document.getElementById("hud-leaderboard").style.display = "block";
  864. document.getElementById("hldb-btn").innerHTML = "Hide Leaderboard";
  865. } else {
  866. document.getElementById("hud-leaderboard").style.display = "none";
  867. document.getElementById("hldb-btn").innerHTML = "Show Leaderboard";
  868. }
  869. }
  870.  
  871.  
  872. function hideMap() {
  873. if (document.getElementsByClassName("hud-bottom-left")[0].style.display === "none" && document.getElementById("hmap-btn").innerHTML == "Show Map") {
  874. document.getElementsByClassName("hud-bottom-left")[0].style.display = "block";
  875. document.getElementById("hmap-btn").innerHTML = "Hide Map";
  876. } else {
  877. document.getElementsByClassName("hud-bottom-left")[0].style.display = "none";
  878. document.getElementById("hmap-btn").innerHTML = "Show Map";
  879. }
  880. }
  881.  
  882. function hideChat() {
  883. if (document.getElementsByClassName("hud-top-left")[0].style.display === "none" && document.getElementById("hchat-btn").innerHTML == "Show Chat"){
  884. document.getElementsByClassName("hud-top-left")[0].style.display = "block";
  885. document.getElementById("hchat-btn").innerHTML = "Hide Chat";
  886. } else {
  887. document.getElementsByClassName("hud-top-left")[0].style.display = "none";
  888. document.getElementById("hchat-btn").innerHTML = "Show Chat";
  889. }
  890. }
  891.  
  892. document.getElementById("spamparty-btn").addEventListener("click", spambutton);
  893. document.getElementById("spamparty-btn").addEventListener("click", spampartys);
  894.  
  895. var partyspam = null;
  896.  
  897. function spampartys() {
  898. clearInterval(partyspam);
  899. if (partyspam !== null) {
  900. partyspam = null;
  901. } else {
  902. partyspam = setInterval(function() {
  903. var party = document.getElementsByClassName('hud-party-link');
  904. for (var i = 0; i < party.length; i++) {
  905. var link = party[i];
  906. link.click();
  907. }
  908. confirm = document.getElementsByClassName('btn btn-green hud-confirmation-accept');
  909. for (var i2 = 0; i2 < confirm.length; i2++) {
  910. var accept = confirm[i2];
  911. accept.click();
  912. }
  913. }, 0); // SPEED FOR PARTY SPAM
  914. }
  915. }
  916.  
  917. function spambutton() {
  918. if (document.getElementById("spamparty-btn").innerHTML == "Disable Spam Party") {
  919. document.getElementById("spamparty-btn").innerHTML = "Enable Spam Party";
  920. } else {
  921. document.getElementById("spamparty-btn").innerHTML = "Disable Spam Party";
  922. }
  923. }
  924.  
  925. function loadedPlayers() { // loaded player names
  926. var returns = []
  927. Object.entries(Game.currentGame.world.entities)
  928. .forEach((stuff => {
  929. if (stuff[1].targetTick.entityClass == "PlayerEntity" && ((stuff[1].targetTick.uid !== Game.currentGame.world.entities[Game.currentGame.world.getMyUid()].targetTick.uid) || window.useSamePI)) {
  930. returns.push(stuff[1].targetTick.name)
  931. }
  932. }))
  933. return returns;
  934. }
  935. window.loadedIDS = function () {
  936. var returns = []
  937. Object.entries(Game.currentGame.world.entities)
  938. .forEach((stuff => {
  939. if (stuff[1].targetTick.entityClass == "PlayerEntity" && ((stuff[1].targetTick.uid !== Game.currentGame.world.entities[Game.currentGame.world.getMyUid()].targetTick.uid) || window.useSamePI)) {
  940. var h = stuff[1].targetTick
  941. if (document.querySelector('#advancedlpi')
  942. .checked) {
  943. returns.push(JSON.stringify(h))
  944. } else {
  945. returns.push(stuff[1].targetTick.name + " - Wood: " + Game.currentGame.world.entities[stuff[1].targetTick.uid].targetTick.wood +
  946. ", Stone: " + Game.currentGame.world.entities[stuff[1].targetTick.uid].targetTick.stone + ", Gold: " + Game.currentGame
  947. .world.entities[stuff[1].targetTick.uid].targetTick.gold)
  948. }
  949. }
  950. }))
  951. return returns;
  952. }
  953.  
  954. function spamchatclick() { // used to be called spam chat, its split chat now
  955. var user = document.querySelector('#spamchat')
  956. .value
  957. splitChatLength(user)
  958. }
  959. document.querySelector('#spamchatbtn')
  960. .addEventListener('click', spamchatclick)
  961.  
  962. let dimension = 1;
  963. const onWindowResize = () => {
  964. if (!window.isInMenu && window.zoomonscroll) {
  965. const renderer = Game.currentGame.renderer;
  966. let canvasWidth = window.innerWidth * window.devicePixelRatio;
  967. let canvasHeight = window.innerHeight * window.devicePixelRatio;
  968. let ratio = canvasHeight / (1080 * dimension);
  969. renderer.scale = ratio;
  970. renderer.entities.setScale(ratio);
  971. renderer.ui.setScale(ratio);
  972. renderer.renderer.resize(canvasWidth, canvasHeight);
  973. renderer.viewport.width = renderer.renderer.width / renderer.scale + 2 * renderer.viewportPadding;
  974. renderer.viewport.height = renderer.renderer.height / renderer.scale + 2 * renderer.viewportPadding;
  975. }
  976. } // Zoom by Apex, modified by eh
  977. onWindowResize();
  978. var transparentMenu = false;
  979. window.onresize = onWindowResize;
  980. window.onwheel = e => {
  981. if (e.deltaY > 0) {
  982. dimension += 0.09;
  983. onWindowResize();
  984. } else if (e.deltaY < 0) {
  985. dimension -= 0.09;
  986. onWindowResize();
  987. }
  988. }
  989. var _isInChatbox = false;
  990. window.isChatting = 0
  991.  
  992. function doNewSend(sender) {
  993. if (sender[0] == "ch") {
  994. Game.currentGame.network.sendRpc({
  995. name: "SendChatMessage",
  996. channel: "Local",
  997. message: sender[1][0]
  998. })
  999. }
  1000. }
  1001.  
  1002. function splitChatLength(text) {
  1003. let i = 0;
  1004. window.chatSetInterval = setInterval(function () {
  1005. if (i < text.length) {
  1006. doNewSend(['ch', [text.slice(i, i + 45)]])
  1007. i += 45;
  1008. } else {
  1009. clearInterval(window.chatSetInterval)
  1010. }
  1011. }, 1500)
  1012. }
  1013. addEventListener('keydown', function (e) {
  1014. if (!_isInChatbox && e.key == "/") {
  1015. document.querySelector("#hud-menu-settings")
  1016. .style.display = document.querySelector("#hud-menu-settings")
  1017. .style.display == "none" ? "block" : "none"
  1018. document.querySelector("#hud-menu-shop")
  1019. .style.display = "none"
  1020. document.querySelector("#hud-menu-party")
  1021. .style.display = "none"
  1022. }
  1023. if (!_isInChatbox && e.key == "-") {
  1024. Game.currentGame.network.sendRpc({
  1025. name: "BuyItem",
  1026. itemName: "Crossbow",
  1027. tier: 1
  1028. });
  1029. Game.currentGame.network.sendRpc({
  1030. name: "EquipItem",
  1031. itemName: "Crossbow",
  1032. tier: 1
  1033. });
  1034. } else if (e.key == "=" && !_isInChatbox) {
  1035. game.ui.getComponent("PopupOverlay").showHint(
  1036. 'Press [/] for menu, press [=] for help and press [u] for transparent menu. Left click somewhere on the minimap to automatically move there.',
  1037. 1.5e4
  1038. )
  1039. }
  1040. })
  1041. document.querySelector('#toggleahrc')
  1042. .addEventListener('click', function () {
  1043. window.ahrc = !window.ahrc
  1044. document.querySelector('#toggleahrc')
  1045. .innerText = window.ahrc ? "Disable AHRC" : "Enable AHRC"
  1046. })
  1047. document.querySelector('#menu-jpbsk-btn')
  1048. .addEventListener('click', function () {
  1049. window.ahrc = !window.ahrc
  1050. document.querySelector('#toggleahrc')
  1051. .innerText = window.ahrc ? "Disable AHRC" : "Enable AHRC"
  1052. })
  1053. var isBowing = false;
  1054. function autoBow() {
  1055. if (isBowing) {
  1056. isBowing = false
  1057. clearInterval(window.bow)
  1058. } else {
  1059. isBowing = true
  1060. if (Game.currentGame.ui.inventory.Bow) {
  1061. Game.currentGame.network.sendRpc({
  1062. name: "EquipItem",
  1063. itemName: "Bow",
  1064. tier: Game.currentGame.ui.inventory.Bow.tier
  1065. })
  1066. window.bow = setInterval(function () {
  1067. Game.currentGame.inputPacketScheduler.scheduleInput({
  1068. space: 1
  1069. })
  1070. Game.currentGame.inputPacketScheduler.scheduleInput({
  1071. space: 0
  1072. })
  1073. Game.currentGame.inputPacketScheduler.scheduleInput({
  1074. space: 0
  1075. })
  1076. }, 0);
  1077. }
  1078. }
  1079. document.querySelector('#toggleab')
  1080. .innerText = isBowing ? "Disable AutoBow" : "Enable AutoBow"
  1081. }
  1082. document.querySelector('#toggleab')
  1083. .addEventListener('click', autoBow)
  1084. document.querySelector('#upgradeallbtn')
  1085. .addEventListener('click', upgradeAll)
  1086.  
  1087. function onChangePP() {
  1088. game.ui.getComponent('PopupOverlay')
  1089. .showHint('This may take a bit to apply, so be patient')
  1090. }
  1091. document.querySelector('#showpp')
  1092. .addEventListener('change', onChangePP)
  1093. document.querySelector('#advancedlpi')
  1094. .addEventListener('change', function (e) {
  1095. var THIS_LPI_EVENT = this;
  1096. })
  1097. document.querySelector('#zos')
  1098. .addEventListener('change', function (e) {
  1099. var THIS_ZOS_EVENT = this;
  1100. window.zoomonscroll = THIS_ZOS_EVENT.checked
  1101. })
  1102. // AITO from Main X (credit to pot for giving me this)
  1103. window.sendAitoAlt = () => {
  1104. if (window.startaito) {
  1105. let ws = new WebSocket(`ws://${Game.currentGame.options.servers[Game.currentGame.options.serverId].hostname}:8000`);
  1106. ws.binaryType = "arraybuffer";
  1107. ws.onclose = () => {
  1108. ws.isclosed = true;
  1109. }
  1110. ws.onopen = () => {
  1111. ws.network = new Game.currentGame.networkType();
  1112. ws.network.sendEnterWorldAndDisplayName = (t) => {
  1113. ws.network.sendPacket(4, {
  1114. displayName: t
  1115. });
  1116. };
  1117. ws.network.sendInput = (t) => {
  1118. ws.network.sendPacket(3, t);
  1119. };
  1120. ws.network.sendRpc = (t) => {
  1121. ws.network.sendPacket(9, t);
  1122. };
  1123. ws.network.sendPacket = (e, t) => {
  1124. if (!ws.isclosed) {
  1125. ws.send(ws.network.codec.encode(e, t));
  1126. }
  1127. };
  1128. ws.network.sendEnterWorldAndDisplayName(localStorage.name);
  1129. }
  1130. ws.onEnterWorld = () => {
  1131. // useless
  1132. }
  1133. ws.onmessage = msg => {
  1134. ws.data = ws.network.codec.decode(msg.data);
  1135. if (ws.data.uid) {
  1136. ws.uid = ws.data.uid;
  1137. }
  1138. if (ws.data.name) {
  1139. ws.dataType = ws.data;
  1140. }
  1141. if (!window.startaito && !ws.isclosed) {
  1142. ws.isclosed = true;
  1143. ws.close();
  1144. }
  1145. if (ws.verified) {
  1146. if (!ws.isDay && !ws.isclosed) {
  1147. ws.isclosed = true;
  1148. ws.close();
  1149. window.sendAitoAlt();
  1150. }
  1151. }
  1152. if (ws.data.name == "DayCycle") {
  1153. ws.isDay = ws.data.response.isDay;
  1154. if (ws.isDay) {
  1155. ws.verified = true;
  1156. }
  1157. }
  1158. if (ws.data.name == "Dead") {
  1159. ws.network.sendInput({
  1160. respawn: 1
  1161. });
  1162. }
  1163. if (ws.data.name == "Leaderboard") {
  1164. ws.lb = ws.data;
  1165. if (ws.psk) {
  1166. ws.network.sendRpc({
  1167. name: "JoinPartyByShareKey",
  1168. partyShareKey: game.ui.getPlayerPartyShareKey()
  1169. });
  1170. if (ws.psk.response.partyShareKey == game.ui.getPlayerPartyShareKey()) {
  1171. ws.network.sendRpc({
  1172. name: "BuyItem",
  1173. itemName: "Pause",
  1174. tier: 1
  1175. });
  1176. }
  1177. }
  1178. }
  1179. if (ws.data.name == "PartyShareKey") {
  1180. ws.psk = ws.data;
  1181. }
  1182. switch (ws.data.opcode) {
  1183. case 4:
  1184. ws.onEnterWorld(ws.data);
  1185. break;
  1186. }
  1187. }
  1188. }
  1189. }
  1190.  
  1191. function toggleAito() {
  1192. if (window.startaito) {
  1193. window.startaito = false;
  1194. } else {
  1195. window.startaito = true;
  1196. window.sendAitoAlt()
  1197. }
  1198. document.querySelector('#mainxaito')
  1199. .innerText = window.startaito ? "Disable Aito" : "Enable Aito"
  1200. }
  1201. document.querySelector('#mainxaito')
  1202. .addEventListener('click', toggleAito)
  1203.  
  1204. document.querySelector('#togglebot')
  1205. .addEventListener('click', function () {
  1206. botMode = !botMode
  1207. this.innerText = botMode ? "Disable Bot Mode" : "Enable Bot Mode"
  1208. })
  1209. document.querySelector('#toggleresp')
  1210. .addEventListener('click', function () {
  1211. autoRespawn = !autoRespawn
  1212. this.innerText = autoRespawn ? "Disable Auto Respawn" : "Enable Auto Respawn"
  1213. })
  1214. document.querySelector('#togglespmch')
  1215. .addEventListener('click', function () {
  1216. pauseChatSpam(document.querySelector('#spamchat').value)
  1217. this.innerText = isSpamming ? "Disable Spam Chat" : "Enable Spam Chat"
  1218. })
  1219. document.querySelector('#walldoor')
  1220. .addEventListener('click', doorWall)
  1221.  
  1222. // ==UserScript==
  1223. // @name ZoGUI
  1224. // @namespace http://tampermonkey.net/
  1225. // @version 0.1
  1226. // @description Makes the ZOMBS.io ui look better!
  1227. // @author ehScripts
  1228. // @match zombs.io
  1229. // @grant none
  1230. // ==/UserScript==
  1231. // addEventListener('load', function(e){
  1232.  
  1233. function moveNext(targetX, targetY) {
  1234. let player = game.world.localPlayer.entity.targetTick.position
  1235. if (player.x <= targetX && player.y <= targetY) {
  1236. game.network.sendInput({
  1237. right: 1,
  1238. left: 0,
  1239. up: 0,
  1240. down: 1
  1241. })
  1242. } else if (player.x >= targetX && player.y <= targetY) {
  1243. game.network.sendInput({
  1244. right: 0,
  1245. left: 1,
  1246. up: 0,
  1247. down: 1
  1248. })
  1249. } else if (player.x <= targetX && player.y >= targetY) {
  1250. game.network.sendInput({
  1251. right: 1,
  1252. left: 0,
  1253. up: 1,
  1254. down: 0
  1255. })
  1256. } else if (player.x >= targetX && player.y >= targetY) {
  1257. game.network.sendInput({
  1258. right: 0,
  1259. left: 1,
  1260. up: 1,
  1261. down: 0
  1262. })
  1263. }
  1264. }
  1265.  
  1266. function isXYCloseTo(x, y) {
  1267. let playerTargetTick = game.world.localPlayer.entity.targetTick.position;
  1268. const radius = 50;
  1269. return ((x <= (playerTargetTick.x + radius) && x >= (playerTargetTick.x - radius)) && (y <= (playerTargetTick.y + radius) && y >= (playerTargetTick.y - radius)));
  1270. }
  1271.  
  1272. let moveIsActive = false;
  1273.  
  1274. function goToPos(x, y) {
  1275. moveIsActive = true;
  1276. window.goToPosInterval = setInterval(() => {
  1277. moveNext(x, y)
  1278. }, 250)
  1279. window.checkPosInterval = setInterval(() => {
  1280. if (moveIsActive) {
  1281. if (isXYCloseTo(x, y)) {
  1282. game.network.sendInput({
  1283. left: 0,
  1284. right: 0,
  1285. up: 0,
  1286. down: 0
  1287. })
  1288. game.ui.getComponent('PopupOverlay')
  1289. .showHint('Finished moving!', 1e4)
  1290. moveIsActive = false;
  1291. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1292. clearInterval(window.goToPosInterval)
  1293. clearInterval(window.checkPosInterval)
  1294. }
  1295. } else {
  1296. game.network.sendInput({
  1297. left: 0,
  1298. right: 0,
  1299. up: 0,
  1300. down: 0
  1301. })
  1302. doNewSend(['ch', ['MapMover: Unexpectedly shut down']])
  1303. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1304. game.ui.getComponent('PopupOverlay')
  1305. .showHint('MapMover unexpectedly stopped', 1e4)
  1306. clearInterval(window.checkPosInterval)
  1307. }
  1308. }, 10)
  1309. let g = setTimeout(() => {
  1310. clearInterval(window.goToPosInterval)
  1311. game.ui.getComponent('PopupOverlay')
  1312. .showHint('It has been 4 minutes to move to the position on the map, so it has automatically stopped to prevent infinite loops.', 1e4)
  1313. moveIsActive = false;
  1314. game.network.sendInput({
  1315. left: 0,
  1316. right: 0,
  1317. up: 0,
  1318. down: 0
  1319. })
  1320. }, 240000)
  1321. mapTimeouts.push(g)
  1322. }
  1323. let mapContainer = document.createElement('div')
  1324.  
  1325. mapContainer.id = "hud-map-container"
  1326. document.querySelector('.hud-bottom-left')
  1327. .append(mapContainer)
  1328. $('#hud-map')
  1329. .appendTo(document.querySelector('#hud-map-container'))
  1330. document.querySelector("#hud-map-container")
  1331. .addEventListener('mousemove', function (e) {
  1332. var offset = $('#hud-map-container')
  1333. .offset();
  1334. // Then refer to
  1335. mapMouseX = e.pageX - offset.left;
  1336. mapMouseY = e.pageY - offset.top;
  1337. })
  1338.  
  1339. document.querySelector("#hud-map-container")
  1340. .addEventListener('click', function (e) {
  1341. if (!moveIsActive) {
  1342. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1343. let yn = "y"
  1344. game.ui.getComponent('PopupOverlay').showConfirmation('Are you sure you want to move to X:' + (mapMouseX * 170.4390625) + ",Y:" + (mapMouseY * 171.9977142857143) + '? You can right click the minimap to cancel this at any time.', 5e3, function() {
  1345. if (yn.toLowerCase() == "y") {
  1346. game.ui.getComponent('PopupOverlay').showHint('Starting MapMove...', 3e3)
  1347. let moveToMapX = (mapMouseX * 170.4390625)
  1348. let moveToMapY = (mapMouseY * 171.9977142857143)
  1349. goToPos(moveToMapX, moveToMapY)
  1350. }
  1351. }, function() {
  1352. game.ui.getComponent('PopupOverlay').showHint('OK, did not start MapMove', 3e3)
  1353. })
  1354. } else {
  1355. moveIsActive = false;
  1356. clearInterval(window.goToPosInterval)
  1357. clearInterval(window.checkPosInterval)
  1358. game.network.sendInput({
  1359. left: 0,
  1360. right: 0,
  1361. up: 0,
  1362. down: 0
  1363. })
  1364. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1365. game.ui.getComponent('PopupOverlay').showHint('MapMove is already in process. Restarting and moving to X:' + (mapMouseX * 170.4390625) + ",Y:" + (mapMouseY * 171.9977142857143) + '. You can right click the minimap to cancel this at any time.', 5e3)
  1366. let yn = "y"
  1367. if (yn.toLowerCase() == "y") {
  1368. let moveToMapX = (mapMouseX * 170.4390625)
  1369. let moveToMapY = (mapMouseY * 171.9977142857143)
  1370. goToPos(moveToMapX, moveToMapY)
  1371. }
  1372. }
  1373. })
  1374.  
  1375. document.querySelector('#hud-map-container').addEventListener('contextmenu', function(ev) {
  1376. ev.preventDefault();
  1377. if(moveIsActive) {
  1378. game.ui.getComponent('PopupOverlay').showConfirmation('Are you sure you want to cancel the current MapMove process?', 5e3, function() {
  1379. moveIsActive = false;
  1380. clearInterval(window.goToPosInterval)
  1381. clearInterval(window.checkPosInterval)
  1382. game.network.sendInput({
  1383. left: 0,
  1384. right: 0,
  1385. up: 0,
  1386. down: 0
  1387. })
  1388. game.ui.getComponent('PopupOverlay').showHint('Successfully stopped MapMover.', 3e3)
  1389. mapTimeouts.forEach((item => { clearTimeout(item) }))
  1390. }, function() {
  1391. game.ui.getComponent('PopupOverlay').showHint('OK, did not stop MapMover.', 3e3)
  1392. })
  1393. } else {
  1394. game.ui.getComponent('PopupOverlay').showHint('You are not in a MapMover process right now. Left click somewhere on the minimap to start one.')
  1395. }
  1396. return false;
  1397. }, false);