Example #1
0
        private void Send()
        {
            try{
                if (!Pm.CanReply(ChatInfo.GetInfo(Owner), ChatInfo.GetInfo(c_Other)))
                {
                    Owner.SendMessage(ChatInfo.GetInfo(Owner).SystemColor, "Your message could not be delivered.");
                    return;
                }

                if (GetTextField(0) == "")
                {
                    NewGump();
                    return;
                }

                c_Message.AddMessage(Owner, GetTextField(0));

                Server.Scripts.Commands.CommandLogging.WriteLine(Owner, String.Format("<PM> {0} to {1}: {2}", Owner.Name, c_Other.Name, GetTextField(0)));

                foreach (ChatInfo ci in ChatInfo.ChatInfos.Values)
                {
                    if (ci.GlobalPm && ci.Mobile.AccessLevel > Owner.AccessLevel)
                    {
                        ci.Mobile.SendMessage(ci.PmColor, String.Format("<PM> {0} to {1}: {2}", Owner.Name, c_Other.Name, GetTextField(0)));
                    }
                }

                ChatInfo.GetInfo(c_Other).AddMessage(Owner, c_Message);
            }catch { Errors.Report(String.Format("PmGump-> Send-> |{0}|-> |{1}|", Owner, c_Other)); }
        }
Example #2
0
        private void Unban()
        {
            ChatInfo.GetInfo(c_Target).RemoveBan();

            Owner.CloseGump(typeof(ListGump), -5);
            NewGump();
        }
Example #3
0
        public ProfileGump(Mobile m, Mobile target) : base(m, 100, 100)
        {
            c_Target = target;
            c_Info   = ChatInfo.GetInfo(Owner);

            NewGump();
        }
Example #4
0
        private void Help()
        {
            NewGump();

            ChatInfo info = ChatInfo.GetInfo(Owner);

            InfoGump.SendTo(Owner, 300, 300, s_Help + (Owner.AccessLevel != AccessLevel.Player ? "<BR><BR>" + s_StaffHelp : ""), true);
        }
Example #5
0
        public static void SendTo(Mobile m, Message msg)
        {
            if (m != null && msg.LastSender != null)
            {
                new PmGump(m, msg.LastSender, msg);
            }

            ChatInfo.GetInfo(m).RemoveMessage(msg);
        }
Example #6
0
        protected override void BuildGump()
        {
            ChatInfo info = ChatInfo.GetInfo(Owner);

            AddButton(30, 10, 0x82E, 0x82E, "Message", new TimerCallback(Message));
            AddImage(0, 0, 0x9CB);
            AddImageTiled(35, 7, 20, 8, 0x9DC);
            AddHtml(23, 1, 50, 20, "<CENTER>" + HTML.Black + info.NextMessage().LastSender.Name, false, false);
        }
Example #7
0
        private void GlobalAccess(object obj)
        {
            if (!(obj is bool))
            {
                return;
            }

            ChatInfo.GetInfo(c_Target).GlobalAccess = !(bool)obj;
            NewGump();
        }
Example #8
0
        public ListGump(Mobile m, Listing listing) : base(m, 100, 100)
        {
            c_Info    = ChatInfo.GetInfo(m);
            c_Listing = listing;

            c_List    = new ArrayList();
            c_Mailbox = true;

            NewGump();
        }
Example #9
0
        private void BanCallback(object obj)
        {
            if (!(obj is TimeSpan))
            {
                return;
            }

            ChatInfo.GetInfo(c_Target).Ban((TimeSpan)obj);

            NewGump();
        }
Example #10
0
        private static void OnPm(CommandEventArgs e)
        {
            try{
                ChatInfo info = ChatInfo.GetInfo(e.Mobile);

                if (!CanPm(info, true))
                {
                    return;
                }

                if (e.ArgString == null || e.ArgString == "")
                {
                    ListGump.SendTo(e.Mobile, Listing.Messages);
                }
                else
                {
                    string name = e.GetString(0);
                    string text = "";

                    if (e.Arguments.Length > 1)
                    {
                        text = e.ArgString.Substring(name.Length + 1, e.ArgString.Length - name.Length - 1);
                    }

                    ArrayList list = GetPmCanidates(info, name);

                    if (list.Count > 10)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "Too many name search results, please be more specific.");
                    }
                    else if (list.Count == 0)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "No name containing '{0}' was found.", name);
                    }
                    else if (list.Count == 1)
                    {
                        PmGump.SendTo(info.Mobile, (Mobile)list[0], text);
                    }
                    else
                    {
                        Hashtable table = new Hashtable();
                        foreach (Mobile m in list)
                        {
                            table.Add(new object[3] {
                                e.Mobile, m, text
                            }, m.Name);
                        }

                        ChoiceGump.SendTo(info.Mobile, "", 200, new TimerStateCallback(ChoiceCallback), table);
                    }
                }
            }catch { Errors.Report(String.Format("Pm-> OnPm-> |{0}|", e.Mobile)); }
        }
