コード例 #1
1
ファイル: Pm.cs プロジェクト: cynricthehun/UOLegends
        public static bool CanPm( ChatInfo source, ChatInfo target )
        {
            if ( source == target )
                return false;

            if ( source.Mobile.AccessLevel > target.Mobile.AccessLevel )
                return true;

            if ( target.PmDisabled && source.Mobile.AccessLevel == AccessLevel.Player )
                return false;

            if ( !ChatInfo.ShowStaff
            && source.Mobile.AccessLevel == AccessLevel.Player
            && target.Mobile.AccessLevel > AccessLevel.Player )
                return false;

            if ( source.PmFriends || target.PmFriends )
            {
                if ( !source.Friends.Contains( target.Mobile ) )
                    return false;
                if ( !target.Friends.Contains( source.Mobile ) )
                    return false;
            }

            if ( !CanPm( target ) || !CanPm( source ) )
                return false;

            if ( source.Ignoring( target.Mobile )
            || target.Ignoring( source.Mobile ) )
                return false;

            return true;
        }
コード例 #2
0
ファイル: Pm.cs プロジェクト: StoryOfTheBard/UOLegends
        public static bool CanPm(ChatInfo source, ChatInfo target)
        {
            if (source == target)
            {
                return(false);
            }

            if (source.Mobile.AccessLevel > target.Mobile.AccessLevel)
            {
                return(true);
            }

            if (target.PmDisabled && source.Mobile.AccessLevel == AccessLevel.Player)
            {
                return(false);
            }

            if (!ChatInfo.ShowStaff &&
                source.Mobile.AccessLevel == AccessLevel.Player &&
                target.Mobile.AccessLevel > AccessLevel.Player)
            {
                return(false);
            }

            if (source.PmFriends || target.PmFriends)
            {
                if (!source.Friends.Contains(target.Mobile))
                {
                    return(false);
                }
                if (!target.Friends.Contains(source.Mobile))
                {
                    return(false);
                }
            }

            if (!CanPm(target) || !CanPm(source))
            {
                return(false);
            }

            if (source.Ignoring(target.Mobile) ||
                target.Ignoring(source.Mobile))
            {
                return(false);
            }

            return(true);
        }
コード例 #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)); }
        }