本文整理汇总了C++中AddQuestLevelToTitle函数的典型用法代码示例。如果您正苦于以下问题:C++ AddQuestLevelToTitle函数的具体用法?C++ AddQuestLevelToTitle怎么用?C++ AddQuestLevelToTitle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AddQuestLevelToTitle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddQuestLevelToTitle
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, ObjectGuid npcGUID, bool enableNext) const
{
std::string questTitle = quest->GetLogTitle();
std::string questOfferRewardText = quest->GetOfferRewardText();
std::string portraitGiverText = quest->GetPortraitGiverText();
std::string portraitGiverName = quest->GetPortraitGiverName();
std::string portraitTurnInText = quest->GetPortraitTurnInText();
std::string portraitTurnInName = quest->GetPortraitTurnInName();
LocaleConstant locale = _session->GetSessionDbLocaleIndex();
if (locale >= LOCALE_enUS)
{
if (QuestTemplateLocale const* questTemplateLocale = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(questTemplateLocale->LogTitle, locale, questTitle);
ObjectMgr::GetLocaleString(questTemplateLocale->OfferRewardText, locale, questOfferRewardText);
ObjectMgr::GetLocaleString(questTemplateLocale->PortraitGiverText, locale, portraitGiverText);
ObjectMgr::GetLocaleString(questTemplateLocale->PortraitGiverName, locale, portraitGiverName);
ObjectMgr::GetLocaleString(questTemplateLocale->PortraitTurnInText, locale, portraitTurnInText);
ObjectMgr::GetLocaleString(questTemplateLocale->PortraitTurnInName, locale, portraitTurnInName);
}
}
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
WorldPackets::Quest::QuestGiverOfferRewardMessage packet;
WorldPackets::Quest::QuestGiverOfferReward& offer = packet.QuestData;
quest->BuildQuestRewards(offer.Rewards, _session->GetPlayer());
offer.QuestGiverGUID = npcGUID;
// Is there a better way? what about game objects?
if (Creature const* creature = ObjectAccessor::GetCreature(*_session->GetPlayer(), npcGUID))
offer.QuestGiverCreatureID = creature->GetCreatureTemplate()->Entry;
offer.QuestID = quest->GetQuestId();
offer.AutoLaunched = enableNext;
offer.SuggestedPartyMembers = quest->GetSuggestedPlayers();
for (uint32 i = 0; i < QUEST_EMOTE_COUNT && quest->OfferRewardEmote[i]; ++i)
offer.Emotes.push_back(WorldPackets::Quest::QuestDescEmote(quest->OfferRewardEmote[i], quest->OfferRewardEmoteDelay[i]));
offer.QuestFlags[0] = quest->GetFlags();
offer.QuestFlags[1] = quest->GetFlagsEx();
packet.QuestTitle = questTitle;
packet.RewardText = questOfferRewardText;
packet.PortraitTurnIn = quest->GetQuestTurnInPortrait();
packet.PortraitGiver = quest->GetQuestGiverPortrait();
packet.PortraitGiverText = portraitGiverText;
packet.PortraitGiverName = portraitGiverName;
packet.PortraitTurnInText = portraitTurnInText;
packet.PortraitTurnInName = portraitTurnInName;
packet.QuestPackageID = quest->GetQuestPackageID();
_session->SendPacket(packet.Write());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPC=%s, questid=%u", npcGUID.ToString().c_str(), quest->GetQuestId());
}
示例2: data
void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, uint64 npcGuid)
{
ObjectGuid guid = npcGuid;
uint32 count = 0;
WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100); // guess size
data << guid;
data << int32(eEmote._Emote);
data << int32(eEmote._Delay);
size_t countPos = data.wpos();
data << uint32(count);
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
for (uint32 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
QuestMenuItem const& qmi = _questMenu.GetItem(i);
uint32 questID = qmi.QuestId;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
{
++count;
std::string title = quest->GetTitle();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
if (questLevelInTitle)
AddQuestLevelToTitle(title, quest->GetQuestLevel());
data << int32(questID);
data << int32(qmi.QuestIcon);
data << int32(quest->GetQuestLevel());
data << int32(quest->GetFlags());
data << int32(quest->GetFlags2());
data.WriteBit(quest->IsRepeatable());
data.WriteBits(quest->GetTitle().size(), 9);
data.FlushBits();
data.WriteString(quest->GetTitle());
}
}
data.WriteBits(Title.size(), 11);
data.FlushBits();
data.WriteString(Title);
data.put<uint32>(countPos, count);
_session->SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGuid));
}
示例3: data
void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID)
{
_gossipMenu.SetSenderGUID(objectGUID);
WorldPacket data(SMSG_GOSSIP_MESSAGE, 100); // guess size
data << uint64(objectGUID);
data << uint32(_gossipMenu.GetMenuId()); // new 2.4.0
data << uint32(titleTextId);
data << uint32(_gossipMenu.GetMenuItemCount()); // max count 0x10
for (GossipMenuItemContainer::const_iterator itr = _gossipMenu.GetMenuItems().begin(); itr != _gossipMenu.GetMenuItems().end(); ++itr)
{
GossipMenuItem const& item = itr->second;
data << uint32(itr->first);
data << uint8(item.MenuItemIcon);
data << uint8(item.IsCoded); // makes pop up box password
data << uint32(item.BoxMoney); // money required to open menu, 2.0.3
data << item.Message; // text for gossip item
data << item.BoxMessage; // accept text (related to money) pop up box, 2.0.3
}
size_t count_pos = data.wpos();
data << uint32(0); // max count 0x20
uint32 count = 0;
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
for (uint8 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
QuestMenuItem const& item = _questMenu.GetItem(i);
uint32 questID = item.QuestId;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
{
++count;
data << uint32(questID);
data << uint32(item.QuestIcon);
data << int32(quest->GetQuestLevel());
data << uint32(quest->GetFlags()); // 3.3.3 quest flags
data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
std::string title = quest->GetTitle();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
if (questLevelInTitle)
AddQuestLevelToTitle(title, quest->GetQuestLevel());
data << title; // max 0x200
}
}
data.put<uint8>(count_pos, count);
_session->SendPacket(&data);
}
示例4: data
void PlayerMenu::SendGossipMenu(uint32 TitleTextId, uint64 objectGUID)
{
WorldPacket data(SMSG_GOSSIP_MESSAGE, (100)); // guess size
data << uint64(objectGUID);
data << uint32(mGossipMenu.GetMenuId()); // new 2.4.0
data << uint32(TitleTextId);
data << uint32(mGossipMenu.MenuItemCount()); // max count 0x20
for (uint32 iI = 0; iI < mGossipMenu.MenuItemCount(); ++iI)
{
GossipMenuItem const& gItem = mGossipMenu.GetItem(iI);
data << uint32(iI);
data << uint8(gItem.m_gIcon);
data << uint8(gItem.m_gCoded); // makes pop up box password
data << uint32(gItem.m_gBoxMoney); // money required to open menu, 2.0.3
data << gItem.m_gMessage; // text for gossip item, max 0x800
data << gItem.m_gBoxMessage; // accept text (related to money) pop up box, 2.0.3, max 0x800
}
data << uint32(mQuestMenu.MenuItemCount()); // max count 0x20
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld.getConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
for (uint32 iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI)
{
QuestMenuItem const& qItem = mQuestMenu.GetItem(iI);
uint32 questID = qItem.m_qId;
Quest const* pQuest = sObjectMgr.GetQuestTemplate(questID);
data << uint32(questID);
data << uint32(qItem.m_qIcon);
data << int32(pQuest->GetQuestLevel());
std::string Title = pQuest->GetTitle();
int loc_idx = pSession->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
if (QuestLocale const* ql = sObjectMgr.GetQuestLocale(questID))
if (ql->Title.size() > uint32(loc_idx) && !ql->Title[loc_idx].empty())
Title = ql->Title[loc_idx];
if (questLevelInTitle)
AddQuestLevelToTitle(Title, pQuest->GetQuestLevel());
data << Title;
}
pSession->SendPacket(&data);
}
示例5: data
void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, uint64 npcGUID)
{
WorldPacket data(SMSG_QUESTGIVER_QUEST_LIST, 100); // guess size
data << uint64(npcGUID);
data << Title;
data << uint32(eEmote._Delay); // player emote
data << uint32(eEmote._Emote); // NPC emote
size_t count_pos = data.wpos();
data << uint8 (0);
uint32 count = 0;
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
for (uint32 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
QuestMenuItem const& qmi = _questMenu.GetItem(i);
uint32 questID = qmi.QuestId;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
{
++count;
std::string title = quest->GetTitle();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
if (questLevelInTitle)
AddQuestLevelToTitle(title, quest->GetQuestLevel());
data << uint32(questID);
data << uint32(qmi.QuestIcon);
data << int32(quest->GetQuestLevel());
data << uint32(quest->GetFlags()); // 3.3.3 quest flags
data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
data << title;
}
}
data.put<uint8>(count_pos, count);
_session->SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID));
}
示例6: if
void PlayerMenu::SendQuestGiverQuestList(ObjectGuid guid)
{
WorldPackets::Quest::QuestGiverQuestList questList;
questList.QuestGiverGUID = guid;
if (QuestGreeting const* questGreeting = sObjectMgr->GetQuestGreeting(guid))
{
questList.GreetEmoteDelay = questGreeting->greetEmoteDelay;
questList.GreetEmoteType = questGreeting->greetEmoteType;
questList.Greeting = questGreeting->greeting;
}
else
TC_LOG_ERROR("misc", "Guid: %s - No quest greeting found.", guid.ToString().c_str());
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
for (uint32 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
QuestMenuItem const& questMenuItem = _questMenu.GetItem(i);
uint32 questID = questMenuItem.QuestId;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
{
std::string title = quest->GetLogTitle();
LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex();
if (localeConstant >= LOCALE_enUS)
if (QuestTemplateLocale const* questTemplateLocale = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(questTemplateLocale->LogTitle, localeConstant, title);
if (questLevelInTitle)
AddQuestLevelToTitle(title, quest->GetQuestLevel());
bool repeatable = false; // NYI
bool ignored = false; // NYI
questList.GossipTexts.push_back(WorldPackets::Quest::GossipTextData(questID, questMenuItem.QuestIcon, quest->GetQuestLevel(), quest->GetFlags(), quest->GetFlagsEx(), repeatable, ignored, title));
}
}
_session->SendPacket(questList.Write());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_GIVER_QUEST_LIST_MESSAGE NPC=%s", guid.ToString().c_str());
}
示例7: text
void PlayerMenu::SendGossipMenu(uint32 titleTextId, ObjectGuid objectGUID)
{
_gossipMenu.SetSenderGUID(objectGUID);
WorldPackets::NPC::GossipMessage packet;
packet.GossipGUID = objectGUID;
packet.GossipID = _gossipMenu.GetMenuId();
packet.TextID = titleTextId;
packet.GossipOptions.resize(_gossipMenu.GetMenuItems().size());
uint32 count = 0;
for (GossipMenuItemContainer::const_iterator itr = _gossipMenu.GetMenuItems().begin(); itr != _gossipMenu.GetMenuItems().end(); ++itr)
{
WorldPackets::NPC::ClientGossipOptions& opt = packet.GossipOptions[count];
GossipMenuItem const& item = itr->second;
opt.ClientOption = itr->first;
opt.OptionNPC = item.MenuItemIcon;
opt.OptionFlags = item.IsCoded; // makes pop up box password
opt.OptionCost = 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
++count;
}
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
packet.GossipText.resize(_questMenu.GetMenuItemCount());
count = 0;
for (uint8 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
QuestMenuItem const& item = _questMenu.GetItem(i);
uint32 questID = item.QuestId;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(questID))
{
WorldPackets::NPC::ClientGossipText& text = packet.GossipText[count];
text.QuestID = questID;
text.QuestType = item.QuestIcon;
text.QuestLevel = quest->GetQuestLevel();
text.QuestFlags[0] = quest->GetFlags();
text.QuestFlags[1] = quest->GetFlagsEx();
text.Repeatable = quest->IsRepeatable();
std::string title = quest->GetLogTitle();
LocaleConstant localeConstant = _session->GetSessionDbLocaleIndex();
if (localeConstant >= LOCALE_enUS)
if (QuestTemplateLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
ObjectMgr::GetLocaleString(localeData->LogTitle, localeConstant, title);
if (questLevelInTitle)
AddQuestLevelToTitle(title, quest->GetQuestLevel());
text.QuestTitle = title;
++count;
}
}
// Shrink to the real size
packet.GossipText.resize(count);
_session->SendPacket(packet.Write());
}
示例8: AddQuestLevelToTitle
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGuid, bool enableNext) const
{
std::string questTitle = quest->GetTitle();
std::string questOfferRewardText = quest->GetOfferRewardText();
std::string questGiverTextWindow = quest->GetQuestGiverTextWindow();
std::string questGiverTargetName = quest->GetQuestGiverTargetName();
std::string questTurnTextWindow = quest->GetQuestTurnTextWindow();
std::string questTurnTargetName = quest->GetQuestTurnTargetName();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
{
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle);
ObjectMgr::GetLocaleString(localeData->OfferRewardText, locale, questOfferRewardText);
ObjectMgr::GetLocaleString(localeData->QuestGiverTextWindow, locale, questGiverTextWindow);
ObjectMgr::GetLocaleString(localeData->QuestGiverTargetName, locale, questGiverTargetName);
ObjectMgr::GetLocaleString(localeData->QuestTurnTextWindow, locale, questTurnTextWindow);
ObjectMgr::GetLocaleString(localeData->QuestTurnTargetName, locale, questTurnTargetName);
}
}
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
uint32 rewItemDisplayId[QUEST_REWARDS_COUNT];
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; i++)
{
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i]);
rewItemDisplayId[i] = itemTemplate ? itemTemplate->DisplayInfoID : 0;
}
uint32 rewChoiceItemDisplayId[QUEST_REWARD_CHOICES_COUNT];
for (uint8 i = 0; i < QUEST_REWARD_CHOICES_COUNT; i++)
{
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]);
rewChoiceItemDisplayId[i] = itemTemplate ? itemTemplate->DisplayInfoID : 0;
}
uint32 rewEmoteCount = 0;
for (uint8 i = 0; i < QUEST_EMOTE_COUNT; i++)
{
if (quest->OfferRewardEmote[i] <= 0)
break;
rewEmoteCount++;
}
/*
* TODO: Quest System
*
* Finish structure, missing values:
* SuggestedPartyMembers, FactionFlags, SkillLineID, NumSkillUps, SpellCompletionID, SpellCompletionDisplayID
*/
ObjectGuid guid = npcGuid;
WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 50); // guess size
data << uint32(quest->RewardItemIdCount[2]);
data << uint32(quest->GetQuestId());
data << uint32(quest->RewardItemId[3]);
data << uint32(rewChoiceItemDisplayId[2]);
for (uint8 i = 0; i < QUEST_REPUTATIONS_COUNT; i++)
{
data << uint32(quest->RewardFactionId[i]);
data << uint32(quest->RewardFactionValueId[i]);
data << uint32(quest->RewardFactionValueIdOverride[i]);
}
data << uint32(quest->RewardItemIdCount[0]);
data << uint32(quest->RewardItemIdCount[3]);
data << uint32(rewItemDisplayId[3]);
data << uint32(quest->RewardItemId[1]);
data << uint32(quest->RewardChoiceItemId[3]);
data << uint32(rewChoiceItemDisplayId[3]);
data << uint32(quest->GetRewChoiceItemsCount());
data << uint32(quest->GetRewSpellCast());
data << uint32(rewItemDisplayId[1]);
data << uint32(quest->RewardChoiceItemCount[5]);
data << uint32(rewChoiceItemDisplayId[4]);
data << uint32(quest->RewardChoiceItemCount[1]);
data << uint32(rewChoiceItemDisplayId[0]);
data << uint32(rewItemDisplayId[0]);
data << uint32(quest->GetRewardPackageItemId());
data << uint32(0); // model Id, usually used in wanted or boss quests
data << uint32(quest->RewardItemIdCount[1]);
data << uint32(0);
data << uint32(quest->RewardChoiceItemId[0]);
data << uint32(quest->RewardChoiceItemCount[3]);
data << uint32(quest->RewardChoiceItemCount[4]);
data << uint32(quest->RewardChoiceItemId[1]);
data << uint32(quest->GetBonusTalents());
data << uint32(0);
for (uint8 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; i++)
{
data << uint32(quest->RewardCurrencyId[i]);
data << uint32(quest->RewardCurrencyCount[i]);
//.........这里部分代码省略.........
示例9: AddQuestLevelToTitle
void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const
{
std::string questTitle = quest->GetTitle();
std::string questOfferRewardText = quest->GetOfferRewardText();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
{
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle);
ObjectMgr::GetLocaleString(localeData->OfferRewardText, locale, questOfferRewardText);
}
}
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 50); // guess size
data << uint64(npcGUID);
data << uint32(quest->GetQuestId());
data << questTitle;
data << questOfferRewardText;
data << uint8(enableNext ? 1 : 0); // Auto Finish
data << uint32(quest->GetFlags()); // 3.3.3 questFlags
data << uint32(quest->GetSuggestedPlayers()); // SuggestedGroupNum
uint32 emoteCount = 0;
for (uint8 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
if (quest->OfferRewardEmote[i] <= 0)
break;
++emoteCount;
}
data << emoteCount; // Emote Count
for (uint8 i = 0; i < emoteCount; ++i)
{
data << uint32(quest->OfferRewardEmoteDelay[i]); // Delay Emote
data << uint32(quest->OfferRewardEmote[i]);
}
data << uint32(quest->GetRewChoiceItemsCount());
for (uint32 i=0; i < quest->GetRewChoiceItemsCount(); ++i)
{
data << uint32(quest->RewardChoiceItemId[i]);
data << uint32(quest->RewardChoiceItemCount[i]);
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardChoiceItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
data << uint32(quest->GetRewItemsCount());
for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
{
data << uint32(quest->RewardItemId[i]);
data << uint32(quest->RewardItemIdCount[i]);
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RewardItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
}
data << uint32(quest->GetRewOrReqMoney());
data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST));
// rewarded honor points. Multiply with 10 to satisfy client
data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest)));
data << float(0.0f); // unk, honor multiplier?
data << uint32(0x08); // unused by client?
data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << int32(quest->GetRewSpellCast()); // casted spell
data << uint32(0); // unknown
data << uint32(quest->GetBonusTalents()); // bonus talents
data << uint32(quest->GetRewArenaPoints()); // arena points
data << uint32(0);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward factions ids
data << uint32(quest->RewardFactionId[i]);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (zero based)?
data << int32(quest->RewardFactionValueId[i]);
for (uint32 i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override?
data << uint32(quest->RewardFactionValueIdOverride[i]);
_session->SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
}
示例10: ObjectGuid
void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
{
std::string updatedQuestTitles[0x20];
ObjectGuid guid = ObjectGuid(objectGUID);
WorldPacket data(SMSG_GOSSIP_MESSAGE, 150); //??? GUESSED
data.WriteBit(guid[7]);
data.WriteBit(guid[6]);
data.WriteBit(guid[1]);
data.WriteBits(_questMenu.GetMenuItemCount(), 19); // max count 0x20
data.WriteBit(guid[0]);
data.WriteBit(guid[4]);
data.WriteBit(guid[5]);
data.WriteBit(guid[2]);
data.WriteBit(guid[3]);
data.WriteBits(_gossipMenu.GetMenuItemCount(), 20); // max count 0x10
for (GossipMenuItemContainer::const_iterator itr = _gossipMenu.GetMenuItems().begin(); itr != _gossipMenu.GetMenuItems().end(); ++itr)
{
GossipMenuItem const& item = itr->second;
data.WriteBits(item.BoxMessage.length(), 12);
data.WriteBits(item.Message.length(), 12);
}
// Store this instead of checking the Singleton every loop iteration
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
for (uint8 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
uint32 questId = _questMenu.GetItem(i).QuestId;
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
std::string title = quest->GetTitle();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questId))
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
if (questLevelInTitle)
AddQuestLevelToTitle(title, quest->GetQuestLevel());
if (title.length() % 2 != 0)
title += " "; // if quest title length is odd dividing by 2 will cause precision loss, add a space to the end
data.WriteBit(0); // unknown bit
data.WriteBits(title.length() / 2, 8); // title length is divided by 2
data.WriteBit(0); // unknown bit
updatedQuestTitles[i] = title;
}
data.FlushBits();
for (uint8 i = 0; i < _questMenu.GetMenuItemCount(); ++i)
{
QuestMenuItem const& item = _questMenu.GetItem(i);
Quest const* quest = sObjectMgr->GetQuestTemplate(item.QuestId);
data << int32(quest->GetSpecialFlags());
data << int32(item.QuestId);
data << int32(quest->GetQuestLevel());
data << int32(item.QuestIcon);
data << int32(quest->GetFlags());
data.WriteString(updatedQuestTitles[i]); // max 0xFF?, length is stored in 8 bits, 5.4.1
}
data.WriteByteSeq(guid[6]);
for (GossipMenuItemContainer::const_iterator itr = _gossipMenu.GetMenuItems().begin(); itr != _gossipMenu.GetMenuItems().end(); ++itr)
{
GossipMenuItem const& item = itr->second;
data << int32(item.BoxMoney); // money required to open menu, 2.0.3
data.WriteString(item.Message); // text for gossip item
data << int32(itr->first);
data << int8(item.MenuItemIcon);
data.WriteString(item.BoxMessage); // accept text (related to money) pop up box, 2.0.
data << int8(item.IsCoded); // makes pop up box password
}
data.WriteByteSeq(guid[2]);
data << int32(titleTextId);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[5]);
data << int32(_gossipMenu.GetMenuId()); // new 2.4.0
data << int32(0); // friend faction ID?
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[0]);
_session->SendPacket(&data);
}
示例11: AddQuestLevelToTitle
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const
{
std::string questTitle = quest->GetTitle();
std::string questDetails = quest->GetDetails();
std::string questObjectives = quest->GetObjectives();
std::string questGiverTextWindow = quest->GetQuestGiverTextWindow();
std::string questGiverTargetName = quest->GetQuestGiverTargetName();
std::string questTurnTextWindow = quest->GetQuestTurnTextWindow();
std::string questTurnTargetName = quest->GetQuestTurnTargetName();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
{
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle);
ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails);
ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives);
ObjectMgr::GetLocaleString(localeData->QuestGiverTextWindow, locale, questGiverTextWindow);
ObjectMgr::GetLocaleString(localeData->QuestGiverTargetName, locale, questGiverTargetName);
ObjectMgr::GetLocaleString(localeData->QuestTurnTextWindow, locale, questTurnTextWindow);
ObjectMgr::GetLocaleString(localeData->QuestTurnTargetName, locale, questTurnTargetName);
}
}
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
/*
* -- Objective Structure --
* uint32 - objective count (value required to complete objective)
* uint32 - objective Id (NPC, GO, item, spell, currency or faction Id)
* uint8 - objective type (see QuestObjectiveType enum)
* uint32 - unknown
*/
ByteBuffer objData;
int objCount = 0;
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
{
if (quest->RequiredNpcOrGo[i] != 0)
{
int32 requiredObjId = quest->RequiredNpcOrGo[i];
objData << uint8(requiredObjId < 0 ? QUEST_OBJECTIVE_TYPE_GO : QUEST_OBJECTIVE_TYPE_NPC);
objData << uint32(0);
objData << int32(quest->RequiredNpcOrGoCount[i]);
objData << uint32(requiredObjId < 0 ? requiredObjId * -1 : requiredObjId);
objCount++;
}
}
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
{
if (quest->RequiredItemId[i] != 0)
{
objData << uint8(QUEST_OBJECTIVE_TYPE_ITEM);
objData << uint32(0);
objData << int32(quest->RequiredItemCount[i]);
objData << uint32(quest->RequiredItemId[i]);
objCount++;
}
}
for (uint8 i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; i++)
{
if (quest->RequiredCurrencyId[i] != 0)
{
objData << uint8(QUEST_OBJECTIVE_TYPE_CURRENCY);
objData << uint32(0);
objData << int32(quest->RequiredCurrencyCount[i]);
objData << uint32(quest->RequiredCurrencyId[i]);
objCount++;
}
}
if (quest->GetRequiredSpell() != 0)
{
objData << uint8(QUEST_OBJECTIVE_TYPE_SPELL);
objData << uint32(0);
objData << int32(1);
objData << uint32(quest->GetRequiredSpell());
objCount++;
}
if (quest->GetRepObjectiveFaction() != 0)
{
objData << uint8(QUEST_OBJECTIVE_TYPE_FACTION_REP);
objData << uint32(0);
objData << int32(quest->GetRepObjectiveValue());
objData << uint32(quest->GetRepObjectiveFaction());
objCount++;
}
//.........这里部分代码省略.........
示例12: SendQuestGiverOfferReward
void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const
{
// We can always call to RequestItems, but this packet only goes out if there are actually
// items. Otherwise, we'll skip straight to the OfferReward
std::string questTitle = quest->GetTitle();
std::string requestItemsText = quest->GetRequestItemsText();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
{
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle);
ObjectMgr::GetLocaleString(localeData->RequestItemsText, locale, requestItemsText);
}
}
if (!quest->GetReqItemsCount() && canComplete)
{
SendQuestGiverOfferReward(quest, npcGUID, true);
return;
}
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
ObjectGuid guid = npcGUID;
WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 50); // guess size
data << uint32(0);
data << uint32(quest->GetFlags());
data << uint32(0);
data << uint32(canComplete ? 0x5F : 0x5B); // unknown, if not 5F continue button is greyed out
data << uint32(quest->GetRewOrReqMoney() < 0 ? -quest->GetRewOrReqMoney() : 0);
data << uint32(0); // quest starter NPC/GO entry
data << uint32(0);
data << uint32(canComplete ? quest->GetCompleteEmote() : quest->GetIncompleteEmote());
data << uint32(quest->GetQuestId());
data.WriteBits(quest->GetReqCurrencyCount(), 21);
data.WriteBit(closeOnCancel);
data.WriteBit(guid[2]);
data.WriteBit(guid[5]);
data.WriteBit(guid[1]);
data.WriteBits(questTitle.size(), 9);
data.WriteBits(requestItemsText.size(), 12);
data.WriteBit(guid[6]);
data.WriteBit(guid[0]);
data.WriteBits(quest->GetReqItemsCount(), 20);
data.WriteBit(guid[4]);
data.WriteBit(guid[7]);
data.WriteBit(guid[3]);
data.FlushBits();
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[2]);
data.WriteString(questTitle);
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; i++)
{
if (!quest->RequiredCurrencyId[i])
continue;
data << uint32(quest->RequiredCurrencyId[i]);
data << uint32(quest->RequiredCurrencyCount[i]);
}
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++)
{
if (!quest->RequiredItemId[i])
continue;
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
data << uint32(itemTemplate->DisplayInfoID);
else
data << uint32(0);
data << uint32(quest->RequiredItemId[i]);
data << uint32(quest->RequiredItemCount[i]);
}
data.WriteByteSeq(guid[3]);
data.WriteByteSeq(guid[1]);
data.WriteString(requestItemsText);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[6]);
_session->SendPacket(&data);
// missing from Cata - quest->GetSuggestedPlayers()
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
}
示例13: SendQuestGiverOfferReward
void PlayerMenu::SendQuestGiverRequestItems(Quest const* pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel)
{
// We can always call to RequestItems, but this packet only goes out if there are actually
// items. Otherwise, we'll skip straight to the OfferReward
std::string Title = pQuest->GetTitle();
std::string RequestItemsText = pQuest->GetRequestItemsText();
int loc_idx = pSession->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
if (QuestLocale const* ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
{
if (ql->Title.size() > uint32(loc_idx) && !ql->Title[loc_idx].empty())
Title = ql->Title[loc_idx];
if (ql->RequestItemsText.size() > uint32(loc_idx) && !ql->RequestItemsText[loc_idx].empty())
RequestItemsText = ql->RequestItemsText[loc_idx];
}
}
// We may wish a better check, perhaps checking the real quest requirements
if (pQuest->GetRequestItemsText().empty() && Completable)
{
SendQuestGiverOfferReward(pQuest, npcGUID, true);
return;
}
if (sWorld.getConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(Title, pQuest->GetQuestLevel());
WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 50); // guess size
data << uint64(npcGUID);
data << uint32(pQuest->GetQuestId());
data << Title;
data << RequestItemsText;
data << uint32(0x00); // unknown
if (Completable)
data << pQuest->GetCompleteEmote();
else
data << pQuest->GetIncompleteEmote();
// Close Window after cancel
if (CloseOnCancel)
data << uint32(0x01);
else
data << uint32(0x00);
data << uint32(0x00); // unknown
// Required Money
data << uint32(pQuest->GetRewOrReqMoney() < 0 ? -pQuest->GetRewOrReqMoney() : 0);
data << uint32(pQuest->GetReqItemsCount());
ItemTemplate const* pItem;
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
if (!pQuest->RequiredItemId[i])
continue;
pItem = sObjectMgr.GetItemTemplate(pQuest->RequiredItemId[i]);
data << uint32(pQuest->RequiredItemId[i]);
data << uint32(pQuest->ReqItemCount[i]);
if (pItem)
data << uint32(pItem->DisplayInfoID);
else
data << uint32(0);
}
if (!Completable)
data << uint32(0x00);
else
data << uint32(0x03);
data << uint32(0x04);
data << uint32(0x08);
data << uint32(0x10);
pSession->SendPacket(&data);
sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId());
}
示例14: AddQuestLevelToTitle
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, uint64 npcGUID, bool ActivateAccept)
{
std::string Title = pQuest->GetTitle();
std::string Details = pQuest->GetDetails();
std::string Objectives = pQuest->GetObjectives();
std::string EndText = pQuest->GetEndText();
int loc_idx = pSession->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
QuestLocale const* ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
if (ql)
{
if (ql->Title.size() > uint32(loc_idx) && !ql->Title[loc_idx].empty())
Title = ql->Title[loc_idx];
if (ql->Details.size() > uint32(loc_idx) && !ql->Details[loc_idx].empty())
Details = ql->Details[loc_idx];
if (ql->Objectives.size() > uint32(loc_idx) && !ql->Objectives[loc_idx].empty())
Objectives = ql->Objectives[loc_idx];
if (ql->EndText.size() > uint32(loc_idx) && !ql->EndText[loc_idx].empty())
EndText = ql->EndText[loc_idx];
}
}
if (sWorld.getConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(Title, pQuest->GetQuestLevel());
WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size
data << uint64(npcGUID);
data << uint32(pQuest->GetQuestId());
data << Title;
data << Details;
data << Objectives;
data << uint32(ActivateAccept);
data << uint32(pQuest->GetSuggestedPlayers());
if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
{
data << uint32(0); // Rewarded chosen items hidden
data << uint32(0); // Rewarded items hidden
data << uint32(0); // Rewarded money hidden
}
else
{
ItemTemplate const* IProto;
data << uint32(pQuest->GetRewChoiceItemsCount());
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
if (!pQuest->RewChoiceItemId[i])
continue;
data << uint32(pQuest->RewChoiceItemId[i]);
data << uint32(pQuest->RewChoiceItemCount[i]);
IProto = sObjectMgr.GetItemTemplate(pQuest->RewChoiceItemId[i]);
if (IProto)
data << uint32(IProto->DisplayInfoID);
else
data << uint32(0x00);
}
data << uint32(pQuest->GetRewItemsCount());
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
if (!pQuest->RewItemId[i])
continue;
data << uint32(pQuest->RewItemId[i]);
data << uint32(pQuest->RewItemCount[i]);
IProto = sObjectMgr.GetItemTemplate(pQuest->RewItemId[i]);
if (IProto)
data << uint32(IProto->DisplayInfoID);
else
data << uint32(0);
}
data << uint32(pQuest->GetRewOrReqMoney());
}
// rewarded honor points. Multiply with 10 to satisfy client
data << uint32(10 * Oregon::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0)
data << uint32(pQuest->GetRewSpellCast()); // casted spell
data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
data << uint32(QUEST_EMOTE_COUNT);
for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
data << uint32(pQuest->DetailsEmote[i]);
data << uint32(0); // DetailsEmoteDelay
}
pSession->SendPacket(&data);
DEBUG_LOG("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId());
}
示例15: AddQuestLevelToTitle
void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const
{
std::string questTitle = quest->GetTitle();
std::string questDetails = quest->GetDetails();
std::string questObjectives = quest->GetObjectives();
std::string questEndText = quest->GetEndText();
std::string questGiverTextWindow = quest->GetQuestGiverTextWindow();
std::string questGiverTargetName = quest->GetQuestGiverTargetName();
std::string questTurnTextWindow = quest->GetQuestTurnTextWindow();
std::string questTurnTargetName = quest->GetQuestTurnTargetName();
int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0)
{
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId()))
{
ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle);
ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails);
ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives);
ObjectMgr::GetLocaleString(localeData->EndText, locale, questEndText);
ObjectMgr::GetLocaleString(localeData->QuestGiverTextWindow, locale, questGiverTextWindow);
ObjectMgr::GetLocaleString(localeData->QuestGiverTargetName, locale, questGiverTargetName);
ObjectMgr::GetLocaleString(localeData->QuestTurnTextWindow, locale, questTurnTextWindow);
ObjectMgr::GetLocaleString(localeData->QuestTurnTargetName, locale, questTurnTargetName);
}
}
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 100); // guess size
data << uint64(npcGUID);
data << uint64(_session->GetPlayer()->GetDivider());
data << uint32(quest->GetQuestId());
data << questTitle;
data << questDetails;
data << questObjectives;
data << questGiverTextWindow; // 4.x
data << questGiverTargetName; // 4.x
data << questTurnTextWindow; // 4.x
data << questTurnTargetName; // 4.x
data << uint32(quest->GetQuestGiverPortrait()); // 4.x
data << uint32(quest->GetQuestTurnInPortrait()); // 4.x
data << uint8(activateAccept ? 1 : 0); // auto finish
data << uint32(quest->GetFlags()); // 3.3.3 questFlags
data << uint32(quest->GetSuggestedPlayers());
data << uint8(0); // IsFinished? value is sent back to server in quest accept packet
data << uint8(0); // 4.x FIXME: Starts at AreaTrigger
data << uint32(quest->GetRequiredSpell()); // 4.x
quest->BuildExtraQuestInfo(data, _session->GetPlayer());
data << uint32(QUEST_EMOTE_COUNT);
for (uint8 i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
data << uint32(quest->DetailsEmote[i]);
data << uint32(quest->DetailsEmoteDelay[i]); // DetailsEmoteDelay (in ms)
}
_session->SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
}