Example #11
0
        private void Broadcast(Mobile m, string msg)
        {
            ChatInfo info = ChatInfo.GetInfo(m);

            foreach (ChatInfo otherInfo in ChatInfo.ChatInfos.Values)
            {
                if (otherInfo.IrcOn && !otherInfo.Banned)
                {
                    otherInfo.Mobile.SendMessage(m.AccessLevel == AccessLevel.Player ? otherInfo.IrcColor : info.StaffColor, msg);
                }
            }
        }
Example #12
0
        private void Unban(object obj)
        {
            if (!(obj is int))
            {
                return;
            }

            if ((int)obj >= c_List.Count || (int)obj < 0)
            {
                return;
            }

            ChatInfo.GetInfo((Mobile)c_List[(int)obj]).RemoveBan();
            NewGump();
        }
Example #13
0
        private static void OnChat(CommandEventArgs e, bool spammsg)
        {
            try{
                ChatInfo info = ChatInfo.GetInfo(e.Mobile);

                if (!CanChat(info, true))
                {
                    return;
                }

                if (e.ArgString == null || e.ArgString == "")
                {
                    ListGump.SendTo(e.Mobile, Listing.Guild);
                }
                else if (!TrackSpam.LogSpam(e.Mobile, "chat", ChatInfo.SpamLimiter))
                {
                    Timer.DelayCall(TrackSpam.NextAllowedIn(e.Mobile, "chat", ChatInfo.SpamLimiter), new TimerStateCallback(Queued), e);
                    if (spammsg)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "Message queued.  Please wait {0} seconds between messages.", ChatInfo.SpamLimiter);
                    }
                }
                else
                {
                    foreach (ChatInfo ci in ChatInfo.ChatInfos.Values)
                    {
                        if (ci.Mobile.NetState == null)
                        {
                            continue;
                        }

                        if (CanChat(ci) && info.Mobile.Guild == ci.Mobile.Guild && !ci.Ignoring(info.Mobile))
                        {
                            ci.Mobile.SendMessage(ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString);
                        }
                        else if (ChatInfo.AllianceChat && CanChat(ci) && ((Guild)info.Mobile.Guild).Allies.Contains(ci.Mobile.Guild) && !ci.Ignoring(info.Mobile))
                        {
                            ci.Mobile.SendMessage(ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString);
                        }
                        else if (ci.GlobalGuild)
                        {
                            ci.Mobile.SendMessage(ci.GuildColor, "<{0}> {1}: {2}", e.Mobile.Guild.Abbreviation, e.Mobile.Name, e.ArgString);
                        }
                    }
                }
            }catch { Errors.Report(String.Format("GuildChat-> OnChat-> |{0}|", e.Mobile)); }
        }
Example #14
0
        public void Connect(Mobile m)
        {
            ChatInfo info = ChatInfo.GetInfo(m);

            if (c_Connecting)
            {
                m.SendMessage(info.SystemColor, "The server is already attempting to connect.");
                return;
            }

            if (c_Connected)
            {
                m.SendMessage(info.SystemColor, "The server is already connected.");
                return;
            }

            Connect();
        }
Example #15
0
        public PmGump(Mobile m, Mobile other, Message message, string str) : base(m, 100, 100)
        {
            c_Other     = other;
            c_Message   = message;
            c_StartText = str;

            if (c_Message.History.Count == 0)
            {
                c_Page = Page.Send;
            }
            else if (c_Other.AccessLevel >= Owner.AccessLevel &&
                     ChatInfo.GetInfo(c_Other).PmReceipt)
            {
                c_Other.SendMessage("{0} has opened your message.", Owner.Name);
            }

            NewGump();
        }
Example #16
0
        private static void OnChat(CommandEventArgs e, bool spammsg)
        {
            try{
                ChatInfo info = ChatInfo.GetInfo(e.Mobile);

                if (!CanChat(info, true))
                {
                    return;
                }

                if (e.ArgString == null || e.ArgString == "")
                {
                    ListGump.SendTo(e.Mobile, Listing.Faction);
                }
                else if (!TrackSpam.LogSpam(e.Mobile, "chat", ChatInfo.SpamLimiter))
                {
                    Timer.DelayCall(TrackSpam.NextAllowedIn(e.Mobile, "chat", ChatInfo.SpamLimiter), new TimerStateCallback(Queued), e);
                    if (spammsg)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "Message queued.  Please wait {0} seconds between messages.", ChatInfo.SpamLimiter);
                    }
                }
                else
                {
                    foreach (ChatInfo ci in ChatInfo.ChatInfos.Values)
                    {
                        if (ci.Mobile.NetState == null)
                        {
                            continue;
                        }

                        if (CanChat(ci) && SameFaction(info.Mobile, ci.Mobile) && !ci.Ignoring(info.Mobile))
                        {
                            ci.Mobile.SendMessage(ci.FactionColor, "<{0}> {1}: {2}", ((PlayerMobile)e.Mobile).FactionPlayerState.Faction.Definition.FriendlyName, e.Mobile.Name, e.ArgString);
                        }
                        else if (ci.GlobalFaction)
                        {
                            ci.Mobile.SendMessage(ci.FactionColor, "<{0}> {1}: {2}", ((PlayerMobile)e.Mobile).FactionPlayerState.Faction.Definition.FriendlyName, e.Mobile.Name, e.ArgString);
                        }
                    }
                }
            }catch { Errors.Report(String.Format("FactionChat-> OnChat-> |{0}|", e.Mobile)); }
        }
Example #17
0
        private void BanCallback(object obj)
        {
            if (!(obj is object[]))
            {
                return;
            }

            object[] info = (object[])obj;

            if (info.Length != 2 ||
                !(info[0] is Mobile) ||
                !(info[1] is TimeSpan))
            {
                return;
            }

            ChatInfo.GetInfo((Mobile)info[0]).Ban((TimeSpan)info[1]);

            NewGump();
        }
Example #18
0
        public static bool CanIRC(Mobile m, bool action)
        {
            ChatInfo info = ChatInfo.GetInfo(m);

            if (info.Banned)
            {
                if (action)
                {
                    m.SendMessage(info.SystemColor, "You are banned from chat.");
                }

                return(false);
            }

            if (!info.IrcOn)
            {
                if (action)
                {
                    OptionsGump.SendTo(info.Mobile);
                    m.SendMessage(info.SystemColor, "You must first turn on IRC.");
                }

                return(false);
            }

            if (!IrcConnection.Connection.Connected)
            {
                if (action)
                {
                    m.SendMessage(info.SystemColor, "The irc connection is down.");
                }

                return(false);
            }

            return(true);
        }
Example #19
0
 private void Save()
 {
     ChatInfo.GetInfo(Owner).Save(c_Message);
     NewGump();
 }
