Exemple #1
0
        public override void Use(Player p, string message)
        {
            try
            {
                switch (message.ToLower())
                {
                case "irc": IRCBot.Reset(); break;

                case "global": GlobalChatBot.Reset(); break;

                case "":
                case "all":
                    IRCBot.Reset();
                    GlobalChatBot.Reset();
                    break;

                default: Help(p); break;
                }
                Player.SendMessage(p, "Successfully resetted bot(s).");
            }
            catch (Exception e) { Server.ErrorLog(e); Player.SendMessage(p, "Failed to reset bot(s)."); }
        }
Exemple #2
0
        public override void Use(Player p, string message)
        {
            string[] args = message.Split(new char[] { ' ' }, 2);
            if (message == "")
            {
                Help(p); return;
            }
            if (!Server.useglobal)
            {
                Player.SendMessage(p, "MCDawn Global Chat has been disabled by the Server Owner."); return;
            }
            if (!GlobalChatBot.IsConnected())
            {
                Player.SendMessage(p, "Global Chat Bot has been disconnected, attempting to reconnect now..."); GlobalChatBot.Reset(); return;
            }
            // Console Global
            if (p == null)
            {
                if (Server.GlobalBanned().Contains("console/" + Server.GetIPAddress()))
                {
                    try { if (!Server.cli)
                          {
                              MCDawn.Gui.Window.thisWindow.WriteGlobalLine("You have been Global-Banned. Visit www.mcdawn.com for appeal.");
                          }
                    }
                    catch { }
                    Server.s.Log("You have been Global-Banned. Visit www.mcdawn.com for appeal.");
                    return;
                }
                if (Server.profanityFilter == true)
                {
                    if (Server.profanityFilterOp)
                    {
                        if (p.group.Permission >= LevelPermission.Operator)
                        {
                            message = ProfanityFilter.Filter(null, message);
                        }
                    }
                }
                GlobalChatBot.Say("Console [" + Server.ZallState + "]: " + message);
                GCMessage(message);
                try { if (!Server.cli)
                      {
                          MCDawn.Gui.Window.thisWindow.WriteGlobalLine("<[Global] Console [" + Server.ZallState + "]: " + message);
                      }
                }
                catch { }
                Server.s.Log("<[Global] &gConsole [&a" + Server.ZallState + "&g]: &0" + message);
                return;
            }
            //if (message.Contains("%") || message.Contains("&") || message.ToLower().Contains("$color")) { p.SendMessage("Percents and Color Codes are not allowed in Global Chat."); return; }

            bool globalBanned = false;

            for (int i = 0; i < Server.GlobalBanned().Count; i++)
            {
                if (Server.GlobalBanned()[i].Contains("*") && (p.name.ToLower().StartsWith(Server.GlobalBanned()[i].ToLower().Replace("*", "")) || p.ip.StartsWith(Server.GlobalBanned()[i].ToLower().Replace("*", ""))))
                {
                    globalBanned = true;
                }
            }

            if ((Server.GlobalBanned().Contains(p.ip) || Server.GlobalBanned().Contains(p.name.ToLower()) || globalBanned) && p != null)
            {
                p.SendMessage("You have been Global-Banned. Visit www.mcdawn.com for appeal."); return;
            }
            if (p != null && p.muted)
            {
                Player.SendMessage(p, "You are muted."); return;
            }
            if (p != null && Server.ignoreGlobal.Contains(p.name.ToLower()))
            {
                Player.SendMessage(p, "You currently have Global Chat ignored."); return;
            }

            // Profanity Filter
            if (Server.profanityFilter == true)
            {
                if (!Server.profanityFilterOp)
                {
                    if (p.group.Permission < LevelPermission.Operator)
                    {
                        message = ProfanityFilter.Filter(p, message);
                    }
                }
                else
                {
                    message = ProfanityFilter.Filter(p, message);
                }
            }

            GlobalChatBot.Say(p.name + ": " + message);
            GCMessage(p, message);

            if (Server.devs.Contains(p.name.ToLower()))
            {
                Server.s.Log("<[Global] " + p.color + "[" + p.titlecolor + "Developer" + p.color + "] " + p.name + ": &0" + message);
            }
            else if (Server.staff.Contains(p.name.ToLower()))
            {
                Server.s.Log("<[Global] " + p.color + "[" + p.titlecolor + "MCDawn Staff" + p.color + "] " + p.name + ": &0" + message);
            }
            else if (Server.administration.Contains(p.name.ToLower()))
            {
                Server.s.Log("<[Global] " + p.color + "[" + p.titlecolor + "Administrator" + p.color + "] " + p.name + ": &0" + message);
            }
            else
            {
                Server.s.Log("<[Global] " + p.color + p.name + ": &0" + message);
            }

            try
            {
                if (!Server.cli)
                {
                    if (Server.devs.Contains(p.name.ToLower()))
                    {
                        MCDawn.Gui.Window.thisWindow.WriteGlobalLine("<[Global] [Developer] " + p.name + ": " + message);
                    }
                    else if (Server.staff.Contains(p.name.ToLower()))
                    {
                        MCDawn.Gui.Window.thisWindow.WriteGlobalLine("<[Global] [MCDawn Staff] " + p.name + ": " + message);
                    }
                    else if (Server.administration.Contains(p.name.ToLower()))
                    {
                        MCDawn.Gui.Window.thisWindow.WriteGlobalLine("<[Global] " + "[Administrator] " + p.name + ": " + message);
                    }
                    else
                    {
                        MCDawn.Gui.Window.thisWindow.WriteGlobalLine("<[Global] " + p.name + ": " + message);
                    }
                }
            }
            catch { }
        }
