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); }
public void SendGossipMenu(uint titleTextId, ObjectGuid objectGUID) { _interactionData.Reset(); _interactionData.SourceGuid = objectGUID; GossipMessagePkt packet = new GossipMessagePkt(); packet.GossipGUID = objectGUID; packet.GossipID = (int)_gossipMenu.GetMenuId(); packet.TextID = (int)titleTextId; foreach (var pair in _gossipMenu.GetMenuItems()) { ClientGossipOptions opt = new ClientGossipOptions(); GossipMenuItem item = pair.Value; opt.ClientOption = (int)pair.Key; opt.OptionNPC = item.MenuItemIcon; opt.OptionFlags = (byte)(item.IsCoded ? 1 : 0); // makes pop up box password opt.OptionCost = (int)item.BoxMoney; // money required to open menu, 2.0.3 opt.Text = item.Message; // text for gossip item opt.Confirm = item.BoxMessage; // accept text (related to money) pop up box, 2.0.3 opt.Status = GossipOptionStatus.Available; packet.GossipOptions.Add(opt); } for (byte i = 0; i < _questMenu.GetMenuItemCount(); ++i) { QuestMenuItem item = _questMenu.GetItem(i); uint questID = item.QuestId; Quest quest = Global.ObjectMgr.GetQuestTemplate(questID); if (quest != null) { ClientGossipText text = new ClientGossipText(); text.QuestID = questID; text.ContentTuningID = quest.ContentTuningId; text.QuestType = item.QuestIcon; text.QuestFlags = (uint)quest.Flags; text.QuestFlagsEx = (uint)quest.FlagsEx; text.Repeatable = quest.IsRepeatable(); text.QuestTitle = quest.LogTitle; Locale locale = _session.GetSessionDbLocaleIndex(); if (locale != Locale.enUS) { QuestTemplateLocale localeData = Global.ObjectMgr.GetQuestLocale(quest.Id); if (localeData != null) { ObjectManager.GetLocaleString(localeData.LogTitle, locale, ref text.QuestTitle); } } packet.GossipText.Add(text); } } _session.SendPacket(packet); }
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 void AddMenuItem(uint QuestId, byte Icon) { if (Global.ObjectMgr.GetQuestTemplate(QuestId) == null) { return; } QuestMenuItem questMenuItem = new QuestMenuItem(); questMenuItem.QuestId = QuestId; questMenuItem.QuestIcon = Icon; _questMenuItems.Add(questMenuItem); }