Esempio n. 1
0
            public override void OnResponse(Mobile from, string text)
            {
                int          page  = m_Page;
                BaseHouse    house = m_House;
                BasePlayerBB board = m_Board;

                if (!board.CheckUse(house, from))
                {
                    from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable.
                    return;
                }
                else if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                    return;
                }
                else if (!board.CheckAccess(house, from))
                {
                    from.SendLocalizedMessage(1062398); // You are not allowed to post to this bulletin board.
                    return;
                }
                else if (m_Greeting && !board.CanPostGreeting(house, from))
                {
                    return;
                }

                text = text.Trim();

                if (text.Length > 255)
                {
                    text = text.Substring(0, 255);
                }

                if (text.Length > 0)
                {
                    PlayerBBMessage message = new PlayerBBMessage(DateTime.UtcNow, from, text);

                    if (m_Greeting)
                    {
                        board.Greeting = message;
                    }
                    else
                    {
                        board.Messages.Add(message);

                        if (board.Messages.Count > 50)
                        {
                            board.Messages.RemoveAt(0);

                            if (page > 0)
                            {
                                --page;
                            }
                        }
                    }
                }

                from.SendGump(new PlayerBBGump(from, house, board, page));
            }
Esempio n. 2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int          page  = m_Page;
            Mobile       from  = m_From;
            BaseHouse    house = m_House;
            BasePlayerBB board = m_Board;

            if (!board.CheckUse(house, from))
            {
                from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable.
                return;
            }
            else if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                return;
            }
            else if (!board.CheckAccess(house, from))
            {
                from.SendLocalizedMessage(1062398); // You are not allowed to post to this bulletin board.
                return;
            }

            switch (info.ButtonID)
            {
            case 1:     // Post message
            {
                from.Prompt = new BasePlayerBB.PostPrompt(page, house, board, false);
                from.SendLocalizedMessage(1062397);         // Please enter your message:

                break;
            }

            case 2:     // Set title
            {
                if (board.CanPostGreeting(house, from))
                {
                    from.Prompt = new BasePlayerBB.SetTitlePrompt(page, house, board);
                    from.SendLocalizedMessage(1062402);         // Enter new title:
                }

                break;
            }

            case 3:     // Post greeting
            {
                if (board.CanPostGreeting(house, from))
                {
                    from.Prompt = new BasePlayerBB.PostPrompt(page, house, board, true);
                    from.SendLocalizedMessage(1062404);         // Enter new greeting (this will always be the first post):
                }

                break;
            }

            case 4:     // Scroll up
            {
                if (page == 0)
                {
                    page = board.Messages.Count;
                }
                else
                {
                    page -= 1;
                }

                from.SendGump(new PlayerBBGump(from, house, board, page));

                break;
            }

            case 5:     // Scroll down
            {
                page += 1;
                page %= board.Messages.Count + 1;

                from.SendGump(new PlayerBBGump(from, house, board, page));

                break;
            }

            case 6:     // Banish poster
            {
                if (house != null && house.IsOwner(from))
                {
                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        PlayerBBMessage message = board.Messages[page - 1];
                        Mobile          poster  = message.Poster;

                        if (poster == null)
                        {
                            from.SendGump(new PlayerBBGump(from, house, board, page));
                            return;
                        }

                        if (poster.IsStaff() && from.AccessLevel <= poster.AccessLevel)
                        {
                            from.SendLocalizedMessage(501354);         // Uh oh...a bigger boot may be required.
                        }
                        else if (house.IsFriend(poster))
                        {
                            from.SendLocalizedMessage(1060750);         // That person is a friend, co-owner, or owner of this house, and therefore cannot be banished!
                        }
                        else if (poster is PlayerVendor)
                        {
                            from.SendLocalizedMessage(501351);         // You cannot eject a vendor.
                        }
                        else if (house.Bans.Count >= BaseHouse.MaxBans)
                        {
                            from.SendLocalizedMessage(501355);         // The ban limit for this house has been reached!
                        }
                        else if (house.IsBanned(poster))
                        {
                            from.SendLocalizedMessage(501356);         // This person is already banned!
                        }
                        else if (poster is BaseCreature && ((BaseCreature)poster).NoHouseRestrictions)
                        {
                            from.SendLocalizedMessage(1062040);         // You cannot ban that.
                        }
                        else
                        {
                            if (!house.Bans.Contains(poster))
                            {
                                house.Bans.Add(poster);
                            }

                            from.SendLocalizedMessage(1062417);         // That person has been banned from this house.

                            if (house.IsInside(poster) && !board.CheckAccess(house, poster))
                            {
                                poster.MoveToWorld(house.BanLocation, house.Map);
                            }
                        }
                    }

                    from.SendGump(new PlayerBBGump(from, house, board, page));
                }

                break;
            }

            case 7:     // Delete message
            {
                if (board.CanPostGreeting(house, from))
                {
                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        board.Messages.RemoveAt(page - 1);
                    }

                    from.SendGump(new PlayerBBGump(from, house, board, 0));
                }

                break;
            }

            case 8:     // Post props
            {
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    PlayerBBMessage message = board.Greeting;

                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        message = board.Messages[page - 1];
                    }

                    from.SendGump(new PlayerBBGump(from, house, board, page));
                    from.SendGump(new PropertiesGump(from, message));
                }

                break;
            }
            }
        }
