Advertisement
xXicefireXx

moomoo.io [Cloudy mod] [by icefireAlan]

Jul 26th, 2019
2,185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        ScriptSource: The Leading Portal for Web Apps [YouTube/Quora/Reddit/Discord/+More]
  3. // @namespace    -
  4. // @version      40.1
  5. // @description  Currently trusted by over 100,000 users!
  6. // @author       Sammy «Z»#7383
  7. // @match        *://sandbox.moomoo.io/*
  8. // @match        *://moomoo.io/*
  9. // @match        *://dev.moomoo.io/*
  10. // @grant        GM_xmlhttpRequest
  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. // @require https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.10/pako.js
  16. // @run-at       document-start
  17. // ==/UserScript==
  18.  
  19. var msgpack5 = msgpack;
  20.  
  21. if (window.location.href.includes("reddit") && false){ // "Old reddit, please!"
  22.    if (window.location.href.includes("/r/")){
  23.       let splitPage = window.location.href;
  24.       if (splitPage.substr(-1) === "/") splitPage = splitPage.slice(0, -1);
  25.       splitPage = splitPage.split("/");
  26.       let subName = splitPage[4];
  27.       let pageSort = splitPage[5];
  28.       GM_xmlhttpRequest({
  29.           method: "GET",
  30.           url: `http://api.pushshift.io/reddit/submission/search?subreddit=${subName}&limit=100&sort=${pageSort || "hot"}`,
  31.           onload: jsresp => {
  32.              let mainPosts = JSON.parse(jsresp.responseText);
  33.           }
  34.       });
  35.    }
  36.  
  37. } else if (window.location.href.includes("youtube")) {
  38.   var currentTitle = "";
  39.   setInterval(() => {
  40.      if (window.location.href.includes("watch")){
  41.          if (document.title != currentTitle || !(document.querySelector("#timeBtn"))){
  42.              let btn = document.createElement("button");
  43.              btn.id = "timeBtn";
  44.              btn.style = "width: 150px; height: 50px; font-size: 17.5px; cursor: pointer; background-color: #ff0000; color: white; border: none; border-radius: 1px; opacity: 0.95; outline: none; box-shadow: 0 10px 30px 0 rgba(73,85,114,.18);";
  45.              btn.innerText = "Get Time!";
  46.              document.querySelector("#meta-contents").appendChild(btn);
  47.              currentTitle = document.title;
  48.              $(btn).click(() => {
  49.                  let w = window.open("http://scriptsourceapp.com/portal.html?yturl="+window.location.href.split("v=")[1], null, `height=497, width=1009, status=yes, toolbar=no, menubar=no, location=no`);
  50.              });
  51.          }
  52.      }
  53.   }, 50);
  54. } else if (window.location.href.includes("quora")){
  55.    window.stop();
  56.    let requrl = window.location.href;
  57.    document.innerHTML = ``;
  58.    GM_xmlhttpRequest({
  59.        method: "GET",
  60.        url: requrl,
  61.        headers: {
  62.          referer: "https://www.google.com"
  63.        },
  64.        onload: resp => {
  65.             let rtext = resp.responseText;
  66.             document.open();
  67.             document.write(rtext);
  68.             document.close();
  69.        }
  70.    })
  71. } else if (window.location.href.includes("discordapp")){
  72.     let token = unsafeWindow.localStorage.token;
  73.     var heartBeat = false;
  74.     var heartBeatVal = null;
  75.     var alldata = [];
  76.     var allMessages;
  77.     var savedMessageWrap;
  78.     var focus;
  79.  
  80.     GM_xmlhttpRequest({
  81.     method: "GET",
  82.     url: `https://discordapp.com/api/v6/gateway`,
  83.     onload: jsresp => {
  84.         let url = JSON.parse(jsresp.responseText).url;
  85.         console.log(url);
  86.         let ws = new WebSocket(url+`/?encoding=json&v=6`);
  87.         ws.onopen = (data) => {
  88.           console.log('SS WebSocket opened!');
  89.           var d = {
  90.              token: token.replace('"','').replace('"', ''),
  91.              "properties": {
  92.                 "$os": "linux",
  93.                 "$browser": "disco",
  94.                 "$device": "disco"
  95.              },
  96.              shard: [0, 1],
  97.              compress: false,
  98.              large_threshold: 250,
  99.           }
  100.           console.log(token);
  101.           ws.send(JSON.stringify({op: 2, d: d}))
  102.         }
  103.  
  104.         ws.onmessage = (msg) => {
  105.           let data = JSON.parse(msg.data);
  106.           console.log(data);
  107.           heartBeatVal = data.s;
  108.           if (!heartBeat){
  109.              ws.send(JSON.stringify({op: 1, d: heartBeatVal}));
  110.              heartBeat = true;
  111.              setInterval(() => {
  112.                 console.log("Sent HeartBeat Response!");
  113.                 ws.send(JSON.stringify({op: 1, d: heartBeatVal}));
  114.              }, data.d.heartbeat_interval);
  115.           }
  116.  
  117.              if (!allMessages || allMessages.length == 0) allMessages  = document.querySelectorAll("div[class^=messageCozy]");
  118.              let newMessages = document.querySelectorAll("div[class^=messageCozy]");
  119.              var toCompare = Array.from(newMessages).map(x=>x.innerHTML);
  120.              if (!focus || focus.length == 0) focus = document.querySelectorAll("div[class^=containerCozyBounded]");
  121.              if (focus[0].offsetTop == 0)
  122.              {
  123.                  //console.log(allMessages)
  124.                  focus = document.querySelectorAll("div[class^=containerCozyBounded]");
  125.                  allMessages = document.querySelectorAll("div[class^=messageCozy]");
  126.                  //console.log(allMessages);
  127.  
  128.              }
  129.  
  130.              if (data.t == "MESSAGE_DELETE"){
  131.                  for (let iddata of Array.from(allMessages).entries()){
  132.                      let index = iddata[0];
  133.                      let element = iddata[1];
  134.                      if (!toCompare.includes(element.innerHTML) && !element.innerHTML.includes(`class="isSending`)){
  135.                         if (index >= 20){
  136.                             element.style.opacity = 1
  137.                             //element.style.backgroundColor = "rgba(232, 83, 83, 0.4)";
  138.                             console.log(newMessages[index-1].parentElement);
  139.                             try {
  140.                                 //newMessages[index-1].parentElement.insertBefore(element, newMessages[index]);
  141.                                 throw "err";
  142.                             } catch(e) {
  143.                                 console.log('error');
  144.                                 console.log(newMessages[index-1].parentElement.parentElement);
  145.                                 let testDiv = document.createElement("div");
  146.                                 console.log(element);
  147.                                 testDiv.innerHTML = `<div style="background-color: rgba(232, 83, 83, 0.4);" class="containerCozyBounded-1rKFAn containerCozy-jafyvG container-1YxwTf">${element.outerHTML}</div>`
  148.                                 try {
  149.                                     let mparent = newMessages[index].parentElement.parentElement
  150.                                     let tparent = newMessages[index].parentElement;
  151.                                     console.log(mparent);
  152.                                     console.log(tparent);
  153.                                     mparent.insertBefore(testDiv, tparent);
  154.                                 } catch(e) {
  155.                                     let mparent = newMessages[index-1].parentElement.parentElement
  156.                                     let tparent = newMessages[index-1].parentElement;
  157.                                     console.log(mparent);
  158.                                     console.log(tparent);
  159.                                     mparent.appendChild(testDiv);
  160.                                 }
  161.                                 //mparent.appendChild(testDiv);
  162.                             }
  163.  
  164.  
  165.                         }
  166.  
  167.                     }
  168.  
  169.                 }
  170.             }
  171.  
  172.             allMessages = newMessages;
  173.  
  174.        }
  175.  
  176.        ws.onclose = (data) => {
  177.         console.log('SS Closed');
  178.         console.log(data);
  179.        }
  180.        }
  181.  
  182.    });
  183.  
  184.  
  185. } else if (window.location.href.includes("moomoo")){
  186.    window.localStorage.moofoll = "1";
  187.    $(document).ready(() => {
  188.  
  189. //Neat cursor: credit to FlareZ 3301#6016
  190. $("#gameCanvas").css('cursor', 'url(http://cur.cursors-4u.net/user/use-1/use153.cur), default');
  191. $("#consentBlock").css({display: "none"});
  192. var autoHealSpeed = 150; //Bigger number = SLOWER autoheal; fastest is 0.
  193. var DEFAULT_HAT = 7;
  194. var DEFAULT_WINGS = 18;
  195. var instaKillKey = 114;
  196. var spikeKey = 118;
  197. var trapKey = 102;
  198. var removeMonkeyTail = true;
  199. var askMeAgain = true; //set this to false if the user doesnt want to be asked about hat switching again
  200.  
  201. var allTraps = [];
  202. var CORESTATE = {
  203.         inwater: {active: false},
  204.         nearenemy: {active: false},
  205.         intrap: {active: false},
  206.         ipress: {active: false},
  207. };
  208.  
  209. try {
  210. document.getElementById("moomooio_728x90_home").style.display = "none"; //Remove sidney's ads
  211.    $("#moomooio_728x90_home").parent().css({display: "none"});
  212. } catch (e) {
  213.  console.log("error removing ad");
  214. }
  215.  
  216. unsafeWindow.onbeforeunload = null;
  217.  
  218.  
  219. let coreURL =  new URL(window.location.href);
  220. window.sessionStorage.force = coreURL.searchParams.get("fc");
  221.  
  222.  
  223. if (window.sessionStorage.force != "false" && window.sessionStorage.force && window.sessionStorage.force.toString() != "null"){
  224.    console.error(window.sessionStorage.force);
  225.    /*alert(window.location.force);*/
  226.    document.getElementsByClassName("menuHeader")[0].innerHTML = `Servers <span style="color: red;">Force (${window.sessionStorage.force})</span>`;
  227. }
  228.  
  229.  
  230. var oldAlert = unsafeWindow.alert;
  231. unsafeWindow.alert = function(){
  232.    $.alert({title: "Full Server!",
  233.            content: "This server is full! Would you like to force connect?",
  234.            useBootstrap: false,
  235.            buttons: {
  236.                  Back: () => { unsafeWindow.onbeforeunload = null; window.location = "http://moomoo.io"; },
  237.                   Yes: () => {
  238.                           let coreURL =  new URL(window.location.href);
  239.                           let server = coreURL.searchParams.get("server");
  240.                           window.sessionStorage.force = server;
  241.                           window.sessionStorage.dog = server;
  242.                           console.error(window.sessionStorage.force);
  243.                           console.error(window.sessionStorage.dog);
  244.                           console.error(server);
  245.                           setTimeout(() => {
  246.                                    console.error(window.sessionStorage.force);
  247.                                   window.location = `http://moomoo.io?fc=${server}`;
  248.                           }, 500);
  249.                   },
  250.             }
  251.             });
  252. }
  253.  
  254.  
  255. class ForceSocket extends WebSocket {
  256.           constructor(...args){
  257.               if (window.sessionStorage.force != "false" && window.sessionStorage.force && window.sessionStorage.force.toString() != "null"){
  258.                   let server = window.sessionStorage.force;
  259.                   let sip = "";
  260.                   for (let gameServer of window.vultr.servers){
  261.                       if (`${gameServer.region}:${gameServer.index}:0` == server){
  262.                                sip = gameServer.ip;
  263.                       }
  264.                   }
  265.                   args[0] = `wss://ip_${sip}.moomoo.io:8008/?gameIndex=0`;
  266.  
  267.                   console.error("Setting false");
  268.                   console.error(args[0]);
  269.                   delete window.sessionStorage.force;
  270.               }
  271.  
  272.              super(...args);
  273.  
  274.           }
  275.  
  276.  
  277. }
  278.  
  279. WebSocket = ForceSocket;
  280.  
  281.  
  282. unsafeWindow.admob = {
  283.     requestInterstitialAd: ()=>{},
  284.     showInterstitialAd: ()=>{}
  285. }
  286.  
  287.  
  288. var accessories = [{
  289.         id: 12,
  290.         name: "Snowball",
  291.         price: 1e3,
  292.         scale: 105,
  293.         xOff: 18,
  294.         desc: "no effect"
  295.     }, {
  296.         id: 9,
  297.         name: "Tree Cape",
  298.         price: 1e3,
  299.         scale: 90,
  300.         desc: "no effect"
  301.     }, {
  302.         id: 10,
  303.         name: "Stone Cape",
  304.         price: 1e3,
  305.         scale: 90,
  306.         desc: "no effect"
  307.     }, {
  308.         id: 3,
  309.         name: "Cookie Cape",
  310.         price: 1500,
  311.         scale: 90,
  312.         desc: "no effect"
  313.     }, {
  314.         id: 8,
  315.         name: "Cow Cape",
  316.         price: 2e3,
  317.         scale: 90,
  318.         desc: "no effect"
  319.     }, {
  320.         id: 11,
  321.         name: "Monkey Tail",
  322.         price: 2e3,
  323.         scale: 97,
  324.         xOff: 25,
  325.         desc: "Super speed but reduced damage",
  326.         spdMult: 1.35,
  327.         dmgMultO: .2
  328.     }, {
  329.         id: 17,
  330.         name: "Apple Basket",
  331.         price: 3e3,
  332.         scale: 80,
  333.         xOff: 12,
  334.         desc: "slowly regenerates health over time",
  335.         healthRegen: 1
  336.     }, {
  337.         id: 6,
  338.         name: "Winter Cape",
  339.         price: 3e3,
  340.         scale: 90,
  341.         desc: "no effect"
  342.     }, {
  343.         id: 4,
  344.         name: "Skull Cape",
  345.         price: 4e3,
  346.         scale: 90,
  347.         desc: "no effect"
  348.     }, {
  349.         id: 5,
  350.         name: "Dash Cape",
  351.         price: 5e3,
  352.         scale: 90,
  353.         desc: "no effect"
  354.     }, {
  355.         id: 2,
  356.         name: "Dragon Cape",
  357.         price: 6e3,
  358.         scale: 90,
  359.         desc: "no effect"
  360.     }, {
  361.         id: 1,
  362.         name: "Super Cape",
  363.         price: 8e3,
  364.         scale: 90,
  365.         desc: "no effect"
  366.     }, {
  367.         id: 7,
  368.         name: "Troll Cape",
  369.         price: 8e3,
  370.         scale: 90,
  371.         desc: "no effect"
  372.     }, {
  373.         id: 14,
  374.         name: "Thorns",
  375.         price: 1e4,
  376.         scale: 115,
  377.         xOff: 20,
  378.         desc: "no effect"
  379.     }, {
  380.         id: 15,
  381.         name: "Blockades",
  382.         price: 1e4,
  383.         scale: 95,
  384.         xOff: 15,
  385.         desc: "no effect"
  386.     }, {
  387.         id: 20,
  388.         name: "Devils Tail",
  389.         price: 1e4,
  390.         scale: 95,
  391.         xOff: 20,
  392.         desc: "no effect"
  393.     }, {
  394.         id: 16,
  395.         name: "Sawblade",
  396.         price: 12e3,
  397.         scale: 90,
  398.         spin: !0,
  399.         xOff: 0,
  400.         desc: "deal damage to players that damage you",
  401.         dmg: .15
  402.     }, {
  403.         id: 13,
  404.         name: "Angel Wings",
  405.         price: 15e3,
  406.         scale: 138,
  407.         xOff: 22,
  408.         desc: "slowly regenerates health over time",
  409.         healthRegen: 3
  410.     }, {
  411.         id: 19,
  412.         name: "Shadow Wings",
  413.         price: 15e3,
  414.         scale: 138,
  415.         xOff: 22,
  416.         desc: "increased movement speed",
  417.         spdMult: 1.1
  418.     }, {
  419.         id: 18,
  420.         name: "Blood Wings",
  421.         price: 2e4,
  422.         scale: 178,
  423.         xOff: 26,
  424.         desc: "restores health when you deal damage",
  425.         healD: .2
  426.     }, {
  427.         id: 21,
  428.         name: "Corrupt X Wings",
  429.         price: 2e4,
  430.         scale: 178,
  431.         xOff: 26,
  432.         desc: "deal damage to players that damage you",
  433.         dmg: .25
  434.     }]
  435.  
  436.  
  437. var hats = hats = [{
  438.         id: 45,
  439.         name: "Shame!",
  440.         dontSell: !0,
  441.         price: 0,
  442.         scale: 120,
  443.         desc: "hacks are for losers"
  444.     }, {
  445.         id: 51,
  446.         name: "Moo Cap",
  447.         price: 0,
  448.         scale: 120,
  449.         desc: "coolest mooer around"
  450.     }, {
  451.         id: 50,
  452.         name: "Apple Cap",
  453.         price: 0,
  454.         scale: 120,
  455.         desc: "apple farms remembers"
  456.     }, {
  457.         id: 28,
  458.         name: "Moo Head",
  459.         price: 0,
  460.         scale: 120,
  461.         desc: "no effect"
  462.     }, {
  463.         id: 29,
  464.         name: "Pig Head",
  465.         price: 0,
  466.         scale: 120,
  467.         desc: "no effect"
  468.     }, {
  469.         id: 30,
  470.         name: "Fluff Head",
  471.         price: 0,
  472.         scale: 120,
  473.         desc: "no effect"
  474.     }, {
  475.         id: 36,
  476.         name: "Pandou Head",
  477.         price: 0,
  478.         scale: 120,
  479.         desc: "no effect"
  480.     }, {
  481.         id: 37,
  482.         name: "Bear Head",
  483.         price: 0,
  484.         scale: 120,
  485.         desc: "no effect"
  486.     }, {
  487.         id: 38,
  488.         name: "Monkey Head",
  489.         price: 0,
  490.         scale: 120,
  491.         desc: "no effect"
  492.     }, {
  493.         id: 44,
  494.         name: "Polar Head",
  495.         price: 0,
  496.         scale: 120,
  497.         desc: "no effect"
  498.     }, {
  499.         id: 35,
  500.         name: "Fez Hat",
  501.         price: 0,
  502.         scale: 120,
  503.         desc: "no effect"
  504.     }, {
  505.         id: 42,
  506.         name: "Enigma Hat",
  507.         price: 0,
  508.         scale: 120,
  509.         desc: "join the enigma army"
  510.     }, {
  511.         id: 43,
  512.         name: "Blitz Hat",
  513.         price: 0,
  514.         scale: 120,
  515.         desc: "hey everybody i'm blitz"
  516.     }, {
  517.         id: 49,
  518.         name: "Bob XIII Hat",
  519.         price: 0,
  520.         scale: 120,
  521.         desc: "like and subscribe"
  522.     }, {
  523.         id: 8,
  524.         name: "Bummle Hat",
  525.         price: 100,
  526.         scale: 120,
  527.         desc: "no effect"
  528.     }, {
  529.         id: 2,
  530.         name: "Straw Hat",
  531.         price: 500,
  532.         scale: 120,
  533.         desc: "no effect"
  534.     }, {
  535.         id: 15,
  536.         name: "Winter Cap",
  537.         price: 600,
  538.         scale: 120,
  539.         desc: "allows you to move at normal speed in snow",
  540.         coldM: 1
  541.     }, {
  542.         id: 5,
  543.         name: "Cowboy Hat",
  544.         price: 1e3,
  545.         scale: 120,
  546.         desc: "no effect"
  547.     }, {
  548.         id: 4,
  549.         name: "Ranger Hat",
  550.         price: 2e3,
  551.         scale: 120,
  552.         desc: "no effect"
  553.     }, {
  554.         id: 18,
  555.         name: "Explorer Hat",
  556.         price: 2e3,
  557.         scale: 120,
  558.         desc: "no effect"
  559.     }, {
  560.         id: 31,
  561.         name: "Flipper Hat",
  562.         price: 2500,
  563.         scale: 120,
  564.         desc: "have more control while in water",
  565.         watrImm: !0
  566.     }, {
  567.         id: 1,
  568.         name: "Marksman Cap",
  569.         price: 3e3,
  570.         scale: 120,
  571.         desc: "increases arrow speed and range",
  572.         aMlt: 1.3
  573.     }, {
  574.         id: 10,
  575.         name: "Bush Gear",
  576.         price: 3e3,
  577.         scale: 160,
  578.         desc: "allows you to disguise yourself as a bush"
  579.     }, {
  580.         id: 48,
  581.         name: "Halo",
  582.         price: 3e3,
  583.         scale: 120,
  584.         desc: "no effect"
  585.     }, {
  586.         id: 6,
  587.         name: "Soldier Helmet",
  588.         price: 4e3,
  589.         scale: 120,
  590.         desc: "reduces damage taken but slows movement",
  591.         spdMult: .94,
  592.         dmgMult: .75
  593.     }, {
  594.         id: 23,
  595.         name: "Anti Venom Gear",
  596.         price: 4e3,
  597.         scale: 120,
  598.         desc: "makes you immune to poison",
  599.         poisonRes: 1
  600.     }, {
  601.         id: 13,
  602.         name: "Medic Gear",
  603.         price: 5e3,
  604.         scale: 110,
  605.         desc: "slowly regenerates health over time",
  606.         healthRegen: 3
  607.     }, {
  608.         id: 9,
  609.         name: "Miners Helmet",
  610.         price: 5e3,
  611.         scale: 120,
  612.         desc: "earn 1 extra gold per resource",
  613.         extraGold: 1
  614.     }, {
  615.         id: 32,
  616.         name: "Musketeer Hat",
  617.         price: 5e3,
  618.         scale: 120,
  619.         desc: "reduces cost of projectiles",
  620.         projCost: .5
  621.     }, {
  622.         id: 7,
  623.         name: "Bull Helmet",
  624.         price: 6e3,
  625.         scale: 120,
  626.         desc: "increases damage done but drains health",
  627.         healthRegen: -5,
  628.         dmgMultO: 1.5,
  629.         spdMult: .96
  630.     }, {
  631.         id: 22,
  632.         name: "Emp Helmet",
  633.         price: 6e3,
  634.         scale: 120,
  635.         desc: "turrets won't attack but you move slower",
  636.         antiTurret: 1,
  637.         spdMult: .7
  638.     }, {
  639.         id: 12,
  640.         name: "Booster Hat",
  641.         price: 6e3,
  642.         scale: 120,
  643.         desc: "increases your movement speed",
  644.         spdMult: 1.16
  645.     }, {
  646.         id: 26,
  647.         name: "Barbarian Armor",
  648.         price: 8e3,
  649.         scale: 120,
  650.         desc: "knocks back enemies that attack you",
  651.         dmgK: .6
  652.     }, {
  653.         id: 21,
  654.         name: "Plague Mask",
  655.         price: 1e4,
  656.         scale: 120,
  657.         desc: "melee attacks deal poison damage",
  658.         poisonDmg: 5,
  659.         poisonTime: 6
  660.     }, {
  661.         id: 46,
  662.         name: "Bull Mask",
  663.         price: 1e4,
  664.         scale: 120,
  665.         desc: "bulls won't target you unless you attack them",
  666.         bullRepel: 1
  667.     }, {
  668.         id: 14,
  669.         name: "Windmill Hat",
  670.         topSprite: !0,
  671.         price: 1e4,
  672.         scale: 120,
  673.         desc: "generates points while worn",
  674.         pps: 1.5
  675.     }, {
  676.         id: 11,
  677.         name: "Spike Gear",
  678.         topSprite: !0,
  679.         price: 1e4,
  680.         scale: 120,
  681.         desc: "deal damage to players that damage you",
  682.         dmg: .45
  683.     }, {
  684.         id: 53,
  685.         name: "Turret Gear",
  686.         topSprite: !0,
  687.         price: 1e4,
  688.         scale: 120,
  689.         desc: "you become a walking turret",
  690.         turret: {
  691.             proj: 1,
  692.             range: 700,
  693.             rate: 2500
  694.         },
  695.         spdMult: .5
  696.     }, {
  697.         id: 20,
  698.         name: "Samurai Armor",
  699.         price: 12e3,
  700.         scale: 120,
  701.         desc: "increased attack speed and fire rate",
  702.         atkSpd: .78
  703.     }, {
  704.         id: 16,
  705.         name: "Bushido Armor",
  706.         price: 12e3,
  707.         scale: 120,
  708.         desc: "restores health when you deal damage",
  709.         healD: .4
  710.     }, {
  711.         id: 27,
  712.         name: "Scavenger Gear",
  713.         price: 15e3,
  714.         scale: 120,
  715.         desc: "earn double points for each kill",
  716.         kScrM: 2
  717.     }, {
  718.         id: 40,
  719.         name: "Tank Gear",
  720.         price: 15e3,
  721.         scale: 120,
  722.         desc: "increased damage to buildings but slower movement",
  723.         spdMult: .3,
  724.         bDmg: 3.3
  725.     }, {
  726.         id: 52,
  727.         name: "Thief Gear",
  728.         price: 15e3,
  729.         scale: 120,
  730.         desc: "steal half of a players gold when you kill them",
  731.         goldSteal: .5
  732.     }]
  733.  
  734.  
  735. var objects = [{
  736.         id: 0,
  737.         name: "food",
  738.         layer: 0
  739.     }, {
  740.         id: 1,
  741.         name: "walls",
  742.         place: !0,
  743.         limit: 30,
  744.         layer: 0
  745.     }, {
  746.         id: 2,
  747.         name: "spikes",
  748.         place: !0,
  749.         limit: 15,
  750.         layer: 0
  751.     }, {
  752.         id: 3,
  753.         name: "mill",
  754.         place: !0,
  755.         limit: 7,
  756.         layer: 1
  757.     }, {
  758.         id: 4,
  759.         name: "mine",
  760.         place: !0,
  761.         limit: 1,
  762.         layer: 0
  763.     }, {
  764.         id: 5,
  765.         name: "trap",
  766.         place: !0,
  767.         limit: 6,
  768.         layer: -1
  769.     }, {
  770.         id: 6,
  771.         name: "booster",
  772.         place: !0,
  773.         limit: 12,
  774.         layer: -1
  775.     }, {
  776.         id: 7,
  777.         name: "turret",
  778.         place: !0,
  779.         limit: 2,
  780.         layer: 1
  781.     }, {
  782.         id: 8,
  783.         name: "watchtower",
  784.         place: !0,
  785.         limit: 12,
  786.         layer: 1
  787.     }, {
  788.         id: 9,
  789.         name: "buff",
  790.         place: !0,
  791.         limit: 4,
  792.         layer: -1
  793.     }, {
  794.         id: 10,
  795.         name: "spawn",
  796.         place: !0,
  797.         limit: 1,
  798.         layer: -1
  799.     }, {
  800.         id: 11,
  801.         name: "sapling",
  802.         place: !0,
  803.         limit: 2,
  804.         layer: 0
  805.     }, {
  806.         id: 12,
  807.         name: "blocker",
  808.         place: !0,
  809.         limit: 3,
  810.         layer: -1
  811.     }, {
  812.         id: 13,
  813.         name: "teleporter",
  814.         place: !0,
  815.         limit: 1,
  816.         layer: -1
  817.     }]
  818.  
  819.     var weapons = [{
  820.         id: 0,
  821.         type: 0,
  822.         name: "tool hammer",
  823.         desc: "tool for gathering all resources",
  824.         src: "hammer_1",
  825.         length: 140,
  826.         width: 140,
  827.         xOff: -3,
  828.         yOff: 18,
  829.         dmg: 25,
  830.         range: 65,
  831.         gather: 1,
  832.         speed: 300
  833.     }, {
  834.         id: 1,
  835.         type: 0,
  836.         age: 2,
  837.         name: "hand axe",
  838.         desc: "gathers resources at a higher rate",
  839.         src: "axe_1",
  840.         length: 140,
  841.         width: 140,
  842.         xOff: 3,
  843.         yOff: 24,
  844.         dmg: 30,
  845.         spdMult: 1,
  846.         range: 70,
  847.         gather: 2,
  848.         speed: 400
  849.     }, {
  850.         id: 2,
  851.         type: 0,
  852.         age: 8,
  853.         pre: 1,
  854.         name: "great axe",
  855.         desc: "deal more damage and gather more resources",
  856.         src: "great_axe_1",
  857.         length: 140,
  858.         width: 140,
  859.         xOff: -8,
  860.         yOff: 25,
  861.         dmg: 35,
  862.         spdMult: 1,
  863.         range: 75,
  864.         gather: 4,
  865.         speed: 400
  866.     }, {
  867.         id: 3,
  868.         type: 0,
  869.         age: 2,
  870.         name: "short sword",
  871.         desc: "increased attack power but slower move speed",
  872.         src: "sword_1",
  873.         iPad: 1.3,
  874.         length: 130,
  875.         width: 210,
  876.         xOff: -8,
  877.         yOff: 46,
  878.         dmg: 35,
  879.         spdMult: .85,
  880.         range: 110,
  881.         gather: 1,
  882.         speed: 300
  883.     }, {
  884.         id: 4,
  885.         type: 0,
  886.         age: 8,
  887.         pre: 3,
  888.         name: "katana",
  889.         desc: "greater range and damage",
  890.         src: "samurai_1",
  891.         iPad: 1.3,
  892.         length: 130,
  893.         width: 210,
  894.         xOff: -8,
  895.         yOff: 59,
  896.         dmg: 40,
  897.         spdMult: .8,
  898.         range: 118,
  899.         gather: 1,
  900.         speed: 300
  901.     }, {
  902.         id: 5,
  903.         type: 0,
  904.         age: 2,
  905.         name: "polearm",
  906.         desc: "long range melee weapon",
  907.         src: "spear_1",
  908.         iPad: 1.3,
  909.         length: 130,
  910.         width: 210,
  911.         xOff: -8,
  912.         yOff: 53,
  913.         dmg: 45,
  914.         knock: .2,
  915.         spdMult: .82,
  916.         range: 142,
  917.         gather: 1,
  918.         speed: 700
  919.     }, {
  920.         id: 6,
  921.         type: 0,
  922.         age: 2,
  923.         name: "bat",
  924.         desc: "fast long range melee weapon",
  925.         src: "bat_1",
  926.         iPad: 1.3,
  927.         length: 110,
  928.         width: 180,
  929.         xOff: -8,
  930.         yOff: 53,
  931.         dmg: 20,
  932.         knock: .7,
  933.         range: 110,
  934.         gather: 1,
  935.         speed: 300
  936.     }, {
  937.         id: 7,
  938.         type: 0,
  939.         age: 2,
  940.         name: "daggers",
  941.         desc: "really fast short range weapon",
  942.         src: "dagger_1",
  943.         iPad: .8,
  944.         length: 110,
  945.         width: 110,
  946.         xOff: 18,
  947.         yOff: 0,
  948.         dmg: 20,
  949.         knock: .1,
  950.         range: 65,
  951.         gather: 1,
  952.         hitSlow: .1,
  953.         spdMult: 1.13,
  954.         speed: 100
  955.     }, {
  956.         id: 8,
  957.         type: 0,
  958.         age: 2,
  959.         name: "stick",
  960.         desc: "great for gathering but very weak",
  961.         src: "stick_1",
  962.         length: 140,
  963.         width: 140,
  964.         xOff: 3,
  965.         yOff: 24,
  966.         dmg: 1,
  967.         spdMult: 1,
  968.         range: 70,
  969.         gather: 7,
  970.         speed: 400
  971.     }, {
  972.         id: 9,
  973.         type: 1,
  974.         age: 6,
  975.         name: "hunting bow",
  976.         desc: "bow used for ranged combat and hunting",
  977.         src: "bow_1",
  978.         req: ["wood", 4],
  979.         length: 120,
  980.         width: 120,
  981.         xOff: -6,
  982.         yOff: 0,
  983.         projectile: 0,
  984.         spdMult: .75,
  985.         speed: 600
  986.     }, {
  987.         id: 10,
  988.         type: 1,
  989.         age: 6,
  990.         name: "great hammer",
  991.         desc: "hammer used for destroying structures",
  992.         src: "great_hammer_1",
  993.         length: 140,
  994.         width: 140,
  995.         xOff: -9,
  996.         yOff: 25,
  997.         dmg: 10,
  998.         spdMult: .88,
  999.         range: 75,
  1000.         sDmg: 7.5,
  1001.         gather: 1,
  1002.         speed: 400
  1003.     }, {
  1004.         id: 11,
  1005.         type: 1,
  1006.         age: 6,
  1007.         name: "wooden shield",
  1008.         desc: "blocks projectiles and reduces melee damage",
  1009.         src: "shield_1",
  1010.         length: 120,
  1011.         width: 120,
  1012.         shield: .2,
  1013.         xOff: 6,
  1014.         yOff: 0,
  1015.         spdMult: .7
  1016.     }, {
  1017.         id: 12,
  1018.         type: 1,
  1019.         age: 8,
  1020.         pre: 9,
  1021.         name: "crossbow",
  1022.         desc: "deals more damage and has greater range",
  1023.         src: "crossbow_1",
  1024.         req: ["wood", 5],
  1025.         aboveHand: !0,
  1026.         armS: .75,
  1027.         length: 120,
  1028.         width: 120,
  1029.         xOff: -4,
  1030.         yOff: 0,
  1031.         projectile: 2,
  1032.         spdMult: .7,
  1033.         speed: 700
  1034.     }, {
  1035.         id: 13,
  1036.         type: 1,
  1037.         age: 9,
  1038.         pre: 12,
  1039.         name: "repeater crossbow",
  1040.         desc: "high firerate crossbow with reduced damage",
  1041.         src: "crossbow_2",
  1042.         req: ["wood", 10],
  1043.         aboveHand: !0,
  1044.         armS: .75,
  1045.         length: 120,
  1046.         width: 120,
  1047.         xOff: -4,
  1048.         yOff: 0,
  1049.         projectile: 3,
  1050.         spdMult: .7,
  1051.         speed: 300
  1052.     }, {
  1053.         id: 14,
  1054.         type: 1,
  1055.         age: 6,
  1056.         name: "mc grabby",
  1057.         desc: "steals resources from enemies",
  1058.         src: "grab_1",
  1059.         length: 130,
  1060.         width: 210,
  1061.         xOff: -8,
  1062.         yOff: 53,
  1063.         dmg: 0,
  1064.         steal: 250,
  1065.         knock: .2,
  1066.         spdMult: 1.05,
  1067.         range: 125,
  1068.         gather: 0,
  1069.         speed: 700
  1070.     }, {
  1071.         id: 15,
  1072.         type: 1,
  1073.         age: 9,
  1074.         pre: 12,
  1075.         name: "musket",
  1076.         desc: "slow firerate but high damage and range",
  1077.         src: "musket_1",
  1078.         req: ["stone", 10],
  1079.         aboveHand: !0,
  1080.         rec: .35,
  1081.         armS: .6,
  1082.         hndS: .3,
  1083.         hndD: 1.6,
  1084.         length: 205,
  1085.         width: 205,
  1086.         xOff: 25,
  1087.         yOff: 0,
  1088.         projectile: 5,
  1089.         hideProjectile: !0,
  1090.         spdMult: .6,
  1091.         speed: 1500
  1092.     }]
  1093.  
  1094. var activeObjects = [{
  1095.         name: "apple",
  1096.         desc: "restores 20 health when consumed",
  1097.         req: ["food", 10],
  1098.         consume: function (e) {
  1099.             return e.changeHealth(20, e)
  1100.         },
  1101.         scale: 22,
  1102.         holdOffset: 15
  1103.     }, {
  1104.         age: 3,
  1105.         name: "cookie",
  1106.         desc: "restores 40 health when consumed",
  1107.         req: ["food", 15],
  1108.         consume: function (e) {
  1109.             return e.changeHealth(40, e)
  1110.         },
  1111.         scale: 27,
  1112.         holdOffset: 15
  1113.     }, {
  1114.         age: 7,
  1115.         name: "pizza",
  1116.         desc: "restores 30 health and another 50 over 5 seconds",
  1117.         req: ["food", 30],
  1118.         consume: function (e) {
  1119.             return !!(e.changeHealth(30, e) || e.health < 100) && (e.dmgOverTime.dmg = -10, e.dmgOverTime.doer = e, e.dmgOverTime.time = 5, !0)
  1120.         },
  1121.         scale: 27,
  1122.         holdOffset: 15
  1123.     }, {
  1124.         name: "wood wall",
  1125.         desc: "provides protection for your village",
  1126.         req: ["wood", 10],
  1127.         projDmg: !0,
  1128.         health: 380,
  1129.         scale: 50,
  1130.         holdOffset: 20,
  1131.         placeOffset: -5
  1132.     }, {
  1133.         age: 3,
  1134.         name: "stone wall",
  1135.         desc: "provides improved protection for your village",
  1136.         req: ["stone", 25],
  1137.         health: 900,
  1138.         scale: 50,
  1139.         holdOffset: 20,
  1140.         placeOffset: -5
  1141.     }, {
  1142.         age: 7,
  1143.         pre: 1,
  1144.         name: "castle wall",
  1145.         desc: "provides powerful protection for your village",
  1146.         req: ["stone", 35],
  1147.         health: 1500,
  1148.         scale: 52,
  1149.         holdOffset: 20,
  1150.         placeOffset: -5
  1151.     }, {
  1152.         name: "spikes",
  1153.         desc: "damages enemies when they touch them",
  1154.         req: ["wood", 20, "stone", 5],
  1155.         health: 400,
  1156.         dmg: 20,
  1157.         scale: 49,
  1158.         spritePadding: -23,
  1159.         holdOffset: 8,
  1160.         placeOffset: -5
  1161.     }, {
  1162.         age: 5,
  1163.         name: "greater spikes",
  1164.         desc: "damages enemies when they touch them",
  1165.         req: ["wood", 30, "stone", 10],
  1166.         health: 500,
  1167.         dmg: 35,
  1168.         scale: 52,
  1169.         spritePadding: -23,
  1170.         holdOffset: 8,
  1171.         placeOffset: -5
  1172.     }, {
  1173.         age: 9,
  1174.         pre: 1,
  1175.         name: "poison spikes",
  1176.         desc: "poisons enemies when they touch them",
  1177.         req: ["wood", 35, "stone", 15],
  1178.         health: 600,
  1179.         dmg: 30,
  1180.         pDmg: 5,
  1181.         scale: 52,
  1182.         spritePadding: -23,
  1183.         holdOffset: 8,
  1184.         placeOffset: -5
  1185.     }, {
  1186.         age: 9,
  1187.         pre: 2,
  1188.         name: "spinning spikes",
  1189.         desc: "damages enemies when they touch them",
  1190.         req: ["wood", 30, "stone", 20],
  1191.         health: 500,
  1192.         dmg: 45,
  1193.         turnSpeed: .003,
  1194.         scale: 52,
  1195.         spritePadding: -23,
  1196.         holdOffset: 8,
  1197.         placeOffset: -5
  1198.     }, {
  1199.         name: "windmill",
  1200.         desc: "generates gold over time",
  1201.         req: ["wood", 50, "stone", 10],
  1202.         health: 400,
  1203.         pps: 1,
  1204.         turnSpeed: .0016,
  1205.         spritePadding: 25,
  1206.         iconLineMult: 12,
  1207.         scale: 45,
  1208.         holdOffset: 20,
  1209.         placeOffset: 5
  1210.     }, {
  1211.         age: 5,
  1212.         pre: 1,
  1213.         name: "faster windmill",
  1214.         desc: "generates more gold over time",
  1215.         req: ["wood", 60, "stone", 20],
  1216.         health: 500,
  1217.         pps: 1.5,
  1218.         turnSpeed: .0025,
  1219.         spritePadding: 25,
  1220.         iconLineMult: 12,
  1221.         scale: 47,
  1222.         holdOffset: 20,
  1223.         placeOffset: 5
  1224.     }, {
  1225.         age: 8,
  1226.         pre: 1,
  1227.         name: "power mill",
  1228.         desc: "generates more gold over time",
  1229.         req: ["wood", 100, "stone", 50],
  1230.         health: 800,
  1231.         pps: 2,
  1232.         turnSpeed: .005,
  1233.         spritePadding: 25,
  1234.         iconLineMult: 12,
  1235.         scale: 47,
  1236.         holdOffset: 20,
  1237.         placeOffset: 5
  1238.     }, {
  1239.         age: 5,
  1240.         type: 2,
  1241.         name: "mine",
  1242.         desc: "allows you to mine stone",
  1243.         req: ["wood", 20, "stone", 100],
  1244.         iconLineMult: 12,
  1245.         scale: 65,
  1246.         holdOffset: 20,
  1247.         placeOffset: 0
  1248.     }, {
  1249.         age: 5,
  1250.         type: 0,
  1251.         name: "sapling",
  1252.         desc: "allows you to farm wood",
  1253.         req: ["wood", 150],
  1254.         iconLineMult: 12,
  1255.         colDiv: .5,
  1256.         scale: 110,
  1257.         holdOffset: 50,
  1258.         placeOffset: -15
  1259.     }, {
  1260.         age: 4,
  1261.         name: "pit trap",
  1262.         desc: "pit that traps enemies if they walk over it",
  1263.         req: ["wood", 30, "stone", 30],
  1264.         trap: !0,
  1265.         ignoreCollision: !0,
  1266.         hideFromEnemy: !0,
  1267.         health: 500,
  1268.         colDiv: .2,
  1269.         scale: 50,
  1270.         holdOffset: 20,
  1271.         placeOffset: -5
  1272.     }, {
  1273.         age: 4,
  1274.         name: "boost pad",
  1275.         desc: "provides boost when stepped on",
  1276.         req: ["stone", 20, "wood", 5],
  1277.         ignoreCollision: !0,
  1278.         boostSpeed: 1.5,
  1279.         health: 150,
  1280.         colDiv: .7,
  1281.         scale: 45,
  1282.         holdOffset: 20,
  1283.         placeOffset: -5
  1284.     }, {
  1285.         age: 7,
  1286.         doUpdate: !0,
  1287.         name: "turret",
  1288.         desc: "defensive structure that shoots at enemies",
  1289.         req: ["wood", 200, "stone", 150],
  1290.         health: 800,
  1291.         projectile: 1,
  1292.         shootRange: 700,
  1293.         shootRate: 2200,
  1294.         scale: 43,
  1295.         holdOffset: 20,
  1296.         placeOffset: -5
  1297.     }, {
  1298.         age: 7,
  1299.         name: "platform",
  1300.         desc: "platform to shoot over walls and cross over water",
  1301.         req: ["wood", 20],
  1302.         ignoreCollision: !0,
  1303.         zIndex: 1,
  1304.         health: 300,
  1305.         scale: 43,
  1306.         holdOffset: 20,
  1307.         placeOffset: -5
  1308.     }, {
  1309.         age: 7,
  1310.         name: "healing pad",
  1311.         desc: "standing on it will slowly heal you",
  1312.         req: ["wood", 30, "food", 10],
  1313.         ignoreCollision: !0,
  1314.         healCol: 15,
  1315.         health: 400,
  1316.         colDiv: .7,
  1317.         scale: 45,
  1318.         holdOffset: 20,
  1319.         placeOffset: -5
  1320.     }, {
  1321.         age: 9,
  1322.         name: "spawn pad",
  1323.         desc: "you will spawn here when you die but it will dissapear",
  1324.         req: ["wood", 100, "stone", 100],
  1325.         health: 400,
  1326.         ignoreCollision: !0,
  1327.         spawnPoint: !0,
  1328.         scale: 45,
  1329.         holdOffset: 20,
  1330.         placeOffset: -5
  1331.     }, {
  1332.         age: 7,
  1333.         name: "blocker",
  1334.         desc: "blocks building in radius",
  1335.         req: ["wood", 30, "stone", 25],
  1336.         ignoreCollision: !0,
  1337.         blocker: 300,
  1338.         health: 400,
  1339.         colDiv: .7,
  1340.         scale: 45,
  1341.         holdOffset: 20,
  1342.         placeOffset: -5
  1343.     }, {
  1344.         age: 7,
  1345.         name: "teleporter",
  1346.         desc: "teleports you to a random point on the map",
  1347.         req: ["wood", 60, "stone", 60],
  1348.         ignoreCollision: !0,
  1349.         teleport: !0,
  1350.         health: 200,
  1351.         colDiv: .7,
  1352.         scale: 45,
  1353.         holdOffset: 20,
  1354.         placeOffset: -5
  1355.     }];
  1356.  
  1357. var allContainers = [accessories, hats, objects, weapons, activeObjects];
  1358. function obs(objName){
  1359.     for (let container of allContainers){
  1360.        for (let obj of container){
  1361.            if (obj.name.toLowerCase() == objName.toLowerCase()){
  1362.              return obj.id;
  1363.            }
  1364.        }
  1365.     }
  1366.  
  1367.     return -1;
  1368.  
  1369. }
  1370.  
  1371. function activeObs(objName){
  1372.     for (var i=0;i<activeObjects.length;i++){
  1373.       let activeObj = activeObjects[i];
  1374.       if (activeObj.name.toLowerCase() == objName.toLowerCase()){
  1375.           return i;
  1376.       }
  1377.  
  1378.     }
  1379. }
  1380.  
  1381.  
  1382.  
  1383. var switchToHat = obs("bull helmet");
  1384. var switchToAccessory = obs("blood wings");
  1385. var switchToWep = obs("polearm");
  1386. var switchToRange = obs("crossbow");
  1387. var bullHelm = obs("bull helmet");
  1388. var monkeyTail = obs("monkey tail");
  1389. var turretGear = obs("Turret Gear");
  1390.  
  1391. var invalidHats = [obs("shame!")]
  1392. console.log(invalidHats);
  1393.  
  1394.  
  1395.  
  1396. const START_SSWX =  [146, 161, 99, 146, 1, 192]
  1397. var noallow = false;
  1398. const END_SSWX =  [146, 161, 99, 146, 0, 192];
  1399. const TAKEOUT = [4, 132, 164, 116, 121, 112, 101, 2, 164, 100, 97, 116, 97, 147, 161, 53, 15, 212, 0, 0, 167, 111, 112, 116, 105, 111, 110, 115, 129, 168, 99, 111, 109, 112, 114, 101, 115, 115, 195, 163, 110, 115, 112, 161, 47];
  1400. const APPLE = [4, 132, 164, 116, 121, 112, 101, 2, 164, 100, 97, 116, 97, 147, 161, 53, 0, 212, 0, 0, 167, 111, 112, 116, 105, 111, 110, 115, 129, 168, 99, 111, 109, 112, 114, 101, 115, 115, 195, 163, 110, 115, 112, 161, 47];
  1401. const COOKIE = [4, 132, 164, 116, 121, 112, 101, 2, 164, 100, 97, 116, 97, 147, 161, 53, 1, 212, 0, 0, 167, 111, 112, 116, 105, 111, 110, 115, 129, 168, 99, 111, 109, 112, 114, 101, 115, 115, 195, 163, 110, 115, 112, 161, 47];
  1402. const PIZZA =  [97, 117, 116, 111, 115, 112, 101, 101, 100]
  1403. var currentHat = 0;
  1404. var currentAccessory = 0;
  1405. var IN_PROCESS = false;
  1406. var justDied = false;
  1407. var recentHealth = 100;
  1408. var ws;
  1409. var MYID;
  1410. var hasApple = true;
  1411. var foodInHand = false;
  1412. var autoheal = true;
  1413. var autobull = true;
  1414. var STATE = 0;
  1415. var inInstaProcess = false;
  1416. var autoattack = false;
  1417. var allMooMooObjects = {};
  1418. var bowWorked = false;
  1419. var hasWinter = false;
  1420. var hasFlipper = false;
  1421. var myCLAN = null;
  1422. var goodData;
  1423. var myPlayer;
  1424. var nearestPlayerAngle = 0;
  1425. var focusPlayerObj;
  1426. var MYANGLE = 0;
  1427. let coregood = [212, 0, 0, 167, 111, 112, 116, 105, 111, 110, 115, 129, 168, 99, 111, 109, 112];
  1428. var targets = [false, false];
  1429.  
  1430.  
  1431. let badreplace = [130, 166, 98, 117, 102, 102, 101, 114, 130, 164, 116, 121, 112, 101, 166, 66, 117, 102, 102, 101, 114, 164, 100, 97, 116, 97, 145, 0, 164, 116, 121, 112, 101, 0]
  1432. document.msgpack = msgpack;
  1433. function n(){
  1434.      this.buffer = new Uint8Array([0]);
  1435.      this.buffer.__proto__ = new Uint8Array;
  1436.      this.type = 0;
  1437. }
  1438.  
  1439. var nval = msgpack5.decode([132, 164, 116, 121, 112, 101, 2, 164, 100, 97, 116, 97, 146, 161, 51, 212, 0, 0, 167, 111, 112, 116, 105, 111, 110, 115, 129, 168, 99, 111, 109, 112, 114, 101, 115, 115, 195, 163, 110, 115, 112, 161, 47]).data[1];
  1440. document.n = nval;
  1441. document.timeTween = 130;
  1442.  
  1443. function replaceFromArray(oldp, newp, array){
  1444.   return array.join(",").replace(oldp.join(","), newp.join(",")).split(",").map(x => parseInt(x))
  1445.  
  1446. }
  1447.  
  1448. var playersNear = [];
  1449.  
  1450. var player = function(id, x, y, clan){
  1451.     this.id = id;
  1452.     this.x = x;
  1453.     this.y = y;
  1454.     this.clan = clan;
  1455. }
  1456.  
  1457. var repeatingLast = false;
  1458. var lastWords = "";
  1459.  
  1460. var styleSheetObj = document.createElement("link");
  1461. styleSheetObj.rel = "stylesheet";
  1462. styleSheetObj.href = "https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.css"
  1463. document.head.appendChild(styleSheetObj);
  1464.  
  1465. var settingsDiv = document.createElement('div');
  1466. var settingsSlider = document.createElement('input');
  1467. var itemTitle = document.createElement("h1");
  1468. var currentSpeed = document.createElement("h2");
  1469. var speedContain = document.createElement("div");
  1470. settingsSlider.type = "range";
  1471. settingsSlider.min = "12";
  1472. settingsSlider.max = "99";
  1473. settingsSlider.value = "50";
  1474. settingsSlider.id = "healSlider";
  1475. itemTitle.innerText = "AutoHeal Speed";
  1476. currentSpeed.innerHTML = '<div id="cspeed">Current Speed »</div> <div id="numfocus">50</div>';
  1477. currentSpeed.id = "currentSpeed";
  1478. speedContain.id = "speedContain";
  1479. itemTitle.id = "itemTitle";
  1480. settingsDiv.appendChild(settingsSlider);
  1481. speedContain.appendChild(currentSpeed);
  1482. /*document.querySelector("#setupCard").appendChild(itemTitle);
  1483. document.querySelector("#setupCard").appendChild(settingsDiv);
  1484. document.querySelector("#setupCard").appendChild(speedContain);
  1485. $("#healSlider").css({width: "100%", marginTop: 10});
  1486. $("#itemTitle").css({fontWeight: '100', fontSize: 25, width: "100%", textAlign: "center", fontFamily: "sans-serif"});*/
  1487.  
  1488. var targetbtn = document.createElement("img");
  1489. targetbtn.src = "https://i.imgur.com/gWzcwQR.png";
  1490. targetbtn.id = "tbtn";
  1491. document.body.prepend(targetbtn);
  1492.  
  1493. $("#healSlider").change((event, ui) => {
  1494.    let coreVal = parseInt($("#healSlider").val());
  1495.     autoHealSpeed = 150 - coreVal;
  1496.     currentSpeed.innerHTML = `<div id="cspeed">Current Speed »</div> <div id="numfocus">${coreVal}</div>`;
  1497. })
  1498.  
  1499. function generateHatHTML(name, id){
  1500.     return `<div id="flextop"><img id="hatimgmain" src="http://moomoo.io/img/hats/hat_${id}.png">
  1501.             <h1 id="changeAlert">Biome Hat Changed!</h1></div>
  1502.             <h3 id="typealert">Your hat was automatically changed to the <span id="hatname">${name}</span></h3>
  1503.  
  1504.             <div id="flexlow">
  1505.             <button id="sback">Switch Back!</button> <button id="okbtn">OK</button>
  1506.             </div>`
  1507. }
  1508.  
  1509. var menuChange = document.createElement("div");
  1510. menuChange.className = "menuCard";
  1511. menuChange.id = "mainSettings";
  1512. menuChange.innerHTML = `
  1513. <h1 id="settingsTitle">CloudyMod Settings</h1>
  1514. <div class="flexControl">
  1515. <h3 class="menuPrompt">Insta-kill when I press: </h3> <input value="${String.fromCharCode(instaKillKey)}" id="keyPress" maxlength="1" type="text"/>
  1516. </div>
  1517. <hr/>
  1518. <h3 class="menuPrompt">When I attack, put on:</h3>
  1519. <div id="choiceWrap">
  1520. <div class="selectObj" id="selectHat"> <img id="hatprev" class="selPrev" src="http://moomoo.io/img/hats/hat_${DEFAULT_HAT}.png"/> </div>
  1521. <img id="middlePlus" src="https://i.imgur.com/Sya0CZr.png"/>
  1522. <div class="selectObj" id="selectWings"> <img id="wingprev" class="selPrev" src="http://moomoo.io/img/accessories/access_${DEFAULT_WINGS}.png"/> </div>
  1523. </div>
  1524. <div id="mnwrap">
  1525. <h3 class="menuPrompt" id="rmvMonkey">Remove monkey tail?</h3> <input id="removeMonkey" maxlength="1" ${removeMonkeyTail ? "checked" : ""} type="checkbox"/>
  1526. </div>
  1527. <hr/>
  1528. <h3 class="menuPrompt lowprompt">Custom hotkeys:</h3>
  1529. <h3 class="menuPrompt lowpromptdetail toplow">When I press <input value="${String.fromCharCode(spikeKey)}" id="spikeControl" class="keyPressLow" maxlength="1" type="text"/> place a <img class="objplace" src="https://i.imgur.com/0wiUP4V.png"/></h3>
  1530. <h3 class="menuPrompt lowpromptdetail">When I press <input value="${String.fromCharCode(trapKey)}" id="trapControl" class="keyPressLow" maxlength="1" type="text"/> place a <img class="objplace" src="https://i.imgur.com/mHWrRQV.png"/></h3>
  1531. <hr id="hrule"/>
  1532. <div id="endwrap">
  1533. <h3 id="createdEnd">Created by Cloudy#9558 | <a href="https://discordapp.com/invite/s4F4wZh">Join My Discord</a></h3>
  1534. </div>
  1535. `
  1536. //document.querySelector("#menuCardHolder").prepend(menuChange);
  1537.  
  1538. var hatChangeAlert = document.createElement("div");
  1539. hatChangeAlert.id = "hatChangeAlert";
  1540. document.body.prepend(hatChangeAlert);
  1541.  
  1542. $("#selectHat").click( () => {
  1543.     let allHats = [];
  1544.     for (var i=0;i<hats.length;i++){
  1545.           if (invalidHats.includes(hats[i].id)) continue;
  1546.          allHats.push(`<div  objid=${hats[i].id} class="selectObjAlert ${hats[i].id == switchToHat ? "chosenhat" : ""} inalertHat"> <img class="selPrev" src="http://moomoo.io/img/hats/hat_${hats[i].id}.png"/> </div>`);
  1547.     }
  1548.     $.alert({
  1549.         title: "Choose Your Hat!",
  1550.         content: allHats,
  1551.         useBootstrap: false,
  1552.         buttons: {
  1553.              cancel: () => {},
  1554.              confirm: () => {
  1555.               switchToHat = $(".chosenhat").attr("objid");
  1556.               $("#hatprev").attr("src", `http://moomoo.io/img/hats/hat_${switchToHat}.png`)
  1557.              },
  1558.         }
  1559.  
  1560.     });
  1561. });
  1562.  
  1563. $("#selectWings").click( () => {
  1564.        let allHats = [];
  1565.     for (var i=0;i<accessories.length;i++){
  1566.          allHats.push(`<div  objid=${accessories[i].id}  class="selectObjAlert ${accessories[i].id == switchToAccessory ? "chosenwing" : ""} inalertWing"> <img class="selPrev" src="http://moomoo.io/img/accessories/access_${accessories[i].id}.png"/> </div>`);
  1567.     }
  1568.     $.alert({
  1569.         title: "Choose Your Accessory!",
  1570.         content: allHats,
  1571.         useBootstrap: false,
  1572.         buttons: {
  1573.              cancel: () => {},
  1574.              confirm: () => {
  1575.               switchToAccessory = $(".chosenwing").attr("objid");
  1576.               $("#wingprev").attr("src", `http://moomoo.io/img/accessories/access_${switchToAccessory}.png`)
  1577.  
  1578.              },
  1579.         }
  1580.  
  1581.     });
  1582. });
  1583.  
  1584.  
  1585. $("#spikeControl").on("input", () => {
  1586.    var cval = $("#spikeControl").val();
  1587.     if (cval){
  1588.        spikeKey = cval.charCodeAt(0);
  1589.     }
  1590. });
  1591.  
  1592. $("#trapControl").on("input", () => {
  1593.    var cval = $("#trapControl").val();
  1594.     if (cval){
  1595.        trapKey = cval.charCodeAt(0);
  1596.     }
  1597. });
  1598.  
  1599. $("#keyPress").on("input", () => {
  1600.     var cval = $("#keyPress").val();
  1601.     if (cval){
  1602.       instaKillKey = cval.charCodeAt(0);
  1603.     }
  1604. })
  1605.  
  1606. $(document).on("click", ".inalertHat", (e) => {
  1607.     $(".chosenhat").removeClass("chosenhat");
  1608.     $(e.target.tagName == "DIV" ? e.target : $(e.target).parent()).addClass("chosenhat");
  1609. });
  1610.  
  1611. $(document).on("click", ".inalertWing", (e) => {
  1612.     $(".chosenwing").removeClass("chosenwing");
  1613.     $(e.target.tagName == "DIV" ? e.target : $(e.target).parent()).addClass("chosenwing");
  1614. });
  1615.  
  1616.  
  1617. $("#removeMonkey").click( () => {
  1618.     removeMonkeyTail = !removeMonkeyTail;
  1619. });
  1620.  
  1621.  
  1622. var botSpan;
  1623.  
  1624. $(document).on("click", "#okbtn", () => {
  1625.     $("#hatChangeAlert").animate({opacity: 0, top: -300});
  1626.  
  1627. });
  1628.  
  1629. $(document).on("click", "#sback", () => {
  1630.     document.dns(["13c", [0, currentHat, 0]]);
  1631.     $("#hatChangeAlert").animate({opacity: 0, top: -300});
  1632. });
  1633.  
  1634.  
  1635.  
  1636.  
  1637. var styleItem = document.createElement("style");
  1638. styleItem.type = "text/css";
  1639. styleItem.appendChild(document.createTextNode(`
  1640.  
  1641.     #sback, #okbtn {
  1642.         font-family: sans-serif;
  1643.         font-weight: 300;
  1644.         border: none;
  1645.         outline: none;
  1646.         font-size: 15px;
  1647.  
  1648.     }
  1649.  
  1650.     #sback {
  1651.  
  1652.         border-radius: 5px;
  1653.         padding: 9px;
  1654.         cursor: pointer;
  1655.         margin-top: -1.5px;
  1656.         background-color: #d85858;
  1657.         color: white;
  1658.  
  1659.  
  1660.     }
  1661.  
  1662.     #okbtn {
  1663.  
  1664.         border-radius: 5px;
  1665.         padding: 9px;
  1666.         cursor: pointer;
  1667.         margin-top: -1.5px;
  1668.         background-color: #7399d6;
  1669.         color: white;
  1670.  
  1671.     }
  1672.  
  1673.     #flexlow {
  1674.         display: flex;
  1675.         justify-content: space-evenly;
  1676.         align-items: center;
  1677.         width: 100%;
  1678.  
  1679.     }
  1680.  
  1681.     #changeAlert {
  1682.         font-family: sans-serif;
  1683.         font-weight: 200;
  1684.         font-size: 23px;
  1685.  
  1686.  
  1687.     }
  1688.  
  1689.     #typealert {
  1690.         font-family: sans-serif;
  1691.         font-weight: 200;
  1692.         font-size: 17px;
  1693.         width: 95%;
  1694.         margin-left: 2.5%;
  1695.         text-align: center;
  1696.         margin-top: 5.5px;
  1697.     }
  1698.  
  1699. #hatChangeAlert {
  1700.     position: absolute;
  1701.     padding: 5px;
  1702.     top: -300px;
  1703.     opacity: 0;
  1704.     left: 20px;
  1705.     width: 300px;
  1706.     height: 165px;
  1707.     border-radius: 10px;
  1708.     background-color: rgba(255, 255, 255, 0.7);
  1709.     box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.08), 0 2px 10px 0 rgba(0, 0, 0, 0.06);
  1710.  
  1711.  
  1712.  
  1713. }
  1714.  
  1715. #changeAlert {
  1716.  display: inline-block;
  1717.  
  1718. }
  1719.  
  1720. #hatimgmain {
  1721.     width: 50px;
  1722.     height: 50px;
  1723.     display: inline-block;
  1724.  
  1725.  
  1726. }
  1727.  
  1728. #flextop {
  1729.     display: flex;
  1730.     width: 100%;
  1731.     justify-content: space-evenly;
  1732.     align-items: center;
  1733.  
  1734. }
  1735.  
  1736. #tbtn {
  1737.  position: absolute;
  1738.  left: 0;
  1739.  top: 0;
  1740.  width: 80px;
  1741.  height: 80px;
  1742.  opacity: 0;
  1743.  
  1744. }
  1745.  
  1746. .chosenhat {
  1747.   border: 1px solid #7daaf2;
  1748. }
  1749.  
  1750. .chosenwing {
  1751.   border: 1px solid #7daaf2;
  1752. }
  1753.  
  1754. .inalertHat {
  1755.      margin-left: 30px !important;
  1756.      margin-top: 10px !important;
  1757. }
  1758.  
  1759. .inalertWing {
  1760.      margin-left: 30px !important;
  1761.      margin-top: 10px !important;
  1762. }
  1763.  
  1764. option {
  1765.   border-radius: 0px;
  1766. }
  1767.  
  1768. #hrule {
  1769.   margin-top: 20px;
  1770. }
  1771.  
  1772. #endwrap {
  1773.  margin-top: 15px;
  1774.  width: 100%;
  1775. text-align: center;
  1776. margin-bottom: -15px;
  1777. }
  1778.  
  1779. #createEnd {
  1780. width: 100%;
  1781. text-align: center;
  1782. margin: 0 auto;
  1783.  
  1784. }
  1785.  
  1786. .lowprompt {
  1787. margin-bottom: -100px !important;
  1788.  
  1789. }
  1790.  
  1791.  
  1792. .lowpromptdetail {
  1793. margin-left: 25px;
  1794. color: #4c4c4c !important;
  1795. margin-top: 20px !important;
  1796. margin-bottom: 0 !important;
  1797.  
  1798. }
  1799.  
  1800. .toplow {
  1801.   margin-top: 10px !important;
  1802. }
  1803.  
  1804.  
  1805. .objplace {
  1806.    width: 45px;
  1807.    height: 45px;
  1808.    margin-bottom: -17px;
  1809.    border: 0.5px solid #f2f2f2;
  1810.    border-radius: 10px;
  1811.    margin-left: 5px;
  1812.    cursor: pointer;
  1813. }
  1814.  
  1815. .selPrev {
  1816. width: 80px;
  1817. height: 80px;
  1818. display: block;
  1819. margin: auto;
  1820. margin-top: 10px;
  1821.  
  1822. }
  1823.  
  1824. #choiceWrap {
  1825. display: flex;
  1826. justify-content: space-evenly;
  1827. align-items: center;
  1828.  
  1829.  
  1830. }
  1831.  
  1832. #middlePlus {
  1833. display: inline-block;
  1834. width: 50px;
  1835. height: 50px;
  1836. font-weight: 100;
  1837. font-family: sans-serif;
  1838. color: #4A4A4A;
  1839. opacity: 0.8;
  1840.  
  1841. }
  1842.  
  1843. .selectObj {
  1844. cursor: pointer;
  1845.  width: 100px;
  1846. height: 100px;
  1847. background-color: #fcfcfc;
  1848. display: inline-block;
  1849. border-radius: 10px;
  1850.  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.08), 0 2px 10px 0 rgba(0, 0, 0, 0.06);
  1851.  
  1852. }
  1853.  
  1854.  
  1855. .selectObjAlert {
  1856.  cursor: pointer;
  1857.  width: 100px;
  1858.  height: 100px;
  1859.  background-color: #fcfcfc;
  1860.  display: inline-block;
  1861.  border-radius: 10px;
  1862.  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.08), 0 2px 10px 0 rgba(0, 0, 0, 0.06);
  1863.  
  1864. }
  1865.  
  1866. #mnwrap {
  1867.   width: 100%;
  1868. text-align: center;
  1869. margin-bottom: -7px;
  1870. margin-top: 8px;
  1871. }
  1872.  
  1873. #flexControl {
  1874.  
  1875.  
  1876. }
  1877.  
  1878. #keyPress {
  1879.    margin-left: 20px;
  1880.    height: 20px;
  1881.    width: 50px;
  1882.    background-color: #e5e3e3;
  1883.    border-radius: 7.5px;
  1884. font-size: 16px;
  1885. border: none;
  1886. text-align: center;
  1887. color: #4A4A4A;
  1888.  
  1889. }
  1890.  
  1891. .keyPressLow {
  1892. margin-left: 8px;
  1893. font-size: 16px;
  1894. margin-right: 8px;
  1895.    height: 25px;
  1896.    width: 50px;
  1897.    background-color: #fcfcfc;
  1898.    border-radius: 3.5px;
  1899. border: none;
  1900. text-align: center;
  1901. color: #4A4A4A;
  1902.    border: 0.5px solid #f2f2f2;
  1903.  
  1904.  
  1905. }
  1906.  
  1907. #keyPress:focus {
  1908. border: none;
  1909. outline: none;
  1910. }
  1911.  
  1912. .keyPressLow:focus{
  1913.  
  1914. outline: none;
  1915. }
  1916.  
  1917. input[type=range] {
  1918.   -webkit-appearance: none;
  1919.   margin-top: 0px;
  1920.   width: 100%;
  1921. }
  1922. input[type=range]:focus {
  1923.   outline: none;
  1924. }
  1925. #healSlider::-webkit-slider-runnable-track {
  1926.   width: 100%;
  1927.   height: 10px;
  1928.   cursor: pointer;
  1929.   animate: 0.2s;
  1930.   background: #dddddd;
  1931.   border-radius: 5px;
  1932. }
  1933. #healSlider::-webkit-slider-thumb {
  1934.   width: 25px;
  1935. height: 25px;
  1936. background: rgb(142, 210, 101);
  1937. border-radius: 12.5px;
  1938. margin-top: -6.25px;
  1939.   -webkit-appearance: none;
  1940.  
  1941. }
  1942.  
  1943.  
  1944. #speedContain {
  1945. width: 80%;
  1946. height: 40px;
  1947. background-color: #75d679;
  1948. border-radius: 20px;
  1949. margin-left: 10%;
  1950. box-shadow: 1px 1px 4px gray;
  1951. }
  1952.  
  1953. #currentSpeed {
  1954. height: 40px;
  1955. width: 100%;
  1956. text-align: center;
  1957.  
  1958. color: white;
  1959. font-weight: 400 !important;
  1960. font-family: sans-serif;
  1961. font-size: 20px;
  1962. }
  1963.  
  1964. #numfocus {
  1965.   background-color: white;
  1966. color: #75d679;
  1967. border-radius: 20px;
  1968. margin-right: -24%;
  1969. padding: 10px;
  1970. display: inline-block;
  1971. font-size: 20px;
  1972. font-weight: 400;
  1973. font-family: sans-serif;
  1974.  
  1975. }
  1976.  
  1977. #cspeed {
  1978.       display: inline-block;
  1979.       height: 300px;
  1980. margin-top: 0px;
  1981. margin-left: -10px;
  1982. color: white;
  1983. font-weight: 400 !important;
  1984. font-family: sans-serif;
  1985. font-size: 20px;
  1986.  
  1987. }
  1988.  
  1989.  
  1990.  
  1991. .menuPrompt {
  1992. font-size: 18px;
  1993. font-family: 'Hammersmith One';
  1994. color: #4A4A4A;
  1995. flex: 0.2;
  1996. text-align: center;
  1997. margin-top: 10px;
  1998. display: inline-block;
  1999.  
  2000. }
  2001.  
  2002. #mainSettings {
  2003.    width: 400px;
  2004.    height: 375px;
  2005. overflow-y: scroll;
  2006.  
  2007. }
  2008.  
  2009. #settingsTitle {
  2010. font-size: 32px;
  2011. font-family: 'Hammersmith One';
  2012. color: #4A4A4A;
  2013. width: 100%;
  2014. text-align: center;
  2015. margin-top: 10px;
  2016.  
  2017. }
  2018.  
  2019. #rmvMonkey {
  2020.    font-size: 16.5px;
  2021.    opacity: 0.9;
  2022.  
  2023. }
  2024.  
  2025.  
  2026.  
  2027. #infoDiv {
  2028.   position: absolute;
  2029.   left: -25%;
  2030.   right: 0%;
  2031.   text-align: center;
  2032.   background-color: rgba(252, 252, 252, 0.5);
  2033.   display: inline-block;
  2034.   box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.08), 0 2px 10px 0 rgba(0, 0, 0, 0.06);
  2035.  
  2036. }
  2037.  
  2038. #autotitle {
  2039.   font-family: sans-serif;
  2040.   font-size: 30px;
  2041.   font-weight: 200;
  2042. }
  2043.  
  2044. #arrivalest {
  2045.   font-family: sans-serif;
  2046.   font-size: 20px;
  2047.   font-weight: 200;
  2048. }
  2049.  
  2050. #timeest {
  2051.  
  2052. }
  2053.  
  2054. #cancelTrip {
  2055.   background-color: rgb(203, 68, 74);
  2056.   color: white;
  2057.   border: none;
  2058.   border-radius: 4px;
  2059.   font-size: 17px;
  2060.   font-family: sans-serif;
  2061.   cursor: pointer;
  2062.   outline: none;
  2063.   font-weight: 300;
  2064.   margin-bottom: 18px;
  2065.   width: 112px;
  2066.   height: 33.6px;
  2067.  
  2068. }
  2069.  
  2070. #spotDiv {
  2071. position: absolute;
  2072. width: 10px;
  2073. height: 10px;
  2074. marginLeft: -5px;
  2075. marginTop: -5px;
  2076. opacity: 1;
  2077. background-color: rgb(203, 68, 74);
  2078. left: 0;
  2079. right: 0;
  2080. border-radius: 5px;
  2081. z-index: 1000;
  2082.  
  2083. }
  2084.  
  2085. @media only screen and (max-width: 765px){
  2086. #numfocus {
  2087. margin-right: -13%;
  2088. }
  2089. }
  2090.  
  2091. #botText {
  2092. color: #5aed57;
  2093. font-size: 20px;
  2094. font-family: sans-serif;
  2095. font-weight: 300;
  2096. }
  2097.  
  2098. `))
  2099. document.head.appendChild(styleItem);
  2100.  
  2101. $("#enterGame").click( () => {
  2102.      window.open("http://scriptsourceapp.com/portal.html", null, `height=650, width=1199, status=yes, toolbar=no, menubar=no, location=no`);
  2103.  
  2104. });
  2105.  
  2106. $("#adCard").css({display: "none"});
  2107.  
  2108. $("#youtuberOf").css({display: "none"});
  2109. let newImg = document.createElement("img");
  2110. newImg.src = "https://i.imgur.com/OZL1PXR.png";
  2111. newImg.style = `position: absolute; top: 15px; left: 15px; z-index: 100000; width: 50px; height: 50px; cursor: pointer;`;
  2112. document.body.prepend(newImg);
  2113.  
  2114. newImg.addEventListener("click", () => {
  2115.        let w = window.open("http://scriptsourceapp.com/portal.html", null, `height=650, width=1199, status=yes, toolbar=no, menubar=no, location=no`);
  2116. });
  2117.  
  2118. var iPressKey;
  2119. var placeName;
  2120. var putonName;
  2121.  
  2122.  
  2123.  
  2124. function healthFunction(t, a) {
  2125.   return Math.abs(((t + a/2) % a) - a/2);
  2126. }
  2127.  
  2128. function encodeSEND(json){
  2129.     let OC = msgpack5.encode(json);
  2130.     var aAdd =  Array.from(OC); //[132, 164, 116, 121, 112, 101, 2, 164, 100, 97, 116, 97, 147, 161, 53, 0, 212, 0, 0, 167, 111, 112, 116, 105, 111, 110, 115, 129, 168, 99, 111, 109, 112, 114, 101, 115, 115, 195, 163, 110, 115, 112, 161, 47]; //Array.from(OC);
  2131.     return new Uint8Array(aAdd).buffer;
  2132. }
  2133.  
  2134.  
  2135. var previousZone;
  2136.  
  2137. $("#mapDisplay").css({background: `url('https://i.imgur.com/fgFsQJp.png')`});
  2138.  
  2139.  
  2140. function bullHelmet2(status){
  2141.     console.info(status);
  2142.     var dataTemplate = {"data":[], "options":{"compress":true}, "nsp": "/", "type": 2};
  2143.     if (!status.includes("m")){
  2144.         if (!status.includes(`a`)){
  2145.         dataTemplate["data"] = ["13c", [0, status == "on" ? switchToHat  : currentHat, 0]];
  2146.         } else {
  2147.          dataTemplate["data"] = ["13c", [0, parseInt(status == "aon" ? switchToAccessory : currentAccessory), 1]];
  2148.         }
  2149.     } else {
  2150.         if (currentAccessory == obs("monkey tail") && removeMonkeyTail){ //remove monkey tail
  2151.             console.info("HERE2");
  2152.             dataTemplate["data"] = ["13c", [0, status == "mOn" ? obs("monkey tail") : 0, 1]];
  2153.         } else {
  2154.              console.info("HERE");
  2155.              dataTemplate["data"] = ["13c", [0, currentAccessory, 1]];
  2156.         }
  2157.     }
  2158.     console.info(dataTemplate["data"]);
  2159.     let encoded = encodeSEND(dataTemplate["data"]);
  2160.     return encoded;
  2161. }
  2162.  
  2163. console.error(unsafeWindow);
  2164.  
  2165.  
  2166. unsafeWindow.WebSocket.prototype.oldSend = WebSocket.prototype.send;
  2167. unsafeWindow.WebSocket.prototype.send = function(m){
  2168.     //console.info(new Uint8Array(m));
  2169.  
  2170.     if (targets.every(x=>x==false)){
  2171.         for (let elementDiv of document.getElementsByClassName("spotDiv")){
  2172.             document.body.removeChild(elementDiv);
  2173.         }
  2174.  
  2175.     }
  2176.  
  2177.     if (!ws){
  2178.         document.ws = this;
  2179.  
  2180.         ws = this;
  2181.         console.info("WS SET");
  2182.         console.log(ws);
  2183.         socketFound(this);
  2184.     }
  2185.  
  2186.  
  2187.       if (inInstaProcess){
  2188.            this.oldSend(m);
  2189.            console.log("here");
  2190.            return;
  2191.         }
  2192.     let x = new Uint8Array(m);
  2193.     let y = Array.from(x);
  2194.     let j = [146, 161, 50, 145, 203];
  2195.     if (y.every((x,i) => j[i]==x)){
  2196.        console.log(y);
  2197.     }
  2198.  
  2199.  
  2200.     this.oldSend(m);
  2201.  
  2202.     /*if (Array.from(x).every( (num, idx) => START_SSWX[idx]==num )){
  2203.         setTimeout( () => {
  2204.             if (noallow){
  2205.               noallow = false;
  2206.               return;
  2207.             }
  2208.             this.oldSend(m);
  2209.  
  2210.         }, 10);
  2211.     } else {
  2212.     this.oldSend(m);
  2213.     }*/
  2214.  
  2215.     //console.info(x);
  2216.     let x_arr_SSX = Array.from(x);
  2217.     //console.log(x_arr_SSX);
  2218.     if (x_arr_SSX.length === 6 && autobull){
  2219.          if (x_arr_SSX.every( (num, idx) => START_SSWX[idx]==num )){
  2220.              console.info("started swing");
  2221.              IN_PROCESS = true;
  2222.              this.oldSend(bullHelmet2("on"));
  2223.              this.oldSend(bullHelmet2("mOff"));
  2224.              document.dns(["13c", [0, switchToAccessory, 1]])
  2225.          } else if (x_arr_SSX.every( (num, idx) => END_SSWX[idx]==num ) ){
  2226.              console.info("ended swing");
  2227.              this.oldSend(bullHelmet2("off"));
  2228.              this.oldSend(bullHelmet2("mOn"));
  2229.              document.dns(["13c", [0, currentAccessory, 1]])
  2230.              IN_PROCESS = false;
  2231.          }
  2232.     }
  2233.  
  2234.  
  2235.     /*let usageArray = Array.from(new Uint8Array(m));
  2236.     if (usageArray.length == 45){
  2237.         if (usageArray[16] == 0 || usageArray[16] == 1) foodInHand = false;
  2238.         console.info(`Food in hand: null{foodInHand}`);
  2239.  
  2240.     };*/
  2241.  
  2242.     let realData = {}
  2243.     let realInfo = msgpack5.decode(x);
  2244.     if (realInfo[1] instanceof Array){
  2245.     realData.data = [realInfo[0], ...realInfo[1]]
  2246.     } else {
  2247.         realData.data = realInfo
  2248.     }
  2249.     //console.log(realData)
  2250.     //console.info("sent");
  2251.     //console.info(realData.data);
  2252.     if (realData.data[0] == "ch"){
  2253.        lastWords = realData.data[1];
  2254.  
  2255.  
  2256.     }
  2257.      if(realData.data[0]!="2")  {
  2258.          // console.info("HERE3");
  2259.        // console.info(realData.data[0])
  2260.       console.info(realData.data);
  2261.          // console.log(x);
  2262.     if (realData.data[0]=="3"){
  2263.          //console.info(realData.data[1]);
  2264.          /*console.info(new Uint8Array(m));
  2265.          if(typeof realData.data[1] != "number" && !nval){
  2266.              nval = realData.data[1];
  2267.              document.n = nval;
  2268.              console.info("SET NVAL to");
  2269.              console.info(nval);
  2270.  
  2271.  
  2272.          }*/
  2273.         /*console.info(typeof realData.data[2]);
  2274.         console.info(realData.data[2].buffer);
  2275.         goodData = realData.data;
  2276.         console.info(goodData);
  2277.         console.info(["5", 0, nval]);
  2278.         document.n = goodData[2];
  2279.         document.nval = nval*/
  2280.     }
  2281.      }
  2282.     //console.info(new Date().getTime());
  2283.     // console.log(realData.data[0]);
  2284.     if (realData.data[0]=="s"){
  2285.       console.info("user respawned");
  2286.        for (var elem of Object.values(allMooMooObjects)){
  2287.            console.info(elem);
  2288.           elem.style.opacity = 1;
  2289.         }
  2290.        justDied = false;
  2291.     } else if (realData.data[0]=="13c"){
  2292.         console.info("In Hat Part");
  2293.         console.info(realData);
  2294.         console.info(IN_PROCESS);
  2295.         console.info(realData.data.length == 4)
  2296.         console.info("test");
  2297.         if (!IN_PROCESS && realData.data.length == 4 && realData.data[3]==0 &&realData.data[1]==0){
  2298.             currentHat = realData.data[2];
  2299.             console.info("Changed hat to " + currentHat);
  2300.  
  2301.         } else if (!IN_PROCESS && realData.data.length == 4 && realData.data[3]==1 &&realData.data[1]==0){
  2302.             currentAccessory = realData.data[2];
  2303.             console.info("Changed accessory to " + currentAccessory);
  2304.         } else if (realData.data.length == 4 && realData.data[3] == 0 && realData.data[1]==1){
  2305.             let hatID = realData.data[2];
  2306.             if (hatID == obs("winter cap")){
  2307.                 hasWinter = true;
  2308.             } else if (hatID == obs("flipper hat")){
  2309.                 hasFlipper = true;
  2310.             }
  2311.             console.log("BOUGHT HAT");
  2312.         }
  2313.  
  2314.     } else if (realData.data[0]=="2"){
  2315.       MYANGLE = realData.data[1];
  2316.         //console.log("ANGLE");
  2317.  
  2318.     } else if (realData.data[0]=="5") {
  2319.        //console.info("hai");
  2320.         //console.info(new Uint8Array(m));
  2321.         //console.info(realData.data);
  2322.     }
  2323. };
  2324.  
  2325.  
  2326. function socketFound(socket){
  2327.     window.addEventListener("message", (message) => {
  2328.         if (message.origin != "http://scriptsourceapp.com") return;
  2329.  
  2330.            autoHealSpeed = message.data.autoHealSpeed;
  2331.            instaKillKey = message.data.instaKillKey;
  2332.            spikeKey = message.data.spikeKey;
  2333.            trapKey = message.data.trapKey;
  2334.                      iPressKey = message.data.iPressKey;
  2335.            switchToAccessory = message.data.switchToAccessory;
  2336.            switchToHat = message.data.switchToHat;
  2337.                      placeName = message.data.placeName;
  2338.                      putonName = message.data.putonName;
  2339.                      // oldAlert('hi');
  2340.            for (let keyobj of Object.keys(message.data.state)){
  2341.                  CORESTATE[keyobj] = {
  2342.                      active: false,
  2343.                      rel: message.data.state[keyobj][0],
  2344.                  }
  2345.            }
  2346.  
  2347.  
  2348.     });
  2349.     socket.addEventListener('message', function(message){
  2350.         handleMessage(message);
  2351.     });
  2352. }
  2353.  
  2354. function isElementVisible(e) {
  2355.     return (e.offsetParent !== null);
  2356. }
  2357.  
  2358. function aim(x, y){
  2359.      var cvs = document.getElementById("gameCanvas");
  2360.      cvs.dispatchEvent(new MouseEvent("mousemove", {
  2361.          clientX: x,
  2362.          clientY: y
  2363.  
  2364.      }));
  2365.  
  2366. }
  2367.  
  2368.  
  2369. function triggerAlert(name, id){
  2370.         hatChangeAlert.innerHTML = generateHatHTML(name, id);
  2371.         $("#hatChangeAlert").animate({opacity: 1, top: '20px'});
  2372.         setTimeout( () => {
  2373.             $("#hatChangeAlert").animate({opacity: 0, top: -300});
  2374.         }, 5000);
  2375. }
  2376.  
  2377.  
  2378.  
  2379.  
  2380. function heal(){
  2381.     console.log(hasApple);
  2382.     console.log("healing");
  2383.     if (recentHealth>=100) return;
  2384.     console.info(recentHealth);
  2385.     console.info(`HERE I AM IN THE HEAL FUNC with ${hasApple}`);
  2386.     var dataTemplate = {"data":[], "options":{"compress":true}, "nsp": "/", "type": 2};
  2387.     if (hasApple){
  2388.         if (!haveApple()){
  2389.             heal();
  2390.             return;
  2391.         }
  2392.         else { //User has apple
  2393.             document.dns(["5", [0, null]]);
  2394.  
  2395.         }
  2396.     }
  2397.     else { //User has cookie
  2398.         console.info('user has cookie');
  2399.           document.dns(["5", [1, null]]);
  2400.     }
  2401.     document.dns(["c", [1, 0]]);
  2402.  
  2403.  
  2404.     setTimeout( () => {
  2405.        document.dns(["c", [0, 0]]);
  2406.     }, 100);
  2407.     recentHealth += hasApple ? 20 : 40;
  2408.  
  2409. }
  2410.  
  2411. var runaway = false;
  2412.  
  2413. function handleMessage(m){
  2414.     if (repeatingLast){
  2415.        doNewSend(["ch", [lastWords]]);
  2416.     }
  2417.         var secondVote = autoattack;
  2418.         for (let obj of Object.values(CORESTATE)){
  2419.             if (obj.rel == "attack"){
  2420.                 console.log(obj)
  2421.                  if (obj.active == true){
  2422.                      secondVote = true;
  2423.                  } else {
  2424.                      secondVote = autoattack;
  2425.                  }
  2426.             } else if (obj.rel == "run"){
  2427.                 if (obj.active == true){
  2428.                     runaway = true;
  2429.                 } else {
  2430.                     runaway = false;
  2431.                 }
  2432.             }
  2433.         }
  2434.         autoattack = secondVote;
  2435.  
  2436.     let td = new Uint8Array(m.data);
  2437. //      console.info(td);
  2438.     //console.info(td);
  2439.     //console.info(td.slice(98,-1));
  2440.     var infotest = msgpack5.decode(td);
  2441.     var info;
  2442.     if(infotest.length > 1) {
  2443.         info = [infotest[0], ...infotest[1]];
  2444.         if (info[1] instanceof Array){
  2445.              info = info;
  2446.         }
  2447.     } else {
  2448.         info = infotest;
  2449.     }
  2450.  
  2451. // console.log(info);
  2452.    //console.info("received");
  2453.     //console.info(new Date().getTime());
  2454.     if(!info) return;
  2455.     //if(!["c","5", "3"].includes(info[0])) console.log(info[0])
  2456.      if (inInstaProcess){
  2457.         doNewSend(["2", [nearestPlayerAngle]]);
  2458.       }
  2459. //    doNewSend(["2", 0.45]);
  2460.     if (info[0]=="3"){ //player update
  2461.         botTag();
  2462.         playersNear = [];
  2463.         var locInfoNow = info[1];
  2464.         //console.log(locInfoNow)
  2465.         //console.info(locInfoNow);
  2466.         for (var i=0;i<locInfoNow.length/13;i++){
  2467.             var playerData = locInfoNow.slice(13*i, 13*i+13);
  2468.             if (playerData[0]==MYID){
  2469.                 myCLAN = playerData[7];
  2470.                 myPlayer = new player(playerData[0], playerData[1], playerData[2], playerData[7]);
  2471.  
  2472.                                 var newTraps = [];
  2473.                                 for (let arr of allTraps){
  2474.                                     let objx = arr[1];
  2475.                                     let objy = arr[2];
  2476.                                     let objtype = arr[arr.length-2];
  2477.                                     console.log(myPlayer);
  2478.                                     let totalDist = Math.sqrt( (objx-myPlayer.x)**2  + (objy-myPlayer.y)**2 );
  2479.                                     console.log(totalDist);
  2480.                                     if (objtype == 15 && totalDist < 100){
  2481.                                         let spikeVal;
  2482.                                         if (havePoison()) {
  2483.                                             spikeVal = 8;
  2484.                                         } else if (haveGreat()){
  2485.                                             spikeVal = 7;
  2486.                                         } else if (haveSpinning()){
  2487.                                             spikeVal = 9;
  2488.                                         } else {
  2489.                                             spikeVal = 6;
  2490.                                         }
  2491.  
  2492.                                         for (var j=0;j<0;j++){
  2493.                                             let angle = (-1 * Math.PI + ((Math.PI*2)/20)*j) - 0.1;
  2494.                                             placeSpike(spikeVal, angle);
  2495.                                             console.log("c.data " + j);
  2496.                                             console.log("c.data " + angle);
  2497.                                         }
  2498.  
  2499.                                             CORESTATE.intrap.active = true;
  2500.                                             CORESTATE.intrap.extra = arr[0]; //object id
  2501.  
  2502.                                     } else if (objtype == 15 && totalDist < 1500){
  2503.                                             newTraps.push(arr)
  2504.                                     }
  2505.                             }
  2506.                             allTraps = newTraps;
  2507.  
  2508.                 if (myPlayer.y < 2400){
  2509.                                     CORESTATE.inwater.active = false;
  2510.                                     if (!hasWinter) return;
  2511.                     if (previousZone != "winter"){
  2512.                         previousZone = "winter";
  2513.                         IN_PROCESS = true;
  2514.                         document.dns(["13c", [0, obs("winter cap"), 0]]);
  2515.                         IN_PROCESS = false;
  2516.                         if (askMeAgain) triggerAlert("Winter Cap", obs("winter cap"));
  2517.                 }
  2518.                 } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
  2519.                     CORESTATE.inwater.active = true;
  2520.                                         if (!hasFlipper) return;
  2521.                     if (previousZone != "river"){
  2522.                         previousZone = "river";
  2523.                         IN_PROCESS = true;
  2524.                         document.dns(["13c", [0, obs("flipper hat") , 0]]);
  2525.                         IN_PROCESS = false;
  2526.                        if (askMeAgain) triggerAlert("Flipper Hat", obs("flipper hat"));
  2527.                }
  2528.                 } else {
  2529.                                     CORESTATE.inwater.active = false;
  2530.                     if (previousZone != "normal"){
  2531.                     previousZone = "normal";
  2532.                     $("#hatChangeAlert").animate({opacity: 0, top: -300});
  2533.                     if (askMeAgain) document.dns(["13c", [0, currentHat, 0]]);
  2534.  
  2535.                 }
  2536.                 }
  2537.                 if (!targets.every(x => x===false)){
  2538.                     let targetXDir = targets[0];
  2539.                     let targetYDir = targets[1];
  2540.                     let correctAngle = Math.atan2(targetYDir-myPlayer.y, targetXDir-myPlayer.x);
  2541.                     document.dns(["3", [correctAngle]]);
  2542.                     //For every 1 second of travel, you go forward 320 pixels!
  2543.                     let totalDist = Math.sqrt( (targetXDir-myPlayer.x)**2  + (targetYDir-myPlayer.y)**2 );
  2544.                     let totalTime = Math.ceil(totalDist/319.2);
  2545.                     document.getElementById("timeest").innerHTML = `${totalTime} seconds...`
  2546.  
  2547.                     if (totalDist < 100){
  2548.                      targets = [false, false];
  2549.                      document.dns(["3", [null]]);
  2550.                      $("#infoDiv").animate({opacity: 0});
  2551.                     }
  2552.  
  2553.                 }
  2554.                 continue
  2555.             }
  2556.             if (playerData[7]===null || playerData[7] != myCLAN){
  2557.                  var locPlayer = new player(playerData[0], playerData[1], playerData[2], playerData[7]);
  2558.                  playersNear.push(locPlayer);
  2559.             }
  2560.  
  2561.         }
  2562.          var nearestPlayerPosition = playersNear.sort( (a,b) => pdist(a, myPlayer) - pdist(b, myPlayer) );
  2563.            var nearestPlayer = nearestPlayerPosition[0];
  2564.            focusPlayerObj = nearestPlayer;
  2565.            if (nearestPlayer){
  2566.                                 CORESTATE.nearenemy.active = true;
  2567.                nearestPlayerAngle = Math.atan2( nearestPlayer.y-myPlayer.y, nearestPlayer.x-myPlayer.x);
  2568.                if (autoattack){
  2569.                doNewSend(["3", [nearestPlayerAngle]]);
  2570.                              ws.send(encodeSEND([ "c",[1, null] ]));
  2571.                aim(nearestPlayer.x-myPlayer.x+window.innerWidth/2, nearestPlayer.y-myPlayer.y+window.innerHeight/2);
  2572.  
  2573.                $("#tbtn").css({opacity: 1, marginLeft: nearestPlayer.x-myPlayer.x+window.innerWidth/2-20, marginTop: nearestPlayer.y-myPlayer.y+window.innerHeight/2-20});
  2574.                          } else if (runaway) {
  2575.                                 doNewSend(["3", [-1 * nearestPlayerAngle]]);
  2576.                    //$("#tbtn").animate({opacity: 0.5});
  2577.                }
  2578.            } else {
  2579.                          CORESTATE.nearenemy.active = false;
  2580.              // $("#tbtn").animate({opacity: 0.5});
  2581.            }
  2582.  
  2583.     }
  2584.  
  2585.    if (info[0]=="6"){
  2586.         var locInfo = info[1];
  2587.         if (locInfo[locInfo.length-1].toString() == MYID){ //Object created
  2588.         if (window.innerWidth >= 770){
  2589.             console.log(locInfo);
  2590.             var itemID = `actionBarItem${locInfo[locInfo.length-2]+16}`;
  2591.             var imgURL = document.getElementById(itemID).style.backgroundImage.toString().match(/url\("(.+)?(?=")/)[1];
  2592.             console.info(imgURL);
  2593.             let mapDisplay = document.getElementById("mapDisplay").getBoundingClientRect();
  2594.             let mapSize = [14365, 14365];
  2595.             let boxSize = [$("#mapDisplay").width(), $("#mapDisplay").height()];
  2596.             let targets = [locInfo[1], locInfo[2]].map(item => (130*item)/14365);
  2597.             let x = mapDisplay.x + targets[0] - 6;
  2598.             let y = mapDisplay.y + targets[1] - 6;
  2599.             let newTarget = document.createElement("div");
  2600.             newTarget.rawX = targets[0];
  2601.             newTarget.rawY = targets[1];
  2602.             newTarget.rimgURL = imgURL;
  2603.             newTarget.style = `background-image: url("${imgURL}"); background-size: 12px 12px; width:12px; height:12px; position:absolute; left: ${x}px; top:${y}px; opacity:0; z-index:100; cursor: pointer;`;
  2604.             newTarget.className = "mapTarget";
  2605.             document.getElementsByTagName("body")[0].appendChild(newTarget);
  2606.             $(newTarget).animate({opacity: 1});
  2607.             allMooMooObjects[locInfo[0]] = newTarget;
  2608.  
  2609.         }
  2610.     } else {
  2611.             console.log(locInfo);
  2612.             for (var i=0;i<locInfo.length/8;i+=1){
  2613.             let arr = locInfo.slice(i*8, (i+1)*8); console.log(arr)
  2614.                 let objtype = arr[arr.length-2];
  2615.                 if (objtype == 15){
  2616.                     allTraps.push(arr);
  2617.                 }
  2618.  
  2619.         }
  2620.  
  2621.  
  2622.         }
  2623.     }
  2624.  
  2625.     if (info[0]=="12"){
  2626.  
  2627.         let newTraps = [];
  2628.         for (let trap of allTraps){
  2629.             if (trap[trap.length-2] != info[1]) newTraps.push(trap);
  2630.         }
  2631.         allTraps = newTraps;
  2632.  
  2633.  
  2634.         console.error(info);
  2635.        if (Object.keys(allMooMooObjects).includes(info[1].toString())){
  2636.             allMooMooObjects[info[1]].remove();
  2637.       }
  2638.             if (CORESTATE.intrap.active){
  2639.                 if (CORESTATE.intrap.extra == info[1]){
  2640.                         CORESTATE.intrap.active = false;
  2641.                     let newTraps = [];
  2642.                     for (let trap of allTraps){
  2643.                         if (trap[trap.length-2] != info[1]) newTraps.push(trap);
  2644.                     }
  2645.                     allTraps = newTraps;
  2646.                 }
  2647.             }
  2648.     }
  2649.  
  2650. //    console.info("-------------")
  2651.     if (info[0] == "1" && !MYID){
  2652.         MYID =  info[1];
  2653.     }
  2654.  
  2655.  
  2656.     if (info[0] == "18" && info[4]=="1200") {
  2657.         console.info(info);
  2658.       bowWorked = true;
  2659.     }
  2660.  
  2661.     if (info[0] == "h" && info[1] == MYID && autoheal){
  2662.           console.info("doing stuff");
  2663.         console.info(info);
  2664.         if (info[2] < 100 && info[2] > 0){
  2665.        recentHealth = info[2];
  2666.        console.info("RECEIVED:");
  2667.         console.info(info);
  2668.         //recentHealth += hasApple ? 20 : 40;
  2669.        console.info("heal notif sent");
  2670.        setTimeout( () => {
  2671.            heal();
  2672.        }, autoHealSpeed);
  2673.         } else if (info[2] > 0) {
  2674.             console.info("done healing");
  2675.             recentHealth = 100;
  2676.             if (foodInHand){
  2677.                console.info("okay bad thing happened");
  2678.              var dataTemplate5 = {"type": 2, "data":[], "options":{"compress":false}, "nsp": "/"};
  2679.              dataTemplate5["data"]=["5", [0, true]];
  2680.              let encoded5 = encodeSEND(dataTemplate5["data"]);
  2681.              ws.send(encoded5);
  2682.                 console.info("corrected bad thing");
  2683.             }
  2684.  
  2685.         } else {
  2686.             hasApple = true; //You've died tragically in combat; back to the apple for you!
  2687.             console.info("Setting has apple to true from here");
  2688.         }
  2689.     }
  2690.     else if(info[0] == "11"){
  2691.         console.info("doing death");
  2692.         for (var elem of Object.values(allMooMooObjects)){
  2693.            console.info(elem);
  2694.           elem.style.opacity = 0;
  2695.         }
  2696.         hasApple = true;
  2697.         justDied = true;
  2698.         recentHealth = 100;
  2699.  
  2700.     }
  2701.  
  2702. }
  2703.  
  2704. function pdist(player1, player2){
  2705.       return Math.sqrt( Math.pow((player2.y-player1.y), 2) + Math.pow((player2.x-player1.x), 2) );
  2706. }
  2707.  
  2708. function haveApple(){
  2709.     console.info("Im being used and justDied is:" + justDied);
  2710.     if (justDied){
  2711.         hasApple = true;
  2712.         return true;
  2713.     }
  2714.     if (hasApple) hasApple = isElementVisible(document.getElementById("actionBarItem16"));
  2715.     return hasApple;
  2716. }
  2717.  
  2718. function havePoison(){
  2719.     let hasPoison = true;
  2720.     if (hasPoison) hasPoison = isElementVisible(document.getElementById("actionBarItem24"));
  2721.     return hasPoison;
  2722. }
  2723.  
  2724. /*$(window).resize( () => {
  2725.      for (var elem of Object.values(allMooMooObjects)){
  2726.         let mapDisplay = document.getElementById("mapDisplay").getBoundingClientRect();
  2727.             let mapSize = [14365, 14365];
  2728.             let boxSize = [$("#mapDisplay").width(), $("#mapDisplay").height()];
  2729.             let x = mapDisplay.x + parseInt(elem.rawX) - 6;
  2730.             let y = mapDisplay.y + parseInt(elem.rawY) - 6;
  2731.             console.log(x, y);
  2732.             elem.style = `background-image: url("${elem.rimgURL}"); background-size: 12px 12px; width:12px; height:12px; position:absolute; left: ${x}px; top:${y}px; opacity:0; z-index:100; cursor: pointer;`;
  2733.      }
  2734. });*/
  2735.  
  2736. function haveGreat(){
  2737.     let hasGreat = true;
  2738.     if (hasGreat) hasGreat = isElementVisible(document.getElementById("actionBarItem23"));
  2739.     return hasGreat;
  2740. }
  2741.  
  2742. function haveSpinning(){
  2743.     let hasSpinning = true;
  2744.     if (hasSpinning) hasSpinning = isElementVisible(document.getElementById("actionBarItem25"));
  2745.     return hasSpinning;
  2746. }
  2747.  
  2748. function doNewSend(sender){
  2749.     ws.send(encodeSEND(sender));
  2750. }
  2751.  
  2752. function placeSpike(item, angle){
  2753.   ws.send(encodeSEND( ["5", [item, null]]));
  2754.   ws.send(encodeSEND([
  2755.   "c",
  2756.   [
  2757.     1,
  2758.     angle ? angle : null
  2759.   ]
  2760. ]));
  2761.  
  2762.   ws.send(encodeSEND([
  2763.   "c",
  2764.   [
  2765.     0,
  2766.     null
  2767.   ]
  2768. ])); //spike function by
  2769. }
  2770.  
  2771. $("#mapDisplay").on("click", (event) => {
  2772.     if (!targets.every(x=>x===false)) return;
  2773.  
  2774.      $("#spotDiv").css({zIndex: 10000});
  2775.     var xpos = event.pageX - $("#mapDisplay").offset().left;
  2776.     var ypos = event.pageY - $("#mapDisplay").offset().top;
  2777.     var mapWidth = $("#mapDisplay").width();
  2778.     var mapHeight = $("#mapDisplay").height();
  2779.     var shiftX = (xpos/mapWidth)*14365;
  2780.     var shiftY = (ypos/mapHeight)*14365;
  2781.     targets = [shiftX, shiftY];
  2782.     var infoDiv = document.createElement("div");
  2783.     infoDiv.innerHTML = `<h1 id="autotitle">You are currently in CloudyMod auto-pilot.</h1>
  2784.      <h3 id="arrivalest">You will arrive in <span id="timeest">30 seconds...</span></h3>
  2785.  
  2786.      <button type="button" id="cancelTrip">Cancel</button>`;
  2787.     infoDiv.id = "infoDiv";
  2788.     document.body.prepend(infoDiv);
  2789.  
  2790.    let spotDiv = document.createElement("div");
  2791.    spotDiv.id = "spotDiv";
  2792.    spotDiv.className = "spotDiv";
  2793.    document.body.prepend(spotDiv);
  2794.    $("#spotDiv").css({left: event.pageX, top: event.pageY});
  2795.    $("#spotDiv").animate({width: '50px', height: '50px', marginLeft: '-25px', marginTop: '-25px', borderRadius: '25px', opacity: 0}, 2000);
  2796.     var spotDivs = [];
  2797.    let coreInterval = setInterval( () => {
  2798.            console.log('looping');
  2799.            if (targets.every(x=>x===false)){
  2800.              clearInterval(coreInterval);
  2801.                console.log('clearing');
  2802.              for (let elementDiv of document.getElementsByClassName("spotDiv")){
  2803.                    document.body.removeChild(elementDiv);
  2804.              }
  2805.  
  2806.            } else {
  2807.            let spotDiv = document.createElement("div");
  2808.            spotDiv.id = "spotDiv";
  2809.                spotDiv.className = "spotDiv";
  2810.            document.body.prepend(spotDiv);
  2811.            $("#spotDiv").css({left: event.pageX, top: event.pageY});
  2812.            $("#spotDiv").animate({width: '50px', height: '50px', marginLeft: '-25px', marginTop: '-25px', borderRadius: '25px', opacity: 0}, 2000);
  2813.             spotDivs.push(spotDiv);
  2814.            }
  2815.     }, 700);
  2816.  
  2817. })
  2818.  
  2819. document.dns = doNewSend;
  2820.  
  2821.  
  2822. function botTag(){
  2823.   if (!botSpan || !isElementVisible(botSpan)){
  2824.             botSpan = document.createElement("span");
  2825.             botSpan.id = "botText";
  2826.             var ageDiv = document.getElementById("ageText");
  2827.              ageDiv.prepend(botSpan);
  2828.           }
  2829.  
  2830.           if (autoattack){
  2831.              botSpan.innerHTML = "BOT "
  2832.              console.log(botSpan);
  2833.               console.log(botSpan.id)
  2834.               console.log(botSpan.innerHTML)
  2835.           } else {
  2836.              $("#tbtn").animate({opacity: 0});
  2837.              botSpan.innerHTML = "";
  2838.           }
  2839. }
  2840.  
  2841. $(document).on("click", "#cancelTrip", () => {
  2842.            targets = [false, false];
  2843.            document.dns(["3", [null]]);
  2844.            $("#infoDiv").animate({opacity: 0});
  2845. })
  2846.  
  2847. document.title="CloudyMod: Autoheal ON"
  2848.  
  2849. document.addEventListener('keypress', (e)=>{
  2850.  
  2851.  
  2852.    if (e.keyCode == 116 && document.activeElement.id.toLowerCase() !== 'chatbox'){
  2853.        STATE+=1;
  2854.        let coreIndex = STATE%2; //STATE%4;
  2855.        //let truthArray = [ [1,2].includes(coreIndex), [0,1].includes(coreIndex)];
  2856.        //autobull = truthArray[0];
  2857.        autoheal = coreIndex == 0; //truthArray[1];
  2858.        document.title = document.title=`CloudyMod: Autoheal ${autoheal ? "ON" : "OFF"}` //"Heal " + (autoheal ? "ON" : "OFF") + " / Bull Hat " + (autobull ? "ON" : "OFF");
  2859.    } else if (e.keyCode == trapKey && document.activeElement.id.toLowerCase() !== 'chatbox') { //Place a trap
  2860.        console.log("UH OH")
  2861.         var dataTemplate = {"data":[], "options":{"compress":true}, "nsp": "/", "type": 2};
  2862.         var data50 = dataTemplate;
  2863.                 if (isElementVisible(document.getElementById("actionBarItem31"))){
  2864.         data50["data"]=["5", [15, 0]];
  2865.             } else {
  2866.                       data50["data"]=["5", [16, 0]];
  2867.                 }
  2868.         ws.send(encodeSEND(data50["data"]));
  2869.         var data51 = dataTemplate;
  2870.         data51["data"]=[
  2871.   "c",
  2872.   [
  2873.     1,
  2874.     null
  2875.   ]
  2876. ];
  2877.         let encoded2 = encodeSEND(data51["data"]);
  2878.         ws.send(encoded2);
  2879.         dataTemplate["data"]=["c",0, null];
  2880.         let encoded = encodeSEND(dataTemplate);
  2881.         ws.send(encoded);
  2882.  
  2883.       } else if (e.keyCode == 112 && document.activeElement.id.toLowerCase() !== 'chatbox'){
  2884.          autoattack = !autoattack
  2885.          botTag();
  2886.  
  2887.     } else if (e.keyCode == 103 && document.activeElement.id.toLowerCase() !== 'chatbox') {
  2888.         repeatingLast = !repeatingLast;
  2889.  
  2890.  
  2891.  
  2892.     }    else if (e.keyCode == spikeKey && document.activeElement.id.toLowerCase() !== 'chatbox') { //Place a spike
  2893.            if (havePoison()) {
  2894.              placeSpike(8);
  2895.            } else if (haveGreat()){
  2896.              placeSpike(7);
  2897.            } else if (haveSpinning()){
  2898.              placeSpike(9);
  2899.            } else {
  2900.              placeSpike(6);
  2901.          }
  2902.  
  2903.    } else if (e.keyCode == instaKillKey && document.activeElement.id.toLowerCase() !== 'chatbox') {
  2904.        let allActiveItems = Array.from(document.getElementById("actionBar").children).filter(x=>x.style.display != "none");
  2905.              let allActiveIDs = allActiveItems.map(x=>parseInt(x.id.replace("actionBarItem", "")));
  2906.              switchToWep = allActiveIDs[0];
  2907.              switchToRange = allActiveIDs[1];
  2908.        console.info(currentAccessory);
  2909.        var ctime = new Date().getTime();
  2910.        console.info(inInstaProcess)
  2911.        if (!inInstaProcess){
  2912.        console.info("got in");
  2913.        inInstaProcess = true
  2914.         IN_PROCESS = true;
  2915.  
  2916.        doNewSend(["13c", [0, bullHelm, 0]]);
  2917.           if (currentAccessory == monkeyTail){
  2918.                doNewSend(["13c", [0, 0, 1]]);
  2919.            }
  2920.        doNewSend(["5", [switchToWep, true]]);
  2921.        console.info("Starting at 0");
  2922.  
  2923.       //after bad
  2924.  
  2925.  
  2926.        setTimeout( () => {
  2927.            doNewSend(["2", [nearestPlayerAngle]]);
  2928.            doNewSend([
  2929.   "c",
  2930.   [
  2931.     1,
  2932.     null
  2933.   ]
  2934. ]); //If we're perfect, we only send this once
  2935.            console.info(`Sending swing at ${new Date().getTime() - ctime}`);
  2936.            ctime = new Date().getTime();
  2937.        }, 20);
  2938.  
  2939.  
  2940.  
  2941.        setTimeout( () => {
  2942.            doNewSend(["2", [nearestPlayerAngle]]);
  2943.            doNewSend(["5", [switchToRange, true]]);
  2944.            console.info(`Changed weapon at ${new Date().getTime() - ctime}`);
  2945.            ctime = new Date().getTime();
  2946.        }, document.timeTween); //120-140?
  2947.  
  2948.  
  2949.      setTimeout(() => {
  2950.  
  2951.              doNewSend(["13c", [0, turretGear, 0]]);
  2952.      }, 300);
  2953.  
  2954.        setTimeout( () => {
  2955.  
  2956.            doNewSend(["c", [0, null]]);
  2957.            //doNewSend(["13c", [0, currentHat, 0]]);
  2958.            if (currentAccessory == monkeyTail){
  2959.                 doNewSend(["13c", [0, currentAccessory, 1]]);
  2960.                     }
  2961.            doNewSend(["5", [switchToWep, true]]);
  2962.            console.info(`Finished at  ${new Date().getTime() - ctime}`);
  2963.            ctime = new Date().getTime();
  2964.        }, 600);
  2965.  
  2966.         setTimeout( () => {
  2967.           if (bowWorked){
  2968.           doNewSend(["5", [switchToRange, true]]);
  2969.         }
  2970.        }, 730);
  2971.  
  2972.         setTimeout( () => {
  2973.           if (bowWorked){
  2974.           doNewSend([
  2975.   "c",
  2976.   [
  2977.     1,
  2978.     null
  2979.   ]
  2980. ]);
  2981.         }
  2982.         doNewSend(["13c", [0, currentHat, 0]]); /*test*/
  2983.        }, 840);
  2984.  
  2985.       setTimeout( () => {
  2986.            if (bowWorked){
  2987.           doNewSend(["c", [0, null]]);
  2988.         }
  2989.        }, 950);
  2990.  
  2991.       setTimeout( () => {
  2992.           inInstaProcess = false;
  2993.           if (bowWorked){
  2994.          doNewSend(["5",  [switchToWep, true]]);
  2995.               setTimeout( () => {
  2996.          doNewSend(["c", [0, null]]);
  2997.               }, 300);
  2998.          bowWorked = false;
  2999.          IN_PROCESS = false;
  3000.        }
  3001.         IN_PROCESS = false;
  3002.        }, 1060);
  3003.  
  3004.     //if it worked, fire, if it didn't dont fire
  3005.        }
  3006.  
  3007. //IT WORKS ON AND OFF
  3008. //    WTF ??!?p!?
  3009.  
  3010.  
  3011.    } else if (document.activeElement.id.toLowerCase() !== 'chatbox' ){
  3012.        if (e.keyCode == 108){ //use pressed "l"; spikes
  3013.  
  3014.  
  3015.            let spikeVal;
  3016.                                         if (havePoison()) {
  3017.                                             spikeVal = 8;
  3018.                                         } else if (haveGreat()){
  3019.                                             spikeVal = 7;
  3020.                                         } else if (haveSpinning()){
  3021.                                             spikeVal = 9;
  3022.                                         } else {
  3023.                                             spikeVal = 6;
  3024.                                         }
  3025.  
  3026.  
  3027.          for (var i=0;i<4;i++){
  3028.              let angle = (Math.PI/2)*i;
  3029.              /*let x = Math.cos(angle)*50;
  3030.              let y = Math.sin(angle)*50;
  3031.              console.log(x, y);
  3032.              aim(x, y);*/
  3033.              document.dns(["2", [angle]]);
  3034.              placeSpike(spikeVal);
  3035.  
  3036.          }
  3037.  
  3038.  
  3039.        } else if (e.keyCode == 111){ //user pressed "i"; traps
  3040.            for (var j=0;j<4;j++){
  3041.               document.dns(["2", [(Math.PI/2)*j]]);
  3042.               document.dns(["5", [15, 0]]);
  3043.               document.dns(["c", [1, null]]);
  3044.               document.dns(["c", [0, null]]);
  3045.            }
  3046.  
  3047.        } else if (e.keyCode == iPressKey){
  3048.  
  3049.                  if (CORESTATE.ipress.rel){
  3050.                         if (CORESTATE.ipress.rel == "puton"){
  3051.                                 document.dns(["13c", [0, putonName, 0]]);
  3052.                         } else if (CORESTATE.ipress.rel == "place"){
  3053.                             placeSpike(placeName);
  3054.                         }
  3055.                  }
  3056.              }
  3057.       else if (e.keyCode == 104){
  3058.           if (focusPlayerObj && focusPlayerObj.clan){
  3059.              document.dns(["10", [focusPlayerObj.clan]]);
  3060.           }
  3061.       }
  3062.   }
  3063. });
  3064.  
  3065. window.kiH = () => {};
  3066.  
  3067. document.body.oncontextmenu = (e) => {
  3068.  
  3069.    noallow = true;
  3070.  
  3071.     setTimeout( () =>  {
  3072.  
  3073.      let allActiveItems = Array.from(document.getElementById("actionBar").children).filter(x=>x.style.display != "none");
  3074.              let allActiveIDs = allActiveItems.map(x=>parseInt(x.id.replace("actionBarItem", "")));
  3075.              switchToWep = allActiveIDs[0];
  3076.              switchToRange = allActiveIDs[1];
  3077.        console.info(currentAccessory);
  3078.        var ctime = new Date().getTime();
  3079.        console.info(inInstaProcess)
  3080.        if (!inInstaProcess){
  3081.        console.info("got in");
  3082.        inInstaProcess = true
  3083.         IN_PROCESS = true;
  3084.  
  3085.        doNewSend(["13c", [0, bullHelm, 0]]);
  3086.           if (currentAccessory == monkeyTail){
  3087.                doNewSend(["13c", [0, 0, 1]]);
  3088.            }
  3089.        doNewSend(["5", [switchToWep, true]]);
  3090.        console.info("Starting at 0");
  3091.  
  3092.       //after bad
  3093.  
  3094.  
  3095.        setTimeout( () => {
  3096.            doNewSend(["2", [nearestPlayerAngle]]);
  3097.            doNewSend([
  3098.   "c",
  3099.   [
  3100.     1,
  3101.     null
  3102.   ]
  3103. ]); //If we're perfect, we only send this once
  3104.            console.info(`Sending swing at ${new Date().getTime() - ctime}`);
  3105.            ctime = new Date().getTime();
  3106.        }, 20);
  3107.  
  3108.  
  3109.  
  3110.        setTimeout( () => {
  3111.            doNewSend(["2", [nearestPlayerAngle]]);
  3112.            doNewSend(["5", [switchToRange, true]]);
  3113.            console.info(`Changed weapon at ${new Date().getTime() - ctime}`);
  3114.            ctime = new Date().getTime();
  3115.        }, document.timeTween); //120-140?
  3116.  
  3117.  
  3118.  
  3119.  
  3120.        setTimeout( () => {
  3121.            doNewSend(["c", [0, null]]);
  3122.            doNewSend(["13c", [0, currentHat, 0]]);
  3123.            if (currentAccessory == monkeyTail){
  3124.                 doNewSend(["13c", [0, currentAccessory, 1]]);
  3125.                     }
  3126.            doNewSend(["5", [switchToWep, true]]);
  3127.            console.info(`Finished at  ${new Date().getTime() - ctime}`);
  3128.            ctime = new Date().getTime();
  3129.        }, 600);
  3130.  
  3131.         setTimeout( () => {
  3132.           if (bowWorked){
  3133.           doNewSend(["5", [switchToRange, true]]);
  3134.         }
  3135.        }, 730);
  3136.  
  3137.         setTimeout( () => {
  3138.           if (bowWorked){
  3139.           doNewSend([
  3140.   "c",
  3141.   [
  3142.     1,
  3143.     null
  3144.   ]
  3145. ]);
  3146.         }
  3147.        }, 840);
  3148.  
  3149.       setTimeout( () => {
  3150.            if (bowWorked){
  3151.           doNewSend(["c", [0, null]]);
  3152.         }
  3153.        }, 950);
  3154.  
  3155.       setTimeout( () => {
  3156.           inInstaProcess = false;
  3157.           if (bowWorked){
  3158.          doNewSend(["5",  [switchToWep, true]]);
  3159.               setTimeout( () => {
  3160.          doNewSend(["c", [0, null]]);
  3161.               }, 300);
  3162.          bowWorked = false;
  3163.          IN_PROCESS = false;
  3164.        }
  3165.         IN_PROCESS = false;
  3166.        }, 1060);
  3167.  
  3168.     //if it worked, fire, if it didn't dont fire
  3169.        }
  3170.  
  3171. //IT WORKS ON AND OFF
  3172. //    WTF ??!?p!?
  3173.  
  3174.  
  3175.     }, 150);
  3176. }
  3177.  
  3178.  
  3179. document.ps = placeSpike;
  3180.  
  3181.     });
  3182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement