Exemple #1
0
        public static void HandleMoveStopTurn(ref PacketReader packet, ref WorldClass session)
        {
            ObjectMovementValues movementValues = new ObjectMovementValues();
            BitUnpack BitUnpack = new BitUnpack(packet);

            bool[] guidMask = new bool[8];
            byte[] guidBytes = new byte[8];

            Vector4 vector = new Vector4()
            {
                X = packet.ReadFloat(),
                Z = packet.ReadFloat(),
                Y = packet.ReadFloat()
            };

            bool HasTime = !BitUnpack.GetBit();

            guidMask[5] = BitUnpack.GetBit();

            bool Unknown = BitUnpack.GetBit();

            movementValues.IsTransport = BitUnpack.GetBit();

            bool Unknown2 = BitUnpack.GetBit();

            guidMask[3] = BitUnpack.GetBit();

            bool HasSplineElevation = !BitUnpack.GetBit();

            guidMask[0] = BitUnpack.GetBit();

            bool HasPitch = !BitUnpack.GetBit();

            uint counter = BitUnpack.GetBits<uint>(24);

            guidMask[1] = BitUnpack.GetBit();
            guidMask[7] = BitUnpack.GetBit();

            movementValues.HasMovementFlags = !BitUnpack.GetBit();
            movementValues.IsAlive = !BitUnpack.GetBit();

            guidMask[2] = BitUnpack.GetBit();
            guidMask[6] = BitUnpack.GetBit();

            movementValues.HasRotation = !BitUnpack.GetBit();

            bool Unknown3 = BitUnpack.GetBit();

            movementValues.HasMovementFlags2 = !BitUnpack.GetBit();

            bool Unknown4 = BitUnpack.GetBit();

            guidMask[4] = BitUnpack.GetBit();

            /*if (movementValues.IsTransport)
            {

            }

            if (IsInterpolated)
            {

            }*/

            if (movementValues.HasMovementFlags)
                movementValues.MovementFlags = (MovementFlag)BitUnpack.GetBits<uint>(30);

            if (movementValues.HasMovementFlags2)
                movementValues.MovementFlags2 = (MovementFlag2)BitUnpack.GetBits<uint>(13);

            if (guidMask[6]) guidBytes[6] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[0]) guidBytes[0] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[5]) guidBytes[5] = (byte)(packet.ReadUInt8() ^ 1);

            for (int i = 0; i < counter; i++)
                packet.ReadUInt32();

            if (guidMask[1]) guidBytes[1] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[7]) guidBytes[7] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[3]) guidBytes[3] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[4]) guidBytes[4] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[2]) guidBytes[2] = (byte)(packet.ReadUInt8() ^ 1);

            /*if (movementValues.IsTransport)
            {

            }*/

            if (movementValues.HasRotation)
                vector.W = packet.ReadFloat();

            if (movementValues.IsAlive)
                movementValues.Time = packet.ReadUInt32();

            /*if (IsInterpolated)
            {

            }*/

            if (HasPitch)
                packet.ReadFloat();

            if (HasSplineElevation)
                packet.ReadFloat();

            if (HasTime)
                movementValues.Time = packet.ReadUInt32();

            var guid = BitConverter.ToUInt64(guidBytes, 0);
            HandleMoveUpdate(guid, movementValues, vector);
        }