Esempio n. 3
0
        public PlayerBBGump(Mobile from, BaseHouse house, BasePlayerBB board, int page)
            : base(50, 10)
        {
            from.CloseGump(typeof(PlayerBBGump));

            m_Page  = page;
            m_From  = from;
            m_House = house;
            m_Board = board;

            AddPage(0);

            AddImage(30, 30, 5400);

            AddButton(393, 145, 2084, 2084, 4, GumpButtonType.Reply, 0); // Scroll up
            AddButton(390, 371, 2085, 2085, 5, GumpButtonType.Reply, 0); // Scroll down

            AddButton(32, 183, 5412, 5413, 1, GumpButtonType.Reply, 0);  // Post message

            if (board.CanPostGreeting(house, from))
            {
                AddButton(63, 90, 5601, 5605, 2, GumpButtonType.Reply, 0);
                AddHtmlLocalized(81, 89, 230, 20, 1062400, LabelColor, false, false); // Set title

                AddButton(63, 109, 5601, 5605, 3, GumpButtonType.Reply, 0);
                AddHtmlLocalized(81, 108, 230, 20, 1062401, LabelColor, false, false); // Post greeting
            }

            string title = board.Title;

            if (title != null)
            {
                AddHtml(183, 68, 180, 23, title, false, false);
            }

            AddHtmlLocalized(385, 89, 60, 20, 1062409, LabelColor, false, false); // Post

            AddLabel(440, 89, LabelHue, page.ToString());
            AddLabel(455, 89, LabelHue, "/");
            AddLabel(470, 89, LabelHue, board.Messages.Count.ToString());

            PlayerBBMessage message = board.Greeting;

            if (page >= 1 && page <= board.Messages.Count)
            {
                message = board.Messages[page - 1];
            }

            AddImageTiled(150, 220, 240, 1, 2700);                             // Separator

            AddHtmlLocalized(150, 180, 100, 20, 1062405, 16715, false, false); // Posted On:
            AddHtmlLocalized(150, 200, 100, 20, 1062406, 16715, false, false); // Posted By:

            if (message != null)
            {
                AddHtml(255, 180, 150, 20, message.Time.ToString("yyyy-MM-dd HH:mm:ss"), false, false);

                Mobile poster = message.Poster;
                string name   = (poster == null ? null : poster.Name);

                if (name == null || (name = name.Trim()).Length == 0)
                {
                    name = "Someone";
                }

                AddHtml(255, 200, 150, 20, name, false, false);

                string body = message.Message;

                if (body == null)
                {
                    body = "";
                }

                AddHtml(150, 240, 250, 100, body, false, false);

                if (board.CanPostGreeting(house, from))
                {
                    if (house != null && poster != from)
                    {
                        AddButton(130, 395, 1209, 1210, 6, GumpButtonType.Reply, 0);
                        AddHtmlLocalized(150, 393, 150, 20, 1062410, LabelColor, false, false); // Banish Poster
                    }

                    AddButton(310, 395, 1209, 1210, 7, GumpButtonType.Reply, 0);
                    AddHtmlLocalized(330, 393, 150, 20, 1062411, LabelColor, false, false); // Delete Message
                }

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    AddButton(135, 242, 1209, 1210, 8, GumpButtonType.Reply, 0); // Post props
                }
            }
        }