Beispiel #1
0
        public static void HandleClientEntityCommand(WorldSession session, ClientEntityCommand entityCommand)
        {
            foreach ((EntityCommand id, IEntityCommand command) in entityCommand.Commands)
            {
                switch (command)
                {
                case SetPositionCommand setPosition:
                    session.Player.CancelSpellsOnMove();
                    session.Player.Map.EnqueueRelocate(session.Player, setPosition.Position.Vector);
                    break;

                case SetRotationCommand setRotation:
                    session.Player.Rotation = setRotation.Position.Vector;
                    break;
                }
            }

            session.Player.EnqueueToVisible(new ServerEntityCommand
            {
                Guid     = session.Player.Guid,
                Time     = entityCommand.Time,
                Unknown2 = true,
                Commands = entityCommand.Commands
            });
        }
Beispiel #2
0
        public static void HandleEntityCommand(WorldSession session, ClientEntityCommand entityCommand)
        {
            WorldEntity mover = session.Player;

            if (session.Player.ControlGuid != session.Player.Guid)
            {
                mover = session.Player.GetVisible <WorldEntity>(session.Player.ControlGuid);
            }

            if (mover == null)
            {
                return;
            }

            foreach ((EntityCommand id, IEntityCommandModel command) in entityCommand.Commands)
            {
                switch (command)
                {
                case SetPositionCommand setPosition:
                {
                    // this is causing issues after moving to soon after mounting:
                    // session.Player.CancelSpellsOnMove();
                    mover.Relocate(setPosition.Position.Vector);
                    break;
                }

                case SetRotationCommand setRotation:
                    mover.Rotation = setRotation.Position.Vector;
                    break;
                }
            }

            mover.EnqueueToVisible(new ServerEntityCommand
            {
                Guid             = mover.Guid,
                Time             = entityCommand.Time,
                ServerControlled = false,
                Commands         = entityCommand.Commands
            });
        }