Exemple #1
0
        public override void OnCommand(BotShell bot, CommandArgs e)
        {
            switch (e.Command)
            {
            case "cloak":
                if (this.State == VhCityState.Enabled && this.TimeLeft.TotalMinutes <= 0)
                {
                    bot.SendReply(e, "The city cloak is currently " + HTML.CreateColorString(RichTextWindow.ColorGreen, "enabled") + " and has been fully charged");
                }
                else if (this.State == VhCityState.Enabled)
                {
                    bot.SendReply(e, "The city cloak is currently " + HTML.CreateColorString(RichTextWindow.ColorGreen, "enabled") + " and will finish charging in " + Format.Time(this.TimeLeft, FormatStyle.Medium));
                }
                else if (this.State == VhCityState.Disabled && this.TimeLeft.TotalMinutes <= 0)
                {
                    bot.SendReply(e, "The city cloak is currently " + HTML.CreateColorString(RichTextWindow.ColorRed, "disabled") + " and requires enabling");
                }
                else if (this.State == VhCityState.Disabled)
                {
                    bot.SendReply(e, "The city cloak is currently " + HTML.CreateColorString(RichTextWindow.ColorRed, "disabled") + " and will require enabling in " + Format.Time(this.TimeLeft, FormatStyle.Medium));
                }
                else
                {
                    bot.SendReply(e, "The city cloak state is currently " + HTML.CreateColorString(RichTextWindow.ColorOrange, "unknown"));
                }
                break;

            case "cloak reset":
                this._state = VhCityState.Unknown;
                bot.SendReply(e, "The city cloak state has been reset to unknown");
                break;
            }
        }
Exemple #2
0
 private void OnChannelMessageEvent(BotShell bot, ChannelMessageArgs e)
 {
     if (e.Type != ChannelType.Organization)
     {
         return;
     }
     if (!e.IsDescrambled)
     {
         return;
     }
     if (e.Descrambled.CategoryID != 1001)
     {
         return;
     }
     switch (e.Descrambled.EntryID)
     {
     case 1:     // %s turned the cloaking device in your city %s.
         this._time     = DateTime.Now;
         this._username = e.Descrambled.Arguments[0].Text;
         //this._sentAnnounce = false;
         //this._sentPreAnnounce = false;
         //this._sentPostAnnounce = false;
         this._reminders = VhCityRemindState.Waiting;
         if (e.Descrambled.Arguments[1].Text.Equals("on", StringComparison.CurrentCultureIgnoreCase))
         {
             this._state = VhCityState.Enabled;
             this.SendMessage(bot, HTML.CreateColorString(bot.ColorHeaderHex, this._username) + " has " + HTML.CreateColorString(RichTextWindow.ColorGreen, "enabled") + " the city cloaking device");
         }
         else if (e.Descrambled.Arguments[1].Text.Equals("off", StringComparison.CurrentCultureIgnoreCase))
         {
             this._state = VhCityState.Disabled;
             this.SendMessage(bot, HTML.CreateColorString(bot.ColorHeaderHex, this._username) + " has " + HTML.CreateColorString(RichTextWindow.ColorRed, "disabled") + " the city cloaking device");
         }
         else
         {
             this._state = VhCityState.Unknown;
         }
         break;
     }
 }