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


C# Packet.ReadUInt16方法代码示例

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


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

示例1: HandleInspectTalent

        public static void HandleInspectTalent(Packet packet)
        {
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6a_13623))
                packet.ReadGuid("GUID");
            else
                packet.ReadPackedGuid("GUID");

            if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_INSPECT_TALENT))
                ReadTalentInfo(ref packet);

            var slotMask = packet.ReadUInt32("Slot Mask");
            var slot = 0;
            while (slotMask > 0)
            {
                if ((slotMask & 0x1) > 0)
                {
                    var name = "[" + (EquipmentSlotType)slot + "] ";
                    packet.ReadEntryWithName<UInt32>(StoreNameType.Item, name + "Item Entry");
                    var enchantMask = packet.ReadUInt16();
                    if (enchantMask > 0)
                    {
                        var enchantName = name + "Item Enchantments: ";
                        while (enchantMask > 0)
                        {
                            if ((enchantMask & 0x1) > 0)
                            {
                                enchantName += packet.ReadUInt16();
                                if (enchantMask > 1)
                                        enchantName += ", ";
                            }
                            enchantMask >>= 1;
                        }
                        packet.WriteLine(enchantName);
                    }
                    packet.ReadUInt16(name + "Unk Uint16");
                    packet.ReadPackedGuid(name + "Creator GUID");
                    packet.ReadUInt32(name + "Unk Uint32");
                }
                ++slot;
                slotMask >>= 1;
            }

            if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_INSPECT_TALENT)
                && packet.CanRead()) // otherwise it would fail for players without a guild
            {
                packet.ReadGuid("Guild GUID");
                packet.ReadUInt32("Guild Level");
                packet.ReadUInt64("Guild Xp");
                packet.ReadUInt32("Guild Members");
            }
        }
开发者ID:Kinzcool,项目名称:WowPacketParser,代码行数:51,代码来源:TalentHandler.cs

示例2: HandleLearnTalents

        public static void HandleLearnTalents(Packet packet)
        {
            var talentCount = packet.ReadBits("Learned Talent Count", 25);

            for (int i = 0; i < talentCount; i++)
                packet.ReadUInt16("Talent Id", i);
        }
开发者ID:rodrigoalv,项目名称:WowPacketParser,代码行数:7,代码来源:TalentHandler.cs

示例3: HandleClientWardenData

        public static void HandleClientWardenData(Packet packet)
        {
            var opcode = packet.ReadEnum<WardenClientOpcode>("Warden Client Opcode", TypeCode.Byte);

            switch (opcode)
            {
                case WardenClientOpcode.CheatCheckResults:
                {
                    var length = packet.ReadUInt16("Check Result Length");

                    packet.ReadInt32("Check Result Checksum");

                    var result = packet.ReadBytes(length);
                    packet.WriteLine("Check Results: " + Utilities.ByteArrayToHexString(result));

                    break;
                }
                case WardenClientOpcode.TransformedSeed:
                {
                    var sha1 = packet.ReadBytes(20);
                    packet.WriteLine("SHA1 Seed: " + Utilities.ByteArrayToHexString(sha1));
                    break;
                }
            }
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:25,代码来源:WardenHandler.cs

示例4: HandleUpdateObject

        public static void HandleUpdateObject(Packet packet)
        {
            uint map = MovementHandler.CurrentMapId;
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
                map = packet.ReadUInt16("Map");

            var count = packet.ReadUInt32("Count");

            if (ClientVersion.RemovedInVersion(ClientVersionBuild.V3_0_2_9056))
                packet.ReadBoolean("Has Transport");

            for (var i = 0; i < count; i++)
            {
                var type = packet.ReadByte();
                var typeString = ClientVersion.AddedInVersion(ClientType.Cataclysm) ? ((UpdateTypeCataclysm)type).ToString() : ((UpdateType)type).ToString();

                packet.WriteLine("[" + i + "] UpdateType: " + typeString);
                switch (typeString)
                {
                    case "Values":
                    {
                        var guid = packet.ReadPackedGuid("GUID", i);

                        WoWObject obj;
                        var updates = ReadValuesUpdateBlock(ref packet, guid.GetObjectType(), i, false);

                        if (Storage.Objects.TryGetValue(guid, out obj))
                        {
                            if (obj.ChangedUpdateFieldsList == null)
                                obj.ChangedUpdateFieldsList = new List<Dictionary<int, UpdateField>>();
                            obj.ChangedUpdateFieldsList.Add(updates);
                        }

                        break;
                    }
                    case "Movement":
                    {
                        var guid = ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_2_9901) ? packet.ReadPackedGuid("GUID", i) : packet.ReadGuid("GUID", i);
                        ReadMovementUpdateBlock(ref packet, guid, i);
                        // Should we update Storage.Object?
                        break;
                    }
                    case "CreateObject1":
                    case "CreateObject2": // Might != CreateObject1 on Cata
                    {
                        var guid = packet.ReadPackedGuid("GUID", i);
                        ReadCreateObjectBlock(ref packet, guid, map, i);
                        break;
                    }
                    case "FarObjects":
                    case "NearObjects":
                    case "DestroyObjects":
                    {
                        ReadObjectsBlock(ref packet, i);
                        break;
                    }
                }
            }
        }
开发者ID:Huri,项目名称:WowPacketParser,代码行数:59,代码来源:UpdateHandler.cs

示例5: HandlePetAction

 public static void HandlePetAction(Packet packet)
 {
     packet.ReadGuid("GUID");
     var action = (uint)packet.ReadUInt16() + (packet.ReadByte() << 16);
     packet.Writer.WriteLine("Action: {0}", action);
     packet.ReadEnum<ActionButtonType>("Type", TypeCode.Byte);
     packet.ReadGuid("GUID");
 }
开发者ID:CarlosX,项目名称:WowPacketParser,代码行数:8,代码来源:PetHandler.cs

示例6: HandleMailListResult

 public static void HandleMailListResult(Packet packet)
 {
     packet.ReadUInt32("Total Mails");
     var count = packet.ReadByte("Shown Mails");
     for (var i = 0; i < count; ++i)
     {
         packet.ReadUInt16("Message Size", i);
         packet.ReadUInt32("Mail Id", i);
         var mailType = packet.ReadEnum<MailType>("Message Type", TypeCode.Byte, i);
         switch (mailType) // Read GUID if MailType.Normal, int32 (entry) if not
         {
             case MailType.Normal:
                 packet.ReadGuid("Player GUID", i);
                 break;
             case MailType.Creature:
                 packet.Writer.WriteLine("[" + i + "] Entry: " + StoreGetters.GetExistingDatabaseString(StoreNameType.Unit, packet.ReadInt32()));
                 break;
             case MailType.GameObject:
                 packet.Writer.WriteLine("[" + i + "] Entry: " + StoreGetters.GetExistingDatabaseString(StoreNameType.GameObject, packet.ReadInt32()));
                 break;
             case MailType.Item:
                 packet.Writer.WriteLine("[" + i + "] Entry: " + StoreGetters.GetExistingDatabaseString(StoreNameType.Item, packet.ReadInt32()));
                 break;
             default:
                 packet.ReadInt32("Entry", i);
                 break;
         }
         packet.ReadUInt32("COD", i);
         packet.ReadUInt32("Unk uint32", i);
         packet.ReadUInt32("Stationery", i);
         packet.ReadUInt32("Money", i);
         packet.ReadUInt32("Flags", i);
         packet.ReadSingle("Time?", i);
         packet.ReadUInt32("Template Id", i);
         packet.ReadCString("Subject", i);
         packet.ReadCString("Body", i);
         var items = packet.ReadByte("Item Count", i);
         for (var j = 0; j < items; ++j)
         {
             packet.ReadByte("Item Index", i, j);
             packet.ReadUInt32("Item GuidLow", i, j);
             packet.ReadEntryWithName<UInt32>(StoreNameType.Item, "Item Id", i, j);
             for (var k = 0; k < 7; ++k)
             {
                 packet.ReadUInt32("Item Enchantment Id", i, j, k);
                 packet.ReadUInt32("Item Enchantment Duration", i, j, k);
                 packet.ReadUInt32("Item Enchantment Charges", i, j, k);
             }
             packet.ReadInt32("Item Random Property Id", i, j);
             packet.ReadUInt32("Item Suffix Factor", i, j);
             packet.ReadUInt32("Item Count", i, j);
             packet.ReadUInt32("Item SpellCharges", i, j);
             packet.ReadUInt32("Item Max Durability", i, j);
             packet.ReadUInt32("Item Durability", i, j);
             packet.ReadByte("Unk byte", i, j);
         }
     }
 }
开发者ID:Supabad,项目名称:WowPacketParser,代码行数:58,代码来源:MailHandler.cs

示例7: HandlePetAction

 public static void HandlePetAction(Packet packet)
 {
     packet.ReadPackedGuid128("PetGUID");
     var action = (uint)packet.ReadUInt16() + (packet.ReadByte() << 16);
     packet.AddValue("Action", action);
     packet.ReadByte("Slot");
     packet.ReadPackedGuid128("TargetGUID");
     packet.ReadVector3("ActionPosition");
 }
