示例#1
0
        private static void OnIRC(CommandEventArgs e)
        {
            try{
                if (ChatInfo.PublicPlusIRC && !(e.ArgString.ToLower().StartsWith("input ") && e.Mobile.AccessLevel == AccessLevel.Administrator))
                {
                    PublicChat.OnChat(e);
                    return;
                }

                if (e.ArgString == null || e.ArgString == "")
                {
                    return;
                }

                if (!CanIRC(e.Mobile, true))
                {
                    return;
                }

                if (e.ArgString.ToLower().StartsWith("input ") && e.Mobile.AccessLevel == AccessLevel.Administrator)
                {
                    IrcConnection.Connection.SendMessage(e.ArgString.Substring(6, e.ArgString.Length - 6));
                }
                else
                {
                    IrcConnection.Connection.SendUserMessage(e.Mobile, e.ArgString);
                }
            }catch { Errors.Report(String.Format("IRC-> OnIRC-> |{0}|", e.Mobile)); }
        }
示例#2
0
        private void BuildList()
        {
            try{
                c_List.Clear();

                switch (c_Listing)
                {
                case Listing.Public:

                    foreach (ChatInfo info in new ArrayList(ChatInfo.ChatInfos.Values))
                    {
                        if (info.Mobile == null || info.Mobile.Deleted)
                        {
                            ChatInfo.ChatInfos.Remove(info);
                            continue;
                        }

                        if (info.Mobile.NetState == null ||
                            info.Mobile.AccessLevel != AccessLevel.Player)
                        {
                            continue;
                        }

                        if (PublicChat.CanChat(info) || Owner.AccessLevel > info.Mobile.AccessLevel)
                        {
                            c_List.Add(info.Mobile);
                        }
                    }

                    c_List.Sort(new MobileName());

                    break;

                case Listing.Friends:

                    c_List = new ArrayList(c_Info.Friends);

                    if (!ChatInfo.ShowStaff)
                    {
                        foreach (Mobile m in new ArrayList(c_List))
                        {
                            if (m.AccessLevel != AccessLevel.Player)
                            {
                                c_List.Remove(m);
                            }
                        }
                    }

                    c_List.Sort(new MobileName());

                    break;

                case Listing.Search:

                    if (c_Info.Search == "")
                    {
                        break;
                    }

                    foreach (ChatInfo info in ChatInfo.ChatInfos.Values)
                    {
                        if (!ChatInfo.ShowStaff && info.Mobile.AccessLevel != AccessLevel.Player)
                        {
                            continue;
                        }

                        if (info.Mobile.Name.ToLower().IndexOf(c_Info.Search.ToLower()) != -1 &&
                            info.Mobile.NetState != null)
                        {
                            c_List.Add(info.Mobile);
                        }
                    }

                    c_List.Sort(new MobileName());

                    break;

                case Listing.IRC:

                    c_List = new ArrayList(ChatInfo.IrcList);
                    c_List.Sort(new Alpha());

                    break;

                case Listing.Messages:

                    c_List = new ArrayList(c_Mailbox ? c_Info.Messages : c_Info.SavedMsgs);
                    c_List.Sort(new MessageTime());

                    break;

                case Listing.Ignores:

                    c_List = new ArrayList(c_Info.Ignores);
                    c_List.AddRange(c_Info.GlobalIgnores);

                    if (!ChatInfo.ShowStaff)
                    {
                        foreach (Mobile m in new ArrayList(c_List))
                        {
                            if (m.AccessLevel != AccessLevel.Player)
                            {
                                c_List.Remove(m);
                            }
                        }
                    }

                    c_List.Sort(new MobileName());

                    break;

                case Listing.Guild:

                    foreach (ChatInfo info in ChatInfo.ChatInfos.Values)
                    {
                        if (info.Mobile.Guild != null &&
                            info.Mobile.Guild == Owner.Guild)
                        {
                            c_List.Add(info.Mobile);
                        }
                    }

                    c_List.Sort(new MobileName());

                    break;

                case Listing.Faction:

                    foreach (ChatInfo info in ChatInfo.ChatInfos.Values)
                    {
                        if (FactionChat.SameFaction(Owner, info.Mobile))
                        {
                            c_List.Add(info.Mobile);
                        }
                    }

                    c_List.Sort(new MobileName());

                    break;

                case Listing.Staff:

                    foreach (ChatInfo info in ChatInfo.ChatInfos.Values)
                    {
                        if (info.Mobile.AccessLevel != AccessLevel.Player)
                        {
                            c_List.Add(info.Mobile);
                        }
                    }

                    c_List.Sort(new MobileAccessLevel());

                    break;

                case Listing.Banned:

                    foreach (ChatInfo info in ChatInfo.ChatInfos.Values)
                    {
                        if (info.Banned)
                        {
                            c_List.Add(info.Mobile);
                        }
                    }

                    c_List.Sort(new MobileName());

                    break;
                }
            }catch { Errors.Report(String.Format("ListGump-> BuildList-> |{0}|", Owner)); }
        }