Пример #1
0
 private void StartFlood()
 {
     foreach (FloodEntry floodEntry in FloodEntries)
     {
         if (floodEntry.IsEnabled && floodEntry.UseTimer)
         {
             FloodEntry entry = floodEntry;
             floodEntry.LastSend = DateTime.Now;
             Bot.CallDelayed(floodEntry.Timer * 1000, () => OnTimerEnded(entry));
         }
     }
 }
Пример #2
0
        private void OnTimerEnded(FloodEntry entry)
        {
            if (!IsFloodEnabled)
            {
                return;
            }

            ExecuteEntry(entry, Bot.Character.Context.Actors.OfType <IPlayer>());

            if (IsFloodEnabled)
            {
                Bot.CallDelayed(entry.Timer * 1000, () => OnTimerEnded(entry));
            }
        }
Пример #3
0
        private void ExecuteEntry(FloodEntry entry, IEnumerable <IPlayer> receivers)
        {
            string text = entry.Text.Replace(MacroCounter, m_counter.ToString());

            foreach (FloodedChannel channel in entry.Channels.Where(x => x.IsEnabled))
            {
                if (channel.Channel != ChatActivableChannelsEnum.PSEUDO_CHANNEL_PRIVATE)
                {
                    Bot.Character.Say(text, channel.Channel);
                }
                else
                {
                    foreach (Character character in receivers)
                    {
                        Bot.Character.SayTo(text.Replace(MacroCharacter, character.Name), character.Name);
                    }
                }

                m_counter++;
            }

            entry.LastSend = DateTime.Now;
        }
 public BasicPluginSettings()
 {
     FloodEntries = new FloodEntry[0];
 }