Exemplo n.º 1
0
        public void SendQuestGiverQuestListMessage(WorldObject questgiver)
        {
            ObjectGuid guid           = questgiver.GetGUID();
            Locale     localeConstant = _session.GetSessionDbLocaleIndex();

            QuestGiverQuestListMessage questList = new QuestGiverQuestListMessage();

            questList.QuestGiverGUID = guid;

            QuestGreeting questGreeting = Global.ObjectMgr.GetQuestGreeting(questgiver.GetTypeId(), questgiver.GetEntry());

            if (questGreeting != null)
            {
                questList.GreetEmoteDelay = questGreeting.EmoteDelay;
                questList.GreetEmoteType  = questGreeting.EmoteType;
                questList.Greeting        = questGreeting.Text;

                if (localeConstant != Locale.enUS)
                {
                    QuestGreetingLocale questGreetingLocale = Global.ObjectMgr.GetQuestGreetingLocale(questgiver.GetTypeId(), questgiver.GetEntry());
                    if (questGreetingLocale != null)
                    {
                        ObjectManager.GetLocaleString(questGreetingLocale.Greeting, localeConstant, ref questList.Greeting);
                    }
                }
            }

            for (var i = 0; i < _questMenu.GetMenuItemCount(); ++i)
            {
                QuestMenuItem questMenuItem = _questMenu.GetItem(i);

                uint  questID = questMenuItem.QuestId;
                Quest quest   = Global.ObjectMgr.GetQuestTemplate(questID);
                if (quest != null)
                {
                    ClientGossipText text = new ClientGossipText();
                    text.QuestID         = questID;
                    text.ContentTuningID = quest.ContentTuningId;
                    text.QuestType       = questMenuItem.QuestIcon;
                    text.QuestFlags      = (uint)quest.Flags;
                    text.QuestFlagsEx    = (uint)quest.FlagsEx;
                    text.Repeatable      = quest.IsRepeatable();
                    text.QuestTitle      = quest.LogTitle;

                    if (localeConstant != Locale.enUS)
                    {
                        QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id);
                        if (localeData != null)
                        {
                            ObjectManager.GetLocaleString(localeData.LogTitle, localeConstant, ref text.QuestTitle);
                        }
                    }

                    questList.QuestDataText.Add(text);
                }
            }

            _session.SendPacket(questList);
        }
Exemplo n.º 2
0
        public void SendQuestGiverQuestListMessage(ObjectGuid guid)
        {
            QuestGiverQuestListMessage questList = new QuestGiverQuestListMessage();

            questList.QuestGiverGUID = guid;

            QuestGreeting questGreeting = Global.ObjectMgr.GetQuestGreeting(guid);

            if (questGreeting != null)
            {
                questList.GreetEmoteDelay = questGreeting.greetEmoteDelay;
                questList.GreetEmoteType  = questGreeting.greetEmoteType;
                questList.Greeting        = questGreeting.greeting;
            }
            else
            {
                Log.outError(LogFilter.Server, "Guid: {0} - No quest greeting found.", guid.ToString());
            }

            for (var i = 0; i < _questMenu.GetMenuItemCount(); ++i)
            {
                QuestMenuItem questMenuItem = _questMenu.GetItem(i);

                uint  questID = questMenuItem.QuestId;
                Quest quest   = Global.ObjectMgr.GetQuestTemplate(questID);
                if (quest != null)
                {
                    string title = quest.LogTitle;

                    LocaleConstant locale = _session.GetSessionDbLocaleIndex();
                    if (locale != LocaleConstant.enUS)
                    {
                        QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id);
                        if (localeData != null)
                        {
                            ObjectManager.GetLocaleString(localeData.LogTitle, locale, ref title);
                        }
                    }

                    GossipText text = new GossipText();
                    text.QuestID              = questID;
                    text.QuestType            = questMenuItem.QuestIcon;
                    text.QuestLevel           = (uint)quest.Level;
                    text.QuestMaxScalingLevel = (uint)quest.MaxScalingLevel;
                    text.QuestFlags           = (uint)quest.Flags;
                    text.QuestFlagsEx         = (uint)quest.FlagsEx;
                    text.Repeatable           = false; // NYI
                    text.QuestTitle           = title;
                    questList.QuestDataText.Add(text);
                }
            }

            _session.SendPacket(questList);
        }
        public static void HandleQuestgiverQuestList(Packet packet)
        {
            WowGuid guid = packet.ReadPackedGuid128("QuestGiverGUID");

            QuestGreeting questGreeting = new QuestGreeting
            {
                ID = guid.GetEntry(),
                GreetEmoteDelay = packet.ReadUInt32("GreetEmoteDelay"),
                GreetEmoteType  = packet.ReadUInt32("GreetEmoteType")
            };

            uint int520 = packet.ReadUInt32("GossipTextCount");

            for (int i = 0; i < int520; i++)
            {
                ReadGossipText(packet, i);
            }

            packet.ResetBitReader();

            uint bits16 = packet.ReadBits(11);

            questGreeting.Greeting = packet.ReadWoWString("Greeting", bits16);

            switch (guid.GetObjectType())
            {
            case ObjectType.Unit:
                questGreeting.Type = 0;
                break;

            case ObjectType.GameObject:
                questGreeting.Type = 1;
                break;
            }

            Storage.QuestGreetings.Add(questGreeting, packet.TimeSpan);

            if (ClientLocale.PacketLocale != LocaleConstant.enUS && questGreeting.Greeting != string.Empty)
            {
                QuestGreetingLocale localesQuestGreeting = new QuestGreetingLocale
                {
                    ID       = questGreeting.ID,
                    Type     = questGreeting.Type,
                    Greeting = questGreeting.Greeting
                };
                Storage.LocalesQuestGreeting.Add(localesQuestGreeting, packet.TimeSpan);
            }
        }
