Clap mod

Public mod for MooMoo.io

目前為 2025-03-17 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Clap mod
  3. // @namespace Good Guy
  4. // @version v1
  5. // @description Public mod for MooMoo.io
  6. // @match http*://*.moomoo.io/*
  7. // @icon https://www.google.com/s2/favicons?sz=64&domain=moomoo.io
  8. // @require https://update.gf.qytechs.cn/scripts/423602/1005014/msgpack.js
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12. /** VARIABLES **/
  13. let spike = 0;
  14. let weapongrind = false;
  15. let { msgpack, config, jQuery: $ } = window;
  16. let leaderboard = document.getElementById('leaderboard')
  17. let gameCanvas = document.getElementById("gameCanvas");
  18. let mainContext = gameCanvas.getContext("2d");
  19. let storeMenu = document.getElementById("storeMenu");
  20. let allianceMenu = document.getElementById("allianceMenu");
  21. let chatHolder = document.getElementById("chatHolder");
  22. let altchaCheckbox = document.getElementById('altcha_checkbox');
  23. let altcha = document.getElementById('altcha');
  24. let menuOpened = false;
  25. let mouseX, mouseY, width = innerWidth, height = innerHeight;
  26. let moveKeys = { w: false, a: false, s: false, d: false };
  27. let myPlayer = {
  28. id: null, x: null, y: null, dir: null, object: null, weapon: null, clan: null,
  29. isLeader: null, maxXP: 300, XP: 0, age: 1, hat: null, accessory: null, isSkull: null, maxHealth: 100
  30. };
  31. let locked = false, gameTick = 0, enemy = [], ws = null;
  32. let tPing = 90;
  33. let players = [], nearestEnemy = {}, enemyAngle, isEnemyNear;
  34. let primary, secondary, foodType, wallType, spikeType, millType, mineType, boostType, spawnpadType, turretType, haveMine;
  35. let SaVeGe = {
  36. tick: 0,
  37. tickQueue: [],
  38. manage: [],
  39. tickRate: 1000 / 9,
  40. tickSpeed: 0,
  41. lastTick: performance.now(),
  42. tickBase(set, tick) {
  43. const targetTick = this.tick + tick;
  44. this.tickQueue[targetTick] = this.tickQueue[targetTick] ?? [];
  45. this.tickQueue[targetTick].push(set);
  46. }
  47. };
  48.  
  49. /** SOCKET **/
  50. WebSocket.prototype.oldSend = WebSocket.prototype.send;
  51. WebSocket.prototype.send = function (m) {
  52. if (!ws) {
  53. document.websocket = this;
  54. ws = this;
  55. socketFound(this);
  56. }
  57. this.oldSend(m);
  58. };
  59.  
  60. /** FPS BOOSTER **/
  61. let { maxScreenWidth, maxScreenHeight } = config;
  62. let FPSBooster;
  63. let { moveTo, lineTo } = CanvasRenderingContext2D.prototype;
  64.  
  65. CanvasRenderingContext2D.prototype.moveTo = function(x, y) {
  66. if (!FPSBooster || this.globalAlpha !== 0.06) {
  67. return moveTo.call(this, x, y);
  68. }
  69. };
  70. CanvasRenderingContext2D.prototype.lineTo = function(x, y) {
  71. if (!FPSBooster || this.globalAlpha !== 0.06) {
  72. return lineTo.call(this, x, y);
  73. }
  74. };
  75.  
  76. class Checker {
  77. check(callback) {
  78. return (event) => {
  79. if (event instanceof Event && (event.isTrusted ?? true)) {
  80. callback(event);
  81. }
  82. };
  83. }
  84. }
  85.  
  86. let checker = new Checker();
  87. let updateScreen = () => {
  88. let currentWidth = window.innerWidth;
  89. let currentHeight = window.innerHeight;
  90.  
  91. if (FPSBooster) {
  92. let pixelDensity = 0.35;
  93. let scale = Math.max(currentWidth / maxScreenWidth, currentHeight / maxScreenHeight) * pixelDensity;
  94.  
  95. gameCanvas.width = currentWidth * pixelDensity;
  96. gameCanvas.height = currentHeight * pixelDensity;
  97.  
  98. gameCanvas.style.width = `${currentWidth}px`;
  99. gameCanvas.style.height = `${currentHeight}px`;
  100.  
  101. mainContext.setTransform(scale, 0, 0, scale, (currentWidth * pixelDensity - maxScreenWidth * scale) / 2, (currentHeight * pixelDensity - maxScreenHeight * scale) / 2);
  102. } else {
  103. let pixelDensity = 0.8;
  104. let scale = Math.max(currentWidth / maxScreenWidth, currentHeight / maxScreenHeight) * pixelDensity;
  105.  
  106. gameCanvas.width = currentWidth * pixelDensity;
  107. gameCanvas.height = currentHeight * pixelDensity;
  108.  
  109. gameCanvas.style.width = `${currentWidth}px`;
  110. gameCanvas.style.height = `${currentHeight}px`;
  111.  
  112. mainContext.setTransform(scale, 0, 0, scale, (currentWidth * pixelDensity - maxScreenWidth * scale) / 2, (currentHeight * pixelDensity - maxScreenHeight * scale) / 2);
  113. }
  114. };
  115. window.addEventListener("resize", checker.check(updateScreen));
  116. /** LOCKERS **/
  117. let lockers = {
  118. attacker: false,
  119. breaker: false,
  120. storeOpened: false,
  121. }
  122.  
  123. /** WS SEND PACKET **/
  124. let sendPacket = (packet, ...data) => {
  125. ws.send(new Uint8Array(msgpack.encode([packet, data])));
  126. };
  127.  
  128. /** FOR STORE FUNCTIONS **/
  129. let goldCount = () => {
  130. let scoreCount = document.getElementById("scoreDisplay");
  131. return scoreCount ? parseInt(scoreCount.innerText) : 0;
  132. };
  133.  
  134. let hatPrice = (hatId) => {
  135. let hatPrice = {
  136. 45: 0,
  137. 51: 0,
  138. 50: 0,
  139. 28: 0,
  140. 29: 0,
  141. 30: 0,
  142. 36: 0,
  143. 37: 0,
  144. 38: 0,
  145. 44: 0,
  146. 35: 0,
  147. 42: 0,
  148. 43: 0,
  149. 49: 0,
  150. 57: 50,
  151. 8: 100,
  152. 2: 500,
  153. 15: 600,
  154. 5: 1000,
  155. 4: 2000,
  156. 18: 2000,
  157. 31: 2500,
  158. 1: 3000,
  159. 10: 3000,
  160. 48: 3000,
  161. 6: 4000,
  162. 23: 4000,
  163. 13: 5000,
  164. 9: 5000,
  165. 32: 5000,
  166. 7: 6000,
  167. 22: 6000,
  168. 12: 6000,
  169. 26: 8000,
  170. 21: 10000,
  171. 46: 10000,
  172. 14: 10000,
  173. 11: 10000,
  174. 53: 10000,
  175. 20: 12000,
  176. 58: 12000,
  177. 27: 15000,
  178. 40: 15000,
  179. 52: 15000,
  180. 55: 20000,
  181. 56: 20000
  182. };
  183. return hatPrice[hatId] || 0;
  184. };
  185.  
  186. let accPrice = (accessoryId) => {
  187. let accPrice = {
  188. 12: 1000,
  189. 9: 1000,
  190. 10: 1000,
  191. 3: 1500,
  192. 8: 2000,
  193. 11: 2000,
  194. 17: 3000,
  195. 6: 3000,
  196. 4: 4000,
  197. 5: 5000,
  198. 2: 6000,
  199. 1: 8000,
  200. 7: 8000,
  201. 14: 10000,
  202. 15: 10000,
  203. 20: 10000,
  204. 16: 12000,
  205. 13: 15000,
  206. 19: 15000,
  207. 18: 20000,
  208. 21: 20000
  209. };
  210. return accPrice[accessoryId] || 0;
  211. };
  212. let purchased = [];
  213. let isPurchased = (id) => {
  214. return purchased.includes(id);
  215. };
  216.  
  217. /** STORE **/
  218. let storeBuy = (id, index) => {
  219. if (isPurchased(id)) {
  220. return;
  221. }
  222. let gold = goldCount();
  223. let cost = 0;
  224. if (index === 0) {
  225. cost = hatPrice(id);
  226. } else if (index === 1) {
  227. cost = accPrice(id);
  228. }
  229. if (gold >= cost) {
  230. sendPacket('c', 1, id, index);
  231. purchased.push(id);
  232. }
  233. };
  234. let storeEquip = (id, index) => sendPacket('c', 0, id, index);
  235.  
  236. /** EQUIP WEAPONS **/
  237. let equipWeapon = (weapon) => sendPacket('z', weapon, true);
  238.  
  239. /** SEND CHAT **/
  240. let sendChat = message => sendPacket('6', message);
  241.  
  242. /** AUTO GATHER **/
  243. let autoGather = () => sendPacket('K', 1, 1);
  244.  
  245. /** REQUEST ANIMATION FRAME **/
  246. let requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || (callback => setTimeout(callback, 1000 / 60));
  247.  
  248. /** HANDLE MESSAGE **/
  249. let handleMessage = (message) => {
  250. let decodeData = msgpack.decode(new Uint8Array(message.data));
  251.  
  252. let data = Array.isArray(decodeData) && decodeData.length > 1 ? [decodeData[0], ...decodeData[1]] : decodeData;
  253.  
  254. if (!data) return;
  255.  
  256. let dataType = data[0];
  257.  
  258. if (dataType === "C" && myPlayer.id == null) {
  259. myPlayer.id = data[1];
  260. }
  261. if (dataType == "D" && data[2]) {
  262. secondary = null;
  263. primary = 0;
  264. foodType = 0;
  265. wallType = 3;
  266. spikeType = 6;
  267. millType = 10;
  268. spawnpadType = 36;
  269. }
  270. if (dataType == "V") {
  271. if (data[2] == 1) {
  272. primary = data[1][0];
  273. secondary = data[1][1] ?? null;
  274. } else {
  275. foodType = data[1][0];
  276. wallType = data[1][1];
  277. spikeType = data[1][2];
  278. millType = data[1][3];
  279. boostType = data[1][4] ?? -1;
  280. haveMine = data[1][5] == 13 || data[1][4] == 14;
  281. if (haveMine) {
  282. mineType = data[1][5];
  283. }
  284. turretType = data[1][5 + (haveMine ? 1 : 0)];
  285. }
  286. }
  287. if (dataType == "a") updatePlayers(data);
  288. if (dataType === "T") updateAge(data[1], data[2], data[3]);
  289. if (dataType == "O" && data[1] == myPlayer.id) {
  290. let playerID = data[1];
  291. let health = data[2];
  292. updateHealth(health, playerID);
  293. }
  294. };
  295.  
  296. /** DISTANCE CALCULATE **/
  297. let distance = (a, b) => {
  298. return Math.sqrt(Math.pow(b.y - a[2], 2) + Math.pow(b.x - a[1], 2));
  299. };
  300.  
  301. /** ANTI ALTCHA **/
  302. document.getElementById('altcha').style.display = 'none';
  303. document.getElementById('altcha_checkbox').click();
  304.  
  305. /** UPDATE XP/MAXXP/AGE **/
  306. let updateAge = (xp, maxXp, age) => {
  307. if (xp != undefined) {
  308. myPlayer.XP = xp;
  309. }
  310. if (maxXp != undefined) {
  311. myPlayer.maxXP = maxXp;
  312. }
  313. if (age != undefined) {
  314. myPlayer.age = age;
  315. }
  316. }
  317.  
  318. /** PLACE **/
  319. let place = (id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) => {
  320. if (typeof id !== "number" || id == -1) return;
  321. sendPacket("z", id, null);
  322. sendPacket("F", 1, angle);
  323. sendPacket("F", 0, angle);
  324. sendPacket("z", myPlayer.weapon, true);
  325. }
  326. //sendupgrade
  327. function sendUpgrade(index) {
  328. sendPacket("H");
  329. }
  330. /** HOOK **/
  331. let hook = (target, prop, setter, getter) => {
  332. let symbol = Symbol(prop);
  333. Object.defineProperty(target, prop, {
  334. get() {
  335. getter(this, this[symbol]);
  336. return this[symbol];
  337. },
  338. set(value) {
  339. setter(this, symbol, value);
  340. },
  341. configurable: true
  342. })
  343. }
  344.  
  345. /** IS TEAM **/
  346. let isTeam = (kaka) => {
  347. return kaka.clan == myPlayer.clan;
  348. };
  349.  
  350. /** OPEN/CLOSED **/
  351. let checkMenu = () => {
  352. return (allianceMenu.style.display != "block" && chatHolder.style.display != "block" && storeMenu.style.display != "block" && !menuOpened);
  353. }
  354.  
  355. /** RENDERING **/
  356. let object = null;
  357. hook(Object.prototype, "isItem", function(that, symbol, value) {
  358. that[symbol] = value;
  359. }, function(that, value) {
  360. if (value === true) {
  361. object = that;
  362. }
  363. });
  364.  
  365. CanvasRenderingContext2D.prototype.restore = new Proxy(CanvasRenderingContext2D.prototype.restore, {
  366. apply(target, thisArg, args) {
  367. markObject(thisArg);
  368. return Reflect.apply(target, thisArg, args);
  369. }
  370. });
  371.  
  372. let markColor = (id) => {
  373.  
  374. if (id === myPlayer.id) {
  375. return { color: "#00ff00", render: true };
  376. } else {
  377. return { color: "#FF4D4D", render: false };
  378. }
  379. };
  380.  
  381. // item.owner.sid
  382.  
  383. let markObject = (ctx) => {
  384. if (!object || !object.owner || myPlayer.id === null) return;
  385. let distance = Math.sqrt(Math.pow(myPlayer.x - object.x, 2) + Math.pow(myPlayer.y - object.y, 2));
  386. if (distance > 300) return;
  387. let type = markColor(object.owner.sid);
  388. if (!type.render) return;
  389. ctx.fillStyle = type.color;
  390. ctx.beginPath();
  391. ctx.arc(0, 0, 10, 0, 2 * Math.PI);
  392. ctx.fill();
  393. object = null;
  394. };
  395.  
  396. /** WEAPONS/NAMES/IDS **/
  397. let weapon = {
  398. "tool_hammer": 0,
  399. "hand_axe": 1,
  400. "great_axe": 2,
  401. "short_sword": 3,
  402. "katana": 4,
  403. "polearm": 5,
  404. "bat": 6,
  405. "daggers": 7,
  406. "stick": 8,
  407. "hunting_bow": 9,
  408. "great_hammer": 10,
  409. "wooden_shield": 11,
  410. "crossbow": 12,
  411. "repeater_crossbow": 13,
  412. "mc_grabby": 14,
  413. "musket": 15
  414. };
  415.  
  416. /** UPDATE PLAYERS **/
  417. let updatePlayers = data => {
  418. SaVeGe.tick++
  419. let enemies = [];
  420. let players = [];
  421. let cTickQ = SaVeGe.tickQueue[SaVeGe.tick];
  422. if (Array.isArray(cTickQ)) {
  423. cTickQ.forEach((did) => did());
  424. SaVeGe.tickQueue[SaVeGe.tick] = null;
  425. }
  426. for (let i = 0; i < data[1].length / 13; i++) {
  427. let playerInfo = data[1].slice(13 * i, 13 * i + 13);
  428. players.push(playerInfo);
  429.  
  430. if (playerInfo[0] == myPlayer.id) {
  431. myPlayer.x = playerInfo[1];
  432. myPlayer.y = playerInfo[2];
  433. myPlayer.dir = playerInfo[3];
  434. myPlayer.object = playerInfo[4];
  435. myPlayer.weapon = playerInfo[5];
  436. myPlayer.clan = playerInfo[7];
  437. myPlayer.isLeader = playerInfo[8];
  438. myPlayer.hat = playerInfo[9];
  439. myPlayer.accessory = playerInfo[10];
  440. myPlayer.isSkull = playerInfo[11];
  441. } else if (playerInfo[7] != myPlayer.clan && playerInfo[7] !== null) {
  442. enemies.push({
  443. id: playerInfo[0],
  444. x: playerInfo[1],
  445. y: playerInfo[2],
  446. dir: playerInfo[3],
  447. object: playerInfo[4],
  448. weapon: playerInfo[5],
  449. clan: playerInfo[7],
  450. isLeader: playerInfo[8],
  451. hat: playerInfo[9],
  452. accessory: playerInfo[10],
  453. isSkull: playerInfo[11]
  454. });
  455. }
  456. }
  457.  
  458. if (enemies) {
  459. nearestEnemy = enemies.sort((a, b) => distance(a, myPlayer) - distance(b, myPlayer))[0];
  460. }
  461.  
  462. let isEnemyNear = (Math.sqrt(Math.pow((myPlayer.y - nearestEnemy), 2) + Math.pow((myPlayer.x-nearestEnemy[1]), 2)) < 300) /**nearestEnemy ? (Math.sqrt(Math.pow(myPlayer.y - nearestEnemy.y, 2) + Math.pow(myPlayer.x - nearestEnemy.x, 2)) < 320) : false;
  463. enemyAngle = nearestEnemy ? Math.atan2(nearestEnemy.y - myPlayer.y, nearestEnemy.x - myPlayer.x) : (myPlayer?.dir ?? 0)**/
  464. };
  465.  
  466. /** PLACE REPEATER **/
  467. let placeRepeater = (key, action) => {
  468. return {
  469. interval: null,
  470. action,
  471. key,
  472. };
  473. }
  474.  
  475. let repeaters = [
  476. placeRepeater("q", () => {
  477. place(foodType);
  478. }),
  479. placeRepeater("f", () => {
  480. place(boostType);
  481. }),
  482. placeRepeater("v", () => {
  483. place(spikeType);
  484. }),
  485. placeRepeater("F", () => {
  486. place(millType);
  487. }),
  488. placeRepeater("h", () => {
  489. place(turretType);
  490. }),
  491. placeRepeater("t", () => {
  492. place(wallType);
  493. }),
  494. ];
  495.  
  496.  
  497. /** HIT **/
  498. let hit = () => {
  499. sendPacket("F", 1, enemyAngle);
  500. sendPacket("F", 0);
  501. }
  502.  
  503. /** SOCKET CONNECTION **/
  504. let socketFound = stuff => {
  505. stuff.addEventListener("message", handleMessage);
  506. gameCanvas.addEventListener("mousemove", ({ x, y }) => {
  507. mouseX = x;
  508. mouseY = y;
  509. });
  510. window.addEventListener("resize", () => {
  511. height = innerHeight;
  512. width = innerWidth;
  513. });
  514. };
  515. /** MOVEMENT **/
  516. let moveEz = (key, isKeyDown) => {
  517. moveKeys[key] = isKeyDown;
  518. if ((moveKeys.w || moveKeys.a || moveKeys.s || moveKeys.d) && !locked) {
  519. // storeEquip(12, 0);
  520. locked = true;
  521. }
  522. if (!moveKeys.w && !moveKeys.a && !moveKeys.s && !moveKeys.d && locked) {
  523. // storeEquip(6, 0);
  524. locked = false;
  525. }
  526. };
  527.  
  528. /** AUTO HEAL **/
  529. let defHealSpeed = 200;
  530. let autoHeal = (health, damage) => {
  531. let cHealSpeed = defHealSpeed;
  532. if (health <= 50) {
  533. cHealSpeed = 230;
  534. place(foodType);
  535. storeEquip(21, 1);
  536. sendChat("");
  537. if (health < 100){
  538. place(foodType);
  539. }
  540. } else if (damage >= 35) {
  541. sendChat("");
  542. spike = 1;
  543. storeEquip(21, 1);
  544. cHealSpeed = 170;
  545. place(foodType, null);
  546. }
  547. if (health < myPlayer.maxHealth) {
  548. let healing = setInterval(() => {
  549. if (myPlayer.health < myPlayer.maxHealth) {
  550. place(foodType, null);
  551. } else {
  552. clearInterval(healing);
  553. }
  554. }, cHealSpeed);
  555. }
  556. };
  557. /** UPDATE HEALTH **/
  558. let lastHealth = 100;
  559. let updateHealth = (health, playerID) => {
  560. if (myPlayer.id === playerID) {
  561. let damage = Math.max(0, lastHealth - health);
  562. myPlayer.health = health;
  563. if (myPlayer.health > 0) {
  564. autoHeal(myPlayer.health, damage);
  565. }
  566. lastHealth = health;
  567. } else {
  568. enemy.health = health;
  569. }
  570. };
  571.  
  572. /** INSTA KILL **/
  573. let instaKill = (...instaType) => {
  574. let type = instaType[0];
  575.  
  576. switch (type) {
  577. case "normal":
  578. sendChat("");
  579. storeBuy(0, 1);
  580. storeEquip(0, 1);
  581. setTimeout(()=>{
  582. storeBuy(7, 0);
  583. storeEquip(7, 0);
  584. equipWeapon(primary);
  585. hit();
  586. setTimeout(()=>{
  587. storeBuy(53, 0);
  588. storeEquip(53, 0);
  589. equipWeapon(secondary);
  590. hit();
  591. setTimeout(() => {
  592. storeBuy(6, 0);
  593. storeEquip(6, 0);
  594. if (secondary == 15){
  595. equipWeapon(secondary);
  596. setTimeout(()=>{
  597. equipWeapon(primary);
  598. },1500);
  599. } else if (secondary == 12){
  600. equipWeapon(secondary);
  601. setTimeout(()=>{
  602. equipWeapon(primary);
  603. },1000);
  604. } else if (secondary == 13){
  605. equipWeapon(secondary);
  606. setTimeout(()=>{
  607. equipWeapon(primary);
  608. },400);
  609. }
  610. setTimeout(() => {
  611. storeBuy(11, 1);
  612. storeEquip(11, 1);
  613. equipWeapon(primary);
  614. equipWeapon(secondary);
  615. }, 170);
  616. }, 170);
  617. }, 105);
  618. }, 100);
  619. break;
  620.  
  621. case "boostTick":
  622. sendChat("");
  623. storeEquip(0, 1);
  624. place(boostType, null);
  625. setTimeout(()=>{
  626. equipWeapon(secondary);
  627. storeBuy(53, 0);
  628. storeEquip(53, 0);
  629. hit();
  630. setTimeout(()=>{
  631. equipWeapon(primary);
  632. storeBuy(7, 0);
  633. storeEquip(7, 0);
  634. hit();
  635. setTimeout(() => {
  636. storeBuy(6, 0);
  637. storeEquip(6, 0);
  638. setTimeout(() => {
  639. storeBuy(11, 1);
  640. storeEquip(11, 1);
  641. if (secondary == 15){
  642. equipWeapon(secondary);
  643. setTimeout(()=>{
  644. equipWeapon(primary);
  645. },1500);
  646. } else if (secondary == 12){
  647. equipWeapon(secondary);
  648. setTimeout(()=>{
  649. equipWeapon(primary);
  650. },1000);
  651. } else if (secondary == 13){
  652. equipWeapon(secondary);
  653. setTimeout(()=>{
  654. equipWeapon(primary);
  655. },400);
  656. }
  657. equipWeapon(primary);
  658. equipWeapon(secondary);
  659. }, 170);
  660. }, 170);
  661. }, 110);
  662. }, 100);
  663. break;
  664.  
  665. case "reverseInsta":
  666. sendChat("");
  667. storeEquip(0, 1);
  668. setTimeout(()=>{
  669. equipWeapon(secondary);
  670. storeBuy(53, 0);
  671. storeEquip(53, 0);
  672. hit();
  673. setTimeout(()=>{
  674. storeBuy(7, 0);
  675. storeEquip(7, 0);
  676. hit();
  677. equipWeapon(primary);
  678. setTimeout(() => {
  679. storeBuy(6, 0);
  680. storeEquip(6, 0);
  681. setTimeout(() => {
  682. storeBuy(11, 1);
  683. storeEquip(11, 1);
  684. if (secondary == 15){
  685. equipWeapon(secondary);
  686. setTimeout(()=>{
  687. equipWeapon(primary);
  688. },1500);
  689. } else if (secondary == 12){
  690. equipWeapon(secondary);
  691. setTimeout(()=>{
  692. equipWeapon(primary);
  693. },1000);
  694. } else if (secondary == 13){
  695. equipWeapon(secondary);
  696. setTimeout(()=>{
  697. equipWeapon(primary);
  698. },400);
  699. }
  700. equipWeapon(primary);
  701. equipWeapon(secondary);
  702. }, 170);
  703. }, 170);
  704. }, 100);
  705. }, 100);
  706.  
  707. break;
  708.  
  709. case "oneTick":
  710. sendChat("");
  711. storeEquip(0, 1);
  712. setTimeout(()=>{
  713. equipWeapon(primary);
  714. storeBuy(7, 0);
  715. storeEquip(7, 0);
  716. hit();
  717. setTimeout(()=>{
  718. equipWeapon(secondary);
  719. hit();
  720. storeEquip(53, 0);
  721. setTimeout(() => {
  722. storeBuy(6, 0);
  723. storeEquip(6, 0);
  724. equipWeapon(primary);
  725. setTimeout(() => {
  726. storeBuy(11, 1);
  727. storeEquip(11, 1);
  728. equipWeapon(secondary);
  729. }, 800);
  730. }, 170);
  731. }, 105);
  732. }, 100);
  733.  
  734. break;
  735.  
  736. default:
  737. sendChat("");
  738. break;
  739. }
  740. };
  741.  
  742. let instaKillMode = 0;
  743. let isInstaKillModeEnabled = false;
  744.  
  745. let humanBasedInsta = () => {
  746. if (!isInstaKillModeEnabled) return;
  747.  
  748. switch (instaKillMode) {
  749. case 0:
  750. equipWeapon(primary);
  751. storeBuy(7, 0);
  752. storeEquip(7, 0);
  753. hit();
  754. break;
  755.  
  756. case 1:
  757. equipWeapon(secondary);
  758. storeBuy(53, 0);
  759. storeEquip(53, 0);
  760. hit();
  761. break;
  762.  
  763. case 2:
  764. equipWeapon(primary);
  765. storeBuy(6, 0);
  766. storeEquip(6, 0);
  767. break;
  768.  
  769. case 3:
  770. sendChat("");
  771. break;
  772.  
  773. default:
  774. sendChat("");
  775. break;
  776. }
  777.  
  778. instaKillMode = (instaKillMode + 1) % 4;
  779. };
  780. let movementdir;
  781. document.addEventListener("keydown", (event) => {
  782. if (event.key === "w") {
  783. movementdir = -1.57;
  784. }
  785. });
  786. document.addEventListener("keydown", (event) => {
  787. if (event.key === "d") {
  788. movementdir = 0;
  789. }
  790. });
  791. document.addEventListener("keydown", (event) => {
  792. if (event.key === "s") {
  793. movementdir = 1.57;
  794. }
  795. });
  796. document.addEventListener("keydown", (event) => {
  797. if (event.key === "a") {
  798. movementdir = -3.14
  799. }
  800. });
  801. let keys = {};
  802.  
  803. document.addEventListener("keydown", (event) => {
  804. keys[event.code] = true;
  805. if (window.location.hostname === "sandbox.moomoo.io") {
  806. // Check if both keys are pressed
  807. if (keys["KeyW"] && keys["KeyD"]) {
  808. movementdir = -0.785;
  809. }
  810. if (keys["KeyD"] && keys["KeyS"]) {
  811. movementdir = 0.785;
  812. }
  813. if (keys["KeyS"] && keys["KeyA"]) {
  814. movementdir = 2.355;
  815. }
  816. if (keys["KeyA"] && keys["KeyW"]) {
  817. movementdir = -2.355;
  818. }
  819. }
  820. });
  821. document.addEventListener("keyup", (event) => {
  822. keys[event.code] = false;
  823. });
  824. // clown hat
  825. let clownInterval;
  826.  
  827. setInterval(function() {
  828. if (myPlayer.hat === 45) {
  829. storeBuy(13, 1);
  830. storeEquip(13, 1);
  831. }
  832. }, 100);
  833. //autospike
  834. let spikeInterval;
  835.  
  836. setInterval(function() {
  837. if (spike === 1) {
  838. let c = myPlayer.dir;
  839. place(spikeType, myPlayer.dir + toRad(0));
  840. place(spikeType, myPlayer.dir + toRad(120));
  841. place(spikeType, myPlayer.dir - toRad(120));
  842. place(spikeType, c);
  843. spike = 0;
  844. }
  845. }, 100);
  846. /** KEY EVENTS **/
  847. document.addEventListener('keydown', ({ key }) => {
  848. if (key == 'Escape') {
  849. let menu = document.getElementById('modMenu');
  850. if (menu) {
  851. if (menu.style.visibility === 'hidden') {
  852. menu.style.visibility = 'visible';
  853. menu.style.opacity = '1';
  854. menu.style.transform = 'translate(-50%, -50%) scale(1)';
  855. menuOpened = true;
  856. } else {
  857. menu.style.opacity = '0';
  858. menu.style.transform = 'translate(-50%, -50%) scale(0.95)';
  859. menuOpened = false;
  860. menu.style.visibility = 'hidden';
  861. }
  862. }
  863. }
  864. if (!checkMenu()) return;
  865. for (let repeater of repeaters) {
  866. if (repeater.key === key && repeater.interval === null) {
  867. repeater.interval = setInterval(
  868. repeater.action, 100
  869. );
  870. }
  871. }
  872. // if (key in moveKeys) moveEz(key, true);
  873. if (key == "r") {
  874. let instaTypes = document.getElementById('instaKillType');
  875. let instaType = instaTypes.value;
  876. instaKill(instaType);
  877. }
  878. });
  879.  
  880. document.addEventListener('keyup', ({ key }) => {
  881. if (!checkMenu()) return;
  882. for (let repeater of repeaters) {
  883. if (repeater.key === key && repeater.interval !== null) {
  884. clearInterval(repeater.interval);
  885. repeater.interval = null;
  886. }
  887. }
  888. // if (key in moveKeys) moveEz(key, false);
  889. });
  890. document.addEventListener("keydown", (event) => {
  891. if (event.key === "c") {
  892. let c = myPlayer.dir;
  893. place(spikeType, myPlayer.dir + toRad(0));
  894. place(spikeType, myPlayer.dir + toRad(120));
  895. place(spikeType, myPlayer.dir - toRad(120));
  896. place(spikeType, c);
  897. storeEquip(0, 1);
  898. setTimeout(()=>{
  899. equipWeapon(primary);
  900. storeBuy(7, 0);
  901. storeEquip(7, 0);
  902. hit();
  903. setTimeout(()=>{
  904. equipWeapon(secondary);
  905. hit();
  906. storeEquip(53, 0);
  907. setTimeout(() => {
  908. storeBuy(53, 0);
  909. storeEquip(53, 0);
  910. if (enemy.object) {
  911. place(spikeType);
  912. }
  913. setTimeout(() => {
  914. storeBuy(6, 0);
  915. storeEquip(6, 0);
  916. equipWeapon(primary);
  917. setTimeout(() => {
  918. storeBuy(11, 1);
  919. storeEquip(11, 1);
  920. equipWeapon(secondary);
  921. }, 800);
  922. }, 170);
  923. }, 120);
  924. }, 105);
  925. }, 100);
  926. }
  927. });
  928. document.addEventListener("keydown", (event) => {
  929. if (event.key === ",") {
  930. storeBuy(31, 0);
  931. storeEquip(31, 0);
  932. }
  933. });
  934. document.addEventListener("keyup", (event) => {
  935. if (event.key === ",") {
  936. storeBuy(15, 0);
  937. storeEquip(15, 0);
  938. }
  939. });
  940. document.addEventListener("keydown", (event) => {
  941. if (event.key === "e") {
  942. storeEquip(20, 0);
  943. }
  944. });
  945. let x = myPlayer.x;
  946. let y = myPlayer.y;
  947. function toRad(angle) {
  948. return angle * 0.01745329251;
  949. }
  950. document.addEventListener("keydown", (event) => {
  951. if (event.key === "z") {
  952. let a = myPlayer.dir;
  953. place(boostType, myPlayer.dir + toRad(45));
  954. place(boostType, myPlayer.dir - toRad(45));
  955. place(boostType, myPlayer.dir + toRad(135));
  956. place(boostType, myPlayer.dir - toRad(135));
  957. place(boostType, myPlayer.dir + toRad(0));
  958. place(boostType, myPlayer.dir - toRad(180));
  959. place(boostType, myPlayer.dir + toRad(90));
  960. place(boostType, myPlayer.dir - toRad(90));
  961. place(boostType, a);
  962. }
  963. });
  964. let autospin = false;
  965. let spinInterval;
  966.  
  967. document.addEventListener("keydown", (event) => {
  968. if (event.key === ".") {
  969. autospin = !autospin;
  970. sendChat(autospin ? "" : "");
  971.  
  972. if (autospin) {
  973. let autospinDir = myPlayer.dir;
  974. spinInterval = setInterval(() => {
  975. myPlayer.dir + toRad(45);
  976. myPlayer.dir - toRad(45);
  977. myPlayer.dir + toRad(135);
  978. myPlayer.dir - toRad(135);
  979. myPlayer.dir = autospin.dir;
  980. }, 100);
  981. } else {
  982. clearInterval(spinInterval);
  983. }
  984. }
  985. });
  986. let automill = false;
  987. let millInterval;
  988. if (window.location.hostname === "sandbox.moomoo.io") {
  989. document.addEventListener("keydown", (event) => {
  990. if (event.key === "n") {
  991. automill = !automill;
  992. if (automill) {
  993. millInterval = setInterval(() => {
  994. place(millType, movementdir - 1.90);
  995. place(millType, movementdir - 3.14);
  996. place(millType, movementdir + 1.90);
  997. }, 100);
  998. } else {
  999. clearInterval(millInterval);
  1000. }
  1001. }
  1002. });
  1003. };
  1004. /** MOUSE EVENTS **/
  1005. document.addEventListener('mousedown', (mouse) => {
  1006. if (!checkMenu()) return;
  1007. if (mouse.button === 0 && !lockers.attacker) {
  1008. humanBasedInsta();
  1009. if (!isInstaKillModeEnabled) {
  1010. storeBuy(11, 1);
  1011. storeEquip(0, 1);
  1012. equipWeapon(primary);
  1013. setTimeout(()=>{
  1014. storeBuy(7, 0);
  1015. storeEquip(7, 0);
  1016. autoGather();
  1017. }, 100);
  1018. lockers.attacker = true;
  1019. }
  1020. }
  1021. if (mouse.button === 2 && !lockers.breaker) {
  1022. if (!isInstaKillModeEnabled) {
  1023. sendChat("");
  1024. storeBuy(40, 0);
  1025. storeEquip(40, 0);
  1026. autoGather();
  1027.  
  1028. lockers.breaker = true;
  1029. }
  1030. if (secondary == 10 && weapongrind == false) {
  1031. equipWeapon(secondary);
  1032. }
  1033. }
  1034. });
  1035.  
  1036. document.addEventListener('mouseup', (mouse) => {
  1037. if (!checkMenu()) return;
  1038. if (mouse.button === 0 && lockers.attacker) {
  1039. if (!isInstaKillModeEnabled) {
  1040. storeBuy(11, 1);
  1041. storeEquip(11, 1);
  1042. autoGather();
  1043. setTimeout(()=>{
  1044. storeBuy(6, 0);
  1045. storeEquip(6, 0);
  1046. }, 200);
  1047. lockers.attacker = false;
  1048. }
  1049. }
  1050. if (mouse.button === 2 && lockers.breaker) {
  1051. if (!isInstaKillModeEnabled) {
  1052. storeBuy(6, 0);
  1053. storeEquip(6, 0);
  1054. autoGather();
  1055.  
  1056. lockers.breaker = false;
  1057. }
  1058. }
  1059. });
  1060. //bow insta
  1061. document.addEventListener('mousedown', (mouse) => {
  1062. if (mouse.button === 1) {
  1063. sendChat("");
  1064. storeEquip(0, 1);
  1065. setTimeout(() => {
  1066. equipWeapon(secondary);
  1067. hit();
  1068. setTimeout(() => {
  1069. sendUpgrade(12);
  1070. hit();
  1071. storeEquip(53, 0);
  1072. setTimeout(() => {
  1073. sendUpgrade(15);
  1074. hit();
  1075. }, 100);
  1076. }, 100);
  1077. }, 100);
  1078.  
  1079. }
  1080. });
  1081. let prevCount = 0;
  1082. const handleMutations = (mutationsList) => {
  1083. for (const mutation of mutationsList) {
  1084. if (mutation.target.id === "killCounter") {
  1085. const count = parseInt(mutation.target.innerText, 10) || 0;
  1086. if (count > prevCount) {
  1087. if (myPlayer.clan != null){
  1088. sendChat("Clap mod by Good Guy");
  1089. setTimeout(()=>{
  1090. sendChat(count + " kills");
  1091. },650);
  1092. }
  1093. prevCount = count;
  1094. }
  1095. }
  1096. }
  1097. };
  1098. const observer = new MutationObserver(handleMutations);
  1099. observer.observe(document, {
  1100. subtree: true,
  1101. childList: true,
  1102. });
  1103. setInterval(function() {
  1104. if (myPlayer.y > 6850 && myPlayer.y < 7550) {
  1105. storeBuy(31, 0);
  1106. storeEquip(31, 0);
  1107. }
  1108. }, 130);
  1109. setInterval(function() {
  1110. if (myPlayer.y < 2400) {
  1111. storeEquip(15, 0);
  1112. storeEquip(15, 0);
  1113. }
  1114. }, 900);
  1115. setInterval(function() {
  1116. storeBuy(11, 1);
  1117. }, 100);
  1118. setInterval(function() {
  1119. storeBuy(6, 0);
  1120. }, 100);
  1121. setInterval(function() {
  1122. storeBuy(7, 0);
  1123. }, 100);
  1124. setInterval(function() {
  1125. storeBuy(40, 0);
  1126. }, 100);
  1127. // weapond grinder
  1128. document.addEventListener("keydown", (event) => {
  1129. if (event.key === "`") {
  1130. sendChat("Weapond Grinding...");
  1131. weapongrind = !weapongrind;
  1132. }
  1133. });
  1134. /*
  1135.  
  1136.  
  1137. STYLING AND MOD MENUS UNDER
  1138.  
  1139.  
  1140. */
  1141.  
  1142.  
  1143. /** MOD MENU **/
  1144. let createModMenu = () => {
  1145. let menuContainer = document.createElement('div');
  1146. menuContainer.id = 'modMenu';
  1147.  
  1148. menuContainer.innerHTML = `
  1149. <h2 class="mod-menu-title">
  1150. </h2>
  1151. <div class="menu-item" style="margin-top: 0px;">
  1152. <label style="cursor: pointer;">
  1153. <div class="toggle-switch">
  1154. <input type="checkbox" id="fpsBoosterToggle" class="checkbox">
  1155. <span class="slider"></span>
  1156. </div>
  1157. <span class="menu-label">FPS Booster</span>
  1158. </label>
  1159. </div>
  1160. <div class="menu-item" style="margin-top: 0px;">
  1161. <label style="cursor: pointer;">
  1162. <div class="toggle-switch">
  1163. <input type="checkbox" id="autoGatherToggle" class="checkbox">
  1164. <span class="slider"></span>
  1165. </div>
  1166. <span class="menu-label">Auto Gather</span>
  1167. </label>
  1168. </div>
  1169. <div class="menu-item">
  1170. <label for="instaKillType" style="font-size: 16px">InstaKill Type:</label>
  1171. <select id="instaKillType">
  1172. <option value="reverseInsta">Reverse Insta</option>
  1173. <option value="boostTick">Boost Tick</option>
  1174. <option value="normal">Normal Insta</option>
  1175. <option value="oneTick">One Tick</option>
  1176. </select>
  1177. </div>
  1178. <div class="menu-footer">
  1179. Credits: SaVeGe
  1180. </div>
  1181. `;
  1182.  
  1183. document.body.appendChild(menuContainer);
  1184.  
  1185. document.getElementById('fpsBoosterToggle').checked = FPSBooster;
  1186. document.getElementById('fpsBoosterToggle').addEventListener('change', (e) => {
  1187. FPSBooster = e.target.checked;
  1188. updateScreen();
  1189. });
  1190.  
  1191. document.getElementById('autoGatherToggle').addEventListener('change', (e) => {
  1192. if (e.target.checked) {
  1193. autoGather();
  1194. } else {
  1195. autoGather();
  1196. }
  1197. });
  1198. };
  1199.  
  1200. createModMenu();
  1201.  
  1202. let menuStyles = `
  1203. @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');
  1204.  
  1205. #modMenu {
  1206. position: fixed;
  1207. top: 50%;
  1208. left: 50%;
  1209. transform: translate(-50%, -50%) scale(0.95);
  1210. width: 420px;
  1211. background: rgba(30, 30, 30, 0.8);
  1212. border-radius: 20px;
  1213. padding: 20px;
  1214. box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  1215. color: #ffffff;
  1216. visibility: hidden;
  1217. opacity: 0;
  1218. z-index: 10000;
  1219. font-family: 'Poppins', sans-serif;
  1220. transition: transform 0.6s ease, opacity 0.6s ease, visibility 0.6s ease;
  1221. border: 1px solid rgba(255, 255, 255, 0.25);
  1222. }
  1223.  
  1224. #modMenu h2 {
  1225. text-align: center;
  1226. color: #ffffff;
  1227. font-size: 36px;
  1228. letter-spacing: 1.5px;
  1229. margin-bottom: 20px;
  1230. text-shadow: 0px 2px 5px rgba(0, 0, 0, 0.5);
  1231. }
  1232.  
  1233. #modMenu .menu-item {
  1234. margin-bottom: 15px;
  1235. }
  1236.  
  1237. #modMenu .menu-footer {
  1238. margin-top: 20px;
  1239. text-align: center;
  1240. color: #ccc;
  1241. font-size: 14px;
  1242. font-style: italic;
  1243. }
  1244.  
  1245. #modMenu .toggle-switch {
  1246. position: relative;
  1247. display: inline-block;
  1248. width: 50px;
  1249. height: 26px;
  1250. }
  1251.  
  1252. #modMenu .toggle-switch input {
  1253. display: none;
  1254. }
  1255.  
  1256. #modMenu .slider {
  1257. position: absolute;
  1258. cursor: pointer;
  1259. top: 0;
  1260. left: 0;
  1261. right: 0;
  1262. bottom: 0;
  1263. background-color: rgba(255, 255, 255, 0.2);
  1264. border-radius: 34px;
  1265. transition: background-color 0.4s, box-shadow 0.4s;
  1266. box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.3);
  1267. }
  1268.  
  1269. #modMenu .slider:before {
  1270. position: absolute;
  1271. content: "";
  1272. height: 22px;
  1273. width: 22px;
  1274. left: 4px;
  1275. bottom: 2px;
  1276. background-color: #ffffff;
  1277. border-radius: 50%;
  1278. transition: transform 0.4s, box-shadow 0.4s;
  1279. box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
  1280. }
  1281.  
  1282. #modMenu input:checked + .slider {
  1283. background-color: rgba(0, 234, 255, 0.8);
  1284. box-shadow: 0 0 15px rgba(0, 234, 255, 0.6);
  1285. }
  1286.  
  1287. #modMenu input:checked + .slider:before {
  1288. transform: translateX(24px);
  1289. box-shadow: 0px 4px 6px rgba(0, 234, 255, 0.6);
  1290. }
  1291.  
  1292. #modMenu .menu-label {
  1293. position: absolute;
  1294. font-size: 16px;
  1295. margin-top: 5px;
  1296. color: #ddd;
  1297. margin-left: 10px;
  1298. transition: color 0.3s ease;
  1299. text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  1300. }
  1301.  
  1302. #modMenu select {
  1303. background: rgba(255, 255, 255, 0.2);
  1304. border: 1px solid rgba(255, 255, 255, 0.4);
  1305. border-radius: 5px;
  1306. color: #ddd;
  1307. padding: 10px;
  1308. font-size: 16px;
  1309. font-family: 'Poppins', sans-serif;
  1310. width: 100%;
  1311. margin-top: 5px;
  1312. transition: background 0.3s, border-color 0.3s;
  1313. }
  1314.  
  1315. #modMenu select:hover {
  1316. background: rgba(255, 255, 255, 0.3);
  1317. border-color: rgba(255, 255, 255, 0.6);
  1318. }
  1319.  
  1320. #modMenu select option {
  1321. background-color: rgba(30, 30, 30, 0.8);
  1322. color: #ffffff;
  1323. }
  1324.  
  1325. #modMenu select option:hover {
  1326. background-color: rgba(0, 234, 255, 0.5);
  1327. }
  1328.  
  1329. #modMenu select:focus {
  1330. outline: none;
  1331. border-color: rgba(0, 234, 255, 0.8);
  1332. background-color: rgba(255, 255, 255, 0.3);
  1333. }
  1334.  
  1335. #modMenu button {
  1336. background: rgba(255, 255, 255, 0.2);
  1337. border: 1px solid rgba(255, 255, 255, 0.4);
  1338. color: #ffffff;
  1339. border-radius: 5px;
  1340. padding: 12px 20px;
  1341. font-size: 18px;
  1342. cursor: pointer;
  1343. transition: background 0.3s, box-shadow 0.3s;
  1344. width: 100%;
  1345. }
  1346.  
  1347. #modMenu button:hover {
  1348. background: rgba(255, 255, 255, 0.3);
  1349. border-color: rgba(255, 255, 255, 0.6);
  1350. }
  1351. #leaderboard::after {
  1352. display: block;
  1353. font-size: 40px;
  1354. text-align: center;
  1355. margin: 0 auto;
  1356. }
  1357. `;
  1358.  
  1359. let styleSheet = document.createElement('style');
  1360. Object.assign(styleSheet, { type: 'text/css', textContent: menuStyles });
  1361. document.head.append(styleSheet);
  1362.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址