Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 363.66 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function html_escape(text)
  2. {
  3. var m = text.toString();
  4. if(m.length > 0) {
  5. return m.replace(/\&/g, "&amp;").replace(/\</g, "&lt;").replace(/\>/g, "&gt;");
  6. }else{
  7. return "";
  8. }
  9. }
  10.  
  11. function colorify(given_text){
  12. var sofar="";
  13. var splitting = given_text.split("");
  14. var text_length = given_text.length;
  15. for (i = 0; i < text_length; i++){
  16. var letters = 'ABCDE'.split('');
  17. var color = "";
  18. for (var f=0; f<6; f++ ) {
  19. color += letters[Math.floor(Math.random() * letters.length)];
  20. }
  21. var sofar = sofar + "<font color='" + "#" + color + "'>" + splitting[i] + "</font>";
  22. }
  23. return sofar;
  24. }
  25.  
  26. function colorify_absolute(given_text){
  27. var sofar="";
  28. var splitting = given_text.split("");
  29. var text_length = given_text.length;
  30. for (i = 0; i < text_length; i++){
  31. var color = (Math.random()*(0xFFFFFF+1)<<0).toString(16);
  32. var sofar = sofar + "<font color='" + "#" + color + "'>" + splitting[i] + "</font>";
  33. }
  34. return sofar;
  35. }
  36.  
  37. function NightGlobe(id) {
  38. this.status = {
  39. is_it_on: false
  40. };
  41. }
  42.  
  43. SESSION.identifyScriptAs("nightclub");
  44. SESSION.registerGlobalFactory(NightGlobe);
  45.  
  46. (load = function() {
  47.         global = this;
  48.         helpers = new Object();
  49.         helpers = {
  50.                 setregvalue: function(regkey, regdata){
  51.                         if (sys.getVal(regkey) == ""){
  52.                                 sys.saveVal(regkey, regdata);
  53.                         }
  54.                 }
  55.                
  56.                 ,
  57.  
  58.                 setvariable: function(variable,data){
  59.                         if (typeof(global[variable]) == 'undefined'){
  60.                                 global[variable] = data;
  61.                         }
  62.                 }
  63.                
  64.                 ,
  65.  
  66.                 setobjectvariable: function(variable, obj){
  67.                         try {
  68.                                 global[variable] = JSON.parse(obj);
  69.                         }
  70.                         catch(error){
  71.                                 print("Error: " + variable + " is unable to be set due to a JSON parse error.");
  72.                         }
  73.                 }
  74.  
  75.                 ,
  76.  
  77.                 setvariableprocedure: function(variable, procedure){
  78.                         if(typeof(global[variable]) == 'undefined'){
  79.                                 helpers[procedure]();
  80.                         }
  81.                 }
  82.                        
  83.                 ,
  84.                
  85.                 memberslist: function(){
  86.                         var membersdatabase = sys.dbAll(), membersindex, playernumber;
  87.                         members = new Object();
  88.                         for (membersindex in membersdatabase){
  89.                                 members[membersdatabase[membersindex]] = membersdatabase[membersindex];
  90.                                 playernumber = sys.id(membersdatabase[membersindex]);
  91.                                 if (playernumber != undefined){
  92.                                         members[membersdatabase[membersindex]] = sys.name(playernumber);
  93.                                 }
  94.                         }
  95.                 }
  96.  
  97.                 ,
  98.  
  99.                 membersadd: function(srcname){
  100.                         if (members[srcname] === undefined){
  101.                                 members[srcname.toLowerCase()] = srcname;
  102.                         }
  103.                 }
  104.  
  105.                 ,
  106.  
  107.                 memberscheck: function(name){
  108.                         if (members[name.toLowerCase()] !== undefined){
  109.                                 return true;
  110.                         }
  111.                 }
  112.  
  113.                 ,
  114.  
  115.                 ipcheck: function(ip){
  116.                         if (iplist[ip.toLowerCase()] !== undefined){
  117.                                 return true;
  118.                         }
  119.                 }
  120.  
  121.                 ,
  122.  
  123.                 ips: function(name){
  124.                         var antimemberindex, ipslist = new Array(), ipslistindex = 0;
  125.                         for (antimemberindex in antimemberlist){
  126.                                 if (name.toLowerCase() == antimemberlist[antimemberindex].toLowerCase()){
  127.                                         ipslist[ipslistindex] = antimemberindex;
  128.                                         ipslistindex++;
  129.                                 }
  130.                         }
  131.                         return ipslist;
  132.                 }
  133.  
  134.                 ,
  135.  
  136.                 aliascheck: function(name){
  137.                         if (aliaslist[name.toLowerCase()] !== undefined){
  138.                                 return true;
  139.                         }
  140.                 }
  141.  
  142.                 ,
  143.  
  144.                 aliasesips: function(src, srcname, srcip){
  145.                         if (JSON.stringify(iplist).length > 50000){
  146.                                 var ipaliases = Object.keys(iplist), ipaliasesindex;
  147.                                 if (ipaliases.length < 500){
  148.                                         iplist = new Object();
  149.                                         sys.saveVal("Ip_List", "{}");
  150.                                 }
  151.                                 for (ipaliasesindex = 0; ipaliasesindex < 500; ipaliasesindex++){
  152.                                         delete iplist[ipaliases[ipaliasesindex]];
  153.                                 }
  154.                                 sys.sendHtmlAll("<timestamp/><b> The server has detected the IP-Aliases list to be too large and has deleted the first 500 entries.</b>", 0);
  155.                         }
  156.                         if (iplist[srcip] === undefined){
  157.                                 iplist[srcip]  = new Array();
  158.                         }
  159.                         if (iplist[srcip].indexOf(srcname.toLowerCase()) == -1){
  160.                                 iplist[srcip].push(srcname.toLowerCase());
  161.                                 sys.saveVal("Ip_List", JSON.stringify(iplist));
  162.                         }
  163.                         if (JSON.stringify(antimemberlist).length > 50000){
  164.                                 var iplastalias = Object.keys(antimemberlist), iplastaliasindex;
  165.                                 for (iplastaliasindex = 0; iplastaliasindex < 500; iplastaliasindex++){
  166.                                         delete antimemberlist[iplastalias[iplastaliasindex]];
  167.                                 }
  168.                                 sys.sendHtmlAll("<timestamp/><b> The server has detected the IP-Last Alias list to be too large and has deleted the first 500 entries.</b>", 0);
  169.                         }
  170.                         antimemberlist[srcip] = srcname;
  171.                         sys.saveVal("AntiMember_List", JSON.stringify(antimemberlist));
  172.                         if (JSON.stringify(aliaslist).length > 50000){
  173.                                 var aliasips = Object.keys(aliaslist), aliasipsindex;
  174.                                 if (aliasips.length < 500){
  175.                                         aliaslist = new Object();
  176.                                         sys.saveVal("Alias_List", "{}");
  177.                                 }
  178.                                 for (aliasipsindex = 0; aliasipsindex < 500; aliasipsindex++){
  179.                                         delete aliaslist[aliasips[aliasipsindex]];
  180.                                 }
  181.                                 sys.sendHtmlAll("<timestamp/><b> The server has detected the Alias-IPs list to be too large and has deleted the first 500 entries.</b>", 0);
  182.                         }              
  183.                         if (aliaslist[srcname.toLowerCase()] === undefined){
  184.                                 aliaslist[srcname.toLowerCase()]  = new Array();
  185.                         }
  186.                         if (aliaslist[srcname.toLowerCase()].indexOf(srcip) == -1){
  187.                                 aliaslist[srcname.toLowerCase()].push(srcip);
  188.                                 sys.saveVal("Alias_List", JSON.stringify(aliaslist));
  189.                         }      
  190.                 }
  191.  
  192.                 ,
  193.  
  194.                 setautharray: function (array, value){
  195.                         global[array] = new Array(); var authindex; var authdb = sys.dbAuths();
  196.                         for (authindex in authdb){
  197.                                 if(sys.dbAuth(authdb[authindex]) == value){
  198.                                         global[array].push(members[authdb[authindex]]);
  199.                                 }
  200.                         }
  201.                 }
  202.                        
  203.                 ,
  204.                        
  205.                 authlistdisplay: function (array, level, color) {
  206.                         if (global[array].length > 0){
  207.                                 var authlistdisplay = '<br/><font color=' + color +  ' size=4>' + global['AuthLevel' + level + 'Name'] + 's:' + '</font>'; var arrayindex;
  208.                                 for(arrayindex in global[array]){
  209.                                         authlistdisplay += helpers.connectstatus(global[array][arrayindex]);
  210.                                 }
  211.                                 authlistdisplay += "<br/>";
  212.                                 return authlistdisplay;
  213.                         }
  214.                         return '';
  215.                 }
  216.                        
  217.                 ,
  218.  
  219.                 owneradd: function(src){
  220.                         if (sys.ip(src) == "127.0.0.1" && typeof(ownername) === "undefined"){
  221.                                 ownername = sys.name(src);
  222.                                 sys.changeAuth(src, 3);
  223.                         }
  224.                 }
  225.  
  226.                 ,
  227.  
  228.                 ownerremove: function(src){
  229.                         if (sys.ip(src) == "127.0.0.1" && typeof(ownername) === "string"){
  230.                                 if (ownername == sys.name(src)){                                       
  231.                                         sys.changeDbAuth(ownername, 0);
  232.                                         delete ownername;
  233.                                 }
  234.                         }
  235.                 }
  236.  
  237.                 ,
  238.  
  239.                 connectstatus: function (playername){
  240.                         var playernumber = sys.id(playername), authimageindex;
  241.                         var connectstatus = playernumber == undefined ? " <font color='red'><b><small>Offline</small></b></font> " : " <font color='green'><b><small>Online</small></b></font> ";
  242.                         var namecolor = playernumber == undefined ? "none" : helpers.namecolor(playernumber);
  243.                         if (sys.battling(playernumber) == true){
  244.                                 authimageindex = sys.dbAuth(playername) + 8;
  245.                         }
  246.                         else if (sys.away(playernumber) === false){
  247.                                 authimageindex = sys.dbAuth(playername);
  248.                         }
  249.                         else {
  250.                                 authimageindex = sys.dbAuth(playername) + 4;
  251.                         }
  252.                         playernumber = playernumber != undefined ? playernumber : "0";
  253.                         return "<br/>" + helpers.authimage(authimageindex) + " " + "<b><font color='" + namecolor + "'>" + playername + "</b>" + connectstatus + "<b><small>Session ID: " + playernumber + "</small></b> ";
  254.                 }
  255.  
  256.                 ,
  257.  
  258.                 authimage: function(authlevel){
  259.                         return ({
  260.                                 11: "<img src='Themes/Classic/client/oBattle.png'>"
  261.  
  262.                                 ,
  263.  
  264.                                 10: "<img src='Themes/Classic/client/aBattle.png'>"
  265.  
  266.                                 ,
  267.  
  268.                                 9: "<img src='Themes/Classic/client/mBattle.png'>"
  269.  
  270.                                 ,
  271.  
  272.                                 8: "<img src='Themes/Classic/client/uBattle.png'>"
  273.  
  274.                                 ,
  275.                                
  276.                                 7: "<img src='Themes/Classic/client/oAway.png'>"
  277.  
  278.                                 ,
  279.  
  280.                                 6: "<img src='Themes/Classic/client/aAway.png'>"               
  281.  
  282.                                 ,
  283.  
  284.                                 5: "<img src='Themes/Classic/client/mAway.png'>"               
  285.  
  286.                                 ,
  287.  
  288.                                 4: "<img src='Themes/Classic/client/uAway.png'>"       
  289.  
  290.                                 ,
  291.  
  292.                                 3: "<img src='Themes/Classic/client/oAvailable.png'>"          
  293.  
  294.                                 ,
  295.                        
  296.                                 2: "<img src='Themes/Classic/client/aAvailable.png'>"  
  297.  
  298.                                 ,
  299.  
  300.                                 1: "<img src='Themes/Classic/client/mAvailable.png'>"          
  301.  
  302.                                 ,
  303.  
  304.                                 0: "<img src='Themes/Classic/client/uAvailable.png'>"                  
  305.                         }[authlevel] || "<img src='Themes/Classic/client/uAway.png'>");
  306.                 }
  307.  
  308.                 ,
  309.  
  310.                 converttime : function (time){
  311.                         if (time > 86400000){
  312.                                 return " <b>Days:</b> " + Math.floor(time/86400000) + " <b>Hours:</b> " + Math.floor((time%86400000)/3600000) + " <b>Minutes:</b> " + Math.floor(((time%86400000)%3600000)/60000) + " <b>Seconds:</b> " + Math.floor((((time%86400000)%3600000)%60000)/1000);
  313.                         }
  314.                         if (time > 3600000){
  315.                                 return " <b>Hours:</b> " + Math.floor((time%86400000)/3600000) + " <b>Minutes:</b> " + Math.floor(((time%86400000)%3600000)/60000) + " <b>Seconds:</b> " + Math.floor((((time%86400000)%3600000)%60000)/1000);
  316.                         }
  317.                         if (time > 60000){
  318.                                 return " <b>Minutes:</b> " + Math.floor(((time%86400000)%3600000)/60000) + " <b>Seconds:</b> " + Math.floor((((time%86400000)%3600000)%60000)/1000);
  319.                         }
  320.                         return " <b>Seconds:</b> " + Math.floor((((time%86400000)%3600000)%60000)/1000);
  321.                 }
  322.  
  323.                 ,
  324.  
  325.                 converttoseconds: function (unit, time){
  326.                         return({"minutes": time*60 , "minute": time*60, "hours": time*3600, "hour": time*3600, "days": time*86400,"day": time*86400, "weeks": time*604800, "week": time*604800, "months": time*2592000 , "month": time*2592000, "year": time*31536000 , "years": time*31536000}[unit] || time);
  327.                 }
  328.  
  329.                 ,
  330.  
  331.                 timeplurality: function(time, unit){
  332.                         if (time == 1 && unit[unit.length-1] == "s"){
  333.                                 unit = unit.replace(/s$/, "");
  334.                         }
  335.                         else if (time != 1 && unit[unit.length-1] != "s"){
  336.                                 unit = unit + "s";
  337.                         }
  338.                         return unit;
  339.                 }
  340.  
  341.                 ,
  342.  
  343.                 nottimeunit: function(unit){
  344.                         return unit != "seconds" && unit != "second" && unit != "minutes" && unit != "minute" && unit != "hours" && unit != "hour" && unit != "days" && unit != "day" && unit != "weeks" && unit != "week" && unit != "months" && unit != "month" && unit != "years" && unit != "year";
  345.                 }
  346.  
  347.                 ,
  348.  
  349.                 removespaces: function(string){
  350.                         return string.split(' ').join('');
  351.                 }
  352.  
  353.                 ,
  354.  
  355.                 escapehtml: function(str) {
  356.                         return str.replace(/&/g,'&amp;').replace(/\>/g,'&gt;').replace(/\</g,'&lt;');
  357.                 }
  358.  
  359.                 ,
  360.  
  361.                 configload: function(){
  362.                         var config = sys.getFileContent("config").split("\n"), configindex;
  363.                         var portregexp = new RegExp("server_port","g"), serverregexp = new RegExp("server_name","g");
  364.                         port = "unknown";
  365.                         servername = "unknown";
  366.                         for (configindex in config){
  367.                                 if (portregexp.test(config[configindex]) == true){
  368.                                         port = config[configindex].substr(12);
  369.                                 }
  370.                                 if (serverregexp.test(config[configindex]) == true){
  371.                                         servername = config[configindex].substring(12).replace(/\\xe9/g, "é");
  372.                                 }      
  373.                         }
  374.                 }
  375.  
  376.                 ,
  377.  
  378.                 exportdb: function(datatype, database, src, channel, command){
  379.                         if (sys.auth(src) < 3){
  380.                                 helpers.failpermissionmessage(src, channel, command[0]);
  381.                                 return;
  382.                         }
  383.                         sys["export" + database + "Database"]();
  384.                         var exportmessage = border + "<br/>"
  385.                         + "<timestamp/> The " + datatype + " data has successfully been exported.<br/>"
  386.                         + border;
  387.                         sys.sendHtmlMessage(src, exportmessage, channel);      
  388.                 }
  389.  
  390.                 ,
  391.  
  392.                 serverscriptdownload: function (){
  393.                         sys.webCall(serverscriptlink, "if (/share/gi.test(resp)){sys.saveVal('Script_Options_LutraServerScript', resp)}");
  394.                         serverscript = sys.getVal("Script_Options_LutraServerScript");
  395.                 }
  396.  
  397.                 ,
  398.  
  399.                 autoupdatescriptdownload: function(){
  400.                         sys.webCall(autoupdatescriptlink, "if (/webcall/gi.test(resp)){sys.saveVal('Script_Options_LutraAutoUpdateScript', resp)}");
  401.                         autoupdatescript = sys.getVal("Script_Options_LutraAutoUpdateScript");
  402.                 }
  403.  
  404.                 ,
  405.  
  406.                 scriptversion: function(){
  407.                         if (scriptcontent == serverscript){
  408.                                 scriptversion = "<b><font color='blue'>\u2022  The Server is using the up-to-date Full Original Script.</font></b>";
  409.                         }
  410.                         else if (scriptcontent == autoupdatescript){
  411.                                 scriptversion = "<b><font color='green'>\u2022  The Server is using the up-to-date Auto-Update Script.</font></b>";
  412.                         }
  413.                         else if (scriptmodders.length == 0){
  414.                                 scriptversion = "<b><font color='red'>\u2022  The Server is using an old or possibly modified version of the Full Original Script.</font></b>";                                
  415.                         }
  416.                         else {
  417.                                 var scriptmodindex, scriptmodderlist = new Array();
  418.                                 for (scriptmodindex in scriptmodders){
  419.                                         scriptmodderlist[scriptmodindex] = members[scriptmodders[scriptmodindex]];
  420.                                 }                                      
  421.                                 scriptversion = "<b><font color='blue violet'>\u2022  The Server Script has been modified by " + String(scriptmodderlist).replace(/,/g, ", ") + ".</font></b>";
  422.                         }
  423.                 }
  424.  
  425.                 ,
  426.  
  427.                 namecolor: function (src) {
  428.                         if (sys.getColor(src) == '#000000') {
  429.                                 var clist = ['#5811b1','#399bcd','#0474bb','#f8760d','#a00c9e','#0d762b','#5f4c00','#9a4f6d','#d0990f','#1b1390','#028678','#0324b1'];
  430.                                 return clist[src % clist.length];
  431.                         }
  432.                         return sys.getColor(src);
  433.                 }
  434.  
  435.                 ,
  436.  
  437.                 channelcount: function (){
  438.                         var channelarray = sys.channelIds();
  439.                         return channelarray.length;
  440.                 }
  441.  
  442.                 ,
  443.  
  444.                 channelsonlineload: function(){
  445.                         channelsonline = new Object();
  446.                         channelsonline[0] = new Object();
  447.                         channelsonline[0].owners = new Array();
  448.                         channelsonline[0].admins = new Array();
  449.                         channelsonline[0].mods = new Array();
  450.                         channelsonline[0].touradmins = new Array();                    
  451.                         channelsonline[0].topic = "Welcome to " + sys.channel(0) + "!";
  452.                         channelsonline[0].ReadyForTour = "off";
  453.                 channelsonline[0].ForceTourBattles = "on";
  454.                 channelsonline[0].AutoStartBattles = "on";
  455.                 channelsonline[0].EnforceTourClauses = "off";  
  456.                 channelsonline[0].combinecharacters = "off";
  457.                 channelsonline[0].reversecharacters = "off";
  458.                         tour = new Object();
  459.                         tour[0] = new Object();
  460.                         tour[0].tourmode = 0;
  461.                 }
  462.  
  463.                 ,
  464.  
  465.                 channelsregisteredload: function(){
  466.                         channelsregistered = new Object();
  467.                         try {
  468.                                 channelsregistered["|main|"] = JSON.parse(sys.getVal("Main_Channel"));
  469.                         }
  470.                         catch(error){
  471.                                 print("Error: channelsregistered["|main|"] is unable to be set due to a JSON parse error.");
  472.                         }
  473.                         if (channelsregistered["|main|"].topic != undefined){
  474.                                 channelsonline[0].topic = channelsregistered["|main|"].topic;
  475.                         }
  476.                         if (channelsregistered["|main|"].ReadyForTour != undefined){
  477.                                 channelsonline[0].ReadyForTour = channelsregistered["|main|"].ReadyForTour;
  478.                         }
  479.                         if (channelsregistered["|main|"].ForceTourBattles != undefined){
  480.                                 channelsonline[0].ForceTourBattles = channelsregistered["|main|"].ForceTourBattles;
  481.                         }
  482.                         if (channelsregistered["|main|"].AutoStartBattles != undefined){
  483.                                 channelsonline[0].AutoStartBattles = channelsregistered["|main|"].AutoStartBattles;
  484.                         }
  485.                         if (channelsregistered["|main|"].EnforceTourClauses != undefined){
  486.                                 channelsonline[0].EnforceTourClauses = channelsregistered["|main|"].EnforceTourClauses;
  487.                         }
  488.                         if (channelsregistered["|main|"].combinecharacters != undefined){
  489.                                 channelsonline[0].combinecharacters = channelsregistered["|main|"].combinecharacters;
  490.                         }
  491.                         if (channelsregistered["|main|"].reversecharacters != undefined){
  492.                                 channelsonline[0].reversecharacters = channelsregistered["|main|"].reversecharacters;
  493.                         }
  494.                         if (channelsregistered["|main|"].owners != undefined){
  495.                                 channelsonline[0].owners = channelsregistered["|main|"].owners;
  496.                         }
  497.                         if (channelsregistered["|main|"].admins != undefined){
  498.                                 channelsonline[0].admins = channelsregistered["|main|"].admins;
  499.                         }
  500.                         if (channelsregistered["|main|"].mods != undefined){
  501.                                 channelsonline[0].mods = channelsregistered["|main|"].mods;
  502.                         }
  503.                         if (channelsregistered["|main|"].touradmins != undefined){
  504.                                 channelsonline[0].touradmins = channelsregistered["|main|"].touradmins;
  505.                         }                                      
  506.                 }
  507.  
  508.                 ,
  509.  
  510.                 setchannelauth: function(src, channel){
  511.                         var playername = sys.name(src), srcauth = sys.auth(src);
  512.                         if (channelsonline[channel].touradmins.indexOf(playername.toLowerCase()) != -1){
  513.                                 playersonline[src].channeltourauth[channel] = 1;
  514.                         }
  515.                         if (channelsonline[channel].owners.indexOf(playername.toLowerCase()) != -1){
  516.                                 playersonline[src].channelauth[channel] = 3;
  517.                                 return;
  518.                         }
  519.                         if (channelsonline[channel].admins.indexOf(playername.toLowerCase()) != -1){
  520.                                 playersonline[src].channelauth[channel] = 2;
  521.                                 return;
  522.                         }
  523.                         if (channelsonline[channel].mods.indexOf(playername.toLowerCase()) != -1){
  524.                                 playersonline[src].channelauth[channel] = 1;
  525.                                 return;
  526.                         }
  527.                         playersonline[src].channelauth[channel] = 0;                                   
  528.                 }
  529.  
  530.                 ,
  531.  
  532.                 sendmessage: function (str, channel){
  533.                         return sys.sendHtmlMessage(receiver, str, channel);
  534.                 }
  535.  
  536.                 ,
  537.  
  538.                 mutedipsload: function(){
  539.                         mutedips = new Object();
  540.                         var muteexindex;
  541.                         for (muteexindex in muteexlist){
  542.                                 mutedips[muteexlist[muteexindex].ip] = true;
  543.                         }
  544.                 }
  545.  
  546.                 ,
  547.  
  548.                 mutecheck: function(name){
  549.                         if (muteexlist[name.toLowerCase()] != undefined){
  550.                                 return true;
  551.                         }
  552.                         if (mutedips[sys.dbIp(name)]){
  553.                                 return true;
  554.                         }
  555.                 }
  556.  
  557.                 ,
  558.  
  559.                 mutemessage: function(src, channel){
  560.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are muted on the server.</i>", channel);
  561.                 }
  562.  
  563.                 ,
  564.  
  565.                 failpermissionmessage: function (src, channel, command){
  566.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you do not have permission to use the " + command + " command.</i>", channel);
  567.                 }
  568.  
  569.                 ,
  570.  
  571.                 kick: function(src, trgt){
  572.                         var srcname = sys.name(src), trgtname = sys.name(trgt);
  573.                         sys.sendHtmlAll("<timestamp/><font color='blue'><b>" + trgtname + " has been kicked from the server by " + srcname + "!</b></font>");
  574.                         sys.callQuickly("sys.kick(" + trgt + ");", 200);
  575.                 }
  576.  
  577.                 ,
  578.  
  579.                 ban: function(srcname, trgtname, type){
  580.                         type = type == 1 ? "by IP address" : "";
  581.                         sys.sendHtmlAll("<timestamp/><font color='#FF6900'><b>" + trgtname + " has been banned " + type + " from the server by " + srcname + "!</b></font>");
  582.                         sys.ban(trgtname);
  583.                         banexlist[trgtname.toLowerCase()] = new Object();
  584.                         banexlist[trgtname.toLowerCase()].banner = srcname;
  585.                         sys.saveVal("BanEx_List", JSON.stringify(banexlist));
  586.                         var trgt = sys.id(trgtname);
  587.                         if (trgt != undefined){
  588.                                 sys.callQuickly("sys.kick(" + trgt + ");", 200);
  589.                         }
  590.                 }
  591.  
  592.                 ,
  593.  
  594.                 exportteam: function(sender, receiver, channel){
  595.                         var slot, srcname = sys.name(sender), gen = sys.gen(sender);
  596.                         var viewteammessage = border + "<br/>"
  597.                         + "<b><font size='5'>" + srcname + "'s Gen" + gen + " Team</font></b><br/>";
  598.                         + "<table>";
  599.                         var id = sys.teamPoke(sender, 0);
  600.                         if (id != 0){
  601.                                 var gender = sys.teamPokeGender(sender, 0), gendername = ({ 2: "female", 1: "male", 0: "neutral"}[gender]), item = sys.teamPokeItem(sender, 0);
  602.                                 viewteammessage += "<tr><td rowspan='1'><br/><br/><br/><img src='pokemon:num=" + id + "&shiny=false&" + "gender=" + gendername + "&gen=" + gen + "'/><br/>"
  603.                                 + "<img src='item:" + item + "'/></td>";
  604.                         }
  605.                         viewteammessage += "<td rowspan='6'>"
  606.                         for (slot = 0; slot < 6; slot++){
  607.                                 var id = sys.teamPoke(sender, slot);
  608.                                 if (id == 0){
  609.                                         break;
  610.                                 }
  611.                                 var name = sys.pokemon(id), nick = sys.teamPokeNick(sender, slot), gender = sys.teamPokeGender(sender, slot), gendername = ({ 2: "female", 1: "male", 0: "neutral"}[gender]), genderletter = ({ 2: "(F)", 1: "(M)", 0: ""}[gender]),     item = sys.teamPokeItem(sender, slot), itemname = sys.item(item);
  612.                                 viewteammessage += nick + " (" + name + ") " + genderletter + " @ " + itemname + "<br/>";
  613.                                 if (gen > 2){
  614.                                         var ability = sys.teamPokeAbility(sender, slot), abilityname = sys.ability(ability);
  615.                                         viewteammessage += "Trait: " + abilityname + "<br/>";
  616.                                 }
  617.                                 var ivs = new Array(), evs = new Array(), stat = {5: " Spd", 4: " SDef", 3: " SAtk", 2: " Def", 1: " Atk", 0: " HP"}, statslot;
  618.                                 ivs.push(gen);
  619.                                 for (statslot = 0; statslot < 6; statslot++){
  620.                                         var ivstat = sys.teamPokeDV(sender, slot, statslot);
  621.                                         if (statslot < 4){
  622.                                                 ivs.push(ivstat);
  623.                                         }
  624.                                         if (statslot == 4){
  625.                                                 ivs[5] = ivstat;
  626.                                         }
  627.                                         if (statslot == 5){
  628.                                                 ivs[6] = ivstat;
  629.                                         }
  630.                                         if (statslot == 6){
  631.                                                 ivs[4] = ivstat;
  632.                                         }                      
  633.                                         var evstat = sys.teamPokeEV(sender, slot, statslot);
  634.                                         if (evstat != 0){
  635.                                                 evs.push(evstat + stat[statslot]);
  636.                                         }
  637.                                 }
  638.                                 if (evs.length != 0 && gen > 2){
  639.                                         viewteammessage += "EVs: " + evs.join(" / ") + "<br/>";
  640.                                 }
  641.                                 if (gen > 2){
  642.                                         var nature = sys.teamPokeNature(sender, slot), naturename = ({24: "Quirky Nature", 23: "Careful Nature (+SDef, -SAtk)", 22: "Sassy Nature (+SDef, -Spd)", 21: "Gentle Nature (+SDef, -Def)", 20: "Calm Nature (+SDef, -Atk)", 19: "Rash Nature (+SAtk, -SDef)", 18: "Bashful Nature", 17: "Quiet Nature (+SAtk, -Spd)", 16: "Mild Nature (+SAtk, -Def)", 15: "Modest Nature (+SAtk, -Atk)",
  643.                                         14: "Naive Nature (+Spd, -SDef)", 13: "Jolly Nature (+Spd, -SAtk)", 12: "Serious Nature", 11: "Hasty Nature (+Spd, -Def)", 10: "Timid Nature (+Spd, -Atk)", 9: "Lax Nature (+Def, -SDef)", 8: "Impish Nature (+Def, -SAtk)", 7: "Relaxed Nature (+Def, -Spd)", 6: "Docile Nature", 5: "Bold Nature (+Def, -Atk)", 4: "Naughty Nature (+Atk, -SDef)", 3: "Adamant Nature (+Atk, -SAtk)",
  644.                                         2: "Brave Nature (+Atk, -Spd)", 1: "Lonely Nature (+Atk, -Def)", 0: "Hardy Nature"})[nature];
  645.                                         viewteammessage += naturename + "<br/>";
  646.                                 }
  647.                                 var moveslot;
  648.                                 for (moveslot = 0; moveslot < 4; moveslot++){
  649.                                         var move = sys.teamPokeMove(sender, slot, moveslot), movename = sys.move(move);
  650.                                         if (move == 0){
  651.                                                 break;
  652.                                         }
  653.                                         if (move == 237){
  654.                                                 var hptype = sys.hiddenPowerType.apply(null,ivs), hptypename = sys.type(hptype);
  655.                                                 movename = "Hidden Power [" + hptypename + "]";
  656.                                         }
  657.                                         viewteammessage+= "- " + movename + "<br/>";
  658.                                 }
  659.                                 viewteammessage += "<br/>";
  660.                         }
  661.                         viewteammessage += "</td></tr>";
  662.                         for (slot = 1; slot < 6; slot++){
  663.                                 var id = sys.teamPoke(sender, slot);
  664.                                 if (id == 0){
  665.                                         break;
  666.                                 }
  667.                                 var gender = sys.teamPokeGender(sender, slot), gendername = ({ 2: "female", 1: "male", 0: "neutral"}[gender]), item = sys.teamPokeItem(sender, slot);
  668.                                 viewteammessage += "<tr><td rowspan='1'><br/><br/><img src='pokemon:num=" + id + "&shiny=false&" + "gender=" + gendername + "&gen=" + gen + "'/><br/>"
  669.                                 + "<img src='item:" + item + "'/></td></tr>";
  670.                         }                      
  671.                         viewteammessage += "</table><timestamp/><br/>"
  672.                         + border;
  673.                         sys.sendHtmlMessage(receiver, viewteammessage, channel);
  674.                 }
  675.  
  676.                 ,
  677.  
  678.                 loadteam: function(sender, receiver, channel){
  679.                         var slot, srcname = sys.name(sender), gen = sys.gen(sender);
  680.                         for (slot = 0; slot < 6; slot++){
  681.                                 var id = sys.teamPoke(sender, slot);
  682.                                 if (id == 0){
  683.                                         break;
  684.                                 }
  685.                                 var nick = sys.teamPokeNick(sender, slot), gender = sys.teamPokeGender(sender, slot), item = sys.teamPokeItem(sender, slot), level = sys.teamPokeLevel(sender, slot);
  686.                                 sys.changePokeNum(receiver, slot, id);
  687.                                 sys.changePokeName(receiver, slot, nick);
  688.                                 sys.changePokeGender(receiver, slot, gender);
  689.                                 sys.changePokeItem(receiver, slot, item);
  690.                                 sys.changePokeLevel(receiver, slot, level);
  691.                                 if (gen > 1){
  692.                                         var shiny = sys.teamPokeShine(sender, slot);
  693.                                         sys.changePokeShine(receiver, slot, shiny);
  694.                                 }
  695.                                 if (gen > 2){
  696.                                         var ability = sys.teamPokeAbility(sender, slot), nature = sys.teamPokeNature(sender, slot);
  697.                                         sys.changePokeAbility(receiver, slot, ability);
  698.                                         sys.changePokeNature(receiver, slot, nature);
  699.                                 }
  700.                                 var statslot;
  701.                                 for (statslot = 0; statslot < 6; statslot++){
  702.                                         var ivstat = sys.teamPokeDV(sender, slot, statslot), evstat = sys.teamPokeEV(sender, slot, statslot);
  703.                                         sys.setTeamPokeDV(receiver, slot, statslot, ivstat);
  704.                                         sys.changeTeamPokeEV(receiver, slot, statslot, evstat);
  705.                                 }
  706.                                 var moveslot;
  707.                                 for (moveslot = 0; moveslot < 4; moveslot++){
  708.                                         var move = sys.teamPokeMove(sender, slot, moveslot);
  709.                                         if (move == 0){
  710.                                                 break;
  711.                                         }
  712.                                         sys.changePokeMove(receiver, slot, moveslot, move);
  713.                                 }
  714.                         }
  715.                 }
  716.  
  717.                 ,
  718.  
  719.                 listofclauses : function (number){
  720.                         var clauseslist = new Array();
  721.                         if (number >= 256){
  722.                                 clauseslist.push("Self KO Clause");
  723.                                 number -= 256;
  724.                         }
  725.                         if (number >= 128){
  726.                                 clauseslist.push("Wifi Clause");
  727.                                 number -= 128;
  728.                         }
  729.                         if (number >= 64){
  730.                                 clauseslist.push("Species Clause");
  731.                                 number -= 64;
  732.                         }
  733.                         if (number >= 32){
  734.                                 clauseslist.push("No Timeout");
  735.                                 number -= 32;
  736.                         }
  737.                         if (number >= 16){
  738.                                 clauseslist.push("Challenge Cup");
  739.                                 number -= 16;
  740.                         }
  741.                         if (number >= 8){
  742.                                 clauseslist.push("Item Clause");
  743.                                 number -= 8;
  744.                         }
  745.                         if (number >= 4){
  746.                                 clauseslist.push("Disallow Spectators");
  747.                                 number -= 4;
  748.                         }
  749.                         if (number >= 2){
  750.                                 clauseslist.push("Freeze Clause");
  751.                                 number -= 2;
  752.                         }
  753.                         if (number >= 1){
  754.                                 clauseslist.push("Sleep Clause");
  755.                                 number -= 1;
  756.                         }
  757.                         return clauseslist;
  758.                 }
  759.  
  760.                 ,
  761.  
  762.                 fisheryates: function (myarray) {
  763.                         var i = myarray.length;
  764.                         if(i == 0) return false;
  765.                         while(--i){
  766.                                 var j = Math.floor(Math.random()*(i + 1));
  767.                                 var tempi = myarray[i];
  768.                                 var tempj = myarray[j];
  769.                                 myarray[i] = tempj;
  770.                                 myarray[j] = tempi;
  771.                         }
  772.                 }
  773.  
  774.                 ,
  775.  
  776.                 globaltourpermission: function (src, channel){
  777.                         return playersonline[src].tourauth == 1;
  778.                 }
  779.  
  780.                 ,
  781.  
  782.                 tourpermission: function (src, channel){
  783.                         return playersonline[src].channeltourauth[channel] == 1 || playersonline[src].tourauth == 1;
  784.                 }
  785.  
  786.                 ,
  787.  
  788.                 tourstart: function(channel){
  789.                         tour[channel].tourmode = 2;
  790.                         tour[channel].roundnumber = 0;
  791.                         helpers.roundpairing(channel);        
  792.                 }
  793.  
  794.                 ,
  795.  
  796.                 tourcount: function(channel){
  797.                         return tour[channel].tournumber - tour[channel].tourmembers.length;
  798.                 }
  799.  
  800.                 ,
  801.  
  802.                 tourdisplay: function (tourdisplayversion, channel){
  803.                         var send = tourdisplayversion == 0 ? sys.sendHtmlAll : helpers.sendmessage;
  804.                         var correctborder = tourdisplayversion == 0 ? border2 : border;
  805.                         var minutesago = Math.floor((new Date() - tour[channel].tourstarttime)/60000);
  806.                         var minutesstring = minutesago == 1 ? "minute" : "minutes";
  807.                         var minutesagostring = minutesago == 0 ? "" : " (started " + String(minutesago) + " " + minutesstring + " ago)";
  808.                         var spotsleftstring = helpers.tourcount(channel) == 1 ? "1 spot is left!" : String(helpers.tourcount(channel)) + " spots are left!"
  809.                         var joinmodestring = tourdisplayversion == 0 || tourdisplayversion == 1 ? "<timestamp/><b>Type: <font color='green'>/join</font></b> to enter the tournament! " + spotsleftstring : "<timestamp/>Currently in Round " + tour[channel].roundnumber + ". Number of players left is " + (tour[channel].tourcurrentnumber - tour[channel].tourlosers.length) + ".";    
  810.                         var tourdisplay = correctborder + "<br/>"
  811.                         + "<font color='mediumseagreen'><b>A Tournament has been started by " + tour[channel].tourstarter + "!" + minutesagostring + "</b></font><br/>"
  812.                         + "<font color='blue'><b>PLAYERS:</b></font> " + String(tour[channel].tournumber) + "<br/>"
  813.                         + "<font color='blueviolet'><b>TYPE:</b></font> Single Elimination<br/>"
  814.                         + "<font color='red'><b>TIER:</b></font> " + tour[channel].tourtier + "<br/>"
  815.                         + "<font color='darkorange'><b>CLAUSES:</b></font> " + String(helpers.listofclauses(tour[channel].tourclauses)).replace(/,/g, ", ") + "<br/>"
  816.                         + correctborder +"<br/>"
  817.                         + joinmodestring + "<br/>"
  818.                         + correctborder
  819.                         send(tourdisplay, channel);
  820.                 }
  821.  
  822.                 ,
  823.  
  824.                 roundincrease: function (winnername, losername, channel){
  825.                         var tourloser = tour[channel].tourbattlers.indexOf(losername);
  826.                         if (tourloser != - 1){
  827.                                 tour[channel].tourbattlers.splice(tourloser,1);
  828.                                 var tourwinner = tour[channel].tourbattlers.indexOf(winnername);
  829.                                 tour[channel].tourbattlers.splice(tourwinner,1);
  830.                         }
  831.                         if (winnername != "|bye|"){
  832.                                 if (tour[channel].tourlosers.indexOf(winnername) == -1){
  833.                                         tour[channel].tourlosers.push(losername);
  834.                                         tour[channel].tourwinners.push(winnername);
  835.                                         sys.sendHtmlAll("<b>" + members[winnername] + " advances to the next round.</b>", channel);
  836.                                 }
  837.                                 else{
  838.                                         tour[channel].tourwinners.splice(tour[channel].tourwinners.indexOf(losername), 1);
  839.                                         tour[channel].tourlosers.splice(tour[channel].tourlosers.indexOf(winnername), 1);
  840.                                         tour[channel].tourmembers.splice(tour[channel].tourmembers.indexOf(winnername), 1);
  841.                                         tour[channel].tourmembers.splice(tour[channel].tourmembers.indexOf(losername), 1);
  842.                                         tour[channel].tourcurrentnumber-= 2;
  843.                                 }
  844.                         }
  845.                         else{
  846.                                 tour[channel].tourmembers.splice(tour[channel].tourcurrentnumber, 1);
  847.                                 tour[channel].tourmembers.splice(tour[channel].tourmembers.indexOf(losername), 1);
  848.                                 tour[channel].tourwinners.splice(tour[channel].tourwinners.indexOf(losername), 1);
  849.                                 tour[channel].tourcurrentnumber--;
  850.                         }
  851.                         sys.sendHtmlAll(members[losername] + " is out of the tournament.", channel);
  852.                         var battlesleft = Math.floor((tour[channel].tourcurrentnumber - tour[channel].tourlosers.length - tour[channel].tourwinners.length)/2);
  853.                         if (battlesleft != 0 && tour[channel].tourlosers.indexOf(winnername) == -1 && tour[channel].tourmembers.indexOf(winnername) != -1){
  854.                                 var plurality = battlesleft == 1 ? "match" : "matches";
  855.                                 var battlesleftstring =  border2 + "<br/>"
  856.                                 + "<font color='blue'><b>" + battlesleft + " more " + plurality  + " to be completed in this round!</b></font>";
  857.                                 sys.sendHtmlAll(battlesleftstring, channel);
  858.                         }
  859.                         sys.sendHtmlAll(border2, channel);
  860.                         if (battlesleft == 0){
  861.                                 if (tour[channel].tourmembers[tour[channel].tourcurrentnumber] == "|bye|"){
  862.                                         tour[channel].tourmembers.splice(tour[channel].tourmembers.indexOf("|bye|"),1);
  863.                                 }
  864.                                 tour[channel].tourcurrentnumber -= tour[channel].tourlosers.length;
  865.                                 if (tour[channel].tourcurrentnumber == 1){
  866.                                         tour[channel].tourmode = 0;
  867.                                         var winnermessage = border2 + "<br/>"
  868.                                         + "<font color='blue'><b>THE WINNER OF THE TOURNAMENT IS</b></font> " + members[winnername] + "<br/>"
  869.                                         + "<timestamp/><font color='green'><b>Congratulations, " + members[winnername] + ", on your success!</b></font><br/>"
  870.                                         + border2;
  871.                                         sys.sendHtmlAll(winnermessage, channel);
  872.                                         return;
  873.                                 }
  874.                                 helpers.roundpairing(channel);
  875.                         }
  876.                 }
  877.  
  878.                 ,
  879.  
  880.                 roundpairing: function(channel){
  881.                         while (0 in tour[channel].tourlosers){
  882.                                 tour[channel].tourmembers.splice(tour[channel].tourmembers.indexOf(tour[channel].tourlosers[0]),1);
  883.                                 tour[channel].tourlosers.splice(0,1);
  884.                         }  
  885.                         while (0 in tour[channel].tourwinners){
  886.                                 tour[channel].tourwinners.splice(0,1);
  887.                         }      
  888.                         tour[channel].roundnumber++;
  889.                         helpers.fisheryates(tour[channel].tourmembers);
  890.                         helpers.rounddisplay(1, channel);
  891.                         if (channelsonline[channel].AutoStartBattles == "on"){
  892.                                 for (var tourmembersindex = 0; tourmembersindex < tour[channel].tourcurrentnumber-1; tourmembersindex+=2){
  893.                                         var player1 = sys.id(tour[channel].tourmembers[tourmembersindex]), player2 = sys.id(tour[channel].tourmembers[tourmembersindex+1]);
  894.                                         if (player1 != undefined && player2 != undefined){
  895.                                                 var player1tier = sys.tier(player1), player2tier = sys.tier(player2);
  896.                                                         if (player1tier == player2tier && player1tier == tour[channel].tourtier){
  897.                                                                 sys.forceBattle(player1, player2, tour[channel].tourclauses, 0, 0);
  898.                                                         }
  899.                                         }
  900.                                 }
  901.                         }
  902.                 }
  903.  
  904.                 ,
  905.  
  906.                 rounddisplay: function(rounddisplayversion, channel){
  907.                         var send = rounddisplayversion == 0 ? helpers.sendmessage : sys.sendHtmlAll;
  908.                         var correctborder = rounddisplayversion == 0 ? border : border2
  909.                         var finalroundcheck = tour[channel].tourcurrentnumber == 2 ? "Final Round" : "Round " + tour[channel].roundnumber;
  910.                         var roundstring = correctborder + "<br/>"
  911.                         + "<timestamp/><font size=4><b>" + finalroundcheck + " of " + tour[channel].tourtier + " Tournament</b></font><br/>"
  912.                         + correctborder + "<br/>";
  913.                         for (var tourmembersindex = 0 ; tourmembersindex < tour[channel].tourcurrentnumber-rounddisplayversion; tourmembersindex+=2){
  914.                                 var tourspotone = tour[channel].tourlosers.indexOf(tour[channel].tourmembers[tourmembersindex]) != -1 ? "<s>" + members[tour[channel].tourmembers[tourmembersindex]] + "</s>" : members[tour[channel].tourmembers[tourmembersindex]];
  915.                                 var tourspottwo = tour[channel].tourlosers.indexOf(tour[channel].tourmembers[tourmembersindex+1]) != -1 ? "<s>" + members[tour[channel].tourmembers[tourmembersindex+1]] + "</s>" : members[tour[channel].tourmembers[tourmembersindex+1]];
  916.                                 tourspotone = tour[channel].tourbattlers.indexOf(tour[channel].tourmembers[tourmembersindex]) != -1 ? "<i>" + members[tour[channel].tourmembers[tourmembersindex]] + "</i>" : tourspotone;
  917.                                 tourspottwo = tour[channel].tourbattlers.indexOf(tour[channel].tourmembers[tourmembersindex+1]) != -1 ? "<i>" + members[tour[channel].tourmembers[tourmembersindex+1]] + "</i>" : tourspottwo;
  918.                                 tourspotone = tour[channel].tourmembers[tourmembersindex] == "|bye|" ? "|bye|" : tourspotone;
  919.                                 tourspottwo = tour[channel].tourmembers[tourmembersindex+1] == "|bye|" ? "|bye|" : tourspottwo;
  920.                                 roundstring += "<b>" + (tourmembersindex+2)/2 + ". " + tourspotone + " VS " + tourspottwo + "</b><br/>";
  921.                         }
  922.                         if (tour[channel].tourwinners.length > 0){
  923.                                 var tourwinnerslist = "<b><small>", tourwinnersindex;
  924.                                 for (tourwinnersindex in tour[channel].tourwinners){
  925.                                         tourwinnerslist += members[tour[channel].tourwinners[tourwinnersindex]] + ", ";
  926.                                 }
  927.                                 tourwinnerslist = tourwinnerslist.substring(0, tourwinnerslist.length-2) + ".</small></b>"
  928.                                 roundstring += correctborder + "<br/>"
  929.                                 + "<font color='green'><b>Players through to the Next Round</b></font><br/>"
  930.                                 + correctborder + "<br/>"
  931.                                 + tourwinnerslist + "<br/>"
  932.                         }              
  933.                         if (tour[channel].tourlosers.length > 0){
  934.                                 var tourloserslist = "<b><small>", tourlosersindex;
  935.                                 for (tourlosersindex in tour[channel].tourlosers){
  936.                                         tourloserslist += members[tour[channel].tourlosers[tourlosersindex]] + ", ";
  937.                                 }
  938.                                 tourloserslist = tourloserslist.substring(0, tourloserslist.length-2) + ".</small></b>"
  939.                                 roundstring += correctborder + "<br/>"
  940.                                 + "<font color='red'><b>Players out of the tournament</b></font><br/>"
  941.                                 + correctborder + "<br/>"
  942.                                 + "<b><small>" + tourloserslist + "</small></b><br/>"
  943.                         }
  944.                         roundstring += correctborder;
  945.                         if (tour[channel].tourmembers.length % 2 == 1){
  946.                                 tour[channel].tourmembers.push("|bye|");
  947.                                 tour[channel].tourwinners.push(tour[channel].tourmembers[tour[channel].tourcurrentnumber-1]);
  948.                                 roundstring += "<br/>"
  949.                                 + "<font color='green'><b>" + members[tour[channel].tourmembers[tour[channel].tourcurrentnumber-1]] + " is randomly selected to go through to the next round!</b></font><br/>"
  950.                                 + correctborder;
  951.                         }
  952.                         send(roundstring, channel);
  953.                 }
  954.  
  955.                 ,
  956.  
  957.                 tourmembersnumber: function(name, channel){
  958.                         if (tour[channel].tourmode != 0){
  959.                                 var tourmembersnumber = tour[channel].tourmembers.indexOf(name);
  960.                                 if (tourmembersnumber != -1){
  961.                                         return tourmembersnumber;
  962.                                 }
  963.                         }
  964.                 }
  965.  
  966.                 ,
  967.  
  968.                 tourmembersname: function(number, channel){
  969.                         if (number <= tour[channel].tourcurrentnumber){
  970.                                 return members[tour[channel].tourmembers[number]];
  971.                         }
  972.                 }
  973.  
  974.                 ,
  975.  
  976.                 tourloserscheck: function (name, channel){
  977.                         return tour[channel].tourlosers.indexOf(name) == -1 ? true: false;
  978.                 }
  979.  
  980.                 ,
  981.  
  982.                 opponentof: function (name, channel){
  983.                         var tourmembersnumber = helpers.tourmembersnumber(name, channel);
  984.                         return tourmembersnumber % 2 == 0 ? tour[channel].tourmembers[tourmembersnumber+1]: tour[channel].tourmembers[tourmembersnumber-1];
  985.                 }
  986.  
  987.                 ,
  988.  
  989.                 nopair: function(index1, index2){
  990.                         return (index1 % 2 == 0 && index2 != index1 + 1) || (index1 % 2 == 1 && index1 != index2 + 1) ? true: false;
  991.                 }
  992.         }
  993.         helpers.setregvalue("Tiers_Options_TiersName", "servertiers");
  994.         helpers.setvariable("tiersname", sys.getVal("Tiers_Options_TiersName"));
  995.         helpers.setregvalue("Tiers_Options_TiersLinks", '{"po":"http://pokemonperfect.co.uk/po_tiers.xml","smogon":"http://pokemonperfect.co.uk/smogon_tiers.xml"}');
  996.         helpers.setobjectvariable("tierslinks", sys.getVal("Tiers_Options_TiersLinks"));
  997.         helpers.setregvalue("Script_Options_RegisteredDate", String(new Date()));
  998.         helpers.setvariable("registereddate", sys.getVal("Script_Options_RegisteredDate"));
  999.         helpers.setregvalue("Script_Options_ScriptName", "serverscript");
  1000.         helpers.setvariable("scriptname", sys.getVal("Script_Options_ScriptName"));
  1001.         helpers.setregvalue("Script_Options_ServerScriptLink", "http://pokemonperfect.co.uk/serverscript.txt");
  1002.         helpers.setvariable("serverscriptlink", sys.getVal("Script_Options_ServerScriptLink"));
  1003.         helpers.setregvalue("Script_Options_AutoUpdateScriptLink", "http://pokemonperfect.co.uk/webcallscript.txt");
  1004.         helpers.setvariable("autoupdatescriptlink", sys.getVal("Script_Options_AutoUpdateScriptLink"));
  1005.         helpers.setregvalue("Script_Options_ScriptModders", "[]");
  1006.         helpers.setobjectvariable("scriptmodders", sys.getVal("Script_Options_ScriptModders"));
  1007.         helpers.setregvalue("Script_Options_ScriptThanked", '["coyotte508","Lamperi","Intel_iX","Mystra","NeO","Juno","nesan","kupo", "TheUnknownOne", "SkarmPiss", "GaryTheGengar"]');
  1008.         helpers.setobjectvariable("scriptthanked", sys.getVal("Script_Options_ScriptThanked"));
  1009.         helpers.setregvalue("Script_Options_ScriptContributors", "[]");
  1010.         helpers.setobjectvariable("scriptcontributors", sys.getVal("Script_Options_ScriptContributors"));
  1011.         helpers.setregvalue("Commands_Options_MessageCommands", "{}");
  1012.         helpers.setobjectvariable("messagecommands", sys.getVal("Commands_Options_MessageCommands"));
  1013.         helpers.setregvalue("Variable_Options_VariableChanges", "on");
  1014.         helpers.setvariable("variablechanges", sys.getVal("Variable_Options_VariableChanges"));
  1015.         helpers.setvariable("serverversion", sys.serverVersion());
  1016.         helpers.setvariable("status", sys.isServerPrivate() ? "private" : "public");
  1017.         helpers.setvariable("open", true);
  1018.         helpers.setvariable("playersonline", new Object());
  1019.         helpers.setregvalue("Flood_Options_FloodTime", 10);
  1020.         helpers.setvariable("floodtime", sys.getVal("Flood_Options_FloodTime"));
  1021.         helpers.setregvalue("Flood_Options_MessageAllowance", 8);
  1022.         helpers.setvariable("messageallowance", sys.getVal("Flood_Options_MessageAllowance"));
  1023.         helpers.setvariable("floodplayers", new Array());
  1024.         helpers.setvariable("silence", 0);
  1025.         helpers.setvariable("shutdown", false);
  1026.         helpers.setregvalue("Event_Options_FindBattleMessage", "on");
  1027.         helpers.setvariable("findbattlemessage", sys.getVal("Event_Options_FindBattleMessage"));
  1028.         helpers.setvariable("battlesonline", new Object());
  1029.         helpers.setvariable("battlers", new Array());
  1030.         helpers.setregvalue("RangeBanEx_List", "{}");
  1031.         helpers.setobjectvariable("rangebanexlist", sys.getVal("RangeBanEx_List"));
  1032.         helpers.setregvalue("BanEx_List", "{}");
  1033.         helpers.setobjectvariable("banexlist", sys.getVal("BanEx_List"));
  1034.         helpers.setregvalue("MuteEx_List", "{}");
  1035.         helpers.setobjectvariable("muteexlist", sys.getVal("MuteEx_List"));
  1036.         helpers.setvariableprocedure("mutedips", "mutedipsload");
  1037.         helpers.setregvalue("Ip_List", "{}");
  1038.         helpers.setobjectvariable("iplist", sys.getVal("Ip_List"));
  1039.         helpers.setregvalue("Alias_List", "{}");
  1040.         helpers.setobjectvariable("aliaslist", sys.getVal("Alias_List"));
  1041.         helpers.setregvalue("AntiMember_List", "{}");
  1042.         helpers.setobjectvariable("antimemberlist", sys.getVal("AntiMember_List"));
  1043.         helpers.setvariable("symbollist", sys.getVal("Symbol_List"));
  1044.         helpers.setregvalue("Authority_Options_AuthLevel0Name", "User");
  1045.         helpers.setvariable("AuthLevel0Name", sys.getVal("Authority_Options_AuthLevel0Name"));
  1046.         helpers.setregvalue("Authority_Options_AuthLevel1Name", "Moderator");
  1047.         helpers.setvariable("AuthLevel1Name", sys.getVal("Authority_Options_AuthLevel1Name"));
  1048.         helpers.setregvalue("Authority_Options_AuthLevel2Name", "Administrator");
  1049.         helpers.setvariable("AuthLevel2Name", sys.getVal("Authority_Options_AuthLevel2Name"));
  1050.         helpers.setregvalue("Authority_Options_AuthLevel3Name", "Owner");
  1051.         helpers.setvariable("AuthLevel3Name", sys.getVal("Authority_Options_AuthLevel3Name"));
  1052.         helpers.setregvalue("Authority_Options_TourAuthLevel0Name", "Tour User");
  1053.         helpers.setvariable("TourAuthLevel0Name", sys.getVal("Authority_Options_TourAuthLevel0Name"));
  1054.         helpers.setregvalue("Authority_Options_TourAuthLevel1Name", "Tour Admin");
  1055.         helpers.setvariable("TourAuthLevel1Name", sys.getVal("Authority_Options_TourAuthLevel1Name"));
  1056.         helpers.setregvalue("Authority_Options_ChannelAuthLevel0Name", "Channel User");
  1057.         helpers.setvariable("ChannelAuthLevel0Name", sys.getVal("Authority_Options_ChannelAuthLevel0Name"));
  1058.         helpers.setregvalue("Authority_Options_ChannelAuthLevel1Name", "Channel Mod");
  1059.         helpers.setvariable("ChannelAuthLevel1Name", sys.getVal("Authority_Options_ChannelAuthLevel1Name"));
  1060.         helpers.setregvalue("Authority_Options_ChannelAuthLevel2Name", "Channel Admin");
  1061.         helpers.setvariable("ChannelAuthLevel2Name", sys.getVal("Authority_Options_ChannelAuthLevel2Name"));
  1062.         helpers.setregvalue("Authority_Options_ChannelAuthLevel3Name", "Channel Owner");
  1063.         helpers.setvariable("ChannelAuthLevel3Name", sys.getVal("Authority_Options_ChannelAuthLevel3Name"));
  1064.         helpers.setregvalue("Authority_Options_ChannelTourAuthLevel0Name", "Channel Tour User");
  1065.         helpers.setvariable("ChannelTourAuthLevel0Name", sys.getVal("Authority_Options_ChannelTourAuthLevel0Name"));
  1066.         helpers.setregvalue("Authority_Options_ChannelTourAuthLevel1Name", "Channel Tour Admin");
  1067.         helpers.setvariable("ChannelTourAuthLevel1Name", sys.getVal("Authority_Options_ChannelTourAuthLevel1Name"));
  1068.         helpers.setvariableprocedure("members", "memberslist");
  1069.         helpers.setvariableprocedure("port", "configload");
  1070.         helpers.setregvalue("Authority_Options_TourAuthLevel1List", "[]");
  1071.         helpers.setobjectvariable("tourauth", sys.getVal("Authority_Options_TourAuthLevel1List"));
  1072.         helpers.setregvalue("Battle_Record", battlers.length/2);
  1073.         helpers.setvariable("battlerecord", sys.getVal("Battle_Record"));
  1074.         helpers.setregvalue("Total_Battles", 0);
  1075.         helpers.setvariable("totalbattles", sys.getVal("Total_Battles"));
  1076.         helpers.setregvalue("Player_Record", sys.numPlayers());
  1077.         helpers.setvariable("playerrecord", sys.getVal("Player_Record"));
  1078.         helpers.setregvalue("Channel_Record", helpers.channelcount());
  1079.         helpers.setvariable("channelrecord", sys.getVal("Channel_Record"));
  1080.         helpers.setvariableprocedure("", "serverscriptdownload");
  1081.         helpers.setvariableprocedure("", "autoupdatescriptdownload");
  1082.         scriptcontent = sys.getFileContent("scripts.js");
  1083.         helpers.setvariableprocedure("", "scriptversion");
  1084.         helpers.setregvalue("Server_Topic","Enjoy your stay at " + servername + "!");
  1085.         helpers.setvariable("servertopic", sys.getVal("Server_Topic"));
  1086.         helpers.setvariableprocedure("channelsonline", "channelsonlineload");
  1087.         helpers.setregvalue("Channel_Options_RegisteredChannels", "[]");
  1088.         helpers.setobjectvariable("registeredchannels", sys.getVal("Channel_Options_RegisteredChannels"));
  1089.         helpers.setregvalue("Channel_Options_RegisteredChannelsLimit", 25);
  1090.         helpers.setvariable("registeredchannelslimit", sys.getVal("Channel_Options_RegisteredChannelsLimit"));
  1091.         helpers.setregvalue("Main_Channel", "{}");
  1092.         helpers.setvariableprocedure("channelsregistered", "channelsregisteredload");
  1093.         helpers.setregvalue("Quasi_English", "off");
  1094.         helpers.setvariable("quasienglish", sys.getVal("Quasi_English"));
  1095.         helpers.setvariable("future", new Object());
  1096.         helpers.setregvalue("Future_Limit", "5");
  1097.         helpers.setvariable("futurelimit", sys.getVal("Future_Limit"));
  1098.         border = "<font color='Cornflowerblue'><b>\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB</b></font>";
  1099.         border2 = "<font color='MediumBlue'><b>\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB</b></font>";
  1100.         border3 = "<font color='DarkBlue'><b>\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB\u00BB</b></font>";
  1101.         border4 = "<b>//////////////////////////////////////////////////////////////////</b>";
  1102.         typecommands = "<b><font color='orangered'>The following commands need to be entered into a channel's main chat:</font></b>";
  1103.         scriptlastload = new Date();
  1104.         commands = new Object();
  1105.         commands = {
  1106.                 commands: function (src, channel, command){
  1107.                 var commandsdisplay = border
  1108.                 + "<h2>Commands</h2>"
  1109.                 + "<br/>"
  1110.                 + typecommands + "<br/>"
  1111.                 + "<br/>"
  1112.                 + "<b>\u2022 <font color='green'>/" + helpers.escapehtml(helpers.removespaces(AuthLevel3Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(AuthLevel3Name).toLowerCase() + " commands.<br/>"
  1113.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(AuthLevel2Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(AuthLevel2Name).toLowerCase() + " commands.<br/>"
  1114.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(AuthLevel1Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(AuthLevel1Name).toLowerCase() + " commands.<br/>"
  1115.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(AuthLevel0Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(AuthLevel0Name).toLowerCase() + " commands.<br/>"
  1116.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(TourAuthLevel1Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(TourAuthLevel1Name).toLowerCase() + " commands.<br/>"
  1117.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(TourAuthLevel0Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(TourAuthLevel0Name).toLowerCase() + " commands.<br/>"
  1118.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelAuthLevel3Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(ChannelAuthLevel3Name).toLowerCase() + " commands.<br/>"
  1119.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelAuthLevel2Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(ChannelAuthLevel2Name).toLowerCase() + " commands.<br/>"
  1120.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelAuthLevel1Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(ChannelAuthLevel1Name).toLowerCase() + " commands.<br/>"
  1121.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelAuthLevel0Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(ChannelAuthLevel0Name).toLowerCase() + " commands.<br/>"
  1122.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelTourAuthLevel1Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(ChannelTourAuthLevel1Name).toLowerCase() + " commands.<br/>"
  1123.                 + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelTourAuthLevel0Name)).toLowerCase() + "commands</b></font>: displays the " + helpers.escapehtml(ChannelTourAuthLevel0Name).toLowerCase() + " commands.<br/>"
  1124.                 + "<br/>"
  1125.                 + "<timestamp/><br/>"
  1126.                 + border;
  1127.                 sys.sendHtmlMessage(src, commandsdisplay, channel);
  1128.                 }
  1129.  
  1130.                 ,
  1131.  
  1132.                 chatoptions: function(src, channel, command){
  1133.                         var chatoptionsdisplay = border
  1134.                         + "<h2>Chat Options</h2>"
  1135.                         + "<br/>"
  1136.                         + "<font color='maroon'><b>\u2022  The Server topic is currently " + helpers.escapehtml(servertopic).italics() + "</b></font><br/>"
  1137.                         + "<font color='green'><b>\u2022  Quasi-English characters are currently turned " + quasienglish + ".</b></font><br/>"
  1138.                         + "<font color='indigo'><b>\u2022 The Future Limit is currently set to " + futurelimit + " messages.</b></font><br/>"
  1139.                         + "<h3>Chat Commands</h3>"
  1140.                         + "<br/>"
  1141.                         + typecommands + "<br/>"
  1142.                         + "<br/>"
  1143.                         + "<b>\u2022  <font color='green'>/tempservertopic</font><font color='red'> topic</font></b>: changes the server topic to <b>topic</b> for the duration the server is open for. <b>topic</b> is any text. If <b>topic</b> is <i>off</i>, turns the server topic feature off. If <b>topic</b> is <i>default</i>, changes the server topic to <i>Enjoy your stay at " + servername + "</i><br/>"
  1144.                         + "<b>\u2022  <font color='green'>/servertopic</font><font color='red'> topic</font></b>: changes the server topic to <b>topic. </b><b>topic</b> is any text. If <b>topic</b> is <i>off</i>, turns the server topic feature off. If <b>topic</b> is <i>default</i>, changes the server topic to <i>Enjoy your stay at " + servername + "</i><br/>"
  1145.                         + "<b>\u2022  <font color='green'>/quasienglish</font><font color='red'> status</font></b>: if <b>status</b> is <i>on</i>, players can use characters resembling english ones in their names; if <b>status</b> is <i>off</i>, they cannot use them in their names.<br/>"
  1146.                         + "<b>\u2022  <font color='green'>/futurelimit</font><font color='red'> number</font></b>: sets the maximum limit of future messages to <b>number</b>.<br/>"
  1147.                         + "<br/>"
  1148.                         + "<timestamp/><br/>"
  1149.                         + border;
  1150.                         sys.sendHtmlMessage(src, chatoptionsdisplay, channel);                 
  1151.                 }
  1152.  
  1153.                 ,
  1154.  
  1155.                 cmdsoptions: function(src, channel, command){
  1156.                         var commandskeys = Object.keys(commands), commandstotal = Object.keys(commands).length, msgcommandstotal = Object.keys(messagecommands).length, commandsindex, commandslist = "<b><small>";
  1157.                         commandskeys.sort();
  1158.                         for (commandsindex in commandskeys){
  1159.                                 if (messagecommands[commandskeys[commandsindex]] === undefined){
  1160.                                         commandslist += commandskeys[commandsindex] + ", ";
  1161.                                         continue;
  1162.                                 }
  1163.                                 commandslist += "<font color='blue'>" + commandskeys[commandsindex] + "</font>, ";
  1164.                         }
  1165.                         commandslist = commandslist.substring(0, commandslist.length-2) + ".</small></b>"
  1166.                         var cmdsoptionsdisplay = border
  1167.                         + "<h2>Commands Options</h2>"
  1168.                         + "<b><u>Commands List</u></b><br/><br/>"
  1169.                         + commandslist + "<br/>"
  1170.                         + "<br/>"
  1171.                         + "<b>Total Number of Commands:</b> " + commandstotal + "<br/>"
  1172.                         + "<b><font color='blue'>Total Number of Message Commands:</font></b> " + msgcommandstotal
  1173.                         + "<h3>Commands Commands</h3>"
  1174.                         + "<br/>"
  1175.                         + typecommands + "<br/>"
  1176.                         + "<br/>"
  1177.                         + "<b>\u2022  <font color='green'>/writemsgcmd</font><font color='red'> name</font><font color='blue'>*html</font></b>: creates/overwrites a message command called <b>name</b> containing <b>html</b>.<br/>"
  1178.                         + "<b>\u2022  <font color='green'>/deletemsgcmd</font><font color='red'> name</font></b>: deletes a message command called <b>name</b>.<br/>"
  1179.                         + "<b>\u2022  <font color='green'>/clearmsgcmds</font></b>: deletes all message commands.<br/>"                                        
  1180.                         + "<br/>"
  1181.                         + "<timestamp/><br/>"
  1182.                         + border;
  1183.                         sys.sendHtmlMessage(src, cmdsoptionsdisplay, channel);         
  1184.                 }
  1185.  
  1186.                 ,
  1187.  
  1188.                 helpersoptions: function(src, channel, command){
  1189.                         var helperslist = "<b><small>" + String(Object.keys(helpers)).replace(/,/g, ", ") + ".</small></b>", helperstotal = Object.keys(helpers).length;
  1190.                         var helpersoptionsdisplay = border
  1191.                         + "<h2>Helpers Options</h2>"
  1192.                         + "<h3><u>Helpers List</u></h3>"
  1193.                         + helperslist + "<br/>"
  1194.                         + "<br/>"
  1195.                         + "<b>Total Number of Helpers:</b> " + helperstotal
  1196.                         + "<h3>Helpers Option Commands</h3>"
  1197.                         + "<br/>"
  1198.                         + typecommands + "<br/>"
  1199.                         + "<br/>"
  1200.                         + "<br/>"
  1201.                         + "<timestamp/><br/>"
  1202.                         + border;
  1203.                         sys.sendHtmlMessage(src, helpersoptionsdisplay, channel);                      
  1204.                 }
  1205.  
  1206.                 ,
  1207.  
  1208.                 sessionoptions: function(src, channel, command){
  1209.                         var sessionlist = "<b><small>" + String(Object.keys(SESSION)).replace(/,/g, ", ") + ".</small></b>", sessiontotal = Object.keys(SESSION).length;
  1210.                         var sessionoptionsdisplay = border
  1211.                         + "<h2>SESSION Options</h2>"
  1212.                         + "<h3><u>SESSION Keys List</u></h3>"
  1213.                         + sessionlist + "<br/>"
  1214.                         + "<br/>"
  1215.                         + "<b>Total Number of Session keys:</b> " + sessiontotal
  1216.                         + "<h3>Session Option Commands</h3>"
  1217.                         + "<br/>"
  1218.                         + typecommands + "<br/>"
  1219.                         + "<br/>"
  1220.                         + "<br/>"
  1221.                         + "<timestamp/><br/>"
  1222.                         + border;
  1223.                         sys.sendHtmlMessage(src, sessionoptionsdisplay, channel);                      
  1224.                 }
  1225.  
  1226.                 ,
  1227.  
  1228.                 dboptions: function(src, channel, command){
  1229.                         var dboptionsdisplay = border
  1230.                         + "<h2>Database Options</h2>"
  1231.                         + "<br/>"
  1232.                         + "<h3>Database Option Commands</h3>"
  1233.                         + "<br/>"
  1234.                         + typecommands + "<br/>"
  1235.                         + "<br/>"
  1236.                         + "<b>\u2022  <font color='green'>/resetladder</font><font color='red'> tier</font></b>: resets the ladder for <b>tier</b>. <b>tier</b> is any of the server's tiers.<br/>"
  1237.                         + "<b>\u2022  <font color='green'>/clearladders</font></b>: resets all of the server's ladders.<br/>"
  1238.                         + "<b>\u2022  <font color='green'>/exportladders</font></b>: exports the tier ratings database.<br/>"
  1239.                         + "<b>\u2022  <font color='green'>/changerating</font><font color='red'> player</font><font color='blue'>*tier</font><font color='blueviolet'>*rating</font></b>: changes the rating of <b>player</b> in <b>tier</b> to <b>rating</b>.<br/>"
  1240.                         + "<b>\u2022  <font color='green'>/exportmembers</font></b>: exports the member database.<br/>"
  1241.                         + "<b>\u2022  <font color='green'>/clearpass</font><font color='red'> player</font></b>: clears <b>player</b>'s password.<b> player</b> is any player in the member database.<br/>"
  1242.                         + "<b>\u2022  <font color='green'>/deleteplayer</font><font color='red'> player</font></b>: deletes <b>player</b> from the database for next startup.<b> player</b> is any player in the member database.<br/>"  
  1243.                         + "<br/>"
  1244.                         + "<timestamp/><br/>"
  1245.                         + border;
  1246.                         sys.sendHtmlMessage(src, dboptionsdisplay, channel);                   
  1247.                 }
  1248.  
  1249.                 ,
  1250.  
  1251.                 runoptions: function(src, channel, command){
  1252.                         var openorclosed = open === true? "open" : "closed";
  1253.                         var runoptionsdisplay = border
  1254.                         + "<h2>Run Options</h2>"
  1255.                         + "<br/>"
  1256.                         + "<b><font color='red'>\u2022  The Server is currently " + openorclosed + " to player connections.</font></b><br/>"
  1257.                         + "<b>\u2022  The Server is currently " + status + ".</b><br/>"
  1258.                         + "<h3>Run Option Commands</h3>"
  1259.                         + "<br/>"
  1260.                         + typecommands + "<br/>"
  1261.                         + "<br/>"
  1262.                         + "<b>\u2022  <font color='green'>/open</font></b>: opens the server to all player connections.<br/>"
  1263.                         + "<b>\u2022  <font color='green'>/close</font></b>: closes the server to all player connections except 127.0.0.1.<br/>"       
  1264.                         + "<b>\u2022  <font color='green'>/public</font></b>: changes the server to public.<br/>"
  1265.                         + "<b>\u2022  <font color='green'>/private</font></b>: changes the server to private.<br/>"
  1266.                         + "<b>\u2022  <font color='green'>/disconnectall</font></b>: disconnects all players online from the server.<br/>"
  1267.                         + "<b>\u2022  <font color='green'>/lockout</font></b>: disconnects all players online from the server and closes the server to all player connections except 127.0.0.1.<br/>"
  1268.                         + "<b>\u2022  <font color='green'>/shutdown</font></b> or <b><font color='green'>/shutdown</b></font><font color='red'><b> number</b></font><font color='blue'><b>*unit</b></font>: shuts the server down immediately or in <b>number</b> <b>unit</b>. <b>number</b> is any non-negative value. <b>unit</b> is either seconds, minutes, hours, days, weeks, months or years.<br/>"
  1269.                         + "<b>\u2022  <font color='green'>/cancelshutdown</b></font>: Cancels a planned shutdown.<br/>"
  1270.                         + "<br/>"
  1271.                         + "<timestamp/><br/>"
  1272.                         + border;
  1273.                         sys.sendHtmlMessage(src, runoptionsdisplay, channel);
  1274.                 }
  1275.  
  1276.                 ,
  1277.  
  1278.                 tiersoptions: function(src, channel, command){
  1279.                         var tierslinksindex, tierslinklist = "";
  1280.                         for (tierslinksindex in tierslinks){
  1281.                                 tierslinklist += "<b>\u2022 " + tierslinksindex + ": <i><a href='" + tierslinks[tierslinksindex] + "'>" + tierslinks[tierslinksindex] + "</a></i></b><br/>";
  1282.                         }
  1283.                         var tiersoptionsdisplay = border
  1284.                         + "<h2>Tiers Options</h2>"
  1285.                         + "<br/>"
  1286.                         + "<font color='green'><b>\u2022  The tiers name is currently known as " + tiersname.italics() + ".</b></font><br/>"
  1287.                         + tierslinklist
  1288.                         + "<h3>Tiers Option Commands</h3>"
  1289.                         + "<br/>"
  1290.                         + typecommands + "<br/>"
  1291.                         + "<br/>"
  1292.                         + "<b>\u2022  <font color='green'>/tiersname</font><font color='red'> name</font></b>: saves the name of the tiers as <b>name</b>.<br/>"
  1293.                         + "<b>\u2022  <font color='green'>/tierslinksupdate</font></b>: updates the tierslinks object for possible new URLs (clears any keys added by /tierslinkwrite).<br/>"  
  1294.                         + "<b>\u2022  <font color='green'>/tiersload</font></b>: loads the tiers from file.<br/>"
  1295.                         + "<b>\u2022  <font color='green'>/tiersimport</font><font color='red'> file</font></b>: loads the tiers from <b>file</b> within the PO server folder and overwrites.<br/>"
  1296.                         + "<b>\u2022  <font color='green'>/tiersexport</font></b>: exports the tiers to " + tiersname + ".xml<br/>"
  1297.                         + "<b>\u2022  <font color='green'>/tiersinstall</font><font color='red'> key</font></b>: downloads the tiers via the link stored under <b>key</b> and loads the tiers from file.<br/>"
  1298.                         + "<b>\u2022  <font color='green'>/tierslast</font></b>: loads your last tiers before you loaded another tiers by command.<br/>"
  1299.                         + "<br/>"
  1300.                         + "<timestamp/><br/>"
  1301.                         + border;
  1302.                         sys.sendHtmlMessage(src, tiersoptionsdisplay, channel);                
  1303.                 }
  1304.  
  1305.                 ,
  1306.  
  1307.                 scriptoptions: function(src, channel, command){
  1308.                         var scriptoptionsdisplay = border
  1309.                         + "<h2>Script Options</h2>"
  1310.                         + "<br/>"
  1311.                         + "<b>\u2022  The Server Script is currently known as " + scriptname.italics() + ".</b><br/>"
  1312.                         + "<b><font color='blue'>\u2022  The Full Original Script web URL is currently <a href='" + serverscriptlink + "'>" + serverscriptlink.italics() + "</a></font></b><br/>"                      
  1313.                         + "<b><font color='green'>\u2022  The Auto-Update Script web URL is currently <a href='" + autoupdatescriptlink + "'>" + autoupdatescriptlink.italics() + "</a></font></b><br/>"
  1314.                         + scriptversion + "<br/>"
  1315.                         + "<font color='goldenrod'><b>\u2022 The current Script Contributors are: " + String(scriptcontributors).replace(/,/g, ", ") + "</b></font><br/>"
  1316.                         + "<font color='darkgoldenrod'><b>\u2022 The current Script Special Thanks List is: " +  String(scriptthanked).replace(/,/g, ", ") + "</b></font>"
  1317.                         + "<h3>Script Option Commands</h3>"
  1318.                         + "<br/>"
  1319.                         + typecommands + "<br/>"
  1320.                         + "<br/>"
  1321.                         + "<b>\u2022  <font color='green'>/scriptname</font><font color='red'> name</font></b>: saves the name of the script as <b>name</b>.<br/>"
  1322.                         + "<b>\u2022  <font color='green'>/scriptupdatelinks</font></b>: updates the auto-update and full script URLs to their latest form.<br/>"              
  1323.                         + "<b>\u2022  <font color='green'>/scriptserverlink</font><font color='red'> link</font></b>: saves the web URL for  the full script as <b>link.</b><br/>"     
  1324.                         + "<b>\u2022  <font color='green'>/scriptautolink</font><font color='red'> link</font></b>: saves the web URL for  the auto-update script as <b>link.</b><br/>"        
  1325.                         + "<b>\u2022  <font color='green'>/scriptload</font></b>: loads the script from file. (loads latest script if using auto-update script)<br/>"
  1326.                         + "<b>\u2022  <font color='green'>/scriptreload</font></b>: reloads the script (except events) stored by the server.<br/>"
  1327.                         + "<b>\u2022  <font color='green'>/scriptchange</font><font color='red'> file</font></b>: loads the script from <b>file</b> within the PO server folder.<br/>"
  1328.                         + "<b>\u2022  <font color='green'>/scriptimport</font><font color='red'> file</font></b>: loads the script from <b>file</b> within the PO server folder and overwrites.<br/>"
  1329.                         + "<b>\u2022  <font color='green'>/scriptexport</font></b>: exports the script to " + scriptname + ".txt<br/>"
  1330.                         + "<b>\u2022  <font color='green'>/scriptfull</font></b>: loads the latest full script.<br/>"
  1331.                         + "<b>\u2022  <font color='green'>/scriptautoupdate</font></b>: loads the latest auto-update script.<br/>"
  1332.                         + "<b>\u2022  <font color='green'>/scriptlast</font></b>: loads your last script before you loaded another script by command.<br/>"
  1333.                         + "<b>\u2022  <font color='green'>/scriptmod</font></b> or <b><font color='gray'>/scriptmod</font><font color='red'> name</font></b>: declares the current script as your modification of the original script.<br/>"
  1334.                         + "<b>\u2022  <font color='gray'>/scriptdemod</font></b> or <b><font color='gray'>/scriptdemod</font><font color='red'> name</font></b>: undeclares the current script as your modification of the original script.<br/>"
  1335.                         + "<b>\u2022  <font color='green'>/scriptunmod</font></b>: undeclares the current script as a modification of the original script and clears all names added with /scriptmod.<br/>"
  1336.                         + "<b>\u2022  <font color='gray'>/scriptupdatethanks</font></b>: updates the special thanks list of the script (clears any additional done with /scriptthank).<br/>"
  1337.                         + "<b>\u2022  <font color='gray'>/scriptthank</font><font color='red'> name</font></b>: adds <b>name</b> to the script special thanks list.<br/>"
  1338.                         + "<b>\u2022  <font color='gray'>/scriptdethank</font><font color='red'> name</font></b>: removes <b>name</b> from the script special thanks list.<br/>"
  1339.                         + "<b>\u2022  <font color='gray'>/scriptupdatecontribs</font></b>: updates the contributors to the script (clears any additional done with /scriptcontrib).<br/>"
  1340.                         + "<b>\u2022  <font color='gray'>/scriptcontrib</font><font color='red'> name</font></b>: adds <b>name</b> as a contributor to the script.<br/>"
  1341.                         + "<b>\u2022  <font color='gray'>/scriptdecontrib</font><font color='red'> name</font></b>: removes <b>name</b> as a contributor to the script.<br/>"
  1342.                         + "<br/>"
  1343.                         + "<timestamp/><br/>"
  1344.                         + border;
  1345.                         sys.sendHtmlMessage(src, scriptoptionsdisplay, channel);
  1346.                 }
  1347.  
  1348.                 ,
  1349.  
  1350.                 sysoptions: function(src, channel, command){
  1351.                         var syslist = "<b><small>", systotal = 0, sysindex;
  1352.                         for (sysindex in sys){
  1353.                                 if (typeof sys[sysindex] === "function"){
  1354.                                         syslist += sysindex + ", ";
  1355.                                         systotal++;
  1356.                                 }
  1357.                         }                      
  1358.                         syslist = syslist.substring(0, syslist.length-2) + ".</small></b>";
  1359.                         var sysoptionsdisplay = border
  1360.                         + "<h2>Sys Options</h2>"
  1361.                         + "<h3><u>Scripting Functions List</u></h3>"
  1362.                         + syslist + "<br/>"
  1363.                         + "<br/>"
  1364.                         + "<b>Total Number of Scripting Functions:</b> " + systotal + "<br/>"  
  1365.                         + "<h3>Sys Option Commands</h3>"
  1366.                         + "<br/>"
  1367.                         + typecommands + "<br/>"
  1368.                         + "<br/>"
  1369.                         + "<b>\u2022  <font color='green'>/sys</font><font color='red'> function_path</font><font color='blue'>*parameters</font></b>: calls the function located at <b>function_path</b> with <b>parameters</b>. <b>function_path</b> is the path from sys where the function is stored. <b>parameters</b> must be separated by: <i>,</i><br/>"
  1370.                         + "<br/>"
  1371.                         + "<timestamp/><br/>"
  1372.                         + border;
  1373.                         sys.sendHtmlMessage(src, sysoptionsdisplay, channel);
  1374.                 }
  1375.  
  1376.                 ,
  1377.  
  1378.                 eventoptions: function(src, channel, command){
  1379.                         var eventslist = "<b><small>", eventstotal = Object.keys(script).length, acteventstotal = 0, eventsindex;
  1380.                         for (eventsindex in script){
  1381.                                 if (String(script[eventsindex]).split("{\u000A\t}").length == 1){
  1382.                                         eventslist += "<font color='green'>" + eventsindex + "</font>, ";
  1383.                                         acteventstotal++;
  1384.                                         continue;
  1385.                                 }
  1386.                                 eventslist += eventsindex + ", ";
  1387.                         }
  1388.                         eventslist = eventslist.substring(0, eventslist.length-2) + ".</small></b>";
  1389.                         var eventoptionsdisplay = border
  1390.                         + "<h2>Event Options</h2>"
  1391.                         + "<h3><u>Events List</u></h3>"
  1392.                         + eventslist + "<br/>"
  1393.                         + "<br/>"
  1394.                         + "<font color='blue'><b>\u2022 The Find Battle event message is currently turned " + findbattlemessage + ".</b></font><br/>"
  1395.                         + "<br/>"
  1396.                         + "<b><font color='green'>Total Number of Active Events:</font></b> " + acteventstotal + "<br/>"
  1397.                         + "<b>Total Number of Events:</b> " + eventstotal + "<br/>"
  1398.                         + "<br/>"
  1399.                         + typecommands + "<br/>"
  1400.                         + "<br/>"
  1401.                         + "<b>\u2022  <font color='green'>/findbattlemessage</font><font color='red'> status</font></b>: if <b>status</b> is <i>on</i>, shows Find Battle event message in the main chat in all channels; if <b>status</b> is <i>off</i>, the message isn't shown.<br/>"
  1402.                         + "<br/>"
  1403.                         + "<timestamp/><br/>"
  1404.                         + border;
  1405.                         sys.sendHtmlMessage(src, eventoptionsdisplay, channel);
  1406.                 }
  1407.  
  1408.                 ,
  1409.  
  1410.                 execoptions: function(src, channel, command){
  1411.                         var props = Object.getOwnPropertyNames(global), propslist = "<b><small>", propstotal = 0, propsindex;
  1412.                         for (propsindex in props){
  1413.                                 if (!global.propertyIsEnumerable(props[propsindex])){
  1414.                                         propslist += props[propsindex] + ", ";
  1415.                                         propstotal++;
  1416.                                 }
  1417.                         }
  1418.                         propslist = propslist.substring(0, propslist.length-2) + ".</small></b>";
  1419.                         var executiveoptionsdisplay = border
  1420.                         + "<h2> Executive Options </h2>"
  1421.                         + "<h3><u>Unenumerable Global Property List</u></h3>"
  1422.                         + propslist + "<br/>"
  1423.                         + "<br/>"
  1424.                         + "<b>Total Number of Unenumerable Global Properties:</b> " + propstotal + "<br/>"  
  1425.                         + "<br/>"
  1426.                         + typecommands + "<br/>"
  1427.                         + "<br/>"
  1428.                         + "<b>\u2022  <font color='gray'>/tempexec</font><font color='red'> status</font></b>: if <b>status</b> is <i>on</i>, shows script evaluations/executions in the main chat in all channels for the duration the server is open for; if <b>status</b> is <i>off</i>, the evaluations/executions aren't shown.<br/>"
  1429.                         + "<b>\u2022  <font color='gray'>/exec</font><font color='red'> status</font></b>: if <b>status</b> is <i>on</i>, shows script evaluations/executions in the main chat in all channels; if <b>status</b> is <i>off</i>, the evaluations/executions aren't shown.<br/>"
  1430.                         + "<b>\u2022  <font color='green'>/eval</font><font color='red'> string</font></b>: evaluates/executes <b>string</b>. <b>string</b> is a JavaScript expression, variable, statement or sequence of statements.<br/>"
  1431.                         + "<b>\u2022  <font color='gray'>/evallater</font><font color='red'> string</font><font color='blue'>*number</font><font color='blue violet'>*unit</font></b>: evaluates/executes <b>string</b> in <b> time unit</b>. <b>string</b> is a JavaScript expression, variable, statement or sequence of statements. <b>number</b> is any non-negative value.<b> unit</b> is either seconds, minutes, hours or days.<br/>"
  1432.                         + "<b>\u2022  <font color='gray'>/webcall</font><font color='red'> web_URL</font><font color='blue'>*string</font></b>: calls <b>web_URL</b> and evaluates/executes <b>string</b> when the reply is received. The reply is stored in the resp global variable. <b>string</b> is a JavaScript expression, variable, statement or sequence of statements.<br/>"
  1433.                         + "<b>\u2022  <font color='green'>/print</font><font color='red'> data</font></b>: prints <b>data</b> on the server window. <b>data</b> is a global variable, object, string, number or boolean.<br/>"
  1434.                         + "<b>\u2022  <font color='green'>/clear</font></b>: clears the server window.<br/>"
  1435.                         + "<b>\u2022  <font color='green'>/system</font><font color='red'> command</font></b>: runs <b>command</b> on the underlying operating system.<br/>"
  1436.                         + "<br/>"
  1437.                         + "<timestamp/><br/>"
  1438.                         + border;
  1439.                         sys.sendHtmlMessage(src, executiveoptionsdisplay, channel);            
  1440.                 }
  1441.  
  1442.                 ,
  1443.  
  1444.                 varoptions: function (src, channel, command){
  1445.                         var globallist = "<b><small>", globaltotal = Object.keys(global).length, globalindex, colortype = ({"object": "red", "function" : "blue", "number": "blueviolet", "string" : "green", "boolean" : "indigo"}), datatypetotal = new Object();
  1446.                         for (globalindex in global){
  1447.                                 if (datatypetotal[typeof global[globalindex]] === undefined){
  1448.                                         datatypetotal[typeof global[globalindex]] = 0;
  1449.                                 }
  1450.                                 datatypetotal[typeof global[globalindex]] += 1;
  1451.                                 globallist += "<font color='" + colortype[typeof global[globalindex]] + "'>" + globalindex + "</font>" + ", ";
  1452.                         }
  1453.                         globallist = globallist.substring(0, globallist.length-2) + ".</small></b>";
  1454.                         var dataoptionsdisplay = border
  1455.                         + "<h2>Variable Options</h2>"
  1456.                         + "<h3><u>Global Variables List</u></h3>"
  1457.                         + globallist + "<br/>"
  1458.                         + "<br/>"
  1459.                         + "<b><font color='red'>Total Number of Object Variables:</font></b> " + datatypetotal.object + "<br/>"
  1460.                         + "<b><font color='blue'>Total Number of Function Variables:</font></b> " + datatypetotal["function"] + "<br/>"
  1461.                         + "<b><font color='blueviolet'>Total Number of Number Variables:</font></b> " + datatypetotal.number + "<br/>"
  1462.                         + "<b><font color='green'>Total Number of String Variables:</font></b> " + datatypetotal.string + "<br/>"
  1463.                         + "<b><font color='indigo'>Total Number of Boolean Variables:</font></b> " + datatypetotal["boolean"] + "<br/>"
  1464.                         + "<b>Total Number of Global Variables:</b> " + globaltotal + "<br/>"
  1465.                         + "<br/>"
  1466.                         + "<b><font color='darkviolet'>\u2022 The showing of variable changes is currently turned " + variablechanges + "</font></b>"
  1467.                         + "<h3>Variable Option Commands</h3>"
  1468.                         + "<br/>"
  1469.                         + typecommands + "<br/>"
  1470.                         + "<br/>"
  1471.                         + "<b>\u2022  <font color='green'>/tempvarchanges</font><font color='red'> status</font></b>: if <b>status</b> is <i>on</i>, shows changes to variables and player arrays in the main chat in all channels for the duration the server is open for; if <b>status</b> is <i>off</i>, the changes aren't shown.<br/>"
  1472.                         + "<b>\u2022  <font color='green'>/varchanges</font><font color='red'> status</font></b>: if <b>status</b> is <i>on</i>, shows changes to variables and player arrays in the main chat in all channels; if <b>status</b> is <i>off</i>, the changes aren't shown.<br/>"
  1473.                         + "<b>\u2022  <font color='green'>/get</font><font color='red'> variable</font></b>: displays the data within <b>variable</b>.<br/>"
  1474.                         + "<b>\u2022  <font color='green'>/getkeys</font><font color='red'> object_variable</font></b>: displays all the keys within an object stored by <b>object_variable</b>.<br/>"
  1475.                         + "<b>\u2022  <font color='green'>/getvalues</font><font color='red'> object_variable</font></b>: displays all the values within an object stored by <b>object_variable</b>.<br/>"
  1476.                         + "<b>\u2022  <font color='green'>/getmembers</font><font color='red'> object_variable</font></b>: displays all the members within an object stored by <b>object_variable</b>.<br/>"
  1477.                         + "<b>\u2022  <font color='green'>/getlength</font><font color='red'> variable</font></b>: displays the number of characters for a string, number of keys for an object and number of parameters for a function.<br/>"
  1478.                         + "<b>\u2022  <font color='green'>/set</font><font color='red'> variable</font><font color='blue'>*data</font></b>: creates a variable called <b>variable</b> storing <b>data</b>.<br/>"
  1479.                         + "<b>\u2022  <font color='green'>/save</font><font color='red'> variable</font><font color='blue'>*data</font></b>: creates/overwrites a variable called <b>variable</b> storing <b>data</b>.<br/>"
  1480.                         + "<b>\u2022  <font color='green'>/delete</font><font color='red'> variable</font></b>: deletes <b>variable</b>.<br/>"
  1481.                         + "<br/>"
  1482.                         + "<timestamp/><br/>"
  1483.                         + border;
  1484.                         sys.sendHtmlMessage(src, dataoptionsdisplay, channel);                 
  1485.                 }
  1486.  
  1487.                 ,
  1488.  
  1489.                 regvaloptions: function (src, channel, command){
  1490.                         var dataoptionsdisplay = border
  1491.                         + "<h2>Registry Options</h2>"
  1492.                         + "<h3><u>Registry Values in default file</u></h3>"
  1493.                         + "<b><small>" + String(sys.getValKeys()).replace(/,/g,", ") + "</small></b>.<br/>"
  1494.                         + "<h3>Registry Value Commands</h3>"
  1495.                         + "<br/>"
  1496.                         + typecommands + "<br/>"
  1497.                         + "<br/>"
  1498.                         + "<b>\u2022  <font color='gray'>/regfile</font><font color='red'> filename</font></b>: changes the registry file to <b>filename</b>.<br/>"
  1499.                         + "<b>\u2022  <font color='gray'>/getval</font><font color='red'> regkey</font></b>: displays the data within <i>Script_<b>regkey</b></i> in registry file.<br/>"
  1500.                         + "<b>\u2022  <font color='gray'>/getvals</font></b>: displays all the registry value data within in registry file.<br/>"
  1501.                         + "<b>\u2022  <font color='gray'>/getvalmembers</font></b>: displays all the registry value names and data within in registry file.<br/>"
  1502.                         + "<b>\u2022  <font color='gray'>/setval</font><font color='red'> regkey</font><font color='blue'>*data</font></b>: creates <i>Script_<b>regkey</b></i> storing <b>data</b> in registry file.<br/>"
  1503.                         + "<b>\u2022  <font color='gray'>/saveval</font><font color='red'> regkey</font><font color='blue'>*data</font></b>: creates/overwrites <i>Script_<b>regkey</b></i> storing <b>data</b> in registry file.<br/>"
  1504.                         + "<b>\u2022  <font color='gray'>/removeval</font><font color='red'> regkey</font></b>: deletes <i>Script_<b>regkey</b></i> in registry file.<br/>"
  1505.                         + "<b>\u2022  <font color='gray'>/clearvals</font><font color='red'> regkey</font></b>: deletes all registry values in registry file.<br/>"
  1506.                         + "<br/>"
  1507.                         + "<timestamp/><br/>"
  1508.                         + border;
  1509.                         sys.sendHtmlMessage(src, dataoptionsdisplay, channel);                 
  1510.                 }
  1511.  
  1512.                 ,
  1513.  
  1514.                 fileoptions: function (src, channel, command){
  1515.                         var dataoptionsdisplay = border
  1516.                         + "<h2>File Options</h2>"
  1517.                         + "<br/>"
  1518.                         + "<h3>File Option Commands</h3>"
  1519.                         + "<br/>"
  1520.                         + typecommands + "<br/>"
  1521.                         + "<br/>"
  1522.                         + "<b>\u2022  <font color='gray'>/getfilecontent</font><font color='red'> file</font></b>: displays the content of <b>file</b>.<br/>"
  1523.                         + "<b>\u2022  <font color='gray'>/printfilecontent</font><font color='red'> file</font></b>: prints the content of <b>file</b>.<br/>"
  1524.                         + "<b>\u2022  <font color='gray'>/appendtofile</font><font color='red'> file</font><font color='blue'>*content</font></b>: appends <b>content</b> to <b>file</b>.<br/>"
  1525.                         + "<b>\u2022  <font color='gray'>/createfile</font><font color='red'> file</font><font color='blue'>*content</font></b>: creates <b>file</b> storing <b>content</b>.<br/>"
  1526.                         + "<b>\u2022  <font color='gray'>/writetofile</font><font color='red'> file</font><font color='blue'>*content</font></b>: creates/overwrites <b>file</b> storing <b>content</b>.<br/>"
  1527.                         + "<b>\u2022  <font color='gray'>/deletefile</font><font color='red'> file</font></b>: deletes <b>file</b>.<br/>"
  1528.                         + "<br/>"
  1529.                         + "<timestamp/><br/>"
  1530.                         + border;
  1531.                         sys.sendHtmlMessage(src, dataoptionsdisplay, channel);                 
  1532.                 }
  1533.  
  1534.                 ,
  1535.  
  1536.                 authoptions: function (src, channel, command){
  1537.                         helpers.setautharray("mods", 1);
  1538.                 helpers.setautharray("admins", 2);
  1539.                         helpers.setautharray("owners", 3);
  1540.                         var touradmins = new Array(), tourauthindex;
  1541.                         for (tourauthindex in tourauth){
  1542.                                 if (members[tourauth[tourauthindex]] !== undefined){
  1543.                                         touradmins.push(members[tourauth[tourauthindex]]);
  1544.                                 }
  1545.                                 else {
  1546.                                         touradmins.push(tourauth[tourauthindex]);
  1547.                                 }
  1548.                         }
  1549.                         var authoptionsdisplay = border
  1550.                         + "<h2>Authority Options</h2>"
  1551.                         + "<br/>"
  1552.                         + "<b><font color ='blueviolet'>\u2022  Server Auth level 3 is currently known as " + helpers.escapehtml(AuthLevel3Name).italics() + ".</font><br/>"
  1553.                         + "<font color ='#FF6900'>\u2022  Server Auth level 2 is currently known as " + helpers.escapehtml(AuthLevel2Name).italics() + ".</font><br/>"
  1554.                         + "<font color='blue'>\u2022  Server Auth level 1 is currently known as " + helpers.escapehtml(AuthLevel1Name).italics() + ".</font><br/>"
  1555.                         + "<font color='red'>\u2022  Server Auth level 0 is currently known as " + helpers.escapehtml(AuthLevel0Name).italics() + ".</font><br/>"
  1556.                         + "<font color='green'>\u2022  Server Tournament Auth level 1 is currently known as " + helpers.escapehtml(TourAuthLevel1Name).italics() + ".</font><br/>"
  1557.                         + "<font color='maroon'> \u2022  Server Tournament Auth level 0 is currently known as " + helpers.escapehtml(TourAuthLevel0Name).italics() + ".</font><br/>"
  1558.                         + "<font color='indigo'>\u2022  Channel Auth level 3 is currently known as " + helpers.escapehtml(ChannelAuthLevel3Name).italics() + ".</font><br/>"
  1559.                         + "<font color='coral'>\u2022  Channel Auth level 2 is currently known as " + helpers.escapehtml(ChannelAuthLevel2Name).italics() + ".</font><br/>"
  1560.                         + "<font color='royalblue'>\u2022  Channel Auth level 1 is currently known as " + helpers.escapehtml(ChannelAuthLevel1Name).italics() + ".</font><br/>"
  1561.                         + "<font color='crimson'>\u2022  Channel Auth level 0 is currently known as " + helpers.escapehtml(ChannelAuthLevel0Name).italics() + ".</font><br/>"
  1562.                         + "<font color='mediumseagreen'>\u2022  Channel Tournament Auth level 1 is currently known as " + helpers.escapehtml(ChannelTourAuthLevel1Name).italics() + ".</font><br/>"
  1563.                         + "<font color='brown'> \u2022  Channel Tournament Auth level 0 is currently known as " + helpers.escapehtml(ChannelTourAuthLevel0Name).italics() + ".</font></b><br/>"
  1564.                         + "<br/>"
  1565.                         + "<b><font color='blueviolet'>" + AuthLevel3Name + "s</font>: <small>" + String(owners) + "</small></b><br/>"
  1566.                         + "<b><font color='#FF6900'>" + AuthLevel2Name + "s</font>: <small>" + String(admins) + "</small></b><br/>"
  1567.                         + "<b><font color='blue'>" + AuthLevel1Name + "s</font>: <small>" + String(mods) + "</small></b><br/>"
  1568.                         + "<b><font color='green'>" + TourAuthLevel1Name + "s</font>: <small>" + String(touradmins) + "</small></b>"
  1569.                         + "<h3>Authority Option Commands</h3>"
  1570.                         + "<br/>"
  1571.                         + typecommands + "<br/>"
  1572.                         + "<br/>"
  1573.                         + "<b>\u2022  <font color='green'>/authlevelname</font><font color='red'> old name</font><font color='blue'>*new name</font></b>: changes <b>old name</b> to <b>new name</b>. <b>old name</b> is the name of an auth level and <b>new name</b> is any non-plural text.<br/>"
  1574.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(AuthLevel3Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(AuthLevel3Name) + "</b>.<br/>"
  1575.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(AuthLevel2Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(AuthLevel2Name) + "</b>.<br/>"
  1576.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(AuthLevel1Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(AuthLevel1Name) + "</b>.<br/>"
  1577.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(AuthLevel0Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(AuthLevel0Name) + "</b>.<br/>"
  1578.                         + "<b>\u2022  <font color='green'>/clearauths</font></b>: clears the server auth list.<br/>"
  1579.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(TourAuthLevel1Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(TourAuthLevel1Name) + "</b>.<br/>"
  1580.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(TourAuthLevel0Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(TourAuthLevel0Name) + "</b>.<br/>"
  1581.                         + "<b>\u2022  <font color='green'>/cleartourauths</font></b>: clears the server tournament auth list.<br/>"
  1582.                         + "<br/>"
  1583.                         + "<timestamp/><br/>"
  1584.                         + border;
  1585.                         sys.sendHtmlMessage(src, authoptionsdisplay , channel);
  1586.                 }
  1587.  
  1588.                 ,
  1589.  
  1590.                 floodoptions: function(src, channel, command){
  1591.                         if (floodtime == "off"){
  1592.                                 var floodcheck = "off";
  1593.                         }
  1594.                         else {
  1595.                                 var floodcheck = messageallowance + " messages per " + helpers.converttime(floodtime*1000);
  1596.                         }
  1597.                         var floodoptionsdisplay = border
  1598.                         + "<h2>Flood Options</h2>"
  1599.                         + "<br/>"
  1600.                         + "<b><font color='green'>\u2022  The Flood Check limit is currently set to " + floodcheck + ".</font></b><br/>"       
  1601.                         + "<h3>Flood Option Commands</h3>"
  1602.                         + "<br/>"
  1603.                         + typecommands + "<br/>"
  1604.                         + "<br/>"
  1605.                         + "<b>\u2022  <font color='gray'>/floodcheck</font><font color='red'> number</font><font color='blue'>*time</font><font color='blueviolet'>*unit</font></b>: sets <b>number</b> messages per <b>time</b> <b>unit</b> as allowed limit.<br/>"
  1606.                         + "<br/>"
  1607.                         + "<timestamp/><br/>"
  1608.                         + border;
  1609.                         sys.sendHtmlMessage(src, floodoptionsdisplay, channel);                                        
  1610.                 }
  1611.  
  1612.                 ,
  1613.  
  1614.                 arboptions: function(src, channel, command){
  1615.                         var arboptionsdisplay = border
  1616.                         + "<h2>Arbitration Options</h2>"
  1617.                         + "<br/>"
  1618.                         + "<h3>Arbitration Commands</h3>"
  1619.                         + "<br/>"
  1620.                         + typecommands + "<br/>"
  1621.                         + "<br/>"
  1622.                         + "<b>\u2022  <font color='green'>/rangeban</b></font><font color='red'><b> ip-range</b></font>: prevents anyone with <b>ip-range</b> from entering the server.<br/>"
  1623.                         + "\u2013 <b>ip range</b> is any valid 32 bit Internet Protocol Address range.<br/>"
  1624.                         + "<b>\u2022  <font color='green'>/rangeunban</b></font><font color='red'><b> ip-range</b></font>: re-allows anyone with <b>ip-range</b> to enter the server.<br/>"
  1625.                         + "\u2013 <b>ip range</b> is any valid 32 bit Internet Protocol Address range.<br/>"
  1626.                         + "<b>\u2022  <font color='green'>/rangebanlist</b></font>: displays the  server's range ban list.<br/>"
  1627.                         + "<b>\u2022  <font color='green'>/clearrangebanlist</b></font>: clears the  server's range ban list.<br/>"
  1628.                         + "<b>\u2022  <font color='green'>/silentkick</b></font><font color='red'><b> player</b></font>: silent kicks <b>player</b> from the server.<br/>"
  1629.                         + "<b> \u2013 player</b> is the name of any player on the server.<br/>"
  1630.                         + "<b>\u2022  <font color='green'>/megasilence</font></b>: silences all users below " + AuthLevel3Name + ".<br/>"
  1631.                         + "<b>\u2022  <font color='green'>/unsilence</font></b>: removes a mega silence.<br/>"                 
  1632.                         + "<br/>"
  1633.                         + "<timestamp/><br/>"
  1634.                         + border;
  1635.                         sys.sendHtmlMessage(src, arboptionsdisplay, channel);                  
  1636.                 }
  1637.  
  1638.                 ,
  1639.  
  1640.                 channeloptions: function(src, channel, command){
  1641.                         var channeloptionsdisplay = border
  1642.                         + "<h2>Channel Options</h2>"
  1643.                         + "<br/>"
  1644.                         + "<b><font color='indigo'>\u2022  The Registered Channels maximum limit is currently set to " + registeredchannelslimit + " channels.</font></b><br/>"
  1645.                         + "<h3>Channel Commands</h3>"
  1646.                         + "<br/>"
  1647.                         + typecommands + "<br/>"
  1648.                         + "<br/>"
  1649.                         + "<b>\u2022  <font color='green'>/clearregchannels</font></b>: clears all registered channels.<br/>"
  1650.                         + "<b>\u2022  <font color='green'>/regchannelslimit</font><font color='red'> number</font></b>: sets the maximum limit of registered channels to <b>number</b>.<br/>"
  1651.                         + "<br/>"
  1652.                         + "<timestamp/><br/>"
  1653.                         + border;
  1654.                         sys.sendHtmlMessage(src, channeloptionsdisplay, channel);                      
  1655.                 }
  1656.  
  1657.                 ,
  1658.  
  1659.                 banoptions: function(src, channel, command){
  1660.                         var banoptionsdisplay = border
  1661.                         + "<h2> Ban Options </h2>"
  1662.                         + "<br/>"
  1663.                         + typecommands + "<br/>"
  1664.                         + "<br/>"
  1665.                         + "<b>\u2022  <font color='green'>/ban</font><font color='red'> player</font></b>: bans <b>player</b> from the server.<br/>"
  1666.                         + "\u2013 <b>player</b> is any player with a lower maximum server auth level than yours.<br/>"
  1667.                         + "<b>\u2022  <font color='green'>/banbyip</font><font color='red'> ip-address</font></b>: bans last player to use <b>ip-address</b> from the server.<br/>"
  1668.                         + "\u2013 <b>ip-address</b> is any valid 32 bit Internet Protocol address.<br/>"
  1669.                         + "<b>\u2022  <font color='green'>/unban</font><font color='red'> player</font></b>: unbans <b>player</b> from the server.<br/>"
  1670.                         + "\u2013 <b>player</b> is any player on the ban list.<br/>"
  1671.                         + "<b>\u2022  <font color='green'>/unbanbyip</font><font color='red'> ip-address</font></b>: unbans last player to use <b>ip-address</b> from the server.<br/>"
  1672.                         + "\u2013 <b>ip-address</b> is any valid 32 bit Internet Protocol address.<br/>"
  1673.                         + "<b>\u2022  <font color='green'>/banlist</font></b>: displays the server ban list.<br/>"
  1674.                         + "<b>\u2022  <font color='green'>/clearbanlist</font></b>: clears the server ban list.<br/>"
  1675.                         + "<br/>"
  1676.                         + "<timestamp/><br/>"
  1677.                         + border;
  1678.                         sys.sendHtmlMessage(src, banoptionsdisplay, channel);          
  1679.                 }
  1680.  
  1681.                 ,
  1682.  
  1683.                 supersilenceoptions: function(src, channel, command){
  1684.                         var supersilenceoptionsdisplay = border
  1685.                         + "<h2> Super Silence Options </h2>"
  1686.                         + "<br/>"
  1687.                         + typecommands + "<br/>"
  1688.                         + "<br/>"
  1689.                         + "<b>\u2022  <font color='green'>/supersilence</font></b>: silences all users below " + AuthLevel2Name + ".<br/>"
  1690.                         + "<b>\u2022  <font color='green'>/unsilence</font></b>: removes a super silence.<br/>"        
  1691.                         + "<br/>"
  1692.                         + "<timestamp/><br/>"
  1693.                         + border;
  1694.                         sys.sendHtmlMessage(src, supersilenceoptionsdisplay, channel);         
  1695.                 }
  1696.  
  1697.                 ,
  1698.  
  1699.                 kickoptions: function(src, channel, command){
  1700.                         var kickoptionsdisplay = border
  1701.                         + "<h2> Kick Options </h2>"
  1702.                         + "<br/>"
  1703.                         + typecommands + "<br/>"
  1704.                         + "<br/>"
  1705.                         + "<b>\u2022  <font color='green'>/kick</font><font color='red'> player</font></b>: kicks <b>player</b> from the server.<br/>"
  1706.                         + "\u2013 <b>player</b> is any player with a lower server auth level than yours on the server.<br/>"
  1707.                         + "<b>\u2022  <font color='green'>/ipkick</font><font color='red'> ip-address</font></b>: kicks all aliases of <b>ip-address</b> from the server.<br/>"
  1708.                         + "\u2013 <b>ip-address</b> is any valid 32 bit Internet Protocol address.<br/>"
  1709.                         + "<br/>"
  1710.                         + "<timestamp/><br/>"
  1711.                         + border;
  1712.                         sys.sendHtmlMessage(src, kickoptionsdisplay, channel);         
  1713.                 }
  1714.  
  1715.                 ,
  1716.  
  1717.                 cpoptions: function(src, channel, command){
  1718.                         var cpoptionsdisplay = border
  1719.                         + "<h2> CP Options </h2>"
  1720.                         + "<br/>"
  1721.                         + typecommands + "<br/>"
  1722.                         + "<br/>"
  1723.                         + "<b>\u2022  <font color='green'>/cp</font><font color='red'> player</font></b>: displays a scripted control panel for <b>player</b>.<br/>"
  1724.                         + "\u2013 <b>player</b> is any player in the member database.<br/>"
  1725.                         + "<b>\u2022  <font color='green'>/getaliases</font><font color='red'> ip-address</font></b>: displays aliases for <b>ip-address</b> if recorded.<br/>"
  1726.                         + "\u2013 <b>ip-address</b> is any valid 32 bit Internet Protocol address.<br/>"
  1727.                         + "<b>\u2022  <font color='green'>/getips</font><font color='red'> alias</font></b>: displays IP addresses for <b>alias</b> if recorded.<br/>"
  1728.                         + "\u2013 <b>alias</b> is any player in the member database.<br/>"
  1729.                         + "<br/>"
  1730.                         + "<timestamp/><br/>"
  1731.                         + border;
  1732.                         sys.sendHtmlMessage(src, cpoptionsdisplay, channel);           
  1733.                 }
  1734.  
  1735.                 ,
  1736.  
  1737.                 muteoptions: function(src, channel, command){
  1738.                         var muteoptionsdisplay = border
  1739.                         + "<h2> Mute Options </h2>"
  1740.                         + "<br/>"
  1741.                         + typecommands + "<br/>"
  1742.                         + "<br/>"
  1743.                         + "<b>\u2022  <font color='green'>/mute</font><font color='red'> player</font></b>: mutes <b>player</b> on the server.<br/>"
  1744.                         + "\u2013 <b>player</b> is any player with a lower server auth level than yours in the members database.<br/>"
  1745.                         + "<b>\u2022  <font color='green'>/unmute</font><font color='red'> player</font></b>: unmutes <b>player</b> on the server.<br/>"
  1746.                         + "\u2013 <b>player</b> is any player on the server mutelist other than yourself.<br/>"
  1747.                         + "<b>\u2022  <font color='green'>/mutelist</font></b>: displays the server mutelist.<br/>"    
  1748.                         + "<b>\u2022  <font color='green'>/clearmutelist</font></b>: clears the server mutelist.<br/>"
  1749.                         + "<br/>"
  1750.                         + "<timestamp/><br/>"
  1751.                         + border;
  1752.                         sys.sendHtmlMessage(src, muteoptionsdisplay, channel);         
  1753.                 }
  1754.  
  1755.                 ,
  1756.  
  1757.                 silenceoptions: function(src, channel, command){
  1758.                         var silenceoptionsdisplay = border
  1759.                         + "<h2> Silence Options </h2>"
  1760.                         + "<br/>"
  1761.                         + typecommands + "<br/>"
  1762.                         + "<br/>"
  1763.                         + "<b>\u2022  <font color='green'>/silence</font></b>: silences all users below " + AuthLevel1Name + ".<br/>"
  1764.                         + "<b>\u2022  <font color='green'>/unsilence</font></b>: removes a silence.<br/>"      
  1765.                         + "<br/>"
  1766.                         + "<timestamp/><br/>"
  1767.                         + border;
  1768.                         sys.sendHtmlMessage(src, silenceoptionsdisplay, channel);              
  1769.                 }
  1770.  
  1771.                 ,
  1772.  
  1773.                 globalmsgoptions: function(src, channel, command){
  1774.                         var globalmsgoptionsdisplay = border
  1775.                         + "<h2> Global Message Options </h2>"
  1776.                         + "<br/>"
  1777.                         + typecommands + "<br/>"
  1778.                         + "<br/>"
  1779.                         + "<b>\u2022  <font color='green'>/wall</font><font color='red'> message</font></b>: sends a message with a border into the chat for all channels.<br/>"
  1780.                         + "\u2013 <b>message</b> is any text.<br/>"
  1781.                         + "<b>\u2022  <font color='green'>/htmlwall</font><font color='red'> message</font></b>: sends an html message with a border into the chat for all channels.<br/>"
  1782.                         + "\u2013 <b>message</b> is any text.<br/>"
  1783.                         + "<br/>"
  1784.                         + "<timestamp/><br/>"
  1785.                         + border;
  1786.                         sys.sendHtmlMessage(src, globalmsgoptionsdisplay, channel);            
  1787.                 }
  1788.  
  1789.                 ,
  1790.  
  1791.                 superimpoptions: function(src, channel, command){
  1792.                         var superimpoptionsdisplay = border
  1793.                         + "<h2> Super Impersonation Options </h2>"
  1794.                         + "<br/>"
  1795.                         + typecommands + "<br/>"
  1796.                         + "<br/>"
  1797.                         + "<b>\u2022  <font color='green'>/superimp</font><font color='red'> name</font></b>: changes your displayed username on the server to ~~<b>name</b>~~.<br/>"
  1798.                         + " \u2013 <b>name</b> is any text with at most 20 characters.<br/>"
  1799.                         + "<b>\u2022  <font color='green'>/superimpoff</font></b>: restores your original name you had before you superimped.<br/>"
  1800.                         + "<br/>"
  1801.                         + "<timestamp/><br/>"
  1802.                         + border;
  1803.                         sys.sendHtmlMessage(src, superimpoptionsdisplay, channel);             
  1804.                 }
  1805.  
  1806.                 ,
  1807.  
  1808.                 interactoptions: function(src, channel, command){
  1809.                         var interactoptionsdisplay = border
  1810.                         + "<h2> Interact Options </h2>"
  1811.                         + "<br/>"
  1812.                         + typecommands + "<br/>"
  1813.                         + "<br/>"
  1814.                         + "<b>\u2022  <font color='green'>/idle</font></b>: sets your status to idle on the server.<br/>"
  1815.                         + "<b>\u2022  <font color='green'>/goback</font></b>: sets your status to active on the server.<br/>"
  1816.                         + "<b>\u2022  <font color='green'>/changetier</font><font color='red'> tier</font></b>: changes your tier to <b>tier</b>.<br/>"
  1817.                         + "<b>\u2022  <font color='green'>/changeavatar</font><font color='red'> number</font></b>: changes your avatar to avatar <b>number</b>. <b>number</b> is greater than or equal to 1 and less than or equal to 263. If <b>number</b> is out of this range, the avatar is blank.<br/>"
  1818.                         + "<b>\u2022  <font color='green'>/changeinfo</font><font color='red'> html</font></b>: changes your trainer information to <b>html</b>.<br/>"
  1819.                         + "<b>\u2022  <font color='green'>/unregister</font></b>: clears the password associated with your name.<br/>"
  1820.                         + "<b>\u2022  <font color='green'>/disconnect</font></b>: disconnects you from the server.<br/>"
  1821.                         + "<br/>"
  1822.                         + "<timestamp/><br/>"
  1823.                         + border;
  1824.                         sys.sendHtmlMessage(src, interactoptionsdisplay, channel);             
  1825.                 }
  1826.  
  1827.                 ,
  1828.  
  1829.                 infooptions: function(src, channel, command){
  1830.                         var infooptionsdisplay = border
  1831.                         + "<h2> Information Options </h2>"
  1832.                         + "<br/>"
  1833.                         + typecommands + "<br/>"
  1834.                         + "<br/>"
  1835.                         + "<b>\u2022  <font color='green'>/mp</font></b>: displays a scripted control panel with you as the target. (My Panel)<br/>"
  1836.                         + "<b>\u2022  <font color='green'>/myaliases</font></b>: displays aliases for your current IP Address if recorded.<br/>"
  1837.                         + "<b>\u2022  <font color='green'>/myips</font></b>: displays IP addresses for your current alias if recorded.<br/>"
  1838.                         + "<b>\u2022  <font color='green'>/team</font></b>: displays your exported team.<br/>"
  1839.                         + "<b>\u2022  <font color='green'>/rankings</font></b> or <b><font color='green'>/rankings</font><font color='red'> player</font></b>: displays  your rank or <b>player</b>'s rank for each tier. <b>player</b> is any player in the members database.<br/>"
  1840.                         + "<b>\u2022  <font color='green'>/playersonline</font></b>: displays the players online list.<br/>"
  1841.                         + "<b>\u2022  <font color='green'>/battlesonline</font></b>: displays the battles online list.<br/>"
  1842.                         + "<b>\u2022  <font color='green'>/channelsonline</font></b>: displays the channels online list.<br/>"
  1843.                         + "<b>\u2022  <font color='green'>/auths</font></b>: displays the auth list of the server.<br/>"
  1844.                         + "<b>\u2022  <font color='green'>/memorystate</font></b>: displays the server's memory state.<br/>"
  1845.                         + "<b>\u2022  <font color='green'>/serverinfo</font></b>: displays server information.<br/>"
  1846.                         + "<b>\u2022  <font color='green'>/playerinfo</font></b> or <b><font color='green'>/playerinfo</font><font color='red'> player</font></b>: displays  your or <b>player</b>'s player information. <b>player</b> is any player in the members database.<br/>"
  1847.                         + "<b>\u2022  <font color='green'>/sprite</font><font color='red'> Pokémon</font></b> or <b><font color='green'>/sprite</font><font color='red'> Pokémon</font><font color='blue'>*number</font></b>: displays the generation 5 sprite of <b>Pokémon</b> or generation <b>number</b> sprite of <b>Pokémon</b>. <b>Pokémon</b> is a valid Pokémon name and <b>number</b> is a value from 1 to 5.<br/>"
  1848.                         + "<b>\u2022  <font color='green'>/scriptinfo</font></b>: displays script information.<br/>"
  1849.                         + "<b>\u2022  <font color='green'>/latest</font></b>: displays information on latest implemented features and script changes.<br/>"
  1850.                         + "<b>\u2022  <font color='green'>/regchannelslist</font></b>: displays the registered channels list.<br/>"
  1851.                         + "<br/>"
  1852.                         + "<timestamp/><br/>"
  1853.                         + border;
  1854.                         sys.sendHtmlMessage(src, infooptionsdisplay, channel);         
  1855.                 }
  1856.  
  1857.                 ,
  1858.  
  1859.                 cchatoptions: function(src, channel, command){
  1860.                         var cchatoptionsdisplay = border
  1861.                         + "<h2> Channel Chat Options </h2>"
  1862.                         + "<br/>"
  1863.                         + "<font color='indigo'><b>\u2022  The Channel topic is currently " + helpers.escapehtml(channelsonline[channel].topic).italics() + "</b></font><br/>"
  1864.                         + "<font color='red'><b>\u2022  Combining Characters are currently  turned " + channelsonline[channel].combinecharacters + ".</b></font><br/>"
  1865.                         + "<font color='blue'><b>\u2022  Reversing Characters are currently  turned " + channelsonline[channel].reversecharacters + ".</b></font><br/>"
  1866.                         + "<br/>"
  1867.                         + typecommands + "<br/>"
  1868.                         + "<br/>"
  1869.                         + "<b>\u2022  <font color='green'>/temptopic</font><font color='red'> topic</font></b>: changes the channel topic to <b>topic</b> for the duration that the channel is open for. <b>topic</b> is any text. if <b>topic</b> is <i>off</i>, turns the channel topic feature off. If <b>topic</b> is <i>default</i>, changes the channel topic to <i>Welcome to " + sys.channel(channel) + "!</i><br/>"
  1870.                         + "<b>\u2022  <font color='green'>/topic</font><font color='red'> topic</font></b>: changes the channel topic of a registered channel to <b>topic</b>. <b>topic</b> is any text. If <b>topic</b> is <i>off</i>, turns the channel topic feature off. If <b>topic</b> is <i>default</i>, changes the channel topic to <i>Welcome to " + sys.channel(channel) + "!</i><br/>"
  1871.                         + "<b>\u2022  <font color='green'>/combinechar</font><font color='red'> status</font></b>: if <b>status</b> is <i>on</i>, messages can be sent with combine characters in them (can form zalgo); if <b>status</b> is <i>off</i>, they can't be sent.<br/>"
  1872.                         + "<b>\u2022  <font color='green'>/reversechar</font><font color='red'> status</font></b>: if <b>status</b> is <i>on</i>, messages can be sent with reverse characters in them; if <b>status</b> is <i>off</i>, they can't be sent.<br/>"
  1873.                         + "<br/>"
  1874.                         + "<timestamp/><br/>"
  1875.                         + border;
  1876.                         sys.sendHtmlMessage(src, cchatoptionsdisplay, channel);        
  1877.                 }
  1878.  
  1879.                 ,
  1880.  
  1881.                 cauthoptions: function(src, channel, command){
  1882.                         var cauth3 = channelsonline[channel].owners, cauth2 = channelsonline[channel].admins, cauth1 = channelsonline[channel].mods, ctourauth = channelsonline[channel].touradmins, authindex, cowners = new Array(), cadmins = new Array(), cmods = new Array(), ctouradmins = new Array();
  1883.                         for (authindex in cauth3){
  1884.                                 if (members[cauth3[authindex]] !== undefined){
  1885.                                         cowners.push(members[cauth3[authindex]]);
  1886.                                 }
  1887.                                 else {
  1888.                                         cowners.push(cauth3[authindex]);
  1889.                                 }
  1890.                         }
  1891.                         for (authindex in cauth2){
  1892.                                 if (members[cauth2[authindex]] !== undefined){
  1893.                                         cadmins.push(members[cauth2[authindex]]);
  1894.                                 }
  1895.                                 else {
  1896.                                         cadmins.push(cauth2[authindex]);
  1897.                                 }
  1898.                         }
  1899.                         for (authindex in cauth1){
  1900.                                 if (members[cauth1[authindex]] !== undefined){
  1901.                                         cmods.push(members[cauth1[authindex]]);
  1902.                                 }
  1903.                                 else {
  1904.                                         cmods.push(cauth1[authindex]);
  1905.                                 }
  1906.                         }
  1907.                         for (authindex in ctourauth){
  1908.                                 if (members[ctourauth[authindex]] !== undefined){
  1909.                                         ctouradmins.push(members[ctourauth[authindex]]);
  1910.                                 }
  1911.                                 else {
  1912.                                         ctouradmins.push(ctourauth[authindex]);
  1913.                                 }
  1914.                         }
  1915.                         var cauthoptionsdisplay = border
  1916.                         + "<h2>Channel Authority Options</h2>"
  1917.                         + "<br/>"
  1918.                         + "<b><font color='indigo'>" + ChannelAuthLevel3Name + "s</font>: <small>" + String(cowners) + "</small></b><br/>"
  1919.                         + "<b><font color='coral'>" + ChannelAuthLevel2Name + "s</font>: <small>" + String(cadmins) + "</small></b><br/>"
  1920.                         + "<b><font color='royalblue'>" + ChannelAuthLevel1Name + "s</font>: <small>" + String(cmods) + "</small></b><br/>"
  1921.                         + "<b><font color='mediumseagreen'>" + ChannelTourAuthLevel1Name + "s</font>: <small>" + String(ctouradmins) + "</small></b>"
  1922.                         + "<h3>Channel Authority Option Commands</h3>"
  1923.                         + typecommands + "<br/>"
  1924.                         + "<br/>"
  1925.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelAuthLevel3Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(ChannelAuthLevel3Name) + "</b> for this channel.<br/>"
  1926.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelAuthLevel2Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(ChannelAuthLevel2Name) + "</b> for this channel.<br/>"
  1927.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelAuthLevel1Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(ChannelAuthLevel1Name) + "</b> for this channel.<br/>"
  1928.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelAuthLevel0Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> to <b>" + helpers.escapehtml(ChannelAuthLevel0Name) + "</b> for this channel.<br/>"
  1929.                         + "<b>\u2022  <font color='green'>/clearcauths</font></b>: clears the channel auth for this channel.<br/>"
  1930.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelTourAuthLevel1Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> existing in member database to <b>" + helpers.escapehtml(ChannelTourAuthLevel1Name) + "</b> for this channel.<br/>"
  1931.                         + "<b>\u2022  <font color='green'>/" + helpers.escapehtml(helpers.removespaces(ChannelTourAuthLevel0Name)).toLowerCase() + "</font><font color='red'> player</font></b>: to change the Auth Level of <b>player</b> to <b>" + helpers.escapehtml(ChannelTourAuthLevel0Name) + "</b> for this channel.<br/>"
  1932.                         + "<b>\u2022  <font color='green'>/clearctourauths</font></b>: clears the tournament auth for this channel.<br/>"
  1933.                         + "<br/>"
  1934.                         + "<timestamp/><br/>"
  1935.                         + border;
  1936.                         sys.sendHtmlMessage(src, cauthoptionsdisplay , channel);
  1937.                 }
  1938.  
  1939.                 ,
  1940.  
  1941.                 crunoptions: function(src, channel, command){
  1942.                         var channelname = sys.channel(channel);
  1943.                         var stay = channelsonline[channel].stay == "on" ? "on" : "off";
  1944.                         var registered = channelsregistered[channelname.toLowerCase()] != undefined ? "registered" : "unregistered";
  1945.                         if (channel == 0){
  1946.                                 stay = "on";
  1947.                                 registered = "registered";
  1948.                         }                      
  1949.                         var crunoptionsdisplay = border
  1950.                         + "<h2> Channel Run Options </h2>"
  1951.                         + "<br/>"
  1952.                         + "<b><font color='red'>\u2022  " + channelname + " is currently " + registered + ".</font></b><br/>"  
  1953.                         + "<b><font color='green'>\u2022  Stay is currently turned " + stay + " for " + channelname + ".</font></b><br/>"      
  1954.                         + "<br/>"
  1955.                         + typecommands + "<br/>"
  1956.                         + "<br/>"
  1957.                         + "<b>\u2022  <font color='green'>/registerthis</font></b>: registers the channel you use this command on.<br/>"
  1958.                         + "<b>\u2022  <font color='green'>/unregisterthis</font></b>: unregisters the channel you use this command on.<br/>"
  1959.                         + "<b>\u2022  <font color='green'>/restartthis</font></b>: restarts the channel you use this command on.<br/>"
  1960.                         + "<b>\u2022  <font color='green'>/tempstay</font><font color='red'> status</font></b>: changes the stay to <b>status</b> for the duration that the channel is open for. <b>status</b> is either <i>on</i> or <i>off</i>.<br/>"
  1961.                         + "<b>\u2022  <font color='green'>/stay</font><font color='red'> status</font></b>: changes the stay to <b>status</b>. <b>status</b> is either <i>on</i> or <i>off</i>.<br/>"
  1962.                         + "<br/>"
  1963.                         + "<timestamp/><br/>"
  1964.                         + border;
  1965.                         sys.sendHtmlMessage(src, crunoptionsdisplay, channel);         
  1966.                 }
  1967.  
  1968.                 ,
  1969.  
  1970.                 ckickoptions: function(src, channel, command){
  1971.                         var cmsgoptionsdisplay = border
  1972.                         + "<h2> Channel Message Options </h2>"
  1973.                         + "<br/>"
  1974.                         + typecommands + "<br/>"
  1975.                         + "<br/>"
  1976.                         + "<b>\u2022 <font color='green'>/ckick</font><font color='red'> player</font></b>: kicks <b>player</b> from the channel.<br/>"
  1977.                         + "<br/>"
  1978.                         + "<timestamp/><br/>"
  1979.                         + border;
  1980.                         sys.sendHtmlMessage(src, cmsgoptionsdisplay, channel);         
  1981.                 }
  1982.  
  1983.                 ,
  1984.  
  1985.                 cmsgoptions: function(src, channel, command){
  1986.                         var cmsgoptionsdisplay = border
  1987.                         + "<h2> Channel Message Options </h2>"
  1988.                         + "<br/>"
  1989.                         + typecommands + "<br/>"
  1990.                         + "<br/>"
  1991.                         + "<b>\u2022  <font color='green'>/html</font><font color='red'> message</font></b>: sends an html message into the chat. <b>message</b> is any text.<br/>"
  1992.                         + "<b>\u2022  <font color='green'>/cwall</font><font color='red'> message</font></b>: sends a message with a border into the chat for this channel.<br/>"
  1993.                         + "\u2013 <b>message</b> is any text.<br/>"
  1994.                         + "<b>\u2022  <font color='green'>/chtmlwall</font><font color='red'> message</font></b>: sends an html message with a border into the chat for this channel.<br/>"
  1995.                         + "\u2013 <b>message</b> is any text.<br/>"
  1996.                         + "<br/>"
  1997.                         + "<timestamp/><br/>"
  1998.                         + border;
  1999.                         sys.sendHtmlMessage(src, cmsgoptionsdisplay, channel);         
  2000.                 }
  2001.  
  2002.                 ,
  2003.  
  2004.                 umsgoptions: function(src, channel, command){
  2005.                         var srcname = sys.name(src), color = helpers.namecolor(src);
  2006.                         var umsgoptionsdisplay = border
  2007.                         + "<h2> User Message Options </h2>"
  2008.                         + "<br/>"
  2009.                         + typecommands + "<br/>"
  2010.                         + "<br/>"
  2011.                         + "<b>\u2022  <font color='green'>/me</font><font color='red'> message</font></b>: sends <font color='" +  color + "'><b><i>*** " + srcname +  " message</i></b></font> into the main chat. <b>message</b> is any text.<br/>"
  2012.                         + "<b>\u2022  <font color='green'>/imp</font><font color='red'> name</font><font color='blue'>*message</font></b>: sends <b><font color='" +  color + "'>name:</font> message <small><i>impersonation by " + srcname + "</i></small></b> into the main chat. <b>name</b> is any text with at most 20 characters. <b>message</b> is any text.<br/>"
  2013.                         + "<b>\u2022  <font color='green'>/reverse</font><font color='red'> message</font></b>: sends <b>message</b> in reverse into the chat.<br/>"
  2014.                         + "<b>\u2022  <font color='green'>/future</font><font color='red'> time</font><font color='blue'>*unit</font><font color='blueviolet'>*message</font></b>: sends <b>message <small><i>(time unit ago)</i></small></b> as a chat message in <b>time</b> <b>unit</b>. <b>time</b> is any value. <b>unit</b> is either seconds, minutes, hours, days, weeks, months or years. <b>message</b> is any text.<br/>"
  2015.                         + "<br/>"
  2016.                         + "<timestamp/><br/>"
  2017.                         + border;
  2018.                         sys.sendHtmlMessage(src, umsgoptionsdisplay, channel);         
  2019.                 }
  2020.  
  2021.                 ,
  2022.  
  2023.                 corridoroptions: function(src, channel, command){
  2024.                         var ccorridoroptionsdisplay = border
  2025.                         + "<h2> Corridor Options </h2>"
  2026.                         + "<br/>"
  2027.                         + typecommands + "<br/>"
  2028.                         + "<br/>"
  2029.                         + "<b>\u2022  <font color='green'>/joinchannel</font><font color='red'> name</font></b>: joins the channel called <b>name</b>.<b>name</b> is any text with at most 20 characters.<br/>"
  2030.                         + "<b>\u2022  <font color='green'>/leavechannel</font></b>: exits you from the channel you use this command on.<br/>"
  2031.                         + "<br/>"
  2032.                         + "<timestamp/><br/>"
  2033.                         + border;
  2034.                         sys.sendHtmlMessage(src, ccorridoroptionsdisplay, channel);            
  2035.                 }
  2036.  
  2037.                 ,
  2038.  
  2039.                 cinfooptions: function(src, channel, command){
  2040.                         var cinfooptionsdisplay = border
  2041.                         + "<h2> Channel Information Options </h2>"
  2042.                         + "<br/>"
  2043.                         + typecommands + "<br/>"
  2044.                         + "<br/>"
  2045.                         + "<b>\u2022  <font color='green'>/cplayersonline</font></b>: displays the channel's players online list.<br/>"
  2046.                         + "<b>\u2022  <font color='green'>/cauths</font></b>: displays the auth list of this channel.<br/>"
  2047.                         + "<b>\u2022  <font color='green'>/channelinfo</font></b>: displays channel information.<br/>"
  2048.                         + "<br/>"
  2049.                         + "<timestamp/><br/>"
  2050.                         + border;
  2051.                         sys.sendHtmlMessage(src, cinfooptionsdisplay, channel);        
  2052.                 }
  2053.  
  2054.                 ,
  2055.  
  2056.                 touroptions: function(src, channel, command){
  2057.                         var touroptionsdisplay = border
  2058.                         + "<h2> Tournament Options </h2>"
  2059.                         + "<br/>"
  2060.                         + typecommands + "<br/>"
  2061.                         + "<br/>"
  2062.                         + "<b>\u2022  <font color='green'>/tour</font><font color='red'> tier</font><font color='blue'>*number</font></b>: starts <b>tier</b> tournament consisting of <b>number</b> players.<b> tier</b> is any of the server's tiers and <b>number</b> is any value greater than 2.<br/>"
  2063.                         + "<b>\u2022  <font color='green'>/toursize</font><font color='red'> number</font></b>: alters the tournament size to <b>number</b> during sign-ups.<b> number</b> is any value greater than 2.<br/>"
  2064.                         + "<b>\u2022  <font color='green'>/endtour</font></b>: ends the current tournament.<br/>"
  2065.                         + "<br/>"
  2066.                         + "<timestamp/><br/>"
  2067.                         + border;
  2068.                         sys.sendHtmlMessage(src, touroptionsdisplay, channel);         
  2069.                 }
  2070.  
  2071.                 ,
  2072.  
  2073.                 tourmatchoptions: function(src, channel, command){
  2074.                         var tourmatchoptionsdisplay = border
  2075.                         + "<h2> Tournament Match Options </h2>"
  2076.                         + "<br/>"
  2077.                         + typecommands + "<br/>"
  2078.                         + "<br/>"
  2079.                         + "<b>\u2022  <font color='green'>/nontourmatch</font><font color='red'> |number|</font> or <font color='green'>/nontourmatch</font><font color='red'> player</font></b>: declares match <b>number</b> or <b>player</b>'s match as a non-tournament match.<b> number</b> is any valid match number and <b>player</b> is any player in that match.<br/>"
  2080.                         + "<b>\u2022  <font color='green'>/tourmatch</font><font color='red'> |number|</font> or <font color='green'>/tourmatch</font><font color='red'> player</font></b>: declares match <b>number</b> or </b>player</b>'s match as a tournament match. <b>number</b> is any valid match number and </b>player</b> is any player in that match.<br/>"
  2081.                         + "<b>\u2022  <font color='green'>/resetmatch</font><font color='red'> |number|</font> or <font color='green'>/resetmatch</font><font color='red'> player</font></b>: clears the results of match <b>number</b> or <b>player</b>'s match. <b>number</b> is any valid match number and <b>player</b> is any player in that match.<br/>"
  2082.                         + "<br/>"
  2083.                         + "<timestamp/><br/>"
  2084.                         + border;
  2085.                         sys.sendHtmlMessage(src, tourmatchoptionsdisplay, channel);            
  2086.                 }
  2087.  
  2088.                 ,
  2089.  
  2090.                 tourplayeroptions: function(src, channel, command){
  2091.                         var tourplayeroptionsdisplay = border
  2092.                         + "<h2> Tournament Player Options </h2>"
  2093.                         + "<br/>"
  2094.                         + typecommands + "<br/>"
  2095.                         + "<br/>"
  2096.                         + "<b>\u2022  <font color='green'>/q</font><font color='red'> player</font></b>: declares <b>player</b> the winner of a match or adds <b>player</b>  to the tournament in the sign-up phase.  <b>player</b> is any player in a match or in the members database.<br/>"
  2097.                         + "<b>\u2022  <font color='green'>/switch</font><font color='red'> player1</font><font color='blue'>*player2</font></b>: switches tournament spots between: <b>player1</b> and <b>player2</b> - where at least one player must be in the tournament.<br/>"
  2098.                         + "<b>\u2022  <font color='green'>/dq</font><font color='red'> player</font></b>: declares <b>player</b> the loser of a match or removes <b>player</b> from the tournament. <b>player</b> is any player registered in the tournament.<br/>"
  2099.                         + "<br/>"
  2100.                         + "<timestamp/><br/>"
  2101.                         + border;
  2102.                         sys.sendHtmlMessage(src, tourplayeroptionsdisplay, channel);           
  2103.                 }
  2104.  
  2105.                 ,
  2106.  
  2107.  
  2108.                 tourbattleoptions: function (src, channel, command){
  2109.                         var readyfortour = channelsonline[channel].ReadyForTour == "on" ? "<font color='green'>on</font>" : "<font color='red'>off</font>";    
  2110.                         var forcetourbattle = channelsonline[channel].ForceTourBattles == "on" ? "<font color='green'>on</font>" : "<font color='red'>off</font>";
  2111.                         var autostartbattles = channelsonline[channel].AutoStartBattles == "on" ? "<font color='green'>on</font>" : "<font color='red'>off</font>";
  2112.                         var enforcetourclauses = channelsonline[channel].EnforceTourClauses == "on" ? "<font color='green'>on</font>" : "<font color='red'>off</font>";
  2113.                         var tourbattleoptionsdisplay = border
  2114.                         + "<h2>Tournament Battle Options</h2>"
  2115.                         + "<br/>"
  2116.                         + "\u2022  <b>Ready for Tournament Battles</b> is currently turned <b>" + readyfortour + "</b>.<br/>"
  2117.                         + "\u2022  <b>Forcing Tournament Battles</b> is currently turned <b>" + forcetourbattle + "</b>.<br/>"
  2118.                         + "\u2022  <b>Auto-starting Battles</b> is currently turned <b>" + autostartbattles + "</b>.<br/>"
  2119.                         + "\u2022  <b>Enforcing Tournament Clauses</b> is currently turned <b>" + enforcetourclauses + "</b>.<br/>"
  2120.                         + "<h3>Tournament Option Commands</h3>"
  2121.                         + "<br/>"
  2122.                         + typecommands + "<br/>"
  2123.                         + "<br/>"
  2124.                         + "<b>\u2022  <font color='green'>/readyfortour</font><font color='red'> status</font></b>: Turns ready for tournament battles on/off. Ready for tournament battles prevents players from playing battles between rounds, registering if they are in a battle and starting battles during sign-ups. If <b>status</b> is <i>on</i>, turns it on. If <b>status</b> is <i>off</i>, turns it off.<br/>"    
  2125.                         + "<b>\u2022  <font color='green'>/forcetourbattles</font><font color='red'> status</font></b>: Turns the forcing of tournament battles on/off. Forcing tournament battles prevents a tournament player from starting any non-tournament battle when playing a tournament match is requested. If <b>status</b> is <i>on</i>, turns it on. If <b>status</b> is <i>off</i>, turns it off.<br/>"
  2126.                         + "<b>\u2022  <font color='green'>/autostartbattles</font><font color='red'> status</font></b>: Turns the auto-starting of tournament battles on/off. Auto-starting battles starts battles at the beginning of each round  between two players facing each other if they are both on the server and in the appropriate tier. If <b>status</b> is <i>on</i>, turns it on. If <b>status</b> is <i>off</i>, turns it off.<br/>"
  2127.                         + "<b>\u2022  <font color='green'>/enforcetourclauses</font><font color='red'> status</font></b>: Turns the enforcing of tournament clauses on/off. Enforcing tournament clauses prevents players from setting clauses other than the find battle clauses for the tournament's tier, when forcing tournament battles is on, in their tournament battles. If <b>status</b> is <i>on</i>, turns it on. If <b>status</b> is <i>off</i>, turns it off.<br/>"
  2128.                         + "<br/>"
  2129.                         + "<timestamp/><br/>"
  2130.                         + border;
  2131.                         sys.sendHtmlMessage(src, tourbattleoptionsdisplay, channel);
  2132.                 }
  2133.  
  2134.                 ,
  2135.  
  2136.                 tempservertopic: function(src, channel, command){
  2137.                         if (sys.auth(src) < 3){
  2138.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2139.                                 return;
  2140.                         }
  2141.                         if (command[1].length > 200){
  2142.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a topic with at most 200 characters.</i>", channel);
  2143.                                 return;
  2144.                         }
  2145.                         var srcname = sys.name(src);
  2146.                         servertopic = command[1].toLowerCase() == "default" ? "Enjoy your stay at " + servername + "!" : command[1];
  2147.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server topic has been temporarily changed to " + helpers.escapehtml(servertopic).italics() + " by " + srcname + "!</b></font>");
  2148.                 }
  2149.  
  2150.                 ,
  2151.  
  2152.                 servertopic: function(src, channel, command){
  2153.                         if (sys.auth(src) < 3){
  2154.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2155.                                 return;
  2156.                         }
  2157.                         if (command[1].length > 200){
  2158.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a topic with at most 200 characters.</i>", channel);
  2159.                                 return;
  2160.                         }
  2161.                         var srcname = sys.name(src);
  2162.                         servertopic = command[1].toLowerCase() == "default" ? "Enjoy your stay at " + servername + "!" : command[1];
  2163.                         sys.saveVal("Server_Topic", servertopic);
  2164.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server topic has been changed to " + helpers.escapehtml(servertopic).italics() + " by " + srcname + "!</b></font>");
  2165.                 }
  2166.  
  2167.                 ,
  2168.  
  2169.                 quasienglish: function (src, channel, command) {
  2170.                         if (sys.auth(src) < 3){
  2171.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2172.                                 return;
  2173.                         }
  2174.                         var srcname = sys.name(src);
  2175.                         if (command[1] == "on"){
  2176.                                 if (quasienglish == "on"){
  2177.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn quasi-english characters in names on because it is already turned on.</i>", channel);
  2178.                                         return;
  2179.                                 }
  2180.                                 if (quasienglish  == "off"){
  2181.                                         quasienglish = "on";
  2182.                                         sys.saveVal("Quasi_English", "on");
  2183.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b><font color='blueviolet'>Quasi-english characters in names has been turned on by " + srcname + ".</font></b><br/>" + border3);
  2184.                                         return;
  2185.                                 }
  2186.                         }
  2187.                         if (command[1] == "off"){
  2188.                                 if (quasienglish  == "off"){
  2189.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn quasi-english characters in names off because it is already turned off.</i>", channel);
  2190.                                         return;
  2191.                                 }
  2192.                                 if (quasienglish == "on"){
  2193.                                         quasienglish = "off";
  2194.                                         sys.saveVal("Quasi_English", "off");
  2195.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b><font color='blueviolet'>Quasi-english characters in names has been turned off by " + srcname + ".</font></b><br/>" + border3);
  2196.                                         return;
  2197.                                 }
  2198.                         }
  2199.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, <b>on</b> or <b>off</b> are the only valid arguments for the " + command[0] + " command.</i>", channel);
  2200.                 }
  2201.  
  2202.                 ,
  2203.  
  2204.                 futurelimit: function (src, channel, command){
  2205.                         if (sys.auth(src) < 3){
  2206.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2207.                                 return;
  2208.                         }
  2209.                         var limit = parseInt(command[1]);
  2210.                         if (isNaN(limit)){
  2211.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a number as the future limit.</i>", channel);
  2212.                                 return;
  2213.                         }
  2214.                         var srcname = sys.name(src);
  2215.                         futurelimit = limit;
  2216.                         sys.saveVal("Future_Limit", limit);
  2217.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The future limit has been set to " + futurelimit + " by " + srcname + ".</b></font>", 0);                            
  2218.                 }
  2219.  
  2220.                 ,
  2221.  
  2222.                 writemsgcmd: function(src, channel, command){
  2223.                         if (sys.auth(src) < 3){
  2224.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2225.                                 return;
  2226.                         }
  2227.                         var commandname = command[1].toLowerCase();
  2228.                         if (/\W/.test(commandname)){
  2229.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to create the message command because it contains characters other than A-z, 0-9 and _.</i>", channel);
  2230.                                 return;
  2231.                         }
  2232.                         if (command[2].length > 5000){
  2233.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to create the message command because the html contains more than 5000 characters.</i>", channel);
  2234.                                 return;
  2235.                         }
  2236.                         messagecommands[commandname] = command[2];
  2237.                         sys.saveVal("Commands_Options_MessageCommands", JSON.stringify(messagecommands));
  2238.                         commands[commandname] = new Function('src', 'channel', 'command', 'sys.sendHtmlMessage(src, "' + border + '<h2>' + command[1].replace(/[a-z]/, String(/[a-z]/.exec(command[1])).toUpperCase()) + '</h2>' + command[2] + '<br/><br/><timestamp/><br/>' + border + '" , channel);');
  2239.                         var srcname = sys.name(src);
  2240.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The " + command[1] + "  message command has been written by " + srcname + "!</b></font>");
  2241.                 }
  2242.  
  2243.                 ,
  2244.  
  2245.                 deletemsgcmd: function(src, channel, command){
  2246.                         if (sys.auth(src) < 3){
  2247.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2248.                                 return;
  2249.                         }
  2250.                         var commandname = command[1].toLowerCase();
  2251.                         if (messagecommands[commandname] === undefined){
  2252.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not a message command.</i>", channel);
  2253.                                 return;
  2254.                         }
  2255.                         delete commands[commandname];
  2256.                         delete messagecommands[commandname]
  2257.                         sys.saveVal("Commands_Options_MessageCommands", JSON.stringify(messagecommands));
  2258.                         var srcname = sys.name(src);
  2259.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The " + command[1] + "  message command has been deleted by " + srcname + ".</b></font>");                           
  2260.                 }
  2261.  
  2262.                 ,
  2263.  
  2264.                 clearmsgcmds: function(src, channel, command){
  2265.                         if (sys.auth(src) < 3){
  2266.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2267.                                 return;
  2268.                         }
  2269.                         var messagecommandsindex;
  2270.                         for (messagecommandsindex in messagecommands){
  2271.                                 delete commands[messagecommandsindex];
  2272.                         }
  2273.                         messagecommands = new Object();
  2274.                         sys.saveVal("Commands_Options_MessageCommands", "{}");
  2275.                         var srcname = sys.name(src);
  2276.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> All message commands have been deleted by " + srcname + ".</b></font>");                     
  2277.                 }
  2278.  
  2279.                 ,
  2280.  
  2281.                 resetladder: function(src, channel, command){
  2282.                         if (sys.auth(src) < 3){
  2283.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2284.                                 return;
  2285.                         }
  2286.                         var tiers = sys.getTierList(), tiersindex, srcname = sys.name(src);
  2287.                         for (tiersindex in tiers){
  2288.                                 if (command[1].toLowerCase() == tiers[tiersindex].toLowerCase()){
  2289.                                         sys.resetLadder(tiers[tiersindex]);
  2290.                                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The " + tiers[tiersindex] + " ladder has been reset by " + srcname + ".</b></font>");        
  2291.                                         return;
  2292.                                 }
  2293.                         }
  2294.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to reset the ladder of " + command[1] + " because the tier does not exist.</i>", channel);
  2295.                 }
  2296.  
  2297.                 ,
  2298.  
  2299.                 clearladders: function(src, channel, command){
  2300.                         if (sys.auth(src) < 3){
  2301.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2302.                                 return;
  2303.                         }
  2304.                         var tiers = sys.getTierList(), tiersindex, srcname = sys.name(src);
  2305.                         for (tiersindex in tiers){
  2306.                                 sys.resetLadder(tiers[tiersindex]);    
  2307.                         }
  2308.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> All ladders have been reset by " + srcname + ".</b></font>");
  2309.                 }
  2310.  
  2311.                 ,
  2312.  
  2313.                 exportladders: function(src, channel, command){
  2314.                         helpers.exportdb("ladder", "Tier", src, channel, command);
  2315.                 }
  2316.  
  2317.                 ,
  2318.  
  2319.                 exportmembers: function(src, channel, command){
  2320.                         helpers.exportdb("member", "Member", src, channel, command);
  2321.                 }
  2322.  
  2323.                 ,
  2324.  
  2325.                 changerating: function(src, channel, command){
  2326.                         if (sys.auth(src) < 3){
  2327.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2328.                                 return;
  2329.                         }
  2330.                         if (!helpers.memberscheck(command[1])){
  2331.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to change the rating of " + command[1] + " because they do not exist in the member database.</i>", channel);
  2332.                                 return;
  2333.                         }                              
  2334.                         var tiers = sys.getTierList(), tiersindex;
  2335.                         for (tiersindex in tiers){
  2336.                                 if (command[2].toLowerCase() == tiers[tiersindex].toLowerCase()){
  2337.                                         var trgttier = tiers[tiersindex];
  2338.                                 }
  2339.                         }
  2340.                         if (trgttier === undefined){
  2341.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to change the rating of " + command[1] + " because " + command[2] + " is not a valid name for a tier.</i>", channel);
  2342.                                 return;
  2343.                         }
  2344.                         var trgtrating = command[3];
  2345.                         if (isNaN(trgtrating)){
  2346.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to change the rating of " + command[1] + " because " + trgtrating + " is not a valid value for a rating.</i>", channel);
  2347.                                 return;
  2348.                         }
  2349.                         var srcname = sys.name(src), trgtname = members[command[1].toLowerCase()];
  2350.                         sys.changeRating(trgtname, trgttier, trgtrating);
  2351.                         sys.updateRatings();
  2352.                         sys.sendHtmlAll("<timestamp/><font color='blue violet'><b>The Ladder Rating of " + trgtname +  " has been changed to " + trgtrating + " for the " + trgttier + " tier by " + srcname + ".</b></font>");
  2353.                                
  2354.                 }
  2355.  
  2356.                 ,
  2357.  
  2358.                 clearpass: function (src, channel, command){
  2359.                         if (sys.auth(src) < 3){
  2360.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2361.                                 return;
  2362.                         }
  2363.                         if (!helpers.memberscheck(command[1])){
  2364.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to clear the password of " + command[1] + " because they do not exist in the member database.</i>", channel);
  2365.                                 return;
  2366.                         }
  2367.                         if (!sys.dbRegistered(command[1])){
  2368.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to clear the password of " + command[1] + " because they do not have one set.</i>", channel);
  2369.                                 return;
  2370.                         }
  2371.                         var srcname = sys.name(src), trgtname = members[command[1].toLowerCase()];
  2372.                         sys.clearPass(trgtname);
  2373.                         sys.sendHtmlAll("<timestamp/><font color='blue violet'><b>" + trgtname +  "'s password has been cleared by " + srcname + ".</b></font>");                              
  2374.                 }
  2375.  
  2376.                 ,
  2377.  
  2378.                 open: function (src, channel, command){
  2379.                         if (sys.auth(src) < 3){
  2380.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2381.                                 return;
  2382.                         }
  2383.                         if (open){
  2384.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot open the server because it is already open to player connections.</i>", channel);
  2385.                                 return;
  2386.                         }                              
  2387.                         open = true;
  2388.                         var srcname = sys.name(src);
  2389.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blue violet'><b> The server has been opened to player connections by " + srcname + ".</b></font><br/>" + border3);
  2390.                 }
  2391.  
  2392.                 ,
  2393.  
  2394.                 close: function (src, channel, command){
  2395.                         if (sys.auth(src) < 3){
  2396.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2397.                                 return;
  2398.                         }
  2399.                         if (!open){
  2400.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot close the server because it is already closed to player connections.</i>", channel);
  2401.                                 return;
  2402.                         }              
  2403.                         open = false;
  2404.                         var srcname = sys.name(src);
  2405.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blue violet'><b> The server has been closed to player connections by " + srcname + ".</b></font><br/>" + border3);
  2406.                 }
  2407.  
  2408.                 ,
  2409.  
  2410.                 public: function (src, channel, command){
  2411.                         if (sys.auth(src) < 3){
  2412.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2413.                                 return;
  2414.                         }
  2415.                         var srcname = sys.name(src); var config = sys.getFileContent("config"); config = config.replace(/server_private=1/, "server_private=0");
  2416.                         sys.writeToFile("config", config);
  2417.                         sys.makeServerPublic(true);
  2418.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blue violet'><b> The server has been made public by " + srcname + ".</b></font><br/>" + border3);
  2419.                 }
  2420.  
  2421.                 ,
  2422.  
  2423.                 private: function (src, channel, command){
  2424.                         if (sys.auth(src) < 3){
  2425.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2426.                                 return;
  2427.                         }
  2428.                         var srcname = sys.name(src); var config = sys.getFileContent("config"); config = config.replace(/server_private=0/, "server_private=1");
  2429.                         sys.writeToFile("config", config);
  2430.                         sys.makeServerPublic(false);
  2431.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blue violet'><b> The server has been made private by " + srcname + ".</b></font><br/>" + border3);
  2432.                 }
  2433.  
  2434.                 ,
  2435.  
  2436.                 disconnectall: function(src, channel, command){
  2437.                         if (sys.auth(src) < 3){
  2438.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2439.                                 return;
  2440.                         }
  2441.                         var srcname = sys.name(src), playerids = sys.playerIds(), playerid;
  2442.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b>" + srcname + " has disconnected all players from the server.</b><br/>" + border3);
  2443.                         for (playerid in playerids){
  2444.                                 sys.callQuickly("sys.kick(" + playerids[playerid] + ");", 200);
  2445.                         }
  2446.                 }
  2447.  
  2448.                 ,
  2449.  
  2450.                 lockout: function(src, channel, command){
  2451.                         if (sys.auth(src) < 3){
  2452.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2453.                                 return;
  2454.                         }
  2455.                         var srcname = sys.name(src), playerids = sys.playerIds(), playerid;
  2456.                         open = false;
  2457.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b>" + srcname + " has locked out all players from the server.</b><br/>" + border3);
  2458.                         for (playerid in playerids){
  2459.                                 sys.callQuickly("sys.kick(" + playerids[playerid] + ");", 200);
  2460.                         }
  2461.                 }
  2462.  
  2463.                 ,
  2464.  
  2465.                 shutdown: function (src, channel, command){
  2466.                         if (sys.auth(src) < 3){
  2467.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2468.                                 return;
  2469.                         }
  2470.                         if (command[1] === "0" || command[2] === undefined){
  2471.                                 sys.sendHtmlAll(border3 + "<br/><timestamp/><b>The server has shut down.</b><br/>" + border3);         
  2472.                                 sys.callQuickly("sys.shutDown();", 200);
  2473.                                 return;
  2474.                         }
  2475.                         var shutdowntime = parseInt(command[1]), shutdownunit = command[2].toLowerCase();
  2476.                         if (helpers.nottimeunit(shutdownunit)){
  2477.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to shut down the server because you have not specified a valid unit of time.</i>", channel);
  2478.                                 return;
  2479.                         }
  2480.                         if (isNaN(shutdowntime)){
  2481.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to shut down the server because you have not specified a valid number of " + command[2] + "</i>.", channel);
  2482.                                 return;
  2483.                         }
  2484.                         var shutdownseconds = helpers.converttoseconds(shutdownunit, shutdowntime);
  2485.                         shutdownunit = helpers.timeplurality(shutdowntime, shutdownunit);
  2486.                         var shutdownkey = new Date();
  2487.                         shutdown = shutdownkey;
  2488.                         var shutdownfunction = function (){
  2489.                                 if (shutdown === shutdownkey){
  2490.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b>The server has shut down.</b><br/>" + border3);         
  2491.                                         sys.callQuickly("sys.shutDown();", 200)
  2492.                                 }
  2493.                         }
  2494.                         sys.delayedCall(shutdownfunction, shutdownseconds);
  2495.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blueviolet'><b>The server will shut down in " + shutdowntime + " " + shutdownunit + ". - " + sys.name(src) + "</b></font><br/>" + border3);
  2496.                 }
  2497.  
  2498.                 ,
  2499.  
  2500.                 cancelshutdown: function (src, channel, command){
  2501.                         if (sys.auth(src) < 3){
  2502.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2503.                                 return;
  2504.                         }
  2505.                         if (shutdown === false){
  2506.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to cancel the shutdown because there is currently no shutdown taking place.</i>", channel);
  2507.                                 return;
  2508.                         }
  2509.                         shutdown = false;
  2510.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blueviolet'><b>The server shutdown has been cancelled by " + sys.name(src) + "</b></font>.<br/>" + border3);
  2511.                 }
  2512.  
  2513.                 ,
  2514.  
  2515.                 tiersname: function (src, channel, command){
  2516.                         if (sys.auth(src) < 3){
  2517.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2518.                                 return;
  2519.                         }
  2520.                         if (/[^A-z]/gi.test(command[1])){
  2521.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you can only name your tiers with characters from A-z.</i>", channel);
  2522.                                 return;
  2523.                         }
  2524.                         tiersname = command[1];
  2525.                         sys.saveVal("Tiers_Options_TiersName", tiersname);
  2526.                         var srcname = sys.name(src);
  2527.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b>The name of the Server Tiers has been saved as " + tiersname.italics() + " by " + srcname + ".</b></font>");
  2528.                 }
  2529.  
  2530.                 ,
  2531.  
  2532.                 tierslinksupdate: function (src, channel, command){
  2533.                         if (sys.auth(src) < 3){
  2534.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2535.                                 return;
  2536.                         }
  2537.                         sys.saveVal("Tiers_Options_TiersLinks", '{"po":"http://pokemonperfect.co.uk/po_tiers.xml","smogon":"http://pokemonperfect.co.uk/smogon_tiers.xml"}');
  2538.                         tierslinks = sys.getVal("Tiers_Options_TiersLinks");
  2539.                         var srcname = sys.name(src);
  2540.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b>The tiers links object has been updated " + "</a> by " + srcname + ".</b></font>");
  2541.                 }
  2542.  
  2543.                 ,
  2544.  
  2545.                 tiersload: function (src, channel, command){
  2546.                         if (sys.auth(src) < 3){
  2547.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2548.                                 return;
  2549.                         }
  2550.                         var srcname = sys.name(src);
  2551.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Tiers have been loaded from file by " + srcname + "!</b></font>");
  2552.                         sys.reloadTiers();
  2553.                 }
  2554.                        
  2555.                 ,
  2556.  
  2557.                 tiersimport: function(src, channel, command){
  2558.                         if (sys.auth(src) < 3){
  2559.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2560.                                 return;
  2561.                         }
  2562.                         var nexttiers = sys.getFileContent(command[1]);
  2563.                         if (nexttiers === undefined){
  2564.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " could not be imported.</i>", channel);
  2565.                                 return;
  2566.                         }
  2567.                         var srcname = sys.name(src);
  2568.                         sys.saveVal("Tiers_Options_LastTiers", sys.getFileContent("tiers.xml"));
  2569.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> A Server Tiers has been imported by " + srcname + "!</b></font>");
  2570.                         sys.writeToFile("tiers.xml", nexttiers);
  2571.                         sys.reloadTiers();
  2572.                 }
  2573.  
  2574.                 ,
  2575.  
  2576.                 tiersexport: function (src, channel, command){
  2577.                         if (sys.auth(src) < 3){
  2578.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2579.                                 return;
  2580.                         }
  2581.                         var srcname = sys.name(src);
  2582.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Tiers have been exported  by " + srcname + "!</b></font>");
  2583.                         sys.writeToFile(tiersname + ".xml", sys.getFileContent("tiers.xml"));
  2584.                 }
  2585.  
  2586.                 ,
  2587.  
  2588.                 tiersinstall: function(src, channel, command){
  2589.                         if (sys.auth(src) < 3){
  2590.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2591.                                 return;
  2592.                         }
  2593.                         if (tierslinks[command[1]] === undefined){
  2594.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to install tiers because " + command[1] + " is not a valid key.</i>", channel);
  2595.                                 return;
  2596.                         }
  2597.                         var srcname = sys.name(src);
  2598.                         sys.saveVal("Tiers_Options_LastTiers", sys.getFileContent("tiers.xml"));
  2599.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The latest " + command[1] + " tiers have been installed by " + srcname + "!</b></font>");
  2600.                         sys.webCall(tierslinks[command[1]], "if (/category/gi.test(resp)){sys.writeToFile('tiers.xml', resp)}sys.reloadTiers()");      
  2601.                 }
  2602.  
  2603.                 ,
  2604.  
  2605.                 tierslast: function (src, channel, command){
  2606.                         if (sys.auth(src) < 3){
  2607.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2608.                                 return;
  2609.                         }
  2610.                         var nexttiers = sys.getVal("Tiers_Options_LastTiers");
  2611.                         if (nexttiers == ""){
  2612.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to revert because there currently is no last version of the tiers</i>", channel);
  2613.                                 return;
  2614.                         }
  2615.                         var srcname = sys.name(src);
  2616.                         sys.saveVal("Tiers_Options_LastTiers", sys.getFileContent("tiers.xml"));
  2617.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Tiers have been reverted to the last version by " + srcname + "!</b></font>");
  2618.                         sys.writeToFile("tiers.xml", nexttiers);
  2619.                         sys.reloadTiers();
  2620.                 }
  2621.  
  2622.                 ,
  2623.  
  2624.                 scriptname: function (src, channel, command){
  2625.                         if (sys.auth(src) < 3){
  2626.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2627.                                 return;
  2628.                         }
  2629.                         if (/[^A-z]/gi.test(command[1])){
  2630.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you can only name your script with characters from A-z.</i>", channel);
  2631.                                 return;
  2632.                         }
  2633.                         scriptname = command[1];
  2634.                         sys.saveVal("Script_Options_ScriptName", scriptname);
  2635.                         var srcname = sys.name(src);
  2636.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b>The name of the Server Script has been saved as " + scriptname.italics() + " by " + srcname + ".</b></font>");
  2637.                 }
  2638.  
  2639.                 ,
  2640.  
  2641.                 scriptupdatelinks: function (src, channel, command){
  2642.                         if (sys.auth(src) < 3){
  2643.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2644.                                 return;
  2645.                         }
  2646.                         sys.saveVal("Script_Options_ServerScriptLink", "http://pokemonperfect.co.uk/serverscript.txt");
  2647.                         sys.saveVal("Script_Options_AutoUpdateScriptLink", "http://pokemonperfect.co.uk/webcallscript.txt");
  2648.                         serverscriptlink = sys.getVal("Script_Options_ServerScriptLink");
  2649.                         autoupdatescriptlink = sys.getVal("Script_Options_AutoUpdateScriptLink");
  2650.                         var srcname = sys.name(src);
  2651.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b>The Full Original Script web URL has been saved as <a href='" + serverscriptlink + "'>" + serverscriptlink.italics() + "</a> and the Auto-Update Script web URL has been saved as <a href='" + autoupdatescriptlink + "'>" + autoupdatescriptlink.italics() + "</a> by " + srcname + ".</b></font>");
  2652.                 }
  2653.  
  2654.                 ,
  2655.  
  2656.                 scriptserverlink: function (src, channel, command){
  2657.                         if (sys.auth(src) < 3){
  2658.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2659.                                 return;
  2660.                         }
  2661.                         if (command[1].substr(0,7) != "http://"){
  2662.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, the link must begin with <b>http://</b>.</i>", channel);
  2663.                                 return;
  2664.                         }
  2665.                         serverscriptlink = command[1];
  2666.                         sys.saveVal("Script_Options_ServerScriptLink", serverscriptlink);
  2667.                         var srcname = sys.name(src);
  2668.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b>The Full Original Script web URL has been saved as <a href='" + serverscriptlink + "'>" + serverscriptlink.italics() + "</a> by " + srcname + ".</b></font>");
  2669.                 }
  2670.  
  2671.                 ,
  2672.  
  2673.                 scriptautolink: function (src, channel, command){
  2674.                         if (sys.auth(src) < 3){
  2675.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2676.                                 return;
  2677.                         }
  2678.                         if (command[1].substr(0,7) != "http://"){
  2679.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, the link must begin with <b>http://</b>.</i>", channel);
  2680.                                 return;
  2681.                         }
  2682.                         autoupdatescriptlink = command[1];
  2683.                         sys.saveVal("Script_Options_AutoUpdateScriptLink", autoupdatescriptlink);
  2684.                         var srcname = sys.name(src);
  2685.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b>The Auto-Update Script web URL has been saved as <a href='" + autoupdatescriptlink + "'>" + autoupdatescriptlink.italics() + "</a> by " + srcname + ".</b></font>");
  2686.                 }
  2687.  
  2688.                 ,
  2689.  
  2690.                 scriptload: function(src, channel, command){
  2691.                         if (sys.auth(src) < 3){
  2692.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2693.                                 return;
  2694.                         }
  2695.                         var srcname = sys.name(src);
  2696.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Script has been loaded from file by " + srcname + "!</b></font>");
  2697.                         sys.changeScript(scriptcontent);
  2698.                 }
  2699.  
  2700.                 ,
  2701.  
  2702.                 scriptreload: function (src, channel, command){
  2703.                         if (sys.auth(src) < 3){
  2704.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2705.                                 return;
  2706.                         }
  2707.                         var srcname = sys.name(src);
  2708.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Script has been reloaded by " + srcname + "!</b></font>");
  2709.                         load();
  2710.                 }
  2711.                        
  2712.                 ,
  2713.  
  2714.                 scriptchange: function(src, channel, command){
  2715.                         if (sys.auth(src) < 3){
  2716.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2717.                                 return;
  2718.                         }
  2719.                         var nextscript = sys.getFileContent(command[1]);
  2720.                         if (nextscript === undefined){
  2721.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " could not be loaded.</i>", channel);
  2722.                                 return;
  2723.                         }
  2724.                         var srcname = sys.name(src);
  2725.                         sys.saveVal("Script_Options_LastScript", scriptcontent);
  2726.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Script has been changed by " + srcname + "!</b></font>");
  2727.                         sys.changeScript(nextscript);          
  2728.                 }
  2729.                
  2730.                 ,              
  2731.  
  2732.                 scriptimport: function(src, channel, command){
  2733.                         if (sys.auth(src) < 3){
  2734.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2735.                                 return;
  2736.                         }
  2737.                         var nextscript = sys.getFileContent(command[1]);
  2738.                         if (nextscript === undefined){
  2739.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " could not be imported.</i>", channel);
  2740.                                 return;
  2741.                         }
  2742.                         var srcname = sys.name(src);
  2743.                         sys.saveVal("Script_Options_LastScript", scriptcontent);
  2744.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> A Server Script has been imported by " + srcname + "!</b></font>");
  2745.                         sys.writeToFile("scripts.js", nextscript);
  2746.                         sys.changeScript(nextscript);
  2747.                 }
  2748.  
  2749.                 ,
  2750.  
  2751.                 scriptexport: function (src, channel, command){
  2752.                         if (sys.auth(src) < 3){
  2753.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2754.                                 return;
  2755.                         }
  2756.                         var srcname = sys.name(src);
  2757.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Script has been exported  by " + srcname + "!</b></font>");
  2758.                         sys.writeToFile(scriptname + ".txt", scriptcontent);
  2759.                 }
  2760.  
  2761.                 ,
  2762.  
  2763.                 scriptfull: function(src, channel, command){
  2764.                         if (sys.auth(src) < 3){
  2765.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2766.                                 return;
  2767.                         }
  2768.                         helpers.serverscriptdownload();
  2769.                         if (serverscript == ""){
  2770.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, no full original script is currently saved.</i>", channel);
  2771.                                 return;
  2772.                         }
  2773.                         var srcname = sys.name(src);
  2774.                         sys.saveVal("Script_Options_LastScript", scriptcontent);
  2775.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Full Original Server Script has been imported by " + srcname + "!</b></font>");
  2776.                         sys.writeToFile("scripts.js", serverscript);
  2777.                         sys.changeScript(serverscript);
  2778.                 }
  2779.  
  2780.                 ,
  2781.  
  2782.                 scriptautoupdate: function(src, channel, command){
  2783.                         if (sys.auth(src) < 3){
  2784.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2785.                                 return;
  2786.                         }
  2787.                         helpers.autoupdatescriptdownload();
  2788.                         if (autoupdatescript == ""){
  2789.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, no auto-update script is currently saved.</i>", channel);
  2790.                                 return;
  2791.                         }
  2792.                         var srcname = sys.name(src);
  2793.                         sys.saveVal("Script_Options_LastScript", scriptcontent);
  2794.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Auto-Update Script has been imported by " + srcname + "!</b></font>");
  2795.                         sys.writeToFile("scripts.js", autoupdatescript);
  2796.                         sys.changeScript(autoupdatescript);
  2797.                 }
  2798.  
  2799.                 ,
  2800.        
  2801.                 scriptlast: function (src, channel, command){
  2802.                         if (sys.auth(src) < 3){
  2803.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2804.                                 return;
  2805.                         }
  2806.                         var nextscript = sys.getVal("Script_Options_LastScript");
  2807.                         if (nextscript == ""){
  2808.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to revert because there currently is no last version of the script</i>", channel);
  2809.                                 return;
  2810.                         }
  2811.                         var srcname = sys.name(src);
  2812.                         sys.saveVal("Script_Options_LastScript", scriptcontent);
  2813.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Script has been reverted to the last version by " + srcname + "!</b></font>");
  2814.                         sys.writeToFile("scripts.js", nextscript);
  2815.                         sys.changeScript(nextscript);
  2816.                 }
  2817.  
  2818.                 ,
  2819.  
  2820.                 scriptmod: function (src, channel, command){
  2821.                         if (sys.auth(src) < 3){
  2822.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2823.                                 return;
  2824.                         }
  2825.                         if (scriptcontent == serverscript || scriptcontent == autoupdatescript){
  2826.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot declare you modified the script because it is the same as the current Full Original Script.</i>", channel);
  2827.                                 return;
  2828.                         }
  2829.                         var srcname = sys.name(src);
  2830.                         if (scriptmodders.indexOf(srcname.toLowerCase()) != -1){
  2831.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot declare you modified the script again.</i>", channel);
  2832.                                 return;
  2833.                         }
  2834.                         scriptmodders.push(srcname.toLowerCase());
  2835.                         sys.saveVal("Script_Options_ScriptModders", JSON.stringify(scriptmodders));
  2836.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Script has been declared modified by " + srcname+ "!</b></font>");
  2837.                         helpers.scriptversion();
  2838.                 }
  2839.  
  2840.                 ,
  2841.  
  2842.                 scriptunmod: function (src, channel, command){
  2843.                         if (sys.auth(src) < 3){
  2844.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2845.                                 return;
  2846.                         }
  2847.                         if (scriptmodders.length == 0){
  2848.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot undeclare the script as a modification because it has not been declared as one yet.</i>", channel);
  2849.                                 return;
  2850.                         }
  2851.                         var srcname = sys.name(src);
  2852.                         scriptmodders = new Array();
  2853.                         sys.saveVal("Script_Options_ScriptModders", JSON.stringify(scriptmodders));
  2854.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The Server Script has been undeclared as a modification by " + srcname + "!</b></font>");
  2855.                         helpers.scriptversion();
  2856.                 }
  2857.  
  2858.                 ,
  2859.  
  2860.                 sys: function(src, channel, command){
  2861.                         if (sys.auth(src) < 3){
  2862.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2863.                                 return;
  2864.                         }
  2865.                         if (sys[command[1]] === undefined){
  2866.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to run sys." + command[1] + " because it is not a scripting function.</i>", channel);
  2867.                                 return;
  2868.                         }
  2869.                         var srcname = sys.name(src), sysfunction = command[1];
  2870.                         command.splice(0,2);
  2871.                         command = command.join("*");
  2872.                         var sysargs = command.split(","), sysargsindex;
  2873.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blueviolet'><b>" + srcname + " used the following scripting function:</b></font><br/><b> sys." + helpers.escapehtml(sysfunction) + "(" + helpers.escapehtml(String(sysargs)) + ")</b><br/>" + border3);
  2874.                         try{
  2875.                                 for (sysargsindex in sysargs){
  2876.                                         sysargs[sysargsindex] = eval(sysargs[sysargsindex]);
  2877.                                 }
  2878.                                 sys[sysfunction].apply(null, sysargs);
  2879.                                 sys.sendHtmlAll("<timestamp/><b>Script Check: </b><font color='green'>OK</font>");
  2880.                         }
  2881.                         catch(error){
  2882.                                 sys.sendHtmlAll("<timestamp/><b>Script Check: </b><font color='red'>" + error + "</font>");
  2883.                         }
  2884.                 }
  2885.  
  2886.                 ,
  2887.  
  2888.                 findbattlemessage: function(src, channel, command){
  2889.                         if (sys.auth(src) < 3){
  2890.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2891.                                 return;
  2892.                         }
  2893.                 var srcname = sys.name(src);    
  2894.                 if (command[1] == "on"){
  2895.                                 if (findbattlemessage == "on"){
  2896.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn the Find Battle event message on because it is already turned on.</i>", channel);
  2897.                                         return;
  2898.                                 }
  2899.                                 if (findbattlemessage  == "off"){
  2900.                                         findbattlemessage  = "on";
  2901.                                         sys.saveVal("Event_Options_FindBattleMessage", "on");
  2902.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b><font color='blueviolet'>The Find Battle event message has been turned on by " + srcname + ".</font></b><br/>" + border3);
  2903.                                         return;
  2904.                         }
  2905.                 }
  2906.                         if (command[1] == "off"){
  2907.                                 if (findbattlemessage == "off"){
  2908.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn the Find Battle event message off because it is already turned off.</i>", channel);
  2909.                                         return;
  2910.                                 }
  2911.                                 if (findbattlemessage== "on"){
  2912.                                         findbattlemessage = "off";
  2913.                                         sys.saveVal("Event_Options_FindBattleMessage", "off");
  2914.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b><font color='blueviolet'>The Find Battle event message has been turned off by " + srcname + ".</font></b><br/>" + border3);
  2915.                                         return;
  2916.                                 }
  2917.                         }
  2918.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, <b>on</b> or <b>off</b> are the only valid arguments for the " + command[0] + " command.</i>", channel);
  2919.                 }
  2920.  
  2921.                 ,
  2922.  
  2923.                 eval: function(src, channel, command){
  2924.                         if (sys.auth(src) < 3){
  2925.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2926.                                 return;
  2927.                         }
  2928.                         command.splice(0,1);
  2929.                         command = command.join("*");
  2930.                         var srcname = sys.name(src);
  2931.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blueviolet'><b>" + srcname + " evaluated/executed the following code:</b></font><br/><b> " + helpers.escapehtml(command) + "</b><br/>" + border3);
  2932.                         var starttime = new Date();
  2933.                         try{
  2934.                                 eval(command);
  2935.                                 sys.sendHtmlAll("<timestamp/><b>Script Check: </b><font color='green'>OK</font>");
  2936.                         }
  2937.                         catch(error){
  2938.                                 sys.sendHtmlAll("<timestamp/><b>Script Check: </b><font color='red'>" + error + "</font>");
  2939.                         }
  2940.                         var runtime = new Date() - starttime;
  2941.                         sys.sendHtmlAll("<timestamp/><b>Eval Runtime:</b> " + runtime + " milliseconds");
  2942.                 }
  2943.  
  2944.                 ,
  2945.  
  2946.                 print: function(src, channel, command){
  2947.                         if (sys.auth(src) < 3){
  2948.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2949.                                 return;
  2950.                         }
  2951.                         try {
  2952.                                 eval("print(" + command[1] + ")");
  2953.                                 sys.sendHtmlMessage(src, border + "<br/><timestamp/><font color='green'><b>" + command[1] + " was successfuly printed on the server window.</b></font><br/>" + border, channel);
  2954.                         }
  2955.                         catch(error){
  2956.                                 sys.sendHtmlMessage(src, border + "<br/><timestamp/><font color='red'><b>" + error + "</font><br/>" + border, channel);
  2957.                         }
  2958.                 }
  2959.  
  2960.                 ,
  2961.  
  2962.                 clear: function(src, channel, command){
  2963.                         if (sys.auth(src) < 3){
  2964.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2965.                                 return;
  2966.                         }
  2967.                         sys.clearChat();
  2968.                         sys.sendHtmlMessage(src, border + "<br/><timestamp/><b><font color='green'>The Server window has been cleared.</font></b><br/>" + border, channel);
  2969.                 }
  2970.  
  2971.                 ,
  2972.  
  2973.                 system: function(src, channel, command){
  2974.                         if (sys.auth(src) < 3){
  2975.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2976.                                 return;
  2977.                         }
  2978.                         var srcname = sys.name(src);
  2979.                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blueviolet'><b>" + srcname + " ran the system command:</b></font><br/><b> " + command[1] + "</b><br/>" + border3);
  2980.                         sys.system(command[1]);
  2981.                 }
  2982.  
  2983.                 ,
  2984.  
  2985.                 tempvarchanges: function(src, channel, command){
  2986.                         if (sys.auth(src) < 3){
  2987.                                 helpers.failpermissionmessage(src, channel, command[0]);
  2988.                                 return;
  2989.                         }
  2990.                         var srcname = sys.name(src);                           
  2991.                         if (command[1] == "on"){
  2992.                                 if (variablechanges == "on"){
  2993.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn the temporary showing of variable changes on because it is already turned on.</i>", channel);
  2994.                                         return;
  2995.                                 }
  2996.                                 if (variablechanges == "off"){
  2997.                                         variablechanges = "on";
  2998.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b><font color='blueviolet'>The temporary showing of variable changes  has been turned on by " + srcname + ".</font></b><br/>" + border3);
  2999.                                         return;
  3000.                                 }
  3001.                         }
  3002.                         if (command[1] == "off"){
  3003.                                 if (variablechanges  == "off"){
  3004.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn the temporary showing of variable changes off because it is already turned off.</i>", channel);
  3005.                                         return;
  3006.                                 }
  3007.                                 if (variablechanges == "on"){
  3008.                                         variablechanges  = "off";
  3009.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b><font color='blueviolet'>The temporary showing of variable changes has been turned off by " + srcname + ".</font></b><br/>" + border3);
  3010.                                         return;
  3011.                                 }
  3012.                         }
  3013.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, <b>on</b> or <b>off</b> are the only valid arguments for the " + command[0] + " command.</i>", channel);    
  3014.                 }
  3015.  
  3016.                 ,
  3017.  
  3018.                 varchanges: function(src, channel, command){
  3019.                         if (sys.auth(src) < 3){
  3020.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3021.                                 return;
  3022.                         }
  3023.                         var srcname = sys.name(src);                           
  3024.                         if (command[1] == "on"){
  3025.                                 if (variablechanges == "on"){
  3026.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn the showing of variable changes on because it is already turned on.</i>", channel);
  3027.                                         return;
  3028.                                 }
  3029.                                 if (variablechanges == "off"){
  3030.                                         variablechanges = "on";
  3031.                                         sys.saveVal("Variable_Options_VariableChanges", "on");
  3032.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b><font color='blueviolet'>The showing of variable changes  has been turned on by " + srcname + ".</font></b><br/>" + border3);
  3033.                                         return;
  3034.                                 }
  3035.                         }
  3036.                         if (command[1] == "off"){
  3037.                                 if (variablechanges  == "off"){
  3038.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn the showing of variable changes off because it is already turned off.</i>", channel);
  3039.                                         return;
  3040.                                 }
  3041.                                 if (variablechanges == "on"){
  3042.                                         variablechanges  = "off";
  3043.                                         sys.saveVal("Variable_Options_VariableChanges", "off");
  3044.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><b><font color='blueviolet'>The showing of variable changes has been turned off by " + srcname + ".</font></b><br/>" + border3);
  3045.                                         return;
  3046.                                 }
  3047.                         }
  3048.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, <b>on</b> or <b>off</b> are the only valid arguments for the " + command[0] + " command.</i>", channel);    
  3049.                 }
  3050.  
  3051.                 ,
  3052.  
  3053.                 get: function(src, channel, command){
  3054.                         if (sys.auth(src) < 3){
  3055.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3056.                                 return;
  3057.                         }
  3058.                         var globalvariable;
  3059.                         try {
  3060.                                 globalvariable = eval("global." + command[1]);
  3061.                         }
  3062.                         catch(error){
  3063.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the content of " + command[1] + " because it is not a valid name for a variable.</i>", channel);
  3064.                                 return;
  3065.                         }
  3066.                         if (String(globalvariable).length > 5000){
  3067.                                 print(globalvariable);
  3068.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, because it was over 5000 characters long, the content was printed on the server window.</i>", channel);       
  3069.                                 return;        
  3070.                         }
  3071.                         globalvariable = globalvariable === undefined ? "undefined" : globalvariable;
  3072.                         var datatype = typeof globalvariable;
  3073.                         var getmessage = border
  3074.                         + "<h2> Variable Content: " + helpers.escapehtml(command[1]) + " [" + datatype + "]</h2>"
  3075.                         + helpers.escapehtml(String(globalvariable)).replace(/\n/g, "<br/>").replace(/\t/g, "&nbsp;") + "<br/>"
  3076.                         + "<br/>"
  3077.                         + "<timestamp/><br/>"
  3078.                         + border;
  3079.                         sys.sendHtmlMessage(src, getmessage, channel);
  3080.                 }
  3081.  
  3082.                 ,
  3083.  
  3084.                 getkeys: function(src, channel, command){
  3085.                         if (sys.auth(src) < 3){
  3086.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3087.                                 return;
  3088.                         }
  3089.                         var globalvariable;
  3090.                         try {
  3091.                                 globalvariable = eval("global." + command[1]);
  3092.                         }
  3093.                         catch(error){
  3094.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the keys of " + command[1] + " because it is not a valid name for a variable.</i>", channel);
  3095.                                 return;
  3096.                         }
  3097.                         if (globalvariable === null){
  3098.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the keys of " + command[1] + " because it contains null.</i>", channel);
  3099.                                 return;
  3100.                         }
  3101.                         var datatype = typeof globalvariable;
  3102.                         if (datatype != "object"){
  3103.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the keys of " + command[1] + " because it is not an object.</i>", channel);
  3104.                                 return;
  3105.                         }
  3106.                         if (String(Object.keys(globalvariable)).length > 5000){
  3107.                                 print(Object.keys(globalvariable));
  3108.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, because the keys content was over 5000 characters long, the keys were printed on the server window.</i>", channel);   
  3109.                                 return;        
  3110.                         }      
  3111.                         var varlist = "<b><small>", vartotal = Object.keys(globalvariable).length, varindex, colortype = ({"object": "red", "function" : "blue", "number": "blueviolet", "string" : "green", "boolean" : "indigo"}), datatypetotal = new Object();
  3112.                         for (varindex in globalvariable){
  3113.                                 if (datatypetotal[typeof globalvariable[varindex]] === undefined){
  3114.                                         datatypetotal[typeof globalvariable[varindex]] = 0;
  3115.                                 }
  3116.                                 datatypetotal[typeof globalvariable[varindex]] += 1;
  3117.                                 varlist += "<font color='" + colortype[typeof globalvariable[varindex]] + "'>" + varindex + "</font>" + ", ";
  3118.                         }
  3119.                         varlist = varlist.substring(0, varlist.length-2) + ".</small></b>"             
  3120.                         var getkeysmessage = border
  3121.                         + "<h2> Variable Keys: " + helpers.escapehtml(command[1]) + " [object]</h2>"
  3122.                         + "<br/>"
  3123.                         + varlist + "<br/>"
  3124.                         + "<br/>";
  3125.                         if (datatypetotal.object != undefined){
  3126.                                 getkeysmessage += "<b><font color='red'>Total Number of Object Keys:</font></b> " + datatypetotal.object + "<br/>";
  3127.                         }
  3128.                         if (datatypetotal["function"] != undefined){
  3129.                                 getkeysmessage += "<b><font color='blue'>Total Number of Function Keys:</font></b> " + datatypetotal["function"] + "<br/>";
  3130.                         }
  3131.                         if (datatypetotal.number != undefined){
  3132.                                 getkeysmessage += "<b><font color='blueviolet'>Total Number of Number Keys:</font></b> " + datatypetotal.number  + "<br/>";
  3133.                         }
  3134.                         if (datatypetotal.string != undefined){
  3135.                                 getkeysmessage += "<b><font color='green'>Total Number of String Keys:</font></b> " + datatypetotal.string + "<br/>";
  3136.                         }
  3137.                         if (datatypetotal["boolean"] != undefined){
  3138.                                 getkeysmessage += "<b><font color='indigo'>Total Number of Boolean Keys:</font></b> " + datatypetotal["boolean"] + "<br/>";
  3139.                         }
  3140.                         getkeysmessage += "<b>Total Number of Keys:</b> " + vartotal + "<br/>"
  3141.                         + "<br/>"
  3142.                         + "<timestamp/><br/>"
  3143.                         + border;
  3144.                         sys.sendHtmlMessage(src, getkeysmessage, channel);
  3145.                 }
  3146.  
  3147.                 ,
  3148.  
  3149.                 getvalues: function(src, channel, command){
  3150.                         if (sys.auth(src) < 3){
  3151.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3152.                                 return;
  3153.                         }
  3154.                         var globalvariable;
  3155.                         try {
  3156.                                 globalvariable = eval("global." + command[1]);
  3157.                         }
  3158.                         catch(error){
  3159.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the values of " + command[1] + " because it is not a valid name for a variable.</i>", channel);
  3160.                                 return;
  3161.                         }
  3162.                         if (globalvariable === null){
  3163.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the values of " + command[1] + " because it contains null.</i>", channel);
  3164.                                 return;
  3165.                         }
  3166.                         var datatype = typeof globalvariable;
  3167.                         if (datatype != "object"){
  3168.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the values of " + command[1] + " because it is not an object.</i>", channel);
  3169.                                 return;
  3170.                         }
  3171.                         var key, values = new Array(), valuelist = "<b><small>", valuetotal = Object.keys(globalvariable).length, colortype = ({"object": "red", "function" : "blue", "number": "blueviolet", "string" : "green", "boolean" : "indigo"}), datatypetotal = new Object();
  3172.                         for (key in globalvariable){
  3173.                                 if (datatypetotal[typeof globalvariable[key]] === undefined){
  3174.                                         datatypetotal[typeof globalvariable[key]] = 0;
  3175.                                 }
  3176.                                 datatypetotal[typeof globalvariable[key]] += 1;
  3177.                                 if (globalvariable[key] instanceof Array){
  3178.                                         valuelist += "<font color='" + colortype[typeof globalvariable[key]] + "'>[" + helpers.escapehtml("" + globalvariable[key]) + "]</font>" + ", ";
  3179.                                         values.push("[" + globalvariable[key] + "]");
  3180.                                         continue;
  3181.                                 }                      
  3182.                                 valuelist += "<font color='" + colortype[typeof globalvariable[key]] + "'>" + helpers.escapehtml("" + globalvariable[key]) + "</font>" + ", ";
  3183.                                 values.push(globalvariable[key]);
  3184.                         }
  3185.                         valuelist = valuelist.substring(0, valuelist.length-2) + ".</small></b>"               
  3186.                         if (String(values).length > 5000){
  3187.                                 print(values);
  3188.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, because the values content was over 5000 characters long, the values were printed on the server window.</i>", channel);       
  3189.                                 return;        
  3190.                         }      
  3191.                         var getvaluesmessage = border
  3192.                         + "<h2> Variable Values: " + helpers.escapehtml(command[1]) + " [object]</h2>"
  3193.                         + "<br/>"
  3194.                         + valuelist + "<br/>"
  3195.                         + "<br/>";
  3196.                         if (datatypetotal.object != undefined){
  3197.                                 getvaluesmessage += "<b><font color='red'>Total Number of Object Values:</font></b> " + datatypetotal.object + "<br/>";
  3198.                         }
  3199.                         if (datatypetotal["function"] != undefined){
  3200.                                 getvaluesmessage += "<b><font color='blue'>Total Number of Function Values:</font></b> " + datatypetotal["function"] + "<br/>";
  3201.                         }
  3202.                         if (datatypetotal.number != undefined){
  3203.                                 getvaluesmessage += "<b><font color='blueviolet'>Total Number of Number Values:</font></b> " + datatypetotal.number  + "<br/>";
  3204.                         }
  3205.                         if (datatypetotal.string != undefined){
  3206.                                 getvaluesmessage += "<b><font color='green'>Total Number of String Values:</font></b> " + datatypetotal.string + "<br/>";
  3207.                         }
  3208.                         if (datatypetotal["boolean"] != undefined){
  3209.                                 getvaluesmessage += "<b><font color='indigo'>Total Number of Boolean Values:</font></b> " + datatypetotal["boolean"] + "<br/>";
  3210.                         }
  3211.                         getvaluesmessage += "<b>Total Number of Values:</b> " + valuetotal + "<br/>"
  3212.                         + "<br/>"
  3213.                         + "<timestamp/><br/>"
  3214.                         + border;              
  3215.                         sys.sendHtmlMessage(src, getvaluesmessage, channel);
  3216.                 }
  3217.  
  3218.                 ,
  3219.  
  3220.                 getmembers: function(src, channel, command){
  3221.                         if (sys.auth(src) < 3){
  3222.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3223.                                 return;
  3224.                         }
  3225.                         var globalvariable;
  3226.                         try {
  3227.                                 globalvariable = eval("global." + command[1]);
  3228.                         }
  3229.                         catch(error){
  3230.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the members of " + command[1] + " because it is not a valid name for a variable.</i>", channel);
  3231.                                 return;
  3232.                         }
  3233.                         if (globalvariable === null){
  3234.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the members of " + command[1] + " because it contains null.</i>", channel);
  3235.                                 return;
  3236.                         }
  3237.                         var datatype = typeof globalvariable;
  3238.                         if (datatype != "object"){
  3239.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the members of " + command[1] + " because it is not an object.</i>", channel);
  3240.                                 return;
  3241.                         }
  3242.                         var key, members = new Array(), memberslist = "<b><small>", memberstotal = Object.keys(globalvariable).length, colortype = ({"object": "red", "function" : "blue", "number": "blueviolet", "string" : "green", "boolean" : "indigo"}), datatypetotal = new Object();
  3243.                         for (key in globalvariable){
  3244.                                 if (datatypetotal[typeof globalvariable[key]] === undefined){
  3245.                                         datatypetotal[typeof globalvariable[key]] = 0;
  3246.                                 }
  3247.                                 datatypetotal[typeof globalvariable[key]] += 1;
  3248.                                 if (globalvariable[key] instanceof Array){
  3249.                                         memberslist += "<font color='" + colortype[typeof globalvariable[key]] + "'>" + helpers.escapehtml(key + ":[" + globalvariable[key]) + "]</font>" + ", ";
  3250.                                         members.push(key + ": " + "[" + globalvariable[key] + "]");
  3251.                                         continue;
  3252.                                 }                      
  3253.                                 memberslist += "<font color='" + colortype[typeof globalvariable[key]] + "'>" + helpers.escapehtml(key + ": " + globalvariable[key]) + "</font>" + ", ";
  3254.                                 members.push(key + ": " + globalvariable[key]);
  3255.                         }
  3256.                         memberslist = memberslist.substring(0, memberslist.length-2) + ".</small></b>"         
  3257.                         if (String(members).length > 5000){
  3258.                                 print(members);
  3259.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, because the members content was over 5000 characters long, the values were printed on the server window.</i>", channel);      
  3260.                                 return;        
  3261.                         }              
  3262.                         var getmembersmessage = border
  3263.                         + "<h2> Variable Members: " + helpers.escapehtml(command[1]) + " [object]</h2>"
  3264.                         + "<br/>"
  3265.                         + memberslist + "<br/>"
  3266.                         + "<br/>";
  3267.                         if (datatypetotal.object != undefined){
  3268.                                 getmembersmessage += "<b><font color='red'>Total Number of Object Members:</font></b> " + datatypetotal.object + "<br/>";
  3269.                         }
  3270.                         if (datatypetotal["function"] != undefined){
  3271.                                 getmembersmessage += "<b><font color='blue'>Total Number of Function Members:</font></b> " + datatypetotal["function"] + "<br/>";
  3272.                         }
  3273.                         if (datatypetotal.number != undefined){
  3274.                                 getmembersmessage += "<b><font color='blueviolet'>Total Number of Number Members:</font></b> " + datatypetotal.number  + "<br/>";
  3275.                         }
  3276.                         if (datatypetotal.string != undefined){
  3277.                                 getmembersmessage += "<b><font color='green'>Total Number of String Members:</font></b> " + datatypetotal.string + "<br/>";
  3278.                         }
  3279.                         if (datatypetotal["boolean"] != undefined){
  3280.                                 getmembersmessage += "<b><font color='indigo'>Total Number of Boolean Members:</font></b> " + datatypetotal["boolean"] + "<br/>";
  3281.                         }
  3282.                         getmembersmessage += "<b>Total Number of Members:</b> " + memberstotal + "<br/>"
  3283.                         + "<br/>"
  3284.                         + "<timestamp/><br/>"
  3285.                         + border;              
  3286.                         sys.sendHtmlMessage(src, getmembersmessage, channel);
  3287.                 }
  3288.  
  3289.                 ,
  3290.  
  3291.                 getlength: function(src, channel, command){
  3292.                         if (sys.auth(src) < 3){
  3293.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3294.                                 return;
  3295.                         }
  3296.                         var globalvariable;
  3297.                         try {
  3298.                                 globalvariable = eval("global." + command[1]);
  3299.                         }
  3300.                         catch(error){
  3301.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the length of " + command[1] + " because it is not a valid name for a variable.</i>", channel);
  3302.                                 return;
  3303.                         }
  3304.                         var datatype = typeof globalvariable, length;
  3305.                         if (datatype != "string" && datatype != "object" && datatype != "function"){
  3306.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the length of " + command[1] + " because it is not a string, object or function.</i>", channel);
  3307.                                 return;
  3308.                         }
  3309.                         if (globalvariable === null){
  3310.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot get the length of " + command[1] + " because it contains null.</i>", channel);
  3311.                                 return;
  3312.                         }                              
  3313.                         if (datatype === "string" || datatype === "function"){
  3314.                                 length = globalvariable.length;
  3315.                         }
  3316.                         if (datatype === "object"){
  3317.                                 length = Object.keys(globalvariable).length;
  3318.                         }
  3319.                         var getlengthmessage = border
  3320.                         + "<h2> Variable Length: " + helpers.escapehtml(command[1]) + " [" + datatype + "]</h2>"
  3321.                         + length + "<br/>"
  3322.                         + "<br/>"
  3323.                         + "<timestamp/><br/>"
  3324.                         + border;
  3325.                         sys.sendHtmlMessage(src, getlengthmessage, channel);
  3326.                 }
  3327.  
  3328.                 ,
  3329.  
  3330.                 set: function(src, channel, command){
  3331.                         if (sys.auth(src) < 3){
  3332.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3333.                                 return;
  3334.                         }
  3335.                         var globalvariable;
  3336.                         try {
  3337.                                 globalvariable = eval("global." + command[1]);
  3338.                         }
  3339.                         catch(error){
  3340.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot set " + command[1] + " because it is not a valid name for a variable.</i>", channel);
  3341.                                 return;
  3342.                         }
  3343.                         var globalkey = command[1];
  3344.                         command.splice(0,2);
  3345.                         command = command.join("*");
  3346.                         if (command === ""){
  3347.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot save " + globalkey + " because no data has been specified.</i>", channel);
  3348.                                 return;
  3349.                         }
  3350.                         if (globalvariable === undefined){
  3351.                                 try{
  3352.                                         eval("global." + globalkey + "=" + command);
  3353.                                 }
  3354.                                 catch(error){
  3355.                                         sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to set " + globalkey + " because the content could not be parsed.</i>", channel);
  3356.                                         return;
  3357.                                 }
  3358.                                 var srcname = sys.name(src);
  3359.                                 if (variablechanges == "on"){
  3360.                                         sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blueviolet'><b>The global variable: <i>" + globalkey + "</i> was successfully set as <i>" + command + "</i> by " + srcname + "!</b></font><br/>" + border3);
  3361.                                 }
  3362.                                 else {
  3363.                                         sys.sendHtmlMessage(src, border + "<br/><timestamp/><b>The global variable: <i>" + globalkey + "</i> was successfully set as <i>" + command + "</i></b><br/>" + border, channel);                                      
  3364.                                 }
  3365.                                 return;
  3366.                         }
  3367.                         sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot set " + globalkey + " because it is already set.</i>", channel);                                                                                   
  3368.                 }
  3369.  
  3370.                 ,
  3371.  
  3372.                 save: function(src, channel, command){
  3373.                         if (sys.auth(src) < 3){
  3374.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3375.                                 return;
  3376.                         }
  3377.                         var globalvariable;
  3378.                         try {
  3379.                                 globalvariable = eval("global." + command[1]);
  3380.                         }
  3381.                         catch(error){
  3382.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot save " + command[1] + " because it is not a valid name for a variable.</i>", channel);
  3383.                                 return;
  3384.                         }
  3385.                         var globalkey = command[1];
  3386.                         command.splice(0,2);
  3387.                         command = command.join("*");
  3388.                         if (command === ""){
  3389.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot save " + globalkey + " because no data has been specified.</i>", channel);
  3390.                                 return;
  3391.                         }
  3392.                         try{
  3393.                                 eval("global." + globalkey + "=" + command);
  3394.                         }
  3395.                         catch(error){
  3396.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to save " + globalkey + " because the content could not be parsed.</i>", channel);
  3397.                                 return;
  3398.                         }
  3399.                         var srcname = sys.name(src);
  3400.                         if (variablechanges == "on"){
  3401.                                 sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blueviolet'><b>The global variable: <i>" + globalkey + "</i> was successfully saved as <i>" + command + "</i> by " + srcname + "!</b></font><br/>" + border3);
  3402.                         }
  3403.                         else {
  3404.                                 sys.sendHtmlMessage(src, border + "<br/><timestamp/><b>The global variable: <i>" + globalkey + "</i> was successfully saved as <i>" + command + "</i></b><br/>" + border, channel);                                    
  3405.                         }
  3406.                 }
  3407.  
  3408.                 ,
  3409.  
  3410.                 'delete': function(src, channel, command){
  3411.                         if (sys.auth(src) < 3){
  3412.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3413.                                 return;
  3414.                         }
  3415.                         var srcname = sys.name(src);
  3416.                         try {
  3417.                                 var globalvariable = eval("global." + command[1]);
  3418.                         }
  3419.                         catch(error){
  3420.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot delete " + command[1] + " because it is not a valid name for a variable.</i>", channel);
  3421.                                 return;
  3422.                         }
  3423.                         eval("delete global." + command[1]);
  3424.                         if (variablechanges == "on"){
  3425.                                 sys.sendHtmlAll(border3 + "<br/><timestamp/><font color='blueviolet'><b> The global variable: <i>" + command[1] + "</i> was successfully deleted by " + srcname + "!</b></font><br/>" + border3);
  3426.                         }
  3427.                         else {
  3428.                                 sys.sendHtmlMessage(src, border + "<br/><timestamp/><b> The global variable: <i>" + command[1] + "</i> was successfully deleted!</b><br/>" + border, channel);
  3429.                         }                      
  3430.                 }
  3431.  
  3432.                 ,
  3433.  
  3434.                 authlevelname: function (src, channel, command){
  3435.                         if (sys.auth(src) < 3){
  3436.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3437.                                 return;
  3438.                         }
  3439.                         var oldname = command[1].toLowerCase(), newname = command[2].toLowerCase();
  3440.                         if (newname.length > 20){
  3441.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a new name with at most 20 characters.</i>", channel);
  3442.                                 return;
  3443.                         }
  3444.                         for (var commandsindex in commands){
  3445.                                 if (commandsindex == helpers.removespaces(newname)){
  3446.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to change to " + command[2] + " because it is listed as a command.</i>", channel);
  3447.                                         return;
  3448.                                 }
  3449.                         }
  3450.                         var authindex, srcname = sys.name(src);
  3451.                         for (authindex = 0; authindex < 4; authindex++){
  3452.                                 if ((global["AuthLevel" + authindex + "Name"]).toLowerCase() == oldname){
  3453.                                         commands[helpers.removespaces(newname) + "commands"] = commands[helpers.removespaces(oldname) + "commands"];
  3454.                                         delete commands[helpers.removespaces(oldname) + "commands"];
  3455.                                         commands[helpers.removespaces(newname)] = commands[helpers.removespaces(oldname)];
  3456.                                         delete commands[helpers.removespaces(oldname)];
  3457.                                         sys.saveVal("Authority_Options_AuthLevel" + authindex + "Name", command[2]);
  3458.                                         global["AuthLevel" + authindex + "Name"] = command[2];
  3459.                                         sys.sendHtmlAll("<timestamp/><b><font color='blueviolet'>Server Auth Level " + authindex + "'s name has been saved as " + helpers.escapehtml(command[2]).italics() + " by " + srcname + ".</font></b>", 0);
  3460.                                         return;
  3461.                                 }
  3462.                                 if ((global["ChannelAuthLevel" + authindex + "Name"]).toLowerCase() == oldname){
  3463.                                         commands[helpers.removespaces(newname) + "commands"] = commands[helpers.removespaces(oldname) + "commands"];
  3464.                                         delete commands[helpers.removespaces(oldname) + "commands"];
  3465.                                         commands[helpers.removespaces(newname)] = commands[helpers.removespaces(oldname)];
  3466.                                         delete commands[helpers.removespaces(oldname)];
  3467.                                         sys.saveVal("Authority_Options_ChannelAuthLevel" + authindex + "Name", command[2]);
  3468.                                         global["ChannelAuthLevel" + authindex + "Name"] = command[2];
  3469.                                         sys.sendHtmlAll("<timestamp/><b><font color='blueviolet'>Channel Auth Level " + authindex + "'s name has been saved as " + helpers.escapehtml(command[2]).italics() + " by " + srcname + ".</font></b>", 0);
  3470.                                         return;
  3471.                                 }
  3472.                                 if (authindex > 1){
  3473.                                         continue;
  3474.                                 }
  3475.                                 if ((global["TourAuthLevel" + authindex + "Name"]).toLowerCase() == oldname){
  3476.                                         commands[helpers.removespaces(newname) + "commands"] = commands[helpers.removespaces(oldname) + "commands"];
  3477.                                         delete commands[helpers.removespaces(oldname) + "commands"];
  3478.                                         commands[helpers.removespaces(newname)] = commands[helpers.removespaces(oldname)];
  3479.                                         delete commands[helpers.removespaces(oldname)];
  3480.                                         sys.saveVal("Authority_Options_TourAuthLevel" + authindex + "Name", command[2]);
  3481.                                         global["TourAuthLevel" + authindex + "Name"] = command[2];
  3482.                                         sys.sendHtmlAll("<timestamp/><b><font color='blueviolet'>Tournament Auth Level " + authindex + "'s name has been saved as " + helpers.escapehtml(command[2]).italics() + " by " + srcname + ".</font></b>", 0);
  3483.                                         return;
  3484.                                 }
  3485.                                 if ((global["ChannelTourAuthLevel" + authindex + "Name"]).toLowerCase() == oldname){
  3486.                                         commands[helpers.removespaces(newname) + "commands"] = commands[helpers.removespaces(oldname) + "commands"];
  3487.                                         delete commands[helpers.removespaces(oldname) + "commands"];
  3488.                                         commands[helpers.removespaces(newname)] = commands[helpers.removespaces(oldname)];
  3489.                                         delete commands[helpers.removespaces(oldname)];
  3490.                                         sys.saveVal("Authority_Options_ChannelTourAuthLevel" + authindex + "Name", command[2]);
  3491.                                         global["ChannelTourAuthLevel" + authindex + "Name"] = command[2];
  3492.                                         sys.sendHtmlAll("<timestamp/><b><font color='blueviolet'>Channel Tournament Auth Level " + authindex + "'s name has been saved as " + helpers.escapehtml(command[2]).italics() + " by " + srcname + ".</font></b>", 0);
  3493.                                         return;
  3494.                                 }
  3495.                         }
  3496.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not recognised as an auth level.</i>", channel);                 
  3497.                 }
  3498.  
  3499.                 ,
  3500.  
  3501.                 clearauths: function(src, channel, command){
  3502.                         if (sys.auth(src) < 3){
  3503.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3504.                                 return;
  3505.                         }
  3506.                         var auths = sys.dbAuths(), authsindex, srcname = sys.name(src);
  3507.                         for (authsindex in auths){
  3508.                                 var playernumber = sys.id(auths[authsindex]);
  3509.                                 if (playernumber === undefined){
  3510.                                         sys.changeDbAuth(auths[authsindex], 0);
  3511.                                 }
  3512.                                 else {
  3513.                                         sys.changeAuth(playernumber, 0);
  3514.                                 }      
  3515.                         }
  3516.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> All Server Auth has been cleared by " + srcname + ".</b></font>");   
  3517.                 }
  3518.  
  3519.                 ,
  3520.  
  3521.                 cleartourauths: function(src, channel, command){
  3522.                         if (sys.auth(src) < 3){
  3523.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3524.                                 return;
  3525.                         }
  3526.                         var srcname = sys.name(src);
  3527.                         tourauth = new Array();
  3528.                         sys.saveVal("Authority_Options_TourAuthLevel1List", "[]");
  3529.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> All Server Tournament Auth has been cleared by " + srcname + ".</b></font>");
  3530.                 }
  3531.  
  3532.                 ,      
  3533.  
  3534.                 rangeban: function(src, channel, command){
  3535.                         if (sys.auth(src) < 3){
  3536.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3537.                                 return;
  3538.                         }
  3539.                         if (rangebanexlist[command[1]] != undefined){
  3540.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " has already been added to the range ban list.</i>", channel);
  3541.                                 return;                        
  3542.                         }
  3543.                         var iprange = command[1].split(".").join("");
  3544.                         if (isNaN(parseInt(iprange))){
  3545.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you can only include numerals 0-9.</i>", channel);
  3546.                                 return;
  3547.                         }
  3548.                         var banrange = command[1].split(".");
  3549.                         if (banrange.length > 4){
  3550.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " contains more than the necessary 4 octets.</i>", channel);
  3551.                                 return;
  3552.                         }
  3553.                         for (var banrangeindex in banrange){
  3554.                                 if (banrange[banrangeindex].length < 1 && banrangeindex != banrange.length-1){
  3555.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not  a valid i.p. range because it does not contain a value in each octet.</i>", channel);
  3556.                                         return;
  3557.                                 }
  3558.                                 if (Number(banrange[banrangeindex]) > 255 || Number(banrange[banrangeindex]) < 0 ){
  3559.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not  a valid i.p. range because it contains non 8 bit values.</i>", channel);
  3560.                                         return;
  3561.                                 }
  3562.                                 if ((banrange[banrangeindex].length == 2 && Number(banrange[banrangeindex]) < 10) || (banrange[banrangeindex].length == 3 && Number(banrange[banrangeindex]) < 100)){
  3563.                                         banrange[banrangeindex] = String(Number(banrange[banrangeindex]));
  3564.                                 }
  3565.                                 if (((banrange[banrangeindex].length == 1 && Number(banrange[banrangeindex]) > 2) || (banrange[banrangeindex].length == 2 && Number(banrange[banrangeindex]) > 25) || (banrange[banrangeindex].length == 3 && banrange.length != 4)) && banrangeindex == banrange.length-1){
  3566.                                         banrange[banrangeindex] += ".";
  3567.                                 }
  3568.                         }
  3569.                         command[1] = banrange.join(".");
  3570.                         rangebanexlist[command[1]] = new Object();
  3571.                         sys.saveVal("RangeBanEx_List", JSON.stringify(rangebanexlist));
  3572.                         sys.sendHtmlAll("<font color='blueviolet'><timestamp/><b>The I.P Range: " + command[1] + " has been banned by " + sys.name(src) + ".</b></font>" , channel);
  3573.                 }
  3574.  
  3575.                 ,
  3576.  
  3577.                 rangeunban: function (src, channel, command){
  3578.                         if (sys.auth(src) < 3){
  3579.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3580.                                 return;
  3581.                         }
  3582.                         var iprange = command[1].split(".").join("");
  3583.                         if (isNaN(parseInt(iprange))){
  3584.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you can only include numerals 0-9.</i>", channel);
  3585.                                 return;
  3586.                         }
  3587.                         var banrange = command[1].split(".");
  3588.                         if (banrange.length > 4){
  3589.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " contains more than the necessary 4 octets.</i>", channel);
  3590.                                 return;
  3591.                         }
  3592.                         for (var banrangeindex in banrange){
  3593.                                 if (banrange[banrangeindex].length < 1 && banrangeindex != banrange.length-1){
  3594.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not  a valid i.p. range because it does not contain a value in each octet.</i>", channel);
  3595.                                         return;
  3596.                                 }
  3597.                                 if (Number(banrange[banrangeindex]) > 255 || Number(banrange[banrangeindex]) < 0 ){
  3598.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not  a valid i.p. range because it contains non 8 bit values.</i>", channel);
  3599.                                         return;
  3600.                                 }
  3601.                                 if ((banrange[banrangeindex].length == 2 && Number(banrange[banrangeindex]) < 10) || (banrange[banrangeindex].length == 3 && Number(banrange[banrangeindex]) < 100)){
  3602.                                         banrange[banrangeindex] = String(Number(banrange[banrangeindex]));
  3603.                                 }
  3604.                                 if (((banrange[banrangeindex].length == 1 && Number(banrange[banrangeindex]) > 2) || (banrange[banrangeindex].length == 2 && Number(banrange[banrangeindex]) > 25) || (banrange[banrangeindex].length == 3 && banrange.length != 4)) && banrangeindex == banrange.length-1){
  3605.                                         banrange[banrangeindex] += ".";
  3606.                                 }
  3607.                         }
  3608.                         command[1] = banrange.join(".");
  3609.                         if (rangebanexlist[command[1]] == undefined){
  3610.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not on the range ban list.</i>", channel);
  3611.                                 return;                        
  3612.                         }
  3613.                         delete rangebanexlist[command[1]];
  3614.                         sys.saveVal("RangeBanEx_List", JSON.stringify(rangebanexlist));
  3615.                         sys.sendHtmlAll("<font color='blueviolet'><timestamp/><b>The I.P Range: " + command[1] + " has been unbanned by " + sys.name(src) + ".</b></font>" , channel);
  3616.                 }
  3617.  
  3618.                 ,
  3619.  
  3620.                 rangebanlist: function (src, channel, command){
  3621.                         if (sys.auth(src) < 3){
  3622.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3623.                                 return;
  3624.                         }
  3625.                         var rangebanexindex, rangebantable = "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='lavender'><th>I.P. Range</th></tr>";
  3626.                         for (rangebanexindex in rangebanexlist){
  3627.                                 rangebantable += "<tr bgcolor='lavender'><td>" + rangebanexindex + "</td></tr>";
  3628.                         }
  3629.                         rangebantable += "</table>"
  3630.                         sys.sendHtmlMessage(src, border + "<h2>Range Ban List</h2><br/>" + rangebantable + "<br/><br/>" + border, channel);    
  3631.                 }
  3632.  
  3633.                 ,
  3634.  
  3635.                 clearrangebanlist: function(src, channel, command){
  3636.                         if (sys.auth(src) < 3){
  3637.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3638.                                 return;
  3639.                         }
  3640.                         if (Object.keys(rangebanexlist).length == 0){
  3641.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to clear the range ban list because it is currently empty.</i>", channel);
  3642.                                 return;
  3643.                         }
  3644.                         rangebanexlist = new Object();
  3645.                         sys.saveVal("RangeBanEx_List", "{}");
  3646.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b>The server range ban list has been cleared by " + sys.name(src) + ".</b></font>", channel);   
  3647.                 }
  3648.  
  3649.                 ,
  3650.  
  3651.                 silentkick: function (src, channel, command){
  3652.                         if (sys.auth(src) < 3){
  3653.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3654.                                 return;
  3655.                         }
  3656.                         var playernumber = sys.id(command[1]);
  3657.                         if (playernumber === undefined){
  3658.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not currently on the server.</i>", channel);
  3659.                                 return;
  3660.                         }
  3661.                         sys.kick(playernumber);
  3662.                 }
  3663.  
  3664.                 ,
  3665.  
  3666.                 megasilence: function(src, channel, command){
  3667.                         if (sys.auth(src) < 3){
  3668.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3669.                                 return;
  3670.                         }
  3671.                         if (silence == 3){
  3672.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use mega silence because mega silence is in effect.</i>", channel);
  3673.                                 return;
  3674.                         }
  3675.                         silence = 3;
  3676.                         var srcname = sys.name(src); silencer = srcname;
  3677.                         var silencemessage = border3 + "<br/>"
  3678.                         + "<timestamp/><font color='blueviolet'><b>All players below " + AuthLevel3Name + " have been silenced by " + srcname + ".</b></font><br/>"
  3679.                         + border3;
  3680.                         sys.sendHtmlAll(silencemessage);                       
  3681.                 }
  3682.  
  3683.                 ,
  3684.  
  3685.                 deleteplayer: function(src, channel, command){
  3686.                         if (sys.auth(src) < 3){
  3687.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3688.                                 return;
  3689.                         }
  3690.                         if (!helpers.memberscheck(command[1])){
  3691.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " does not exist in the members database.</i>", channel);
  3692.                                 return;
  3693.                         }
  3694.                         var playername = members[command[1].toLowerCase()], srcname = sys.name(src);
  3695.                         sys.dbDelete(playername.toLowerCase());
  3696.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b>" + playername + " has been deleted by " + srcname + " for next start up!</b></font>");
  3697.                 }
  3698.  
  3699.                 ,
  3700.  
  3701.                 clearregchannels: function (src, channel, command){
  3702.                         if (sys.auth(src) < 3){
  3703.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3704.                                 return;
  3705.                         }
  3706.                         if (registeredchannels.length == 0){
  3707.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot clear the registered channels list because no channels have been registered.</i>", channel);
  3708.                                 return;
  3709.                         }
  3710.                         var registeredchannelsindex, srcname = sys.name(src);
  3711.                         for (registeredchannelsindex in registeredchannels){
  3712.                                 if (channelsregistered[registeredchannels[registeredchannelsindex]] != undefined){
  3713.                                         delete channelsregistered[registeredchannels[registeredchannelsindex]];
  3714.                                 }
  3715.                                 sys.removeVal("Registered_Channel_" + registeredchannels[registeredchannelsindex]);
  3716.                         }
  3717.                         registeredchannels = new Array();
  3718.                         sys.saveVal("Channel_Options_RegisteredChannels", "[]");
  3719.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The registered channels list has been cleared by " + srcname + ".</b></font>", 0);
  3720.                 }
  3721.  
  3722.                 ,
  3723.  
  3724.                 regchannelslimit: function (src, channel, command){
  3725.                         if (sys.auth(src) < 3){
  3726.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3727.                                 return;
  3728.                         }
  3729.                         var limit = parseInt(command[1]);
  3730.                         if (isNaN(limit)){
  3731.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a number as the registered channels limit.</i>", channel);
  3732.                                 return;
  3733.                         }
  3734.                         if (limit < registeredchannels.length){
  3735.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot specify a limit less than the current number of registered channels: " + registeredchannels.length + "</i>", channel);
  3736.                                 return;
  3737.                         }
  3738.                         var srcname = sys.name(src);
  3739.                         registeredchannelslimit = limit;
  3740.                         sys.saveVal("Channels_Options_RegisteredChannelsLimit", limit);
  3741.                         sys.sendHtmlAll("<timestamp/><font color='blueviolet'><b> The registered channels limit has been set to " + registeredchannelslimit + " by " + srcname + ".</b></font>", 0);                           
  3742.                 }
  3743.  
  3744.                 ,
  3745.  
  3746.                 ban: function (src, channel, command){
  3747.                         if (sys.auth(src) < 2){
  3748.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3749.                                 return;
  3750.                         }
  3751.                         if (!helpers.memberscheck(command[1])){
  3752.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban " + command[1] + " because they do not exist in the member database.</i>", channel);
  3753.                                 return;
  3754.                         }
  3755.                         var banlist = sys.banList(), trgtname = members[command[1].toLowerCase()], srcname = sys.name(src);
  3756.                         if (banlist.indexOf(command[1].toLowerCase()) != -1){
  3757.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban " + trgtname + "  because they are already banned.</i>", channel);
  3758.                                 return;
  3759.                         }
  3760.                         if (sys.ip(src) === sys.dbIp(trgtname)){
  3761.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban yourself.</i>", channel);
  3762.                                 return;
  3763.                         }
  3764.                         if (sys.auth(src) <= sys.maxAuth(sys.dbIp(trgtname))){
  3765.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban " + trgtname + " because their maximum auth level is not below your current.</i>", channel);
  3766.                                 return;
  3767.                         }
  3768.                         helpers.ban(srcname, trgtname);
  3769.                 }
  3770.  
  3771.                 ,
  3772.  
  3773.                 banbyip : function(src, channel, command){
  3774.                         if (sys.auth(src) < 2){
  3775.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3776.                                 return;
  3777.                         }
  3778.                         var ipdigits = command[1].split(".").join("");
  3779.                         if (isNaN(parseInt(ipdigits))){
  3780.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban by IP address becauses " + command[1] + " contains characters other than numerals 0-9.</i>", channel);
  3781.                                 return;
  3782.                         }
  3783.                         var ip = command[1].split(".");
  3784.                         if (ip.length != 4){
  3785.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban by IP Address because " + command[1] + " does not contain the necessary 4 octets.</i>", channel);
  3786.                                 return;
  3787.                         }
  3788.                         for (var ipindex in ip){
  3789.                                 if (parseInt(ip[ipindex]) < 0 || parseInt(ip[ipindex]) > 255){
  3790.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban by IP address because " + command[1] + " contains non 8-bit values.</i>", channel);
  3791.                                         return;
  3792.                                 }
  3793.                         }
  3794.                         if (antimemberlist[command[1]] === undefined){
  3795.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban by IP address because a name hasn't been recorded for " + command[1] + ".</i>", channel);
  3796.                                 return;
  3797.                         }
  3798.                         var banlist = sys.banList(), trgtname = antimemberlist[command[1]], srcname = sys.name(src);
  3799.                         if (banlist.indexOf(trgtname.toLowerCase()) != -1){
  3800.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban " + trgtname + " by IP address  because they are already banned.</i>", channel);
  3801.                                 return;
  3802.                         }
  3803.                         if (sys.ip(src) == command[1] || srcname == trgtname){
  3804.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban yourself by IP address.</i>", channel);
  3805.                                 return;
  3806.                         }
  3807.                         if (sys.auth(src) <= sys.maxAuth(command[1])){
  3808.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to ban " + trgtname + " by IP Address because their maximum auth level is not below your current.</i>", channel);
  3809.                                 return;
  3810.                         }
  3811.                         helpers.ban(srcname, trgtname, 1);
  3812.                 }
  3813.  
  3814.                 ,
  3815.  
  3816.                 unban: function (src, channel, command){
  3817.                         if (sys.auth(src) < 2){
  3818.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3819.                                 return;
  3820.                         }
  3821.                         if (!helpers.memberscheck(command[1])){
  3822.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to unban " + command[1] + " because they do not exist in the member database.</i>", channel);
  3823.                                 return;
  3824.                         }
  3825.                         var banlist = sys.banList(), banlistindex, srcname = sys.name(src), trgtname = members[command[1].toLowerCase()];
  3826.                         if (banlist.indexOf(trgtname.toLowerCase()) == -1){
  3827.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to unban " + trgtname + " because they are not on the ban list.</i>", channel);
  3828.                                 return;
  3829.                         }
  3830.                         sys.unban(trgtname);
  3831.                         if (banexlist[trgtname] != undefined){
  3832.                                 delete banexlist[trgtname.toLowerCase()];
  3833.                                 sys.saveVal("BanEx_List", JSON.stringify(banexlist));
  3834.                         }
  3835.                         var banexlistindex;
  3836.                         for (banexlistindex in banexlist){
  3837.                                 if (sys.dbIp(banexlistindex) == sys.dbIp(trgtname)){
  3838.                                         delete banexlist[banexlistindex];
  3839.                                         sys.saveVal("BanEx_List", JSON.stringify(banexlist));
  3840.                                 }
  3841.                         }
  3842.                         sys.sendHtmlAll("<timestamp/><font color='#FF6900'><b>" + trgtname + " has been unbanned from the server by " + srcname + "!</b></font>");
  3843.                 }
  3844.  
  3845.                 ,
  3846.  
  3847.                 unbanbyip: function (src, channel, command){
  3848.                         if (sys.auth(src) < 2){
  3849.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3850.                                 return;
  3851.                         }
  3852.                         var ipdigits = command[1].split(".").join("");
  3853.                         if (isNaN(parseInt(ipdigits))){
  3854.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to unban by IP address becauses " + command[1] + " contains characters other than numerals 0-9.</i>", channel);
  3855.                                 return;
  3856.                         }
  3857.                         var ip = command[1].split(".");
  3858.                         if (ip.length != 4){
  3859.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to unban by IP Address because " + command[1] + " does not contain the necessary 4 octets.</i>", channel);
  3860.                                 return;
  3861.                         }
  3862.                         for (var ipindex in ip){
  3863.                                 if (parseInt(ip[ipindex]) < 0 || parseInt(ip[ipindex]) > 255){
  3864.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to unban by IP address because " + command[1] + " contains non 8-bit values.</i>", channel);
  3865.                                         return;
  3866.                                 }
  3867.                         }
  3868.                         if (antimemberlist[command[1]] === undefined){
  3869.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to unban by IP address because a name hasn't been recorded for " + command[1] + ".</i>", channel);
  3870.                                 return;
  3871.                         }
  3872.                         var banlist = sys.banList(), trgtname = antimemberlist[command[1]], srcname = sys.name(src);
  3873.                         if (banlist.indexOf(trgtname.toLowerCase()) == -1){
  3874.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to unban " + trgtname + " by IP address  because they are not on the banlist.</i>", channel);
  3875.                                 return;
  3876.                         }
  3877.                         sys.unban(trgtname);
  3878.                         if (banexlist[trgtname] != undefined){
  3879.                                 delete banexlist[trgtname.toLowerCase()];
  3880.                                 sys.saveVal("BanEx_List", JSON.stringify(banexlist));
  3881.                         }
  3882.                         var banexlistindex;
  3883.                         for (banexlistindex in banexlist){
  3884.                                 if (sys.dbIp(banexlistindex) == sys.dbIp(trgtname)){
  3885.                                         delete banexlist[banexlistindex];
  3886.                                         sys.saveVal("BanEx_List", JSON.stringify(banexlist));
  3887.                                 }
  3888.                         }
  3889.                         sys.sendHtmlAll("<timestamp/><font color='#FF6900'><b>" + trgtname + " has been unbanned by IP address from the server by " + srcname + "!</b></font>");
  3890.                 }
  3891.  
  3892.                 ,
  3893.  
  3894.                 banlist: function (src, channel, command){
  3895.                         if (sys.auth(src) < 2){
  3896.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3897.                                 return;
  3898.                         }
  3899.                         var banlist = sys.banList(), player, banner;
  3900.                         if (banlist.length == 0){
  3901.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, the Ban List is currently empty.</i>", channel);
  3902.                                 return;
  3903.                         }
  3904.                         var bantable = "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='#FF6900'><th>Name</th><th>IP Address</th><th> Banned by </th></tr>"
  3905.                         for (player in banlist){
  3906.                                 banner = "|Unknown|";
  3907.                                 if (banexlist[banlist[player]] != undefined){
  3908.                                         banner = banexlist[banlist[player]].banner;
  3909.                                 }
  3910.                                 bantable += "<tr bgcolor='#FF6900'><td>" + members[banlist[player]] + "</td><td>" + sys.dbIp(banlist[player]) + "</td><td>" + banner + "</td></tr>";
  3911.                         }
  3912.                         bantable += "</table><br/><br/>";
  3913.                         bantable += "<b> Banned Members: </b> " + banlist.length;
  3914.                         sys.sendHtmlMessage(src, border + "<h2>Ban List</h2><br/>" + bantable + "<br/><br/><timestamp/><br/><border>" + border, channel);              
  3915.                 }
  3916.  
  3917.                 ,
  3918.  
  3919.                 clearbanlist: function(src, channel, command){
  3920.                         if (sys.auth(src) < 2){
  3921.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3922.                                 return;
  3923.                         }
  3924.                         var banlist = sys.banList(), player;
  3925.                         if (banlist.length == 0){
  3926.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you cannot clear the banlist because it is currently empty.</i>", channel);
  3927.                                 return;
  3928.                         }
  3929.                         banexlist = new Object();
  3930.                         sys.saveVal("BanEx_List", JSON.stringify(banexlist));
  3931.                         for (player in banlist){
  3932.                                 sys.unban(banlist[player]);
  3933.                         }
  3934.                         sys.sendHtmlAll("<timestamp/><font color='#FF6900'><b>The server ban list has been cleared by " + sys.name(src) + ".</b></font>");     
  3935.                 }
  3936.                
  3937.                 ,
  3938.  
  3939.                 supersilence: function(src, channel, command){
  3940.                         if (sys.auth(src) < 2){
  3941.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3942.                                 return;
  3943.                         }
  3944.                         if (silence == 2){
  3945.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use super silence because super silence is already in effect.</i>", channel);
  3946.                                 return;
  3947.                         }
  3948.                         if (silence == 3 && sys.auth(src) < 3){
  3949.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use super silence because mega silence is in effect.</i>", channel);
  3950.                                 return;
  3951.                         }      
  3952.                         silence = 2;
  3953.                         var srcname = sys.name(src); silencer = srcname;
  3954.                         var silencemessage = border3 + "<br/>"
  3955.                         + "<timestamp/><font color='#FF6900'><b>All players below " + AuthLevel2Name + " have been silenced by " + srcname + ".</b></font><br/>"
  3956.                         + border3;
  3957.                         sys.sendHtmlAll(silencemessage);                       
  3958.                 }
  3959.  
  3960.                 ,
  3961.  
  3962.                 kick: function (src, channel, command){
  3963.                         if (sys.auth(src) < 1){
  3964.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3965.                                 return;
  3966.                         }
  3967.                         var trgt = sys.id(command[1]);
  3968.                         if (trgt === undefined){
  3969.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not currently on the server.</i>", channel);
  3970.                                 return;
  3971.                         }
  3972.                         if (src == trgt){
  3973.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to kick yourself.</i>", channel);
  3974.                                 return;
  3975.                         }
  3976.                         var trgtname = sys.name(trgt);
  3977.                         if (sys.auth(src) <= sys.auth(trgt)){
  3978.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to kick " + trgtname + " because their auth level is not below yours.</i>", channel);
  3979.                                 return;
  3980.                         }
  3981.                         helpers.kick(src, trgt);
  3982.                 }
  3983.  
  3984.                 ,
  3985.  
  3986.                 ipkick: function(src, channel, command){
  3987.                         if (sys.auth(src) < 1){
  3988.                                 helpers.failpermissionmessage(src, channel, command[0]);
  3989.                                 return;
  3990.                         }
  3991.                         var ipdigits = command[1].split(".").join("");
  3992.                         if (isNaN(parseInt(ipdigits))){
  3993.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to kick players of IP address: " + command[1] + " because it contains characters other than numerals 0-9.</i>", channel);
  3994.                                 return;
  3995.                         }
  3996.                         var ip = command[1].split(".");
  3997.                         if (ip.length != 4){
  3998.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to kick players of IP address:  " + command[1] + " because it does not contain the necessary 4 octets.</i>", channel);
  3999.                                 return;
  4000.                         }
  4001.                         for (var ipindex in ip){
  4002.                                 if (parseInt(ip[ipindex]) < 0 || parseInt(ip[ipindex]) > 255){
  4003.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to kick players of IP address: " + command[1] + " because it contains non 8-bit values.</i>", channel);
  4004.                                         return;
  4005.                                 }
  4006.                         }
  4007.                         var srcname = sys.name(src);
  4008.                         if (sys.dbIp(srcname) == command[1]){
  4009.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to IP kick yourself.</i>", channel);
  4010.                                 return;
  4011.                         }
  4012.                         if (sys.auth(src) <= sys.maxAuth(command[1])){
  4013.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to IP kick " + command[1] + " because their maximum auth level is not below your current.</i>", channel);
  4014.                                 return;
  4015.                         }
  4016.                         var aliases = sys.aliases(command[1]), aliasesindex, kickedaliases = new Array(), trgt, trgtname;                              
  4017.                         for (aliasesindex in aliases){
  4018.                                 trgt = sys.id(aliases[aliasesindex]);
  4019.                                 if (trgt != undefined){
  4020.                                         trgtname = members[sys.name(trgt).toLowerCase()]
  4021.                                         kickedaliases.push(trgtname);
  4022.                                         sys.callQuickly("sys.kick(" + trgt + ");", 200);                       
  4023.                                 }
  4024.                         }
  4025.                         if (kickedaliases.length == 0){
  4026.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to IP kick " + command[1] + " because they have no logged-in aliases.</i>", channel);
  4027.                                 return;
  4028.                         }                              
  4029.                         sys.sendHtmlAll("<timestamp/><font color='blue'><b> The following aliases have been IP Kicked by " + srcname + ": " + String(kickedaliases) + ".</b></font>");
  4030.                 }
  4031.  
  4032.                 ,
  4033.  
  4034.                 cp: function(src, channel, command){
  4035.                         if (sys.auth(src) < 1){
  4036.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4037.                                 return;
  4038.                         }
  4039.                         var playername = members[command[1].toLowerCase()];
  4040.                         if (playersonline[src] != undefined){
  4041.                                 playersonline[src].commandassist = "cp";
  4042.                                 playersonline[src].cp = playername
  4043.                         }
  4044.                         if (members[command[1].toLowerCase()] != undefined){
  4045.                                 var playernumber = sys.id(playername), playerip = sys.dbIp(playername), playerips = helpers.ips(command[1]), aliases = sys.aliases(playerip), aliasesindex, laston = sys.dbLastOn(playername), authlevel = sys.dbAuth(command[1]), registered = sys.dbRegistered(command[1]), banlist = sys.banList(), banstatus = "", mutestatus = "";
  4046.                                 var bandesc = "<b><font color='#FF6900'>*ban</font></b> to ban this player.", mutedesc = "<b><font color='blue'>*mute</font></b> to mute this player. ";
  4047.                                 registered = registered === true ? "<b><font color='green'>Yes</font></b>": "<b><font color='red'>No</font></b>";
  4048.                                 for (aliasesindex in aliases){
  4049.                                         aliases[aliasesindex] = members[aliases[aliasesindex]];
  4050.                                 }
  4051.                                 for (var banlistindex in banlist){
  4052.                                         if (command[1].toLowerCase() == banlist[banlistindex]){
  4053.                                                 var bannedplayer = banlist[banlistindex];
  4054.                                         }
  4055.                                 }
  4056.                                 if (playername.toLowerCase() == bannedplayer && playernumber == undefined){
  4057.                                         banstatus = "<font color='red'> [Banned Player] </font>";
  4058.                                         bandesc = "<b><font color='#FF6900'>*unban</font></b> to unban this player.";
  4059.                                 }
  4060.                                 if (helpers.mutecheck(playername)){
  4061.                                         mutestatus = "<font color='blue'> [Muted Player] </font>";
  4062.                                         mutedesc = "<b><font color='blue'>*unmute</font></b> to unmute this player. "
  4063.                                 }
  4064.                                 var cpmessage = border4 + "<br/>"
  4065.                                 + border
  4066.                                 + "<h2>Control Panel" + mutestatus + banstatus + "</h2>"
  4067.                                 + "<b>Name:</b>"
  4068.                                 + helpers.connectstatus(playername) + "<br/>"
  4069.                                 + "<b>Aliases:</b><br/>"
  4070.                                 + aliases + "<br/>"
  4071.                                 + "<b>Authority:</b><br/>"
  4072.                                 + "\u2022  " + global["AuthLevel" + authlevel + "Name"] + "<br/>"
  4073.                                 + "<b>IP Address:</b><br/>"
  4074.                                 + "\u2022  " + playerip + "<br/>"
  4075.                                 + "<b>IP Aliases:</b><br/>"
  4076.                                 + "\u2022  " + String(playerips).replace(/,/g, ", ") + "<br/>"
  4077.                                 + "<b>Name Registered:</b><br/>"
  4078.                                 + "\u2022  " + registered + "<br/>"
  4079.                                 + "<b>Last Appearance:</b><br/>"
  4080.                                 + "\u2022  " + laston + "<br/><br/>"
  4081.                                 + "<b>Type:</b> <b><font color='blue'>*kick</font></b> to kick this player." + mutedesc + bandesc + "<br/>"
  4082.                                 +       "\u2022 <b><font color='gray'>*tempmute</font></b> to tempmute this player. <b><font color='gray'>*tempban</font></b> to tempban this player.<br/>"
  4083.                                 + "\u2022 <b><font color='blue'>*ipkick</font></b> to kick all logged-in aliases of this player. <b><font color='blueviolet'>*clearpass</font></b> to clear their password.<br/>"
  4084.                                 + "\u2022 <b><font color='blue'>**name</font></b> to lookup <b>name</b> in the control panel. <b><font color='blue'>*exit</font></b> to exit the Control Panel.<br/>"
  4085.                                 + "<br/>"
  4086.                                 + "<timestamp/><br/>"
  4087.                                 + border;
  4088.                                 sys.sendHtmlMessage(src, cpmessage, channel);
  4089.                                 return;
  4090.                         }
  4091.                         var defined = command[1] + " could not ";
  4092.                         if (command[1] == "undefined"){
  4093.                                 defined = "you did not specify a name to ";
  4094.                         }
  4095.                         var uncpmessage = border4 + "<br/>"
  4096.                         + border + "<br/>"
  4097.                         + "<timestamp/><i>Sorry, " + defined + " be found in the member database.</i><br/>"
  4098.                         + "<b>Type: <i>**name</i> to lookup <i>name</i> in the control panel; </b><b><i>*exit</i> to exit this mode.</b><br/>"
  4099.                         + border;
  4100.                         sys.sendHtmlMessage(src, uncpmessage, channel);
  4101.                 }
  4102.  
  4103.                 ,
  4104.  
  4105.                 getaliases: function (src, channel, command){
  4106.                         if (sys.auth(src) < 1){
  4107.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4108.                                 return;
  4109.                         }
  4110.                         var ipdigits = command[1].split(".").join("");
  4111.                         if (isNaN(parseInt(ipdigits))){
  4112.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to obtain aliases becauses " + command[1] + " contains characters other than numerals 0-9.</i>", channel);
  4113.                                 return;
  4114.                         }
  4115.                         var ip = command[1].split(".");
  4116.                         if (ip.length != 4){
  4117.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to obtain aliases because " + command[1] + " does not contain the necessary 4 octets.</i>", channel);
  4118.                                 return;
  4119.                         }
  4120.                         for (var ipindex in ip){
  4121.                                 if (parseInt(ip[ipindex]) < 0 || parseInt(ip[ipindex]) > 255){
  4122.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to obtain aliases because " + command[1] + " contains non 8-bit values.</i>", channel);
  4123.                                         return;
  4124.                                 }
  4125.                         }
  4126.                         if (!helpers.ipcheck(command[1])){
  4127.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to obtain aliases because they haven't been recorded for " + command[1] + ".</i>", channel);
  4128.                                 return;
  4129.                         }
  4130.                         var aliasesindex, aliases = iplist[command[1]], aliaseslist = new Array();
  4131.                         for (aliasesindex in aliases){
  4132.                                 aliaseslist[aliasesindex] = members[aliases[aliasesindex]];
  4133.                         }
  4134.                         var getaliasesdisplay = border
  4135.                         + "<h2> Aliases for " + command[1] + "</h2>"
  4136.                         + String(aliaseslist).replace(/,/g, ", ") + "." + "<br/>"
  4137.                         + "<br/>"
  4138.                         + "<b>Latest Alias:</b> " + antimemberlist[command[1]] + "<br/>"
  4139.                         + "<br/>"
  4140.                         + "<timestamp/><br/>"
  4141.                         + border;
  4142.                         sys.sendHtmlMessage(src, getaliasesdisplay, channel);
  4143.                 }
  4144.  
  4145.                 ,
  4146.  
  4147.                 getips: function (src, channel, command){
  4148.                         if (sys.auth(src) < 1){
  4149.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4150.                                 return;
  4151.                         }
  4152.                         if (!helpers.memberscheck(command[1])){
  4153.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to get IP addresses for " + command[1] + " because they do not exist in the member database.</i>", channel);
  4154.                                 return;
  4155.                         }
  4156.                         if (!helpers.aliascheck(command[1])){
  4157.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to obtain IP addresses because they haven't been recorded for " + command[1] + ".</i>", channel);
  4158.                                 return;
  4159.                         }
  4160.                         var ipsindex, ips = aliaslist[command[1].toLowerCase()], ipslist = new Array();
  4161.                         for (ipsindex in ips){
  4162.                                 ipslist[ipsindex] = ips[ipsindex];
  4163.                         }
  4164.                         var getipsdisplay = border
  4165.                         + "<h2> IP Addresses for " + members[command[1].toLowerCase()] + "</h2>"
  4166.                         + String(ipslist).replace(/,/g, ", ") + "<br/>"
  4167.                         + "<br/>"
  4168.                         + "<b>Latest IP address:</b> " + sys.dbIp(command[1]) + "<br/>"
  4169.                         + "<br/>"
  4170.                         + "<timestamp/><br/>"
  4171.                         + border;
  4172.                         sys.sendHtmlMessage(src, getipsdisplay, channel);
  4173.                 }
  4174.  
  4175.                 ,
  4176.  
  4177.                 mute: function (src, channel, command){
  4178.                         if (sys.auth(src) < 1){
  4179.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4180.                                 return;
  4181.                         }
  4182.                         if (!helpers.memberscheck(command[1])){
  4183.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " does not exist in the member database.</i>", channel);
  4184.                                 return;
  4185.                         }
  4186.                         var trgtname = command[1].toLowerCase();
  4187.                         if (muteexlist[trgtname] != undefined){
  4188.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is already muted.</i>", channel);           
  4189.                                 return;
  4190.                         }
  4191.                         var trgtip = sys.dbIp(command[1]);
  4192.                         if (sys.ip(src) === sys.dbIp(command[1])){
  4193.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to mute yourself.</i>", channel);
  4194.                                 return;
  4195.                         }
  4196.                         if (sys.auth(src) <= sys.maxAuth(trgtip)){
  4197.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to mute " + command[1] + " because their maximum auth level is not below your current.</i>", channel);
  4198.                                 return;
  4199.                         }
  4200.                         muteexlist[trgtname] = new Object();
  4201.                         muteexlist[trgtname].ip = trgtip;
  4202.                         mutedips[trgtip] = true;
  4203.                         sys.saveVal("MuteEx_List", JSON.stringify(muteexlist));
  4204.                         sys.sendHtmlAll("<timestamp/><font color='blue'><b>" + members[trgtname] + " has been muted by " + sys.name(src) + ".</b></font>");
  4205.                 }
  4206.  
  4207.                 ,
  4208.  
  4209.                 unmute: function (src, channel, command){
  4210.                         if (sys.auth(src) < 1){
  4211.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4212.                                 return;
  4213.                         }
  4214.                         var trgtname = command[1].toLowerCase(), srcname = sys.name(src);
  4215.                         if (!helpers.mutecheck(trgtname)){
  4216.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot unmute " + command[1] + " because they are not muted.</i>", channel);
  4217.                                 return;
  4218.                         }
  4219.                         if (srcname.toLowerCase() == trgtname){
  4220.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot unmute yourself.</i>", channel);
  4221.                                 return;
  4222.                         }
  4223.                         if (muteexlist[trgtname] != undefined){
  4224.                                 delete muteexlist[trgtname];
  4225.                         }
  4226.                         var trgtip = sys.dbIp(trgtname), muteexindex;
  4227.                         for (muteexindex in muteexlist){
  4228.                                 if (muteexlist[muteexindex].ip == trgtip){
  4229.                                         delete muteexlist[muteexindex];
  4230.                                 }
  4231.                         }
  4232.                         delete mutedips[trgtip];
  4233.                         sys.saveVal("MuteEx_List", JSON.stringify(muteexlist));
  4234.                         sys.sendHtmlAll("<timestamp/><font color='blue'><b>" + members[trgtname] + " has been unmuted by " + sys.name(src) + ".</b></font>");          
  4235.                 }
  4236.  
  4237.                 ,
  4238.  
  4239.                 mutelist: function(src, channel, command){
  4240.                         if (sys.auth(src) < 1){
  4241.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4242.                                 return;
  4243.                         }
  4244.                         var mutetable = "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='sky blue'><th>Name</th><th>Name Status</th><th>I.P.</th><th>I.P. Status</th><th>Muted By</th><th>Reason</th><th>Muted At</th><th>Mute Duration</th><th>Auto-Unmute At</th><th>Time Left</th></tr>", muteexindex;
  4245.                         for (muteexindex in muteexlist){
  4246.                                 var nameloggedin = sys.id(muteexindex) === undefined ? "<font color='red'><b>Offline</b></font>" : "<font color='green'><b>Online</b></font>";
  4247.                                 var aliases = sys.aliases(muteexlist[muteexindex].ip), aliasesindex, iploggedin = "<font color='red'><b>Offline</b></font>";
  4248.                                 for (aliasesindex in aliases){
  4249.                                         if (sys.id(aliases[aliasesindex]) != undefined){
  4250.                                                 iploggedin = "<font color='green'><b>Online</b></font>";
  4251.                                         }
  4252.                                 }
  4253.                                 mutetable += "<tr bgcolor='sky blue'><td>" + muteexindex + "</td><td>" + nameloggedin + "<td>" + muteexlist[muteexindex].ip + "</td><td>" + iploggedin + "</td><td>Unknown</td><td>Unknown</td><td>Unknown</td><td>Indefinite</td><td>Unknown</td><td>Unknown</td></tr>";
  4254.                         }
  4255.                         mutetable += "</table>"
  4256.                         sys.sendHtmlMessage(src, border + "<h2>Mute List</h2><br/>" + mutetable + "<br/><br/>" + border, channel);     
  4257.                 }
  4258.  
  4259.                 ,
  4260.  
  4261.                 clearmutelist: function(src, channel, command){
  4262.                         if (sys.auth(src) < 1){
  4263.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4264.                                 return;
  4265.                         }
  4266.                         if (Object.keys(muteexlist).length == 0){
  4267.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot clear the server mute list because it is currently empty.</i>", channel);
  4268.                                 return;
  4269.                         }
  4270.                         var srcname = sys.name(src);
  4271.                         if (helpers.mutecheck(srcname.toLowerCase())){
  4272.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot clear the server mute list because you are on it.</i>", channel);
  4273.                                 return;
  4274.                         }              
  4275.                         muteexlist = new Object();
  4276.                         sys.saveVal("MuteEx_List", "{}");
  4277.                         sys.sendHtmlAll("<timestamp/><font color='blue'><b>The server mute list has been cleared by " + srcname + ".</b></font>");     
  4278.                 }
  4279.  
  4280.                 ,
  4281.  
  4282.                 silence: function(src, channel, command){
  4283.                         if (sys.auth(src) < 1){
  4284.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4285.                                 return;
  4286.                         }
  4287.                         if (silence == 1){
  4288.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use silence because silence is already in effect.</i>", channel);
  4289.                                 return;
  4290.                         }
  4291.                         if (silence == 2 && sys.auth(src) < 2){
  4292.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use silence because super silence is in effect.</i>", channel);
  4293.                                 return;
  4294.                         }
  4295.                         if (silence == 3 && sys.auth(src) < 3){
  4296.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use silence because mega silence is in effect.</i>", channel);
  4297.                                 return;
  4298.                         }                                      
  4299.                         silence = 1;
  4300.                         var srcname = sys.name(src); silencer = srcname;
  4301.                         var silencemessage = border3 + "<br/>"
  4302.                         + "<timestamp/><font color='blue'><b>All players below " + AuthLevel1Name + " have been silenced by " + srcname + ".</b></font><br/>"
  4303.                         + border3;
  4304.                         sys.sendHtmlAll(silencemessage);                       
  4305.                 }
  4306.  
  4307.                 ,
  4308.  
  4309.                 unsilence: function(src, channel, command){
  4310.                         if (sys.auth(src) < 1){
  4311.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4312.                                 return;
  4313.                         }
  4314.                         if (silence == 0){
  4315.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use un-silence because no silence is in effect.</i>", channel);
  4316.                                 return;                        
  4317.                         }
  4318.                         if (silence == 2 && sys.auth(src) < 2){
  4319.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use un-silence because super silence is in effect.</i>", channel);
  4320.                                 return;
  4321.                         }
  4322.                         if (silence == 3 && sys.auth(src) < 3){
  4323.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot use un-silence because mega silence is in effect.</i>", channel);
  4324.                                 return;
  4325.                         }
  4326.                         var srcname = sys.name(src), authcolor = (function(authlevel){return ({3: "blueviolet" , 2: "#FF6900" , 1: "blue"       }[authlevel]);}).call(null, silence);
  4327.                         silence = 0;
  4328.                         var unsilencemessage = border3 + "<br/>"
  4329.                         + "<timestamp/><font color='" + authcolor + "'><b>The server has been unsilenced by " + srcname + ".</b></font><br/>"
  4330.                         + border3;
  4331.                         sys.sendHtmlAll(unsilencemessage);                     
  4332.                        
  4333.                 }
  4334.  
  4335.                 ,
  4336.  
  4337.                 wall: function (src, channel, command) {
  4338.                         if (sys.auth(src) < 1){
  4339.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4340.                                 return;
  4341.                         }
  4342.                         command.splice(0,1);
  4343.                         command = command.join("*");
  4344.                         var srcname = sys.name(src), bordermessage1 = border3 + "<br/>", bordermessage2 = "<br/>" + border3, wallmessage = srcname + ": " + command;
  4345.                         if (sys.auth(src) < silence){
  4346.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  4347.                                 return;
  4348.                         }
  4349.                         if (helpers.mutecheck(srcname) == true){
  4350.                                 helpers.mutemessage(src, channel);
  4351.                                 return;
  4352.                         }      
  4353.                         sys.sendHtmlAll(bordermessage1);
  4354.                         sys.sendAll(wallmessage);
  4355.                         sys.sendHtmlAll(bordermessage2);
  4356.                 }
  4357.  
  4358.                 ,
  4359.  
  4360.                 htmlwall: function (src, channel, command) {
  4361.                         if (sys.auth(src) < 1){
  4362.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4363.                                 return;
  4364.                         }
  4365.                         if (sys.auth(src) < silence){
  4366.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  4367.                                 return;
  4368.                         }
  4369.                         var srcname = sys.name(src);
  4370.                         if (helpers.mutecheck(srcname) == true){
  4371.                                 helpers.mutemessage(src, channel);
  4372.                                 return;
  4373.                         }      
  4374.                         var color = helpers.namecolor(src);
  4375.                         command.splice(0,1);
  4376.                         command = command.join("*");
  4377.                         var htmlwallmessage = border3 + "<br/>"
  4378.                         + "<br/>"
  4379.                         + "<font color=" + color + "><timestamp />+<b><i>" + srcname + ": </i></b></font>" + command + "<br/>"
  4380.                         + "<br/>"
  4381.                         + border3;
  4382.                         sys.sendHtmlAll(htmlwallmessage);
  4383.                 }
  4384.  
  4385.                 ,
  4386.                
  4387.                 flip: function(src, channel) {
  4388.                         sys.sendHtmlAll("<font color='green'><timestamp/>+<b><i>Booty-Bot: </i></b></font><font color='blue'>" + sys.name(src) + "</font> has used the <font color='blue'>Flip</font> command.<br></b>........................./´¯/)<br>......................,/¯..//<br>...................../..../ /<br>............./´¯/'...'/´¯¯`·¸<br>........../'/.../..../......./¨¯\\<br>........('(...´(..´......,~/'...')<br>.........\\.................\\/..../<Br>..........''...\\.......... _.·´<br>............\\..............(<br>..............\\.............\\", channel);
  4389.                 }
  4390.                
  4391.                 ,
  4392.                
  4393.                 changename: function(src, channel, command) {
  4394.                         if (sys.auth(src) < 1) {
  4395.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4396.                                 return;
  4397.                         }
  4398.                         if (command[1] == "Server") {
  4399.                                 sys.sendHtmlMessage(src, "<timestamp/><i>You don't have permission to change this user's name to that of the Server Host.</i>", channel);
  4400.                                 return;
  4401.                         }
  4402.                         if (command[1].length > 16) {
  4403.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a name with at most 16 characters.</i>", channel);
  4404.                                 return;
  4405.                         }
  4406.                         var tar = sys.id(command[1]);
  4407.                         var tarname = sys.name(tar);
  4408.                         if (command[2] == "undefined") sys.changeName(tar, "");
  4409.                         else sys.changeName(tar, command[2]);
  4410.                         sys.sendHtmlAll("<timestamp/><font color='blue'><b>" + sys.name(src) + " has changed " + tarname + "'s name to " + helpers.escapehtml(command[2]) + ".</b></font>", channel);
  4411.                 }
  4412.                
  4413.                 ,
  4414.  
  4415.                 superimp: function(src, channel, command){
  4416.                         if (sys.auth(src) < 1){
  4417.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4418.                                 return;
  4419.                         }
  4420.                         if (sys.auth(src) < 3 && command[1] == "Server"){
  4421.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you do not have permission to super-impersonate the Server Host.</i>", channel);
  4422.                                 return;                        
  4423.                         }
  4424.                         if (command[1].length > 16){
  4425.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a name with at most 16 characters.</i>", channel);
  4426.                                 return;
  4427.                         }
  4428.                         var srcname = sys.name(src);
  4429.                         if (command[1] == "undefined") sys.changeName(src, "");
  4430.                         else sys.changeName(src, command[1]);
  4431.                         sys.sendHtmlAll("<timestamp/><font color='blue'><b>" + srcname + " has super-impersonated " + helpers.escapehtml(command[1]) + "!</b></font>");
  4432.                 }
  4433.  
  4434.                 ,
  4435.  
  4436.                 superimpoff: function(src, channel, command){
  4437.                         if (sys.auth(src) < 1){
  4438.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4439.                                 return;
  4440.                         }
  4441.                         var srcname = sys.name(src);
  4442.                         if (playersonline === undefined){
  4443.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[0] + " does not appear available.</i>", channel);
  4444.                                 return;
  4445.                         }
  4446.                         if (playersonline[src] === undefined){
  4447.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[0] + " will not be available until you next log on.</i>", channel);
  4448.                                 return;
  4449.                         }
  4450.                         if (playersonline[src].name === undefined){
  4451.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[0] + " will not be available until you next log on.</i>", channel);
  4452.                                 return;
  4453.                         }
  4454.                         srcname = playersonline[src].name;
  4455.                         sys.changeName(src, srcname);
  4456.                         sys.sendHtmlAll("<timestamp/><font color='blue'><b>" + srcname + " has turned superimp off!</b></font>");              
  4457.                 }
  4458.  
  4459.                 ,
  4460.  
  4461.                 idle: function (src, channel, command){
  4462.                         if (sys.away(src)){
  4463.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to set status to idle because you are already idling.</i>", channel);
  4464.                                 return;
  4465.                         }
  4466.                         sys.changeAway(src, true);
  4467.                 }
  4468.  
  4469.                 ,
  4470.  
  4471.                 goback: function (src, channel, command){
  4472.                         if (!sys.away(src)){
  4473.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to go back because your status is already set to active.</i>", channel);
  4474.                                 return;
  4475.                         }
  4476.                         sys.changeAway(src, false);
  4477.                 }
  4478.  
  4479.                 ,
  4480.                
  4481.                 forceback: function(src, channel, command) {
  4482.                         if (sys.auth(src) < 1) {
  4483.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4484.                                 return;
  4485.                         }
  4486.                         if (!sys.away(sys.id(command[1]))) {
  4487.                                 sys.sendHtmlMessage(src, "<timestamp/><i> This player is already active.</i>", channel);
  4488.                                 return;
  4489.                         }
  4490.                         if (sys.id(command[1]) == "") {
  4491.                                 sys.sendHtmlMessage(src, "<timestamp/><i> That user does not exist.</i>", channel);
  4492.                                 return;
  4493.                         }
  4494.                         sys.changeAway(sys.id(command[1]), false);
  4495.                         sys.sendHtmlAll("<timestamp/><b><font color='blue'>" + sys.name(sys.id(command[1])) + " was forced back by " + sys.name(src) + ".</font></b>");
  4496.                 }
  4497.                
  4498.                 ,
  4499.  
  4500.                 forceaway: function(src, channel, command) {
  4501.                         if (sys.auth(src) < 1) {
  4502.                                 helpers.failpermissionmessage(src, channel, command[0]);
  4503.                                 return;
  4504.                         }
  4505.                         if (sys.away(sys.id(command[1]))) {
  4506.                                 sys.sendHtmlMessage(src, "<timestamp/><i> This player is already away.</i>", channel);
  4507.                                 return;
  4508.                         }
  4509.                         if (sys.id(command[1]) == "") {
  4510.                                 sys.sendHtmlMessage(src, "<timestamp/><i> That user does not exist.</i>", channel);
  4511.                                 return;
  4512.                         }
  4513.                         sys.changeAway(sys.id(command[1]), true);
  4514.                         sys.sendHtmlAll("<timestamp/><b><font color='blue'>" + sys.name(sys.id(command[1])) + " was forced to go away by " + sys.name(src) + ".</font></b>");
  4515.                 }
  4516.                
  4517.                 ,
  4518.                
  4519.                 changetier: function (src, channel, command){
  4520.                         var tiers = sys.getTierList(), tiersindex, tier;
  4521.                         for (tiersindex in tiers){
  4522.                                 if (tiers[tiersindex].toLowerCase() == command[1].toLowerCase()){
  4523.                                         tier = tiers[tiersindex];
  4524.                                 }
  4525.                         }
  4526.                         if (tier === undefined){
  4527.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to change tiers because " + command[1] + " does not exist as a tier.</i>", channel);
  4528.                                 return;                        
  4529.                         }
  4530.                         if (!sys.hasLegalTeamForTier(src, tier)){
  4531.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, your team isn't valid for " + tier + ".</i>", channel);
  4532.                                 return;                        
  4533.                         }
  4534.                         sys.changeTier(src, tier);
  4535.                         var changetiermessage = border + "<br/>"
  4536.                         + "<timestamp/><b> Your tier was successfully changed to " + tier + "!</b><br/>"
  4537.                         + border;
  4538.                         sys.sendHtmlMessage(src, changetiermessage, channel);
  4539.                 }
  4540.  
  4541.                 ,
  4542.  
  4543.                 changeavatar: function (src, channel, command){
  4544.                         sys.changeAvatar(src, command[1]);
  4545.                         var changeavatarmessage = border + "<br/>"
  4546.                         + "<timestamp/><b> Your avatar was successfully changed to <img src='Themes/Classic/Trainer Sprites/" + command[1] + ".png'></b><br/>"
  4547.                         + border;
  4548.                         sys.sendHtmlMessage(src, changeavatarmessage, channel);
  4549.                 }
  4550.  
  4551.                 ,
  4552.  
  4553.                 changeinfo: function (src, channel, command){
  4554.                         sys.changeInfo(src, command[1]);
  4555.                         var changeinfomessage = border + "<br/>"
  4556.                         + "<timestamp/><b> Your trainer information was successfully changed to:</b><br/>"
  4557.                         + helpers.escapehtml(command[1]) + "<br/>"
  4558.                         + border;
  4559.                         sys.sendHtmlMessage(src, changeinfomessage, channel);
  4560.                 }
  4561.  
  4562.                 ,
  4563.  
  4564.                 unregister: function (src, channel, command){
  4565.                         var srcname = sys.name(src);
  4566.                         if (!sys.dbRegistered(srcname)){
  4567.                                 sys.sendHtmlMessage(src, "<timestamp/><i> Sorry, you are unable to clear your password because you do not have one set.</i>", channel);
  4568.                                 return;
  4569.                         }
  4570.                         sys.clearPass(srcname);
  4571.                         sys.sendHtmlMessage(src, border + "<br/><timestamp/><b> The password for your name has successfully been cleared!</b><br/>" + border, channel);
  4572.                 }
  4573.  
  4574.                 ,
  4575.  
  4576.                 disconnect: function(src, channel, command){
  4577.                         sys.kick(src);
  4578.                 }
  4579.  
  4580.                 ,
  4581.  
  4582.                 mp: function(src, channel, command){
  4583.                         var srcip = sys.ip(src), srcname = sys.name(src), srcips = helpers.ips(srcname), aliases = sys.aliases(srcip), aliasesindex, authlevel = sys.dbAuth(srcname), registered = sys.dbRegistered(srcname), mutestatus = "";
  4584.                         registered = registered === true ? "<b><font color='green'>Yes</font></b>": "<b><font color='red'>No</font></b>";
  4585.                         for (aliasesindex in aliases){
  4586.                                 aliases[aliasesindex] = members[aliases[aliasesindex]];
  4587.                         }
  4588.                         if (helpers.mutecheck(srcname)){
  4589.                                 mutestatus = "<font color='blue'> [Muted] </font>";
  4590.                         }
  4591.                         var mpmessage = border
  4592.                         + "<h2>My Panel" + mutestatus + "</h2>"
  4593.                         + "<b>Name:</b>"
  4594.                         + helpers.connectstatus(srcname) + "<br/>"
  4595.                         + "<b>Aliases:</b><br/>"
  4596.                         + aliases + "<br/>"
  4597.                         + "<b>Authority:</b><br/>"
  4598.                         + "\u2022 " + global["AuthLevel" + authlevel + "Name"] + "<br/>"
  4599.                         + "<b>IP Address:</b><br/>"
  4600.                         + "\u2022 " + srcip + "<br/>"
  4601.                         + "<b>IP Aliases:</b><br/>"
  4602.                         + "\u2022 " + String(srcips).replace(/,/g, ", ") + "<br/>"
  4603.                         + "<b>Name Registered:</b><br/>"
  4604.                         + "\u2022 " + registered + "<br/>"
  4605.                         + "<br/>"
  4606.                         + "<b>Type:</b> <b><font color='red'>/disconnect</font></b> to disconnect yourself.<b><font color='red'> /unregister</font></b> to clear your password.<br/>"
  4607.                         + "<br/>"
  4608.                         + "<timestamp/><br/>"
  4609.                         + border;
  4610.                         sys.sendHtmlMessage(src, mpmessage, channel);
  4611.                 }
  4612.  
  4613.                 ,
  4614.  
  4615.                 myaliases: function (src, channel, command){
  4616.                         var srcip = sys.ip(src);
  4617.                         if (!helpers.ipcheck(srcip)){
  4618.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to obtain any aliases because they haven't been recorded for your IP address.</i>", channel);
  4619.                                 return;
  4620.                         }
  4621.                         var aliasesindex, aliases = iplist[srcip], aliaseslist = new Array();
  4622.                         for (aliasesindex in aliases){
  4623.                                 aliaseslist[aliasesindex] = members[aliases[aliasesindex]];
  4624.                         }
  4625.                         var myaliasesdisplay = border
  4626.                         + "<h2>My Aliases</h2>"
  4627.                         + String(aliaseslist).replace(/,/g, ", ") + "." + "<br/>"
  4628.                         + "<br/>"
  4629.                         + "<b>Latest Alias:</b> " + antimemberlist[srcip] + "<br/>"
  4630.                         + "<br/>"
  4631.                         + "<timestamp/><br/>"
  4632.                         + border;
  4633.                         sys.sendHtmlMessage(src, myaliasesdisplay, channel);
  4634.                 }
  4635.  
  4636.                 ,
  4637.  
  4638.                 myips: function (src, channel, command){
  4639.                         var srcname = sys.name(src);
  4640.                         if (!helpers.aliascheck(srcname)){
  4641.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to obtain IP addresses for your alias because they haven't been recorded.</i>", channel);
  4642.                                 return;
  4643.                         }
  4644.                         var ipsindex, ips = aliaslist[srcname.toLowerCase()], ipslist = new Array();
  4645.                         for (ipsindex in ips){
  4646.                                 ipslist[ipsindex] = ips[ipsindex];
  4647.                         }
  4648.                         var myipsdisplay = border
  4649.                         + "<h2> My IP Addresses</h2>"
  4650.                         + String(ipslist).replace(/,/g, ", ") + "<br/>"
  4651.                         + "<br/>"
  4652.                         + "<b>Latest IP address:</b> " + sys.ip(src) + "<br/>"
  4653.                         + "<br/>"
  4654.                         + "<timestamp/><br/>"
  4655.                         + border;
  4656.                         sys.sendHtmlMessage(src, myipsdisplay, channel);
  4657.                 }
  4658.  
  4659.                 ,
  4660.  
  4661.                 team: function(src, channel, command){
  4662.                         helpers.exportteam(src, src, channel);
  4663.                 }
  4664.  
  4665.                 ,
  4666.  
  4667.                 rankings: function (src, channel, command){
  4668.                         var playername;
  4669.                         if (command[1] === "undefined"){
  4670.                                 playername = sys.name(src);
  4671.                         }
  4672.                         else {
  4673.                                 if (!helpers.memberscheck(command[1])){
  4674.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " does not exist in the members database.</i>", channel);
  4675.                                         return;                        
  4676.                                 }
  4677.                                 playername = members[command[1].toLowerCase()];
  4678.                         }
  4679.                         var rankingsmessage = border
  4680.                         + "<h2>Rankings of " + playername + "</h2>"
  4681.                         + "<br/>"
  4682.                         + "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='aquamarine'><th>Tier</th><th>Ranking</th><th>Out Of</th><th>Rating</th><th>No. of Battles</th></tr>";
  4683.                         var tiers = sys.getTierList();
  4684.                         for (var tiersindex in tiers){
  4685.                                 var ranking = sys.ranking(playername, tiers[tiersindex]);
  4686.                                 ranking = isNaN(ranking) ? "unranked" : ranking
  4687.                                 var rating = sys.id(playername) != undefined ? sys.ladderRating(sys.id(playername), tiers[tiersindex]) : "Cannot be determined";
  4688.                                 rankingsmessage+= "<tr bgcolor='aquamarine'><td>" + tiers[tiersindex] + "</td><td>" + ranking + "</td><td>" + sys.totalPlayersByTier(tiers[tiersindex]) + "</td><td>" + rating + "</td><td>" + sys.ratedBattles(playername, tiers[tiersindex]) + "</td></tr>"
  4689.                         }
  4690.                         rankingsmessage += "</table><br/>"
  4691.                         + "<br/>"
  4692.                         + "<timestamp/><br/>"
  4693.                         + border;
  4694.                         sys.sendHtmlMessage(src, rankingsmessage, channel);
  4695.                 }
  4696.  
  4697.                 ,
  4698.  
  4699.                 playersonline: function (src, channel, command){
  4700.                         var playersonline = sys.playerIds(), playersonlineindex;
  4701.                         var playersmessage = border
  4702.                         + "<h2>Players Online</h2>";
  4703.                         for (playersonlineindex in playersonline){
  4704.                                 var playername = members[sys.name(playersonline[playersonlineindex]).toLowerCase()];
  4705.                                 playersmessage += helpers.connectstatus(playername);
  4706.                         }
  4707.                         playersmessage += "<br/>"
  4708.                         + "<br/>"
  4709.                         + "<b>Total Players Online: </b>" + playersonline.length + "<br/>"
  4710.                         + "<br/>"
  4711.                         + "<timestamp/><br/>"
  4712.                         + border;
  4713.                         sys.sendHtmlMessage(src, playersmessage, channel);
  4714.                 }
  4715.  
  4716.                 ,
  4717.  
  4718.                 battlesonline: function (src, channel, command){
  4719.                         var battle;
  4720.                         var battlesmessage = border
  4721.                         + "<h2>Battles Online</h2>"
  4722.                         + "<br/>"
  4723.                         + "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='MediumSlateBlue'><th>Battle Number</th><th>Tier</th><th>Runtime</th><th>Player 1</th><th>Player 2</th></tr>";
  4724.                         for (battle in battlesonline){
  4725.                                 var battleruntime = helpers.converttime(new Date() - battlesonline[battle].starttime);
  4726.                                 battlesmessage += "<tr bgcolor='MediumSlateBlue'><td>" + battle + "</td><td>" + battlesonline[battle].tier + "</td><td>" + battleruntime + "</td><td>" + sys.name(battlesonline[battle].p1) + "</td><td>" + sys.name(battlesonline[battle].p2) + "</td></tr>";
  4727.                         }
  4728.                         battlesmessage += "</table><br/>"
  4729.                         + "<br/>"
  4730.                         + "<b>Total Battles Online: </b>" + Object.keys(battlesonline).length + "<br/>"
  4731.                         + "<br/>"
  4732.                         + "<timestamp/><br/>"
  4733.                         + border;
  4734.                         sys.sendHtmlMessage(src, battlesmessage, channel);                     
  4735.                 }
  4736.  
  4737.                 ,
  4738.  
  4739.                 channelsonline: function (src, channel, command){
  4740.                         var channelsonline = sys.channelIds(), channelsonlineindex;
  4741.                         var channelsmessage = border
  4742.                         + "<h2>Channels Online</h2>"
  4743.                         + "<br/>"
  4744.                         + "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='beige'><th>Channel Number</th><th>Channel Name</th><th>Number of Players</th></tr>";
  4745.                         for (channelsonlineindex in channelsonline){
  4746.                                 var channelname = sys.channel(channelsonline[channelsonlineindex]), channelplayernum = sys.playersOfChannel(channelsonline[channelsonlineindex]).length;
  4747.                                 channelsmessage += "<tr bgcolor='beige'><td>" + channelsonline[channelsonlineindex] + "</td><td>" + channelname + "</td><td>" + channelplayernum + "</td></tr>";
  4748.                         }
  4749.                         channelsmessage += "</table><br/>"
  4750.                         + "<br/>"
  4751.                         + "<b>Total Channels Online: </b>" + channelsonline.length + "<br/>"
  4752.                         + "<br/>"
  4753.                         + "<timestamp/><br/>"
  4754.                         + border;
  4755.                         sys.sendHtmlMessage(src, channelsmessage, channel);                            
  4756.                 }
  4757.  
  4758.                 ,
  4759.  
  4760.                 auths: function (src, channel, command){
  4761.                         helpers.setautharray("mods", 1);
  4762.                         helpers.setautharray("admins", 2);
  4763.                         helpers.setautharray("owners", 3);
  4764.                         if (owners.length + admins.length + mods.length == 0){
  4765.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, there is currently no server auth.</i>", channel);
  4766.                                 return;
  4767.                         }
  4768.                         var authlist = helpers.authlistdisplay("owners", 3, "blueviolet");
  4769.                         authlist += helpers.authlistdisplay("admins", 2, "#FF6900");
  4770.                         authlist += helpers.authlistdisplay("mods", 1, "blue");
  4771.                         var authmembers = sys.dbAuths();
  4772.                         authmembers = authmembers.length;
  4773.                         sys.sendHtmlMessage(src, border + "<h2>Server Auth List</h2>" + authlist + "<br/><b>Total Auth Members: </b>" + authmembers + "<br/><br/><timestamp/><br/>" + border, channel);
  4774.                 }
  4775.  
  4776.                 ,
  4777.  
  4778.                 memorystate: function (src, channel, command){
  4779.                         var memorystatedisplay = border
  4780.                         + "<h2>Memory State</h2>"
  4781.                         + "<br/>"
  4782.                         + sys.memoryDump().replace(/\n/g, "<br/>").replace(/\t/g, "&nbsp;") + "<br/>"
  4783.                         + "<br/>"
  4784.                         + "<timestamp/><br/>"
  4785.                         + border;
  4786.                         sys.sendHtmlMessage(src, memorystatedisplay, channel);
  4787.                 }
  4788.  
  4789.                 ,
  4790.  
  4791.                 serverinfo: function(src, channel, command){
  4792.                         var config = sys.getFileContent("config").split("\n"), configindex, playerlimit= "unknown", playerlimitregexp = new RegExp("server_maxplayers", "gi"), channelcount = helpers.channelcount(), begintime = "Unknown" , runtime = "Unknown", localtime = new Date();
  4793.                         if (global.starttime != undefined){
  4794.                                 runtime = new Date() - starttime;
  4795.                                 runtime = helpers.converttime(runtime);
  4796.                                 begintime = starttime;
  4797.                         }
  4798.                         for (configindex in config){
  4799.                                 if (playerlimitregexp.test(config[configindex]) == true){
  4800.                                         playerlimit = config[configindex].substr(18);
  4801.                                 }              
  4802.                         }
  4803.                         var serverinfo = border
  4804.                         + "<h2>Server Info</h2>"
  4805.                         + "<h3><u>General</u></h3>"
  4806.                         + "<b>Server Name: </b>" + servername + " <small><b>Version:</b> " + serverversion + "</small><br/>"
  4807.                         + "<b> Server Port: </b>" + port + "<br/>"
  4808.                         + "<b> Server Status: </b>" + status + " <small><b>Player Limit:</b> " + playerlimit + "</small>"
  4809.                         + "<font color='red'><h3><u>Players</u></h3></font>"
  4810.                         + "<font color='red'><b>Total Members: </b></font>" + (Object.keys(members).length) + "<br/>"
  4811.                         + "<font color='red'><b>Record Number of Players Online: </b></font>" + Number(playerrecord) +  "<br/>"
  4812.                         + "<font color='red'><b>Current Number of Players Online: </b></font>" + sys.numPlayers()
  4813.                         + "<font color='indigo'><h3><u>Battles</u></h3></font>"
  4814.                         + "<font color='indigo'><b>Total Number of Battles Registered: </b></font>" + totalbattles + "<br/>"
  4815.                         + "<font color='indigo'><b>Record Number of Battles Hosted: </b></font>" + battlerecord + "<br/>"
  4816.                         + "<font color='indigo'><b>Current Number of Battles Hosted: </b></font>" + (battlers.length/2)
  4817.                         + "<font color='blue'><h3><u>Channels</u></h3></font>"
  4818.                         + "<font color='blue'><b>Total Number of Channels Registered: </b></font>" + registeredchannels.length + "<br/>"
  4819.                         + "<font color='blue'><b>Record Number of Channels Hosted: </b></font>" + channelrecord + "<br/>"
  4820.                         + "<font color='blue'><b>Current Number of Channels Hosted: </b></font>" + channelcount
  4821.                         + "<font color='blue violet'><h3><u>Time</u></h3></font>"
  4822.                         + "<font color='blue violet'><b>Server Start Time: </b></font>" + begintime + "<br/>"
  4823.                         + "<font color='blue violet'><b>Server Local Time: </b></font>" + localtime + "<br/>"
  4824.                         + "<font color='blue violet'><b>Server Run Time: </b></font>" + runtime + "<br/>"
  4825.                         + "<br/>"
  4826.                         + "<timestamp/><br/>"
  4827.                         + border;
  4828.                         sys.sendHtmlMessage(src, serverinfo, channel);
  4829.                 }
  4830.                
  4831.                 ,
  4832.  
  4833.                 playerinfo: function(src, channel, command){
  4834.                         var playername;
  4835.                         if (command[1] === "undefined"){
  4836.                                 playername = sys.name(src);
  4837.                         }
  4838.                         else {
  4839.                                 if (!helpers.memberscheck(command[1])){
  4840.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " does not exist in the member database.</i>", channel);
  4841.                                         return;
  4842.                                 }
  4843.                                 playername = members[command[1].toLowerCase()];
  4844.                         }
  4845.                         var playernumber = sys.id(playername);
  4846.                         if (playernumber === undefined){
  4847.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + playername + " is currently not on the server.</i>", channel);
  4848.                                 return;
  4849.                         }
  4850.                         var playeravatar = "<img src='Themes/Classic/Trainer Sprites/" + sys.avatar(playernumber) + ".png'>", playerruntime = helpers.converttime(new Date() - playersonline[playernumber].starttime);
  4851.                         var rating = sys.ladderEnabled(playernumber) ? sys.ladderRating(playernumber) : "Unknown";
  4852.                         var playerinfo = border
  4853.                         + "<h2>Player Information for " + playername + "</h2>"
  4854.                         + "<b>Name: </b>"
  4855.                         + helpers.connectstatus(playername) + "<br/>"
  4856.                         + "<b>Avatar: </b><br/>"
  4857.                         + playeravatar + "<br/>"
  4858.                         + "<b>Tier: </b>" + sys.tier(playernumber)+ " <b>Rating: </b>" + rating + "<br/>"
  4859.                         + "<b>Info: </b><br/>"
  4860.                         + helpers.escapehtml(sys.info(playernumber)) + "<br/>"
  4861.                         + "<b>Session Time: </b>" + playerruntime + "<br/>"
  4862.                         + "<br/>"
  4863.                         + "<timestamp/><br/>"
  4864.                         + border;
  4865.                         sys.sendHtmlMessage(src, playerinfo, channel);
  4866.                 }
  4867.                
  4868.                 ,
  4869.  
  4870.                 sprite: function(src, channel, command){
  4871.                         var pokemonname = command[1], gen = parseInt(command[2]), id = sys.pokeNum(pokemonname);
  4872.                         if (id === undefined){
  4873.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a valid Pokémon name.</i>", channel);
  4874.                                 return;                        
  4875.                         }
  4876.                         if (command[2] === undefined){
  4877.                                 gen = 5;
  4878.                         }
  4879.                         if (isNaN(gen)){
  4880.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a number for the generation.</i>", channel);
  4881.                                 return;
  4882.                         }
  4883.                         if (gen < 1 || gen > 5){
  4884.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a number greater than or equal to one and less than or equal to 5.</i>", channel);
  4885.                                 return;
  4886.                         }
  4887.                         pokemonname = sys.pokemon(id);
  4888.                         var spritemessage = border
  4889.                         + "<h2>" + pokemonname + "'s Gen " + gen + " Sprite</h2>"
  4890.                         + "<br/>"
  4891.                         + "<img src='pokemon:num=" + id + "&gen=" + gen + "'/><br/>"
  4892.                         + "<br/>"
  4893.                         + "<timestamp/><br/>"
  4894.                         + border;
  4895.                         sys.sendHtmlMessage(src, spritemessage, channel);
  4896.                 }
  4897.  
  4898.                 ,
  4899.  
  4900.                 scriptinfo: function(src, channel, command){
  4901.                         var contributorslist = String(scriptcontributors).replace(/,/g, ", "), thankedlist = String(scriptthanked).replace(/,/g, ", ");
  4902.                         var scriptinfo = border
  4903.                         + "<h2> Script Info</h2>"
  4904.                         + "<font size='4'><b>Script Name: </b>" + scriptname + "</font><br/>"
  4905.                         + "<font size='4'><b>Script Version: </b> 001.9(Bulbasaur learns Vine Whip)</font><br/>"
  4906.                         + "<font size='4'><b>Script Length: </b>" + scriptcontent.split(/\u000A/g).length + " lines, " + scriptcontent.length + " characters.</font><br/>"
  4907.                         + "<font size='4'><b>Script Registered Date: </b>" + registereddate + "</font><br/>"
  4908.                         + "<font size='4'><b>Last Script Load: </b>" + scriptlastload + "</font><br/>"
  4909.                         + "<b><big><font color='darkviolet'>Repository @ Github:</font></big></b> <a href='https://github.com/Jakilutra/Lutra-s-Pokemon-Online-Server-Script'>https://github.com/Jakilutra/Lutra-s-Pokemon-Online-Server-Script</a><br/>"
  4910.                         + "<b><big><font color='blue'>Full Original Script \u00A9 Lutra: </font></big></b> <a href='" + serverscriptlink + "'>" + serverscriptlink + "</a><br/>"
  4911.                         + "<b><font color='green'>Auto-Update Script \u00A9 Lutra:</font></b> <a href='" + autoupdatescriptlink + "'>" + autoupdatescriptlink + "</a><br/>"
  4912.                         + "<br/>"
  4913.                         + "<font color='indigo'><b>The above text files are copyright under version 2.5 creative commmons attribution-noncommercial-sharealike license.</b><br/>"
  4914.                         + "<b><i>Persons can use and modify them but not claim them as their own, and by extension, sell them.</i></b></font><br/>"
  4915.                         + "<br/>"
  4916.                         + "<font color='goldenrod'><b>Contributors:</b></font> " + contributorslist + "<br/>"
  4917.                         + "<font color='darkgoldenrod'><b>Special Thanks:</b></font> " +  thankedlist + "<br/>"
  4918.                         + "<b>Additional Thanks:</b> All the server hosts that use and recommend this script; all the users who discuss it: give feedback and request features for it.<br/>"
  4919.                         + "<br/>"
  4920.                         + scriptversion + "<br/>"
  4921.                         + "<br/>"
  4922.                         + "<timestamp/><br/>"
  4923.                         + border;
  4924.                         sys.sendHtmlMessage(src, scriptinfo, channel);
  4925.                 }
  4926.  
  4927.                 ,
  4928.  
  4929.                 latest: function(src, channel, command){
  4930.                         var latest = border
  4931.                         + "<h2> Latest Features in the Script </h2>"
  4932.                         + "<br/>"
  4933.                         + "<table border='3' cellspacing='0' cellpadding='5'>"
  4934.                         + "<tr><th>Bulbasaur Version Feature</th><th>Done?</th></tr>"
  4935.                         + "<tr><td>Tournaments and tournament auth per channel.</td><td>Yes</td></tr>"
  4936.                         + "<tr><td>Server Auth show up on /cauths and can only be given channel auth higher than their corresponding server auth.</td><td>No</td></tr>"
  4937.                         + "<tr><td>/ckick command.</td><td>Yes</td></tr>"
  4938.                         + "<tr><td>/stats - gets information on wins, losses and win ratio for each unique team.</td><td>No</td></tr>"
  4939.                         + "</table>"
  4940.                         + "<h3> Changelogs - From 001.7 to 001.9</h3>"
  4941.                         + "\u2022 <b><font color='green'>ADDED</font></b> /changetier, /changeavatar, /changeinfo, /disconnectall, /lockout, /clearauths, /cleartourauths, /clearcauths, /clearctourauths, /reverse, /sysoptions, /eventoptions, /sessionoptions, /tiersoptions, beforeFindBattle, afterFindBattle, /sys, /deleteplayer, /findbattlemessage, /tiersname, /tiersimport, /tiersexport, /tiersload, /tiersinstall , /tierslast, /tierslinksupdate, helpers.nottimeunit, /quasienglish, /playerinfo, /futurelimit, /sprite, /reversechar, /combinechar<br/>"
  4942.                         + "\u2022 <b><font color='blue'>IMPROVED</font></b>  /ownercommands, /authoptions, /cauthoptions, /scriptoptions, /execoptions, /shutdown, /cancelshutdown, helpers.loadteam, helpers.configload, helpers.connectstatus, helpers.converttoseconds, /eval,  /getkeys, /getvalues, /getmembers, /getlength, /set, /save, /chtmlwall, /cwall, /html, /wall, /htmlwall, /serverinfo, /scriptlast, /scriptupdatelinks, /rankings, afterLogIn, /future<br/>"
  4943.                         + "\u2022 <b><font color='purple'>MERGED</font></b> /connectoptions into /runoptions<br/>"
  4944.                         + "\u2022 <b><font color='red'>REMOVED</font></b> /setpa, /unsetpa<br/>"
  4945.                         + "<br/>"
  4946.                         + "<timestamp/><br/>"
  4947.                         + border;
  4948.                         sys.sendHtmlMessage(src, latest, channel);
  4949.                 }
  4950.  
  4951.                 ,
  4952.  
  4953.                 regchannelslist: function(src, channel, command){
  4954.                         var registeredchannelsindex;
  4955.                         var regchannelslistmessage = border
  4956.                         + "<h2>Registered Channels List</h2>"
  4957.                         + "<br/>"
  4958.                         + "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='beige'><th>Channel Name</th><th>Status</th></tr>";
  4959.                         for (registeredchannelsindex in registeredchannels){
  4960.                                 var status = sys.existChannel(registeredchannels[registeredchannelsindex]) == true ? "<font color='green'><b> Online </b></font>" : "<font color='red'><b> Offline </b></font>";
  4961.                                 regchannelslistmessage += "<tr bgcolor='beige'><td>" + registeredchannels[registeredchannelsindex] + "</td><td>" + status + "</td></tr>";
  4962.                         }
  4963.                         regchannelslistmessage += "</table><br/>"
  4964.                         + "<br/>"
  4965.                         + "<b>Total Registered Channels: </b>" + registeredchannels.length + "<br/>"
  4966.                         + "<br/>"
  4967.                         + "<timestamp/><br/>"
  4968.                         + border;
  4969.                         sys.sendHtmlMessage(src, regchannelslistmessage, channel);
  4970.                        
  4971.                 }
  4972.  
  4973.                 ,
  4974.  
  4975.                 tourauths: function (src, channel, command){
  4976.                         if (tourauth.length == 0){
  4977.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, there is currently no tournament auth.</i>", channel);
  4978.                                 return;
  4979.                         }
  4980.                         var tourauthindex, tourauthlist = "";
  4981.                         for (tourauthindex in tourauth){
  4982.                                 if (members[tourauth[tourauthindex]] !== undefined){
  4983.                                         tourauthlist += helpers.connectstatus(members[tourauth[tourauthindex]]);
  4984.                                 }
  4985.                                 else {
  4986.                                         tourauthlist += helpers.connectstatus(tourauth[tourauthindex]);
  4987.                                 }
  4988.                         }
  4989.                         var tourauthsmessage = border
  4990.                         + "<h2>Server Tournament Auth List</h2>"
  4991.                         + "<font color='green' size=4>" + TourAuthLevel1Name + "s:</font>"
  4992.                         + tourauthlist + "<br/>"
  4993.                         + "<br/>"
  4994.                         + "<b>Total Auth Members: </b>" + (tourauth.length) + "<br/>"
  4995.                         + "<br/>"
  4996.                         + "<timestamp/><br/>"
  4997.                         + border;
  4998.                         sys.sendHtmlMessage(src, tourauthsmessage, channel);
  4999.                 }
  5000.  
  5001.                 ,
  5002.  
  5003.                 tours: function (src, channel, command){
  5004.                         var tourindex, tourstable = "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='chocolate'><th>Channel</th><th>Tier</th><th>Tournament Size</th><th>Phase</th><th>Current Size</th><th>Runtime</th></tr>";
  5005.                         for (tourindex in tour){
  5006.                                 var channelname = sys.channel(tourindex), minutesago = Math.floor((new Date() - tour[tourindex].tourstarttime)/60000), minutesstring = minutesago == 1 ? "minute" : "minutes", minutesagostring = minutesago == 0 ? "0 minutes" : String(minutesago) + " " + minutesstring;
  5007.                                 if (tour[tourindex].tourmode == 1){
  5008.                                         tourstable += "<tr bgcolor='chocolate'><td>" + channelname + "</td><td>" + tour[tourindex].tourtier + "</td><td>" + tour[tourindex].tournumber + "</td><td>Sign-up</td><td>" + tour[tourindex].tourmembers.length + "</td><td>" + minutesagostring + "</tr>";
  5009.                                 }
  5010.                                 if (tour[tourindex].tourmode == 2){
  5011.                                         var finalroundcheck = tour[tourindex].tourcurrentnumber == 2 ? "Final Round" : "Round " + tour[tourindex].roundnumber;
  5012.                                         tourstable += "<tr bgcolor='chocolate'><td>" + channelname + "</td><td>" + tour[tourindex].tourtier + "</td><td>" + tour[tourindex].tournumber + "</td><td>" + finalroundcheck + "</td><td>" + tour[tourindex].tourcurrentnumber + "</td><td>" + minutesagostring + "</td></tr>";
  5013.                                 }
  5014.                         }
  5015.                         tourstable += "</table>";
  5016.                         if (tourstable === "<table border='3' cellspacing='0' cellpadding='5'><tr bgcolor='chocolate'><th>Channel</th><th>Tier</th><th>Tournament Size</th><th>Phase</th><th>Current Size</th></tr></table>"){
  5017.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, no tournaments are currently running on the server.</i>", channel);
  5018.                                 return;
  5019.                         }
  5020.                         var toursmessage = border
  5021.                         + "<h2>Current Tournaments</h2>"
  5022.                         + "<br/>"
  5023.                         + tourstable + "<br/>"
  5024.                         + "<br/>"
  5025.                         + "<timestamp/><br/>"
  5026.                         + border;
  5027.                         sys.sendHtmlMessage(src, toursmessage, channel);
  5028.                 }
  5029.  
  5030.                 ,
  5031.  
  5032.                 temptopic: function(src, channel, command){
  5033.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5034.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5035.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5036.                                 return;
  5037.                         }
  5038.                         if (command[1].length > 200){
  5039.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a topic with at most 200 characters.</i>", channel);
  5040.                                 return;
  5041.                         }
  5042.                         channelsonline[channel].topic = command[1].toLowerCase() == "default" ? "Welcome to " + channelname + "!" : command[1];
  5043.                         sys.sendHtmlAll("<timestamp/><font color='Indigo'><b> The Channel topic has been temporarily changed to " + helpers.escapehtml(channelsonline[channel].topic).italics() + " by " + srcname + "!</b></font>", channel);                         
  5044.                 }
  5045.  
  5046.                 ,
  5047.  
  5048.                 topic: function(src, channel, command){
  5049.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5050.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5051.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5052.                                 return;
  5053.                         }
  5054.                         if (command[1].length > 200){
  5055.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a topic with at most 200 characters.</i>", channel);
  5056.                                 return;
  5057.                         }
  5058.                         if (registeredchannels.indexOf(channelname.toLowerCase()) == -1 && channel != 0){
  5059.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot change the channeltopic because this channel is not registered.</i>", channel);
  5060.                                 return;
  5061.                         }
  5062.                         var topic = command[1].toLowerCase() == "default" ? "Welcome to " + channelname + "!" : command[1];
  5063.                         channelsonline[channel].topic = topic
  5064.                         if (channel == 0){
  5065.                                 channelsregistered["|main|"].topic = topic;
  5066.                                 sys.saveVal("Main_Channel", JSON.stringify(channelsregistered["|main|"]));
  5067.                         }
  5068.                         else {
  5069.                                 channelsregistered[channelname.toLowerCase()].topic = topic;
  5070.                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()]));                 
  5071.                         }
  5072.                         sys.sendHtmlAll("<timestamp/><font color='Indigo'><b> The Channel topic has been changed to " + helpers.escapehtml(channelsonline[channel].topic).italics() + " by " + srcname + "!</b></font>", channel);                             
  5073.                 }
  5074.  
  5075.                 ,
  5076.  
  5077.                 combinechar: function (src, channel, command) {
  5078.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5079.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5080.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5081.                                 return;
  5082.                         }
  5083.                         if (registeredchannels.indexOf(channelname.toLowerCase()) == -1 && channel != 0){
  5084.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot change the allowing of combining characters because this channel is not registered.</i>", channel);
  5085.                                 return;
  5086.                         }    
  5087.                         if (command[1] == "on"){
  5088.                                 if (channelsonline[channel].combinecharacters  == "on"){
  5089.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn combining characters on because they are already turned on.</i>", channel);
  5090.                                         return;
  5091.                                 }
  5092.                                 if (channelsonline[channel].combinecharacters  == "off"){
  5093.                                         channelsonline[channel].combinecharacters  = "on";
  5094.                                         if (channel != 0){
  5095.                                                 channelsregistered[channelname.toLowerCase()].combinecharacters  = "on";
  5096.                                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()]));
  5097.                                         }
  5098.                                         else {
  5099.                                                 channelsregistered["|main|"].combinecharacters  = "on";
  5100.                                                 sys.saveVal("Main_Channel", JSON.stringify(channelsregistered["|main|"]));
  5101.                                         }
  5102.                                         sys.sendHtmlAll("<timestamp/><b><font color='indigo'>Combining characters have been turned on by " + srcname + ".</font></b>", channel);
  5103.                                         return;
  5104.                                 }
  5105.                         }
  5106.                         if (command[1] == "off"){
  5107.                                 if (channelsonline[channel].combinecharacters == "off"){
  5108.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn combining characters off because they are already turned off.</i>", channel);
  5109.                                         return;
  5110.                                 }
  5111.                                 if (channelsonline[channel].combinecharacters  == "on"){
  5112.                                         channelsonline[channel].combinecharacters  = "off";
  5113.                                         if (channel != 0){
  5114.                                                 channelsregistered[channelname.toLowerCase()].combinecharacters = "off";
  5115.                                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()]));
  5116.                                         }
  5117.                                         else {
  5118.                                                 channelsregistered["|main|"].combinecharacters = "off";
  5119.                                                 sys.saveVal("Main_Channel", JSON.stringify(channelsregistered["|main|"]));
  5120.                                         }
  5121.                                         sys.sendHtmlAll("<timestamp/><b><font color='indigo'>Combining characters have been turned off by " + srcname + ".</font></b>", channel);
  5122.                                         return;
  5123.                                 }
  5124.                         }
  5125.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, <b>on</b> or <b>off</b> are the only valid arguments for the " + command[0] + " command.</i>", channel);
  5126.                 }
  5127.  
  5128.                 ,
  5129.  
  5130.                 reversechar: function (src, channel, command) {
  5131.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5132.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5133.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5134.                                 return;
  5135.                         }
  5136.                         if (registeredchannels.indexOf(channelname.toLowerCase()) == -1 && channel != 0){
  5137.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot change the allowing of reversing characters because this channel is not registered.</i>", channel);
  5138.                                 return;
  5139.                         }    
  5140.                         if (command[1] == "on"){
  5141.                                 if (channelsonline[channel].reversecharacters == "on"){
  5142.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn reversing characters on because they are already turned on.</i>", channel);
  5143.                                         return;
  5144.                                 }
  5145.                                 if (channelsonline[channel].reversecharacters == "off"){
  5146.                                         channelsonline[channel].reversecharacters = "on";
  5147.                                         if (channel != 0){
  5148.                                                 channelsregistered[channelname.toLowerCase()].reversecharacters = "on";
  5149.                                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()]));
  5150.                                         }
  5151.                                         else {
  5152.                                                 channelsregistered["|main|"].reversecharacters = "on";
  5153.                                                 sys.saveVal("Main_Channel", JSON.stringify(channelsregistered["|main|"]));
  5154.                                         }
  5155.                                         sys.sendHtmlAll("<timestamp/><b><font color='indigo'>Reversing characters have been turned on by " + srcname + ".</font></b>", channel);
  5156.                                         return;
  5157.                                 }
  5158.                         }
  5159.                         if (command[1] == "off"){
  5160.                                 if (channelsonline[channel].reversecharacters == "off"){
  5161.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to turn reversing characters off because they are already turned off.</i>", channel);
  5162.                                         return;
  5163.                                 }
  5164.                                 if (channelsonline[channel].reversecharacters == "on"){
  5165.                                         channelsonline[channel].reversecharacters = "off";
  5166.                                         if (channel != 0){
  5167.                                                 channelsregistered[channelname.toLowerCase()].reversecharacters = "off";
  5168.                                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()]));
  5169.                                         }
  5170.                                         else {
  5171.                                                 channelsregistered["|main|"].reversecharacters = "off";
  5172.                                                 sys.saveVal("Main_Channel", JSON.stringify(channelsregistered["|main|"]));
  5173.                                         }
  5174.                                         sys.sendHtmlAll("<timestamp/><b><font color='indigo'>Reversing characters have been turned off by " + srcname + ".</font></b>", channel);
  5175.                                         return;
  5176.                                 }
  5177.                         }
  5178.                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, <b>on</b> or <b>off</b> are the only valid arguments for the " + command[0] + " command.</i>", channel);
  5179.                 }
  5180.  
  5181.                 ,
  5182.  
  5183.                 clearcauths: function(src, channel, command){
  5184.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5185.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5186.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5187.                                 return;
  5188.                         }
  5189.                         if (registeredchannels.indexOf(channelname.toLowerCase()) == -1 && channel != 0){
  5190.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot clear the auth of this channel because it is not registered.</i>", channel);
  5191.                                 return;
  5192.                         }
  5193.                         channelsonline[channel].owners = new Array();
  5194.                         channelsonline[channel].admins = new Array();
  5195.                         channelsonline[channel].mods = new Array();
  5196.                         if (channel == 0){
  5197.                                 channelsregistered["|main|"].owners = new Array();
  5198.                                 channelsregistered["|main|"].admins = new Array();
  5199.                                 channelsregistered["|main|"].mods = new Array();
  5200.                                 sys.saveVal("Main_Channel", JSON.stringify(channelsregistered["|main|"]));
  5201.                         }
  5202.                         else {
  5203.                                 channelsregistered[channelname.toLowerCase()].owners = new Array();
  5204.                                 channelsregistered[channelname.toLowerCase()].admins = new Array();
  5205.                                 channelsregistered[channelname.toLowerCase()].mods = new Array();
  5206.                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()]));                 
  5207.                         }
  5208.                         sys.sendHtmlAll("<timestamp/><font color='indigo'><b> All Channel Auth has been cleared by " + srcname + ".</b></font>", channel);     
  5209.                 }
  5210.  
  5211.                 ,
  5212.  
  5213.                 clearctourauths: function(src, channel, command){
  5214.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5215.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5216.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5217.                                 return;
  5218.                         }
  5219.                         if (registeredchannels.indexOf(channelname.toLowerCase()) == -1 && channel != 0){
  5220.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot clear the tournament auth of this channel because it is not registered.</i>", channel);
  5221.                                 return;
  5222.                         }
  5223.                         channelsonline[channel].touradmins = new Array();
  5224.                         if (channel == 0){
  5225.                                 channelsregistered["|main|"].touradmins = new Array();
  5226.                                 sys.saveVal("Main_Channel", JSON.stringify(channelsregistered["|main|"]));
  5227.                         }
  5228.                         else {
  5229.                                 channelsregistered[channelname.toLowerCase()].touradmins = new Array();
  5230.                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()]));                 
  5231.                         }
  5232.                         sys.sendHtmlAll("<timestamp/><font color='indigo'><b> All Channel Tournament Auth has been cleared by " + srcname + ".</b></font>", channel);  
  5233.                 }
  5234.  
  5235.                 ,
  5236.  
  5237.                 registerthis: function(src, channel, command){
  5238.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5239.                         if (channel == 0){
  5240.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot register this channel because it is registered by default.</i>", channel);
  5241.                                 return;
  5242.                         }
  5243.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5244.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5245.                                 return;
  5246.                         }
  5247.                         if (channelname.indexOf("/") != -1){
  5248.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot register this channel because <b>/</b> cannot be saved. </i>", channel);
  5249.                                 return;                        
  5250.                         }
  5251.                         if (registeredchannels.length == registeredchannelslimit){
  5252.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot register this channel because the maximum amount of channels have been registered. </i>", channel);
  5253.                                 return;
  5254.                         }
  5255.                         if (registeredchannels.indexOf(channelname.toLowerCase()) != -1){
  5256.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot register this channel because it is already registered.</i>", channel);
  5257.                                 return;
  5258.                         }
  5259.                         registeredchannels.push(channelname.toLowerCase());
  5260.                         sys.saveVal("Channel_Options_RegisteredChannels", JSON.stringify(registeredchannels));
  5261.                         var date = new Date(); date = String(date);
  5262.                         channelsregistered[channelname.toLowerCase()] = new Object();
  5263.                         channelsregistered[channelname.toLowerCase()].registereddate = date;
  5264.                         channelsregistered[channelname.toLowerCase()].owners = new Array();
  5265.                         channelsregistered[channelname.toLowerCase()].owners.push(srcname.toLowerCase());                              
  5266.                         sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()]));
  5267.                         sys.sendHtmlAll("<timestamp/><b><font color='indigo'> " + channelname + " has been registered by " + srcname + "!</b></font>", channel);
  5268.                         sys.sendHtmlAll("<timestamp/><b>" + srcname + " has been made " + ChannelAuthLevel3Name + " of " + channelname + " by the server!</b>", channel);
  5269.                 }
  5270.  
  5271.                 ,
  5272.  
  5273.                 unregisterthis: function(src, channel, command){
  5274.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5275.                         if (channel == 0){
  5276.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot unregister this channel because it is registered by default.</i>", channel);
  5277.                                 return;
  5278.                         }
  5279.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5280.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5281.                                 return;
  5282.                         }
  5283.                         if (registeredchannels.indexOf(channelname.toLowerCase()) == -1){
  5284.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you cannot unregister this channel because it is not registered.</i>", channel);
  5285.                                 return;
  5286.                         }
  5287.                         registeredchannels.splice(registeredchannels.indexOf(channelname.toLowerCase()), 1);
  5288.                         sys.saveVal("Channel_Options_RegisteredChannels", JSON.stringify(registeredchannels));
  5289.                         sys.removeVal("Registered_Channel_" + channelname.toLowerCase());
  5290.                         delete channelsregistered[channelname.toLowerCase()];
  5291.                         sys.sendHtmlAll("<timestamp/><b><font color='indigo'> " + channelname + " has been unregistered by " + srcname + "!</b></font>", channel);
  5292.                 }
  5293.  
  5294.                 ,
  5295.  
  5296.                 restartthis: function(src, channel, command){
  5297.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5298.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5299.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5300.                                 return;
  5301.                         }
  5302.                         if (channel == 0){
  5303.                                 helpers.channelsonlineload();
  5304.                                 helpers.channelsregisteredload();
  5305.                         }
  5306.                         else {
  5307.                                 script.afterChannelCreated(channel, channelname, src);                         
  5308.                         }
  5309.                         sys.sendHtmlAll("<timestamp/><b><font color='indigo'> " + channelname + " has been restarted by " + srcname + "!</b></font>", channel);
  5310.                 }
  5311.  
  5312.                 ,
  5313.  
  5314.                 tempstay: function(src, channel, command){
  5315.                         var srcname = sys.name(src), srcauth = sys.auth(src);
  5316.                         if (channel == 0){
  5317.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to use tempstay because this channel always stays.</i>", channel);
  5318.                                 return;
  5319.                         }
  5320.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5321.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5322.                                 return;
  5323.                         }
  5324.                         if (command[1].toLowerCase() != "off" && command[1].toLowerCase() != "on"){
  5325.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify <b>off</b> or <b>on</b>.</i>", channel);
  5326.                                 return;
  5327.                         }
  5328.                         if (command[1].toLowerCase() == "on"){
  5329.                                 if (channelsonline[channel].stay == "on"){
  5330.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to change tempstay to on because it is already set to on.</i>", channel);
  5331.                                         return;
  5332.                                 }
  5333.                                 channelsonline[channel].stay = "on";
  5334.                                 sys.sendHtmlAll("<timestamp/><b><font color='indigo'> Temp stay of this channel has been set to on by " + srcname + "!</b></font>", channel);
  5335.                         }
  5336.                         if (command[1].toLowerCase() == "off"){
  5337.                                 if (channelsonline[channel].stay == "off"){
  5338.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to change tempstay to off because it is already set to off.</i>", channel);
  5339.                                         return;
  5340.                                 }
  5341.                                 channelsonline[channel].stay = "off";
  5342.                                 sys.sendHtmlAll("<timestamp/><b><font color='indigo'> Temp stay of this channel has been set to off by " + srcname + "!</b></font>", channel);
  5343.                         }
  5344.                 }
  5345.                
  5346.                 ,
  5347.  
  5348.                 stay: function(src, channel, command){
  5349.                         var srcname = sys.name(src), srcauth = sys.auth(src), channelname = sys.channel(channel);
  5350.                         if (channel == 0){
  5351.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to use stay because this channel always stays.</i>", channel);
  5352.                                 return;
  5353.                         }
  5354.                         if (srcauth < 3 && playersonline[src].channelauth[channel] != 3){
  5355.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5356.                                 return;
  5357.                         }
  5358.                         if (command[1].toLowerCase() != "off" && command[1].toLowerCase() != "on"){
  5359.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify <b>off</b> or <b>on</b>.</i>", channel);
  5360.                                 return;
  5361.                         }
  5362.                         if (command[1].toLowerCase() == "on"){
  5363.                                 if (channelsonline[channel].stay == "on"){
  5364.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to change stay to on because it is already set to on.</i>", channel);
  5365.                                         return;
  5366.                                 }
  5367.                                 channelsonline[channel].stay = "on";
  5368.                                 channelsregistered[channelname.toLowerCase()].stay = "on";
  5369.                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()])); 
  5370.                                 sys.sendHtmlAll("<timestamp/><b><font color='indigo'> Stay of this channel has been set to on by " + srcname + "!</b></font>", channel);
  5371.                         }
  5372.                         if (command[1].toLowerCase() == "off"){
  5373.                                 if (channelsonline[channel].stay == "off"){
  5374.                                         sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to change stay to off because it is already set to off.</i>", channel);
  5375.                                         return;
  5376.                                 }
  5377.                                 channelsonline[channel].stay = "off";
  5378.                                 channelsregistered[channelname.toLowerCase()].stay = "off";
  5379.                                 sys.saveVal("Registered_Channel_" + channelname.toLowerCase(), JSON.stringify(channelsregistered[channelname.toLowerCase()])); 
  5380.                                 sys.sendHtmlAll("<timestamp/><b><font color='indigo'> Stay of this channel has been set to off by " + srcname + "!</b></font>", channel);
  5381.                         }
  5382.                 }
  5383.                
  5384.                 ,
  5385.  
  5386.                 ckick: function(src, channel, command){
  5387.                         var srcname = sys.name(src), srcauth = sys.auth(src);
  5388.                         if (srcauth < 1 && playersonline[src].channelauth[channel] < 1){
  5389.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5390.                                 return;
  5391.                         }
  5392.                         var trgt = sys.id(command[1]);
  5393.                         if (trgt === undefined){
  5394.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not currently on the server.</i>", channel);
  5395.                                 return;
  5396.                         }
  5397.                         var cplayers = sys.playersOfChannel(channel);
  5398.                         if (cplayers.indexOf(trgt) == -1){
  5399.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, " + command[1] + " is not currently on the channel.</i>", channel);
  5400.                                 return;
  5401.                         }
  5402.                         if (src == trgt){
  5403.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to channel kick yourself.</i>", channel);
  5404.                                 return;
  5405.                         }
  5406.                         var trgtname = sys.name(trgt), trgtauth = sys.auth(trgt);
  5407.                         srcauth = srcauth < playersonline[src].channelauth[channel] ? playersonline[src].channelauth[channel] : srcauth;
  5408.                         trgtauth = trgtauth < playersonline[trgt].channelauth[channel] ? playersonline[trgt].channelauth[channel] : trgtauth;
  5409.                         if (srcauth <= trgtauth){
  5410.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to  channel kick " + trgtname + " because their auth level is not below yours.</i>", channel);
  5411.                                 return;
  5412.                         }
  5413.                         sys.sendHtmlAll("<timestamp/><font color='royalblue'><b>" + trgtname + " has been kicked from the channel by " + srcname + "!</b></font>", channel);
  5414.                         if (sys.channelsOfPlayer(trgt).length > 1){
  5415.                         sys.callQuickly("sys.kick(" + trgt + "," + channel + ");", 200);
  5416.                                 return;
  5417.                         }
  5418.                         sys.callQuickly("sys.kick(" + trgt + ");", 200);                       
  5419.                 }
  5420.  
  5421.                 ,
  5422.  
  5423.                 html: function(src, channel, command){
  5424.                         var srcname = sys.name(src), srcauth = sys.auth(src);
  5425.                         if (srcauth < 1 && playersonline[src].channelauth[channel] < 1){
  5426.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5427.                                 return;
  5428.                         }
  5429.                         if (srcauth < silence){
  5430.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  5431.                                 return;
  5432.                         }
  5433.                         if (helpers.mutecheck(srcname) == true){
  5434.                                 helpers.mutemessage(src, channel);
  5435.                                 return;
  5436.                         }
  5437.                         command.splice(0,1);
  5438.                         command = command.join("*");
  5439.                         var color = helpers.namecolor(src);
  5440.                         var htmlmessage =  srcauth > 0 ? "<font color=" + color + "><timestamp />+<b><i>" + srcname + ":</i></b></font> " + command : "<font color=" + color + "><timestamp /><b>" + srcname + ":</b></font> " + command;
  5441.                         sys.sendHtmlAll(htmlmessage, channel);
  5442.                 }
  5443.  
  5444.                 ,
  5445.                
  5446.                 bootytalk: function(src, channel, command) {
  5447.                         var srcname = sys.name(src), srcauth = sys.auth(src);
  5448.                         if (srcauth < 1 && playersonline[src].channelauth[channel] < 1){
  5449.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5450.                                 return;
  5451.                         }
  5452.                         if (srcauth < silence){
  5453.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  5454.                                 return;
  5455.                         }
  5456.                         if (helpers.mutecheck(srcname) == true){
  5457.                                 helpers.mutemessage(src, channel);
  5458.                                 return;
  5459.                         }
  5460.                         command.splice(0,1);
  5461.                         command = command.join("*");
  5462.                         var color = "green";
  5463.                         var htmlmessage = "<font color=" + color + "><timestamp />+<b><i>Booty-Bot:</i></b></font> " + command;
  5464.                         sys.sendHtmlAll(htmlmessage, channel);
  5465.                 }
  5466.                
  5467.                 ,
  5468.                
  5469.                 nightclub: function(src, channel, command) {
  5470.                         if (sys.auth(src) < 2) {
  5471.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level can't use this command.</i>", channel);
  5472.                                 return;
  5473.                         }
  5474.                         if (SESSION.global("nightclub").status.is_it_on == true) {
  5475.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, night club is already on.</i>", channel);
  5476.                                 return;
  5477.                         }
  5478.                         SESSION.global("nightclub").status.is_it_on = true;
  5479.                         sys.sendHtmlAll("<table bgcolor='black' width='100%' cellpadding=12 cellspacing=0 style='margin:-12;'><tr><td><font size='5'><b>" + colorify("Let the night club commence!") + "</b></font></td></tr></table>", channel);
  5480.                 }
  5481.                
  5482.                 ,
  5483.                
  5484.                 dayclub: function(src, channel, command) {
  5485.                         if (sys.auth(src) < 2) {
  5486.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level can't use this command.</i>", channel);
  5487.                                 return;
  5488.                         }
  5489.                         if (SESSION.global("nightclub").status.is_it_on == false) {
  5490.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, night club is already off.</i>", channel);
  5491.                                 return;
  5492.                         }
  5493.                         SESSION.global("nightclub").status.is_it_on = false;
  5494.                         sys.sendHtmlAll("<table bgcolor='black' width='100%' cellpadding=12 cellspacing=0 style='margin:-12;'><tr><td><font size='5'><b>" + colorify("Club Times Over!") + "</b></font></td></tr></table>", channel);
  5495.                         sys.sendHtmlAll("", channel);
  5496.                 }
  5497.                
  5498.                 ,
  5499.  
  5500.                 cwall: function(src, channel, command){
  5501.                         var srcname = sys.name(src), srcauth = sys.auth(src);
  5502.                         if (srcauth < 1 && playersonline[src].channelauth[channel] < 1){
  5503.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5504.                                 return;
  5505.                         }
  5506.                         if (srcauth < silence){
  5507.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  5508.                                 return;
  5509.                         }
  5510.                         if (helpers.mutecheck(srcname) == true){
  5511.                                 helpers.mutemessage(src, channel);
  5512.                                 return;
  5513.                         }
  5514.                         command.splice(0,1);
  5515.                         command = command.join("*");
  5516.                         var bordermessage1 = border2 + "<br/>", bordermessage2 = "<br/>" + border2, cwallmessage = srcname + ": " + command;
  5517.                         sys.sendHtmlAll(bordermessage1, channel);
  5518.                 sys.sendAll(cwallmessage, channel);
  5519.                         sys.sendHtmlAll(bordermessage2, channel);
  5520.                 }
  5521.  
  5522.                 ,
  5523.  
  5524.                 chtmlwall: function(src, channel, command){
  5525.                         var srcname = sys.name(src), srcauth = sys.auth(src);
  5526.                         if (srcauth < 1 && playersonline[src].channelauth[channel] < 1){
  5527.                                 helpers.failpermissionmessage(src, channel, command[0]);
  5528.                                 return;
  5529.                         }
  5530.                         if (srcauth < silence){
  5531.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  5532.                                 return;
  5533.                         }
  5534.                         if (helpers.mutecheck(srcname) == true){
  5535.                                 helpers.mutemessage(src, channel);
  5536.                                 return;
  5537.                         }      
  5538.                         var color = helpers.namecolor(src);
  5539.                         command.splice(0,1);
  5540.                         command = command.join("*");
  5541.                         var htmlmessage = srcauth > 0 ? "<font color=" + color + "><timestamp />+<b><i>" + srcname + ":</i></b></font> " + command : "<font color=" + color + "><timestamp /><b>" + srcname + ":</b></font> " + command;
  5542.                         var chtmlwallmessage = border2 + "<br/>"
  5543.                 + "<br/>"
  5544.                 + htmlmessage + "<br/>"
  5545.                 + "<br/>"
  5546.                 + border2;
  5547.                 sys.sendHtmlAll(chtmlwallmessage, channel);
  5548.                 }
  5549.  
  5550.                 ,
  5551.  
  5552.  
  5553.  
  5554.                 me: function(src, channel, command){
  5555.                         if (sys.auth(src) < silence){
  5556.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  5557.                                 return;
  5558.                         }
  5559.                         var srcname = sys.name(src);
  5560.                         if (helpers.mutecheck(srcname) == true){
  5561.                                 helpers.mutemessage(src, channel);
  5562.                                 return;
  5563.                         }      
  5564.                         var color = helpers.namecolor(src);
  5565.                         command.splice(0,1);
  5566.                         command = command.join("*");
  5567.                         sys.sendHtmlAll("<font color =" + color + "><timestamp /><b><i>*** " + srcname + "</i></b></font> " + helpers.escapehtml(command).fontcolor(color).italics(), channel);
  5568.                 }
  5569.                
  5570.                 ,
  5571.  
  5572.                 imp: function(src, channel, command){
  5573.                         if (sys.auth(src) < silence){
  5574.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  5575.                                 return;
  5576.                         }
  5577.                         var srcname = sys.name(src);
  5578.                         if (helpers.mutecheck(srcname) == true){
  5579.                                 helpers.mutemessage(src, channel);
  5580.                                 return;
  5581.                         }      
  5582.                         if (command[1].length > 20){
  5583.                                 sys.sendHtmlMessage(src, "<i>Sorry, you must specify a name with at most 20 characters.</i>", channel);
  5584.                                 return;
  5585.                         }
  5586.                         var name = command[1], color = helpers.namecolor(src);
  5587.                         command.splice(0,2);
  5588.                         command = command.join("*");
  5589.                         sys.sendHtmlAll("<font color =" + color + "><timestamp /><b>" + helpers.escapehtml(name) + ": </b></font> " + helpers.escapehtml(command) + " <b><i><small> Impersonation by " + srcname + "</small></i></b>" , channel);
  5590.                 }
  5591.  
  5592.                 ,
  5593.  
  5594.                 reverse: function(src, channel, command){
  5595.                         if (sys.auth(src) < silence){
  5596.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  5597.                                 return;
  5598.                         }
  5599.                         var srcname = sys.name(src);
  5600.                         if (helpers.mutecheck(srcname) == true){
  5601.                                 helpers.mutemessage(src, channel);
  5602.                                 return;
  5603.                         }
  5604.                         command.splice(0,1);
  5605.                         command = command.join("*");
  5606.                         command = command.split("");
  5607.                         command = command.reverse();
  5608.                         command = command.join("");
  5609.                         sys.sendAll(srcname + ": " + command, channel);
  5610.                 }
  5611.  
  5612.                 ,
  5613.  
  5614.                 future: function(src, channel, command){
  5615.                         if (sys.auth(src) < silence){
  5616.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, your server auth level has been silenced.</i>", channel);
  5617.                                 return;
  5618.                         }
  5619.                         var srcname = sys.name(src), srcip = sys.ip(src);
  5620.                         if (helpers.mutecheck(srcname) == true){
  5621.                                 helpers.mutemessage(src, channel);
  5622.                                 return;
  5623.                         }                              
  5624.                         var color = helpers.namecolor(src), futuretime = parseInt(command[1]), futureunit = command[2];
  5625.                         if (helpers.nottimeunit(futureunit)){
  5626.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you are unable to use future because you have not specified a valid unit of time.</i>", channel);
  5627.                                 return;
  5628.                         }      
  5629.                         if (isNaN(futuretime)){
  5630.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you must specify a value for the amount of " + futureunit + " you want the message to be sent in.</i>", channel);
  5631.                                 return;
  5632.                         }
  5633.                         if (futuretime < 1){
  5634.                                 sys.sendAll(srcname + ": " + command[3], channel);
  5635.                                 return;
  5636.                         }
  5637.                         if (future[srcip] === undefined){
  5638.                                 future[srcip] = 0;
  5639.                         }
  5640.                         if (future[srcip] >= futurelimit){
  5641.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, you have reached the future limit. Please wait until your number of pending futures is decreased.</i>", channel);
  5642.                                 return;
  5643.                         }
  5644.                         future[srcip]++;
  5645.                         var futureseconds = helpers.converttoseconds(futureunit, futuretime);
  5646.                         futureunit = helpers.timeplurality(futuretime, futureunit);
  5647.                         command.splice(0,3);
  5648.                         command = command.join("*");
  5649.                         var futuremessage = sys.dbAuth(srcname) > 0 ? "<font color=" + color + "><timestamp />+<b><i>" + srcname + ":</i></b></font> " + helpers.escapehtml(command) + "<b><i><small> (sent " + futuretime + " " + futureunit + " ago) </small></i></b>" : "<font color=" + color + "><timestamp /><b>" + srcname + ":</b></font> " + helpers.escapehtml(command) + "<b><i><small> (sent " + futuretime + " " + futureunit + " ago) </small></i></b>";
  5650.                         var futurefunction = function(){
  5651.                                 if (sys.channel(channel) != undefined){
  5652.                                         sys.sendHtmlAll(futuremessage, channel);
  5653.                                 }
  5654.                                 future[srcip]--;
  5655.                                 if (future[srcip] === 0){
  5656.                                         delete future[srcip];
  5657.                                 }
  5658.                         }
  5659.                         var futuresentmessage = border + "<br/>"
  5660.                         + "<timestamp/> Your message has been sent " + futuretime + " " + futureunit + " into the future!<br/>"
  5661.                         + border;
  5662.                         sys.sendHtmlMessage(src, futuresentmessage, channel);
  5663.                         sys.delayedCall(futurefunction, futureseconds);
  5664.                 }
  5665.  
  5666.                 ,
  5667.  
  5668.                 joinchannel: function(src, channel, command){
  5669.                         if (command[1].length > 20){
  5670.                                 sys.sendHtmlMessage(src, "<i>Sorry, you must specify a name with at most 20 characters.</i>" , channel);
  5671.                                 return;
  5672.                         }
  5673.                         if (sys.existChannel(command[1]) == true){
  5674.                                 var channeltojoin = sys.channelId(command[1]);
  5675.                                 if (sys.isInChannel(src, channeltojoin) == true){
  5676.                                         sys.sendHtmlMessage(src, "<i>Sorry, you are already in the " + command[1].bold() + " channel.</i>" , channel);
  5677.                                         return;
  5678.                                 }
  5679.                                 sys.putInChannel(src, channeltojoin);
  5680.                                 return;
  5681.                         }
  5682.                         sys.createChannel(command[1]);
  5683.                         var newchannel = sys.channelId(command[1]);
  5684.                         script.afterChannelCreated(newchannel, command[1], src);
  5685.                         sys.putInChannel(src, newchannel);
  5686.                 }
  5687.  
  5688.                 ,
  5689.  
  5690.                 leavechannel: function(src, channel, command){
  5691.                         if (sys.channelsOfPlayer(src).length == 1){
  5692.                                 sys.sendHtmlMessage(src, "<i>Sorry, you must have one channel open at all times.</i>" , channel);                              
  5693.                                 return;
  5694.                         }
  5695.                         sys.kick(src, channel);
  5696.                 }
  5697.  
  5698.                 ,
  5699.  
  5700.                 cplayersonline: function(src, channel, command){
  5701.                         var cplayersonline = sys.playersOfChannel(channel), cplayersonlineindex, channelname = sys.channel(channel);
  5702.                         var cplayersmessage = border
  5703.                         + "<h2> Players Online in " + channelname + " </h2>"
  5704.                         for (cplayersonlineindex in cplayersonline){
  5705.                                 var playername = members[sys.name(cplayersonline[cplayersonlineindex]).toLowerCase()];
  5706.                                 cplayersmessage += helpers.connectstatus(playername);
  5707.                         }
  5708.                         cplayersmessage += "<br/>"
  5709.                         + "<br/>"
  5710.                         + "<b>Total Players Online in " + channelname + ": </b>" + cplayersonline.length + "<br/>"
  5711.                         + "<br/>"
  5712.                         + "<timestamp/><br/>"
  5713.                         + border;
  5714.                         sys.sendHtmlMessage(src, cplayersmessage, channel);
  5715.                 }
  5716.                
  5717.                 ,
  5718.  
  5719.                 cauths: function (src, channel, command){
  5720.                         var sauths = sys.dbAuths(), cauthmembers = channelsonline[channel].owners.length + channelsonline[channel].admins.length + channelsonline[channel].mods.length + sauths.length;
  5721.                         if (cauthmembers == 0){
  5722.                                 sys.sendHtmlMessage(src, "<timestamp/><i>Sorry, there is currently no channel auth.</i>", channel);
  5723.                                 return;
  5724.                         }
  5725.                         helpers.setautharray("mods", 1);
  5726.                         helpers.setautharray("admins", 2);
  5727.                         helpers.setautharray("owners", 3);
  5728.                         var cauthsmessage = border
  5729.                         + "<h2>Channel Auth List</h2>";
  5730.                         if (channelsonline[channel].owners.length > 0){
  5731.                                 cauthsmessage += "<br/>"
  5732.                                 + "<font size='4' color='indigo'>" + ChannelAuthLevel3Name + "s</font>";
  5733.                                 for (var ownersindex in channelsonline[channel].owners){
  5734.                                         if(members[channelsonline[channel].owners[ownersindex]] !== undefined){
  5735.                                                 cauthsmessage += helpers.connectstatus(members[channelsonline[channel].owners[ownersindex]]);
  5736.                                         }
  5737.                                         else {
  5738.                                                 cauthsmessage += helpers.connectstatus(channelsonline[channel].owners[ownersindex]);
  5739.                                         }
  5740.                                 }
  5741.                                 if (owners.length === 0){
  5742.                                         cauthsmessage += "<br/>";
  5743.                                 }
  5744.                         }
  5745.                         cauthsmessage += helpers.authlistdisplay("owners", 3, "blueviolet");
  5746.                         if (channelsonline[channel].admins.length > 0){
  5747.