コード例 #1
0
        public static void HandleQuestQueryResponse(Packet packet)
        {
            var hasData = packet.ReadBit();
            if (!hasData)
            {
                packet.ReadUInt32("Entry");
                return; // nothing to do
            }

            var quest = new QuestTemplate();

            var bits19E8 = (int)packet.ReadBits(9);
            var bits2604 = (int)packet.ReadBits(11);
            var bits278 = (int)packet.ReadBits(12);
            var bits2004 = packet.ReadBits(8);
            var bits2504 = packet.ReadBits(8);
            var bits1C04 = (int)packet.ReadBits(10);
            var bits78 = (int)packet.ReadBits(9);
            var bitsE30 = (int)packet.ReadBits(12);
            var bits2E10 = (int)packet.ReadBits(19);

            var len2949_20 = new uint[bits2E10];
            var bits114 = new uint[bits2E10];

               for (var i = 0; i < bits2E10; ++i)
               {
               len2949_20[i] = packet.ReadBits(8);
               bits114[i] = packet.ReadBits(22);
               }

               var bits2104 = (int)packet.ReadBits(10);

               packet.ReadInt32("Int2E34");
               packet.ReadInt32("Int2E44");
               packet.ReadInt32("Int2E9C");

               for (var i = 0; i < bits2E10; ++i)
               {
                packet.ReadInt32("Int2E14", i);
                packet.ReadWoWString("StringEA", len2949_20[i], i);
                packet.ReadByte("ByteED", i);
                packet.ReadInt32("IntEA", i);
                for (var j = 0; j < bits114[i]; ++j)
                    packet.ReadInt32("IntEC", i, j);

                packet.ReadByte("ByteED", i);
                packet.ReadInt32("IntED", i);
                packet.ReadInt32("IntED", i);
            }

            packet.ReadSingle("Float6C");
            packet.ReadInt32("Int3C");
            packet.ReadInt32("Int74");
            packet.ReadInt32("Int1BEC");
            packet.ReadInt32("Int2E5C");
            packet.ReadInt32("Int2E38");
            packet.ReadInt32("Int2E20");
            packet.ReadWoWString("String2104", bits2104);
            packet.ReadInt32("Int2C");
            packet.ReadInt32("Int2E80");
            packet.ReadWoWString("String2004", bits2004);
            packet.ReadInt32("Int2E8C");
            packet.ReadInt32("Int1BF8");
            packet.ReadSingle("Float58");
            packet.ReadInt32("Int2E60");

            for (var i = 0; i < 5; ++i)
            {
                packet.ReadInt32("int2986+40", i);
                packet.ReadInt32("int2986+0", i);
                packet.ReadInt32("int2986+20", i);
            }

            packet.ReadInt32("Int4C");
            packet.ReadInt32("Int2E84");
            packet.ReadInt32("Int2E48");
            packet.ReadInt32("Int1C00");
            packet.ReadInt32("Int2E30");
            packet.ReadInt32("Int2E40");
            packet.ReadInt32("Int2E94");
            packet.ReadWoWString("String2604", bits2604);
            packet.ReadInt32("Int2E0C");
            packet.ReadInt32("Int2E98");
            packet.ReadInt32("Int2E24");
            packet.ReadInt32("Int2E90");
            packet.ReadInt32("Int60");
            packet.ReadWoWString("String19E8", bits19E8);
            packet.ReadInt32("Int2E58");
            packet.ReadInt32("Int2E6C");
            packet.ReadInt32("Int2E64");
            packet.ReadInt32("Int5C");
            packet.ReadInt32("Int2E78");

            for (var i = 0; i < 4; ++i)
            {
                packet.ReadInt32("int3001+16", i);
                packet.ReadInt32("int3001+0", i);
            }

            packet.ReadInt32("Int18");
            packet.ReadInt32("Int2E7C");
            packet.ReadWoWString("String78", bits78);
            packet.ReadWoWString("StringE30", bitsE30);
            packet.ReadInt32("Int2E74");
            packet.ReadInt32("Int2E88");
            packet.ReadInt32("Int30");
            packet.ReadInt32("Int40");
            packet.ReadInt32("Int1BF4");
            packet.ReadInt32("Int2EA4");
            packet.ReadInt32("Int2E68");
            packet.ReadInt32("Int48");
            packet.ReadInt32("Int28");
            packet.ReadInt32("Int50");
            packet.ReadInt32("Int44");
            packet.ReadInt32("Int2EA0");
            packet.ReadInt32("Int2E54");
            packet.ReadInt32("Int2E04");
            packet.ReadInt32("Int64");
            packet.ReadInt32("Int68");
            packet.ReadInt32("Int2E28");
            packet.ReadInt32("Int2E50");
            packet.ReadInt32("Int2E4C");
            packet.ReadInt32("Int24");
            packet.ReadWoWString("String278", bits278);
            packet.ReadWoWString("String2504", bits2504);
            packet.ReadInt32("Int54");
            packet.ReadInt32("Int2E2C");
            packet.ReadSingle("Float70");
            packet.ReadInt32("Int1C");
            packet.ReadInt32("Int2E3C");
            packet.ReadInt32("Int38");
            packet.ReadInt32("Int1BE8");
            packet.ReadInt32("Int2E70");
            packet.ReadInt32("Int2E08");
            packet.ReadInt32("Int34");
            packet.ReadInt32("Int1BF0");
            packet.ReadInt32("Int1BFC");
            packet.ReadWoWString("String1C04", bits1C04);
            packet.ReadInt32("Int20");

            var id = packet.ReadInt32("Quest Id");

            //packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");
            //Storage.QuestTemplates.Add((uint)id.Key, quest, packet.TimeSpan);
        }
コード例 #2
0
        public static void HandleQuestQueryResponse(Packet packet)
        {
            var id = packet.ReadEntry("Quest ID");
            if (id.Value) // entry is masked
                return;

            var quest = new QuestTemplate
            {
                Method = packet.ReadEnum<QuestMethod>("Method", TypeCode.Int32),
                Level = packet.ReadInt32("Level")
            };

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.MinLevel = packet.ReadInt32("Min Level");

            quest.ZoneOrSort = packet.ReadEnum<QuestSort>("Sort", TypeCode.Int32);

            quest.Type = packet.ReadEnum<QuestType>("Type", TypeCode.Int32);

            quest.SuggestedPlayers = packet.ReadUInt32("Suggested Players");

            quest.RequiredFactionId = new uint[2];
            quest.RequiredFactionValue = new int[2];
            for (var i = 0; i < 2; i++)
            {
                quest.RequiredFactionId[i] = packet.ReadUInt32("Required Faction ID", i);
                quest.RequiredFactionValue[i] = packet.ReadInt32("Required Faction Rep", i);
            }

            quest.NextQuestIdChain = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Quest, "Next Chain Quest");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardXPId = packet.ReadUInt32("Quest XP ID");

            quest.RewardOrRequiredMoney = packet.ReadInt32("Reward/Required Money");

            quest.RewardMoneyMaxLevel = packet.ReadUInt32("Reward Money Max Level");

            quest.RewardSpell = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Reward Spell");

            quest.RewardSpellCast = packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Reward Spell Cast");

            quest.RewardHonor = packet.ReadInt32("Reward Honor");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardHonorMultiplier = packet.ReadSingle("Reward Honor Multiplier");

            quest.SourceItemId = (uint) packet.ReadEntryWithName<UInt32>(StoreNameType.Item, "Source Item ID");

            quest.Flags = packet.ReadEnum<QuestFlags>("Flags", TypeCode.UInt32);

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
                quest.MinimapTargetMark = packet.ReadUInt32("Minimap Target Mark"); // missing enum. 1- Skull, 16 - Unknown, but exists

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V2_4_0_8089))
                quest.RewardTitleId = packet.ReadUInt32("Reward Title ID");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056))
            {
                quest.RequiredPlayerKills = packet.ReadUInt32("Required Player Kills");
                quest.RewardTalents = packet.ReadUInt32("Bonus Talents");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardArenaPoints = packet.ReadUInt32("Bonus Arena Points");

            // TODO: Find when was this added/removed and what is it
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958) && (ClientVersion.RemovedInVersion(ClientVersionBuild.V4_0_1_13164)))
                packet.ReadInt32("Unknown Int32");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
            {
                quest.RewardSkillId = packet.ReadUInt32("RewSkillId");
                quest.RewardSkillPoints = packet.ReadUInt32("RewSkillPoints");
                quest.RewardReputationMask = packet.ReadUInt32("RewRepMask");
                quest.QuestGiverPortrait = packet.ReadUInt32("QuestGiverPortrait");
                quest.QuestTurnInPortrait = packet.ReadUInt32("QuestTurnInPortrait");
            }

            quest.RewardItemId = new uint[4];
            quest.RewardItemCount = new uint[4];
            for (var i = 0; i < 4; i++)
            {
                quest.RewardItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Reward Item ID", i);
                quest.RewardItemCount[i] = packet.ReadUInt32("Reward Item Count", i);
            }

            quest.RewardChoiceItemId = new uint[6];
            quest.RewardChoiceItemCount = new uint[6];
            for (var i = 0; i < 6; i++)
            {
                quest.RewardChoiceItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Reward Choice Item ID", i);
                quest.RewardChoiceItemCount[i] = packet.ReadUInt32("Reward Choice Item Count", i);
            }

            const int repCount = 5;
            quest.RewardFactionId = new uint[repCount];
            quest.RewardFactionValueId = new int[repCount];
            quest.RewardFactionValueIdOverride = new uint[repCount];
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
            {
                for (var i = 0; i < repCount; i++)
                    quest.RewardFactionId[i] = packet.ReadUInt32("Reward Faction ID", i);

                for (var i = 0; i < repCount; i++)
                    quest.RewardFactionValueId[i] = packet.ReadInt32("Reward Reputation ID", i);

                for (var i = 0; i < repCount; i++)
                    quest.RewardFactionValueIdOverride[i] = packet.ReadUInt32("Reward Reputation ID Override", i);
            }

            quest.PointMapId = packet.ReadUInt32("Point Map ID");

            quest.PointX = packet.ReadSingle("Point X");

            quest.PointY = packet.ReadSingle("Point Y");

            quest.PointOption = packet.ReadUInt32("Point Opt");

            quest.Title = packet.ReadCString("Title");

            quest.Objectives = packet.ReadCString("Objectives");

            quest.Details = packet.ReadCString("Details");

            quest.EndText = packet.ReadCString("End Text");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.CompletedText = packet.ReadCString("Completed Text");

            var reqId = new KeyValuePair<int, bool>[4];
            quest.RequiredNpcOrGo = new int[4];
            quest.RequiredNpcOrGoCount = new uint[4];
            quest.RequiredSourceItemId = new uint[4];
            quest.RequiredSourceItemCount = new uint[4];
            var reqItemFieldCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464) ? 6 : 4;
            quest.RequiredItemId = new uint[reqItemFieldCount];
            quest.RequiredItemCount = new uint[reqItemFieldCount];

            for (var i = 0; i < 4; i++)
            {
                reqId[i] = packet.ReadEntry();
                var isGo = reqId[i].Value;
                quest.RequiredNpcOrGo[i] = reqId[i].Key * (isGo ? -1 : 1);

                packet.WriteLine("[" + i + "] Required " + (isGo ? "GO" : "NPC") +
                    " ID: " + StoreGetters.GetName(isGo ? StoreNameType.GameObject : StoreNameType.Unit, reqId[i].Key));

                quest.RequiredNpcOrGoCount[i] = packet.ReadUInt32("Required Count", i);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056))
                    quest.RequiredSourceItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Required Source Item ID", i);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                    quest.RequiredSourceItemCount[i] = packet.ReadUInt32("Source Item Count", i);

                if (ClientVersion.RemovedInVersion(ClientVersionBuild.V3_0_8_9464))
                {
                    quest.RequiredItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Required Item ID", i);
                    quest.RequiredItemCount[i] = packet.ReadUInt32("Required Item Count", i);
                }
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464))
            {
                for (var i = 0; i < reqItemFieldCount; i++)
                {
                    quest.RequiredItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Required Item ID", i);
                    quest.RequiredItemCount[i] = packet.ReadUInt32("Required Item Count", i);
                }
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
                quest.RequiredSpell = (uint) packet.ReadEntryWithName<UInt32>(StoreNameType.Spell, "Required Spell");

            quest.ObjectiveText = new string[4];
            for (var i = 0; i < 4; i++)
                quest.ObjectiveText[i] = packet.ReadCString("Objective Text", i);

            quest.RewardCurrencyId = new uint[4];
            quest.RewardCurrencyCount = new uint[4];
            quest.RequiredCurrencyId = new uint[4];
            quest.RequiredCurrencyCount = new uint[4];
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
            {
                for (var i = 0; i < 4; ++i)
                {
                    quest.RewardCurrencyId[i] = packet.ReadUInt32("Reward Currency ID", i);
                    quest.RewardCurrencyCount[i] = packet.ReadUInt32("Reward Currency Count", i);
                }

                for (var i = 0; i < 4; ++i)
                {
                    quest.RequiredCurrencyId[i] = packet.ReadUInt32("Required Currency ID", i);
                    quest.RequiredCurrencyCount[i] = packet.ReadUInt32("Required Currency Count", i);
                }

                quest.QuestGiverTextWindow = packet.ReadCString("QuestGiver Text Window");
                quest.QuestGiverTargetName = packet.ReadCString("QuestGiver Target Name");
                quest.QuestTurnTextWindow = packet.ReadCString("QuestTurn Text Window");
                quest.QuestTurnTargetName = packet.ReadCString("QuestTurn Target Name");

                quest.SoundAccept = packet.ReadUInt32("Sound Accept");
                quest.SoundTurnIn = packet.ReadUInt32("Sound TurnIn");
            }

            packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");

            Storage.QuestTemplates.Add((uint) id.Key, quest, packet.TimeSpan);
        }
コード例 #3
0
        public static void HandleQuestQueryResponse510(Packet packet)
        {
            var id = packet.ReadEntry("Quest ID");
            if (id.Value) // entry is masked
                return;

            var quest = new QuestTemplate
            {
                Method = packet.ReadEnum<QuestMethod>("Method", TypeCode.Int32),
                Level = packet.ReadInt32("Level")
            };

            packet.ReadInt32("Package Id");
            quest.MinLevel = packet.ReadInt32("Min Level");
            quest.ZoneOrSort = packet.ReadEnum<QuestSort>("Sort", TypeCode.Int32);
            quest.Type = packet.ReadEnum<QuestType>("Type", TypeCode.Int32);
            quest.SuggestedPlayers = packet.ReadUInt32("Suggested Players");
            quest.NextQuestIdChain = (uint)packet.ReadEntry<Int32>(StoreNameType.Quest, "Next Chain Quest");
            quest.RewardXPId = packet.ReadUInt32("Quest XP ID");
            quest.RewardOrRequiredMoney = packet.ReadInt32("Reward Money");
            quest.RewardMoneyMaxLevel = packet.ReadUInt32("Reward Money Max Level");
            quest.RewardSpell = (uint)packet.ReadEntry<Int32>(StoreNameType.Spell, "Reward Spell");
            quest.RewardSpellCast = packet.ReadEntry<Int32>(StoreNameType.Spell, "Reward Spell Cast");
            quest.RewardHonor = packet.ReadInt32("Reward Honor");
            quest.RewardHonorMultiplier = packet.ReadSingle("Reward Honor Multiplier");
            quest.SourceItemId = packet.ReadEntry<UInt32>(StoreNameType.Item, "Source Item ID");
            quest.Flags = packet.ReadEnum<QuestFlags>("Flags", TypeCode.UInt32);
            packet.ReadEnum<QuestFlags2>("Flags 2", TypeCode.UInt32);
            quest.MinimapTargetMark = packet.ReadUInt32("Minimap Target Mark"); // missing enum. 1- Skull, 16 - Unknown, but exists
            quest.RewardTitleId = packet.ReadUInt32("Reward Title ID");
            quest.RequiredPlayerKills = packet.ReadUInt32("Required Player Kills");
            quest.RewardSkillId = packet.ReadUInt32("RewSkillId");
            quest.RewardSkillPoints = packet.ReadUInt32("RewSkillPoints");
            quest.RewardReputationMask = packet.ReadUInt32("RewRepMask");
            quest.QuestGiverPortrait = packet.ReadUInt32("QuestGiverPortrait");
            quest.QuestTurnInPortrait = packet.ReadUInt32("QuestTurnInPortrait");

            quest.RewardItemId = new uint[4];
            quest.RewardItemCount = new uint[4];
            for (var i = 0; i < 4; i++)
            {
                quest.RewardItemId[i] = (uint)packet.ReadEntry<Int32>(StoreNameType.Item, "Reward Item ID", i);
                quest.RewardItemCount[i] = packet.ReadUInt32("Reward Item Count", i);
            }

            quest.RewardChoiceItemId = new uint[6];
            quest.RewardChoiceItemCount = new uint[6];
            for (var i = 0; i < 6; i++)
            {
                quest.RewardChoiceItemId[i] = (uint)packet.ReadEntry<Int32>(StoreNameType.Item, "Reward Choice Item ID", i);
                quest.RewardChoiceItemCount[i] = packet.ReadUInt32("Reward Choice Item Count", i);
            }

            const int repCount = 5;
            quest.RewardFactionId = new uint[repCount];
            quest.RewardFactionValueId = new int[repCount];
            quest.RewardFactionValueIdOverride = new uint[repCount];
            for (var i = 0; i < repCount; i++)
                quest.RewardFactionId[i] = packet.ReadUInt32("Reward Faction ID", i);

            for (var i = 0; i < repCount; i++)
                quest.RewardFactionValueId[i] = packet.ReadInt32("Reward Reputation ID", i);

            for (var i = 0; i < repCount; i++)
                quest.RewardFactionValueIdOverride[i] = packet.ReadUInt32("Reward Reputation ID Override", i);

            quest.RewardCurrencyId = new uint[4];
            quest.RewardCurrencyCount = new uint[4];
            for (var i = 0; i < 4; i++)
            {
                quest.RewardCurrencyId[i] = packet.ReadUInt32("Reward Currency ID", i);
                quest.RewardCurrencyCount[i] = packet.ReadUInt32("Reward Currency Count", i);
            }

            quest.PointMapId = packet.ReadUInt32("Point Map ID");
            quest.PointX = packet.ReadSingle("Point X");
            quest.PointY = packet.ReadSingle("Point Y");
            quest.PointOption = packet.ReadUInt32("Point Opt");

            quest.Title = packet.ReadCString("Title");
            quest.Objectives = packet.ReadCString("Objectives");
            quest.Details = packet.ReadCString("Details");
            quest.EndText = packet.ReadCString("End Text");
            quest.CompletedText = packet.ReadCString("Completed Text");
            quest.QuestGiverTextWindow = packet.ReadCString("QuestGiver Text Window");
            quest.QuestGiverTargetName = packet.ReadCString("QuestGiver Target Name");
            quest.QuestTurnTextWindow = packet.ReadCString("QuestTurn Text Window");
            quest.QuestTurnTargetName = packet.ReadCString("QuestTurn Target Name");

            quest.SoundAccept = packet.ReadUInt32("Sound Accept");
            quest.SoundTurnIn = packet.ReadUInt32("Sound TurnIn");

            quest.RequiredSourceItemId = new uint[4];
            quest.RequiredSourceItemCount = new uint[4];
            for (var i = 0; i < 4; i++)
            {
                quest.RequiredSourceItemId[i] = (uint)packet.ReadEntry<Int32>(StoreNameType.Item, "Required Source Item ID", i);
                quest.RequiredSourceItemCount[i] = packet.ReadUInt32("Source Item Count", i);
            }

            var requirementCount = packet.ReadByte("Requirement Count");
            for (var i = 0; i < requirementCount; i++)
            {
                packet.ReadUInt32("Unk UInt32", i);

                var reqType = packet.ReadEnum<QuestRequirementType>("Requirement Type", TypeCode.Byte, i);
                switch (reqType)
                {
                    case QuestRequirementType.Creature:
                    case QuestRequirementType.Unknown3:
                        packet.ReadEntry<Int32>(StoreNameType.Unit, "Required Creature ID", i);
                        break;
                    case QuestRequirementType.Item:
                        packet.ReadEntry<Int32>(StoreNameType.Item, "Required Item ID", i);
                        break;
                    case QuestRequirementType.GameObject:
                        packet.ReadEntry<Int32>(StoreNameType.GameObject, "Required GameObject ID", i);
                        break;
                    case QuestRequirementType.Currency:
                        packet.ReadUInt32("Required Currency ID", i);
                        break;
                    case QuestRequirementType.Spell:
                        packet.ReadEntry<Int32>(StoreNameType.Spell, "Required Spell ID", i);
                        break;
                    case QuestRequirementType.Faction:
                        packet.ReadUInt32("Required Faction ID", i);
                        break;
                    default:
                        packet.ReadInt32("Required ID", i);
                        break;
                }

                packet.ReadInt32("Required Count", i);
                packet.ReadUInt32("Unk UInt32", i);
                packet.ReadCString("Objective Text", i);
                packet.ReadByte("Unk Byte", i);
                var count = packet.ReadByte("Unk Byte", i);
                for (var j = 0; j < count; j++)
                    packet.ReadUInt32("Unk UInt32", i, j);
            }

            // unused in MoP, but required for SQL building
            quest.RequiredNpcOrGo = new int[4];
            quest.RequiredNpcOrGoCount = new uint[4];
            quest.RequiredItemId = new uint[6];
            quest.RequiredItemCount = new uint[6];
            quest.RequiredCurrencyId = new uint[4];
            quest.RequiredCurrencyCount = new uint[4];
            quest.RequiredFactionId = new uint[2];
            quest.RequiredFactionValue = new int[2];
            quest.ObjectiveText = new string[4];
            quest.RewardTalents = 0;

            packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");

            Storage.QuestTemplates.Add((uint)id.Key, quest, packet.TimeSpan);
        }
