Esempio n. 1
0
        public Listener(MainPanel panel)
        {
            CommandOutput    = panel.CommandOutputBox;
            LogOutput        = panel.LogText;
            _commandListener = new CommandListener();

            _commandListener.AddCommand(new Xana());
            _commandListener.AddCommand(new LW());
            _commandListener.AddCommand(new Aelita());

            //Ensure Help command is always the last command to be added to the listener
            List <Command> commands = _commandListener.GetCommands();

            _commandListener.AddCommand(new Help(ref commands));
        }
Esempio n. 2
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            CommandListener.AddCommand("!~adduser", AddUser, true);
            CommandListener.AddCommand("!~removeuser", RemoveUser, true);
            CommandListener.AddCommand("!~setname", SetName, true);
        }
Esempio n. 3
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            mapList = new MapList(this);
            config  = new MapModuleConfig();

            CommandListener.AddCommand <MapAdd>(ADD);
            CommandListener.AddCommand <MapRemove>(DELETE);
            CommandListener.AddCommand <MapGet>(GET);
            CommandListener.AddCommand <MapUpdate>(UPDATE);
        }
Esempio n. 4
0
        protected override void OnInitialize()
        {
            Config  = new Config();
            Data    = new Data(this);
            Strings = new Strings(this);

            // Set announcement mode
            AnnouncementMode = Config.Data.AnnouncementMode;

            // Create the announcer
            announcer               = new Announcer();
            announcer.Announce     += OnAnnounce;
            announcer.AllAnnounced += OnAllAnnouncements;

            // Make an announcement once every hour.
            for (int i = 0; i < 24; i++)
            {
                announcer.AddTime(i, 59, 59);
            }

            announcer.Start();

            Logger.Info("Announcements remaining for {0}: {1}", DateTime.Now.DayOfWeek.ToString(), announcer.AnnouncementsRemaining);

            CommandListener.AddCommand <GetDogOfTheDay>(DOTD);
            CommandListener.AddCommand <GetDogOfTheDayCount>("!dotdcount");
            CommandListener.AddCommand <Stats>("!dotdstats");
            CommandListener.AddCommand <SubmitDogOfTheDay>("!dotdsubmit");
            CommandListener.AddCommand("!dogrnd", GetRandomDog);

            CommandListener.AddCommand("!dogpost", Post, true);
            CommandListener.AddCommand("!dogmovenext", MoveNext, true);
            CommandListener.AddCommand("!dogmute", Mute, true);
            CommandListener.AddCommand("!dogunmute", Unmute, true);
            CommandListener.AddCommand("!dogsort", Sort, true);
            CommandListener.AddCommand("!dogqueue", QueueInfo, true);
            CommandListener.AddCommand("!dogpeek", Peek, true);
            CommandListener.AddCommand("!dogtoggle", ToggleAnnouncementMode, true);
        }
Esempio n. 5
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            // Get Servers.
            var config = new Config();

            if (config.Data.Servers == null)
            {
                Logger.Warning("No Servers found in config...");
            }
            else
            {
                foreach (var server in config.Data.Servers)
                {
                    CommandListener.AddCommand <ServerQuery>(server.Alias, (command) =>
                    {
                        command.ServerName = server.Name;
                        command.Hostname   = server.Host;
                        command.Port       = server.Port;
                    });
                }
            }
        }
Esempio n. 6
0
        public void Update()
        {
            RemoveLoggedOutPlayers();

            if (m_LeaveTimers.Count > 0)
            {
                List <LeaveTimer> toRemove = new List <LeaveTimer>();
                foreach (LeaveTimer t in m_LeaveTimers)
                {
                    if (t.IsExpired())
                    {
                        m_CommandListener.AddCommand("sub", AddToSubList);
                        Chat.SendMessage(">> Leaver Detected: " + t.Leaver.Name);
                        Chat.SendMessage(">> Type /sub to join.");
                        m_SubSearches.Add(new SubSearch(t.Leaver));
                        toRemove.Add(t);
                    }
                    else if (m_Context.GetPlayer(t.Leaver.Name) != null)
                    {
                        //player rejoined
                        m_Context.AddPlayerToTeam(t.Leaver.Name, t.Leaver.TeamLeft);
                        toRemove.Add(t);
                    }
                }
                m_LeaveTimers.RemoveAll(x => toRemove.Contains(x));
            }

            if (m_SubSearches.Count > 0)
            {
                List <SubSearch> done             = new List <SubSearch>();
                bool             sentNoSubMessage = false;
                foreach (SubSearch s in m_SubSearches)
                {
                    if (s.IsExpired())
                    {
                        if (m_PotentialSubs.Count > 0)
                        {
                            RankedPlayer p = s.ClosestElo(m_PotentialSubs);
                            m_Context.RemovePlayerFromTeam(p.Name);
                            m_Context.AddPlayerToTeam(p.Name, s.Team);
                            Chat.SendMessage(">> " + p.Name + " added to " + s.Team.ToString() + " team.");
                            done.Add(s);
                        }
                        else
                        {
                            if (!sentNoSubMessage)
                            {
                                Chat.SendMessage(">> No Sub Found.");
                                Chat.SendMessage(">> Type /sub to join.");
                                sentNoSubMessage = true;
                            }

                            s.ResetSearchTime();
                        }
                    }
                }
                m_SubSearches.RemoveAll(x => done.Contains(x));

                if (m_SubSearches.Count == 0)
                {
                    m_PotentialSubs = new List <RankedPlayer>();
                    m_CommandListener.RemoveCommand("sub");
                }
            }
        }