Exemple #2
0
        public static void HandleMoveFallLand(ref PacketReader packet, ref WorldClass session)
        {
            ObjectMovementValues movementValues = new ObjectMovementValues();
            BitUnpack BitUnpack = new BitUnpack(packet);

            bool[] guidMask = new bool[8];
            byte[] guidBytes = new byte[8];

            Vector4 vector = new Vector4()
            {
                Y = packet.ReadFloat(),
                X = packet.ReadFloat(),
                Z = packet.ReadFloat()
            };

            uint counter = BitUnpack.GetBits<uint>(24);

            guidMask[2] = BitUnpack.GetBit();

            bool HasTime = !BitUnpack.GetBit();

            bool HasSplineElevation = !BitUnpack.GetBit();

            guidMask[6] = BitUnpack.GetBit();
            guidMask[0] = BitUnpack.GetBit();

            movementValues.IsTransport = BitUnpack.GetBit();

            bool Unknown3 = BitUnpack.GetBit();
            bool Unknown = BitUnpack.GetBit();

            guidMask[4] = BitUnpack.GetBit();

            movementValues.HasMovementFlags2 = !BitUnpack.GetBit();

            bool HasPitch = !BitUnpack.GetBit();

            movementValues.HasRotation = !BitUnpack.GetBit();

            bool Unknown2 = BitUnpack.GetBit();

            guidMask[1] = BitUnpack.GetBit();

            movementValues.IsAlive = !BitUnpack.GetBit();
            movementValues.HasMovementFlags = !BitUnpack.GetBit();

            guidMask[5] = BitUnpack.GetBit();
            guidMask[7] = BitUnpack.GetBit();
            guidMask[3] = BitUnpack.GetBit();

            bool Unknown4 = BitUnpack.GetBit();

            /*if (movementValues.IsTransport)
            {
                vehicleGuidMask[4] = BitUnpack.GetBit();
                vehicleGuidMask[1] = BitUnpack.GetBit();
                bool vehicleUnknown2 = BitUnpack.GetBit();
                vehicleGuidMask[2] = BitUnpack.GetBit();
                vehicleGuidMask[3] = BitUnpack.GetBit();
                vehicleGuidMask[7] = BitUnpack.GetBit();
                vehicleGuidMask[0] = BitUnpack.GetBit();
                bool vehicleUnknown1 = BitUnpack.GetBit();
                vehicleGuidMask[5] = BitUnpack.GetBit();
                vehicleGuidMask[6] = BitUnpack.GetBit();
            }

            if (movementValues.IsInterpolated)
                    movementValues.IsInterpolated2 = BitUnpack.GetBit();*/

            if (movementValues.HasMovementFlags2)
                movementValues.MovementFlags2 = (MovementFlag2)BitUnpack.GetBits<uint>(13);

            if (movementValues.HasMovementFlags)
                movementValues.MovementFlags = (MovementFlag)BitUnpack.GetBits<uint>(30);

            if (guidMask[0]) guidBytes[0] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[2]) guidBytes[2] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[1]) guidBytes[1] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[4]) guidBytes[4] = (byte)(packet.ReadUInt8() ^ 1);

            for (int i = 0; i < counter; i++)
                packet.ReadUInt32();

            if (guidMask[6]) guidBytes[6] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[5]) guidBytes[5] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[7]) guidBytes[7] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[3]) guidBytes[3] = (byte)(packet.ReadUInt8() ^ 1);

            /*if (movementValues.IsTransport)
            {
                Vector4 vehiclevector = new Vector4();
                vehiclevector.X = packet.ReadFloat();
                if (vehicleGuidMask[0]) vehicleGuidBytes[0] = (byte)(packet.ReadUInt8() ^ 1);
                if ( vehicleUnknown1 ) uint _25 = packet.ReadUInt32();
                if (vehicleGuidMask[4]) vehicleGuidBytes[4] = (byte)(packet.ReadUInt8() ^ 1);
                if (vehicleGuidMask[5]) vehicleGuidBytes[5] = (byte)(packet.ReadUInt8() ^ 1);
                if (vehicleGuidMask[3]) vehicleGuidBytes[3] = (byte)(packet.ReadUInt8() ^ 1);
                byte _88 = packet.ReadUInt8();
                if (vehicleGuidMask[7]) vehicleGuidBytes[7] = (byte)(packet.ReadUInt8() ^ 1);
                vehiclevector.O = packet.ReadFloat();
                vehiclevector.Z = packet.ReadFloat();
                vehiclevector.Y = packet.ReadFloat();
                if (vehicleGuidMask[6]) vehicleGuidBytes[6] = (byte)(packet.ReadUInt8() ^ 1);
                uint _23 = packet.ReadUInt32();
                if (vehicleGuidMask[2]) vehicleGuidBytes[2] = (byte)(packet.ReadUInt8() ^ 1);
                if ( vehicleUnknown2 ) uint _27 = packet.ReadUInt32();
                if (vehicleGuidMask[1]) vehicleGuidBytes[1] = (byte)(packet.ReadUInt8() ^ 1);
            }*/
               // return

            if (HasPitch)
                packet.ReadFloat(); // float _28

            /*if (movementValues.IsInterpolated)
            {
                if (movementValues.IsInterpolated2)
                {
                    float _33 = packet.ReadFloat();
                    float _34 = packet.ReadFloat();
                    float _35 = packet.ReadFloat();
                }
                float _ 31 = packet.ReadFloat();
                uint _30 = packet.ReadUInt32();
            }*/

            if (movementValues.HasRotation)
                vector.O = packet.ReadFloat();

            if (HasTime)
                movementValues.Time = packet.ReadUInt32();

            if (HasSplineElevation)
                packet.ReadFloat();

            if (movementValues.IsAlive)
                movementValues.Time = packet.ReadUInt32();

            var guid = BitConverter.ToUInt64(guidBytes, 0);
            HandleMoveUpdate(guid, movementValues, vector);
        }
