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


C# WowGuid.GetObjectType方法代码示例

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


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

示例1: CheckFilter

        public static bool CheckFilter(WowGuid guid)
        {
            var result = true;

            if (guid.HasEntry())
                result = CheckFilter(Utilities.ObjectTypeToStore(guid.GetObjectType()), (int)guid.GetEntry());

            return result;
        }
开发者ID:cyberbrest,项目名称:WowPacketParser,代码行数:9,代码来源:Filters.cs

示例2: HandleSpellClick

        public static void HandleSpellClick(Packet packet)
        {
            var guidBytes = new byte[8];
            packet.StartBitStream(guidBytes, 7, 4, 0, 3, 6, 5);
            packet.ReadBit("unk");
            packet.StartBitStream(guidBytes, 1, 2);
            packet.ParseBitStream(guidBytes, 6, 1, 5, 4, 7, 2, 3, 0);

            packet.WriteGuid("Guid", guidBytes);

            var guid = new WowGuid(BitConverter.ToUInt64(guidBytes, 0));
            if (guid.GetObjectType() == ObjectType.Unit)
                Storage.NpcSpellClicks.Add(guid, packet.TimeSpan);
        }
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:14,代码来源:MiscellaneousHandler.cs

示例3: HandleNpcGossip

        public static void HandleNpcGossip(Packet packet)
        {
            var gossip = new Gossip();

            var guidBytes = new byte[8];

            guidBytes[7] = packet.ReadBit();
            guidBytes[6] = packet.ReadBit();
            guidBytes[1] = packet.ReadBit();

            var questgossips = packet.ReadBits(19);

            guidBytes[0] = packet.ReadBit();
            guidBytes[4] = packet.ReadBit();
            guidBytes[5] = packet.ReadBit();
            guidBytes[2] = packet.ReadBit();
            guidBytes[3] = packet.ReadBit();

            var amountOfOptions = packet.ReadBits(20);

            var boxTextLen = new uint[amountOfOptions];
            var optionTextLen = new uint[amountOfOptions];
            for (var i = 0; i < amountOfOptions; ++i)
            {
                boxTextLen[i] = packet.ReadBits(12);
                optionTextLen[i] = packet.ReadBits(12);
            }

            var titleLen = new uint[questgossips];
            for (var i = 0; i < questgossips; ++i)
            {
                packet.ReadBit("Change Icon", i);
                titleLen[i] = packet.ReadBits(9);
            }

            for (var i = 0; i < questgossips; ++i)
            {
                packet.ReadEnum<QuestFlags2>("Flags 2", TypeCode.UInt32, i);
                packet.ReadEntry<UInt32>(StoreNameType.Quest, "Quest ID", i);
                packet.ReadInt32("Level", i);
                packet.ReadUInt32("Icon", i);
                packet.ReadEnum<QuestFlags>("Flags", TypeCode.UInt32, i);
                packet.ReadWoWString("Title", titleLen[i], i);
            }

            packet.ReadXORByte(guidBytes, 6);

            gossip.GossipOptions = new List<GossipOption>((int)amountOfOptions);
            for (var i = 0; i < amountOfOptions; ++i)
            {
                var gossipOption = new GossipOption
                {
                    RequiredMoney = packet.ReadUInt32("Required money", i),
                    OptionText = packet.ReadWoWString("Text", optionTextLen[i], i),
                    Index = packet.ReadUInt32("Index", i),
                    OptionIcon = packet.ReadEnum<GossipOptionIcon>("Icon", TypeCode.Byte, i),
                    BoxText = packet.ReadWoWString("Box Text", boxTextLen[i], i),
                    Box = packet.ReadBoolean("Box", i),
                };

                gossip.GossipOptions.Add(gossipOption);
            }

            packet.ReadXORByte(guidBytes, 2);

            var textId = packet.ReadUInt32("Text Id");

            packet.ReadXORByte(guidBytes, 1);
            packet.ReadXORByte(guidBytes, 5);

            var menuId = packet.ReadUInt32("Menu Id");
            packet.ReadUInt32("Friendship Faction");

            packet.ReadXORByte(guidBytes, 4);
            packet.ReadXORByte(guidBytes, 7);
            packet.ReadXORByte(guidBytes, 3);
            packet.ReadXORByte(guidBytes, 0);

            packet.WriteGuid("Guid", guidBytes);

            var guid = new WowGuid(BitConverter.ToUInt64(guidBytes, 0));
            gossip.ObjectType = guid.GetObjectType();
            gossip.ObjectEntry = guid.GetEntry();

            if (guid.GetObjectType() == ObjectType.Unit)
                if (Storage.Objects.ContainsKey(guid))
                    ((Unit)Storage.Objects[guid].Item1).GossipId = menuId;

            if (Storage.Gossips.ContainsKey(Tuple.Create(menuId, textId)))
            {
                var oldGossipOptions = Storage.Gossips[Tuple.Create(menuId, textId)];
                if (oldGossipOptions != null)
                {
                    foreach (var gossipOptions in gossip.GossipOptions)
                        oldGossipOptions.Item1.GossipOptions.Add(gossipOptions);
                }
            }
            else
                Storage.Gossips.Add(Tuple.Create(menuId, textId), gossip, packet.TimeSpan);

//.........这里部分代码省略.........
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:101,代码来源:NpcHandler.cs

示例4: HandleNpcGossip

        public static void HandleNpcGossip(Packet packet)
        {
            var gossip = new Gossip();

            var guid = new byte[8];

            uint[] titleLen;
            uint[] BoxTextLen;
            uint[] OptionTextLen;

            var questgossips = packet.ReadBits(19);

            titleLen = new uint[questgossips];
            for (var i = 0; i < questgossips; ++i)
            {
                packet.ReadBit("Change Icon", i);
                titleLen[i] = packet.ReadBits(9);
            }

            guid[5] = packet.ReadBit();
            guid[7] = packet.ReadBit();
            guid[4] = packet.ReadBit();
            guid[0] = packet.ReadBit();

            var AmountOfOptions = packet.ReadBits(20);

            guid[6] = packet.ReadBit();
            guid[2] = packet.ReadBit();

            BoxTextLen = new uint[AmountOfOptions];
            OptionTextLen = new uint[AmountOfOptions];
            for (var i = 0; i < AmountOfOptions; ++i)
            {
                BoxTextLen[i] = packet.ReadBits(12);
                OptionTextLen[i] = packet.ReadBits(12);
            }

            guid[3] = packet.ReadBit();
            guid[1] = packet.ReadBit();

            for (var i = 0; i < questgossips; ++i)
            {
                packet.ReadWoWString("Title", titleLen[i], i);
                packet.ReadEnum<QuestFlags>("Flags", TypeCode.UInt32, i);//528
                packet.ReadInt32("Level", i);//8
                packet.ReadUInt32("Icon", i);//4
                packet.ReadEntry<UInt32>(StoreNameType.Quest, "Quest ID", i); //528
                packet.ReadEnum<QuestFlags2>("Flags 2", TypeCode.UInt32, i);//532
            }

            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(guid, 0);

            gossip.GossipOptions = new List<GossipOption>((int)AmountOfOptions);
            for (var i = 0; i < AmountOfOptions; ++i)
            {
                var gossipOption = new GossipOption
                {
                    RequiredMoney = packet.ReadUInt32("Required money", i),//3012
                    BoxText = packet.ReadWoWString("Box Text", BoxTextLen[i], i),//12
                    Index = packet.ReadUInt32("Index", i),//0
                    Box = packet.ReadBoolean("Box", i),
                    OptionText = packet.ReadWoWString("Text", OptionTextLen[i], i),
                    OptionIcon = packet.ReadEnum<GossipOptionIcon>("Icon", TypeCode.Byte, i),//4
                };

                gossip.GossipOptions.Add(gossipOption);
            }

            packet.ReadXORByte(guid, 5);
            packet.ReadXORByte(guid, 3);
            var menuId = packet.ReadUInt32("Menu Id");
            packet.ReadXORByte(guid, 2);
            packet.ReadXORByte(guid, 6);
            packet.ReadXORByte(guid, 4);
            packet.ReadUInt32("Friendship Faction");
            packet.ReadXORByte(guid, 7);
            var textId = packet.ReadUInt32("Text Id");

            packet.WriteGuid("Guid", guid);

            var GUID = new Guid(BitConverter.ToUInt64(guid, 0));
            gossip.ObjectType = GUID.GetObjectType();
            gossip.ObjectEntry = GUID.GetEntry();

            if (GUID.GetObjectType() == ObjectType.Unit)
                if (Storage.Objects.ContainsKey(GUID))
                    ((Unit)Storage.Objects[GUID].Item1).GossipId = menuId;

            if (Storage.Gossips.ContainsKey(Tuple.Create(menuId, textId)))
            {
                var oldGossipOptions = Storage.Gossips[Tuple.Create(menuId, textId)];
                if (oldGossipOptions != null)
                {
                    foreach (var gossipOptions in gossip.GossipOptions)
                        oldGossipOptions.Item1.GossipOptions.Add(gossipOptions);
                }
            }
            else
                Storage.Gossips.Add(Tuple.Create(menuId, textId), gossip, packet.TimeSpan);
//.........这里部分代码省略.........
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:101,代码来源:NpcHandler.cs

示例5: TestGetObjectType

        public void TestGetObjectType()
        {
            var guid1 = new WowGuid(0xF130005C0500105F);
            var guid2 = new WowGuid(0x600000002B2D7C9);
            var guid3 = new WowGuid(0);

            Assert.AreEqual(ObjectType.Unit, guid1.GetObjectType());
            Assert.AreEqual(ObjectType.Player, guid2.GetObjectType());
            Assert.AreEqual(ObjectType.Object, guid3.GetObjectType());
        }
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:10,代码来源:GuidTest.cs

示例6: HandleMessageChat

        public static void HandleMessageChat(Packet packet)
        {
            var text = new CreatureText();
            uint entry = 0;

            //text.Language = packet.ReadEnum<Language>("Language", TypeCode.Int32);

            var hasSenderName = !packet.ReadBit("!hasSenderName");
            packet.ReadBit("unk5272");
            var SenderLen = 0u;
            if (hasSenderName)
                SenderLen = packet.ReadBits("SenderLen", 11);

            packet.ReadBit("!unk48*4");
            // unk52*4 = 0;
            var hasChannelName = !packet.ReadBit("!hasChannelName");
            packet.ReadBit("unk5273*4");
            var has1494 = !packet.ReadBit("!unk1494h"); // dword ptr [esi+1494h] = ("has unk1494h") ? 0 : ds:dword_D26EA8
            var chatTag = !packet.ReadBit("!chatTag"); // 5264*2
            var hasRealmID1 = !packet.ReadBit("!hasRealmID1"); // 56

            var guid4 = packet.StartBitStream(0, 1, 5, 4, 3, 2, 6, 7);

            if (chatTag)
                packet.ReadBits("chatTag", 9); // 5264*2

            packet.ReadBit("!unk40*4");
            // unk44*4 = 0
            var guid3 = packet.StartBitStream(7, 6, 1, 4, 0, 2, 3, 5);
            packet.ReadBit("!unk24*4");
            // unk28*4 = 0
            var hasLanguage = !packet.ReadBit("!hasLanguage"); // 17
            var hasPrefix = !packet.ReadBit("!hasPrefix");

            var guid = packet.StartBitStream(0, 3, 7, 2, 1, 5, 4, 6);

            var hasAchievementID = !packet.ReadBit("!hasAchievementID"); // 5260*4
            var hasMessage = !packet.ReadBit("!hasMessage"); // 2259

            var ChannelLen = 0u;
            if (hasChannelName)
                ChannelLen = packet.ReadBits("ChannelLen", 7); // 2134

            var MessageLen = 0u;
            if (hasMessage)
                MessageLen = packet.ReadBits("MessageLen", 12);

            var hasReceiverName = !packet.ReadBit("!hasReceiverName"); // 1089

            var PrefixLen = 0u;
            if (hasPrefix)
                PrefixLen = packet.ReadBits("PrefixLen", 5); // 2114*4

            var hasRealmID2 = !packet.ReadBit("!hasRealmID2"); // 60

            var ReceiverLen = 0u;
            if (hasReceiverName)
                ReceiverLen = packet.ReadBits("ReceiverLen", 11);

            packet.ReadBit("!unk32*4");
            // unk36 = 0

            var guid2 = packet.StartBitStream(2, 5, 7, 4, 0, 1, 3, 6);
            packet.ParseBitStream(guid2, 4, 5, 7, 3, 2, 6, 0, 1);
            packet.WriteGuid("Guid2", guid2);

            if (hasChannelName)
                packet.ReadWoWString("ChannelName", ChannelLen);

            if (hasPrefix)
                packet.ReadWoWString("Prefix", PrefixLen);

            if (has1494)
                packet.ReadSingle("unk1494");

            packet.ParseBitStream(guid, 4, 7, 1, 5, 0, 6, 2, 3);
            packet.WriteGuid("Sender", guid);

            var unitGuid = new Guid(BitConverter.ToUInt64(guid, 0));

            if (unitGuid.GetObjectType() == ObjectType.Unit)
                entry = unitGuid.GetEntry();

            text.Type = packet.ReadEnum<ChatMessageType>("Type", TypeCode.Byte);

            if (hasAchievementID)
                packet.ReadUInt32("AchievementID");

            packet.ParseBitStream(guid4, 1, 3, 4, 6, 0, 2, 5, 7);
            packet.WriteGuid("Guid4", guid4);

            packet.ParseBitStream(guid3, 2, 5, 3, 6, 7, 4, 1, 0);
            packet.WriteGuid("Target", guid3);

            if (hasLanguage)
                packet.ReadByte("Language");

            if (hasRealmID2)
                packet.ReadInt32("RealmID2"); // 60

//.........这里部分代码省略.........
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:101,代码来源:ChatHandler.cs

示例7: HandleNpcGossip

        public static void HandleNpcGossip(Packet packet)
        {
            var guid = new byte[8];
            uint[] QuestTitleLength;
            uint[] OptionsMessageLength;
            uint[] BoxMessageLength;

            guid[7] = packet.ReadBit();
            guid[6] = packet.ReadBit();
            guid[1] = packet.ReadBit();

            var QuestsCount = packet.ReadBits("Quests Count", 19);

            guid[0] = packet.ReadBit();
            guid[4] = packet.ReadBit();
            guid[5] = packet.ReadBit();
            guid[2] = packet.ReadBit();
            guid[3] = packet.ReadBit();

            var OptionsCount = packet.ReadBits("Gossip Options Count", 20);

            OptionsMessageLength = new uint[OptionsCount];
            BoxMessageLength = new uint[OptionsCount];
            for (var i = 0; i < OptionsCount; ++i)
            {
                BoxMessageLength[i] = packet.ReadBits(12);
                OptionsMessageLength[i] = packet.ReadBits(12);
            }

            QuestTitleLength = new uint[QuestsCount];
            for (var i = 0; i < QuestsCount; ++i)
            {
                packet.ReadBit("Quest Icon Change", i);
                QuestTitleLength[i] = packet.ReadBits(9);
            }

            for (var i = 0; i < QuestsCount; i++)
            {
                packet.ReadEnum<QuestFlags2>("Quest Special Flags", TypeCode.UInt32, i);
                packet.ReadEntry<UInt32>(StoreNameType.Quest, "Quest Id", i);
                packet.ReadUInt32("Quest Level", i);
                packet.ReadUInt32("Quest Icon", i);
                packet.ReadEnum<QuestFlags>("Quest Flags", TypeCode.UInt32, i);
                packet.ReadWoWString("Quest Titles", QuestTitleLength[i], i);
            }

            packet.ReadXORByte(guid, 6);

            var ObjectGossip = new Gossip();
            ObjectGossip.GossipOptions = new List<GossipOption>((int)OptionsCount);
            for (var i = 0; i < OptionsCount; ++i)
            {
                var gossipMenuOption = new GossipOption
                {
                    RequiredMoney = packet.ReadUInt32("Message Box Required Money", i),
                    OptionText = packet.ReadWoWString("Gossip Option Text", OptionsMessageLength[i], i),
                    Index = packet.ReadUInt32("Gossip Option Index", i),
                    OptionIcon = packet.ReadEnum<GossipOptionIcon>("Gossip Option Icon", TypeCode.Byte, i),
                    BoxText = packet.ReadWoWString("Message Box Text", BoxMessageLength[i], i),
                    Box = packet.ReadBoolean("Message Box Coded", i), // True if it has a password.
                };

                ObjectGossip.GossipOptions.Add(gossipMenuOption);
            }

            packet.ReadXORByte(guid, 2);

            var GossipMenuTextId = packet.ReadUInt32("Gossip Menu Text Id");

            packet.ReadXORByte(guid, 1);
            packet.ReadXORByte(guid, 5);

            var GossipMenuId = packet.ReadUInt32("Gossip Menu Id");
            packet.ReadUInt32("Friendly Faction Id");

            packet.ReadXORByte(guid, 4);
            packet.ReadXORByte(guid, 7);
            packet.ReadXORByte(guid, 3);
            packet.ReadXORByte(guid, 0);

            packet.WriteGuid("Object Guid", guid);

            var ObjectGuid = new Guid(BitConverter.ToUInt64(guid, 0));
            ObjectGossip.ObjectEntry = ObjectGuid.GetEntry();
            ObjectGossip.ObjectType = ObjectGuid.GetObjectType();

            if (ObjectGuid.GetObjectType() == ObjectType.Unit)
                if (Storage.Objects.ContainsKey(ObjectGuid))
                    ((Unit)Storage.Objects[ObjectGuid].Item1).GossipId = GossipMenuId;

            Storage.Gossips.Add(Tuple.Create(GossipMenuId, GossipMenuTextId), ObjectGossip, packet.TimeSpan);
            packet.AddSniffData(StoreNameType.Gossip, (int)GossipMenuId, ObjectGuid.GetEntry().ToString(CultureInfo.InvariantCulture));
        }
开发者ID:samaelsacred,项目名称:WowPacketParser,代码行数:93,代码来源:NpcHandler.cs


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