コード例 #4
0
        public static void HandleQuestQueryResponse(Packet packet)
        {
            var id = packet.ReadEntry("Quest ID"); // +4
            if (id.Value) // entry is masked
                return;
            //sub_6B9CD3 quest failed 0x0B70

            //sub_6B575B -> 0x0F59
            bool questIsntAutoComplete = packet.ReadBit("Quest Isn't AutoComplete"); // +20

            if (questIsntAutoComplete)
            {
                var questTurnTextWindowLen = packet.ReadBits(10); // +2113
                var questTitleLen = packet.ReadBits(9); // +30
                var questCompletedTextLen = packet.ReadBits(11); // +2433
                var questDetailsLen = packet.ReadBits(12); // +908
                var questTurnTargetNameLen = packet.ReadBits(8); // +2369
                var questGiverTargetNameLen = packet.ReadBits(8); // +2049
                var questGiverTextWindowLen = packet.ReadBits(10); // +1793
                var questEndTextLen = packet.ReadBits(9); // +1658
                var questObjectivesCount = packet.ReadBits("Objectives Count", 19);
                var questObjectivesLen = packet.ReadBits(12); // +158

                uint[,] objectivesCounts = new uint[questObjectivesCount, 2];

                for (var i = 0; i < questObjectivesCount; ++i)
                {
                    objectivesCounts[i, 1] = packet.ReadBits(8); // +2949 + 20
                    objectivesCounts[i, 0] = packet.ReadBits(22); // +2949 + 0
                }

                packet.ResetBitReader();

                for (var i = 0; i < questObjectivesCount; ++i)
                {
                    packet.ReadUInt32("Requirement Count ", i); // +2949 + 12
                    packet.ReadUInt32("Unk UInt32", i); // +2949 + 0
                    packet.ReadWoWString("Objective Text", objectivesCounts[i, 1], i); // +2949 + 20
                    packet.ReadUInt32("Unk2 UInt32", i); // +2949 + 16
                    packet.ReadByte("Objective", i); // +2949 + 5
                    var reqType = packet.ReadEnum<QuestRequirementType>("Requirement Type", TypeCode.Byte, i); // +2949 + 4

                    // +2949 + 8
                    switch (reqType)
                    {
                        case QuestRequirementType.Creature:
                        case QuestRequirementType.Unknown3:
                            packet.ReadEntry<Int32>(StoreNameType.Unit, "Required Creature ID", i);
                            break;
                        case QuestRequirementType.Item:
                            packet.ReadEntry<Int32>(StoreNameType.Item, "Required Item ID", i);
                            break;
                        case QuestRequirementType.GameObject:
                            packet.ReadEntry<Int32>(StoreNameType.GameObject, "Required GameObject ID", i);
                            break;
                        case QuestRequirementType.Currency:
                            packet.ReadUInt32("Required Currency ID", i);
                            break;
                        case QuestRequirementType.Spell:
                            packet.ReadEntry<Int32>(StoreNameType.Spell, "Required Spell ID", i);
                            break;
                        case QuestRequirementType.Faction:
                            packet.ReadUInt32("Required Faction ID", i);
                            break;
                        default:
                            packet.ReadInt32("Required ID", i);
                            break;
                    }

                    for (var j = 0; j < objectivesCounts[i, 0]; j++)
                        packet.ReadUInt32("Unk Looped DWROD", i, j);
                }

                packet.ReadUInt32("Required Source Item ID 1"); // +2960
                packet.ReadUInt32("Reward Choice ItemID 2"); // +2980
                packet.ReadUInt32("Reward ItemID 3"); // +2955
                packet.ReadUInt32("Reward ItemID Count2"); // +2957
                packet.ReadUInt32("int2973"); // +2975

                var quest = new QuestTemplate
                {
                    Method = questIsntAutoComplete ? QuestMethod.Normal : QuestMethod.AutoComplete,
                };

                quest.RewardCurrencyId = new uint[4];
                quest.RewardCurrencyCount = new uint[4];
                for (var i = 0; i < 4; ++i)
                {
                    quest.RewardCurrencyId[i] = packet.ReadUInt32("Reward Currency ID", i); // +3001 + 16
                    quest.RewardCurrencyCount[i] = packet.ReadUInt32("Reward Currency Count", i); // +3001 + 0
                }

                packet.ReadUInt32("CharTittleID"); // +1787
                packet.ReadSingle("Point Y"); // +28
                quest.SoundTurnIn = packet.ReadUInt32("Sound TurnIn"); // +2947

                const int repCount = 5;
                quest.RewardFactionId = new uint[repCount];
                quest.RewardFactionValueId = new int[repCount];
                quest.RewardFactionValueIdOverride = new uint[repCount];

                for (var i = 0; i < repCount; i++)
                {
                    quest.RewardFactionValueId[i] = packet.ReadInt32("Reward Reputation ID", i); // +2986 + 20
                    quest.RewardFactionValueIdOverride[i] = packet.ReadUInt32("Reward Reputation ID Override", i); // +2986 + 0
                    quest.RewardFactionId[i] = packet.ReadUInt32("Reward Faction ID", i); // +2986 + 400
                }

                quest.RewardOrRequiredMoney = packet.ReadInt32("Reward Money"); // +16
                packet.ReadUInt32("EmoteOnComplete"); // +2981
                packet.ReadUInt32("Reward Choice ItemID Count5"); // +2972
                packet.ReadUInt32("MinimapTargetMask"); // +25
                quest.EndText = packet.ReadWoWString("QuestEndText", questEndTextLen); // +1658
                packet.ReadUInt32("Reward Choice ItemID 2"); // +2971
                quest.RewardMoneyMaxLevel = packet.ReadUInt32("Reward Money Max Level"); // +18
                packet.ReadUInt32("Reward Item1 ID"); // +2952
                quest.CompletedText = packet.ReadWoWString("QuestCompletedText", questCompletedTextLen); // +2433
                packet.ReadInt32("Reward Choice ItemID 4"); // +2977
                packet.ReadUInt32("RewardHonorAddition"); // +21
                quest.QuestGiverTextWindow = packet.ReadWoWString("QuestGiverTextWindow", questGiverTextWindowLen); // +1793
                quest.Objectives = packet.ReadWoWString("QuestObjectives", questObjectivesLen); // +158
                packet.ReadUInt32("RewArenaPoints"); // +1790
                packet.ReadUInt32("Reward Choice ItemID 6"); // +2983
                quest.SuggestedPlayers = packet.ReadUInt32("Suggested Players"); // +13
                packet.ReadUInt32("RepObjectiveFaction"); // +6
                packet.ReadUInt32("Required Source Item ID 2"); // +2961
                packet.ReadUInt32("Reward ItemID 2"); // +2953
                packet.ReadUInt32("MinLevel"); // +10
                packet.ReadUInt32("Reward Choice ItemID Count3"); // +2945
                packet.ReadUInt32("PointOpt"); // +29

                // +8
                quest.Level = packet.ReadInt32("Level"); // +8

                packet.ReadUInt32("RepObjectiveFaction2"); // +7
                packet.ReadUInt32("Required Source Item ID Count 3"); // +2966
                packet.ReadUInt32("XPId"); // +17
                quest.Details = packet.ReadWoWString("QuestDetails", questDetailsLen); // +908
                packet.ReadUInt32("Reward ItemID Count1"); // +2956
                packet.ReadUInt32("Reward Choice ItemID Count6"); // +2984
                packet.ReadUInt32("Reward ItemID Count3"); // +2958
                packet.ReadUInt32("RewardSpellCasted"); // +20
                packet.ReadUInt32("dword2E80"); // +2976
                quest.QuestTurnTargetName = packet.ReadWoWString("QuestTurnTargetName", questTurnTargetNameLen); // +2369
                packet.ReadUInt32("dword2E74"); // +2973
                packet.ReadUInt32("Required Source Item ID Count 2"); // +2965
                packet.ReadUInt32("Required Source Item ID 3"); // +2962
                packet.ReadUInt32("RewSkillPoints"); // +1792
                quest.Title = packet.ReadWoWString("QuestTitle", questTitleLen); // +30
                var type = packet.ReadEnum<QuestType>("Type", TypeCode.Int32); // +12
                packet.ReadUInt32("RepObjectiveValue2"); // +15
                packet.ReadUInt32("unk11"); // +2982
                packet.ReadUInt32("PlayersSlain"); // +1788
                packet.ReadUInt32("PointMapId"); // +26
                packet.ReadUInt32("NextQuestInChain"); // +14
                packet.ReadUInt32("Reward Choice ItemID 1"); // +2968
                var QuestGiverTargetName = packet.ReadWoWString("QuestGiverTargetName", questGiverTargetNameLen); // +2049
                packet.ReadUInt32("dword2E8C"); // +2979
                packet.ReadUInt32("Required Source Item ID 4"); // +2963
                packet.ReadSingle("Point X"); // +27
                packet.ReadUInt32("Reward Choice ItemID 3"); // +2974
                packet.ReadUInt32("unk"); // +2970
                packet.ReadUInt32("Reward ItemID Count4"); // +2959
                quest.SoundAccept = packet.ReadUInt32("Sound Accept"); // +2946
                packet.ReadUInt32("Reward ItemID 3"); // +2954
                packet.ReadSingle("RewardHonorMultiplier"); // +22
                packet.ReadUInt32("RequiredSpellID"); // +1786
                packet.ReadWoWString("QuestTurnTextWindow", questTurnTextWindowLen); // +2113
                packet.ReadUInt32("Reward Choice ItemID Count4"); // +2978
                packet.ReadUInt32("Required Source Item ID Count 1"); // +2964
                quest.ZoneOrSort = packet.ReadEnum<QuestSort>("Sort", TypeCode.Int32); // +11
                packet.ReadUInt32("BonusTalents"); // +1789
                packet.ReadUInt32("Reward Choice ItemID Count1"); // +2969
                packet.ReadUInt32("Rewarded Spell"); // +19
                packet.ReadUInt32("RewSkillID"); // +1791
                packet.ReadUInt32("unk9"); // +2985
                packet.ReadUInt32("unk10"); // +2967
                quest.Flags = packet.ReadEnum<QuestFlags>("Flags", TypeCode.UInt32); // +24
                packet.ReadUInt32("Suggested Players"); // +9
                packet.ReadUInt32("SourceItemID"); // +23

                packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");

                Storage.QuestTemplates.Add((uint)id.Key, quest, packet.TimeSpan);
            }
        }
