Advertisement
Odleyodlev1

Moomoo.io ExPloit v3

Feb 1st, 2020
2,392
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.59 KB | None | 0 0
  1. - Edited by odleyodle -
  2. - Credits to Jack LAL and MooJAX -
  3.  
  4. // ==UserScript==
  5. // @name Odleyodle Mod (Stick to Katana / Musket + Katana or Greater Axe / Stick + Spinning Spikes)(Insta. Pro!)
  6. // @version 1.7
  7. // @description odleyodle - On Axion
  8. // @match *://moomoo.io/*
  9. // @match *://sandbox.moomoo.io/*
  10. // @grant odleyodle
  11. // @require https://greasyfork.org/scripts/368273-msgpack/code/msgpack.js?version=598723
  12. // @require http://code.jquery.com/jquery-3.3.1.min.js
  13. // @require https://code.jquery.com/ui/1.12.0/jquery-ui.min.js
  14. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js
  15. // @namespace -
  16. // ==/UserScript==
  17.  
  18. document.getElementById("followText").innerHTML = "Sub to odleyodles"
  19. document.getElementById("linksContainer2").innerHTML = "Edited by odley, [G] For Spike + BoostPad, [N] For 1 Windmills, [O] For 4 pits, [H] For Turrets [F] For BoostPad/Pit, [V] For Spike, [B] for Active/Unactive Auto Hat, [L] For 4 Spikes, [T] for Active/Unactive AutoHeal, [J] To Musket, [Z] Turret Quad, [ESC] Open macro configuration, [Y] For Katana, [U] For Musket, [I] For Spinnng Spikes!";
  20. document.getElementById("twitterFollow").remove();
  21. document.getElementById('loadingText').innerHTML = 'EPIC Loading';
  22. document.getElementById('gameName').innerHTML = '🔥odleyMOD🔥';
  23. document.getElementById("leaderboard").append('☢️odleyodleMOD☢️');;
  24. document.getElementById("youtubeFollow").remove();
  25. document.getElementById('errorNotification').remove();
  26. document.getElementById("pingDisplay").remove();
  27. $("#consentBlock").css({display: "none"});
  28. $("#youtuberOf").css({display: "none"});
  29. $("#mapDisplay").css({background: `url('https://i.imgur.com/fgFsQJp.png')`});
  30.  
  31. document.getElementById("moomooio_728x90_home").style.display = "none";
  32. $("#moomooio_728x90_home").parent().css({display: "none"});
  33.  
  34. window.onbeforeunload = null;
  35.  
  36. let mouseX;
  37. let mouseY;
  38.  
  39. let width;
  40. let height;
  41.  
  42. setInterval(() => {
  43. if(clanToggle == 1) {
  44. doNewSend(["9", [null]]);
  45. doNewSend(["8", [animate(false, 5)]])
  46. }
  47. doNewSend(["testing", [6]]);
  48. }, 200);
  49.  
  50. setInterval(() => {
  51. if(messageToggle == 1) {
  52. doNewSend(["ch", [animate(true, 5)]])
  53. }
  54. }, 200);
  55.  
  56. setInterval(() => {
  57. if(autoaim == true) {
  58. doNewSend(["2", [nearestEnemyAngle]]);
  59. }
  60. }, 0);
  61.  
  62. setInterval(() => {
  63. if(hatToggle == 1) {
  64. if(oldHat != normalHat) {
  65. hat(normalHat);
  66. console.log("Tried. - Hat")
  67. }
  68. if(oldAcc != normalAcc) {
  69. acc(normalAcc);
  70. console.log("Tried. - Acc")
  71. }
  72. oldHat = normalHat;
  73. oldAcc = normalAcc
  74. }
  75. }, 25);
  76.  
  77. function normal() {
  78. hat(normalHat);
  79. acc(normalAcc);
  80. }
  81.  
  82. function aim(x, y){
  83. var cvs = document.getElementById("gameCanvas");
  84. cvs.dispatchEvent(new MouseEvent("mousemove", {
  85. clientX: x,
  86. clientY: y
  87.  
  88. }));
  89. }
  90.  
  91. let coreURL = new URL(window.location.href);
  92. window.sessionStorage.force = coreURL.searchParams.get("fc");
  93.  
  94. var nearestEnemy;
  95. var nearestEnemyAngle;
  96. var isEnemyNear;
  97. var instaSpeed = 230;
  98. var primary;
  99. var secondary;
  100. var foodType;
  101. var wallType;
  102. var spikeType;
  103. var millType;
  104. var mineType;
  105. var boostType;
  106. var turretType;
  107. var spawnpadType;
  108. var autoaim = false;
  109. var tick = 1;
  110. var oldHat;
  111. var oldAcc;
  112. var enemiesNear;
  113. var normalHat;
  114. var normalAcc;
  115. var ws;
  116. var msgpack5 = msgpack;
  117. var boostDir;
  118. let myPlayer = {
  119. id: null,
  120. x: null,
  121. y: null,
  122. dir: null,
  123. object: null,
  124. weapon: null,
  125. clan: null,
  126. isLeader: null,
  127. hat: null,
  128. accessory: null,
  129. isSkull: null
  130. };
  131.  
  132. let healSpeed = 70;
  133. var messageToggle = 0;
  134. var clanToggle = 0;
  135. let healToggle = 1;
  136. let hatToggle = 1;
  137.  
  138. document.msgpack = msgpack;
  139. function n(){
  140. this.buffer = new Uint8Array([0]);
  141. this.buffer.__proto__ = new Uint8Array;
  142. this.type = 0;
  143. }
  144.  
  145. WebSocket.prototype.oldSend = WebSocket.prototype.send;
  146. WebSocket.prototype.send = function(m){
  147. if (!ws){
  148. document.ws = this;
  149.  
  150. ws = this;
  151. socketFound(this);
  152. }
  153. this.oldSend(m);
  154. };
  155.  
  156.  
  157. function socketFound(socket){
  158. socket.addEventListener('message', function(message){
  159. handleMessage(message);
  160. });
  161. }
  162.  
  163. function handleMessage(m){
  164. let temp = msgpack5.decode(new Uint8Array(m.data));
  165. let data;
  166. if(temp.length > 1) {
  167. data = [temp[0], ...temp[1]];
  168. if (data[1] instanceof Array){
  169. data = data;
  170. }
  171. } else {
  172. data = temp;
  173. }
  174. let item = data[0];
  175. if(!data) {return};
  176.  
  177. if(item === "io-init") {
  178. let cvs = document.getElementById("gameCanvas");
  179. width = cvs.clientWidth;
  180. height = cvs.clientHeight;
  181. $(window).resize(function() {
  182. width = cvs.clientWidth;
  183. height = cvs.clientHeight;
  184. });
  185. cvs.addEventListener("mousemove", e => {
  186. mouseX = e.clientX;
  187. mouseY = e.clientY;
  188. });
  189. }
  190.  
  191. if (item == "1" && myPlayer.id == null){
  192. myPlayer.id = data[1];
  193. }
  194.  
  195. if (item == "33") {
  196. enemiesNear = [];
  197. for(let i = 0; i < data[1].length / 13; i++) {
  198. let playerInfo = data[1].slice(13*i, 13*i+13);
  199. if(playerInfo[0] == myPlayer.id) {
  200. myPlayer.x = playerInfo[1];
  201. myPlayer.y = playerInfo[2];
  202. myPlayer.dir = playerInfo[3];
  203. myPlayer.object = playerInfo[4];
  204. myPlayer.weapon = playerInfo[5];
  205. myPlayer.clan = playerInfo[7];
  206. myPlayer.isLeader = playerInfo[8];
  207. myPlayer.hat = playerInfo[9];
  208. myPlayer.accessory = playerInfo[10];
  209. myPlayer.isSkull = playerInfo[11];
  210. } else if(playerInfo[7] != myPlayer.clan || playerInfo[7] === null) {
  211. enemiesNear.push(playerInfo);
  212. }
  213. }
  214. }
  215.  
  216. isEnemyNear = false;
  217. if(enemiesNear) {
  218. nearestEnemy = enemiesNear.sort((a,b) => dist(a, myPlayer) - dist(b, myPlayer))[0];
  219. }
  220.  
  221. if(nearestEnemy) {
  222. nearestEnemyAngle = Math.atan2(nearestEnemy[2]-myPlayer.y, nearestEnemy[1]-myPlayer.x);
  223. if(Math.sqrt(Math.pow((myPlayer.y-nearestEnemy[2]), 2) + Math.pow((myPlayer.x-nearestEnemy[1]), 2)) < 300) {
  224. isEnemyNear = true;
  225. if(autoaim == false && myPlayer.hat != 7 && myPlayer.hat != 53) {
  226. normalHat = 6;
  227. if(primary != 8) {
  228. normalAcc = 21
  229. }
  230. };
  231. }
  232. }
  233. if(isEnemyNear == false && autoaim == false) {
  234. normalAcc = 11;
  235. if (myPlayer.y < 2400){
  236. normalHat = 15;
  237. } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
  238. normalHat = 31;
  239. } else {
  240. normalHat = 12;
  241. }
  242. }
  243. if (!nearestEnemy) {
  244. nearestEnemyAngle = myPlayer.dir;
  245. }
  246. if(item == "h" && data[1] == myPlayer.id) {
  247. if(data[2] < 100 && data[2] > 0 && healToggle == 1) {
  248. setTimeout( () => {
  249. place(foodType, null);
  250. }, healSpeed);
  251.  
  252. }
  253. }
  254. update();
  255. }
  256.  
  257.  
  258. function doNewSend(sender){
  259. ws.send(new Uint8Array(Array.from(msgpack5.encode(sender))));
  260. }
  261.  
  262. function acc(id) {
  263. doNewSend(["13c", [0, 0, 1]]);
  264. doNewSend(["13c", [0, id, 1]]);
  265. }
  266.  
  267. function hat(id) {
  268. doNewSend(["13c", [0, id, 0]]);
  269. }
  270.  
  271.  
  272. function place(id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) {
  273. doNewSend(["5", [id, null]]);
  274. doNewSend(["c", [1, angle]]);
  275. doNewSend(["c", [0, angle]]);
  276. doNewSend(["5", [myPlayer.weapon, true]]);
  277. }
  278.  
  279. function boostSpike() {
  280. if(boostDir == null) {
  281. boostDir = nearestEnemyAngle;
  282. }
  283. place(spikeType, boostDir + toRad(90));
  284. place(spikeType, boostDir - toRad(90));
  285. place(boostType, boostDir);
  286. doNewSend(["33", [boostDir]]);
  287. }
  288.  
  289.  
  290. var repeater = function(key, action, interval) {
  291. let _isKeyDown = false;
  292. let _intervalId = undefined;
  293.  
  294. return {
  295. start(keycode) {
  296. if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
  297. _isKeyDown = true;
  298. if(_intervalId === undefined) {
  299. _intervalId = setInterval(() => {
  300. action();
  301. if(!_isKeyDown){
  302. clearInterval(_intervalId);
  303. _intervalId = undefined;
  304. console.log("claered");
  305. }
  306. }, interval);
  307. }
  308. }
  309. },
  310.  
  311. stop(keycode) {
  312. if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
  313. _isKeyDown = false;
  314. }
  315. }
  316. };
  317.  
  318.  
  319. }
  320.  
  321. const healer = repeater(81, () => {place(foodType)}, 0);
  322. const boostPlacer = repeater(70, () => {place(boostType)}, 0);
  323. const spikePlacer = repeater(86, () => {place(spikeType)}, 0);
  324. const millPlacer = repeater(78, () => {place(millType)}, 0);
  325. const turretPlacer = repeater(72, () => {place(turretType)}, 0);
  326. const boostSpiker = repeater(71, boostSpike, 0);
  327.  
  328. document.addEventListener('keydown', (e)=>{
  329. spikePlacer.start(e.keyCode);
  330. healer.start(e.keyCode);
  331. boostPlacer.start(e.keyCode);
  332. boostSpiker.start(e.keyCode);
  333. millPlacer.start(e.keyCode);
  334. turretPlacer.start(e.keyCode);
  335.  
  336. if (e.keyCode == 80 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  337. for (let i=0;i<5;i++){
  338. let angle = myPlayer.dir + toRad(i * 72);
  339. place(millType, angle)
  340. }
  341. }
  342. if (e.keyCode == 79 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  343. for (let i=0;i<4;i++){
  344. let angle = myPlayer.dir + toRad(i * 90);
  345. place(boostType, angle)
  346. }
  347. }
  348. if (e.keyCode == 76 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  349. for (let i=0;i<4;i++){
  350. let angle = myPlayer.dir + toRad(i * 90);
  351. place(spikeType, angle)
  352. }
  353. }
  354. if (e.keyCode == 90 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  355. for (let i=0;i<4;i++){
  356. let angle = myPlayer.dir + toRad(i * 90);
  357. place(turretType, angle)
  358. }
  359. }
  360. if (e.keyCode == 72 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  361. place(turretType, myPlayer.dir + toRad(45));
  362. place(turretType, myPlayer.dir - toRad(45));
  363. }
  364.  
  365. if (e.keyCode == 77 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  366. if (myPlayer.y < 2400){
  367. hat(15);
  368. } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
  369. hat(31);
  370. } else {
  371. hat(12);
  372. }
  373. acc(11);
  374. }
  375.  
  376. if(e.keyCode == 82 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  377. autoaim = true;
  378. doNewSend(["5", [primary, true]]);
  379. doNewSend(["13c", [0, 26, 0]]);
  380. doNewSend(["13c", [0, 7, 0]]);
  381. doNewSend(["13c", [0, 0, 1]]);
  382. doNewSend(["13c", [0, 18, 1]]);
  383. doNewSend(["c", [1]]);
  384. setTimeout( () => {
  385. doNewSend(["13c", [0, 53, 0]]);
  386. doNewSend(["13c", [0, 11, 1]]);
  387. doNewSend(["5", [secondary, true]]);
  388. }, instaSpeed - 130);
  389.  
  390. setTimeout( () => {
  391. doNewSend(["5", [primary, true]]);
  392. doNewSend(["c", [0, null]]);
  393. doNewSend(["13c", [0, 6, 0]]);
  394. autoaim = false;
  395. }, instaSpeed);
  396. }
  397.  
  398.  
  399. if(e.keyCode == 38 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  400. messageToggle = (messageToggle + 1) % 2;
  401. }
  402.  
  403. if(e.keyCode == 40 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  404. clanToggle = (clanToggle + 1) % 2;
  405. }
  406.  
  407. if(e.keyCode == 84 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  408. healToggle = (healToggle + 1) % 2;
  409. if(healToggle == 0) {
  410. if(hatToggle == 0) {
  411. document.title = "Heal: OFF / Hat: OFF"
  412. } else {
  413. document.title = "Heal: OFF / Hat: ON"
  414. }
  415. } else {
  416. if(hatToggle == 0) {
  417. document.title = "Heal: ON / Hat: OFF"
  418. } else {
  419. document.title = "Heal: ON / Hat: ON"
  420. }
  421. }
  422. }
  423. if(e.keyCode == 74 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  424. autoaim = true;
  425. doNewSend(["5", [secondary, true]]);
  426. doNewSend(["13c", [0, 53, 0]]);
  427. doNewSend(["c", [1]]);
  428.  
  429. setTimeout( () => {
  430. doNewSend(["6", [12]]);
  431. }, 300);
  432.  
  433. setTimeout( () => {
  434. doNewSend(["6", [15]]);
  435. }, 300);
  436.  
  437. setTimeout( () => {
  438. doNewSend(["c", [0]]);
  439. doNewSend(["13c", [0, 6, 0]]);
  440. doNewSend(["5", [primary, true]]);
  441. autoaim = false;
  442. }, 300);
  443. }
  444.  
  445. if(e.keyCode == 89 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  446. doNewSend(["6", [4]]);
  447. }
  448.  
  449. if(e.keyCode == 85 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  450. doNewSend(["6", [15]]);
  451. }
  452. if(e.keyCode == 73 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  453. doNewSend(["6", [28]]);
  454. doNewSend(["6", [25]]);
  455. }
  456. if(e.keyCode == 105 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  457. doNewSend(["6", [28]]);
  458. doNewSend(["6", [25]]);
  459. }
  460. if(e.keyCode == 66 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  461. hatToggle = (hatToggle + 1) % 2;
  462. if(healToggle == 0) {
  463. if(hatToggle == 0) {
  464. document.title = "Heal: OFF / Hat: OFF"
  465. } else {
  466. document.title = "Heal: OFF / Hat: ON"
  467. }
  468. } else {
  469. if(hatToggle == 0) {
  470. document.title = "Heal: ON / Hat: OFF"
  471. } else {
  472. document.title = "Heal: ON / Hat: ON"
  473. }
  474. }
  475. }
  476. })
  477.  
  478. document.addEventListener('keyup', (e)=>{
  479. spikePlacer.stop(e.keyCode);
  480. boostPlacer.stop(e.keyCode);
  481. boostSpiker.stop(e.keyCode);
  482. millPlacer.stop(e.keyCode);
  483. turretPlacer.stop(e.keyCode);
  484. healer.stop(e.keyCode);
  485. if(e.keyCode == 71 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  486. setTimeout( () => {
  487. doNewSend(["33", [null]]);
  488. boostDir = null;
  489. }, 10);
  490. }
  491. })
  492.  
  493.  
  494. function isElementVisible(e) {
  495. return (e.offsetParent !== null);
  496. }
  497.  
  498.  
  499. function toRad(angle) {
  500. return angle * 0.01745329251;
  501. }
  502.  
  503. function dist(a, b){
  504. return Math.sqrt( Math.pow((b.y-a[2]), 2) + Math.pow((b.x-a[1]), 2) );
  505. }
  506.  
  507.  
  508. document.title = "MooJaXReloaded"
  509.  
  510. function update() {
  511. for (let i=0;i<9;i++){
  512. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  513. primary = i;
  514. }
  515. }
  516.  
  517. for (let i=9;i<16;i++){
  518. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  519. secondary = i;
  520. }
  521. }
  522.  
  523. for (let i=16;i<19;i++){
  524. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  525. foodType = i - 16;
  526. }
  527. }
  528.  
  529. for (let i=19;i<22;i++){
  530. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  531. wallType = i - 16;
  532. }
  533. }
  534.  
  535. for (let i=22;i<26;i++){
  536. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  537. spikeType = i - 16;
  538. }
  539. }
  540.  
  541. for (let i=26;i<29;i++){
  542. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  543. millType = i - 16;
  544. }
  545. }
  546.  
  547. for (let i=29;i<31;i++){
  548. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  549. mineType = i - 16;
  550. }
  551. }
  552.  
  553. for (let i=31;i<33;i++){
  554. if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
  555. boostType = i - 16;
  556. }
  557. }
  558.  
  559. for (let i=33;i<39;i++){
  560. if (isElementVisible(document.getElementById("actionBarItem" + i.toString())) && i != 36){
  561. turretType = i - 16;
  562. }
  563. }
  564.  
  565. spawnpadType = 36;
  566. }
  567.  
  568. var ID_WinterCap = 15;
  569. var ID_FlipperHat = 31;
  570. var ID_MarksmanCap = 1;
  571. var ID_BushGear = 10;
  572. var ID_SoldierHelmet = 6;
  573. var ID_AntiVenomGear = 23;
  574. var ID_MusketeerHat = 32;
  575. var ID_MedicGear = 13;
  576. var ID_BullHelmet = 7;
  577. var ID_EmpHelmet = 22;
  578. var ID_BoosterHat = 12;
  579. var ID_BarbarianArmor = 26;
  580. var ID_BullMask = 46;
  581. var ID_WindmillHat = 14;
  582. var ID_SpikeGear = 11;
  583. var ID_BushidoArmor = 16;
  584. var ID_SamuraiArmor = 20;
  585. var ID_ScavengerGear = 27;
  586. var ID_TankGear = 40;
  587. var ID_TurretGear = 53;
  588.  
  589. // Keys
  590. var TankGearKey = 90;
  591. var BullHelmetKey = 74;
  592. var SoldierHelmetKey = 71;
  593. var TurretKey = 72;
  594. var BoosterHatKey = 66;
  595. var uneqiup = 16;
  596. var SpikeGearKey = 89;
  597. var EmpKey = 84;
  598. var SamuKey = 80;
  599. var SpikeKey = 86
  600.  
  601. try {
  602. document.getElementById("moomooio_728x90_home").style.display = "none";
  603. $("moomooio728x90_home").parent().css({display: "none"});
  604. } catch (e) {
  605. console.log("There was an error removing the ads.");
  606. }
  607.  
  608.  
  609. var menuChange = document.createElement("div");
  610. menuChange.className = "menuCard";
  611. menuChange.id = "mainSettings";
  612. menuChange.innerHTML = `
  613. <div id="simpleModal" class="modal">
  614. <div class="modal-content">
  615. <div class="modal-header">
  616. <span class="closeBtn">&times;</span>
  617. <h2 style="font-size: 17px;">Macro Settings</h2>
  618. </div>
  619. <div class="modal-body" style="font-size: 17px;">
  620. <div class="flexControl">
  621. <h3 style="color: #2196F3; font-size: 17px;">To unquip a hat press: LEFT SHIFT</h3>
  622. <h3 class="menuPrompt">Tank Gear: </h3> <input value="${String.fromCharCode(TankGearKey)}" id="tankGear" class="keyPressLow" onkeyup="this.value = this.value.toUpperCase();" maxlength="1" type="text"/>
  623. <h3 class="menuPrompt">Bull Helmet: </h3> <input value="${String.fromCharCode(BullHelmetKey)}" id="bullHelm" class="keyPressLow" onkeyup="this.value = this.value.toUpperCase();" maxlength="1" type="text"/>
  624. <h3 class="menuPrompt">Soldier Helmet: </h3> <input value="${String.fromCharCode(SoldierHelmetKey)}" id="soldier" class="keyPressLow"onkeyup="this.value = this.value.toUpperCase();" maxlength="1" type="text"/>
  625. <h3 class="menuPrompt">Turret Gear: </h3> <input value="${String.fromCharCode(TurretKey)}" id="turret" class="keyPressLow" maxlength="1" onkeyup="this.value = this.value.toUpperCase();" type="text"/>
  626. <h3 class="menuPrompt">Booster Hat: </h3> <input value="${String.fromCharCode(BoosterHatKey)}" id="booster" class="keyPressLow" maxlength="1" onkeyup="this.value = this.value.toUpperCase();" type="text"/>
  627. <h3 class="menuPrompt">Spike Gear: </h3> <input value="${String.fromCharCode(SpikeGearKey)}" id="spikeg" class="keyPressLow" maxlength="1" onkeyup="this.value = this.value.toUpperCase();" type="text"/>
  628. <h3 class="menuPrompt">Emp Helmet: </h3> <input value="${String.fromCharCode(EmpKey)}" id="emp" class="keyPressLow" onkeyup="this.value = this.value.toUpperCase();" maxlength="1" type="text"/>
  629. <h3 class="menuPrompt">Samurai Armor: </h3> <input value="${String.fromCharCode(SamuKey)}" id="samu" class="keyPressLow" onkeyup="this.value = this.value.toUpperCase();" maxlength="1" type="text"/>
  630.  
  631. <hr>
  632. <h3 style="font-size: 17px;"> Map Settings </h3>
  633.  
  634. <label class="container">Show biomes on the map ?(Snow, Plains, desert)
  635. <input type="checkbox" id="myCheck">
  636. <span class="checkmark"></span>
  637. </label>
  638. </div>
  639. </div>
  640. <div class="modal-footer">
  641. <h3 style="font-size: 17px;">Edit and live save your changes !</h3>
  642. <p>Thanks for 40 subs (JackLaL)</p>
  643. </div>
  644. </div>
  645. </div>
  646. `
  647. document.body.appendChild(menuChange)
  648.  
  649.  
  650. $("#tankGear").on("input", () => {
  651. var cval = $("#tankGear").val();
  652. if (cval){
  653. TankGearKey = cval.toUpperCase();
  654. TankGearKey = TankGearKey.charCodeAt(0);
  655. console.log(TankGearKey);
  656. }
  657. });
  658.  
  659. $("#bullHelm").on("input", () => {
  660. var cval = $("#bullHelm").val();
  661. if (cval){
  662. BullHelmetKey = cval.toUpperCase();
  663. BullHelmetKey = BullHelmetKey.charCodeAt(0);
  664. console.log(BullHelmetKey);
  665. }
  666. });
  667.  
  668. $("#soldier").on("input", () => {
  669. var cval = $("#soldier").val();
  670. if (cval){
  671. SoldierHelmetKey = cval.toUpperCase();
  672. SoldierHelmetKey = SoldierHelmetKey.charCodeAt(0);
  673. console.log(SoldierHelmetKey);
  674. }
  675. });
  676.  
  677. $("#turret").on("input", () => {
  678. var cval = $("#turret").val();
  679. if (cval){
  680. TurretKey = cval.toUpperCase();
  681. TurretKey = TurretKey.charCodeAt(0);
  682. console.log(TurretKey);
  683. }
  684. });
  685.  
  686.  
  687.  
  688. $("#emp").on("input", () => {
  689. var cval = $("#emp").val();
  690. if (cval){
  691. EmpKey = cval.toUpperCase();
  692. EmpKey = EmpKey.charCodeAt(0);
  693. console.log(EmpKey);
  694. }
  695. });
  696.  
  697. $("#samu").on("input", () => {
  698. var cval = $("#samu").val();
  699. if (cval){
  700. SamuKey = cval.toUpperCase();
  701. SamuKey = SamuKey.charCodeAt(0);
  702. console.log(SamuKey);
  703. }
  704. });
  705.  
  706. $("#booster").on("input", () => {
  707. var cval = $("#booster").val();
  708. if (cval){
  709. BoosterHatKey = cval.toUpperCase();
  710. BoosterHatKey = BoosterHatKey.charCodeAt(0);
  711. console.log(BoosterHatKey);
  712. }
  713. });
  714.  
  715. $("#spikeg").on("input", () => {
  716. var cval = $("#spikeg").val();
  717. if (cval){
  718. SpikeGearKey = cval.toUpperCase();
  719. SpikeGearKey = SpikeGearKey.charCodeAt(0);
  720. console.log(SpikeGearKey);
  721. }
  722. });
  723.  
  724. $("#trap").on("input", () => {
  725. var cval = $("#trap").val();
  726. if (cval){
  727. TrapKey = cval.toUpperCase();
  728. TrapKey = TrapKey.charCodeAt(0);
  729. console.log(TrapKey);
  730. }
  731. });
  732.  
  733. var styleItem = document.createElement("style");
  734. styleItem.type = "text/css";
  735. styleItem.appendChild(document.createTextNode(`
  736. .keyPressLow {
  737. margin-left: 8px;
  738. font-size: 16px;
  739. margin-right: 8px;
  740. height: 25px;
  741. width: 50px;
  742. background-color: #fcfcfc;
  743. border-radius: 3.5px;
  744. border: none;
  745. text-align: center;
  746. color: #4A4A4A;
  747. border: 0.5px solid #f2f2f2;
  748. }
  749.  
  750. .menuPrompt {
  751. font-size: 17px;
  752. font-family: 'Hammersmith One';
  753. color: #4A4A4A;
  754. flex: 0.2;
  755. text-align: center;
  756. margin-top: 10px;
  757. display: inline-block;
  758. }
  759.  
  760. .modal {
  761. display: none;
  762. position: fixed;
  763. z-index: 1;
  764. left: 0;
  765. top: 0;
  766. overflow: auto;
  767. height: 100%;
  768. width: 100%;
  769. }
  770.  
  771. .modal-content {
  772. margin: 10% auto;
  773. width: 40%;
  774. box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.2), 0 7px 20px 0 rgba(0, 0, 0, 0.17);
  775. font-size: 14px;
  776. line-height: 1.6;
  777. }
  778.  
  779. .modal-header h2,
  780. .modal-footer h3 {
  781. margin: 0;
  782. }
  783.  
  784. .modal-header {
  785. background: #cf2727;
  786. padding: 15px;
  787. color: #fff;
  788. border-top-left-radius: 5px;
  789. border-top-right-radius: 5px;
  790. }
  791.  
  792. .modal-body {
  793. padding: 10px 20px;
  794. background: #fff;
  795. }
  796.  
  797. .modal-footer {
  798. background: #cf2727;
  799. padding: 10px;
  800. color: #fff;
  801. text-align: center;
  802. border-bottom-left-radius: 5px;
  803. border-bottom-right-radius: 5px;
  804. }
  805.  
  806. .closeBtn {
  807. color: #ccc;
  808. float: right;
  809. font-size: 30px;
  810. color: #fff;
  811. }
  812.  
  813. .closeBtn:hover,
  814. .closeBtn:focus {
  815. color: #000;
  816. text-decoration: none;
  817. cursor: pointer;
  818. }
  819.  
  820. /* Customize the label (the container) */
  821. .container {
  822. display: block;
  823. position: relative;
  824. padding-left: 35px;
  825. margin-bottom: 12px;
  826. cursor: pointer;
  827. font-size: 16px;
  828. -webkit-user-select: none;
  829. -moz-user-select: none;
  830. -ms-user-select: none;
  831. user-select: none;
  832. }
  833.  
  834. /* Hide the browser's default checkbox */
  835. .container input {
  836. position: absolute;
  837. opacity: 0;
  838. cursor: pointer;
  839. height: 0;
  840. width: 0;
  841. }
  842.  
  843. /* Create a custom checkbox */
  844. .checkmark {
  845. position: absolute;
  846. top: 0;
  847. left: 0;
  848. height: 25px;
  849. width: 25px;
  850. background-color: #eee;
  851. }
  852.  
  853. /* On mouse-over, add a grey background color */
  854. .container:hover input ~ .checkmark {
  855. background-color: #ccc;
  856. }
  857.  
  858. /* When the checkbox is checked, add a red background */
  859. .container input:checked ~ .checkmark {
  860. background-color: #cf2727;
  861. }
  862.  
  863. /* Create the checkmark/indicator (hidden when not checked) */
  864. .checkmark:after {
  865. content: "";
  866. position: absolute;
  867. display: none;
  868. }
  869.  
  870. /* Show the checkmark when checked */
  871. .container input:checked ~ .checkmark:after {
  872. display: block;
  873. }
  874.  
  875. /* Style the checkmark/indicator */
  876. .container .checkmark:after {
  877. left: 9px;
  878. top: 5px;
  879. width: 5px;
  880. height: 10px;
  881. border: solid white;
  882. border-width: 0 3px 3px 0;
  883. -webkit-transform: rotate(45deg);
  884. -ms-transform: rotate(45deg);
  885. transform: rotate(45deg);
  886. }
  887.  
  888. `))
  889. document.head.appendChild(styleItem);
  890.  
  891.  
  892. $("#adCard").css({display: "none"});
  893.  
  894.  
  895. document.addEventListener('keydown', function(e) {
  896. if (e.keyCode == uneqiup && document.activeElement.id.toLowerCase() !== 'chatbox'){
  897. console.log("done")
  898. storeEquip(0);
  899. } else if (e.keyCode == 27){
  900. if (modal.style.display = "none") {
  901. modal.style.display = "block";
  902. } else {
  903. modal.style.display = "none";
  904. }
  905. } else if (e.keyCode == TankGearKey && document.activeElement.id.toLowerCase() !== 'chatbox'){
  906. storeEquip(ID_TankGear);
  907. } else if (e.keyCode == SoldierHelmetKey && document.activeElement.id.toLowerCase() !== 'chatbox'){
  908. storeEquip(ID_SoldierHelmet);
  909. } else if (e.keyCode == BullHelmetKey && document.activeElement.id.toLowerCase() !== 'chatbox'){
  910. storeEquip(ID_BullHelmet);
  911. } else if (e.keyCode == BoosterHatKey && document.activeElement.id.toLowerCase() !== 'chatbox'){
  912. storeEquip(ID_BoosterHat);
  913. } else if (e.keyCode == EmpKey && document.activeElement.id.toLowerCase() !== 'chatbox'){
  914. storeEquip(ID_EmpHelmet);
  915. } else if (e.keyCode == SamuKey && document.activeElement.id.toLowerCase() !== 'chatbox'){
  916. storeEquip(ID_SamuraiArmor);
  917. } else if (e.keyCode == SpikeGearKey && document.activeElement.id.toLowerCase() !== 'chatbox'){
  918. storeEquip(ID_SpikeGear);
  919. } else if (e.keyCode == TurretKey && document.activeElement.id.toLowerCase() !== 'chatbox'){
  920. storeEquip(ID_TurretGear);
  921. }
  922. })
  923.  
  924. // Get modal element
  925. var modal = document.getElementById("simpleModal");
  926. // Get close button
  927. var closeBtn = document.getElementsByClassName('closeBtn')[0];
  928.  
  929. // Events
  930. closeBtn.addEventListener('click', closeModal);
  931. window.addEventListener('click', outsideClick);
  932.  
  933. // Close
  934. function closeModal() {
  935. modal.style.display = 'none';
  936. }
  937.  
  938. // Close If Outside Click
  939. function outsideClick(e) {
  940. if (e.target == modal) {
  941. modal.style.display = 'none';
  942. }
  943. }
  944.  
  945. var checkbox = document.querySelector("#myCheck")
  946.  
  947. checkbox.addEventListener('change', function() {
  948. if (this.checked) {
  949. $("#mapDisplay").css({background: `url('https://i.imgur.com/fgFsQJp.png')`});
  950. console.log('checked')
  951. } else {
  952. $("#mapDisplay").css({background: `rgba(0, 0, 0, 0.25)`})
  953. console.log('unchecked')
  954. }
  955. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement