示例#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)); }
        }
示例#2
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)); }
        }
示例#3
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)); }
        }
示例#4
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)); }
        }