コード例 #5
0
ファイル: QuestHandler.cs プロジェクト: horn/WowPacketParser
        public static void HandleQuestQueryResponse(Packet packet)
        {
            var id = packet.ReadEntry("Quest ID");
            if (id.Value) // entry is masked
                return;

            QuestTemplate quest = new QuestTemplate
            {
                ID = (uint)id.Key
            };

            quest.QuestType = packet.ReadInt32E<QuestType>("QuestType");
            quest.QuestLevel = packet.ReadInt32("QuestLevel");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.MinLevel = packet.ReadInt32("QuestMinLevel");

            quest.QuestSortID = packet.ReadInt32E<QuestSort>("QuestSortID");

            quest.QuestInfoID = packet.ReadInt32E<QuestInfo>("QuestInfoID");

            quest.SuggestedGroupNum = packet.ReadUInt32("SuggestedGroupNum");

            quest.RequiredFactionID = new uint?[2];
            quest.RequiredFactionValue = new int?[2];
            for (int i = 0; i < 2; i++)
            {
                quest.RequiredFactionID[i] = packet.ReadUInt32("RequiredFactionID", i);
                quest.RequiredFactionValue[i] = packet.ReadInt32("RequiredFactionValue", i);
            }

            quest.NextQuestID = packet.ReadInt32<QuestId>("NextQuestID");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardXPDifficulty = packet.ReadUInt32("RewardXPDifficulty");

            quest.RewardMoney = packet.ReadInt32("RewardMoney");
            quest.RewardBonusMoney = packet.ReadUInt32("RewardBonusMoney");
            quest.RewardDisplaySpell = (uint)packet.ReadInt32<SpellId>("RewardDisplaySpell");
            quest.RewardSpell = packet.ReadInt32<SpellId>("RewardSpell");
            quest.RewardHonor = packet.ReadInt32("RewardHonor");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardKillHonor = packet.ReadSingle("RewardKillHonor");

            quest.StartItem = packet.ReadUInt32<ItemId>("StartItem");
            quest.Flags = packet.ReadUInt32E<QuestFlags>("Flags");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
                quest.MinimapTargetMark = packet.ReadUInt32("MinimapTargetMark"); // missing enum. 1- Skull, 16 - Unknown, but exists

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V2_4_0_8089))
                quest.RewardTitle = packet.ReadUInt32("RewardTitle");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056))
            {
                quest.RequiredPlayerKills = packet.ReadUInt32("RequiredPlayerKills");
                quest.RewardTalents = packet.ReadUInt32("RewardTalents");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardArenaPoints = packet.ReadUInt32("RewardArenaPoints");

            // TODO: Find when was this added/removed and what is it
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958) && (ClientVersion.RemovedInVersion(ClientVersionBuild.V4_0_1_13164)))
                packet.ReadInt32("Unknown Int32");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
            {
                quest.RewardSkillLineID = packet.ReadUInt32("RewardSkillLineID");
                quest.RewardNumSkillUps = packet.ReadUInt32("RewardNumSkillUps");
                quest.RewardReputationMask = packet.ReadUInt32("RewardReputationMask");
                quest.QuestGiverPortrait = packet.ReadUInt32("QuestGiverPortrait");
                quest.QuestTurnInPortrait = packet.ReadUInt32("QuestTurnInPortrait");
            }

            quest.RewardItem = new uint?[4];
            quest.RewardAmount = new uint?[4];
            for (int i = 0; i < 4; i++)
            {
                quest.RewardItem[i] = (uint) packet.ReadInt32<ItemId>("RewardItems", i);
                quest.RewardAmount[i] = packet.ReadUInt32("RewardAmount", i);
            }

            quest.RewardChoiceItemID = new uint?[6];
            quest.RewardChoiceItemQuantity = new uint?[6];
            for (int i = 0; i < 6; i++)
            {
                quest.RewardChoiceItemID[i] = (uint) packet.ReadInt32<ItemId>("RewardChoiceItemID", i);
                quest.RewardChoiceItemQuantity[i] = packet.ReadUInt32("RewardChoiceItemQuantity", i);
            }

            const int repCount = 5;
            quest.RewardFactionID = new uint?[repCount];
            quest.RewardFactionValue = new int?[repCount];
            quest.RewardFactionOverride = new int?[repCount];
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
            {
                for (int i = 0; i < repCount; i++)
                    quest.RewardFactionID[i] = packet.ReadUInt32("RewardFactionID", i);

                for (int i = 0; i < repCount; i++)
                    quest.RewardFactionValue[i] = packet.ReadInt32("RewardFactionValue", i);

                for (int i = 0; i < repCount; i++)
                    quest.RewardFactionOverride[i] = (int)packet.ReadUInt32("RewardFactionOverride", i);
            }

            quest.POIContinent = packet.ReadUInt32("POIContinent");
            quest.POIx = packet.ReadSingle("POIx");
            quest.POIy = packet.ReadSingle("POIy");
            quest.POIPriority = packet.ReadUInt32("POIPriority");
            quest.LogTitle = packet.ReadCString("LogTitle");
            quest.LogDescription = packet.ReadCString("LogDescription");
            quest.QuestDescription = packet.ReadCString("QuestDescription");
            quest.AreaDescription = packet.ReadCString("AreaDescription");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.QuestCompletionLog = packet.ReadCString("QuestCompletionLog");

            var reqId = new KeyValuePair<int, bool>[4];
            quest.RequiredNpcOrGo = new int?[4];
            quest.RequiredNpcOrGoCount = new uint?[4];
            quest.RequiredItemID = new uint?[4];
            quest.RequiredItemCount = new uint?[4];
            int reqItemFieldCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464) ? 6 : 4;
            quest.RequiredItemID = new uint?[reqItemFieldCount];
            quest.RequiredItemCount = new uint?[reqItemFieldCount];

            for (int i = 0; i < 4; i++)
            {
                reqId[i] = packet.ReadEntry();
                bool isGo = reqId[i].Value;
                quest.RequiredNpcOrGo[i] = reqId[i].Key * (isGo ? -1 : 1);

                packet.AddValue("Required", (isGo ? "GO" : "NPC") +
                    " ID: " + StoreGetters.GetName(isGo ? StoreNameType.GameObject : StoreNameType.Unit, reqId[i].Key), i);

                quest.RequiredNpcOrGoCount[i] = packet.ReadUInt32("RequiredCount", i);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056))
                    quest.RequiredItemID[i] = (uint) packet.ReadInt32<ItemId>("RequiredItemID", i);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                    quest.RequiredItemCount[i] = packet.ReadUInt32("RequiredItemCount", i);

                if (ClientVersion.RemovedInVersion(ClientVersionBuild.V3_0_8_9464))
                {
                    quest.RequiredItemID[i] = (uint) packet.ReadInt32<ItemId>("RequiredItemID", i);
                    quest.RequiredItemCount[i] = packet.ReadUInt32("RequiredItemCount", i);
                }
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464))
            {
                for (int i = 0; i < reqItemFieldCount; i++)
                {
                    quest.RequiredItemID[i] = (uint) packet.ReadInt32<ItemId>("RequiredItemID", i);
                    quest.RequiredItemCount[i] = packet.ReadUInt32("RequiredItemCount", i);
                }
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
                quest.RequiredSpell = packet.ReadUInt32<SpellId>("RequiredSpell");

            quest.ObjectiveText = new string[4];
            for (int i = 0; i < 4; i++)
                quest.ObjectiveText[i] = packet.ReadCString("Objective Text", i);

            quest.RewardCurrencyID = new uint?[4];
            quest.RewardCurrencyCount = new uint?[4];
            quest.RequiredCurrencyID = new uint?[4];
            quest.RequiredCurrencyCount = new uint?[4];
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164))
            {
                for (int i = 0; i < 4; ++i)
                {
                    quest.RewardCurrencyID[i] = packet.ReadUInt32("Reward Currency ID", i);
                    quest.RewardCurrencyCount[i] = packet.ReadUInt32("Reward Currency Count", i);
                }

                for (int i = 0; i < 4; ++i)
                {
                    quest.RequiredCurrencyID[i] = packet.ReadUInt32("Required Currency ID", i);
                    quest.RequiredCurrencyCount[i] = packet.ReadUInt32("Required Currency Count", i);
                }

                quest.QuestGiverTextWindow = packet.ReadCString("QuestGiver Text Window");
                quest.QuestGiverTargetName = packet.ReadCString("QuestGiver Target Name");
                quest.QuestTurnTextWindow = packet.ReadCString("QuestTurn Text Window");
                quest.QuestTurnTargetName = packet.ReadCString("QuestTurn Target Name");

                quest.SoundAccept = packet.ReadUInt32("Sound Accept");
                quest.SoundTurnIn = packet.ReadUInt32("Sound TurnIn");
            }

            packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");

            Storage.QuestTemplates.Add(quest, packet.TimeSpan);
        }
