Maxtri Mod

Shows a lot of info about the game. Press "F" to turn the display on/off.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Maxtri Mod
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Shows a lot of info about the game. Press "F" to turn the display on/off.
// @author       Sopur
// @match        http://maxtri.glitch.me/
// @match        http://maxtri.ml/
// @match        http://maxtri-beta-server.glitch.me/
// @grant        none
// ==/UserScript==

const gui = document.createElement("div"); document.body.appendChild(gui);

var display = true;
var Mpos = "None"; // Mouse position
var Mcords = "None"; // Mouse cords
var Ppos = "None"; // Player position
var Pnear = "False"; // Players nearby
var Kpress = "None"; // Keys pressed
var Lmove = "None"; // Last movement sent
var Lupgrade = "None"; // Last upgrade sent
var Lchat = "None"; // Last chat sent

document.addEventListener('keydown', function (event) {
    let keyCode = event.keyCode || event.which;
    if (keyCode === 70) { //F
        if (display) {
            display = false;
            window.global.chat_message.push({ content: `Display is off. Press "F" to turn it on.`, time: 500, color: 16, alphasize: 0 });
        } else {
            display = true;
            window.global.chat_message.push({ content: `Display is on. Press "F" to turn it off.`, time: 500, color: 16, alphasize: 0 });
        };
    };
});

const update = () => {
    let HTML;
    if (display) {
        HTML = `<style>
.main {
pointer-events: none; position: fixed; top: 150px; left: 50px;
font-family: 'Comic Sans MS', cursive, sans-serif;
color: #FFFFFF; font-style: normal; font-variant: normal;
}
</style>
<div class="main" id="all">
<p id="guia">Mouse position:  ${Mpos}<br><br>Player position:  ${Ppos}<br><br>Mouse cords:  ${Mcords}<br><br>Players nearby:  ${Pnear}<br><br>Keys pressed:  ${Kpress}<br><br>Last movement sent:  ${Lmove}<br><br>Last upgrade sent:  ${Lupgrade}<br><br>Last chat sent:  ${Lchat}</p></div>`
    } else {
        HTML = `<style>
.main {
pointer-events: none; position: fixed; top: 150px; left: 50px;
font-family: 'Comic Sans MS', cursive, sans-serif;
color: #FFFFFF; font-style: normal; font-variant: normal;
}
</style>
<div class="main" id="all">
<p id="guia"></p></div>`
    }
    gui.innerHTML = HTML;
};

document.addEventListener('keydown', (event) => { Kpress = event.key });
window.addEventListener('mousemove', (event) => {
    Mpos = `${event.clientX}, ${event.clientY}`;
    try {
        let X = event.clientX - (window.win_size[0] / 2);
        let Y = event.clientY - (window.win_size[1] / 2);
        let newX = Math.abs(window.netX);
        let newY = Math.abs(window.netY);
        X = Math.round(newX + X);
        Y = Math.round(newY + Y);
        Mcords = `${X}, ${Y}`;
    } catch (err) { Mcords = "None" };
});
WebSocket.prototype.qwer15 = WebSocket.prototype.send
WebSocket.prototype.send = function (data) {
    let message = new Uint8Array(data);
    if (message[0] === 5) Lupgrade = message;
    if (message[0] === 2) Lmove = message;
    if (message[0] === 1) Lchat = message;
    this.qwer15(data);
};


setInterval(() => {
    try {
        var world = JSON.stringify(window.world.entities);
        if (world.includes("name")) {
            let info = world.split('name');
            info = `{"name${info[1]}}`;
            info = `${info.split(",")[0]}}`;
            info = JSON.parse(info);
            Pnear = info.name;
        } else { Pnear = "None"; }
    } catch (err) { Pnear = "None"; };
    try {
        let X = Math.abs(window.netX);
        let Y = Math.abs(window.netY);
        Ppos = `${X}, ${Y}`;
    } catch (err) { Ppos = "None"; };
    update();
}, 50);

document.getElementById('playerKey').style.display = 'block';