开发者ID:rob3ns,项目名称:PacketSniffer,代码行数:9,代码来源:PetHandler.cs

示例8: HandleServerWardenData

        public static void HandleServerWardenData(Packet packet)
        {
            var opcode = packet.ReadEnum<WardenServerOpcode>("Warden Server Opcode", TypeCode.Byte);

            packet.SetPosition(0);

            switch (opcode)
            {
                case WardenServerOpcode.ModuleInfo:
                {
                    packet.ReadByte();
                    packet.ReadBytes("Module MD5", 16);
                    packet.ReadBytes("Module RC4", 16);
                    packet.ReadUInt32("Module Length");
                    break;
                }
                case WardenServerOpcode.ModuleChunk:
                {
                    packet.ReadByte();

                    var length = packet.ReadUInt16("Chunk Length");
                    packet.ReadBytes("Module Chunk", length);
                    break;
                }
                case WardenServerOpcode.CheatChecks:
                {
                    packet.ReadByte();

                    byte length;
                    while ((length = packet.ReadByte()) != 0)
                    {
                        packet.ReadBytes("String", length);
                    }

                    // var rest = (int)(packet.GetLength() - packet.GetPosition());
                    break;
                }
                case WardenServerOpcode.Data:
                {
                    while (packet.CanRead())
                    {
                        packet.ReadByte();

                        var length = packet.ReadUInt16("Data Length");
                        packet.ReadInt32("Data Checksum");
                        packet.ReadBytes("Data", length);
                    }
                    break;
                }
                case WardenServerOpcode.Seed:
                {
                    packet.ReadByte();
                    packet.ReadBytes("Seed", 16);
                    break;
                }
            }
        }
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:57,代码来源:WardenHandler.cs

示例9: HandlePetAction

 public static void HandlePetAction(Packet packet)
 {
     packet.ReadGuid("GUID");
     var action = (uint)packet.ReadUInt16() + (packet.ReadByte() << 16);
     packet.AddValue("Action", action);
     packet.ReadByteE<ActionButtonType>("Type");
     packet.ReadGuid("GUID");
     if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6_13596))
         packet.ReadVector3("Position");
 }
开发者ID:Oboltys,项目名称:WowPacketParser,代码行数:10,代码来源:PetHandler.cs

示例10: HandlePetAction

 public static void HandlePetAction(Packet packet)
 {
     packet.ReadGuid("GUID");
     var action = (uint)packet.ReadUInt16() + (packet.ReadByte() << 16);
     packet.WriteLine("Action: {0}", action);
     packet.ReadEnum<ActionButtonType>("Type", TypeCode.Byte);
     packet.ReadGuid("GUID");
     if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
         packet.ReadVector3("Position");
 }
开发者ID:Chaplain,项目名称:WowPacketParser,代码行数:10,代码来源:PetHandler.cs

示例11: HandleInspectTalent

        public static void HandleInspectTalent(Packet packet)
        {
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545))
                packet.ReadGuid("GUID");
            else
                packet.ReadPackedGuid("GUID");

            if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_INSPECT_TALENT))
                ReadTalentInfo(ref packet);

            var slotMask = packet.ReadUInt32("Slot Mask");
            var slot = 0;
            while (slotMask > 0)
            {
                if ((slotMask & 0x1) > 0)
                {
                    var name = "[" + (EquipmentSlotType)slot + "] ";
                    packet.ReadEntryWithName<UInt32>(StoreNameType.Item, name + "Item Entry");
                    var enchantMask = packet.ReadUInt16();
                    if (enchantMask > 0)
                    {
                        var enchantName = name + "Item Enchantments: ";
                        while (enchantMask > 0)
                        {
                            if ((enchantMask & 0x1) > 0)
                            {
                                enchantName += packet.ReadUInt16();
                                if (enchantMask > 1)
                                        enchantName += ", ";
                            }
                            enchantMask >>= 1;
                        }
                        packet.WriteLine(enchantName);
                    }
                    packet.ReadUInt16(name + "Unk Uint16");
                    packet.ReadPackedGuid(name + "Creator GUID");
                    packet.ReadUInt32(name + "Unk Uint32");
                }
                ++slot;
                slotMask >>= 1;
            }
        }
开发者ID:skypeak,项目名称:WowPacketParser_SkyFire,代码行数:42,代码来源:TalentHandler.cs