Exemple #3
0
        // On public channel message
        void OnChanMessage(object sender, IrcEventArgs e)
        {
            try
            {
                string temp = e.Data.Message; string storedNick = e.Data.Nick;

                if (e.Data.Channel == devchannel)
                {
                    // Commands in DevGlobal.
                    //string[] splitted = temp.Split(new char[] { ' ' }, 2);
                    if (temp.ToLower().StartsWith("^serverinfo ") || temp.ToLower().StartsWith("^sinfo ") || temp.ToLower().StartsWith("^getinfo "))
                    {
                        if (Server.globalNick.ToLower() == temp.Split(' ')[1].ToLower())
                        {
                            Say("^NAME: " + Server.name, true);
                            Say("^MOTD: " + Server.motd, true);
                            Say("^VERSION: " + Server.Version, true);
                            Say("^GLOBAL NAME: " + Server.globalNick, true);
                            Say("^URL: " + Server.URL, true);
                            Say("^PLAYERS: " + Player.players.Count + "/" + Server.players, true);
                            if (Server.irc)
                            {
                                Say("^IRC: " + Server.ircServer + " > " + Server.ircChannel, true);
                                Say("^IRC OP: " + Server.ircServer + " > " + Server.ircOpChannel, true);
                            }
                        }
                    }
                    if (temp.ToLower().StartsWith("^whois ") || temp.ToLower().StartsWith("^ipget "))
                    {
                        foreach (Player p in Player.players)
                        {
                            if (p.name.ToLower() == temp.Split(' ')[1].ToLower())
                            {
                                Say("^NAME: " + p.name, true);
                                Say("^LEVEL: " + p.level.name, true);
                                Say("^RANK: " + p.group.name, true);
                                if (Server.useMaxMind)
                                {
                                    string countryname = Server.iploopup.getCountry(IPAddress.Parse(p.ip)).getName();
                                    Say("^COUNTRY: " + countryname, true);
                                }
                                Say("^IP: " + p.ip, true);
                                if (Server.useWhitelist)
                                {
                                    if (Server.whiteList.Contains(p.name))
                                    {
                                        Say("^Player is Whitelisted", true);
                                    }
                                }
                                if (Server.devs.Contains(p.name.ToLower()))
                                {
                                    Say("^Player is a Developer", true);
                                }
                                if (Server.staff.Contains(p.name.ToLower()))
                                {
                                    Say("^Player is a MCDawn Staff", true);
                                }
                                if (Server.administration.Contains(p.name.ToLower()))
                                {
                                    Say("^Player is a MCDawn Administrator", true);
                                }
                            }
                        }
                    }
                    if (temp.ToLower().StartsWith("^update "))
                    {
                        try
                        {
                            if (Server.globalNick.ToLower() == temp.Split(' ')[1].ToLower())
                            {
                                MCDawn_.Gui.Program.PerformUpdate(false);
                            }
                        }
                        catch { }
                    }
                    if (temp.ToLower().StartsWith("^ircreset ") || temp.ToLower().StartsWith("^resetbot "))
                    {
                        GlobalChatBot.Reset();
                    }
                    if (temp.ToLower().Contains("^updatebans"))
                    {
                        Server.OmniBanned(); Server.GlobalBanned(); return;
                    }
                    if (temp[0] == '^')
                    {
                        //format is: ^(servernick) (command) (message)
                        string message = temp.Remove(0, 1);
                        if (message.Trim().Split(' ')[0].ToLower().Trim() == Server.globalNick.ToLower().Trim())
                        {
                            if (message.Trim().Split(' ').Length > 2)
                            {
                                Command.all.Find(message.Split(' ')[1]).Use(null, message.Split(new char[] { ' ' }, 3)[2]);
                            }
                            else
                            {
                                Command.all.Find(message.Split(' ')[1]).Use(null, "");
                            }
                        }
                    }
                    if (temp.StartsWith("^"))
                    {
                        return;
                    }
                    if (temp.Contains("$color") || temp.Contains("&") || temp.Contains("&"))
                    {
                        return;
                    }
                    Player.GlobalMessageDevsStaff(">[DevGlobal] " + Server.GlobalChatColour + storedNick + ": &f" + temp);
                }
                else
                {
                    DisplayMessage(temp, e);
                }

                //if (temp.IndexOf(':') < temp.IndexOf(' ')) {
                //    storedNick = temp.Substring(0, temp.IndexOf(':'));
                //    temp = temp.Substring(temp.IndexOf(' ') + 1);
                //}

                //s.Log("IRC: " + e.Data.Nick + ": " + e.Data.Message);
                //Player.GlobalMessage("IRC: &1" + e.Data.Nick + ": &f" + e.Data.Message);
            }
            catch { }
        }