// ==UserScript== // @name EMjack // @version 2.5 // @description Some crap you may find useful. // @match https://epicmafia.com/game/* // @match http://userscripts.org/scripts/source/* // ==/UserScript== //Welcome back function EMjack() { //public window.ej={ name: "EMjack", version: 2.5, meta: new Object() } ej.fname=ej.name+ej.version; //variables var afk=false, meet=null, master=null, bubble=null, roulette=null, rouletteOn=null, kicktimer=0, antidc=false, autokick=!ranked, autobomb=false, autowill=false, auth=false, morse=false, users=new Object(); window.development=false; //setup var sock=null, cmds=$("#cmds").scope(), log=function(a,classes) { cmds.log(a,(classes||"")+" emjack"); } //avoid collision if(!window.SockJS) { log("EMjack disabled."); log("Socket library changed. Again."); return; } //plug in cmds.execute_cmds=function(initial) { return function(pkg) { initJack(pkg); initial(pkg); execJack(pkg); }; }(cmds.execute_cmds); SockJS.prototype._dispatchOpen=function(initial) { return function() { sock=this; initial.apply(this,arguments); } }(SockJS.prototype._dispatchOpen); SockJS.prototype._dispatchMessage=function(initial) { return function() { if(sock===null) { sock=this; } initial.apply(this,arguments); } }(SockJS.prototype._dispatchMessage); //sock wrapper var socket=new Object(); //sock cmd socket.cmd=function(cmd,data) { sock.send(JSON.stringify([cmd,data])); }; //sock chat socket.chat=function(message,direct) { if(direct!==undefined) { message="@"+direct+" "+message; } socket.cmd("<",{ meet:meet, msg:message }); }; //sock vote socket.vote=function(vote,meeting) { socket.cmd("point",{ meet:meeting===undefined?meet:meeting, target:vote }); }; //sock dc wrapper socket.dcfunc=function(callback) { cmds.redirect_back=callback; socket.cmd("leave"); }; //the management function initJack(pkg) { for(var i=0,cmd,data;i "+user.name+" "+this.txt(user.morse.id,user.morse.code)+": "+id+": "+message); } } ej.mor.send=function(id,code,message) { socket.cmd("u"); for(var i=0;i100) { user.morse.id=0; } if(user.morse.id) { ej.mor(user); user.morse.id=0; } else if(user.morse.code>=2) { user.morse.id=user.morse.code; } user.morse.code=0; user.morse.clock=Date.now(); }, "<": function() { if(auth) { if(slave&&this.directed===user) { bot.eval(this.msg,this); } } }, "speech": function() { if(this.type==="contact") { log("The roles are... "+this.data.join(", ")); } }, "m": function() { if(this.say) { meet=this.meet; for(var i=0;i1) { roulette--; socket.chat(message+", and nothing happens.",user); } else { roulette=0 socket.chat(message+", and die instantly.",user); socket.vote(user,"gun"); } if(roulette===0) { roulette=null; } },3000); } }, { name: "Become bitch", regex: /be my bitch/, callback: function() { if(master===null) { master=this.user; socket.chat("Yes master "+master+"..."); } else { socket.chat("I belong to "+master); } } }, { name: "Roll over", regex: /roll over/, callback: function() { socket.chat(this.user!==master? "You're not the boss of me": "/me rolls over for senpai..." ); } }, { name: "Bow", regex: /bow ?(down)?/, callback: function() { socket.chat(this.user!==master? "You're not the boss of me": "/me bows for her master..." ); } }, { name: "Beg", regex: /beg(?: for (.+))?/, callback: function(what) { if(this.user!==master) return; var output=[ "gets on her knees", "gets on all fours" ].random(); output="/me "+output+" and begs"; if(what) { output+=" for "+what; } socket.chat(output); } }, { name: "Vote", regex: /vote (\w+)/, callback: function(who) { if(this.user!==master) return; socket.vote(who,this.meet); } }, { name: "Shoot", regex: /shoot (\w+)/, callback: function(who) { if(this.user!==master) return; socket.vote(who,"gun"); } } ]); //get acquainted var commands=null; commands=Cmdlist([ { name: "Scriptcheck", regex: /scriptcheck/, callback: function() { log(ej.fname); } }, { name: "About", regex: /info|help|about/, callback: function() { log("Running "+ej.fname,"bold"); log("Type /cmdlist for a list of commands"); } }, { name: "Evaluate", regex: /eval (.+)/, callback: function(input) { log(JSON.stringify(eval(input))); } }, { name: "Clear chat/logs", regex: /clear( logs)?/, callback: function(_logs) { if(_logs) { $("#window .emjack").remove(); } else { $("#window").empty(); } } }, { name: "Request scriptcheck", regex: /botnet/, callback: function() { if(!morse) { setTimeout(function() { morse=false; },1000); } morse=true; ej.mor.send(2,0,"botnet"); } }, { name: "Get metadata", regex: /meta(?:data)?/, callback: function() { for(var param in ej.meta) { log("@"+param+": "+ej.meta[param]); } } }, { name: "Get command list", regex: /cmdlist ?(bot)?/, callback: function(_bot) { var data=(_bot?bot:commands); for(var i=0;i