Esempio n. 1
0
        public override void OnLocationChanged(Mobile m, Point3D oldLocation)
        {
            if (m_Game == null || m is ChessMobile || m_AllowSpectators || m_Game.IsPlayer(m))
            {
                base.OnLocationChanged(m, oldLocation);
            }
            else if (m_BoardBounds.Contains(m.Location) && m.AccessLevel < AccessLevel.GameMaster)
            {
                m.SendMessage(0x40, "Spectators aren't allowed on the chessboard");

                // Expel
                if (!m_BoardBounds.Contains(oldLocation as IPoint2D))
                {
                    m.Location = oldLocation;
                }
                else
                {
                    m.Location = new Point3D(m_BoardBounds.X - 1, m_BoardBounds.Y - 1, m_Height);
                }
            }
            else
            {
                base.OnLocationChanged(m, oldLocation);
            }
        }
Esempio n. 2
0
        public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
        {
            if (m_Game == null || m is ChessMobile || m_AllowSpectators || m_Game.IsPlayer(m) || m.AccessLevel > AccessLevel.Player)
            {
                return(true);
            }

            m.SendMessage(0x40, "Spectators aren't allowed on the chessboard");
            return(false);
        }
Esempio n. 3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (m_Bounds.Width == 0)
            {
                // Not configured yet
                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.Target = new ChessTarget(from, "Target the north west corner of the chessboard you wish to create",
                                                  OnBoardTarget);
                }
                else
                {
                    from.SendMessage(0x40, "This chess board isn't ready for a game yet. Please contact a game master for assistance with its configuration.");
                }
            }
            else if (m_Game != null)
            {
                if (m_Game.IsPlayer(from) && m_Game.AllowGame)
                {
                    m_Game.SendAllGumps(null, null);
                }
                else
                {
                    from.SendMessage(0x40, "A chess game is currently in progress. Please try again later.");
                }
            }
            else
            {
                m_Game = new ChessGame(this, from, m_Bounds, m_BoardHeight);

                InvalidateProperties();
            }
        }