Example #20
0
        public static void OnChat(CommandEventArgs e, bool spammsg)
        {
            try{
                ChatInfo info = ChatInfo.GetInfo(e.Mobile);

                if (!CanChat(info, true))
                {
                    return;
                }

                if (e.ArgString == null || e.ArgString == "" || ChatInfo.NoPublic)
                {
                    ListGump.SendTo(e.Mobile, Listing.Public);
                }
                else if (ChatInfo.Regional && (e.Mobile.Region == null || e.Mobile.Region.Name == ""))
                {
                    e.Mobile.SendMessage(info.SystemColor, "You are not in a region.");
                }
                else if (!TrackSpam.LogSpam(e.Mobile, "chat", ChatInfo.SpamLimiter))
                {
                    Timer.DelayCall(TrackSpam.NextAllowedIn(e.Mobile, "chat", ChatInfo.SpamLimiter), new TimerStateCallback(Queued), e);
                    if (spammsg)
                    {
                        e.Mobile.SendMessage(info.SystemColor, "Message queued.  Please wait {0} seconds between messages.", ChatInfo.SpamLimiter);
                    }
                }
                else
                {
                    string text = Filter.FilterText(e.Mobile, e.ArgString);
                    if (text == "")
                    {
                        return;
                    }

                    foreach (ChatInfo ci in ChatInfo.ChatInfos.Values)
                    {
                        if (ci.Mobile == null || ci.Mobile.NetState == null)
                        {
                            continue;
                        }

                        if (CanChat(ci) && !ci.Ignoring(info.Mobile))
                        {
                            if (ci.Mobile.AccessLevel == AccessLevel.Player &&
                                ChatInfo.Regional &&
                                info.Mobile.Region != ci.Mobile.Region)
                            {
                                continue;
                            }

                            ci.Mobile.SendMessage(e.Mobile.AccessLevel == AccessLevel.Player ? ci.PublicColor : info.StaffColor, "<{0}> {1}: {2}", ChatInfo.Regional ? e.Mobile.Region.Name : "Public", e.Mobile.Name, text);
                        }
                    }

                    if (ChatInfo.PublicPlusIRC)
                    {
                        IrcConnection.Connection.SendUserMessage(e.Mobile, e.ArgString);
                    }
                }
            }catch { Errors.Report(String.Format("PublicChat-> OnChat-> |{0}|", e.Mobile)); }
        }
Example #21
0
        protected override void BuildGump()
        {
            try{
                ChatInfo info      = ChatInfo.GetInfo(Owner);
                ChatInfo otherInfo = ChatInfo.GetInfo(c_Other);

                AddPage(0);

                AddBackground(0, 0, Width, Height, 0x13BE);

                AddButton(Width - 20, Height - 20, 0x5689, 0x5689, "Help", new TimerCallback(Help));

                AddPage(1);

                if (Owner.AccessLevel > c_Other.AccessLevel &&
                    c_Other.NetState != null)
                {
                    AddTemplateButton(30, Height - 30, 70, Template.RedSquare, "Goto", HTML.White + "<CENTER>Goto", new TimerCallback(Goto));
                }

                if (c_Other.AccessLevel == AccessLevel.Player)
                {
                    AddTemplateButton(80, Height - 30, 70, Template.RedSquare, "Ignore", HTML.White + "<CENTER>Ignore", new TimerCallback(Ignore));
                }

                int currentMessage = c_Message.History.Count - 1;

                object[] obj;

                if (c_Page == Page.Reply)
                {
                    if (currentMessage < 0)
                    {
                        return;
                    }

                    obj = (object[])c_Message.History[currentMessage];

                    AddHtml(0, 10, Width, 25, "<CENTER>" + HTML.White + (DateTime)obj[2], false, false);

                    if (!c_Message.Saved)
                    {
                        AddTemplateButton(130, Height - 30, 70, Template.RedSquare, "Save", HTML.White + "<CENTER>Save", new TimerCallback(Save));
                    }

                    if (!c_Message.Saved && Pm.CanReply(info, otherInfo))
                    {
                        AddTemplateButton(180, Height - 30, 70, Template.RedSquare, "Reply", HTML.White + "<CENTER>Reply", new TimerCallback(Reply));
                    }

                    AddHtml(20, 30, Width - 40, Height - 73, String.Format("<B>{0} says:</B><BR>{1}", c_Message.LastSender.Name, obj[1]), true, true);

                    currentMessage--;
                }
                else
                {
                    AddHtml(0, 10, Width, 25, "<CENTER>" + HTML.White + "Message to " + c_Other.Name + (c_Other.NetState == null || (otherInfo.Hidden && c_Other.AccessLevel >= Owner.AccessLevel) ? " (Offline)" : ""), false, false);

                    if (!c_Message.Saved && Pm.CanReply(info, otherInfo))
                    {
                        AddTemplateButton(180, Height - 30, 70, Template.RedSquare, "Send", HTML.White + "<CENTER>Send", new TimerCallback(Send));
                    }

                    AddImageTiled(20, 30, Width - 40, Height - 73, 0xBBC);
                    AddTextField(20, 30, Width - 40, Height - 73, 0x480, 0, GetTextField(0) == "" ? c_StartText : GetTextField(0));
                }

                int tabPage = 1;

                while (currentMessage >= 0)
                {
                    AddButton(0, Height / 2 - 10, 0x15E3, 0x15E7, 0, GumpButtonType.Page, tabPage + 1);

                    AddPage(++tabPage);

                    obj = (object[])c_Message.History[currentMessage--];

                    AddButton(Width - 20, Height / 2 - 10, 0x15E1, 0x15E5, 0, GumpButtonType.Page, tabPage - 1);

                    AddHtml(0, 10, Width, 25, "<CENTER>" + HTML.White + (DateTime)obj[2], false, false);
                    AddHtml(20, 30, Width - 40, Height - 50, String.Format("<B>{0} says:</B><BR>{1}", ((Mobile)obj[0]).Name, obj[1]), true, true);
                }
            }catch { Errors.Report(String.Format("PmGump-> BuildGump-> |{0}|-> |{1}|", Owner, c_Other)); }
        }
