Agma Chat Command Settings

Configure your settings using the chat.

À partir de 2021-08-14. Voir la dernière version.

Vous devrez installer une extension telle que Tampermonkey, Greasemonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Violentmonkey pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey ou Userscripts pour installer ce script.

Vous devrez installer une extension telle que Tampermonkey pour installer ce script.

Vous devrez installer une extension de gestionnaire de script utilisateur pour installer ce script.

(J'ai déjà un gestionnaire de scripts utilisateur, laissez-moi l'installer !)

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension telle que Stylus pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

Vous devrez installer une extension du gestionnaire de style pour utilisateur pour installer ce style.

(J'ai déjà un gestionnaire de style utilisateur, laissez-moi l'installer!)

// ==UserScript==
// @name         Agma Chat Command Settings
// @namespace    agma-chat-command-settings
// @version      2.0.0
// @description  Configure your settings using the chat.
// @author       Nuke
// @match        *://agma.io/
// @grant        none
// ==/UserScript==

!function(){var e={};Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_COMMAND=e.DEFAULT_OPTIONS=e.DEFAULT_INFORMATION=void 0,e.DEFAULT_INFORMATION={name:void 0,version:"1.0.0",description:void 0,author:void 0},e.DEFAULT_OPTIONS={silent:!1,chatElementSelector:void 0,prefix:"/",exposeToWindowObject:!1},e.DEFAULT_COMMAND={disabled:!1,clearChat:!0};var t={};Object.defineProperty(t,"__esModule",{value:!0}),t.error=t.warn=t.log=void 0,t.log=function(e){return console.log("(@agmajs/core)[LOG]: "+e)},t.warn=function(e){return console.warn("(@agmajs/core)[WARN]: "+e)},t.error=function(e){return console.error("(@agmajs/core)[ERROR]: "+e)};var n={};Object.defineProperty(n,"__esModule",{value:!0}),n.isFunction=void 0,n.isFunction=function(e){return"function"==typeof e};var i={};Object.defineProperty(i,"__esModule",{value:!0}),i.ChatContext=i.createChatContext=void 0,i.createChatContext=function(e){return new o(e)};var o=function(){function e(e){this._chatElement=document.querySelector(e)}return e.prototype.value=function(e){if(void 0===e)return this._chatElement.value;this._chatElement.value=e},e.prototype.clear=function(){this.value("")},e}();i.ChatContext=o;var r={},s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},a=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),c=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return c(t,e),t},u=this&&this.__spreadArray||function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e};Object.defineProperty(r,"__esModule",{value:!0}),r.Script=r.createScript=void 0;var d=l(t);r.createScript=function(e,t){return new f(e,t)};var f=function(){function t(t,n){this._initialized=!1,this.information=Object.freeze(s(s({},e.DEFAULT_INFORMATION),t)),this.options=s(s({},e.DEFAULT_OPTIONS),n),this.plugins=new Set,this.commands=[],this.init(),this.options.exposeToWindowObject&&(window.$script?d.warn("There already is a script that's also using `@agmajs/script`.\n          Cancelling exposing to window object.."):window.$script=this)}return t.prototype.command=function(t,n){if(n)this.commands.includes(n)?this.options.silent||d.warn('Command "'+n.name+'" has already been registered'):(n=s(s(s({},e.DEFAULT_COMMAND),n),{name:t}),this.commands.push(n));else{if(n=this.commands.find((function(e){return e.name==t})))return n;for(var i=0;i<this.commands.length;i++)if((n=this.commands[i]).aliases&&("string"==typeof n.aliases&&t==n.aliases||Array.isArray(n.aliases)&&n.aliases.includes(t)))return n}return this},t.prototype.use=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return this.plugins.has(e)?!this.options.silent&&d.warn("Plugin has already been applied."):e&&n.isFunction(e)?(this.plugins.add(e),e.apply(void 0,u([this],t))):this.options.silent||d.error("A plugin must be a function."),this},t.prototype.init=function(){var e=this;if(!this._initialized){var t=this.options,n=t.chatElementSelector,o=t.prefix;if(!n)return;var r=document.querySelector(n);r.onkeydown=function(t){if("Enter"==t.key){var s=r.value;if(!s.startsWith(o))return;var a=s.trim().slice(null==o?void 0:o.length).split(/ +/g),c=a[0],l=a.slice(1),u=e.command(c.toLowerCase());if(u){if(u.disabled)return;var d=i.createChatContext(n);u.clearChat&&d.clear(),u.run(e,d,l)}}},this._initialized=!0}},t}();r.Script=f;var p={};Object.defineProperty(p,"__esModule",{value:!0}),p.defineCommand=void 0,p.defineCommand=function(e){return e};var h={};Object.defineProperty(h,"__esModule",{value:!0});var m={};Object.defineProperty(m,"__esModule",{value:!0});var v={};Object.defineProperty(v,"__esModule",{value:!0}),v.Script=void 0,Object.defineProperty(v,"Script",{enumerable:!0,get:function(){return r.Script}});var w={},O=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),b=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||O(t,e,n)};Object.defineProperty(w,"__esModule",{value:!0}),w.ChatContext=void 0,Object.defineProperty(w,"ChatContext",{enumerable:!0,get:function(){return i.ChatContext}}),b(h,w),b(m,w),b(v,w);var _={},y=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),g=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||y(t,e,n)};Object.defineProperty(_,"__esModule",{value:!0}),_.defineCommand=_.createScript=void 0,Object.defineProperty(_,"createScript",{enumerable:!0,get:function(){return r.createScript}}),Object.defineProperty(_,"defineCommand",{enumerable:!0,get:function(){return p.defineCommand}}),g(w,_);var C={};Object.defineProperty(C,"__esModule",{value:!0}),C.Colors=C.DEFAULT_OPTIONS=void 0,C.DEFAULT_OPTIONS={textColor:"#ffffff",visibilityTime:5e3,alertElement:"#curser"},function(e){e.WHITE="#FFFFFF",e.SILVER="#C0C0C0",e.GRAY="#808080",e.GREY="#808080",e.BLACK="#000000",e.RED="#FF0000",e.MAROON="#800000",e.YELLOW="#FFF000",e.OLIVE="#808000",e.LIME="#00FF00",e.GREEN="#008000",e.AQUA="#00FFFF",e.TEAL="#008080",e.BLUE="#0000FF",e.NAVY="#000080",e.FUCHSIA="#FF00FF",e.PURPLE="#800080"}(C.Colors||(C.Colors={}));var j={},F=this&&this.__assign||function(){return(F=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(j,"__esModule",{value:!0}),j.useAlert=void 0,j.useAlert=function(e,t){t=F(F({},C.DEFAULT_OPTIONS),t);var n=document.querySelector(t.alertElement);t.textColor&&(n.style.color=t.textColor),n.style.fontSize="24px",n.textContent=e,n.style.display="block",setTimeout((function(){n.style.display="none"}),t.visibilityTime)};var P={};Object.defineProperty(P,"__esModule",{value:!0});var S={},A=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),E=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||A(t,e,n)};Object.defineProperty(S,"__esModule",{value:!0}),E(P,S);var M={},T=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),x=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||T(t,e,n)};Object.defineProperty(M,"__esModule",{value:!0}),M.Colors=M.useAlert=void 0,Object.defineProperty(M,"useAlert",{enumerable:!0,get:function(){return j.useAlert}}),x(S,M),Object.defineProperty(M,"Colors",{enumerable:!0,get:function(){return C.Colors}});const{defineCommand:L}=_,{useAlert:N,Colors:D}=M,I=[["darktheme",window.setDark],["fancygrid",window.setFancyGrid],["sectiongrid",window.setSectionGrid],["gridlines",window.setGrid],["skins",window.setSkins],["wearables",window.setWearables],["names",window.setNames],["minionnames",window.setMinionNames],["largenames",window.setLargeNames],["nameoutlines",window.setNameOutlines],["mass",window.setMass],["food",window.setFood],["cellanimations",window.setCellAnimations],["skinanimations",window.setSkinAnimations],["mapborder",window.setMapBorder],["sounds",window.setSounds],["infinitezoom",window.setZoom],["fixedzoom",window.setFixedZoom],["slowmotion",window.setSlowMotion],["minionpanel",window.setMinionUi],["leaderboard",window.setLeaderboard],["chat",window.setChat],["minimap",window.setMinimap],["fps",window.setFPS],["colors",window.setColors],["cellborders",window.setCellBorders],["cellspikes",window.setCellSpikes],["classicvirus",window.setClassicViruses],["polygonshapes",window.setPolygonShapes],["lineshapes",window.setLineShapes],["bubblecells",window.setBubbleCells]];var U=[L({name:"setting",run:(e,t,n)=>{if("on"==n[1]||"off"==n[1]){const e="on"===n[1],t=I.find(e=>!!e&&e[0]==n[0]);if(!t)return void N(`No setting found with name "${n[0]}"`,{textColor:D.RED});const[i,o]=t;o(e),N(`The setting "${i}" has been turned ${e?"on":"off"}`,{textColor:e?D.LIME:D.RED})}}})];const{createScript:R}=_,{name:k,version:B,description:W,author:z}={name:"agma-chat-command-settings",version:"2.0.0",description:"Configure your settings using the chat.",author:"CodingWithNuke"},G=R({name:k,version:B,description:W,author:z},{chatElementSelector:"#chtbox",exposeToWindowObject:!0});U.forEach(e=>G.command(e.name,e))}();