Agma Chat Command Settings

Config your settings using the chat

ของเมื่อวันที่ 29-08-2019 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Agma Chat Command Settings
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Config your settings using the chat
// @author       Nuke
// @match        http://agma.io/
// @grant        none
// ==/UserScript==

var input = $("#chtbox");
var inputVal = input.val();
var prefix = "/";

input.on("keydown", function (e) {

    function announce(arg1, arg2) {
        var result;
        if (arg2 === true) {
            result = 'enabled';
        } else if (arg2 === false) {
            result = 'disabled';
        }
        if (result === 'enabled') {
            $("#curser").fadeIn().text('The setting "'+arg1+'" is now '+result+'!').css({color: '#00c000'});
        } else if (result === 'disabled') {
            $("#curser").fadeIn().text('The setting "'+arg1+'" is now '+result+'!').css({color: '#ff0000'});
        }

        setTimeout(function() {
            $("#curser").fadeOut();
        }, 4000);
    }

    inputVal = input.val();
    if ($(this).is(":focus") && e.keyCode == '13') {
        // Ignore if message doesn't start with prefix
        if (inputVal.indexOf(prefix) !== 0) return;

        const args = inputVal.slice(prefix.length).trim().split(/ +/g);
        const command = args.shift().toLowerCase();

        // commands

        if (command === "setting") {
            if (args.length === 2) {
                if (args[1] === "on") {
                    args[1] = true;
                } else if (args[1] === "off") {
                    args[1] = false;
                } else {
                    return;
                }
                switch (args[0]) {
                    case 'skins':
                        setSkins(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'wearables':
                        setWearables(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'colors':
                        setColors(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'shownames':
                        setNames(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'minionnames':
                        setMinionNames(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'largenames':
                        setLargeNames(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'nameoutlines':
                        setNameOutlines(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'showmass':
                        setMass(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'showfood':
                        setFood(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'mapborder':
                        setMapBorder(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'fancygrid':
                        setFancyGrid(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'sectiongrid':
                        setSectionGrid(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'gridlines':
                        setGrid(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'darktheme':
                        setDark(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'infinitezoom':
                        setZoom(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'fixedzoom':
                        setFixedZoom(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'slowmotion':
                        setSlowMotion(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'minionpanel':
                        setMinionUi(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'leaderboard':
                        setLeaderboard(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'chat':
                        setChat(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'minimap':
                        setMinimap(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'cellborders':
                        setCellBorders(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'transparentviruses':
                        setTransparentViruses(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'classicviruslook':
                        setClassicViruses(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'polygonshapes':
                        setPolygonShapes(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'lineshapes':
                        setLineShapes(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                    case 'bubblecells':
                        setBubbleCells(args[1])
                        $("#chtbox").val("")
                        announce(args[0], args[1])
                        break;
                }
            }
        }
        if (command === 'help') {
            window.open('https://nuke.wtf/projects/agma-chat-commands', '_blank');
            $("#chtbox").val("")
        }
    }
})