Пример #1
0
        public override void Use(Player p, string message)
        {
            if (!p.extensions.Contains(Extension.MessageTypes))
            {
                Help(p); return;
            }
            string[] args = message.ToLower().Split(' ');
            if (args.Length < 2)
            {
                Help(p); return;
            }
            string custom = "";
            string type   = "";

            switch (args[1])
            {
            case "custom":
                if (args.Length < 3)
                {
                    Help(p); return;
                }
                custom = message.Substring(message.IndexOf(' ', message.IndexOf(args[2]) - 1));
                type   = args[1];
                break;

            case "compass":
            case "default":
            case "game":
            case "motd":
            case "block":
            case "clear":
                type = args[1];
                break;

            default:
                type = "default";
                break;
            }
            int i = 0;

            try
            {
                i = int.Parse(args[0]);
                if (i < 1 || 1 > 3)
                {
                    Help(p); return;
                }
            }
            catch { Help(p); return; }
            switch (i)
            {
            case 1:
                p.status1  = type;
                p.status1c = (type == "custom") ? custom : "";
                break;

            case 2:
                p.status2  = type;
                p.status2c = (type == "custom") ? custom : "";
                break;

            case 3:
                p.status3  = type;
                p.status3c = (type == "custom") ? custom : "";
                break;
            }
            p.UpdateStatusMessages();
            Player.SendMessage(p, "Your status message was changed to " + type + ((type == "custom") ? ": " + custom + "." : "."));
        }