Ejemplo n.º 1
0
        public static bool CheckAccess( IHouse house, Mobile from )
        {
            if ( house.Public )
                return !house.IsBanned( from );

            return house.HasAccess( from );
        }
Ejemplo n.º 2
0
        public static bool CheckAccess(IHouse house, Mobile from)
        {
            if (house.Public)
            {
                return(!house.IsBanned(from));
            }

            return(house.HasAccess(from));
        }
Ejemplo n.º 3
0
        public bool CheckAccess(Mobile m)
        {
            if (!IsLockedDown || m.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

            IHouse house = HousingHelper.FindHouseAt(this);

            if (house != null && (house.Public ? house.IsBanned(m) : !house.HasAccess(m)))
            {
                return(false);
            }

            return(house != null && house.HasSecureAccess(m, m_Level));
        }
Ejemplo n.º 4
0
        public bool CheckAccess(Mobile m)
        {
            IHouse house = FindHouse();

            if (house == null)
            {
                return(false);
            }

            if (house.Public ? house.IsBanned(m) : !house.HasAccess(m))
            {
                return(false);
            }

            return(house.HasSecureAccess(m, m_Level));
        }
Ejemplo n.º 5
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int          page  = m_Page;
            Mobile       from  = m_From;
            IHouse       house = m_House;
            BasePlayerBB board = m_Board;

            if (house == null || !house.IsLockedDown(board))
            {
                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 (!BasePlayerBB.CheckAccess(house, from))
            {
                from.SendLocalizedMessage(1062398);                   // You are not allowed to post to this bulletin board.
                return;
            }

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

                break;
            }

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

                break;
            }

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

                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.IsOwner(from))
                {
                    if (page >= 1 && page <= board.Messages.Count)
                    {
                        PlayerBBMessage message = (PlayerBBMessage)board.Messages[page - 1];
                        Mobile          poster  = message.Poster;

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

                        if (poster.AccessLevel > AccessLevel.Player && 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) && !BasePlayerBB.CheckAccess(house, poster))
                            {
                                poster.MoveToWorld(house.BanLocation, house.Map);
                            }
                        }
                    }

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

                break;
            }

            case 7:                     // Delete message
            {
                if (house.IsOwner(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 = (PlayerBBMessage)board.Messages[page - 1];
                    }

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

                break;
            }
            }
        }