Example #22
0
        public static void SendMostRecent(Mobile m)
        {
            Message msg = ChatInfo.GetInfo(m).GetNextMessage();

            SendTo(m, msg);
        }
Example #23
0
        protected override void BuildGump()
        {
            try{
                Owner.CloseGump(typeof(ProfileGump));

                AddPage(0);

                ChatInfo otherInfo = ChatInfo.GetInfo(c_Target);

                AddBackground(0, 0, Width, Height, 0x13BE);

                AddButton(Width - 20, Height - 20, 0x5689, 0x5689, "Help", new TimerCallback(Help));

                AddPage(1);

                string text = Server.Misc.Titles.ComputeTitle(Owner, c_Target);

                if (c_Target.AccessLevel != AccessLevel.Player)
                {
                    text += "<BR>" + c_Target.AccessLevel;
                }
                else if (c_Target.Guild != null)
                {
                    text += "<BR>[" + c_Target.Guild.Abbreviation + "] " + c_Target.GuildTitle;
                }

                if (Owner.AccessLevel > c_Target.AccessLevel ||
                    (ChatInfo.ShowLocation && Owner.AccessLevel == c_Target.AccessLevel))
                {
                    if (c_Target.NetState != null)
                    {
                        text += "<BR>" + c_Target.Map.Name;

                        if (c_Target.Region != null && c_Target.Region.Name != "")
                        {
                            text += ", " + c_Target.Region.Name;
                        }
                    }
                }

                AddHtml(0, 10, Width, 65, HTML.White + "<CENTER>" + text, false, false);

                AddBackground(20, 65, Width - 40, 3, 0x13BE);

                int y = 90;
                int x = 40;

                if (c_Target.AccessLevel >= Owner.AccessLevel)
                {
                    x = Width / 2 - 35;
                }

                if (Pm.CanPm(c_Info, otherInfo))
                {
                    AddTemplateButton(x, y, 70, Template.RedSquare, "New Message", HTML.White + "<CENTER>Message", new TimerCallback(Message));
                }

                AddTemplateButton(x, y + 20, 70, Template.RedSquare, "Friend", HTML.White + (c_Info.Friends.Contains(c_Target) ? "<CENTER>Unfriend" : "<CENTER>Friend"), new TimerStateCallback(Friend), c_Info.Friends.Contains(c_Target));

                if (Owner.AccessLevel >= c_Target.AccessLevel)
                {
                    AddTemplateButton(x, y + 40, 70, Template.RedSquare, "Ignore", HTML.White + (c_Info.Ignores.Contains(c_Target) ? "<CENTER>Unignore" : "<CENTER>Ignore"), new TimerStateCallback(Ignore), c_Info.Ignores.Contains(c_Target));
                }

                AddHtml(x - 10, y + 65, 70, 25, HTML.White + "Pm Sound:", false, false);
                AddImageTiled(x + 65, y + 65, 35, 21, 0xBBA);
                AddTextField(x + 65, y + 65, 35, 21, 0x480, 0, c_Info.GetSound(c_Target).ToString());
                AddButton(x + 100, y + 67, 0x15E1, 0x15E5, "Play Sound", new TimerCallback(PlaySound));
                AddButton(x + 55, y + 65, 0x983, 0x983, "Sound Up", new TimerCallback(SoundUp));
                AddButton(x + 55, y + 75, 0x985, 0x985, "Sound Down", new TimerCallback(SoundDown));

                if (Owner.AccessLevel > c_Target.AccessLevel)
                {
                    x = Width - 110;

                    if (c_Target.NetState != null)
                    {
                        AddTemplateButton(x, y, 70, Template.RedSquare, "Client", HTML.White + "<CENTER>Client", new TimerCallback(Client));
                        AddItem(x - 30, y + 3, 0x186A);

                        AddTemplateButton(x, y + 20, 70, Template.RedSquare, "Goto", HTML.White + "<CENTER>Goto", new TimerCallback(Goto));
                        AddItem(x - 30, y + 23, 0x186A);
                    }

                    if (c_Info.GlobalAccess)
                    {
                        AddTemplateButton(x, y + 60, 70, Template.RedSquare, "Global Ignore", HTML.White + (c_Info.GlobalIgnores.Contains(c_Target) ? "<CENTER>Global Unignore" : "<CENTER>Global Ignore"), new TimerStateCallback(IgnoreGlobal), c_Info.GlobalIgnores.Contains(c_Target));
                        AddItem(x - 30, y + 63, 0x186A);
                    }

                    if (c_Target.AccessLevel == AccessLevel.Player)
                    {
                        AddTemplateButton(x, y + 40, 70, Template.RedSquare, "Ban", HTML.White + (otherInfo.Banned ? "<CENTER>Unban" : "<CENTER>Ban"), otherInfo.Banned ? new TimerCallback(Unban) : new TimerCallback(Ban));
                        AddItem(x - 30, y + 43, 0x186A);
                    }
                    else if (Owner.AccessLevel == AccessLevel.Administrator)
                    {
                        AddTemplateButton(x, y + 40, 70, Template.RedSquare, "Global Priv", HTML.White + (otherInfo.GlobalAccess ? "<CENTER>Revoke Global" : "<CENTER>Give Global"), new TimerStateCallback(GlobalAccess), otherInfo.GlobalAccess);
                        AddItem(x - 30, y + 43, 0x186A);
                    }
                }

                AddButton(Width - 20, Height / 2 - 10, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 2);

                AddPage(2);

                AddButton(0, Height / 2 - 10, 0x15E3, 0x15E7, 0, GumpButtonType.Page, 1);

                AddHtml(0, 10, Width, 25, "<CENTER>" + HTML.White + c_Target.Name + "'s Profile", false, false);
                AddHtml(20, 30, Width - 40, Height - 50, c_Target.Profile, true, true);
            }catch { Errors.Report(String.Format("ProfileGump-> BuildGump-> |{0}|-> |{1}|", Owner, c_Target)); }
        }