Exemplo n.º 4
0
        public static void HandleQuestgiverQuestList(Packet packet)
        {
            WowGuid guid = packet.ReadPackedGuid128("QuestGiverGUID");

            QuestGreeting questGreeting = new QuestGreeting
            {
                ID = guid.GetEntry(),
                GreetEmoteDelay = packet.ReadUInt32("GreetEmoteDelay"),
                GreetEmoteType  = packet.ReadUInt32("GreetEmoteType")
            };

            uint questsCount = packet.ReadUInt32("GossipQuestsCount");

            packet.ResetBitReader();
            uint greetingLen = packet.ReadBits(12);

            for (int i = 0; i < questsCount; i++)
            {
                V7_0_3_22248.Parsers.NpcHandler.ReadGossipQuestTextData(packet, i, "GossipQuests");
            }

            questGreeting.Greeting = packet.ReadWoWString("Greeting", greetingLen);

            switch (guid.GetObjectType())
            {
            case ObjectType.Unit:
                questGreeting.Type = 0;
                break;

            case ObjectType.GameObject:
                questGreeting.Type = 1;
                break;
            }

            Storage.QuestGreetings.Add(questGreeting, packet.TimeSpan);

            if (ClientLocale.PacketLocale != LocaleConstant.enUS && questGreeting.Greeting != string.Empty)
            {
                QuestGreetingLocale localesQuestGreeting = new QuestGreetingLocale
                {
                    ID       = questGreeting.ID,
                    Type     = questGreeting.Type,
                    Greeting = questGreeting.Greeting
                };
                Storage.LocalesQuestGreeting.Add(localesQuestGreeting, packet.TimeSpan);
            }
        }
Exemplo n.º 5
0
        public static void HandleQuestgiverQuestList(Packet packet)
        {
            var guid = packet.ReadPackedGuid128("QuestGiverGUID");

            var questGreeting = new QuestGreeting
            {
                GreetEmoteDelay = packet.ReadUInt32("GreetEmoteDelay"),
                GreetEmoteType  = packet.ReadUInt32("GreetEmoteType")
            };

            var int520 = packet.ReadUInt32("GossipTextCount");

            for (int i = 0; i < int520; i++)
            {
                ReadGossipText(packet, i);
            }

            packet.ResetBitReader();

            var bits16 = packet.ReadBits(11);

            questGreeting.Greeting = packet.ReadWoWString("Greeting", bits16);

            switch (guid.GetObjectType())
            {
            case ObjectType.Unit:
                questGreeting.Type = 0;
                break;

            case ObjectType.GameObject:
                questGreeting.Type = 1;
                break;
            }

            Storage.QuestGreetings.Add(guid.GetEntry(), questGreeting, packet.TimeSpan);
        }
Exemplo n.º 6
0
        public static void HandleQuestgiverQuestList(Packet packet)
        {
            WowGuid guid = packet.ReadPackedGuid128("QuestGiverGUID");

            QuestGreeting questGreeting = new QuestGreeting
            {
                ID = guid.GetEntry(),
                GreetEmoteDelay = packet.ReadUInt32("GreetEmoteDelay"),
                GreetEmoteType  = packet.ReadUInt32("GreetEmoteType")
            };

            uint gossipTextCount = packet.ReadUInt32("GossipTextCount");

            packet.ResetBitReader();
            uint greetingLen = packet.ReadBits(11);

            for (int i = 0; i < gossipTextCount; i++)
            {
                ReadGossipText(packet, i);
            }

            questGreeting.Greeting = packet.ReadWoWString("Greeting", greetingLen);

            switch (guid.GetObjectType())
            {
            case ObjectType.Unit:
                questGreeting.Type = 0;
                break;

            case ObjectType.GameObject:
                questGreeting.Type = 1;
                break;
            }

            Storage.QuestGreetings.Add(questGreeting, packet.TimeSpan);
        }