Server.Mobiles.PlayerMobile.Move C# (CSharp) Method

Move() public method

public Move ( Direction d ) : bool
d Direction
return bool
        public override bool Move(Direction d)
        {
            NetState ns = this.NetState;

            if (ns != null)
            {
                if (HasGump(typeof(ResurrectGump))) {
                    if (Alive) {
                        CloseGump(typeof(ResurrectGump));
                    } else {
                        SendLocalizedMessage(500111); // You are frozen and cannot move.
                        return false;
                    }
                }
            }

            TimeSpan speed = ComputeMovementSpeed(d);

            bool res;

            if (!Alive)
                Server.Movement.MovementImpl.IgnoreMovableImpassables = true;

            res = base.Move(d);

            Server.Movement.MovementImpl.IgnoreMovableImpassables = false;

            if (!res)
                return false;

            m_NextMovementTime += speed;

            return true;
        }

Usage Example

Ejemplo n.º 1
0
            private static void Process( PlayerMobile pm, Direction dir, int seq )
            {
                if ( (pm.NetState.Sequence == 0 && seq != 0) || !pm.Move( dir ) )
                {
                    pm.Send( new MovementRej( seq, pm ) );
                    pm.NetState.Sequence = 0;

                    pm.ClearFastwalkStack();
                }
                else
                {
                    ++seq;

                    if ( seq == 256 )
                        seq = 1;

                    pm.NetState.Sequence = seq;
                }
            }