Example #24
0
        private void DisplayList()
        {
            try{
                int toList = 10;

                if (c_Listing == Listing.Guild ||
                    c_Listing == Listing.Staff ||
                    c_Listing == Listing.Messages ||
                    c_Listing == Listing.Faction)
                {
                    toList /= 2;
                }

                if (c_Listing == Listing.Search)
                {
                    toList -= 2;
                }

                int beginAt = toList * c_Page;

                while (c_Page > 0)
                {
                    if (beginAt > c_List.Count)
                    {
                        beginAt = toList * --c_Page;
                    }
                    else
                    {
                        break;
                    }
                }

                if (c_Page != 0)
                {
                    AddButton(Width / 2 - 7, 5, 0x15E0, 0x15E4, "Next Page", new TimerCallback(PageDown));
                }

                if (c_Page < (c_List.Count - 1) / toList)
                {
                    AddButton(Width / 2 - 7, c_Listing == Listing.Search ? 230 : 260, 0x15E2, 0x15E6, "Previous Page", new TimerCallback(PageUp));
                }

                int y = -10;
                int x = 30;

                if (c_Listing == Listing.Guild)
                {
                    y += 15;
                }

                if (c_Listing == Listing.Messages)
                {
                    Message msg;

                    if (c_Mailbox)
                    {
                        AddTemplateButton(x, y + 25, 70, Template.RedSquare, "Inbox", HTML.Green + "<CENTER>Inbox", new TimerCallback(MailBox), false);
                    }
                    else
                    {
                        AddTemplateButton(x, y + 25, 70, Template.RedSquare, "Inbox", HTML.White + "<CENTER>Inbox", new TimerCallback(MailBox));
                    }

                    if (!c_Mailbox)
                    {
                        AddTemplateButton(x + 75, y + 25, 70, Template.RedSquare, "Saved", HTML.Green + "<CENTER>Saved", new TimerCallback(SavedMail), false);
                    }
                    else
                    {
                        AddTemplateButton(x + 75, y + 25, 70, Template.RedSquare, "Saved", HTML.White + "<CENTER>Saved", new TimerCallback(SavedMail));
                    }

                    y = 0;
                    x = 40;

                    for (int i = beginAt; i < c_List.Count && i < beginAt + toList; ++i)
                    {
                        msg = (Message)c_List[i];

                        if (msg.History.Count == 0)
                        {
                            continue;
                        }

                        string text = msg.LastText;

                        if (text.Length > 20)
                        {
                            text = text.Substring(0, 20) + "...";
                        }

                        AddHtml(x, y += 30, Width, 25, HTML.White + text, false, false);

                        AddButton(20, y, 0x1523, 0x1523, "Open Message", new TimerStateCallback(OpenMessage), i);
                        AddButton(Width - 20, y, 0x5686, 0x5686, "Delete Message", new TimerStateCallback(DeleteMessage), i);

                        AddHtml(x, y += 20, Width, 25, HTML.Gray + "From " + msg.LastSender.Name, false, false);

                        if (i + 1 < c_List.Count && i + 1 < beginAt + toList)
                        {
                            AddBackground(50, y + 18, Width - 100, 3, 0x13BE);
                        }
                    }
                }
                else if (c_Listing == Listing.IRC)
                {
                    for (int i = beginAt; i < c_List.Count && i < beginAt + toList; ++i)
                    {
                        AddHtml(x, y += 25, Width, 25, HTML.White + c_List[i].ToString(), false, false);

                        if (i + 1 < c_List.Count && i + 1 < beginAt + toList)
                        {
                            AddBackground(50, y + 18, Width - 100, 3, 0x13BE);
                        }
                    }
                }
                else
                {
                    if (c_Listing == Listing.Guild && Owner.Guild != null)
                    {
                        if (((Guild)Owner.Guild).Abbreviation != "none")
                        {
                            AddHtml(20, 15 - 3, 70, 25, HTML.White + ((Guild)Owner.Guild).Abbreviation, false, false);
                        }

                        if (ChatInfo.GuildMenuAccess)
                        {
                            AddTemplateButton(Width - 60, 15, 70, Template.RedSquare, "Guild Menu", HTML.White + "<CENTER>Menu", new TimerCallback(GuildMenu));
                        }
                    }

                    string   text = "";
                    ChatInfo info;

                    for (int i = beginAt; i < c_List.Count && i < beginAt + toList; ++i)
                    {
                        info = ChatInfo.GetInfo((Mobile)c_List[i]);

                        if (info.Mobile == null || info.Mobile.Name == null || info.Mobile.Name == "")
                        {
                            continue;
                        }

                        text = Color(info) + info.Mobile.Name;

                        if (info.Hidden && Owner.AccessLevel > info.Mobile.AccessLevel)
                        {
                            text += HTML.White + " (Hidden)";
                        }
                        else if (info.Away)
                        {
                            text += HTML.White + " (Away)";
                        }

                        AddHtml(x, y += 25, Width, 25, text, false, false, false);

                        if (Owner != info.Mobile)
                        {
                            AddButton(x - 20, y + 3, 0x93A, 0x93A, "Profile", new TimerStateCallback(Profile), i);
                        }

                        if (Owner != info.Mobile && c_Info.Quickbar)
                        {
                            int xx = Width - 15;

                            if (Owner.AccessLevel > info.Mobile.AccessLevel)
                            {
                                if (info.Mobile.NetState != null)
                                {
                                    AddButton(xx -= 12, y + 3, 0x13A8, 0x13A8, "Mini Goto", new TimerStateCallback(Goto), i);
                                    AddLabel(xx + 4, y, 0x47E, "g");
                                    AddButton(xx -= 12, y + 3, 0x13A8, 0x13A8, "Mini Client", new TimerStateCallback(Client), i);
                                    AddLabel(xx + 4, y, 0x47E, "c");
                                }

                                AddButton(xx -= 12, y + 3, 0x13A8, 0x13A8, "Mini Ban", info.Banned ? new TimerStateCallback(Unban) : new TimerStateCallback(Ban), i);
                                AddLabel(xx + 4, y, info.Banned ? 0x20 : 0x47E, "b");
                            }

                            AddButton(xx -= 12, y + 3, 0x13A8, 0x13A8, "Mini Friend", c_Info.Friends.Contains(info.Mobile) ? new TimerStateCallback(Unfriend) : new TimerStateCallback(Friend), i);
                            AddLabel(xx + 4, y - 1, c_Info.Friends.Contains(info.Mobile) ? 0x35 : 0x47E, "f");

                            if (Owner.AccessLevel >= info.Mobile.AccessLevel)
                            {
                                AddButton(xx -= 12, y + 3, 0x13A8, 0x13A8, "Mini Ignore", c_Info.Ignoring(info.Mobile) ? new TimerStateCallback(Unignore) : new TimerStateCallback(Ignore), i);
                                AddLabel(xx + 4, y - 1, c_Info.Ignoring(info.Mobile) ? 0x20 : 0x47E, "i");
                            }

                            if (Pm.CanPm(c_Info, info))
                            {
                                AddButton(xx -= 12, y + 3, 0x13A8, 0x13A8, "Mini New Message", new TimerStateCallback(NewMessage), i);
                                AddLabel(xx + 2, y - 2, 0x47E, "m");
                            }
                        }

                        if (c_Listing == Listing.Guild)
                        {
                            AddHtml(x, y += 20, Width - 20, 25, HTML.White + info.Mobile.GuildTitle, false, false);
                        }
                        else if (c_Listing == Listing.Faction)
                        {
                            AddHtml(x, y += 20, Width - 20, 25, HTML.White + ((PlayerMobile)info.Mobile).FactionPlayerState.Rank.Title.String, false, false);
                        }
                        else if (c_Listing == Listing.Staff)
                        {
                            AddHtml(x, y += 20, Width - 20, 25, HTML.White + info.Mobile.AccessLevel.ToString(), false, false);
                        }

                        if (i + 1 < c_List.Count && i + 1 < beginAt + toList)
                        {
                            AddBackground(50, y + 18, Width - 100, 3, 0x13BE);
                        }
                    }
                }
            }catch { Errors.Report(String.Format("ListGump-> DisplayList-> |{0}|-> {1}", Owner, c_Listing)); }
        }
