当前位置: 首页>>代码示例>>C#>>正文


C# BitUnpack.GetBit方法代码示例

本文整理汇总了C#中BitUnpack.GetBit方法的典型用法代码示例。如果您正苦于以下问题:C# BitUnpack.GetBit方法的具体用法?C# BitUnpack.GetBit怎么用?C# BitUnpack.GetBit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitUnpack的用法示例。


在下文中一共展示了BitUnpack.GetBit方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleCreateCharacter

        public static void HandleCreateCharacter(ref PacketReader packet, WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            packet.Skip(1);

            var facialHair = packet.ReadByte();
            var skin = packet.ReadByte();
            var race = packet.ReadByte();
            var hairStyle = packet.ReadByte();
            var pClass = packet.ReadByte();
            var face = packet.ReadByte();
            var gender = packet.ReadByte();
            var hairColor = packet.ReadByte();

            var nameLength  = BitUnpack.GetBits<uint>(6);
            var hasUnknown = BitUnpack.GetBit();
            var name        = Character.NormalizeName(packet.ReadString(nameLength));

            if (hasUnknown)
                packet.ReadUInt32();

            var result      = DB.Characters.Select("SELECT * from characters WHERE name = ?", name);
            var createChar  = new PacketWriter(ServerMessage.CreateChar);

            if (result.Count != 0)
            {
                // Name already in use
                createChar.WriteUInt8(0x32);
                session.Send(ref createChar);
                return;
            }

            result = DB.Characters.Select("SELECT map, zone, posX, posY, posZ, posO FROM character_creation_data WHERE race = ? AND class = ?", race, pClass);
            if (result.Count == 0)
            {
                createChar.WriteUInt8(0x31);
                session.Send(ref createChar);
                return;
            }

            var map  = result.Read<uint>(0, "map");
            var zone = result.Read<uint>(0, "zone");
            var posX = result.Read<float>(0, "posX");
            var posY = result.Read<float>(0, "posY");
            var posZ = result.Read<float>(0, "posZ");
            var posO = result.Read<float>(0, "posO");

            // Allow declined names for now
            var characterFlags = CharacterFlag.Decline;

            DB.Characters.Execute("INSERT INTO characters (name, accountid, realmId, race, class, gender, skin, zone, map, x, y, z, o, face, hairstyle, haircolor, facialhair, characterFlags) VALUES (" +
                                  "?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
                                  name, session.Account.Id, WorldConfig.RealmId, race, pClass, gender, skin, zone, map, posX, posY, posZ, posO, face, hairStyle, hairColor, facialHair, characterFlags);

            // Success
            createChar.WriteUInt8(0x2F);
            session.Send(ref createChar);
        }
开发者ID:Nowhereman23,项目名称:Arctium-WoW,代码行数:59,代码来源:CharacterHandler.cs

示例2: HandleLoadingScreenNotify

        public static void HandleLoadingScreenNotify(ref PacketReader packet, WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            uint mapId = packet.Read<uint>();
            bool loadingScreenState = BitUnpack.GetBit();

            Log.Message(LogType.Debug, "Loading screen for map '{0}' is {1}.", mapId, loadingScreenState ? "enabled" : "disabled");
        }
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:9,代码来源:MiscHandler.cs

示例3: HandleCharDelete

        public static void HandleCharDelete(ref PacketReader packet, ref WorldClass session)
        {
            bool[] guidMask = new bool[8];
            byte[] guidBytes = new byte[8];

            BitUnpack BitUnpack = new BitUnpack(packet);

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

            var unknown = BitUnpack.GetBit();

            guidMask[3] = BitUnpack.GetBit();
            guidMask[0] = BitUnpack.GetBit();
            guidMask[4] = BitUnpack.GetBit();

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

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

            PacketWriter deleteChar = new PacketWriter(ServerMessage.DeleteChar);

            deleteChar.WriteUInt8(0x47);

            session.Send(ref deleteChar);

            DB.Characters.Execute("DELETE FROM characters WHERE guid = ?", guid);
            DB.Characters.Execute("DELETE FROM character_spells WHERE guid = ?", guid);
            DB.Characters.Execute("DELETE FROM character_skills WHERE guid = ?", guid);
        }
开发者ID:australopitheque,项目名称:Arctium,代码行数:40,代码来源:CharacterHandler.cs

示例4: HandleDBQueryBulk

        public static void HandleDBQueryBulk(ref PacketReader packet, ref WorldClass session)
        {
            List<int> IdList = new List<int>();
            BitUnpack BitUnpack = new BitUnpack(packet);

            var type = (DBTypes)packet.Read<uint>();

            var count = BitUnpack.GetBits<uint>(21);

            bool[][] Mask = new bool[count][];
            byte[][] Bytes = new byte[count][];

            for (int i = 0; i < count; i++)
            {
                Mask[i] = new bool[8];
                Bytes[i] = new byte[8];
            }

            for (int i = 0; i < count; i++)
            {
                Mask[i][7] = BitUnpack.GetBit();
                Mask[i][2] = BitUnpack.GetBit();
                Mask[i][3] = BitUnpack.GetBit();
                Mask[i][5] = BitUnpack.GetBit();
                Mask[i][4] = BitUnpack.GetBit();
                Mask[i][6] = BitUnpack.GetBit();
                Mask[i][0] = BitUnpack.GetBit();
                Mask[i][1] = BitUnpack.GetBit();
            }

            for (int i = 0; i < count; i++)
            {
                if (Mask[i][5])
                    Bytes[i][5] = (byte)(packet.Read<byte>() ^ 1);

                IdList.Add(packet.Read<int>());

                if (Mask[i][7])
                    Bytes[i][7] = (byte)(packet.ReadByte() ^ 1);

                if (Mask[i][3])
                    Bytes[i][3] = (byte)(packet.ReadByte() ^ 1);

                if (Mask[i][0])
                    Bytes[i][0] = (byte)(packet.ReadByte() ^ 1);

                if (Mask[i][1])
                    Bytes[i][1] = (byte)(packet.ReadByte() ^ 1);

                if (Mask[i][6])
                    Bytes[i][6] = (byte)(packet.ReadByte() ^ 1);

                if (Mask[i][2])
                    Bytes[i][2] = (byte)(packet.ReadByte() ^ 1);

                if (Mask[i][4])
                    Bytes[i][4] = (byte)(packet.ReadByte() ^ 1);
            }

            switch (type)
            {
                case DBTypes.BroadcastText:
                {
                    foreach (var id in IdList)
                        HandleBroadcastText(ref session, id);

                    break;
                }
                default:
                    break;
            }
        }
开发者ID:ArkantosWoW,项目名称:ArkantosEmu,代码行数:72,代码来源:CacheHandler.cs

示例5: HandleMoveSetFly

        public static void HandleMoveSetFly(ref PacketReader packet, WorldClass session)
        {
            ObjectMovementValues movementValues = new ObjectMovementValues();
            BitUnpack BitUnpack = new BitUnpack(packet);

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

            Vector4 vector = new Vector4()
            {
                Y = packet.Read<float>(),
                X = packet.Read<float>(),
                Z = packet.Read<float>(),
            };

            movementValues.IsFallingOrJumping = BitUnpack.GetBit();

            guidMask[0] = BitUnpack.GetBit();

            movementValues.HasMovementFlags2 = !BitUnpack.GetBit();

            guidMask[6] = BitUnpack.GetBit();

            movementValues.HasMovementFlags = !BitUnpack.GetBit();

            var Unknown = BitUnpack.GetBit();

            guidMask[2] = BitUnpack.GetBit();

            movementValues.HasRotation = !BitUnpack.GetBit();

            var Unknown2 = !BitUnpack.GetBit();

            var HasSplineElevation = !BitUnpack.GetBit();

            movementValues.IsTransport = BitUnpack.GetBit();

            guidMask[1] = BitUnpack.GetBit();

            guidMask[5] = BitUnpack.GetBit();

            var HasPitch = !BitUnpack.GetBit();

            var Unknown4 = BitUnpack.GetBit();

            guidMask[4] = BitUnpack.GetBit();

            var HasTime = !BitUnpack.GetBit();

            var counter = BitUnpack.GetBits<uint>(22);

            var Unknown3 = BitUnpack.GetBit();

            guidMask[7] = BitUnpack.GetBit();

            guidMask[3] = BitUnpack.GetBit();

            if (movementValues.IsFallingOrJumping)
                movementValues.HasJumpData = BitUnpack.GetBit();

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

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

            for (int i = 0; i < counter; i++)
                packet.Read<uint>();

            if (guidMask[4])
                guidBytes[4] = (byte)(packet.Read<byte>() ^ 1);

            if (guidMask[2])
                guidBytes[2] = (byte)(packet.Read<byte>() ^ 1);

            if (guidMask[6])
                guidBytes[6] = (byte)(packet.Read<byte>() ^ 1);

            if (guidMask[3])
                guidBytes[3] = (byte)(packet.Read<byte>() ^ 1);

            if (guidMask[0])
                guidBytes[0] = (byte)(packet.Read<byte>() ^ 1);

            if (guidMask[7])
                guidBytes[7] = (byte)(packet.Read<byte>() ^ 1);

            if (guidMask[1])
                guidBytes[1] = (byte)(packet.Read<byte>() ^ 1);

            if (guidMask[5])
                guidBytes[5] = (byte)(packet.Read<byte>() ^ 1);

            if (Unknown2)
                packet.Read<uint>();

            if (movementValues.IsFallingOrJumping)
            {
                if (movementValues.HasJumpData)
                {
//.........这里部分代码省略.........
开发者ID:rodrigoalv,项目名称:Arctium-WoW,代码行数:101,代码来源:MoveHandler.cs

示例6: HandleMoveStopTurn

        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)
//.........这里部分代码省略.........
开发者ID:boredtodeath,项目名称:Arctium,代码行数:101,代码来源:MoveHandler.cs

示例7: HandleAuthResponse

        public static void HandleAuthResponse(ref PacketReader packet, WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

            ushort  skipBytes;
            uint[]  UnknownInt = new uint[5];
            ushort  clientBuild;
            byte[]  authChallenge = new byte[20];
            byte[]  UnknownByte = new byte[2];
            ulong   unknownLong;
            int     addonPackedSize;
            int     addonUnpackedSize;

            skipBytes           = packet.Read<ushort>();

            UnknownInt[4]       = packet.Read<uint>();

            authChallenge[14]   = packet.Read<byte>();
            authChallenge[8]    = packet.Read<byte>();

            UnknownInt[0]       = packet.Read<uint>();

            authChallenge[10]   = packet.Read<byte>();
            authChallenge[19]   = packet.Read<byte>();
            authChallenge[16]   = packet.Read<byte>();
            authChallenge[13]   = packet.Read<byte>();
            authChallenge[4]    = packet.Read<byte>();

            UnknownByte[1]      = packet.Read<byte>();

            authChallenge[9]    = packet.Read<byte>();
            authChallenge[0]    = packet.Read<byte>();

            UnknownInt[2]       = packet.Read<uint>();

            authChallenge[5]    = packet.Read<byte>();
            authChallenge[2]    = packet.Read<byte>();

            clientBuild         = packet.Read<ushort>();

            authChallenge[12]   = packet.Read<byte>();

            UnknownInt[3]       = packet.Read<uint>();

            authChallenge[18]   = packet.Read<byte>();
            authChallenge[17]   = packet.Read<byte>();
            authChallenge[11]   = packet.Read<byte>();

            unknownLong         = packet.Read<ulong>();

            authChallenge[7]    = packet.Read<byte>();
            authChallenge[1]    = packet.Read<byte>();
            authChallenge[3]    = packet.Read<byte>();

            UnknownByte[0]      = packet.Read<byte>();

            authChallenge[6]    = packet.Read<byte>();

            UnknownInt[1]       = packet.Read<uint>();

            authChallenge[15]   = packet.Read<byte>();

            addonPackedSize     = packet.Read<int>();
            addonUnpackedSize   = packet.Read<int>();

            byte[] packedAddon  = packet.ReadBytes(addonPackedSize - 4);
            AddonHandler.ReadAddonData(packedAddon, addonUnpackedSize, session);

            uint nameLength = BitUnpack.GetBits<uint>(11);
            bool aBit = BitUnpack.GetBit();

            // BitUnpack.Flush();

            string accountName = packet.ReadString(nameLength);

            SQLResult result = DB.Realms.Select("SELECT * FROM accounts WHERE name = ?", accountName);
            if (result.Count == 0)
                session.clientSocket.Close();
            else
                session.Account = new Account()
                {
                    Id         = result.Read<int>(0, "id"),
                    Name       = result.Read<string>(0, "name"),
                    Password   = result.Read<string>(0, "password"),
                    SessionKey = result.Read<string>(0, "sessionkey"),
                    Expansion  = result.Read<byte>(0, "expansion"),
                    GMLevel    = result.Read<byte>(0, "gmlevel"),
                    IP         = result.Read<string>(0, "ip"),
                    Language   = result.Read<string>(0, "language")
                };

            string K = session.Account.SessionKey;
            byte[] kBytes = new byte[K.Length / 2];

            for (int i = 0; i < K.Length; i += 2)
                kBytes[i / 2] = Convert.ToByte(K.Substring(i, 2), 16);

            session.Crypt.Initialize(kBytes);

            uint realmId = WorldConfig.RealmId;
//.........这里部分代码省略.........
开发者ID:mansemino,项目名称:Arctium,代码行数:101,代码来源:AuthenticationHandler.cs

示例8: HandleQueryPlayerName

        public static void HandleQueryPlayerName(ref PacketReader packet, WorldClass session)
        {
            BitUnpack BitUnpack = new BitUnpack(packet);

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

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

            var hasUnknown = BitUnpack.GetBit();

            guidMask[0] = BitUnpack.GetBit();

            var hasUnknown2 = BitUnpack.GetBit();

            guidMask[4] = BitUnpack.GetBit();

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

            if (hasUnknown)
                packet.Read<uint>();

            if (hasUnknown2)
                packet.Read<uint>();

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

            var pSession = WorldMgr.GetSession(guid);
            if (pSession != null)
            {
                var pChar = pSession.Character;

                if (pChar != null)
                {
                    PacketWriter queryPlayerNameResponse = new PacketWriter(ServerMessage.QueryPlayerNameResponse);
                    BitPack BitPack = new BitPack(queryPlayerNameResponse, guid);

                    BitPack.WriteGuidMask(3, 2, 6, 0, 4, 1, 5, 7);

                    BitPack.Flush();

                    BitPack.WriteGuidBytes(7, 1, 2, 6, 3, 5);

                    queryPlayerNameResponse.WriteUInt8(0);
                    queryPlayerNameResponse.WriteUInt8(pChar.Gender);
                    queryPlayerNameResponse.WriteUInt8(pChar.Class);
                    queryPlayerNameResponse.WriteUInt8(pChar.Level);
                    queryPlayerNameResponse.WriteUInt32(1);
                    queryPlayerNameResponse.WriteUInt8(pChar.Race);
                    queryPlayerNameResponse.WriteUInt32(0);

                    BitPack.WriteGuidBytes(4, 0);

                    BitPack.WriteGuidMask(5);
                    BitPack.Write(0);
                    BitPack.Write(0);
                    BitPack.Write(0);
                    BitPack.WriteGuidMask(3, 7, 0, 6);
                    BitPack.Write(0);
                    BitPack.Write(0);
                    BitPack.WriteGuidMask(1);
                    BitPack.Write(0);

                    for (int i = 0; i < 5; i++)
                        BitPack.Write(0, 7);

                    BitPack.WriteGuidMask(2);
                    BitPack.Write(0);
                    BitPack.WriteGuidMask(4);
                    BitPack.Write(0);
                    BitPack.Write(pChar.Name.Length, 6);
                    BitPack.Write(0);

                    BitPack.Flush();

                    BitPack.WriteGuidBytes(0, 7, 5, 2);

                    queryPlayerNameResponse.WriteString(pChar.Name);

                    BitPack.WriteGuidBytes(4, 1, 3, 6);

                    session.Send(ref queryPlayerNameResponse);
                }
            }
        }
开发者ID:mansemino,项目名称:Arctium,代码行数:97,代码来源:CacheHandler.cs

示例9: HandleMoveFallLand

        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();
//.........这里部分代码省略.........
开发者ID:Mathias1000,项目名称:Arctium,代码行数:101,代码来源:MoveHandler.cs

示例10: HandleForceWalkSpeedChangeAck

        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();
//.........这里部分代码省略.........
开发者ID:Mathias1000,项目名称:Arctium,代码行数:101,代码来源:MoveHandler.cs


注:本文中的BitUnpack.GetBit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。