Exemple #3
0
        public static void HandlePlayerLogin(ref PacketReader packet, ref WorldClass session)
        {
            byte[] guidMask = { 5, 0, 6, 2, 1, 3, 7, 4 };
            byte[] guidBytes = { 1, 5, 7, 0, 4, 6, 3, 2 };

            BitUnpack GuidUnpacker = new BitUnpack(packet);

            var unknown = packet.ReadFloat();
            var guid = GuidUnpacker.GetPackedValue(guidMask, guidBytes);
            Log.Message(LogType.DEBUG, "Character with Guid: {0}, AccountId: {1} tried to enter the world.", guid, session.Account.Id);

            session.Character = new Character(guid);

            if (!WorldMgr.AddSession(guid, ref session))
            {
                Log.Message(LogType.ERROR, "A Character with Guid: {0} is already logged in", guid);
                return;
            }

            WorldMgr.WriteAccountDataTimes(AccountDataMasks.CharacterCacheMask, ref session);

            MiscHandler.HandleMessageOfTheDay(ref session);
            TimeHandler.HandleLoginSetTimeSpeed(ref session);
            //SpecializationHandler.HandleTalentUpdate(ref session);
            SpellHandler.HandleSendKnownSpells(ref session);
            MiscHandler.HandleUpdateActionButtons(ref session);

            if (session.Character.LoginCinematic)
                CinematicHandler.HandleStartCinematic(ref session);

            ObjectHandler.HandleUpdateObjectCreate(ref session);
        }
