Dit script moet niet direct worden geïnstalleerd - het is een bibliotheek voor andere scripts om op te nemen met de meta-richtlijn // @require https://update.sleazyfork.org/scripts/400105/789842/headjs_2.js
document.addEventListener('keydown', function(e){
if (e.keyCode == 71){
if (document.activeElement.id == 'chatBox') return;
if (document.activeElement.id == 'allianceInput') return;
let Storekey = document.getElementById('storeMenu');
if (Storekey.style.display == "none")
{
Storekey.style.display = "block"
}
else if (Storekey.style.display == "block")
{
Storekey.style.display = "none"
}
}
})
$("#consentBlock").css({display: "none"});
//$("#youtuberOf").css({display: "none"});
document.getElementById("moomooio_728x90_home").style.display = "none";
$("#moomooio_728x90_home").parent().css({display: "none"});
window.onbeforeunload = null;
let mouseX;
let mouseY;
let width;
let height;
function normal() {
hat(normalHat);
acc(normalAcc);
}
function aim(x, y){
var cvs = document.getElementById("gameCanvas");
cvs.dispatchEvent(new MouseEvent("mousemove", {
clientX: x,
clientY: y
}));
}
let coreURL = new URL(window.location.href);
window.sessionStorage.force = coreURL.searchParams.get("fc");
if (window.sessionStorage.force != "false" && window.sessionStorage.force && window.sessionStorage.force.toString() != "null"){
document.getElementsByClassName("menuHeader")[0].innerHTML = `Servers <span style="color: red;">Force (${window.sessionStorage.force})</span>`;
}
class ForceSocket extends WebSocket {
constructor(...args){
if (window.sessionStorage.force != "false" && window.sessionStorage.force && window.sessionStorage.force.toString() != "null"){
let server = window.sessionStorage.force;
let sip = "";
for (let gameServer of window.vultr.servers){
if (`${gameServer.region}:${gameServer.index}:0` == server){
sip = gameServer.ip;
}
}
args[0] = `wss://ip_${sip}.moomoo.io:8008/?gameIndex=0`;
delete window.sessionStorage.force;
}
super(...args);
}
}
WebSocket = ForceSocket;
var nearestEnemy;
var nearestEnemyAngle;
var isEnemyNear;
var instaSpeed = 230;
var primary;
var secondary;
var foodType;
var wallType;
var spikeType;
var millType;
var mineType;
var boostType;
var turretType;
var spawnpadType;
var autoaim = false;
var tick = 0;
var oldHat;
var oldAcc;
var enemiesNear;
var normalHat;
var normalAcc;
var ws;
var msgpack5 = msgpack;
let myPlayer = {
id: null,
x: null,
y: null,
dir: null,
object: null,
weapon: null,
clan: null,
isLeader: null,
hat: null,
accessory: null,
isSkull: null
};
let healSpeed = 100;
var messageToggle = 0;
var clanToggle = 0;
let healToggle = 0;
let hatToggle = 0;
document.msgpack = msgpack;
function n(){
this.buffer = new Uint8Array([0]);
this.buffer.__proto__ = new Uint8Array;
this.type = 0;
}
WebSocket.prototype.oldSend = WebSocket.prototype.send;
WebSocket.prototype.send = function(m){
if (!ws){
document.ws = this;
ws = this;
socketFound(this);
}
this.oldSend(m);
};
function socketFound(socket){
socket.addEventListener('message', function(message){
handleMessage(message);
});
}
function handleMessage(m){
let temp = msgpack5.decode(new Uint8Array(m.data));
let data;
if(temp.length > 1) {
data = [temp[0], ...temp[1]];
if (data[1] instanceof Array){
data = data;
}
} else {
data = temp;
}
let item = data[0];
if(!data) {return};
if(item === "io-init") {
let cvs = document.getElementById("gameCanvas");
width = cvs.clientWidth;
height = cvs.clientHeight;
$(window).resize(function() {
width = cvs.clientWidth;
height = cvs.clientHeight;
});
cvs.addEventListener("mousemove", e => {
mouseX = e.clientX;
mouseY = e.clientY;
});
}
if (item == "1" && myPlayer.id == null){
myPlayer.id = data[1];
}
if (item == "33") {
enemiesNear = [];
for(let i = 0; i < data[1].length / 13; i++) {
let playerInfo = data[1].slice(13*i, 13*i+13);
if(playerInfo[0] == myPlayer.id) {
myPlayer.x = playerInfo[1];
myPlayer.y = playerInfo[2];
myPlayer.dir = playerInfo[3];
myPlayer.object = playerInfo[4];
myPlayer.weapon = playerInfo[5];
myPlayer.clan = playerInfo[7];
myPlayer.isLeader = playerInfo[8];
myPlayer.hat = playerInfo[9];
myPlayer.accessory = playerInfo[10];
myPlayer.isSkull = playerInfo[11];
} else if(playerInfo[7] != myPlayer.clan || playerInfo[7] === null) {
enemiesNear.push(playerInfo);
}
}
}
isEnemyNear = false;
if(enemiesNear) {
nearestEnemy = enemiesNear.sort((a,b) => dist(a, myPlayer) - dist(b, myPlayer))[0];
}
if(nearestEnemy) {
nearestEnemyAngle = Math.atan2(nearestEnemy[2]-myPlayer.y, nearestEnemy[1]-myPlayer.x);
if(Math.sqrt(Math.pow((myPlayer.y-nearestEnemy[2]), 2) + Math.pow((myPlayer.x-nearestEnemy[1]), 2)) < 300) {
isEnemyNear = true;
if(autoaim == false && myPlayer.hat != 7 && myPlayer.hat != 53) {
normalHat = 6;
if(primary != 8) {
normalAcc = 19
}
};
}
}
if(isEnemyNear == false && autoaim == false) {
normalAcc = 11;
if (myPlayer.y < 2400){
normalHat = 15;
} else if (myPlayer.y > 6850 && myPlayer.y < 7550){
normalHat = 31;
} else {
normalHat = 12;
}
}
if (!nearestEnemy) {
nearestEnemyAngle = myPlayer.dir;
}
if(item == "h" && data[1] == myPlayer.id) {
if(data[2] < 100 && data[2] > 0 && healToggle == 1) {
setTimeout( () => {
place(foodType, null);
}, healSpeed);
}
}
update();
}
function doNewSend(sender){
ws.send(new Uint8Array(Array.from(msgpack5.encode(sender))));
}
function acc(id) {
doNewSend(["13c", [0, 0, 1]]);
doNewSend(["13c", [0, id, 1]]);
}
function hat(id) {
doNewSend(["13c", [0, id, 0]]);
}
function place(id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) {
doNewSend(["5", [id, null]]);
doNewSend(["c", [1, angle]]);
doNewSend(["c", [0, angle]]);
doNewSend(["5", [myPlayer.weapon, true]]);
}
var repeater = function(key, action, interval) {
let _isKeyDown = false;
let _intervalId = undefined;
return {
start(keycode) {
if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
_isKeyDown = true;
if(_intervalId === undefined) {
_intervalId = setInterval(() => {
action();
if(!_isKeyDown){
clearInterval(_intervalId);
_intervalId = undefined;
console.log("claered");
}
}, interval);
}
}
},
stop(keycode) {
if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
_isKeyDown = false;
}
}
};
}
const healer = repeater(81, () => {place(foodType)}, 80);
const heal = repeater(81, () => {place(foodType)}, 90);
const boostPlacer = repeater(70, () => {place(boostType)}, 0);
const spikePlacer = repeater(86, () => {place(spikeType)}, 0);
const millPlacer = repeater(78, () => {place(millType)}, 0);
const turretPlacer = repeater(56, () => {place(turretType)}, 0);
const wallPlacer = repeater(52, () => {place(wallType)}, 0);
document.addEventListener('keydown', (e)=>{
spikePlacer.start(e.keyCode);
healer.start(e.keyCode);
heal.start(e.keyCode);
boostPlacer.start(e.keyCode);
millPlacer.start(e.keyCode);
wallPlacer.start(e.keyCode);
turretPlacer.start(e.keyCode);
if (e.keyCode == 84 && document.activeElement.id.toLowerCase() !== 'chatbox') {
hat(7);
}
if (e.keyCode == 16 && document.activeElement.id.toLowerCase() !== 'chatbox') {
hat(12);
}
if (e.keyCode == 32 && document.activeElement.id.toLowerCase() !== 'chatbox') {
hat(7);
}
if (e.keyCode == 89 && document.activeElement.id.toLowerCase() !== 'chatbox') {
hat(6);
}
if (e.keyCode == 67 && document.activeElement.id.toLowerCase() !== 'chatbox') {
hat(40);
}
if (e.keyCode == 75 && document.activeElement.id.toLowerCase() !== 'chatbox') {
hat(20);
}
if (e.keyCode == 90 && document.activeElement.id.toLowerCase() !== 'chatbox') {
hat(53);
}
if (e.keyCode == 192 && document.activeElement.id.toLowerCase() !== 'chatbox') {
hat(0);
}
if(e.keyCode == 82 && document.activeElement.id.toLowerCase() !== 'chatbox') {
autoaim = false;
doNewSend(["5", [primary, true]]);
doNewSend(["c", [1]]);
setTimeout( () => {
doNewSend(["13c", [0, 53, 0]]);
doNewSend(["5", [secondary, true]]);
}, instaSpeed - 105);
setTimeout( () => {
doNewSend(["5", [primary, true]]);
doNewSend(["c", [0, null]]);
autoaim = false;
}, instaSpeed);
}
if(e.keyCode == 97 && document.activeElement.id.toLowerCase() !== 'chatbox') { ///num1 katana [age 8]
doNewSend(["6", [4]]);
}
if(e.keyCode == 98 && document.activeElement.id.toLowerCase() !== 'chatbox') { ///num2 musket [age 9]
doNewSend(["6", [15]]);
}
if(e.keyCode == 105 && document.activeElement.id.toLowerCase() !== 'chatbox') { ///num9 max mill [age 8]
doNewSend(["6", [28]]);
}
})
document.addEventListener('keyup', (e)=>{
spikePlacer.stop(e.keyCode);
boostPlacer.stop(e.keyCode);
millPlacer.stop(e.keyCode);
turretPlacer.stop(e.keyCode);
wallPlacer.stop(e.keyCode);
healer.stop(e.keyCode);
heal.stop(e.keyCode);
})
function isElementVisible(e) {
return (e.offsetParent !== null);
}
function toRad(angle) {
return angle * 0.01745329251;
}
function dist(a, b){
return Math.sqrt( Math.pow((b.y-a[2]), 2) + Math.pow((b.x-a[1]), 2) );
}
function update() {
for (let i=0;i<9;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
primary = i;
}
}
for (let i=9;i<16;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
secondary = i;
}
}
for (let i=16;i<19;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
foodType = i - 16;
}
}
for (let i=19;i<22;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
wallType = i - 16;
}
}
for (let i=22;i<26;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
spikeType = i - 16;
}
}
for (let i=26;i<29;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
millType = i - 16;
}
}
for (let i=29;i<31;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
mineType = i - 16;
}
}
for (let i=31;i<33;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
boostType = i - 16;
}
}
for (let i=33;i<39;i++){
if (isElementVisible(document.getElementById("actionBarItem" + i.toString())) && i != 36){
turretType = i - 16;
}
}
spawnpadType = 36;
}
function createTribe(name) {
leaveTribe();
doNewSend(["8", [name]]);
}
function leaveTribe() {
doNewSend(["9", [null]]);
}
var _msgs = ["Hack_Load.", "Hack_Load..", "Hack_Load...", "Hack_Load...."];
var msgs = _msgs;
var msgCycleSwitch = false;
var shift = false;
var minus = false;
var home = false;
var chat;
var msgNum = 0;
var socket = null;
var scriptSetup = false;
WebSocket = class extends WebSocket {
constructor(...arg) {
super(...arg);
if (!scriptSetup){
scriptSetup = true;
styleInit();
ren_overlay();
window.onbeforeunload = function (){
return 'Are you sure you want to leave?';
};
}
socket = this;
}
};
if (storageAvailable('localStorage')){
if (!localStorage.getItem("msgs")){
localStorage.setItem("msgs", JSON.stringify(msgs));
}else{
let temp;
try{
temp = JSON.parse(localStorage.getItem("msgs"));
}
catch (e){
alert("Invalid Array! Setting default...");
saveData();
temp = "";
}
if (temp !== ""){
msgs = temp;
}
}
}
const overlay = {};
overlay.keyCode = 36;
overlay.toggle = false;
overlay.inputString = msgs.join("\n");
overlay.tempMsgs = _msgs;
function styleInit() {
addGlobalStyle(`#chatCyclerUI{padding: 0.2em; margin:0.2em; position: absolute;top: 0;left: 0;width: 30%;
background-color: rgba(255, 255, 255, 0.35);display:none;}`);
addGlobalStyle(".table{ display: table; text-align: center; width: 100%; height: 80%;}");
addGlobalStyle(".row{ display: table-row; }");
addGlobalStyle(`.cell{ display: table-cell; padding: 0px 0.3em;border: 1px solid rgba(0, 0, 0, 0.5);}`);
addGlobalStyle(`.backRed{background-color:#f14e54}`);
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) {
return;
}
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
}
function toggleOverlay(tf){
if (tf){
document.querySelector('#chatCyclerUI').style.display = "block";
}else{
document.querySelector('#chatCyclerUI').style.display = "none";
}
};
function ren_overlay(){
const title = `<div style="font-size:32px;color:rgba(0, 0, 0, 0.75)">Menu</div>`;
const descr = `<div>Press HOME to repeat this menu.</div>`;
const body = `
<div class="table">
<div class="row">Message Settings
</div>
<div class="row">
<div class="cell" style="vertical-align:middle">Messages</div>
<div class="cell" style="vertical-align:middle"><textarea name="overlay_messages" rows=4 cols=32 style="background-color:rgba(255, 255, 255, 0.35);resize:none; rgba(255, 255, 255, 0.75) padding-left: 0px;border-left-width: 0px;border-top-width: 0px;padding-top: 0px;padding-right: 0px;border-right-width: 0px;padding-bottom: 0px;border-bottom-width: 0px;"></textarea></div>
</div>
<div class="row">
<div class="cell" style="vertical-align:middle">Save Message </div>
<div class="cell" style="vertical-align:middle"><input type="button" name="overlay_update_cycle" value="Save" style="border-right-width: 0px;border-left-width: 0px;border-top-width: 0px;padding-left: 6px;border-bottom-width: 0px;"></div>
</div>
<br>
<div class="row">Message Repeat
</div>
<div class="row">
<div class="cell" style="vertical-align:middle">Repeat<br><span class="overlay_cycle_toggle_value"><span style="font-size:24px;color:rgba(0, 0, 0, 0.75)";>Off</span></span></div>
<div class="cell" style="vertical-align:middle"><input type="button" name="overlay_cycle_toggle" value="Repeat"></div>
</div>
</div>`;
const footer = `<div style="font-size:24px;color:rgba(0, 0, 0, 0.75)">AutoChat</div>`;
const temp = `${title} ${body} ${descr} ${footer}`;
const d = document.createElement("div")
d.id = "chatCyclerUI";
d.innerHTML = temp;
d.style.zIndex = 999999;
document.body.appendChild(d);
const val = document.querySelector('textarea[name="overlay_messages"]');
val.value = overlay.inputString;
val.addEventListener('input', function(e) {
overlay.inputString = e.target.value;
});
document.querySelector('input[name="overlay_update_cycle"]').addEventListener('click', function() {
if (!overlay.inputString){
overlay.tempMsgs = _msgs;
}else{
overlay.tempMsgs = overlay.inputString.split(/\r?\n/);
}
msgNum = 99;
msgs = overlay.tempMsgs;
saveData();
});
document.querySelector('input[name="overlay_cycle_toggle"]').addEventListener('click', function(e) {
msgCycleSwitch = !msgCycleSwitch;
if (msgCycleSwitch){
chat = setInterval(autoChat, 1);
document.querySelector('.overlay_cycle_toggle_value').innerHTML = `<span style="font-size:24px;color:rgba(0, 0, 0, 0.75)";>On</span>`;
}else{
document.querySelector('.overlay_cycle_toggle_value').innerHTML = `<span style="font-size:24px;color:rgba(0, 0, 0, 0.75)";>Off</span>`;
clearInterval(chat);
msgNum = 0;
}
});
}
function concatBuffers(buffer1, buffer2){
var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
tmp.set(new Uint8Array(buffer1), 0);
tmp.set(new Uint8Array(buffer2), buffer1.byteLength);
return tmp.buffer;
}
const four = Uint8Array.from([4]).buffer;
function autoChat(){
socket && socket.send(msgpack.encode(["ch", [msgs[msgNum]]]));
msgNum++;
if (msgNum >= msgs.length) msgNum = 0;
}
function storageAvailable(type){
try{
var storage = window[type],
x = '__storage_test__';
storage.setItem(x, x);
storage.removeItem(x);
return true;
}
catch(e){
return false;
}
}
function saveData(){
if (storageAvailable('localStorage')){
localStorage.setItem("msgs", JSON.stringify(msgs));
}
}
window.addEventListener('keydown', function (event){
if (overlay.toggle) event.stopImmediatePropagation();
if (!minus && event.keyCode === 19){ //L
msgCycleSwitch = !msgCycleSwitch;
if (msgCycleSwitch){
chat = setInterval(autoChat, 0);
}else{
clearInterval(chat);
msgNum =0;
}
minus = true;
}
if (!home && event.keyCode === overlay.keyCode){ //HOME
overlay.toggle = !overlay.toggle;
toggleOverlay(overlay.toggle);
home = true;
}
});
window.addEventListener('keypress', function (event){
if (overlay.toggle) event.stopImmediatePropagation();
});
window.addEventListener('keyup', function (event){
if (overlay.toggle) event.stopImmediatePropagation();
if (event.keyCode == 19){
minus = true;
}else if (event.keyCode == 36){
home = true;
}
});