Beispiel #1
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);
        }
Beispiel #2
0
        public void SendQuestGiverQuestListMessage(WorldObject questgiver)
        {
            ObjectGuid     guid           = questgiver.GetGUID();
            LocaleConstant 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 != LocaleConstant.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)
                {
                    string title = quest.LogTitle;

                    if (localeConstant != LocaleConstant.enUS)
                    {
                        QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id);
                        if (localeData != null)
                        {
                            ObjectManager.GetLocaleString(localeData.LogTitle, localeConstant, 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);
        }