Exemple #1
0
        public static void HandleQuestQueryResponse(Packet packet)
        {
            Quest q = new Quest();

            q.Entry    = packet.ReadInt32("Entry");
            q.Method   = packet.ReadEnum <QuestMethod>("Method");
            q.Level    = packet.ReadInt32("Level");
            q.MinLevel = packet.ReadInt32("MinLevel");
            var sort = packet.ReadInt32();

            if (sort >= 0)
            {
                Console.WriteLine("Zone: {0}", sort);
            }
            else
            {
                Console.WriteLine("Sort: {0}", (QuestSort)(-sort));
            }
            q.ZoneOrSort            = sort;
            q.Type                  = packet.ReadEnum <QuestType>("Type");
            q.SuggestedPlayers      = packet.ReadInt32("SuggestedPlayers");
            q.RepObjectiveFaction1  = packet.ReadInt32("RepObjFaction1");
            q.RepObjectiveValue1    = packet.ReadInt32("RepObjValue1");
            q.RepObjectiveFaction2  = packet.ReadInt32("RepObjFaction2");
            q.RepObjectiveValue2    = packet.ReadInt32("RepObjValue2");
            q.NextQuestID           = packet.ReadInt32("NextQuestID");
            q.XPID                  = packet.ReadInt32("XPID");
            q.RewardMoney           = packet.ReadInt32("Money");
            q.RewardMoneyAtMaxLevel = packet.ReadInt32("MoneyAtMaxLevel");
            q.Spell                 = packet.ReadInt32("Spell");
            q.SpellCast             = packet.ReadInt32("SpellCast");
            q.Honor                 = packet.ReadInt32("Honor");
            q.HonorMultiplier       = packet.ReadSingle("Honor (2)");
            q.SourceItemID          = packet.ReadInt32("Source Item ID");
            q.Flags                 = packet.ReadEnum <QuestFlag>("Flags");
            q.Unk                   = packet.ReadInt32("Unk");
            q.RewardTitleID         = packet.ReadInt32("RewardTitleID");
            q.PlayersSlain          = packet.ReadInt32("PlayersSlain");
            q.RewardTalentPoints    = packet.ReadInt32("RewardTalentPoints");
            q.RewardArenaPoints     = packet.ReadInt32("RewardArenaPoints");
            q.RewardSkillLineID     = packet.ReadInt32("RewardSkillLineID");
            q.RewardSkillPoints     = packet.ReadInt32("RewardSkillPoints");
            q.RewardFactionMask     = packet.ReadInt32("RewardFactionMask");
            q.QuestGiverPortraitID  = packet.ReadInt32("QuestGiverPortraitID");
            q.QuestTurnInPortraitID = packet.ReadInt32("QuestTurnInPortraitID");
            for (int i = 0; i < 4; i++)
            {
                q.RewardItem[i]      = packet.ReadInt32("RewardItem[" + i + "]");
                q.RewardItemCount[i] = packet.ReadInt32("RewardItemCount[" + i + "]");
            }
            for (int i = 0; i < 6; i++)
            {
                q.RewardItemChoice[i]      = packet.ReadInt32("RewardItemChoice[" + i + "]");
                q.RewardItemChoiceCount[i] = packet.ReadInt32("RewardItemChoiceCount[" + i + "]");
            }
            for (int i = 0; i < 5; i++)
            {
                q.RewardRepFactionID[i] = packet.ReadInt32("RewardRepFactionID[" + i + "]");
            }
            for (int i = 0; i < 5; i++)
            {
                q.RewardRepValueID[i] = packet.ReadInt32("RewardRepValueID[" + i + "]");
            }
            for (int i = 0; i < 5; i++)
            {
                q.RewardRepValue[i] = packet.ReadInt32("RewardRepValue[" + i + "]");
            }
            q.PointMapID     = packet.ReadInt32("PointMapID");
            q.PointX         = packet.ReadSingle("PointX");
            q.PointY         = packet.ReadSingle("PointY");
            q.PointOption    = packet.ReadInt32("PointOption");
            q.Title          = packet.ReadCString("Title");
            q.ObjectiveText  = packet.ReadCString("ObjectiveText");
            q.Description    = packet.ReadCString("Description");
            q.EndText        = packet.ReadCString("EndText");
            q.CompletionText = packet.ReadCString("CompletionText");
            for (int i = 0; i < 4; i++)
            {
                q.RequiredCreatureOrGOID[i]    = packet.ReadInt32("RequiredCreatureOrGOID[" + i + "]");
                q.RequiredCreatureOrGOCount[i] = packet.ReadInt32("RequiredCreatureOrGOCount[" + i + "]");
                q.ItemDropIntermediateID[i]    = packet.ReadInt32("ItemDropIntermediateID[" + i + "]");
                q.ItemDropIntermediateCount[i] = packet.ReadInt32("ItemDropIntermediateCount[" + i + "]");
            }
            for (int i = 0; i < 6; i++)
            {
                q.RequiredItemID[i]    = packet.ReadInt32("RequiredItemID[" + i + "]");
                q.RequiredItemCount[i] = packet.ReadInt32("RequiredItemCount[" + i + "]");
            }
            q.CriteriaSpellID = packet.ReadInt32("CriteriaSpellID");
            for (int i = 0; i < 4; i++)
            {
                q.ObjectiveTexts[i] = packet.ReadCString("ObjectiveTexts[" + i + "]");
            }
            for (int i = 0; i < 4; i++)
            {
                q.RewardCurrencyID[i]    = packet.ReadInt32("RewardCurrencyID[" + i + "]");
                q.RewardCurrencyValue[i] = packet.ReadInt32("RewardCurrencyValue[" + i + "]");
            }
            for (int i = 0; i < 4; i++)
            {
                q.RequiredCurrencyID[i]    = packet.ReadInt32("RequiredCurrencyID[" + i + "]");
                q.RequiredCurrencyValue[i] = packet.ReadInt32("RequiredCurrencyValue[" + i + "]");
            }
            q.QuestGiverPortraitText  = packet.ReadCString("QuestGiverPortraitText");
            q.QuestGiverPortraitUnk   = packet.ReadCString("QuestGiverPortraitUnk");
            q.QuestTurnInPortraitText = packet.ReadCString("QuestTurnInPortraitText");
            q.QuestTurnInPortraitUnk  = packet.ReadCString("QuestTurnInPortrainUnk");
            q.SoundField1             = packet.ReadInt32("Sound field 1");
            q.SoundField2             = packet.ReadInt32("Sound field 2");
            QuestStorage.GetSingleton().Add(q);
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            CmdLine = new CommandLine(args);

            string file;
            string loader;
            string nodump;
            string nohex;
            string tosql;
            string skiplarge;
            bool   _toSQL = false;

            try
            {
                file      = CmdLine.GetValue("-file");
                loader    = CmdLine.GetValue("-loader");
                nodump    = CmdLine.GetValue("-nodump");
                nohex     = CmdLine.GetValue("-nohex");
                tosql     = CmdLine.GetValue("-tosql");
                skiplarge = CmdLine.GetValue("-skiplarge");
                if (tosql.Equals(bool.TrueString, StringComparison.InvariantCultureIgnoreCase))
                {
                    _toSQL = true;
                }
            }
            catch (IndexOutOfRangeException)
            {
                PrintUsage("All command line options require an argument.");
                return;
            }

            try
            {
                var packets = Reader.Read(loader, file);
                if (packets == null)
                {
                    PrintUsage("Could not open file " + file + " for reading.");
                    return;
                }

                if (packets.Count() > 0)
                {
                    var fullPath = Utilities.GetPathFromFullPath(file);
                    Handler.InitializeLogFile(Path.Combine(fullPath, file + ".txt"), nodump, nohex, skiplarge);

                    foreach (var packet in packets)
                    {
                        Handler.Parse(packet);
                    }
                    Handler.WriteToFile();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.GetType());
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }

            Console.ResetColor();
            if (_toSQL)
            {
                var fullPath = Utilities.GetPathFromFullPath(file);
                QuestStorage.GetSingleton().Output(Path.Combine(fullPath, file + "_questcache.sql"));
                CreatureStorage.GetSingleton().Output(Path.Combine(fullPath, file + "_creaturecache.sql"));
                GameObjectStorage.GetSingleton().Output(Path.Combine(fullPath, file + "_gameobjectcache.sql"));
                CreatureTemplateUpdateStorage.GetSingleton().Output(Path.Combine(fullPath, file + "_creaturecacheupdates.sql"));
                CreatureSpawnStorage   css = CreatureSpawnStorage.GetSingleton();
                GameObjectSpawnStorage gss = GameObjectSpawnStorage.GetSingleton();
                Dictionary <int, Dictionary <Guid, WowObject> > dict = ObjectHandler.Objects;
                foreach (int map in dict.Keys)
                {
                    Dictionary <Guid, WowObject> objectsInMap = dict[map];
                    foreach (Guid guid in objectsInMap.Keys)
                    {
                        WowObject obj = objectsInMap[guid];
                        if (obj.Type == ObjectType.Unit)
                        {
                            CreatureSpawn spawn = new CreatureSpawn();
                            spawn.Entry = guid.GetEntry();
                            spawn.Map   = map;
                            spawn.X     = obj.Position.X;
                            spawn.Y     = obj.Position.Y;
                            spawn.Z     = obj.Position.Z;
                            spawn.O     = obj.Movement.Orientation;
                            css.Add(spawn);
                        }
                        else if (obj.Type == ObjectType.GameObject)
                        {
                            GameObjectSpawn spawn = new GameObjectSpawn();
                            spawn.Entry = guid.GetEntry();
                            spawn.Map   = map;
                            spawn.X     = obj.Position.X;
                            spawn.Y     = obj.Position.Y;
                            spawn.Z     = obj.Position.Z;
                            spawn.O     = obj.Movement.Orientation;
                            gss.Add(spawn);
                        }
                    }
                }
                css.Output(Path.Combine(fullPath, file + "_creaturesniffedspawns.sql"));
                gss.Output(Path.Combine(fullPath, file + "_gameobjectsniffedspawns.sql"));
            }
        }