Example #25
0
 private void Ignore()
 {
     ChatInfo.GetInfo(Owner).AddIgnore(c_Other);
     NewGump();
 }
Example #26
0
 public OptionsGump(Mobile m) : base(m, 100, 100)
 {
     m.CloseGump(typeof(OptionsGump));
     c_Info = ChatInfo.GetInfo(m);
     NewGump();
 }
Example #27
0
        public static string FilterText(Mobile m, string s)
        {
            try{
                string filter   = "";
                string subOne   = "";
                string subTwo   = "";
                string subThree = "";
                int    index    = 0;

                for (int i = 0; i < ChatInfo.Filters.Count; ++i)
                {
                    filter = ChatInfo.Filters[i].ToString();

                    if (filter == "")
                    {
                        ChatInfo.Filters.Remove(filter);
                        continue;
                    }

                    index = s.ToLower().IndexOf(filter);

                    if (index >= 0)
                    {
                        if (m.AccessLevel == AccessLevel.Player)
                        {
                            if (!ChatInfo.NoFilterPenalty)
                            {
                                m.SendMessage(ChatInfo.GetInfo(m).SystemColor, "Filter violation detected: " + filter);
                            }

                            if (ChatInfo.FilterBan)
                            {
                                ChatInfo.GetInfo(m).Ban(ChatInfo.FilterBanLength);
                            }
                            else if (ChatInfo.FilterKick)
                            {
                                m.Say("I've been kicked!");
                                if (m.NetState != null)
                                {
                                    m.NetState.Dispose();
                                }
                            }
                            else if (ChatInfo.FilterCriminal)
                            {
                                m.CriminalAction(false);
                            }

                            if (!ChatInfo.NoFilterPenalty)
                            {
                                return("");
                            }
                        }

                        subOne = s.Substring(0, index);
                        subTwo = "";

                        for (int ii = 0; ii < filter.Length; ++ii)
                        {
                            subTwo += "*";
                        }

                        subThree = s.Substring(index + filter.Length, s.Length - filter.Length - index);

                        s = subOne + subTwo + subThree;

                        i--;
                    }
                }
            }catch { Errors.Report(String.Format("Filter-> FilterText-> |{0}|", m)); }

            return(s);
        }