示例12: ReadPetFlags

        public static void ReadPetFlags(Packet packet, params object[] idx)
        {
            var petModeFlag = packet.ReadUInt16();
            var reactState = packet.ReadByte();
            var flag = petModeFlag >> 16;
            var commandState = (petModeFlag & flag);

            packet.AddValue("ReactState", (ReactState)reactState, idx);
            packet.AddValue("CommandState", (CommandState)commandState, idx);
            packet.AddValue("Flag", flag, idx);
        }
开发者ID:jackpoz,项目名称:WowPacketParser,代码行数:11,代码来源:PetHandler.cs

示例13: ReadTalentInfo

        public static void ReadTalentInfo(Packet packet)
        {
            packet.ReadByte("Active Spec Group");
            var specCount = packet.ReadBits("Spec Group count", 19);
            var wpos = new UInt32[specCount];
            for (var i = 0; i < specCount; ++i)
            {
                wpos[i] = packet.ReadBits("TalentCount", 23, i);
            }

            for (var i = 0; i < specCount; ++i)
            {
                for (var j = 0; j < wpos[i]; ++j)
                    packet.ReadUInt16("TalentID", i, j);

                packet.ReadUInt32("Spec Id", i);

                //var spentTalents = packet.ReadByte("Spec Talent Count", i);
                //var glyphCount = packet.ReadByte("Glyph count", i);
                for (var j = 0; j < 6; ++j)
                    packet.ReadUInt16("Glyph", i, j);
            }
        }
开发者ID:Nihilianth,项目名称:WowPacketParser,代码行数:23,代码来源:TalentHandler.cs

示例14: HandleInspectTalent

        public static void HandleInspectTalent(Packet packet)
        {
            packet.ReadPackedGuid("GUID");
            ReadTalentInfo(ref packet);

            var slotMask = packet.ReadUInt32("Slot Mask");
            var slot = 0;
            while (slotMask > 0)
            {
                if ((slotMask & 0x1) > 0)
                {
                    var name = "[" + (EquipmentSlotType)slot + "] ";
                    packet.ReadEntryWithName<UInt32>(StoreNameType.Item, name + "Item Entry");
                    var enchantMask = packet.ReadUInt16();
                    if (enchantMask > 0)
                    {
                        var enchantName = name + "Item Enchantments: ";
                        while (enchantMask > 0)
                        {
                            if ((enchantMask & 0x1) > 0)
                            {
                                enchantName += packet.ReadUInt16();
                                if (enchantMask > 1)
                                        enchantName += ", ";
                            }
                            enchantMask >>= 1;
                        }
                        packet.Writer.WriteLine(enchantName);
                    }
                    packet.ReadUInt16(name + "Unk Uint16");
                    packet.ReadPackedGuid(name + "Creator GUID");
                    packet.ReadUInt32(name + "Unk Uint32");
                }
                ++slot;
                slotMask >>= 1;
            }
        }
开发者ID:CarlosX,项目名称:WowPacketParser,代码行数:37,代码来源:TalentHandler.cs

示例15: HandleUpdateObject

        public static void HandleUpdateObject(Packet packet)
        {
            uint map = packet.ReadUInt16("Map");
            var count = packet.ReadUInt32("Count");
            //var type = packet.ReadByte();
            //var typeString = ((UpdateType2)type).ToString();

            for (var i = 0; i < count; i++)
            {
                packet.WriteLine("StartPosFor: " + packet.Position);
                var type = packet.ReadByte();
                var typeString = ((UpdateTypeCataclysm)type).ToString();

                packet.ResetBitReader();

                packet.WriteLine("[" + i + "] UpdateType: " + typeString);
                switch (typeString)
                {
                    case "Values":
                    {
                        var guid = packet.ReadPackedGuid("GUID", i);

                        WoWObject obj;
                        var updates = CoreParsers.UpdateHandler.ReadValuesUpdateBlock(packet, guid.GetObjectType(), i, false);

                        if (Storage.Objects.TryGetValue(guid, out obj))
                        {
                            if (obj.ChangedUpdateFieldsList == null)
                                obj.ChangedUpdateFieldsList = new List<Dictionary<int, UpdateField>>();
                            obj.ChangedUpdateFieldsList.Add(updates);
                        }

                        break;
                    }
                    case "CreateObject1":
                    case "CreateObject2":
                    {
                        var guid = packet.ReadPackedGuid("GUID", i);
                        ReadCreateObjectBlock(ref packet, guid, map, i);
                        break;
                    }
                    case "DestroyObjects":
                    {
                        CoreParsers.UpdateHandler.ReadObjectsBlock(packet, i);
                        break;
                    }
                }
            }
        }
开发者ID:ChipLeo,项目名称:WowPacketParser,代码行数:49,代码来源:UpdateHandler.cs


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