Exemple #4
0
        public static void HandleForceWalkSpeedChangeAck(ref PacketReader packet, ref WorldClass session)
        {
            ObjectMovementValues movementValues = new ObjectMovementValues();
            BitUnpack BitUnpack = new BitUnpack(packet);

            bool[] guidMask = new bool[8];
            byte[] guidBytes = new byte[8];

            Vector4 vector = new Vector4()
            {
                Y = packet.ReadFloat(),
                Z = packet.ReadFloat(),
                X = packet.ReadFloat()
            };

            uint zeroes = packet.ReadUInt32();
            float walkspeed = packet.ReadFloat();

            bool Unknown2 = BitUnpack.GetBit();

            guidMask[6] = BitUnpack.GetBit();

            bool HasPitch = !BitUnpack.GetBit();
            movementValues.IsTransport = BitUnpack.GetBit();
            bool Unknown3 = BitUnpack.GetBit();

            guidMask[1] = BitUnpack.GetBit();
            guidMask[2] = BitUnpack.GetBit();

            movementValues.IsAlive = !BitUnpack.GetBit();
            bool HasTime = !BitUnpack.GetBit();

            uint counter = BitUnpack.GetBits<uint>(24);

            guidMask[0] = BitUnpack.GetBit();

            movementValues.HasMovementFlags = !BitUnpack.GetBit();

            guidMask[5] = BitUnpack.GetBit();

            bool Unknown4 = BitUnpack.GetBit();
            bool HasSplineElevation = !BitUnpack.GetBit();

            guidMask[3] = BitUnpack.GetBit();

            movementValues.HasRotation = !BitUnpack.GetBit();
            movementValues.HasMovementFlags2 = !BitUnpack.GetBit();

            guidMask[7] = BitUnpack.GetBit();
            guidMask[4] = BitUnpack.GetBit();

            bool Unknown = BitUnpack.GetBit();

            /*if (movementValues.IsTransport)
            {
                vehicleGuidMask[2] = BitUnpack.GetBit();
                vehicleGuidMask[5] = BitUnpack.GetBit();
                vehicleGuidMask[4] = BitUnpack.GetBit();
                vehicleGuidMask[1] = BitUnpack.GetBit();
                vehicleGuidMask[0] = BitUnpack.GetBit();
                vehicleGuidMask[3] = BitUnpack.GetBit();
                vehicleGuidMask[7] = BitUnpack.GetBit();
                vehicleGuidMask[6] = BitUnpack.GetBit();
                bool vehicleUnknown1 = BitUnpack.GetBit();
                bool vehicleUnknown2 = BitUnpack.GetBit();
            }*/

            if (movementValues.HasMovementFlags)
                movementValues.MovementFlags = (MovementFlag)BitUnpack.GetBits<uint>(30);

            /*if (movementValues.IsInterpolated)
                    movementValues.IsInterpolated2 = BitUnpack.GetBit();*/

            if (movementValues.HasMovementFlags2)
                movementValues.MovementFlags2 = (MovementFlag2)BitUnpack.GetBits<uint>(13);

            if (guidMask[3]) guidBytes[3] = (byte)(packet.ReadUInt8() ^ 1);

            for (int i = 0; i < counter; i++)
                packet.ReadUInt32();

            if (guidMask[0]) guidBytes[0] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[4]) guidBytes[4] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[1]) guidBytes[1] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[2]) guidBytes[2] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[7]) guidBytes[7] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[6]) guidBytes[6] = (byte)(packet.ReadUInt8() ^ 1);
            if (guidMask[5]) guidBytes[5] = (byte)(packet.ReadUInt8() ^ 1);

            /*if (movementValues.IsTransport)
            {
                Vector4 vehiclevector = new Vector4();
                if (vehicleGuidMask[7]) vehicleGuidBytes[7] = (byte)(packet.ReadUInt8() ^ 1);
                if (vehicleGuidMask[5]) vehicleGuidBytes[5] = (byte)(packet.ReadUInt8() ^ 1);
                vehiclevector.Z = packet.ReadFloat();
                if (vehicleGuidMask[3]) vehicleGuidBytes[3] = (byte)(packet.ReadUInt8() ^ 1);
                byte _88 = packet.ReadUInt8(); 					  																			 // (BYTE)DATA[88]
                if (vehicleGuidMask[1]) vehicleGuidBytes[1] = (byte)(packet.ReadUInt8() ^ 1);
                if (vehicleGuidMask[0]) vehicleGuidBytes[0] = (byte)(packet.ReadUInt8() ^ 1);
                vehiclevector.X = packet.ReadFloat();
                if (vehicleGuidMask[4]) vehicleGuidBytes[4] = (byte)(packet.ReadUInt8() ^ 1);
                if ( vehicleUnknown1 ) packet.ReadUInt32();
                vehiclevector.Y = packet.ReadFloat();
                if (vehicleGuidMask[6]) vehicleGuidBytes[6] = (byte)(packet.ReadUInt8() ^ 1);
                uint _23 = packet.ReadUInt32();
                if (vehicleGuidMask[2]) vehicleGuidBytes[2] = (byte)(packet.ReadUInt8() ^ 1);
                if ( vehicleUnknown2 ) packet.ReadUInt32();
                vehiclevector.O = packet.ReadFloat();
            }

            if (movementValues.IsInterpolated)
            {
                float _31 = packet.ReadFloat();
                if (movementValues.IsInterpolated2)
                {
                    float _34 = packet.ReadFloat();
                    float _33 = packet.ReadFloat();
                    float _35 = packet.ReadFloat();
                }
                uint _30 = packet.ReadUInt32();
            }*/

            if (HasTime)
                movementValues.Time = packet.ReadUInt32();

            if (movementValues.IsAlive)
                movementValues.Time = packet.ReadUInt32();

            if (HasPitch)
                packet.ReadFloat();

            if (movementValues.HasRotation)
                vector.O = packet.ReadFloat();

            if (HasSplineElevation)
                packet.ReadFloat();

            var guid = BitConverter.ToUInt64(guidBytes, 0);
            HandleMoveUpdate(guid, movementValues, vector);

            Log.Message(LogType.DEBUG, "Character with Guid: {0}, AccountId: {1} changed walk speed to {2}", guid, session.Account.Id, walkspeed);
        }