コード例 #6
0
ファイル: QuestHandler.cs プロジェクト: horn/WowPacketParser
        public static void HandleQuestQueryResponse510(Packet packet)
        {
            var id = packet.ReadEntry("Quest ID");
            if (id.Value) // entry is masked
                return;

            QuestTemplate quest = new QuestTemplate
            {
                ID = (uint)id.Key
            };

            quest.QuestType = packet.ReadInt32E<QuestType>("QuestType");
            quest.QuestLevel = packet.ReadInt32("QuestLevel");

            quest.QuestPackageID = packet.ReadUInt32("QuestPackageID");
            quest.MinLevel = packet.ReadInt32("QuestMinLevel");
            quest.QuestSortID = packet.ReadInt32E<QuestSort>("QuestSortID");
            quest.QuestInfoID = packet.ReadInt32E<QuestInfo>("QuestInfoID");
            quest.SuggestedGroupNum = packet.ReadUInt32("SuggestedGroupNum");
            quest.RewardNextQuest = (uint)packet.ReadInt32<QuestId>("RewardNextQuest");
            quest.RewardXPDifficulty = packet.ReadUInt32("RewardXPDifficulty");
            quest.RewardMoney = packet.ReadInt32("RewardMoney");
            quest.RewardBonusMoney = packet.ReadUInt32("RewardBonusMoney");
            quest.RewardDisplaySpell = (uint)packet.ReadInt32<SpellId>("RewardDisplaySpell");
            quest.RewardSpell = packet.ReadInt32<SpellId>("RewardSpell");
            quest.RewardHonor = packet.ReadInt32("Reward Honor");
            quest.RewardKillHonor = packet.ReadSingle("RewardKillHonor");
            quest.StartItem = packet.ReadUInt32<ItemId>("StartItem");
            quest.Flags = packet.ReadUInt32E<QuestFlags>("Flags");
            quest.FlagsEx = packet.ReadUInt32E<QuestFlags2>("FlagsEx");
            quest.MinimapTargetMark = packet.ReadUInt32("MinimapTargetMark"); // missing enum. 1- Skull, 16 - Unknown, but exists
            quest.RewardTitle = packet.ReadUInt32("RewardTitle");
            quest.RequiredPlayerKills = packet.ReadUInt32("RequiredPlayerKills");
            quest.RewardSkillLineID = packet.ReadUInt32("RewardSkillLineID");
            quest.RewardNumSkillUps = packet.ReadUInt32("RewardNumSkillUps");
            quest.RewardReputationMask = packet.ReadUInt32("RewRepMask");
            quest.QuestGiverPortrait = packet.ReadUInt32("QuestGiverPortrait");
            quest.QuestTurnInPortrait = packet.ReadUInt32("QuestTurnInPortrait");

            quest.RewardItem = new uint?[4];
            quest.RewardAmount = new uint?[4];
            for (int i = 0; i < 4; i++)
            {
                quest.RewardItem[i] = (uint)packet.ReadInt32<ItemId>("Reward Item ID", i);
                quest.RewardAmount[i] = packet.ReadUInt32("Reward Item Count", i);
            }

            quest.RewardChoiceItemID = new uint?[6];
            quest.RewardChoiceItemQuantity = new uint?[6];
            for (int i = 0; i < 6; i++)
            {
                quest.RewardChoiceItemID[i] = (uint)packet.ReadInt32<ItemId>("Reward Choice Item ID", i);
                quest.RewardChoiceItemQuantity[i] = packet.ReadUInt32("Reward Choice Item Count", i);
            }

            const int repCount = 5;
            quest.RewardFactionID = new uint?[repCount];
            quest.RewardFactionValue = new int?[repCount];
            quest.RewardFactionOverride = new int?[repCount];
            for (int i = 0; i < repCount; i++)
                quest.RewardFactionID[i] = packet.ReadUInt32("RewardFactionID", i);

            for (int i = 0; i < repCount; i++)
                quest.RewardFactionValue[i] = packet.ReadInt32("RewardFactionValue", i);

            for (int i = 0; i < repCount; i++)
                quest.RewardFactionOverride[i] = packet.ReadInt32("RewardFactionOverride", i);

            quest.RewardCurrencyID = new uint?[4];
            quest.RewardCurrencyCount = new uint?[4];
            for (int i = 0; i < 4; i++)
            {
                quest.RewardCurrencyID[i] = packet.ReadUInt32("Reward Currency ID", i);
                quest.RewardCurrencyCount[i] = packet.ReadUInt32("Reward Currency Count", i);
            }

            quest.POIContinent = packet.ReadUInt32("POIContinent");
            quest.POIx = packet.ReadSingle("POIx");
            quest.POIy = packet.ReadSingle("POIy");
            quest.POIPriority = packet.ReadUInt32("POIPriority");

            quest.LogTitle = packet.ReadCString("LogTitle");
            quest.LogDescription = packet.ReadCString("LogDescription");
            quest.QuestDescription = packet.ReadCString("QuestDescription");
            quest.AreaDescription = packet.ReadCString("AreaDescription");
            quest.QuestCompletionLog = packet.ReadCString("QuestCompletionLog");
            quest.QuestGiverTextWindow = packet.ReadCString("QuestGiver Text Window");
            quest.QuestGiverTargetName = packet.ReadCString("QuestGiver Target Name");
            quest.QuestTurnTextWindow = packet.ReadCString("QuestTurn Text Window");
            quest.QuestTurnTargetName = packet.ReadCString("QuestTurn Target Name");

            quest.SoundAccept = packet.ReadUInt32("Sound Accept");
            quest.SoundTurnIn = packet.ReadUInt32("Sound TurnIn");

            quest.RequiredItemID = new uint?[4];
            quest.RequiredItemCount = new uint?[4];
            for (int i = 0; i < 4; i++)
            {
                quest.RequiredItemID[i] = (uint)packet.ReadInt32<ItemId>("RequiredItemID", i);
                quest.RequiredItemCount[i] = packet.ReadUInt32("RequiredItemCount", i);
            }

            byte requirementCount = packet.ReadByte("Requirement Count");
            for (int i = 0; i < requirementCount; i++)
            {
                packet.ReadUInt32("Unk UInt32", i);

                QuestRequirementType reqType = packet.ReadByteE<QuestRequirementType>("Requirement Type", i);
                switch (reqType)
                {
                    case QuestRequirementType.CreatureKill:
                    case QuestRequirementType.CreatureInteract:
                    case QuestRequirementType.PetBattleDefeatCreature:
                        packet.ReadInt32<UnitId>("Required Creature ID", i);
                        break;
                    case QuestRequirementType.Item:
                        packet.ReadInt32<ItemId>("Required Item ID", i);
                        break;
                    case QuestRequirementType.GameObject:
                        packet.ReadInt32<GOId>("Required GameObject ID", i);
                        break;
                    case QuestRequirementType.Currency:
                        packet.ReadUInt32("Required Currency ID", i);
                        break;
                    case QuestRequirementType.Spell:
                        packet.ReadInt32<SpellId>("Required Spell ID", i);
                        break;
                    case QuestRequirementType.FactionRepHigher:
                    case QuestRequirementType.FactionRepLower:
                        packet.ReadUInt32("Required Faction ID", i);
                        break;
                    case QuestRequirementType.PetBattleDefeatSpecies:
                        packet.ReadUInt32("Required Species ID", i);
                        break;
                    default:
                        packet.ReadInt32("Required ID", i);
                        break;
                }

                packet.ReadInt32("Required Count", i);
                packet.ReadUInt32("Unk UInt32", i);
                packet.ReadCString("Objective Text", i);
                packet.ReadByte("Unk Byte", i);
                byte count = packet.ReadByte("Unk Byte", i);
                for (int j = 0; j < count; j++)
                    packet.ReadUInt32("Unk UInt32", i, j);
            }

            // unused in MoP, but required for SQL building
            quest.RequiredNpcOrGo = new int?[4];
            quest.RequiredNpcOrGoCount = new uint?[4];
            quest.RequiredItemID = new uint?[6];
            quest.RequiredItemCount = new uint?[6];
            quest.RequiredCurrencyID = new uint?[4];
            quest.RequiredCurrencyCount = new uint?[4];
            quest.RequiredFactionID = new uint?[2];
            quest.RequiredFactionValue = new int?[2];
            quest.ObjectiveText = new string[4];
            quest.RewardTalents = 0;

            packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");

            Storage.QuestTemplates.Add(quest, packet.TimeSpan);
        }
コード例 #7
0
        public static void HandleQuestQueryResp(Packet packet)
        {
            var id = packet.ReadEntry("Quest ID");
            if (id.Value) // entry is masked
                return;

            bool QuestIsntAutoComplete = packet.ReadBit("Quest Isn't AutoComplete");

            if (QuestIsntAutoComplete)
            {
                var QuestEndTextLen = packet.ReadBits(9);
                var QuestTitleLen = packet.ReadBits(9);
                var QuestGiverTextWindowLen = packet.ReadBits(10);
                var QuestTurnTargetNameLen = packet.ReadBits(8);
                var QuestObjectivesLen = packet.ReadBits(12);
                var QuestGiverTargetNameLen = packet.ReadBits(8);
                var QuestDetailsLen = packet.ReadBits(12);
                var QuestTurnTextWindowLen = packet.ReadBits(10);
                var QuestCompletedTextLen = packet.ReadBits(11);
                var QuestObjectivesCount = packet.ReadBits("Objectives Count", 19);
                uint[,] ObjectivesCounts = new uint[QuestObjectivesCount,2];

                for (var i = 0; i < QuestObjectivesCount; ++i)
                {
                    ObjectivesCounts[i,0] = packet.ReadBits(22);
                    ObjectivesCounts[i,1] = packet.ReadBits(8);
                }

                packet.ResetBitReader();

                for (var i = 0; i < QuestObjectivesCount; ++i)
                {
                    packet.ReadUInt32("Unk UInt32", i);
                    packet.ReadWoWString("Objective Text", ObjectivesCounts[i, 1], i);
                    var reqType = packet.ReadByteE<QuestRequirementType>("Requirement Type", i);
                    packet.ReadByte("Unk Byte5", i);
                    packet.ReadUInt32("Requirement Count ", i);

                    for (var j = 0; j < ObjectivesCounts[i, 0]; j++)
                    {
                        packet.ReadUInt32("Unk Looped DWROD", i, j);
                    }

                    packet.ReadUInt32("Unk2 UInt32", i);

                    switch (reqType)
                    {
                        case QuestRequirementType.CreatureKill:
                        case QuestRequirementType.CreatureInteract:
                        case QuestRequirementType.PetBattleDefeatCreature:
                            packet.ReadInt32<UnitId>("Required Creature ID", i);
                            break;
                        case QuestRequirementType.Item:
                            packet.ReadInt32<ItemId>("Required Item ID", i);
                            break;
                        case QuestRequirementType.GameObject:
                            packet.ReadInt32<GOId>("Required GameObject ID", i);
                            break;
                        case QuestRequirementType.Currency:
                            packet.ReadUInt32("Required Currency ID", i);
                            break;
                        case QuestRequirementType.Spell:
                            packet.ReadInt32<SpellId>("Required Spell ID", i);
                            break;
                        case QuestRequirementType.FactionRepHigher:
                        case QuestRequirementType.FactionRepLower:
                            packet.ReadUInt32("Required Faction ID", i);
                            break;
                        default:
                            packet.ReadInt32("Required ID", i);
                            break;
                    }
                }

                packet.ReadUInt32("Reward ItemID Count4");
                packet.ReadUInt32("dword2E50");
                packet.ReadUInt32("Rewarded Spell");
                packet.ReadSingle("Point X");
                packet.ReadUInt32("NextQuestInChain");
                packet.ReadUInt32("dword2E68");
                packet.ReadSingle("RewardHonorMultiplier");
                packet.ReadUInt32("Reward ItemID 4");
                var type = packet.ReadInt32E<QuestType>("Type");
                packet.ReadUInt32("dword2E94");
                packet.ReadUInt32("Reward ItemID Count2");
                var QuestGiverTargetName = packet.ReadWoWString("QuestGiverTargetName", QuestGiverTargetNameLen);
                packet.ReadUInt32("dword2E84");
                packet.ReadUInt32("RepObjectiveValue2");
                packet.ReadUInt32("dword2E58");
                packet.ReadUInt32("dword2E40");

                QuestTemplate quest = new QuestTemplate
                {
                    QuestType = QuestIsntAutoComplete ? QuestType.Normal : QuestType.AutoComplete,
                    QuestLevel = packet.ReadInt32("Level")
                };

                packet.ReadUInt32("BonusTalents");
                quest.QuestCompletionLog = packet.ReadWoWString("QuestCompletedText", QuestCompletedTextLen);
                quest.AreaDescription = packet.ReadWoWString("QuestEndText", QuestEndTextLen);
                packet.ReadUInt32("dword2E08");
                packet.ReadUInt32("dword2E04");
                packet.ReadUInt32("XPId");
                packet.ReadUInt32("dword2E60");
                packet.ReadUInt32("dword2E0C");
                packet.ReadSingle("Point Y");
                quest.RewardBonusMoney = packet.ReadUInt32("Reward Money Max Level");
                packet.ReadUInt32("PointOpt");
                quest.QuestGiverTextWindow = packet.ReadWoWString("QuestGiverTextWindow", QuestGiverTextWindowLen);

                quest.RewardCurrencyID = new uint?[4];
                quest.RewardCurrencyCount = new uint?[4];
                for (var i = 0; i < 4; ++i)
                {
                    quest.RewardCurrencyID[i] = packet.ReadUInt32("Reward Currency ID", i);
                    quest.RewardCurrencyCount[i] = packet.ReadUInt32("Reward Currency Count", i);
                }

                quest.LogDescription = packet.ReadWoWString("QuestObjectives", QuestObjectivesLen);
                packet.ReadUInt32("dword2E4C");
                packet.ReadUInt32("dword2E54");
                packet.ReadUInt32("RewardSpellCasted");

                const int repCount = 5;
                quest.RewardFactionID = new uint?[repCount];
                quest.RewardFactionValue = new int?[repCount];
                quest.RewardFactionOverride = new int?[repCount];

                for(var i = 0; i < repCount; i++)
                {
                    quest.RewardFactionValue[i] = packet.ReadInt32("Reward Reputation ID", i);
                    quest.RewardFactionOverride[i] = (int)packet.ReadUInt32("Reward Reputation ID Override", i);
                    quest.RewardFactionID[i] = packet.ReadUInt32("Reward Faction ID", i);
                }

                quest.QuestTurnTargetName = packet.ReadWoWString("QuestTurnTargetName", QuestTurnTargetNameLen);
                packet.ReadUInt32("dword2E78");
                packet.ReadUInt32("RewSkillID");
                packet.ReadUInt32("CharTittleID");
                packet.ReadUInt32("Reward Item1 ID");
                quest.QuestSortID = packet.ReadInt32E<QuestSort>("Sort");
                packet.ReadUInt32("RewardHonorAddition");
                packet.ReadUInt32("dword2E8C");
                quest.RewardMoney = packet.ReadInt32("Reward Money");
                packet.ReadUInt32("dword2E48");
                quest.QuestDescription = packet.ReadWoWString("QuestDetails", QuestDetailsLen);
                packet.ReadUInt32("RewSkillPoints");
                packet.ReadUInt32("RepObjectiveFaction");
                packet.ReadUInt32("dword2E7C");
                packet.ReadUInt32("SoundAccept");
                packet.ReadUInt32("dword2E74");
                packet.ReadUInt32("MinimapTargetMask");
                packet.ReadUInt32("MinLevel");
                packet.ReadUInt32("dword2E44");
                packet.ReadUInt32("PlayersSlain");
                packet.ReadUInt32("Unk");
                packet.ReadUInt32("RequiredSpellID");
                packet.ReadUInt32("dword2E90");
                packet.ReadUInt32("SourceItemID");
                packet.ReadUInt32("dword2E80");
                packet.ReadUInt32("Reward ItemID Count1");
                packet.ReadUInt32("dword2E70");
                packet.ReadUInt32("Suggested Players");
                packet.ReadUInt32("PointMapId");
                quest.LogTitle = packet.ReadWoWString("QuestTitle", QuestTitleLen);
                packet.ReadUInt32("Reward ItemID 3");
                packet.ReadUInt32("dword2E98");
                packet.ReadUInt32("dword2E5C");
                packet.ReadUInt32("SoundTurnIn");
                packet.ReadWoWString("QuestTurnTextWindow", QuestTurnTextWindowLen);
                packet.ReadUInt32("dword2E9C");
                packet.ReadUInt32("Reward ItemID 2");
                packet.ReadUInt32("Reward ItemID Count3");
                packet.ReadUInt32("dword2E64");
                quest.Flags = packet.ReadUInt32E<QuestFlags>("Flags");
                packet.ReadUInt32("RewArenaPoints");
                packet.ReadUInt32("dword2E6C");
                packet.ReadUInt32("RepObjectiveFaction2");
                packet.ReadUInt32("dword2E88");

                packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");

                Storage.QuestTemplates.Add(quest, packet.TimeSpan);
            }
        }
コード例 #8
0
        public static void HandleQuestQueryResponse(Packet packet)
        {
            var hasData = packet.ReadBit();
            if (!hasData)
            {
                packet.ReadUInt32("Entry");
                return; // nothing to do
            }

            var quest = new QuestTemplate();

            var bits907 = packet.ReadBits(12);
            var count = packet.ReadBits(19);

            var len2949_20 = new uint[count];
            var counter = new uint[count];

            for (var i = 0; i < count; ++i)
            {
                len2949_20[i] = packet.ReadBits(8);
                counter[i] = packet.ReadBits(22);
            }

            var bits2432 = packet.ReadBits(11);
            var bits2048 = packet.ReadBits(8);
            var bits2112 = packet.ReadBits(10);
            var bits157 = packet.ReadBits(12);
            var bits1657 = packet.ReadBits(9);
            var bits2368 = packet.ReadBits(8);
            var bits1792 = packet.ReadBits(10);
            var bits29 = packet.ReadBits(9);

            packet.ReadInt32("Int2E34");
            packet.ReadInt32("Int4C");
            packet.ReadSingle("Float54");

            for (var i = 0; i < count; ++i)
            {
                packet.ReadInt32("Int2E10", i);
                packet.ReadInt32("IntED", i);
                packet.ReadInt32("IntED", i);
                packet.ReadInt32("IntEA", i);
                packet.ReadWoWString("StringEA", len2949_20[i], i);
                packet.ReadByte("ByteED", i);
                packet.ReadByte("ByteEA", i);

                for (var j = 0; j < counter[i]; ++j)
                    packet.ReadInt32("Int118", i, j);
            }

            packet.ReadInt32("Int58");
            packet.ReadInt32("Int2E54");
            packet.ReadSingle("Float6C");
            packet.ReadWoWString("String2500", bits2368);
            packet.ReadInt32("Int34");
            packet.ReadWoWString("String19E4", bits1657);
            packet.ReadInt32("Int2E74");

            for (var i = 0; i < 4; ++i)
            {
                packet.ReadInt32("int3001+16", i);
                packet.ReadInt32("int3001+0", i);
            }

            packet.ReadInt32("Int1C");
            packet.ReadSingle("Float68");
            packet.ReadInt32("Int2E28");

            for (var i = 0; i < 5; ++i)
            {
                packet.ReadInt32("int2986+40", i);
                packet.ReadInt32("int2986+0", i);
                packet.ReadInt32("int2986+20", i);
            }

            packet.ReadInt32("Int1BE8");
            packet.ReadInt32("Int2E7C");
            packet.ReadInt32("Int1BF8");
            packet.ReadInt32("Int1BFC");
            packet.ReadInt32("Int2E90");
            packet.ReadInt32("Int2E48");
            packet.ReadWoWString("String74", bits29);
            packet.ReadInt32("Int2E2C");
            packet.ReadInt32("Int2E50");
            packet.ReadInt32("Int2E64");
            packet.ReadInt32("Int1BEC");
            packet.ReadInt32("Int60");
            packet.ReadInt32("Int2E88");
            packet.ReadInt32("Int2E94");
            packet.ReadInt32("Int2E6C");
            packet.ReadInt32("Int14");
            packet.ReadInt32("Int2E20");
            packet.ReadInt32("Int2E30");
            packet.ReadInt32("Int2E24");
            packet.ReadInt32("Int1BF0");
            packet.ReadInt32("Int2E4C");
            packet.ReadInt32("Int2E68");
            packet.ReadInt32("Int20");
            packet.ReadInt32("Int1BF4");
            packet.ReadWoWString("String2100", bits2112);
            packet.ReadInt32("Int2E08");
            packet.ReadInt32("Int38");
            packet.ReadInt32("Int5C");
            packet.ReadWoWString("String2600", bits2432);
            packet.ReadInt32("Int24");
            packet.ReadInt32("Int2E58");
            packet.ReadInt32("Int30");
            packet.ReadInt32("Int64");
            packet.ReadInt32("Int44");
            packet.ReadInt32("Int2E00");
            packet.ReadInt32("Int2E44");
            packet.ReadInt32("Int2EA0");
            packet.ReadInt32("Int28");
            packet.ReadInt32("Int2E1C");
            packet.ReadInt32("Int40");
            packet.ReadWoWString("StringE2C", bits907);
            packet.ReadInt32("Int2E60");
            packet.ReadWoWString("String2000", bits2048);
            packet.ReadInt32("Int2E70");
            packet.ReadInt32("Int2E5C");
            packet.ReadInt32("Int18");
            packet.ReadInt32("Int50");
            packet.ReadInt32("Int1BE4");
            packet.ReadWoWString("String1C00", bits1792);
            packet.ReadInt32("Int3C");
            packet.ReadInt32("Int2C");
            packet.ReadWoWString("String274", bits157);
            packet.ReadInt32("Int48");
            packet.ReadInt32("Int2E80");
            packet.ReadInt32("Int2E40");
            packet.ReadInt32("Int2E9C");
            packet.ReadInt32("Int2E84");
            packet.ReadInt32("Int2E38");
            packet.ReadInt32("Int2E04");
            packet.ReadInt32("Int2E98");
            packet.ReadInt32("Int2E3C");
            packet.ReadInt32("Int2E78");
            packet.ReadInt32("Int70");
            packet.ReadInt32("Int2E8C");

            var id = packet.ReadInt32("Int2F00");

            //packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");
            //Storage.QuestTemplates.Add((uint)id.Key, quest, packet.TimeSpan);
        }
コード例 #9
0
        public static void HandleQuestQueryResponse(Packet packet)
        {
            packet.ReadInt32("Entry");

            Bit hasData = packet.ReadBit("Has Data");
            if (!hasData)
                return; // nothing to do

            var id = packet.ReadEntry("Quest ID");

            QuestTemplate quest = new QuestTemplate
            {
                ID = (uint)id.Key
            };

            quest.QuestType = packet.ReadInt32E<QuestType>("QuestType");
            quest.QuestLevel = packet.ReadInt32("QuestLevel");
            quest.QuestPackageID = packet.ReadUInt32("QuestPackageID");
            quest.MinLevel = packet.ReadInt32("QuestMinLevel");
            quest.QuestSortID = (QuestSort)packet.ReadUInt32("QuestSortID");
            quest.QuestInfoID = packet.ReadInt32E<QuestInfo>("QuestInfoID");
            quest.SuggestedGroupNum = packet.ReadUInt32("SuggestedGroupNum");
            quest.RewardNextQuest = packet.ReadUInt32("RewardNextQuest");
            quest.RewardXPDifficulty = packet.ReadUInt32("RewardXPDifficulty");

            quest.RewardXPMultiplier = packet.ReadSingle("RewardXPMultiplier");

            quest.RewardMoney = packet.ReadInt32("RewardMoney");
            quest.RewardMoneyDifficulty = packet.ReadUInt32("RewardMoneyDifficulty");

            quest.RewardMoneyMultiplier = packet.ReadSingle("RewardMoneyMultiplier");

            quest.RewardBonusMoney = packet.ReadUInt32("RewardBonusMoney");
            quest.RewardDisplaySpell = packet.ReadUInt32("RewardDisplaySpell");
            quest.RewardSpellWod = packet.ReadUInt32("RewardSpell");
            quest.RewardHonorWod = packet.ReadUInt32("RewardHonor");

            quest.RewardKillHonor = packet.ReadSingle("RewardKillHonor");

            quest.StartItem = packet.ReadUInt32("StartItem");
            quest.Flags = packet.ReadUInt32E<QuestFlags>("Flags");
            quest.FlagsEx = packet.ReadUInt32E<QuestFlags2>("FlagsEx");

            quest.RewardItem = new uint?[4];
            quest.RewardAmount = new uint?[4];
            quest.ItemDrop = new uint?[4];
            quest.ItemDropQuantity = new uint?[4];
            for (int i = 0; i < 4; ++i)
            {
                quest.RewardItem[i] = packet.ReadUInt32("RewardItems", i);
                quest.RewardAmount[i] = packet.ReadUInt32("RewardAmount", i);
                quest.ItemDrop[i] = packet.ReadUInt32("ItemDrop", i);
                quest.ItemDropQuantity[i] = packet.ReadUInt32("ItemDropQuantity", i);
            }

            quest.RewardChoiceItemID = new uint?[6];
            quest.RewardChoiceItemQuantity = new uint?[6];
            quest.RewardChoiceItemDisplayID = new uint?[6];
            for (int i = 0; i < 6; ++i) // CliQuestInfoChoiceItem
            {
                quest.RewardChoiceItemID[i] = packet.ReadUInt32("RewardChoiceItemID", i);
                quest.RewardChoiceItemQuantity[i] = packet.ReadUInt32("RewardChoiceItemQuantity", i);
                quest.RewardChoiceItemDisplayID[i] = packet.ReadUInt32("RewardChoiceItemDisplayID", i);
            }

            quest.POIContinent = packet.ReadUInt32("POIContinent");

            quest.POIx = packet.ReadSingle("POIx");
            quest.POIy = packet.ReadSingle("POIy");

            quest.POIPriorityWod = packet.ReadInt32("POIPriority");
            quest.RewardTitle = packet.ReadUInt32("RewardTitle");
            quest.RewardTalents = packet.ReadUInt32("RewardTalents");
            quest.RewardArenaPoints = packet.ReadUInt32("RewardArenaPoints");
            quest.RewardSkillLineID = packet.ReadUInt32("RewardSkillLineID");
            quest.RewardNumSkillUps = packet.ReadUInt32("RewardNumSkillUps");
            quest.QuestGiverPortrait = packet.ReadUInt32("PortraitGiver");
            quest.QuestTurnInPortrait = packet.ReadUInt32("PortraitTurnIn");

            quest.RewardFactionID = new uint?[5];
            quest.RewardFactionValue = new int?[5];
            quest.RewardFactionOverride = new int?[5];
            for (int i = 0; i < 5; ++i)
            {
                quest.RewardFactionID[i] = packet.ReadUInt32("RewardFactionID", i);
                quest.RewardFactionValue[i] = packet.ReadInt32("RewardFactionValue", i);
                quest.RewardFactionOverride[i] = packet.ReadInt32("RewardFactionOverride", i);
            }

            quest.RewardFactionFlags = packet.ReadUInt32("RewardFactionFlags");

            quest.RewardCurrencyID = new uint?[4];
            quest.RewardCurrencyCount = new uint?[4];
            for (int i = 0; i < 4; ++i)
            {
                quest.RewardCurrencyID[i] = packet.ReadUInt32("RewardCurrencyID");
                quest.RewardCurrencyCount[i] = packet.ReadUInt32("RewardCurrencyQty");
            }

            quest.SoundAccept = packet.ReadUInt32("AcceptedSoundKitID");
            quest.SoundTurnIn = packet.ReadUInt32("CompleteSoundKitID");
            quest.AreaGroupID = packet.ReadUInt32("AreaGroupID");
            quest.TimeAllowed = packet.ReadUInt32("TimeAllowed");
            uint int2946 = packet.ReadUInt32("CliQuestInfoObjective");
            quest.AllowableRacesWod = packet.ReadInt32("AllowableRaces");

            for (int i = 0; i < int2946; ++i)
            {
                var objectiveId = packet.ReadEntry("Id", i);

                QuestObjective questInfoObjective = new QuestObjective
                {
                    ID = (uint)objectiveId.Key,
                    QuestID = (uint)id.Key
                };
                questInfoObjective.Type = packet.ReadByteE<QuestRequirementType>("Quest Requirement Type", i);
                questInfoObjective.StorageIndex = packet.ReadSByte("StorageIndex", i);
                questInfoObjective.ObjectID = packet.ReadInt32("ObjectID", i);
                questInfoObjective.Amount = packet.ReadInt32("Amount", i);
                questInfoObjective.Flags = packet.ReadUInt32("Flags", i);
                questInfoObjective.ProgressBarWeight = packet.ReadSingle("ProgressBarWeight", i);

                int int280 = packet.ReadInt32("VisualEffects", i);
                for (int j = 0; j < int280; ++j)
                {
                    QuestVisualEffect questVisualEffect = new QuestVisualEffect
                    {
                        ID = questInfoObjective.ID,
                        Index = (uint) j,
                        VisualEffect = packet.ReadInt32("VisualEffectId", i, j)
                    };

                    Storage.QuestVisualEffects.Add(questVisualEffect, packet.TimeSpan);
                }

                packet.ResetBitReader();

                uint bits6 = packet.ReadBits(8);
                questInfoObjective.Description = packet.ReadWoWString("Description", bits6, i);

                if (BinaryPacketReader.GetLocale() != LocaleConstant.enUS && questInfoObjective.Description != string.Empty)
                {
                    QuestObjectivesLocale localesQuestObjectives = new QuestObjectivesLocale
                    {
                        ID = (uint)objectiveId.Key,
                        Locale = BinaryPacketReader.GetClientLocale(),
                        QuestId = (uint)id.Key,
                        StorageIndex = questInfoObjective.StorageIndex,
                        Description = questInfoObjective.Description
                    };

                    Storage.LocalesQuestObjectives.Add(localesQuestObjectives, packet.TimeSpan);
                }

                Storage.QuestObjectives.Add(questInfoObjective, packet.TimeSpan);
            }

            packet.ResetBitReader();

            uint bits26 = packet.ReadBits(9);
            uint bits154 = packet.ReadBits(12);
            uint bits904 = packet.ReadBits(12);
            uint bits1654 = packet.ReadBits(9);
            uint bits1789 = packet.ReadBits(10);
            uint bits2045 = packet.ReadBits(8);
            uint bits2109 = packet.ReadBits(10);
            uint bits2365 = packet.ReadBits(8);
            uint bits2429 = packet.ReadBits(11);

            quest.LogTitle = packet.ReadWoWString("LogTitle", bits26);
            quest.LogDescription = packet.ReadWoWString("LogDescription", bits154);
            quest.QuestDescription = packet.ReadWoWString("QuestDescription", bits904);
            quest.AreaDescription = packet.ReadWoWString("AreaDescription", bits1654);
            quest.QuestGiverTextWindow = packet.ReadWoWString("PortraitGiverText", bits1789);
            quest.QuestGiverTargetName = packet.ReadWoWString("PortraitGiverName", bits2045);
            quest.QuestTurnTextWindow = packet.ReadWoWString("PortraitTurnInText", bits2109);
            quest.QuestTurnTargetName = packet.ReadWoWString("PortraitTurnInName", bits2365);
            quest.QuestCompletionLog = packet.ReadWoWString("QuestCompletionLog", bits2429);

            if (BinaryPacketReader.GetLocale() != LocaleConstant.enUS)
            {
                LocalesQuest localesQuest = new LocalesQuest
                {
                    ID = (uint)id.Key,
                    Locale = BinaryPacketReader.GetClientLocale(),
                    LogTitle            = quest.LogTitle,
                    LogDescription      = quest.LogDescription,
                    QuestDescription    = quest.QuestDescription,
                    AreaDescription     = quest.AreaDescription,
                    PortraitGiverText   = quest.QuestGiverTextWindow,
                    PortraitGiverName   = quest.QuestGiverTargetName,
                    PortraitTurnInText  = quest.QuestTurnTextWindow,
                    PortraitTurnInName  = quest.QuestTurnTargetName,
                    QuestCompletionLog  = quest.QuestCompletionLog
                };

                Storage.LocalesQuests.Add(localesQuest, packet.TimeSpan);
            }

            Storage.QuestTemplates.Add(quest, packet.TimeSpan);
        }
コード例 #10
0
ファイル: QuestHandler.cs プロジェクト: Subv/WowPacketParser
        public static void HandleQuestQueryResponse(Packet packet)
        {
            var id = packet.ReadEntry("Quest ID");
            if (id.Value) // entry is masked
                return;

            var quest = new QuestTemplate();

            quest.Method = packet.ReadEnum<QuestMethod>("Method", TypeCode.Int32);

            quest.Level = packet.ReadInt32("Level");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.MinLevel = packet.ReadInt32("Min Level");

            quest.ZoneOrSort = packet.ReadEnum<QuestSort>("Sort", TypeCode.Int32);

            quest.Type = packet.ReadEnum<QuestType>("Type", TypeCode.Int32);

            quest.SuggestedPlayers = packet.ReadUInt32("Suggested Players");

            quest.RequiredFactionId = new uint[2];
            quest.RequiredFactionValue = new int[2];
            for (var i = 0; i < 2; i++)
            {
                quest.RequiredFactionId[i] = packet.ReadUInt32("Required Faction ID", i);
                quest.RequiredFactionValue[i] = packet.ReadInt32("Required Faction Rep", i);
            }

            quest.NextQuestId = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Quest, "Next Chain Quest");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardXPId = packet.ReadUInt32("Quest XP ID");

            quest.RewardOrRequiredMoney = packet.ReadInt32("Reward/Required Money");

            quest.RewardMoneyMaxLevel = packet.ReadUInt32("Reward Money Max Level");

            quest.RewardSpell = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Reward Spell");

            quest.RewardSpellCast = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Spell, "Reward Spell Cast");

            quest.RewardHonor = packet.ReadUInt32("Reward Honor");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardHonorMultiplier = packet.ReadSingle("Reward Honor Multiplier");

            quest.SourceItemId = packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Source Item ID");

            quest.Flags = packet.ReadEnum<QuestFlags>("Flags", TypeCode.Int32);

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545)) // Not sure when this was added
            quest.TargetMark = packet.ReadUInt32("Minimap Target Mark"); // missing enum

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V2_4_0_8089))
                quest.RewardTitleId = packet.ReadUInt32("Reward Title ID");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056))
            {
                quest.RequiredPlayerKills = packet.ReadUInt32("Required Player Kills");
                quest.RewardTalents = packet.ReadUInt32("Bonus Talents");
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.RewardArenaPoints = packet.ReadUInt32("Bonus Arena Points");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_0_14333)) // Probably added earlier
            {
                quest.RewardSkillId = packet.ReadUInt32("RewSkillId");
                quest.RewardSkillPoints = packet.ReadUInt32("RewSkillPoints");
                quest.RewardReputationMask = packet.ReadUInt32("RewRepMask");
                quest.QuestGiverPortrait = packet.ReadUInt32("QuestGiverPortrait");
                quest.QuestTurnInPortrait = packet.ReadUInt32("QuestTurnInPortrait");
            }

            quest.RewardItemId = new uint[4];
            quest.RewardItemCount = new uint[4];
            for (var i = 0; i < 4; i++)
            {
                quest.RewardItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Reward Item ID", i);
                quest.RewardItemCount[i] = packet.ReadUInt32("Reward Item Count", i);
            }

            quest.RewardChoiceItemId = new uint[6];
            quest.RewardChoiceItemCount = new uint[6];
            for (var i = 0; i < 6; i++)
            {
                quest.RewardChoiceItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Reward Choice Item ID", i);
                quest.RewardChoiceItemCount[i] = packet.ReadUInt32("Reward Choice Item Count", i);
            }

            const int repCount = 5;
            quest.RewardFactionId = new uint[repCount];
            quest.RewardReputationId = new int[repCount];
            quest.RewardReputationIdOverride = new uint[repCount];
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
            {
                for (var i = 0; i < repCount; i++)
                    quest.RewardFactionId[i] = packet.ReadUInt32("Reward Faction ID", i);

                for (var i = 0; i < repCount; i++)
                    quest.RewardReputationId[i] = packet.ReadInt32("Reward Reputation ID", i);

                for (var i = 0; i < repCount; i++)
                    quest.RewardReputationIdOverride[i] = packet.ReadUInt32("Reward Reputation ID Override", i);
            }

            quest.PointMapId = packet.ReadUInt32("Point Map ID");

            quest.PointX = packet.ReadSingle("Point X");

            quest.PointY = packet.ReadSingle("Point Y");

            quest.PointOption = packet.ReadUInt32("Point Opt");

            quest.Title = packet.ReadCString("Title");

            quest.Objectives = packet.ReadCString("Objectives");

            quest.Details = packet.ReadCString("Details");

            quest.EndText = packet.ReadCString("End Text");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                quest.ReturnText = packet.ReadCString("Return Text");

            var reqId = new KeyValuePair<int, bool>[4];
            quest.RequiredNpcOrGo = new int[4];
            quest.RequiredNpcOrGoCount = new uint[4];
            quest.RequiredSourceItemId = new uint[4];
            quest.RequiredSourceItemCount = new uint[4];
            var reqItemFieldCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464) ? 6 : 4;
            quest.RequiredItemId = new uint[reqItemFieldCount];
            quest.RequiredItemCount = new uint[reqItemFieldCount];

            for (var i = 0; i < 4; i++)
            {
                reqId[i] = packet.ReadEntry();
                quest.RequiredNpcOrGo[i] = reqId[i].Key;
                var isGO = reqId[i].Value;

                packet.Writer.WriteLine("[" + i + "] Required " + (isGO ? "GO" : "NPC") +
                    " ID: " + StoreGetters.GetName(isGO ? StoreNameType.GameObject : StoreNameType.Unit, reqId[i].Key));

                quest.RequiredNpcOrGoCount[i] = packet.ReadUInt32("Required Count", i);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056))
                    quest.RequiredSourceItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Required Source Item ID", i);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958))
                    quest.RequiredSourceItemCount[i] = packet.ReadUInt32("Source Item Count", i);

                if (ClientVersion.RemovedInVersion(ClientVersionBuild.V3_0_8_9464))
                {
                    quest.RequiredItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Required Item ID", i);
                    quest.RequiredItemCount[i] = packet.ReadUInt32("Required Item Count", i);
                }
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464))
            {
                for (var i = 0; i < reqItemFieldCount; i++)
                {
                    quest.RequiredItemId[i] = (uint) packet.ReadEntryWithName<Int32>(StoreNameType.Item, "Required Item ID", i);
                    quest.RequiredItemId[i] = packet.ReadUInt32("Required Item Count", i);
                }
            }

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_0_14333)) // Probably earlier
                quest.RequiredSpell = (uint) packet.ReadEntryWithName<UInt32>(StoreNameType.Spell, "Required Spell");

            quest.ObjectiveTexts = new string[4];
            for (var i = 0; i < 4; i++)
                quest.ObjectiveTexts[i] = packet.ReadCString("Objective Text", i);

            quest.RewardCurrencyId = new uint[4];
            quest.RewardCurrencyCount = new uint[4];
            quest.RequiredCurrencyId = new uint[4];
            quest.RequiredCurrencyCount = new uint[4];
            if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_0_14333))
            {
                for (var i = 0; i < 4; ++i)
                {
                    quest.RewardCurrencyId[i] = packet.ReadUInt32("Reward Currency ID", i);
                    quest.RewardCurrencyCount[i] = packet.ReadUInt32("Reward Currency Count", i);
                }

                for (var i = 0; i < 4; ++i)
                {
                    quest.RequiredCurrencyId[i] = packet.ReadUInt32("Required Currency ID", i);
                    quest.RequiredCurrencyCount[i] = packet.ReadUInt32("Required Currency Count", i);
                }

                quest.QuestGiverTextWindow = packet.ReadCString("QuestGiver Text Window");
                quest.QuestGiverTextName = packet.ReadCString("QuestGiver Target Name");
                quest.QuestTurnTextWindow = packet.ReadCString("QuestTurn Text Window");
                quest.QuestTurnTargetName = packet.ReadCString("QuestTurn Target Name");

                quest.SoundAccept = packet.ReadUInt32("Sound Accept");
                quest.SoundTurnIn = packet.ReadUInt32("Sound TurnIn");
            }

            Stuffing.QuestTemplates.TryAdd((uint) id.Key, quest);
        }
コード例 #11
0
        public static void HandleQuestQueryResponse510(Packet packet)
        {
            var hasData = packet.ReadBit();
            if (!hasData)
            {
                packet.ReadUInt32("Entry");
                return; // nothing to do
            }

            var quest = new QuestTemplate();

            var questTurnTextWindow = (int)packet.ReadBits(10);
            var details = (int)packet.ReadBits(12);
            var questGiverTextWindow = (int)packet.ReadBits(10);
            var len1658 = (int)packet.ReadBits(9);
            var completedText = (int)packet.ReadBits(11);
            var len158 = (int)packet.ReadBits(12);
            var questGiverTargetName = (int)packet.ReadBits(8);
            var title = (int)packet.ReadBits(9);
            var questTurnTargetName = (int)packet.ReadBits(8);
            var count = (int)packet.ReadBits("Requirement Count", 19);

            var len294920 = new int[count];
            var counter = new int[count];
            for (var i = 0; i < count; ++i)
            {
                len294920[i] = (int)packet.ReadBits(8);
                counter[i] = (int)packet.ReadBits(22);
            }
            packet.ResetBitReader();

            for (var i = 0; i < count; ++i)
            {
                packet.ReadWoWString("string2949+20", len294920[i], i);
                packet.ReadInt32("int2949+16", i);
                packet.ReadByte("byte2949+5", i);
                packet.ReadByte("byte2949+4", i);
                packet.ReadInt32("int2949+12", i);

                for (var j = 0; j < counter[i]; ++j)
                    packet.ReadInt32("Unk UInt32", i, j);

                packet.ReadInt32("Unk UInt32", i);
                packet.ReadInt32("int2949+8", i);
            }

            packet.ReadWoWString("string158", len158);
            quest.NextQuestIdChain = (uint)packet.ReadInt32<QuestId>("Next Chain Quest");
            packet.ReadInt32("int2971");
            quest.RewardSpellCast = packet.ReadInt32<SpellId>("Reward Spell Cast");
            packet.ReadInt32("int2955");
            quest.RewardHonorMultiplier = packet.ReadSingle("Reward Honor Multiplier");
            packet.ReadInt32("int2970");
            packet.ReadInt32("int2984");
            packet.ReadInt32("int2979");
            quest.MinLevel = packet.ReadInt32("Min Level");
            quest.RewardSkillPoints = packet.ReadUInt32("RewSkillPoints");
            quest.QuestGiverPortrait = packet.ReadUInt32("QuestGiverPortrait");
            packet.ReadInt32("int21");
            quest.Type = packet.ReadInt32E<QuestType>("Type");
            for (var i = 0; i < 5; ++i)
            {
                packet.ReadInt32("int2986+40");
                packet.ReadInt32("int2986+0");
                packet.ReadInt32("int2986+20");
            }

            packet.ReadInt32("int2960");
            for (var i = 0; i < 4; ++i)
            {
                packet.ReadInt32("int3001+16");
                packet.ReadInt32("int3001+0");
            }
            quest.SuggestedPlayers = packet.ReadUInt32("Suggested Players");
            packet.ReadInt32("int2972");
            packet.ReadInt32("int2959");
            quest.Title = packet.ReadWoWString("Title", title);
            packet.ReadInt32("int2965");
            packet.ReadInt32("int2978");
            quest.RewardSkillId = packet.ReadUInt32("RewSkillId");
            packet.ReadInt32("int2982");
            packet.ReadInt32("int2968");
            packet.ReadInt32("int2964");
            packet.ReadInt32("int2957");
            packet.ReadInt32("int2969");
            packet.ReadInt32("int1786");
            quest.SoundAccept = packet.ReadUInt32("Sound Accept");
            packet.ReadInt32("int2981");
            packet.ReadInt32("int2961");
            packet.ReadInt32("int15");
            packet.ReadInt32("int2967");
            quest.CompletedText = packet.ReadWoWString("Completed Text", completedText);
            packet.ReadInt32("int25");
            packet.ReadInt32("Quest Id");
            quest.PointY = packet.ReadSingle("Point Y");
            packet.ReadInt32("int2974");
            packet.ReadInt32("int2952");
            quest.Details = packet.ReadWoWString("Details", details);
            quest.Level = packet.ReadInt32("Level");
            quest.PointMapId = packet.ReadUInt32("Point Map ID");
            packet.ReadWoWString("string1658", len1658);
            quest.PointX = packet.ReadSingle("Point X");
            packet.ReadInt32("int17");
            packet.ReadInt32("int2962");
            quest.QuestGiverTextWindow = packet.ReadWoWString("QuestGiver Text Window", questGiverTextWindow);
            packet.ReadInt32("int2963");
            packet.ReadInt32("int2985");
            quest.Method = packet.ReadInt32E<QuestMethod>("Method");
            quest.RewardReputationMask = packet.ReadUInt32("RewRepMask");
            packet.ReadInt32("int2953");
            packet.ReadInt32("int2983");
            packet.ReadInt32("int9");
            quest.QuestGiverTargetName = packet.ReadWoWString("QuestGiver Target Name", questGiverTargetName);
            quest.ZoneOrSort = packet.ReadInt32E<QuestSort>("Sort");
            packet.ReadInt32("int1788");
            quest.SoundTurnIn = packet.ReadUInt32("Sound TurnIn");
            quest.SourceItemId = packet.ReadUInt32<ItemId>("Source Item ID");
            quest.QuestTurnTargetName = packet.ReadWoWString("QuestTurn Target Name", questTurnTargetName);
            quest.QuestTurnInPortrait = packet.ReadUInt32("QuestTurnInPortrait");
            quest.Flags = packet.ReadUInt32E<QuestFlags>("Flags");
            packet.ReadInt32("int2954");
            packet.ReadInt32("int2958");
            quest.RewardMoneyMaxLevel = packet.ReadUInt32("Reward Money Max Level");
            packet.ReadInt32("int1787");
            quest.QuestTurnTextWindow = packet.ReadWoWString("QuestTurn Text Window", questTurnTextWindow);
            packet.ReadInt32("int2977");
            packet.ReadInt32("int2980");
            packet.ReadInt32("int2975");
            quest.RewardSpell = (uint)packet.ReadInt32<SpellId>("Reward Spell");
            quest.RewardOrRequiredMoney = packet.ReadInt32("Reward Money");
            packet.ReadInt32("int2973");
            packet.ReadInt32("int2966");
            packet.ReadInt32("int2976");
            quest.PointOption = packet.ReadUInt32("Point Opt");
            packet.ReadInt32("int2956");

            var id = packet.ReadEntry("Quest ID");

            packet.AddSniffData(StoreNameType.Quest, id.Key, "QUERY_RESPONSE");
            Storage.QuestTemplates.Add((uint)id.Key, quest, packet.TimeSpan);
        }