Advertisement
Guest User

Just copy that into usercommands.js - Replace it all

a guest
May 27th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. exports.handleCommand = function(src, command, commandData, tar, channel) {
  2.     // loop indices
  3.     var i, x;
  4.     // temp array
  5.     var ar;
  6.     if (command == "commands" || command == "command") {
  7.         if (commandData === undefined) {
  8.             sys.sendMessage(src, "*** Commands ***", channel);
  9.             for (x = 0; x < this.help.length; ++x) {
  10.                 sys.sendMessage(src, this.help[x], channel);
  11.             }
  12.             sys.sendMessage(src, "*** Other Commands ***", channel);
  13.             sys.sendMessage(src, "/commands channel: To know of channel commands", channel);
  14.             if (sys.auth(src) > 0 || SESSION.users(src).tempMod) {
  15.                 sys.sendMessage(src, "/commands mod: To know of moderator commands", channel);
  16.             }
  17.             if (sys.auth(src) > 1 || SESSION.users(src).tempAdmin) {
  18.                 sys.sendMessage(src, "/commands admin: To know of admin commands", channel);
  19.             }
  20.             if (sys.auth(src) > 2 || isSuperAdmin(src)) {
  21.                 sys.sendMessage(src, "/commands owner: To know of owner commands", channel);
  22.             }
  23.             var pluginhelps = getplugins("help-string");
  24.             for (var module in pluginhelps) {
  25.                 if (pluginhelps.hasOwnProperty(module)) {
  26.                     var help = typeof pluginhelps[module] == "string" ? [pluginhelps[module]] : pluginhelps[module];
  27.                     for (i = 0; i < help.length; ++i)
  28.                         sys.sendMessage(src, "/commands " + help[i], channel);
  29.                 }
  30.             }
  31.             return;
  32.         }
  33.  
  34.         commandData = commandData.toLowerCase();
  35.         if ( (commandData == "mod" && sys.auth(src) > 0 || SESSION.users(src).tempMod)
  36.             || (commandData == "admin" && sys.auth(src) > 1 || SESSION.users(src).tempAdmin)
  37.             || (commandData == "owner" && (sys.auth(src) > 2  || isSuperAdmin(src)))
  38.             || (commandData == "channel") ) {
  39.             sys.sendMessage(src, "", channel);
  40.             sys.sendMessage(src, "*** " + utilities.capitalize(commandData.toLowerCase()) + " commands ***", channel);
  41.             var list = require(commandData+"commands.js").help;
  42.             if (typeof list !== "function") {
  43.                 list.forEach(function(help) {
  44.                     sys.sendMessage(src, help, channel);
  45.                 });
  46.             } else {
  47.                 list(src, channel);
  48.             }
  49.         }
  50.         callplugins("onHelp", src, commandData, channel);
  51.  
  52.         return;
  53.     }
  54.     if ((command == "me" || command == "rainbow") && !SESSION.channels(channel).muteall) {
  55.         if (SESSION.channels(channel).meoff === true) {
  56.             normalbot.sendMessage(src, "/me was turned off.", channel);
  57.             return;
  58.         }
  59.         if (commandData === undefined)
  60.             return;
  61.         if (channel == sys.channelId("Trivia") && SESSION.channels(channel).triviaon) {
  62.             sys.sendMessage(src, "±Trivia: Answer using \\a, /me not allowed now.", channel);
  63.             return;
  64.         }
  65.         if (usingBannedWords() || repeatingOneself() || capsName()) {
  66.             sys.stopEvent();
  67.             return;
  68.         }
  69.         if (SESSION.users(src).smute.active) {
  70.             sys.playerIds().forEach(function(id) {
  71.                 if (sys.loggedIn(id) && SESSION.users(id).smute.active && sys.isInChannel(src, channel)) {
  72.                     var colour = script.getColor(src);
  73.                     sys.sendHtmlMessage(id, "<font color='" + colour + "'><timestamp/> *** <b>" + utilities.html_escape(sys.name(src)) + "</b> " + commandData + "</font>", channel);
  74.                 }
  75.             });
  76.             sys.stopEvent();
  77.             script.afterChatMessage(src, '/'+command+ ' '+commandData,channel);
  78.             return;
  79.         }
  80.         SESSION.channels(channel).beforeMessage(src, "/me " + commandData);
  81.         commandData=utilities.html_escape(commandData);
  82.         var messagetosend = commandData;
  83.         if (typeof CAPSLOCKDAYALLOW != 'undefined' && CAPSLOCKDAYALLOW === true) {
  84.             var date = new Date();
  85.             if ((date.getDate() == 22 && date.getMonth() == 9) || (date.getDate() == 28 && date.getMonth() == 5)) { // October 22nd & June 28th
  86.                 messagetosend = messagetosend.toUpperCase();
  87.             }
  88.         }
  89.         if (channel === sys.channelId("Tohjo Falls") && script.reverseTohjo === true) {
  90.             messagetosend = messagetosend.split("").reverse().join("");
  91.         }
  92.         if (command == "me") {
  93.             var colour = script.getColor(src);
  94.             sendChanHtmlAll("<font color='" + colour + "'><timestamp/> *** <b>" + utilities.html_escape(sys.name(src)) + "</b> " + messagetosend + "</font>", channel);
  95.         }
  96.         else if (command == "rainbow" && !script.isOfficialChan(channel)) {
  97.             var auth = 1 <= sys.auth(src) && sys.auth(src) <= 3;
  98.             var colours = ["#F85888", "#F08030", "#F8D030", "#78C850", "#98D8D8", "#A890F0", "#C183C1"];
  99.             var colour = sys.rand(0, colours.length);
  100.             var randColour = function () {
  101.                 var returnVal = colours[colour];
  102.                 colour = colour + 1;
  103.                 if (colour === colours.length) {
  104.                     colour = 0;
  105.                 }
  106.                 return returnVal;
  107.             };
  108.             var toSend = ["<timestamp/><b>"];
  109.             if (auth) toSend.push("<span style='color:" + randColour() + "'>+</span><i>");
  110.             var name = sys.name(src);
  111.             for (var j = 0; j < name.length; ++j)
  112.                 toSend.push("<span style='color:" + randColour() + "'>" + utilities.html_escape(name[j]) + "</span>");
  113.             toSend.push("<span style='color:" + randColour() + "'>:</b></span> ");
  114.             if (auth) toSend.push("</i>");
  115.             toSend.push(messagetosend);
  116.             sendChanHtmlAll(toSend.join(""), channel);
  117.         }
  118.         script.afterChatMessage(src, '/' + command + ' ' + commandData, channel);
  119.         return;
  120.     }
  121.     if (command == "contributors") {
  122.         sys.sendMessage(src, "", channel);
  123.         sys.sendMessage(src, "*** CONTRIBUTORS ***", channel);
  124.         sys.sendMessage(src, "", channel);
  125.         for (var x in script.contributors.hash) {
  126.             if (script.contributors.hash.hasOwnProperty(x)) {
  127.                 sys.sendMessage(src, x + "'s contributions: " + script.contributors.get(x), channel);
  128.             }
  129.         }
  130.         sys.sendMessage(src, "", channel);
  131.         return;
  132.     }
  133.     if (command == "league") {
  134.         if (!Config.League) return;
  135.         sys.sendMessage(src, "", channel);
  136.         sys.sendMessage(src, "*** Pokemon Online League ***", channel);
  137.         sys.sendMessage(src, "", channel);
  138.         ar = Config.League;
  139.         for (x = 0; x < ar.length; ++x) {
  140.             if (ar[x].length > 0) {
  141.                 sys.sendHtmlMessage(src, "<span style='font-weight: bold'>" + utilities.html_escape(ar[x][0].toCorrectCase()) + "</span> - " + ar[x][1].format(utilities.html_escape(ar[x][0])) + " " + (sys.id(ar[x][0]) !== undefined ? "<span style='color: green'>(online)</span>" : "<span style='color: red'>(offline)</span>"), channel);
  142.             }
  143.         }
  144.         sys.sendMessage(src, "", channel);
  145.         return;
  146.     }
  147.     if (command == "rules") {
  148.         if (commandData === "mafia") {
  149.             require('mafia.js').showRules(src, channel);
  150.             return;
  151.         }
  152.         var norules = (rules.length-1)/2; //formula for getting the right amount of rules
  153.         if(commandData !== undefined && !isNaN(commandData) && commandData >0 && commandData < norules){
  154.             var num = parseInt(commandData, 10);
  155.             num = (2*num)+1; //gets the right rule from the list since it isn't simply y=x it's y=2x+1
  156.             sys.sendMessage(src, rules[num], channel);
  157.             sys.sendMessage(src, rules[num+1], channel);
  158.             return;
  159.         }
  160.         for (var rule = 0; rule < rules.length; rule++) {
  161.             sys.sendMessage(src, rules[rule], channel);
  162.         }
  163.         return;
  164.     }
  165.     if (command == "players") {
  166.         if (commandData) {
  167.             commandData = commandData.toLowerCase();
  168.         }
  169.         if (["windows", "linux", "android", "mac", "webclient"].indexOf(commandData) !== -1) {
  170.             var android = 0;
  171.             sys.playerIds().forEach(function (id) {
  172.                 if (sys.os(id) === commandData) {
  173.                     android += 1;
  174.                 }
  175.             });
  176.             countbot.sendMessage(src, "There are  " + android + " " + commandData + " players online", channel);
  177.             return;
  178.         }
  179.         if (commandData == "top" || commandData == "max") {
  180.             countbot.sendMessage(src, "Max number of players online was " + sys.getVal("MaxPlayersOnline") + ".", channel);
  181.             return;
  182.         }
  183.         countbot.sendMessage(src, "There are " + sys.numPlayers() + " players online.", channel);
  184.         return;
  185.     }
  186.     if (command == "ranking") {
  187.         var announceTier = function(tier) {
  188.             var rank = sys.ranking(sys.name(src), tier);
  189.             if (rank === undefined) {
  190.                 rankingbot.sendMessage(src, "You are not ranked in " + tier + " yet!", channel);
  191.             } else {
  192.                 rankingbot.sendMessage(src, "Your rank in " + tier + " is " + rank + "/" + sys.totalPlayersByTier(tier) + " [" + sys.ladderRating(src, tier) + " points / " + sys.ratedBattles(sys.name(src), tier) +" battles]!", channel);
  193.             }
  194.         };
  195.         if (commandData !== undefined) {
  196.             commandData = utilities.find_tier(commandData);
  197.             if (sys.totalPlayersByTier(commandData) === 0)
  198.                 rankingbot.sendMessage(src, commandData + " is not even a tier.", channel);
  199.             else
  200.                 announceTier(commandData);
  201.         } else {
  202.             [0,1,2,3,4,5].slice(0, sys.teamCount(src))
  203.                 .map(function(i) { return sys.tier(src, i); })
  204.                 .filter(function(tier) { return tier !== undefined; })
  205.                 .sort()
  206.                 .filter(function(tier, index, array) { return tier !== array[index-1]; })
  207.                 .forEach(announceTier);
  208.         }
  209.         return;
  210.     }
  211.     if (command == "battlecount") {
  212.         if (!commandData || commandData.indexOf(":") == -1) {
  213.             rankingbot.sendMessage(src, "Usage: /battlecount name:tier", channel);
  214.             return;
  215.         }
  216.         var stuff = commandData.split(":");
  217.         var name = stuff[0];
  218.         var tier = utilities.find_tier(stuff[1]);
  219.         var rank = sys.ranking(name, tier);
  220.         if (!tier) {
  221.             rankbot.sendMessage(stuff[1] + " is not a tier", channel);
  222.             return;
  223.         }
  224.         if (rank === undefined) {
  225.             rankingbot.sendMessage(src, "They are not ranked in " + tier + " yet!", channel);
  226.         } else {
  227.             rankingbot.sendMessage(src, name + "'s rank in " + tier + " is " + rank + "/" + sys.totalPlayersByTier(tier) + " [" + sys.ratedBattles(name, tier) +" battles]!", channel);
  228.         }
  229.         return;
  230.     }
  231.     if (command == "auth") {
  232.         var DoNotShowIfOffline = ["loseyourself", "oneballjay"];
  233.         var filterByAuth = function(level) { return function(name) { return sys.dbAuth(name) == level; }; };
  234.         var printOnlineOffline = function(name) {
  235.             if (sys.id(name) === undefined) {
  236.                 if (DoNotShowIfOffline.indexOf(name) == -1) sys.sendMessage(src, name, channel);
  237.             } else {
  238.                 sys.sendHtmlMessage(src, "<timestamp/><font color = " + sys.getColor(sys.id(name)) + "><b>" + name.toCorrectCase() + "</b></font>", channel);
  239.             }
  240.         };
  241.         var authlist = sys.dbAuths().sort();
  242.         if (commandData !== "~") {
  243.             sys.sendMessage(src, "", channel);
  244.         }
  245.         switch (commandData) {
  246.             case "host":
  247.                 sys.sendMessage(src, "*** Server Host ***", channel);
  248.                 authlist.filter(filterByAuth(10)).forEach(printOnlineOffline);
  249.                 break;
  250.             case "hiddenauth":
  251.                 sys.sendMessage(src, "*** Server Hiddenauth ***", channel);
  252.                 authlist.filter(filterByAuth(4)).forEach(printOnlineOffline);
  253.                 break;
  254.             case "owners":
  255.                 sys.sendMessage(src, "*** Server Owners ***", channel);
  256.                 authlist.filter(filterByAuth(3)).forEach(printOnlineOffline);
  257.                 break;
  258.             case "admins":
  259.             case "administrators":
  260.                 sys.sendMessage(src, "*** Server Administrators & Super Admins ***", channel);
  261.                 authlist.filter(filterByAuth(2)).forEach(printOnlineOffline);
  262.                 break;
  263.             case "mods":
  264.             case "moderators":
  265.                 sys.sendMessage(src, "*** Server Moderators ***", channel);
  266.                 authlist.filter(filterByAuth(1)).forEach(printOnlineOffline);
  267.                 break;
  268.             case "~":
  269.                 var ret = {};
  270.                 ret.owners = authlist.filter(filterByAuth(3));
  271.                 ret.administrators = authlist.filter(filterByAuth(2));
  272.                 ret.moderators = authlist.filter(filterByAuth(1));
  273.                 sys.sendMessage(src, "+auth: " + JSON.stringify(ret), channel);
  274.                 return;
  275.             default:
  276.                 sys.sendMessage(src, "*** Owners ***", channel);
  277.                 authlist.filter(filterByAuth(3)).forEach(printOnlineOffline);
  278.                 sys.sendMessage(src, '', channel);
  279.                 sys.sendMessage(src, "*** Administrators ***", channel);
  280.                 authlist.filter(filterByAuth(2)).forEach(printOnlineOffline);
  281.                 sys.sendMessage(src, '', channel);
  282.                 sys.sendMessage(src, "*** Moderators ***", channel);
  283.                 authlist.filter(filterByAuth(1)).forEach(printOnlineOffline);
  284.         }
  285.         sys.sendMessage(src, '', channel);
  286.         return;
  287.     }
  288.     if (command == "sametier") {
  289.         if (commandData == "on") {
  290.             battlebot.sendMessage(src, "You enforce same tier in your battles.", channel);
  291.             SESSION.users(src).sametier = true;
  292.         } else if (commandData == "off") {
  293.             battlebot.sendMessage(src, "You allow different tiers in your battles.", channel);
  294.             SESSION.users(src).sametier = false;
  295.         } else {
  296.             battlebot.sendMessage(src, "Currently: " + (SESSION.users(src).sametier ? "enforcing same tier" : "allow different tiers") + ". Use /sametier on/off to change it!", channel);
  297.         }
  298.         script.saveKey("forceSameTier", src, SESSION.users(src).sametier * 1);
  299.         return;
  300.     }
  301.     if (command == "idle") {
  302.         if (commandData.toLowerCase() == "on") {
  303.             battlebot.sendMessage(src, "You are now idling.", channel);
  304.             script.saveKey("autoIdle", src, 1);
  305.             sys.changeAway(src, true);
  306.         } else if (commandData.toLowerCase() == "off") {
  307.             battlebot.sendMessage(src, "You are back and ready for battles!", channel);
  308.             script.saveKey("autoIdle", src, 0);
  309.             sys.changeAway(src, false);
  310.         } else {
  311.             battlebot.sendMessage(src, "You are currently " + (sys.away(src) ? "idling" : "here and ready to battle") + ". Use /idle on/off to change it.", channel);
  312.         }
  313.         return;
  314.     }
  315.     if (command == "selfkick" || command == "sk") {
  316.         var src_ip = sys.ip(src);
  317.         var players = sys.playerIds();
  318.         var players_length = players.length;
  319.         for (var i = 0; i < players_length; ++i) {
  320.             var current_player = players[i];
  321.             if ((src != current_player) && (src_ip == sys.ip(current_player))) {
  322.                 sys.kick(current_player);
  323.                 normalbot.sendMessage(src, "Your ghost was kicked...");
  324.             }
  325.         }
  326.         return;
  327.     }
  328.     if (command == "topic") {
  329.         SESSION.channels(channel).setTopic(src, commandData);
  330.         return;
  331.     }
  332.     if (command == "topicadd") {
  333.         if (commandData) {
  334.             if (SESSION.channels(channel).topic.length > 0)
  335.                 SESSION.channels(channel).setTopic(src, SESSION.channels(channel).topic + Config.topic_delimiter + commandData);
  336.             else
  337.                 SESSION.channels(channel).setTopic(src, commandData);
  338.         }
  339.         return;
  340.     }
  341.     if (command == "removepart") {
  342.         var topic = SESSION.channels(channel).topic;
  343.         topic = topic.split(Config.topic_delimiter);
  344.         if (isNaN(commandData) || commandData > topic.length) {
  345.             return;
  346.         }
  347.         var part = commandData;
  348.         if (part > 0) {
  349.             part = part -1;
  350.         }
  351.         topic.splice(part, 1);
  352.         SESSION.channels(channel).setTopic(src, topic.join(Config.topic_delimiter));
  353.         return;
  354.     }
  355.     if (command == "updatepart") {
  356.         var topic = SESSION.channels(channel).topic;
  357.         topic = topic.split(Config.topic_delimiter);
  358.         var pos = commandData.indexOf(" ");
  359.         if (pos === -1) {
  360.             return;
  361.         }
  362.         if (isNaN(commandData.substring(0, pos)) || commandData.substring(0, pos) - 1 < 0 || commandData.substring(0, pos) - 1 > topic.length - 1) {
  363.             return;
  364.         }
  365.         topic[commandData.substring(0, pos) - 1] = commandData.substr(pos+1);
  366.         SESSION.channels(channel).setTopic(src, topic.join(Config.topic_delimiter));
  367.         return;
  368.     }
  369.     if (command == "uptime") {
  370.         if (typeof(script.startUpTime()) != "string") {
  371.             countbot.sendMessage(src, "Somehow the server uptime is messed up...", channel);
  372.             return;
  373.         }
  374.         countbot.sendMessage(src, "Server uptime is "+script.startUpTime(), channel);
  375.         return;
  376.     }
  377.     if (command == "topchannels") {
  378.         var cids = sys.channelIds();
  379.         var limit = (commandData && !isNaN(commandData) ? parseInt(commandData, 10) : 10);
  380.         var l = [];
  381.         for (var i = 0; i < cids.length; ++i) {
  382.             l.push([cids[i], sys.playersOfChannel(cids[i]).length]);
  383.         }
  384.         l.sort(function(a,b) { return b[1]-a[1]; });
  385.         var topchans = l.slice(0, limit);
  386.         channelbot.sendMessage(src, "Most used channels:", channel);
  387.         for (var i = 0; i < topchans.length; ++i) {
  388.             sys.sendMessage(src, "" + sys.channel(topchans[i][0]) + " with " + topchans[i][1] + " players.", channel);
  389.         }
  390.         return;
  391.     }
  392.     if (command == "resetpass") {
  393.         if (!sys.dbRegistered(sys.name(src))) {
  394.             normalbot.sendMessage(src, "You are not registered!", channel);
  395.             return;
  396.         }
  397.         sys.clearPass(sys.name(src));
  398.         normalbot.sendMessage(src, "Your password was cleared!", channel);
  399.         sys.sendNetworkCommand(src, 14); // make the register button active again
  400.         return;
  401.     }
  402.     if (command == "importable") {
  403.         var teamNumber = 0;
  404.         var bind_channel = channel;
  405.         if (!isNaN(commandData) && commandData >= 0 && commandData < sys.teamCount(src)) {
  406.             teamNumber = commandData;
  407.         }
  408.         var team = script.importable(src, teamNumber, true).join("\n");
  409.         var filename = sys.time() + "-" + sys.rand(1000, 10000) + ".txt";
  410.         sys.writeToFile("usage_stats/formatted/team/"+filename, team);
  411.         normalbot.sendMessage(src, "Your team can be found here: http://server.pokemon-online.eu/team/" + filename + " Remember this will be deleted in 24 hours", channel);
  412.         return;
  413.     }
  414.     if (command == "cjoin") {
  415.         var chan;
  416.         if (sys.existChannel(commandData)) {
  417.             chan = sys.channelId(commandData);
  418.         } else {
  419.             var name = commandData.toLowerCase();
  420.             for (var i = 0; i < script.chanNameBans.length; ++i) {
  421.                 var regexp = script.chanNameBans[i];
  422.                 if (regexp.test(name)) {
  423.                     sys.sendMessage(src, 'This kind of channel name is banned from the server. (Matching regexp: ' + regexp + ')');
  424.                     return;
  425.                 }
  426.             }
  427.             chan = sys.createChannel(commandData);
  428.         }
  429.         if (sys.isInChannel(src, chan)) {
  430.             normalbot.sendMessage(src, "You are already on #" + commandData, channel);
  431.         } else {
  432.             sys.putInChannel(src, chan);
  433.         }
  434.         return;
  435.     }
  436.  
  437.     if (command == "register") {
  438.         if (!sys.dbRegistered(sys.name(src))) {
  439.             channelbot.sendMessage(src, "You need to register on the server before registering a channel to yourself for security reasons!", channel);
  440.             return;
  441.         }
  442.         if (sys.auth(src) < 1 && script.isOfficialChan(channel)) {
  443.             channelbot.sendMessage(src, "You don't have sufficient authority to register this channel!", channel);
  444.             return;
  445.         }
  446.         if (SESSION.channels(channel).register(sys.name(src))) {
  447.             channelbot.sendMessage(src, "You registered this channel successfully. Take a look of /commands channel", channel);
  448.         } else {
  449.             channelbot.sendMessage(src, "This channel is already registered!", channel);
  450.         }
  451.         return;
  452.     }
  453.     if (command == "cauth") {
  454.         if (typeof SESSION.channels(channel).operators != 'object')
  455.             SESSION.channels(channel).operators = [];
  456.         if (typeof SESSION.channels(channel).admins != 'object')
  457.             SESSION.channels(channel).admins = [];
  458.         if (typeof SESSION.channels(channel).masters != 'object')
  459.             SESSION.channels(channel).masters = [];
  460.         if (typeof SESSION.channels(channel).members != 'object')
  461.             SESSION.channels(channel).members = [];
  462.         if (commandData === "~") {
  463.             var ret = {};
  464.             ret.members = SESSION.channels(channel).members;
  465.             ret.operators = SESSION.channels(channel).operators;
  466.             ret.admins = SESSION.channels(channel).admins;
  467.             ret.owners = SESSION.channels(channel).masters;
  468.             sys.sendMessage(src, "+cauth: " + JSON.stringify(ret), channel);
  469.             return;
  470.         }
  471.         channelbot.sendMessage(src, "The channel members of " + sys.channel(channel) + " are:", channel);
  472.         channelbot.sendMessage(src, "Owners: " + SESSION.channels(channel).masters.join(", "), channel);
  473.         channelbot.sendMessage(src, "Admins: " + SESSION.channels(channel).admins.join(", "), channel);
  474.         channelbot.sendMessage(src, "Mods: " + SESSION.channels(channel).operators.join(", "), channel);
  475.         if (SESSION.channels(channel).inviteonly >= 1 || SESSION.channels(channel).members.length >= 1) {
  476.             channelbot.sendMessage(src, "Members: " + SESSION.channels(channel).members.join(", "), channel);
  477.         }
  478.         return;
  479.     }
  480.     // Tour alerts
  481.     if(command == "touralerts") {
  482.         if(commandData == "on"){
  483.             SESSION.users(src).tiers = script.getKey("touralerts", src).split("*");
  484.             normalbot.sendMessage(src, "You have turned tour alerts on!", channel);
  485.             script.saveKey("touralertson", src, "true");
  486.             return;
  487.         }
  488.         if(commandData == "off") {
  489.             delete SESSION.users(src).tiers;
  490.             normalbot.sendMessage(src, "You have turned tour alerts off!", channel);
  491.             script.saveKey("touralertson", src, "false");
  492.             return;
  493.         }
  494.         if(typeof(SESSION.users(src).tiers) == "undefined" || SESSION.users(src).tiers.length === 0){
  495.             normalbot.sendMessage(src, "You currently have no alerts activated", channel);
  496.             return;
  497.         }
  498.         normalbot.sendMessage(src, "You currently get alerted for the tiers:", channel);
  499.         var spl = SESSION.users(src).tiers;
  500.         for (var x = 0; x < spl.length; ++x) {
  501.             if (spl[x].length > 0) {
  502.                 normalbot.sendMessage(src, spl[x], channel);
  503.             }
  504.         }
  505.         sys.sendMessage(src, "", channel);
  506.         return;
  507.     }
  508.  
  509.     if(command == "addtouralert") {
  510.         var tier = utilities.find_tier(commandData);
  511.         if (tier === null) {
  512.             normalbot.sendMessage(src, "Sorry, the server does not recognise the " + commandData + " tier.", channel);
  513.             return;
  514.         }
  515.         if (typeof SESSION.users(src).tiers == "undefined") {
  516.             SESSION.users(src).tiers = [];
  517.         }
  518.         if (typeof SESSION.users(src).tiers == "string") {
  519.             SESSION.users(src).tiers = SESSION.users(src).tiers.split("*");
  520.         }
  521.         SESSION.users(src).tiers.push(tier);
  522.         script.saveKey("touralerts", src, SESSION.users(src).tiers.join("*"));
  523.         normalbot.sendMessage(src, "Added a tour alert for the tier: " + tier + "!", channel);
  524.         return;
  525.     }
  526.     if(command == "removetouralert") {
  527.         if(typeof SESSION.users(src).tiers == "undefined" || SESSION.users(src).tiers.length === 0){
  528.             normalbot.sendMessage(src, "You currently have no alerts.", channel);
  529.             return;
  530.         }
  531.         var tier = utilities.find_tier(commandData);
  532.         if (tier === null) {
  533.             normalbot.sendMessage(src, "Sorry, the server does not recognise the " + commandData + " tier.", channel);
  534.             return;
  535.         }
  536.         var idx = -1;
  537.         while ((idx = SESSION.users(src).tiers.indexOf(tier)) != -1) {
  538.             SESSION.users(src).tiers.splice(idx, 1);
  539.         }
  540.         script.saveKey("touralerts", src, SESSION.users(src).tiers.join("*"));
  541.         normalbot.sendMessage(src, "Removed a tour alert for the tier: " + tier + "!", channel);
  542.         return;
  543.     }
  544.     // The Stupid Coin Game
  545.     if (command == "coin" || command == "flip") {
  546.         coinbot.sendMessage(src, "You flipped a coin. It's " + (Math.random() < 0.5 ? "Tails" : "Heads") + "!", channel);
  547.         if (!isNonNegative(SESSION.users(src).coins))
  548.             SESSION.users(src).coins = 320000000000;
  549.         SESSION.users(src).coins++;
  550.         return;
  551.     }
  552.     if (command == "throw") {
  553.         if (channel != sys.channelId("Coins")) {
  554.             coinbot.sendMessage(src, "No throwing here!", channel);
  555.             return;
  556.         }
  557.         if (sys.auth(src) === 0 && SESSION.channels(channel).muteall && !SESSION.channels(channel).isChannelOperator(src)) {
  558.             if (SESSION.channels(channel).muteallmessages) {
  559.                 sys.sendMessage(src, SESSION.channels(channel).muteallmessage, channel);
  560.             } else {
  561.                 coinbot.sendMessage(src, "Respect the minutes of silence!", channel);
  562.             }
  563.             return;
  564.         }
  565.  
  566.         if (!isNonNegative(SESSION.users(src).coins) || SESSION.users(src).coins < 1) {
  567.             coinbot.sendMessage(src, "Need more coins? Use /flip!", channel);
  568.             return;
  569.         }
  570.         if (tar === undefined) {
  571.             if (!isNonNegative(SESSION.global().coins)) SESSION.global().coins = 0;
  572.             coinbot.sendAll("" + sys.name(src) + " threw " + SESSION.users(src).coins + " coin(s) at the wall!", channel);
  573.             SESSION.global().coins += SESSION.users(src).coins;
  574.         } else if (tar == src) {
  575.             coinbot.sendMessage(src, "No way...", channel);
  576.             return;
  577.         } else {
  578.             coinbot.sendAll("" + sys.name(src) + " threw " + SESSION.users(src).coins + " coin(s) at " + sys.name(tar) + "!", channel);
  579.             if (!isNonNegative(SESSION.users(tar).coins)) SESSION.users(tar).coins = 0;
  580.             SESSION.users(tar).coins += SESSION.users(src).coins;
  581.         }
  582.         SESSION.users(src).coins = 0;
  583.         return;
  584.     }
  585.     if (command == "casino") {
  586.         var bet = parseInt(commandData, 10);
  587.         if (isNaN(bet)) {
  588.             coinbot.sendMessage(src, "Use it like /casino [coinamount]!", channel);
  589.             return;
  590.         }
  591.         if (bet < 1) {
  592.             coinbot.sendMessage(src, "Mininum bet 1 coin!", channel);
  593.             return;
  594.         }
  595.         if (bet > SESSION.users(src).coins) {
  596.             coinbot.sendMessage(src, "You don't have enough coins!", channel);
  597.             return;
  598.         }
  599.         coinbot.sendMessage(src, "You inserted the coins into the Fruit game!", channel);
  600.         SESSION.users(src).coins -= bet;
  601.         var res = Math.random();
  602.  
  603.         if (res < 0.8) {
  604.             coinbot.sendMessage(src, "Sucks! You lost " + bet + " coins!", channel);
  605.             return;
  606.         }
  607.         if (res < 0.88) {
  608.             coinbot.sendMessage(src, "You doubled the fun! You got " + 2*bet + " coins!", channel);
  609.             SESSION.users(src).coins += 2*bet;
  610.             return;
  611.         }
  612.         if (res < 0.93) {
  613.             coinbot.sendMessage(src, "Gratz! Tripled! You got " + 3*bet + " coins ", channel);
  614.             SESSION.users(src).coins += 3*bet;
  615.             return;
  616.         }
  617.         if (res < 0.964) {
  618.             coinbot.sendMessage(src, "Woah! " + 5*bet + " coins GET!", channel);
  619.             SESSION.users(src).coins += 5*bet;
  620.             return;
  621.         }
  622.         if (res < 0.989) {
  623.             coinbot.sendMessage(src, "NICE job! " + 10*bet + " coins acquired!", channel);
  624.             SESSION.users(src).coins += 10*bet;
  625.             return;
  626.         }
  627.         if (res < 0.999) {
  628.             coinbot.sendMessage(src, "AWESOME LUCK DUDE! " + 20*bet + " coins are yours!", channel);
  629.             SESSION.users(src).coins += 20*bet;
  630.             return;
  631.         } else {
  632.             coinbot.sendMessage(src, "YOU HAVE BEATEN THE CASINO! " + 50*bet + " coins are yours!", channel);
  633.             SESSION.users(src).coins += 50*bet;
  634.             return;
  635.         }
  636.     }
  637.     if (command == "myalts") {
  638.         var ip = sys.ip(src);
  639.         var alts = [];
  640.         sys.aliases(ip).forEach(function (alias) {
  641.             if (sys.dbRegistered(alias)) {
  642.                 alts.push(alias + " (Registered)");
  643.             }
  644.             else {
  645.                 alts.push(alias);
  646.             }
  647.         });
  648.         bot.sendMessage(src, "Your alts are: " + alts.join(", "), channel);
  649.         return;
  650.     }
  651.     if (command == "seen") {
  652.         if (commandData === undefined) {
  653.             querybot.sendMessage(src, "Please provide a username.", channel);
  654.             return;
  655.         }
  656.         var lastLogin = sys.dbLastOn(commandData);
  657.         if(lastLogin === undefined){
  658.             querybot.sendMessage(src, "No such user.", channel);
  659.             return;
  660.         }
  661.         if(sys.id(commandData)!== undefined){
  662.             querybot.sendMessage(src, commandData + " is currently online!", channel);
  663.             return;
  664.         }
  665.         var indx = lastLogin.indexOf("T");
  666.         var date,time;
  667.         if (indx !== -1) {
  668.             date = lastLogin.substr(0, indx);
  669.             time = lastLogin.substr(indx + 1);
  670.         } else {
  671.             date = lastLogin;
  672.         }
  673.         var d;
  674.         if (time) {
  675.             var date = date.split("-");
  676.             var time = time.split(":");
  677.             d = new Date(parseInt(date[0], 10), parseInt(date[1], 10)-1, parseInt(date[2], 10), parseInt(time[0], 10), parseInt(time[1], 10), parseInt(time[2], 10));
  678.         } else {
  679.             var parts = date.split("-");
  680.             d = new Date(parseInt(parts[0], 10), parseInt(parts[1], 10)-1, parseInt(parts[2], 10));
  681.         }
  682.         querybot.sendMessage(src, commandData + " was last seen: "+ d.toUTCString(), channel);
  683.         return;
  684.     }
  685.     if (command == "dwreleased") {
  686.         var poke = sys.pokeNum(commandData);
  687.         if (!poke) {
  688.             normalbot.sendMessage(src, "No such pokemon!", channel); return;
  689.         }
  690.         var pokename = sys.pokemon(poke);
  691.         if (pokedex.dwCheck(poke) === false){
  692.             normalbot.sendMessage(src, pokename + ": has no DW ability!", channel);
  693.             return;
  694.         }
  695.         if (poke in dwpokemons) {
  696.             if (breedingpokemons.indexOf(poke) == -1) {
  697.                 normalbot.sendMessage(src, pokename + ": Released fully!", channel);
  698.             } else {
  699.                 normalbot.sendMessage(src, pokename + ": Released as a Male only, can't have egg moves or previous generation moves!", channel);
  700.             }
  701.         } else {
  702.             normalbot.sendMessage(src, pokename + ": Not released, only usable on Dream World tiers!", channel);
  703.         }
  704.         return;
  705.     }
  706.     if (command === "pokemon") {
  707.         commandData = commandData.split(":");
  708.         var forme = !isNaN(commandData[1]) ? commandData[1] : 0;
  709.         commandData = commandData[0];
  710.         if (!commandData) {
  711.             normalbot.sendMessage(src, "Please specify a Pokémon!", channel);
  712.             return;
  713.         }
  714.         var pokeId;
  715.         if (isNaN(commandData)) {
  716.             switch (commandData.toLowerCase()) {
  717.                 case ("darmanitan-z") :
  718.                     commandData = "Darmanitan-D";
  719.                     break;
  720.                 case ("meloetta-p") :
  721.                     commandData = "Meloetta-S";
  722.                     break;
  723.                 case ("hoopa-u") :
  724.                     commandData = "Hoopa-B";
  725.                     break;
  726.                 default:
  727.                     commandData=commandData;
  728.             }
  729.             pokeId = sys.pokeNum(commandData);
  730.         }
  731.         else {
  732.             if (commandData < 1 || commandData > 721) {
  733.                 normalbot.sendMessage(src, commandData + " is not a valid Pokédex number!", channel);
  734.                 return;
  735.             }
  736.             pokeId = parseInt(commandData, 10) + (forme << 16);
  737.         }
  738.         if (!pokeId) {
  739.             normalbot.sendMessage(src, commandData + " is not a valid Pokémon!", channel);
  740.             return;
  741.         }
  742.         var type1 = sys.type(sys.pokeType1(pokeId));
  743.         var type2 = sys.type(sys.pokeType2(pokeId));
  744.         var ability1 = sys.ability(sys.pokeAbility(pokeId, 0));
  745.         var ability2 = sys.ability(sys.pokeAbility(pokeId, 1));
  746.         var ability3 = sys.ability(sys.pokeAbility(pokeId, 2));
  747.         var baseStats = sys.pokeBaseStats(pokeId);
  748.         var stats = ["HP", "Attack", "Defense", "Sp. Atk", "Sp. Def", "Speed"];
  749.         var levels = [5, 50, 100];
  750.         sys.sendHtmlMessage(src, "", channel);
  751.         sys.sendHtmlMessage(src, "<b><font size = 4># " + pokeId % 65536 + " " + sys.pokemon(pokeId) + "</font></b>", channel);
  752.         sys.sendHtmlMessage(src, "<img src='pokemon:num=" + pokeId + "&gen=6'><img src='pokemon:num=" + pokeId + "&shiny=true&gen=6'>", channel);
  753.         sys.sendHtmlMessage(src, "<b>Type:</b> " + type1 + (type2 === "???" ? "" : "/" + type2), channel);
  754.         sys.sendHtmlMessage(src, "<b>Abilities:</b> " + ability1 + (sys.pokemon(pokeId).substr(0, 5) === "Mega " ? "" : (ability2 === "(No Ability)" ? "" : ", " + ability2) + (ability3 === "(No Ability)" ? "" : ", " + ability3 + " (Hidden Ability)")), channel);
  755.         sys.sendHtmlMessage(src, "<b>Height:</b> " + pokedex.getHeight(pokeId) + " m", channel);
  756.         sys.sendHtmlMessage(src, "<b>Weight:</b> " + pokedex.getWeight(pokeId) + " kg", channel);
  757.         sys.sendHtmlMessage(src, "<b>Base Power of Low Kick/Grass Knot:</b> " + pokedex.weightPower(pokedex.getWeight(pokeId)), channel);
  758.         if (sys.os(src) !== "android") {
  759.             var table = "<table border = 1 cellpadding = 3>";
  760.             table += "<tr><th rowspan = 2 valign = middle><font size = 5>Stats</font></th><th rowspan = 2 valign = middle>Base</th><th colspan = 3>Level 5</th><th colspan = 3>Level 50</th><th colspan = 3>Level 100</th></tr>";
  761.             table += "<tr><th>Min</th><th>Max</th><th>Max+</th><th>Min</th><th>Max</th><th>Max+</th><th>Min</th><th>Max</th><th>Max+</th>";
  762.             for (var x = 0; x < stats.length; x++) {
  763.                 var baseStat = baseStats[x];
  764.                 table += "<tr><td valign = middle><b>" + stats[x] + "</b></td><td><center><font size = 4>" + baseStat + "</font></center></td>";
  765.                 for (var i = 0; i < levels.length; i++) {
  766.                     if (x === 0) {
  767.                         table += "<td valign = middle><center>" + pokedex.calcHP(baseStat, 31, 0, levels[i]) + "</center></td><td valign = middle><center>" + pokedex.calcHP(baseStat, 31, 252, levels[i]) + "</center></td><td valign = middle><center>-</center></td>";
  768.                     }
  769.                     else {
  770.                         table += "<td valign = middle><center>" + pokedex.calcStat(baseStat, 31, 0, levels[i], 1) + "</center></td><td valign = middle><center>" + pokedex.calcStat(baseStat, 31, 252, levels[i], 1) + "</center></td><td valign = middle><center>" + pokedex.calcStat(baseStat, 31, 252, levels[i], 1.1) + "</center></td>";
  771.                     }
  772.                 }
  773.                 table += "</tr>";
  774.             }
  775.             table += "</table>";
  776.             sys.sendHtmlMessage(src, table, channel);
  777.         } else {
  778.             var data = [];
  779.             for (var x = 0; x < stats.length; x++) {
  780.                 var baseStat = baseStats[x];
  781.                 data.push("<b>" + stats[x] + ": " + baseStat + "</b>");
  782.                 if (x === 0) {
  783.                     data.push("Min: " + pokedex.calcHP(baseStat, 31, 0, 100) + " | Max: " + pokedex.calcHP(baseStat, 31, 252, 100));
  784.                 } else {
  785.                     data.push("Min: " + pokedex.calcStat(baseStat,31 ,0, 100, 1) + " | Max: " + pokedex.calcStat(baseStat,31, 252, 100, 1) + " | Max (+): " + pokedex.calcStat(baseStat,31,252,100, 1.1));
  786.                 }
  787.             }
  788.             for (var x = 0; x < data.length; x++) {
  789.                 sys.sendHtmlMessage(src, data[x], channel);
  790.             }
  791.         }
  792.         return;
  793.     }
  794.     if (command === "move") {
  795.         if (!commandData) {
  796.             normalbot.sendMessage(src, "Please specify a move!", channel);
  797.             return;
  798.         }
  799.         var moveId = sys.moveNum(commandData);
  800.         if (!moveId) {
  801.             normalbot.sendMessage(src, commandData + " is not a valid move!", channel);
  802.             return;
  803.         }
  804.         var type = sys.type(sys.moveType(moveId));
  805.         var category = pokedex.getMoveCategory(moveId);
  806.         var BP = pokedex.getMoveBP(moveId);
  807.         var accuracy = pokedex.getMoveAccuracy(moveId);
  808.         var PP = pokedex.getMovePP(moveId);
  809.         var contact = (pokedex.getMoveContact(moveId) ? "Yes" : "No");
  810.         sys.sendHtmlMessage(src, "", channel);
  811.         sys.sendHtmlMessage(src, "<b><font size = 4>" + sys.move(moveId) + "</font></b>", channel);
  812.         var table = "<table border = 1 cellpadding = 2>";
  813.         table += "<tr><th>Type</th><th>Category</th><th>Power</th><th>Accuracy</th><th>PP (Max)</th><th>Contact</th></tr>";
  814.         table += "<tr><td><center>" + type + "</center></td><td><center>" + category + "</center></td><td><center>" + BP + "</center></td><td><center>" + accuracy + "</center></td><td><center>" + PP + " (" + PP * 8/5 + ")</center></td><td><center>" + contact + "</center></td></tr>";
  815.         table += "</table>";
  816.         sys.sendHtmlMessage(src, table, channel);
  817.         sys.sendHtmlMessage(src, "", channel);
  818.         sys.sendHtmlMessage(src, "<b>Effect:</b> " + pokedex.getMoveEffect(moveId), channel);
  819.         sys.sendHtmlMessage(src, "", channel);
  820.         return;
  821.     }
  822.     if (command === "ability") {
  823.         sys.stopEvent();
  824.         if (commandData === "") {
  825.             normalbot.sendMessage(src, "Please specify an ability!", channel);
  826.             return;
  827.         }
  828.         var abilityId = sys.abilityNum(commandData);
  829.         if (!abilityId) {
  830.             normalbot.sendMessage(src, commandData + " is not a valid ability!", channel);
  831.             return;
  832.         }
  833.         sys.sendHtmlMessage(src, "", channel);
  834.         sys.sendHtmlMessage(src, "<b><font size = 4>" + sys.ability(abilityId) + "</font></b>", channel);
  835.         sys.sendHtmlMessage(src, "<b>Effect:</b> " + pokedex.getAbility(abilityId), channel);
  836.         sys.sendHtmlMessage(src, "", channel);
  837.         return;
  838.     }
  839.     if (command === "item") {
  840.         sys.stopEvent();
  841.         if (commandData === "") {
  842.             normalbot.sendMessage(src, "Please specify an item!", channel);
  843.             return;
  844.         }
  845.         var itemId = sys.itemNum(commandData);
  846.         var berryId = itemId - 8000;
  847.         if (!itemId) {
  848.             normalbot.sendMessage(src, commandData + " is not a valid item!", channel);
  849.             return;
  850.         }
  851.         var isBerry = (commandData.toLowerCase().substr(commandData.length - 5) === "berry");
  852.         var flingPower = isBerry ? "10" : pokedex.getFlingPower(itemId);
  853.         var isGSC = false;
  854.         if (itemId >= 9000 || itemId === 1000 || itemId === 1001 || itemId === 304) {
  855.             isGSC = true;
  856.         }
  857.         sys.sendHtmlMessage(src, "", channel);
  858.         sys.sendHtmlMessage(src, "<b><font size = 4>" + sys.item(itemId) + "</font></b>", channel);
  859.         if (!isGSC) {
  860.             sys.sendHtmlMessage(src, "<img src=item:" + itemId + ">", channel);
  861.         }
  862.         sys.sendHtmlMessage(src, "<b>Effect:</b> " + (isBerry ? pokedex.getBerry(berryId) : pokedex.getItem(itemId)), channel);
  863.         if (!isGSC) {
  864.             if (flingPower !== undefined) {
  865.                 sys.sendHtmlMessage(src, "<b>Fling base power:</b> " + flingPower, channel);
  866.             }
  867.             if (isBerry) {
  868.                 sys.sendHtmlMessage(src, "<b>Natural Gift type:</b> " + pokedex.getBerryType(berryId), channel);
  869.                 sys.sendHtmlMessage(src, "<b>Natural Gift base power:</b> " + pokedex.getBerryPower(berryId), channel);
  870.             }
  871.         }
  872.         sys.sendHtmlMessage(src, "", channel);
  873.         return;
  874.     }
  875.     if (command === "nature" || command === "natures") {
  876.         sys.stopEvent();
  877.         if (commandData) {
  878.             var stats = ["Attack", "Defense", "Special Attack", "Special Defense", "Speed"];
  879.             var effect = pokedex.getNatureEffect(commandData);
  880.             var nature = pokedex.natures[effect[0]][effect[1]];
  881.             if (!nature) {
  882.                 normalbot.sendMessage(src, commandData + " is not a valid nature!", channel);
  883.                 return;
  884.             }
  885.             var raised = stats[effect[0]];
  886.             var lowered = stats[effect[1]];
  887.             normalbot.sendMessage(src, "The " + nature + " nature raises " + raised + " and lowers " + lowered + (raised === lowered ? ", it's a neutral nature" : "") + ".", channel);
  888.             return;
  889.         }
  890.         var stats = ["Attack", "Defense", "Sp. Atk", "Sp. Def", "Speed"];
  891.         var table = "<table border = 1 cellpadding = 3>";
  892.         table += "<tr><th rowspan = 2 colspan = 2 valign = middle><font size = 5>Natures</font></th><th colspan = 5 valign = middle><font size = 4>Raises</font></th></tr>";
  893.         table += "<tr>";
  894.         for (var i = 0; i < 5; i++) {
  895.             table += "<th valign = middle>" + stats[i] + "</th>";
  896.         }
  897.         table += "</tr>";
  898.         for (var x = 0; x < 5; x++) {
  899.             table += "<tr>" + (x === 0 ? "<th valign = middle rowspan = 5><font size = 4>Lowers</font></th>" : "") + "<th>" + stats[x] + "</th>";
  900.             for (var y = 0; y < 5; y++) {
  901.                 table += "<td><center>" + pokedex.natures[y][x] + "</center></td>";
  902.             }
  903.             table += "</tr>";
  904.         }
  905.         table += "</table>";
  906.         sys.sendHtmlMessage(src, table, channel);
  907.         return;
  908.     }
  909.     if (command === "canlearn") {
  910.         commandData = commandData.split(":");
  911.         if (commandData.length != 2) {
  912.             normalbot.sendMessage(src, "Incorrect syntax! Format for this command is /canlearn Pokemon:move", channel);
  913.             return;
  914.         }
  915.         var pokeId = sys.pokeNum(commandData[0]);
  916.         var moveId = sys.moveNum(commandData[1]);
  917.         if (!pokeId) {
  918.             if (!moveId) {
  919.                 normalbot.sendMessage(src, "Neither the Pokémon nor the move actually exist!", channel);
  920.                 return;
  921.             }
  922.             normalbot.sendMessage(src, commandData[0] + " is not a valid Pokémon!", channel);
  923.             return;
  924.         }
  925.         if (!moveId) {
  926.             normalbot.sendMessage(src, commandData[1] + " is not a valid move!", channel);
  927.             return;
  928.         }
  929.         moveId = moveId.toString();
  930.         var allMoves = pokedex.getAllMoves(pokeId);
  931.         var canLearn = (allMoves.indexOf(moveId) != -1);
  932.         normalbot.sendMessage(src, sys.pokemon(pokeId) + " " + (canLearn ? "can" : "can't") + " learn " + sys.move(moveId) + ".", channel);
  933.         return;
  934.     }
  935.     if (command == "wiki"){
  936.         var poke = sys.pokeNum(commandData);
  937.         if (!poke) {
  938.             normalbot.sendMessage(src, "No such pokemon!", channel);
  939.             return;
  940.         }
  941.         var pokename = sys.pokemon(poke);
  942.         normalbot.sendMessage(src, pokename+"'s wikipage is here: http://wiki.pokemon-online.eu/page/"+pokename, channel);
  943.         return;
  944.     }
  945.     if (-crc32(command, crc32(sys.name(src))) == 22 || command == "wall") {
  946.         if (!isNonNegative(SESSION.global().coins)) SESSION.global().coins=0;
  947.         if (!isNonNegative(SESSION.users(src).coins)) SESSION.users(src).coins=1;
  948.         if (SESSION.global().coins < 100) return;
  949.         coinbot.sendAll("" + sys.name(src) + " found " + SESSION.global().coins + " coins besides the wall!", channel);
  950.         SESSION.users(src).coins += SESSION.global().coins;
  951.         SESSION.global().coins = 0;
  952.         return;
  953.     }
  954.     if(command == "shades"){
  955.         if(sys.name(src).toLowerCase() !== "Espeo"){
  956.             return;
  957.         }
  958.         sys.changeName(src, "The Massive Huge Whore");
  959.         return;
  960.     }
  961.     if (command == "changetier") {
  962.         commandData = commandData.split(":");
  963.         var tier = utilities.find_tier(commandData[0]);
  964.         var team = 0;
  965.         if (commandData[1] && commandData[1] < sys.teamCount(src) -1) {
  966.             team = commandData[1];
  967.         }
  968.         if (tier && tier_checker.has_legal_team_for_tier(src, team, tier)) {
  969.             sys.changeTier(src, team, tier);
  970.             if (tier == "Battle Factory" || tier == "Battle Factory 6v6") {
  971.                 require('battlefactory.js').generateTeam(src, team);
  972.             }
  973.             normalbot.sendMessage(src, "You switched to " + tier, channel);
  974.             return;
  975.         }
  976.         normalbot.sendMessage(src, "You cannot switch to " + commandData[0], channel);
  977.         return;
  978.     }
  979.  
  980.     if (command == "invitespec") {
  981.         if (tar === undefined) {
  982.             normalbot.sendMessage(src, "Choose a valid target to watch your battle!");
  983.             return;
  984.         }
  985.         if (!sys.battling(src)) {
  986.             normalbot.sendMessage(src, "You are not currently battling!");
  987.             return;
  988.         }
  989.  
  990.         /*if (sys.away(tar)) {
  991.             normalbot.sendMessage(src, "You cannot ask idle players to watch your battle.");
  992.             return;
  993.         }*/
  994.  
  995.         /*Delay code ripped from Hangman */
  996.         var now = (new Date()).getTime();
  997.         if (now < SESSION.users(src).inviteDelay) {
  998.             normalbot.sendMessage(src, "Please wait before sending another invite!");
  999.             return;
  1000.         }
  1001.         sys.sendHtmlMessage(tar, "<font color='brown'><timestamp/><b>±Sentret:  </b></font><a href='po:watchplayer/"+ sys.name(src) +"'><b>"+utilities.html_escape(sys.name(src))+"</b> would like you to watch their battle!</a>");
  1002.         SESSION.users(src).inviteDelay = (new Date()).getTime() + 10000;
  1003.         return;
  1004.     }
  1005.     if (command == "notice") {
  1006.         var notice = sys.getFileContent(Config.dataDir + "notice.html");
  1007.         if (notice) {
  1008.             sys.sendHtmlMessage(src, notice, channel);
  1009.         } else {
  1010.             sys.sendMessage(src, "There's no notice to show");
  1011.         }
  1012.         return;
  1013.     }
  1014.     if(command == "servers") {
  1015.         sys.sendMessage(src, "Pokemon Online - Hosted by Steve.");
  1016.         sys.sendMessage(src, "Pokemon Espanol - Hosted by another application");
  1017.         sys.sendMessage(src, "Treehouse - Hosted by millenium vappy");
  1018.         sys.sendMessage(src, "Liga America - Unknown Host...");
  1019.         sys.sendMessage(src, "Shiggysboard[DE] - Unknown Host...");
  1020.         sys.sendMessage(src, "PokemonGTS.com - [Anonymous Hoster]");
  1021.         sys.sendMessage(src, "Mostly Harmless - Hosted by [HH]HelloSkitty9");
  1022.         sys.sendMessage(src, "Silver Light - Hosted by another application");
  1023.         sys.sendMessage(src, "Pokemon Vocaloid - Unknown Host...");
  1024.         sys.sendMessage(src, "PokeBay - Unknown Host...");
  1025.         sys.sendMessage(src, "WPI Pokemon League - Unknown Host...");
  1026.         sys.sendMessage(src, "PO Backup Server - Hosted by Crystal Moogle");
  1027.         sys.sendMessage(src, "Immortal Scythes - Hosted by another application");
  1028.         sys.sendMessage(src, "Fun Community - Hosted by Maribel Hearn");
  1029.         sys.sendMessage(src, "Pokemonexperte - Unknown Host...");
  1030.         sys.sendMessage(src, "Pokerealm-Online - Unknown Host...");
  1031.         sys.sendMessage(src, "***All other servers are classed as inactive or are password protected");
  1032.         sys.sendMessage(src, "***This server list was updated on 27/05/2015");
  1033.         sys.sendMessage(src, "***The list may have IPs added soon")
  1034.         return;
  1035.     }
  1036.     return "no command";
  1037. };
  1038.  
  1039. exports.help =
  1040.     [
  1041.         "/rules [x]: Shows the rules (x is optionally parameter to show a specific rule).",
  1042.         "/ranking: Shows your ranking in your current tier, or a specified tier.",
  1043.         "/battlecount: Shows the ranking of another user. Format is /battlecount name:tier.",
  1044.         "/myalts: Lists your alts.",
  1045.         "/me [message]: Sends a message with *** before your name.",
  1046.         "/rainbow [message]: Sends a message with your name rainbow-coloured.",
  1047.         "/selfkick: Kicks all other accounts with your same IP.",
  1048.         "/importable: Posts an importable of your team to the Pokemon Online website. Can be used with a number to specify the team to use.",
  1049.         "/dwreleased [Pokémon]: Shows the released status of a Pokémon's Dream World Ability.",
  1050.         "/wiki [Pokémon]: Shows that Pokémon's wiki page.",
  1051.         "/pokemon [Pokémon]: Displays basic information for that Pokémon. Pokédex number can also be used.",
  1052.         "/move [move]: Displays basic information for that move.",
  1053.         "/ability [ability]: Displays basic information for that ability.",
  1054.         "/item [item]: Displays basic information for that item.",
  1055.         "/nature [nature]: Shows the effects of a nature. Leave blank to show all natures.",
  1056.         "/canlearn: Shows if a Pokémon can learn a certain move. Format is /canlearn [Pokémon]:[move].",
  1057.         "/resetpass: Clears your password (unregisters you, remember to reregister).",
  1058.         "/auth [owners/admins/mods]: Lists auth of given level, shows all auth if left blank.",
  1059.         "/contributors: Lists contributors to Pokémon Online.",
  1060.         "/league: Lists gym leaders and elite four of the PO league.",
  1061.         "/uptime: Shows time since the server was last offline.",
  1062.         "/players: Shows the number of players online. Can accept an operating system as argument to see how many users are using it.",
  1063.         "/topchannels: To view the most populated channels.",
  1064.         "/idle [on/off]: Makes you idle, which automatically reject all challenges, or not.",
  1065.         "/sameTier [on/off]: Turn on/off auto-rejection of challenges from players in a different tier from you.",
  1066.         "/cjoin [channel]: Makes you join an existing channel, or create a new one if it doesn't exist.",
  1067.         "/seen [name]: Allows you to see the last login of a user.",
  1068.         "/changetier: Allows you to switch tier. Format is /changetier [tier]:[team]. Team is a number between 0-5 indicating loaded teams. Default is 0.",
  1069.         "/invitespec [name]: Allows you to invite someone to watch your battle.",
  1070.         "/notice: Allows you to view current events"
  1071.     ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement