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


C# Misc.Guid类代码示例

本文整理汇总了C#中WowPacketParser.Misc.Guid的典型用法代码示例。如果您正苦于以下问题:C# Guid类的具体用法?C# Guid怎么用?C# Guid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Guid类属于WowPacketParser.Misc命名空间,在下文中一共展示了Guid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandlePetNameQuery

        public static void HandlePetNameQuery(Packet packet)
        {
            var guid1 = new byte[8];
            var guid2 = new byte[8];

            guid2[1] = packet.ReadBit();
            guid1[5] = packet.ReadBit();
            guid2[3] = packet.ReadBit();
            guid1[0] = packet.ReadBit();
            guid1[3] = packet.ReadBit();
            guid2[4] = packet.ReadBit();
            guid1[1] = packet.ReadBit();
            guid1[4] = packet.ReadBit();
            guid2[0] = packet.ReadBit();
            guid2[7] = packet.ReadBit();
            guid1[6] = packet.ReadBit();
            guid1[7] = packet.ReadBit();
            guid1[2] = packet.ReadBit();
            guid2[5] = packet.ReadBit();
            guid2[2] = packet.ReadBit();
            guid2[6] = packet.ReadBit();

            packet.ReadXORByte(guid1, 1);
            packet.ReadXORByte(guid2, 5);
            packet.ReadXORByte(guid1, 5);
            packet.ReadXORByte(guid1, 4);
            packet.ReadXORByte(guid2, 1);
            packet.ReadXORByte(guid2, 7);
            packet.ReadXORByte(guid1, 7);
            packet.ReadXORByte(guid2, 4);
            packet.ReadXORByte(guid2, 2);
            packet.ReadXORByte(guid2, 0);
            packet.ReadXORByte(guid2, 6);
            packet.ReadXORByte(guid1, 6);
            packet.ReadXORByte(guid1, 0);
            packet.ReadXORByte(guid1, 3);
            packet.ReadXORByte(guid1, 2);
            packet.ReadXORByte(guid2, 3);

            packet.WriteGuid("Pet Guid", guid1);
            packet.WriteGuid("Pet Number", guid2);

            var PetGuid = new Guid(BitConverter.ToUInt64(guid1, 0));
            var PetNumberGuid = new Guid(BitConverter.ToUInt64(guid2, 0));
            var PetNumber = PetNumberGuid.GetEntry().ToString(CultureInfo.InvariantCulture); // Not sure about this.

            // Store temporary name from Pet Number GUID (will be retrieved as uint64 in SMSG_PET_NAME_QUERY_RESPONSE)
            StoreGetters.AddName(PetGuid, PetNumber);
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:49,代码来源:PetHandler.cs

示例2: ReadCreateObjectBlock

        private static void ReadCreateObjectBlock(ref Packet packet, Guid guid, uint map, int index)
        {
            var objType = packet.ReadEnum<ObjectType>("Object Type", TypeCode.Byte, index);
            var moves = ReadMovementUpdateBlock(ref packet, guid, index);
            var updates = CoreParsers.UpdateHandler.ReadValuesUpdateBlock(ref packet, objType, index, true);

            WoWObject obj;
            switch (objType)
            {
                case ObjectType.Unit:
                    obj = new Unit();
                    break;
                case ObjectType.GameObject:
                    obj = new GameObject();
                    break;
                case ObjectType.Item:
                    obj = new Item();
                    break;
                case ObjectType.Player:
                    obj = new Player();
                    break;
                default:
                    obj = new WoWObject();
                    break;
            }

            obj.Type = objType;
            obj.Movement = moves;
            obj.UpdateFields = updates;
            obj.Map = map;
            obj.Area = CoreParsers.WorldStateHandler.CurrentAreaId;
            obj.PhaseMask = (uint)CoreParsers.MovementHandler.CurrentPhaseMask;
            obj.Phases = new HashSet<ushort>(CoreParsers.MovementHandler.ActivePhases);

            // If this is the second time we see the same object (same guid,
            // same position) update its phasemask
            if (Storage.Objects.ContainsKey(guid))
            {
                var existObj = Storage.Objects[guid].Item1;
                CoreParsers.UpdateHandler.ProcessExistingObject(ref existObj, obj, guid); // can't do "ref Storage.Objects[guid].Item1 directly
            }
            else
                Storage.Objects.Add(guid, obj, packet.TimeSpan);

            if (guid.HasEntry() && (objType == ObjectType.Unit || objType == ObjectType.GameObject))
                packet.AddSniffData(Utilities.ObjectTypeToStore(objType), (int)guid.GetEntry(), "SPAWN");
        }
开发者ID:usernel,项目名称:WowPacketParser,代码行数:47,代码来源:UpdateHandler.cs

示例3: HandlePetNameQuery

        public static void HandlePetNameQuery(Packet packet)
        {
            var guid = new byte[8];
            var number = new byte[8];

            guid[5] = packet.ReadBit();
            number[3] = packet.ReadBit();
            guid[6] = packet.ReadBit();
            packet.StartBitStream(number, 5, 7);
            packet.StartBitStream(guid, 2, 4);
            number[2] = packet.ReadBit();
            guid[3] = packet.ReadBit();
            number[1] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            number[6] = packet.ReadBit();
            packet.StartBitStream(guid, 1, 0);
            packet.StartBitStream(number, 4, 0);
            packet.ResetBitReader();

            packet.ReadXORByte(number, 5);
            packet.ReadXORBytes(guid, 4, 3);
            packet.ReadXORBytes(number, 7, 4);
            packet.ReadXORBytes(guid, 5, 2, 0, 6);
            packet.ReadXORBytes(number, 2, 0, 6);
            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(number, 3);
            packet.ReadXORByte(guid, 7);
            packet.ReadXORByte(number, 1);

            var GUID = new Guid(BitConverter.ToUInt64(guid, 0));
            var Number = BitConverter.ToUInt64(number, 0);
            packet.WriteGuid("Guid", guid);
            packet.WriteLine("Pet Number: {0}", Number);

            // Store temporary name (will be replaced in SMSG_PET_NAME_QUERY_RESPONSE)
            StoreGetters.AddName(GUID, Number.ToString(CultureInfo.InvariantCulture));
        }
开发者ID:usernel,项目名称:WowPacketParser,代码行数:37,代码来源:PetHandler.cs

示例4: ReadMovementInfo

        public static MovementInfo ReadMovementInfo(ref Packet packet, Guid guid, int index = -1)
        {
            if (ClientVersion.Build == ClientVersionBuild.V4_2_0_14333)
                return ReadMovementInfo420(ref packet, index);

            return ReadMovementInfoGen(ref packet, guid, index);
        }
开发者ID:eddyb,项目名称:WowPacketParser,代码行数:7,代码来源:MovementHandler.cs

示例5: HandlePetSpells

        public static void HandlePetSpells(Packet packet)
        {
            var guid64 = packet.ReadUInt64();
            // Equal to "Clear spells" pre cataclysm
            if (guid64 == 0)
                return;

            var guid = new Guid(guid64);
            packet.WriteLine("GUID: " + guid);
            var isPet = guid.GetHighType() == HighGuidType.Pet;

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767))
                packet.ReadEnum<CreatureFamily>("Pet Family", TypeCode.UInt16); // vehicles -> 0

            packet.ReadUInt32("Unknown 1");

            // Following int8,int8,int16 is sent like int32
            /*var reactState = */ packet.ReadByte("React state"); // 1
            /*var commandState = */ packet.ReadByte("Command state"); // 1
            packet.ReadUInt16("Unknown 2"); // pets -> 0, vehicles -> 0x800 (2048)

            for (var i = 1; i <= (int)MiscConstants.CreatureMaxSpells + 2; i++) // Read pet/vehicle spell ids
            {
                var spell16 = packet.ReadUInt16();
                var spell8 = packet.ReadByte();
                var slotid = packet.ReadByte();
                var spellId = spell16 + (spell8 << 16);
                if (!isPet) // cleanup vehicle spells (start at 1 instead 8,
                {           // and do not print spells with id 0)
                    slotid -= (int)MiscConstants.PetSpellsOffset - 1;
                    if (spellId == 0)
                        continue;
                }

                packet.WriteLine("Spell " + slotid + ": " + StoreGetters.GetName(StoreNameType.Spell, spellId));
            }

            var spellCount = packet.ReadByte(); // vehicles -> 0, pets -> != 0. Could this be auras?
            packet.WriteLine("Spell count: " + spellCount);

            for (var i = 0; i < spellCount; i++)
            {
                // Sent as int32
                var spellId = packet.ReadUInt16();
                var active = packet.ReadInt16();
                packet.WriteLine("Spell " + i + ": " + StoreGetters.GetName(StoreNameType.Spell, spellId) + ", active: " + active);
            }

            var cdCount = packet.ReadByte();
            packet.WriteLine("Cooldown count: " + cdCount);

            for (var i = 0; i < cdCount; i++)
            {
                var spellId = ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767) ? packet.ReadInt32() : packet.ReadUInt16();

                var category = packet.ReadUInt16();
                var cooldown = packet.ReadUInt32();
                var categoryCooldown = packet.ReadUInt32();

                packet.WriteLine("Cooldown: Spell: " + StoreGetters.GetName(StoreNameType.Spell, spellId) + " category: " + category +
                    " cooldown: " + cooldown + " category cooldown: " + categoryCooldown);
            }
        }
开发者ID:Chaplain,项目名称:WowPacketParser,代码行数:63,代码来源:PetHandler.cs

示例6: HandleClientCharDelete

        public static void HandleClientCharDelete(Packet packet)
        {
            var playerGuid = new byte[8];

            playerGuid[2] = packet.ReadBit();
            playerGuid[1] = packet.ReadBit();
            playerGuid[5] = packet.ReadBit();
            playerGuid[7] = packet.ReadBit();
            playerGuid[6] = packet.ReadBit();

            var unknown = packet.ReadBit();

            playerGuid[3] = packet.ReadBit();
            playerGuid[0] = packet.ReadBit();
            playerGuid[4] = packet.ReadBit();

            packet.ReadXORByte(playerGuid, 1);
            packet.ReadXORByte(playerGuid, 3);
            packet.ReadXORByte(playerGuid, 4);
            packet.ReadXORByte(playerGuid, 0);
            packet.ReadXORByte(playerGuid, 7);
            packet.ReadXORByte(playerGuid, 2);
            packet.ReadXORByte(playerGuid, 5);
            packet.ReadXORByte(playerGuid, 6);

            var guid = new Guid(BitConverter.ToUInt64(playerGuid, 0));
            packet.WriteGuid("GUID", playerGuid);
        }
开发者ID:Resike,项目名称:WowPacketParser,代码行数:28,代码来源:CharacterHandler.cs

示例7: ReadCreateObjectBlock

        private static void ReadCreateObjectBlock(ref Packet packet, Guid guid, uint map, int index)
        {
            var objType = packet.ReadEnum<ObjectType>("Object Type", TypeCode.Byte, index);
            var moves = ReadMovementUpdateBlock(ref packet, guid, index);
            var updates = ReadValuesUpdateBlock(ref packet, objType, index);

            var obj = new WoWObject {Type = objType, Movement = moves, UpdateFields = updates, Map = map, Area = WorldStateHandler.CurrentAreaId, PhaseMask = (uint) MovementHandler.CurrentPhaseMask};
            if (guid.HasEntry() && guid.GetObjectType() == ObjectType.Unit)
            {
                List<string> lines = new List<string>();
                lines.Add("UpdateType: Values");
                foreach (var data in updates)
                    lines.Add("Block Value " + UpdateFields.GetUpdateFieldName(data.Key, "UnitField") + ": " + data.Value.Int32Value + "/" + data.Value.SingleValue);

                if (packet.SniffFileInfo.Stuffing.upObjPackets.ContainsKey(guid))
                    packet.SniffFileInfo.Stuffing.upObjPackets[guid].upObjPackets.Enqueue(new UpdateObjectPacket(packet.Time, packet.Number, lines));
                else
                    packet.SniffFileInfo.Stuffing.upObjPackets.TryAdd(guid, new UpdateObjectPackets(new UpdateObjectPacket(packet.Time, packet.Number, lines)));
            }

            packet.SniffFileInfo.Stuffing.Objects.TryAdd(guid, obj);

            if (guid.HasEntry() && (objType == ObjectType.Unit || objType == ObjectType.GameObject))
                packet.AddSniffData(Utilities.ObjectTypeToStore(objType), (int)guid.GetEntry(), "SPAWN");
        }
开发者ID:Asdcrew,项目名称:WowPacketParser,代码行数:25,代码来源:UpdateHandler.cs

示例8: ReadMovementInfo420

        public static MovementInfo ReadMovementInfo420(ref Packet packet, Guid guid, int index)
        {
            var info = new MovementInfo();

            info.Flags = packet.ReadEnum<MovementFlag>("Movement Flags", 30, index);

            packet.ReadEnum<MovementFlagExtra>("Extra Movement Flags", 12, index);

            var onTransport = packet.ReadBit("OnTransport", index);
            var hasInterpolatedMovement = false;
            var time3 = false;
            if (onTransport)
            {
                hasInterpolatedMovement = packet.ReadBit("HasInterpolatedMovement", index);
                time3 = packet.ReadBit("Time3", index);
            }

            var swimming = packet.ReadBit("Swimming", index);
            var interPolatedTurning = packet.ReadBit("InterPolatedTurning", index);

            var jumping = false;
            if (interPolatedTurning)
                jumping = packet.ReadBit("Jumping", index);

            var splineElevation = packet.ReadBit("SplineElevation", index);

            info.HasSplineData = packet.ReadBit("HasSplineData", index);

            packet.ResetBitReader(); // reset bitreader

            packet.ReadGuid("GUID 2", index);

            packet.ReadInt32("Time", index);
            var pos = packet.ReadVector4("Position", index);
            info.Position = new Vector3(pos.X, pos.Y, pos.Z);
            info.Orientation = pos.O;

            if (onTransport)
            {
                packet.ReadGuid("Transport GUID", index);
                packet.ReadVector4("Transport Position", index);
                packet.ReadByte("Transport Seat", index);
                packet.ReadInt32("Transport Time", index);
                if (hasInterpolatedMovement)
                    packet.ReadInt32("Transport Time 2", index);
                if (time3)
                    packet.ReadInt32("Transport Time 3", index);
            }
            if (swimming)
                packet.ReadSingle("Swim Pitch", index);

            if (interPolatedTurning)
            {
                packet.ReadInt32("Time Fallen", index);
                packet.ReadSingle("Fall Start Velocity", index);
                if (jumping)
                {
                    packet.ReadSingle("Jump Sin", index);
                    packet.ReadSingle("Jump Cos", index);
                    packet.ReadSingle("Jump Velocity", index);

                }
            }
            if (splineElevation)
                packet.ReadSingle("Spline Elevation", index);

            return info;
        }
开发者ID:CarlosX,项目名称:WowPacketParser,代码行数:68,代码来源:MovementHandler.cs

示例9: ReadMovementInfo

        public static MovementInfo ReadMovementInfo(ref Packet packet, Guid guid)
        {
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_0_14333))
                return ReadMovementInfo420(ref packet, guid, -1);

            return ReadMovementInfo(ref packet, guid, -1);
        }
开发者ID:CarlosX,项目名称:WowPacketParser,代码行数:7,代码来源:MovementHandler.cs

示例10: HandleAuraUpdate

        public static void HandleAuraUpdate(Packet packet)
        {
            var guid = new byte[8];
            var guid2 = new byte[8];

            guid[1] = packet.ReadBit();
            var hasPowerData = packet.ReadBit();

            uint bits3C = 0;
            if (hasPowerData)
            {
                packet.StartBitStream(guid2, 1, 5, 6);
                bits3C = packet.ReadBits(21);
                packet.StartBitStream(guid2, 2, 3, 7, 0, 4);
            }

            var bits4 = packet.ReadBits(24);
            guid[6] = packet.ReadBit();

            var hasAura = new bool[bits4];
            var hasCasterGUID = new bool[bits4];
            var hasDuration = new bool[bits4];
            var hasMaxDuration = new bool[bits4];
            var effectCount = new uint[bits4];
            var casterGUID = new byte[bits4][];
            for (var i = 0; i < bits4; ++i)
            {
                hasAura[i] = packet.ReadBit();
                if (hasAura[i])
                {
                    hasMaxDuration[i] = packet.ReadBit();
                    effectCount[i] = packet.ReadBits(22);
                    hasCasterGUID[i] = packet.ReadBit();
                    if (hasCasterGUID[i])
                    {
                        casterGUID[i] = new byte[8];
                        packet.StartBitStream(casterGUID[i], 5, 7, 4, 1, 6, 0, 3, 2);
                    }
                    hasDuration[i] = packet.ReadBit();
                }
            }
            packet.StartBitStream(guid, 2, 3, 7, 4);
            packet.ReadBit("Is AURA_UPDATE_ALL");
            packet.StartBitStream(guid, 0, 5);
            packet.ResetBitReader();

            var auras = new List<Aura>();
            for (var i = 0; i < bits4; ++i)
            {
                if (hasAura[i])
                {
                    var aura = new Aura();
                    if (hasCasterGUID[i])
                    {
                        packet.ParseBitStream(casterGUID[i], 2, 7, 6, 1, 4, 0, 5, 3);
                        packet.WriteGuid("Caster GUID", casterGUID[i], i);
                        aura.CasterGuid = new Guid(BitConverter.ToUInt64(casterGUID[i], 0));
                    }
                    else
                        aura.CasterGuid = new Guid();

                    aura.Charges = packet.ReadByte("Charges", i);

                    if (hasDuration[i])
                        aura.Duration = packet.ReadInt32("Duration", i);
                    else
                        aura.Duration = 0;

                    aura.SpellId = packet.ReadUInt32("Spell Id", i);
                    aura.AuraFlags = packet.ReadEnum<AuraFlagMoP>("Flags", TypeCode.Byte, i);

                    for (var j = 0; j < effectCount[i]; ++j)
                        packet.ReadSingle("Effect Value", i, j);
                    packet.ReadInt32("Effect Mask", i);

                    if (hasMaxDuration[i])
                        aura.MaxDuration = packet.ReadInt32("Max Duration", i);
                    else
                        aura.MaxDuration = 0;

                    aura.Level = packet.ReadUInt16("Caster Level", i);
                    auras.Add(aura);
                    packet.AddSniffData(StoreNameType.Spell, (int)aura.SpellId, "AURA_UPDATE");
                }
                packet.ReadByte("Slot", i);
            }

            if (hasPowerData)
            {
                packet.ReadXORBytes(guid2, 7, 0);
                for (var i = 0; i < bits3C; ++i)
                {
                    packet.ReadEnum<PowerType>("Power Type", TypeCode.UInt32, i);
                    packet.ReadInt32("Power Value", i);
                }
                packet.ReadXORBytes(guid2, 2, 5);
                packet.ReadInt32("Attack power");
                packet.ReadInt32("Spell power");
                packet.ReadXORBytes(guid2, 6, 4, 3, 1);
                packet.ReadInt32("Current Health");
//.........这里部分代码省略.........
开发者ID:usernel,项目名称:WowPacketParser,代码行数:101,代码来源:SpellHandler.cs

示例11: HandleVendorInventoryList422

        public static void HandleVendorInventoryList422(Packet packet)
        {
            var npcVendor = new NpcVendor();

            var guidBytes = new byte[8];

            guidBytes[5] = (byte)(packet.ReadBit() ? 1 : 0);
            guidBytes[6] = (byte)(packet.ReadBit() ? 1 : 0);
            guidBytes[1] = (byte)(packet.ReadBit() ? 1 : 0);
            guidBytes[2] = (byte)(packet.ReadBit() ? 1 : 0);
            guidBytes[3] = (byte)(packet.ReadBit() ? 1 : 0);
            guidBytes[0] = (byte)(packet.ReadBit() ? 1 : 0);
            guidBytes[7] = (byte)(packet.ReadBit() ? 1 : 0);
            guidBytes[4] = (byte)(packet.ReadBit() ? 1 : 0);

            if (guidBytes[2] != 0) guidBytes[2] ^= packet.ReadByte();
            if (guidBytes[3] != 0) guidBytes[3] ^= packet.ReadByte();

            var itemCount = packet.ReadUInt32("Item Count");

            if (guidBytes[5] != 0) guidBytes[5] ^= packet.ReadByte();
            if (guidBytes[0] != 0) guidBytes[0] ^= packet.ReadByte();
            if (guidBytes[1] != 0) guidBytes[1] ^= packet.ReadByte();

            packet.ReadByte("Unk Byte");

            if (guidBytes[4] != 0) guidBytes[4] ^= packet.ReadByte();
            if (guidBytes[7] != 0) guidBytes[7] ^= packet.ReadByte();
            if (guidBytes[6] != 0) guidBytes[6] ^= packet.ReadByte();

            var guid = new Guid(BitConverter.ToUInt64(guidBytes, 0));
            packet.WriteLine("GUID: {0}", guid);

            npcVendor.VendorItems = new List<VendorItem>((int)itemCount);
            for (var i = 0; i < itemCount; i++)
            {
                var vendorItem = new VendorItem();

                packet.ReadInt32("Max Durability", i);
                vendorItem.Slot = packet.ReadUInt32("Item Position", i);
                vendorItem.ItemId = (uint)packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Item ID", i);
                packet.ReadInt32("Unk Int32 1", i);
                packet.ReadInt32("Display ID", i);
                vendorItem.MaxCount = packet.ReadInt32("Max Count", i);
                packet.ReadUInt32("Buy Count", i);
                vendorItem.ExtendedCostId = packet.ReadUInt32("Extended Cost", i);
                packet.ReadInt32("Unk Int32 2", i);
                packet.ReadInt32("Price", i);

                npcVendor.VendorItems.Add(vendorItem);
            }

            Storage.NpcVendors.TryAdd(guid.GetEntry(), npcVendor);
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:54,代码来源:NpcHandler.cs

示例12: ReadCreateObjectBlock

        private static void ReadCreateObjectBlock(ref Packet packet, Guid guid, uint map, int index)
        {
            var objType = packet.ReadEnum<ObjectType>("Object Type", TypeCode.Byte, index);
            var moves = ReadMovementUpdateBlock(ref packet, guid, index);
            var updates = ReadValuesUpdateBlock(ref packet, objType, index);

            WoWObject obj;
            switch (objType)
            {
                case ObjectType.Unit:       obj = new Unit(); break;
                case ObjectType.GameObject: obj = new GameObject(); break;
                case ObjectType.Item:       obj = new Item(); break;
                case ObjectType.Player:     obj = new Player(); break;
                default:                    obj = new WoWObject(); break;
            }

            obj.Type = objType;
            obj.Movement = moves;
            obj.UpdateFields = updates;
            obj.Map = map;
            obj.Area = WorldStateHandler.CurrentAreaId;
            obj.PhaseMask = (uint) MovementHandler.CurrentPhaseMask;

            Storage.Objects.TryAdd(guid, obj);

            if (guid.HasEntry() && (objType == ObjectType.Unit || objType == ObjectType.GameObject))
                packet.AddSniffData(Utilities.ObjectTypeToStore(objType), (int)guid.GetEntry(), "SPAWN");
        }
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:28,代码来源:UpdateHandler.cs

示例13: ReadMovementUpdateBlock433

        private static MovementInfo ReadMovementUpdateBlock433(ref Packet packet, Guid guid, int index)
        {
            var moveInfo = new MovementInfo();

            bool living = packet.ReadBit("Living", index);
            bool hasAttackingTarget = packet.ReadBit("Has Attacking Target", index);
            bool hasVehicleData = packet.ReadBit("Has Vehicle Data", index);
            uint unkLoopCounter = packet.ReadBits(24);
            bool hasStationaryPosition = packet.ReadBit("Has Stationary Position", index);
            /*bool bit1 =*/ packet.ReadBit();
            /*bool bit4 =*/ packet.ReadBit();
            bool unkInt = packet.ReadBit();
            bool unkFloats = packet.ReadBit();
            /*bool bit2 =*/ packet.ReadBit();
            /*bool bit0 =*/ packet.ReadBit();
            /*bool bit3 =*/ packet.ReadBit();
            bool hasGameObjectPosition = packet.ReadBit("Has GameObject position", index);
            bool hasAnimKits = packet.ReadBit("Has AnimKits", index);
            bool hasGORotation = packet.ReadBit("Has GameObject Rotation", index);
            bool unkFloat1 = false;
            bool hasFallData = false;
            bool unkFloat2 = false;
            bool bit216 = false;
            bool bit256 = false;
            bool hasSplineDurationMult = false;
            SplineType splineType = SplineType.Normal;
            var facingTarget = new byte[8];
            uint splineCount = 0u;
            bool hasTransportData = false;
            var transportGuid = new byte[8];
            bool hasTransportTime2 = false;
            bool hasTransportTime3 = false;
            bool hasFallDirection = false;
            bool hasUnkUInt = false;
            bool hasOrientation = false;
            var attackingTarget = new byte[8];
            var goTransportGuid = new byte[8];
            bool hasGOTransportTime2 = false;
            bool hasGOTransportTime3 = false;
            bool hasAnimKit1 = false;
            bool hasAnimKit2 = false;
            bool hasAnimKit3 = false;
            var guid2 = new byte[8];

            // Reading bits
            if (living)
            {
                guid2[4] = (byte)(packet.ReadBit() ? 1 : 0);
                /*bool bit149 =*/ packet.ReadBit();
                guid2[5] = (byte)(packet.ReadBit() ? 1 : 0);
                unkFloat1 = !packet.ReadBit();
                hasFallData = packet.ReadBit("Has Fall Data", index);
                unkFloat2 = !packet.ReadBit();
                guid2[6] = (byte)(packet.ReadBit() ? 1 : 0);
                moveInfo.HasSplineData = packet.ReadBit("Has Spline Data", index);
                if (moveInfo.HasSplineData)
                {
                    bit216 = packet.ReadBit();
                    if (bit216)
                    {
                        bit256 = packet.ReadBit();
                        /*splineMode =*/ packet.ReadBits(2);
                        hasSplineDurationMult = packet.ReadBit();
                        uint bits57 = packet.ReadBits(2);
                        switch (bits57)
                        {
                            case 0:
                                splineType = SplineType.FacingSpot;
                                break;
                            case 1:
                                splineType = SplineType.Normal;
                                break;
                            case 2:
                                splineType = SplineType.FacingTarget;
                                break;
                            case 3:
                                splineType = SplineType.FacingAngle;
                                break;
                        }

                        if (splineType == SplineType.FacingTarget)
                        {
                            facingTarget[0] = (byte)(packet.ReadBit() ? 1 : 0);
                            facingTarget[2] = (byte)(packet.ReadBit() ? 1 : 0);
                            facingTarget[7] = (byte)(packet.ReadBit() ? 1 : 0);
                            facingTarget[1] = (byte)(packet.ReadBit() ? 1 : 0);
                            facingTarget[6] = (byte)(packet.ReadBit() ? 1 : 0);
                            facingTarget[3] = (byte)(packet.ReadBit() ? 1 : 0);
                            facingTarget[4] = (byte)(packet.ReadBit() ? 1 : 0);
                            facingTarget[5] = (byte)(packet.ReadBit() ? 1 : 0);
                        }

                        /*splineFlags =*/ packet.ReadEnum<SplineFlag422>("Spline flags", 25, index);
                        splineCount = packet.ReadBits(22);
                    }
                }

                hasTransportData = packet.ReadBit("Has transport data", index);
                guid2[1] = (byte)(packet.ReadBit() ? 1 : 0);
                /*bit148 =*/ packet.ReadBit();
//.........这里部分代码省略.........
开发者ID:Machiavell1,项目名称:WowPacketParser,代码行数:101,代码来源:UpdateHandler.cs

示例14: HandleCharEnum434

        public static void HandleCharEnum434(Packet packet)
        {
            //var unkCounter = packet.ReadBits("Unk Counter", 23);
            var unkCounter = packet.ReadByte();
            packet.ReadByte();
            packet.ReadByte();

            var count = packet.ReadBits("Char count", 17);

            var charGuids = new byte[count][];
            var guildGuids = new byte[count][];
            var firstLogins = new bool[count];
            var nameLenghts = new uint[count];

            for (var c = 0; c < count; ++c)
            {
                charGuids[c] = new byte[8];
                guildGuids[c] = new byte[8];
                /*
                guildGuids[c][2] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][2] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][6] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][5] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][4] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][4] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][3] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][7] = (byte)(packet.ReadBit() ? 1 : 0);
                nameLenghts[c] = packet.ReadBits(7);
                guildGuids[c][0] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][0] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][3] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][1] = (byte)(packet.ReadBit() ? 1 : 0);
                firstLogins[c] = packet.ReadBit();
                guildGuids[c][5] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][7] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][6] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][1] = (byte)(packet.ReadBit() ? 1 : 0);*/

                charGuids[c][7] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][4] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][3] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][7] = (byte)(packet.ReadBit() ? 1 : 0);
                nameLenghts[c] = packet.ReadBits(7);

                charGuids[c][4] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][3] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][5] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][5] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][5] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][1] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][5] = (byte)(packet.ReadBit() ? 1 : 0);
                guildGuids[c][5] = (byte)(packet.ReadBit() ? 1 : 0);

                firstLogins[c] = packet.ReadBit();
                charGuids[c][0] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][2] = (byte)(packet.ReadBit() ? 1 : 0);
                charGuids[c][6] = (byte)(packet.ReadBit() ? 1 : 0);

                guildGuids[c][7] = (byte)(packet.ReadBit() ? 1 : 0);
                packet.ReadBit();
                packet.ReadBit();
                packet.ReadBit();
                packet.ReadBit();
                packet.ReadBit();
                packet.ReadBit();
                packet.ReadBit();

            }

              //packet.ReadBit(); // no idea, not used in client

            if (count > 0)
            {

                for (int c = 0; c < count; ++c)
                {
                    var clss = packet.ReadEnum<Class>("Class", TypeCode.Byte, c);

                    for (var itm = 0; itm < 19; ++itm)
                    {
                        packet.ReadEnum<InventoryType>("Item InventoryType", TypeCode.Byte, c, itm);
                        packet.ReadInt32("Item DisplayID", c, itm);
                        packet.ReadInt32("Item EnchantID", c, itm);
                    }

                    for (var itm = 0; itm < 4; ++itm)
                    {
                        packet.ReadEnum<InventoryType>("Bag InventoryType", TypeCode.Byte, c, itm);
                        packet.ReadInt32("Bag DisplayID", c, itm);
                        packet.ReadInt32("Bag EnchantID", c, itm);
                    }

                    packet.ReadInt32("Pet Family", c);
                    packet.ReadByte("List Order", c);
                    packet.ReadByte("Hair Style", c);
                    packet.ReadInt32("Pet Display ID", c);
                    packet.ReadEnum<CharacterFlag>("CharacterFlag", TypeCode.Int32, c);
                    packet.ReadByte("Hair Color", c);
                    var mapId = packet.ReadInt32("Map", c);
                    var z = packet.ReadSingle("Position Z", c);
//.........这里部分代码省略.........
开发者ID:skypeak,项目名称:WowPacketParser_SkyFire,代码行数:101,代码来源:CharacterHandler.cs

示例15: HandleCharEnum422


//.........这里部分代码省略.........

                if (bits[c, 10])
                    guild[4] = (byte)(packet.ReadByte() ^ 1);

                if (bits[c, 15])
                    guild[0] = (byte)(packet.ReadByte() ^ 1);

                var pos = packet.ReadVector3("Position", c);

                if (bits[c, 11])
                    low[0] = (byte)(packet.ReadByte() ^ 1);

                var zone = packet.ReadEntryWithName<Int32>(StoreNameType.Zone, "Zone Id", c);
                packet.ReadInt32("Pet Level", c);

                if (bits[c, 8])
                    low[3] = (byte)(packet.ReadByte() ^ 1);

                if (bits[c, 14])
                    low[7] = (byte)(packet.ReadByte() ^ 1);

                packet.ReadByte("Facial Hair", c);
                packet.ReadByte("Skin", c);
                var clss = packet.ReadEnum<Class>("Class", TypeCode.Byte, c);
                packet.ReadInt32("Pet Family", c);
                packet.ReadEnum<CharacterFlag>("CharacterFlag", TypeCode.Int32, c);

                if (bits[c, 9])
                    low[2] = (byte)(packet.ReadByte() ^ 1);

                packet.ReadInt32("Pet Display ID", c);

                if (bits[c, 3])
                    guild[7] = (byte)(packet.ReadByte() ^ 1);

                var level = packet.ReadByte("Level", c);

                if (bits[c, 7])
                    low[6] = (byte)(packet.ReadByte() ^ 1);

                packet.ReadByte("Hair Style", c);

                if (bits[c, 13])
                    guild[2] = (byte)(packet.ReadByte() ^ 1);

                var race = packet.ReadEnum<Race>("Race", TypeCode.Byte, c);
                packet.ReadByte("Hair Color", c);

                if (bits[c, 5])
                    guild[6] = (byte)(packet.ReadByte() ^ 1);

                packet.ReadEnum<Gender>("Gender", TypeCode.Byte, c);

                if (bits[c, 6])
                    low[5] = (byte)(packet.ReadByte() ^ 1);

                if (bits[c, 2])
                    guild[3] = (byte)(packet.ReadByte() ^ 1);

                packet.ReadByte("List Order", c);

                for (int itm = 0; itm < 19; itm++)
                {
                    packet.ReadInt32("Item EnchantID", c, itm);
                    packet.ReadEnum<InventoryType>("Item InventoryType", TypeCode.Byte, c, itm);
                    packet.ReadInt32("Item DisplayID", c, itm);
                }

                for (int itm = 0; itm < 4; itm++)
                {
                    packet.ReadInt32("Bag EnchantID", c, itm);
                    packet.ReadEnum<InventoryType>("Bag InventoryType", TypeCode.Byte, c, itm);
                    packet.ReadInt32("Bag DisplayID", c, itm);
                }

                packet.ReadEnum<CustomizationFlag>("CustomizationFlag", TypeCode.UInt32, c);

                if (bits[c, 4])
                    guild[1] = (byte)(packet.ReadByte() ^ 1);

                var playerGuid = new Guid(BitConverter.ToUInt64(low, 0));

                packet.WriteLine("[{0}] Character GUID: {1}", c, playerGuid);
                packet.WriteLine("[{0}] Guild GUID: {1}", c, new Guid(BitConverter.ToUInt64(guild, 0)));

                var firstLogin = bits[c, 16];
                if (firstLogin)
                {
                    var startPos = new StartPosition {Map = mapId, Position = pos, Zone = zone};

                    Storage.StartPositions.Add(new Tuple<Race, Class>(race, clss), startPos, packet.TimeSpan);
                }

                var playerInfo = new Player { Race = race, Class = clss, Name = name, FirstLogin = firstLogin, Level = level };
                if (Storage.Objects.ContainsKey(playerGuid))
                    Storage.Objects[playerGuid] = new Tuple<WoWObject, TimeSpan?>(playerInfo, packet.TimeSpan);
                else
                    Storage.Objects.Add(playerGuid, playerInfo, packet.TimeSpan);
            }
        }
开发者ID:skypeak,项目名称:WowPacketParser_SkyFire,代码行数:101,代码来源:CharacterHandler.cs


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