mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Merge pull request #9063 from MrSmite/QuestLevelsInUi
Option to show quest levels in dialogs
This commit is contained in:
@@ -142,6 +142,9 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
|
||||
|
||||
data << uint32(_questMenu.GetMenuItemCount()); // max count 0x20
|
||||
|
||||
// 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);
|
||||
@@ -160,6 +163,9 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
|
||||
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
|
||||
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
|
||||
|
||||
if (questLevelInTitle)
|
||||
AddQuestLevelToTitle(title, quest->GetQuestLevel());
|
||||
|
||||
data << title; // max 0x200
|
||||
}
|
||||
|
||||
@@ -252,6 +258,10 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
|
||||
size_t count_pos = data.wpos();
|
||||
data << uint8 (_questMenu.GetMenuItemCount());
|
||||
uint32 count = 0;
|
||||
|
||||
// Store this instead of checking the Singleton every loop iteration
|
||||
bool questLevelInTitle = sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS);
|
||||
|
||||
for (; count < _questMenu.GetMenuItemCount(); ++count)
|
||||
{
|
||||
QuestMenuItem const& qmi = _questMenu.GetItem(count);
|
||||
@@ -267,6 +277,9 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
|
||||
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());
|
||||
@@ -310,6 +323,9 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
|
||||
}
|
||||
}
|
||||
|
||||
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(0); // wotlk, something todo with quest sharing?
|
||||
@@ -499,6 +515,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
|
||||
data << float(quest->GetPointY());
|
||||
data << uint32(quest->GetPointOpt());
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
|
||||
AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
|
||||
|
||||
data << questTitle;
|
||||
data << questObjectives;
|
||||
data << questDetails;
|
||||
@@ -545,6 +564,9 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
@@ -645,6 +667,9 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
|
||||
return;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_UI_QUESTLEVELS_IN_DIALOGS))
|
||||
AddQuestLevelToTitle(questTitle, quest->GetQuestLevel());
|
||||
|
||||
WorldPacket data(SMSG_QUESTGIVER_REQUEST_ITEMS, 50); // guess size
|
||||
data << uint64(npcGUID);
|
||||
data << uint32(quest->GetQuestId());
|
||||
@@ -694,3 +719,13 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
|
||||
_session->SendPacket(&data);
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId());
|
||||
}
|
||||
|
||||
static void PlayerMenu::AddQuestLevelToTitle(std::string &title, int32 level)
|
||||
{
|
||||
// Adds the quest level to the front of the quest title
|
||||
// example: [13] Westfall Stew
|
||||
|
||||
std::stringstream questTitlePretty;
|
||||
questTitlePretty << "[" << level << "] " << title;
|
||||
title = questTitlePretty.str();
|
||||
}
|
||||
|
||||
@@ -277,6 +277,8 @@ class PlayerMenu
|
||||
void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const;
|
||||
void SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const;
|
||||
|
||||
static void AddQuestLevelToTitle(std::string &title, int32 level);
|
||||
|
||||
private:
|
||||
GossipMenu _gossipMenu;
|
||||
QuestMenu _questMenu;
|
||||
|
||||
@@ -1224,6 +1224,7 @@ void World::LoadConfigSettings(bool reload)
|
||||
// misc
|
||||
m_bool_configs[CONFIG_PDUMP_NO_PATHS] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowPaths", true);
|
||||
m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true);
|
||||
m_bool_configs[CONFIG_UI_QUESTLEVELS_IN_DIALOGS] = ConfigMgr::GetBoolDefault("UI.ShowQuestLevelsInDialogs", false);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = ConfigMgr::GetBoolDefault("Wintergrasp.Enable", false);
|
||||
|
||||
@@ -165,6 +165,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_WARDEN_ENABLED,
|
||||
CONFIG_ENABLE_MMAPS,
|
||||
CONFIG_WINTERGRASP_ENABLE,
|
||||
CONFIG_UI_QUESTLEVELS_IN_DIALOGS, // Should we add quest levels to the title in the NPC dialogs?
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -2651,6 +2651,14 @@ PlayerDump.DisallowPaths = 1
|
||||
|
||||
PlayerDump.DisallowOverwrite = 1
|
||||
|
||||
#
|
||||
# UI.ShowQuestLevelsInDialogs
|
||||
# Description: Show quest levels next to quest titles in UI dialogs
|
||||
# Example: [13] Westfall Stew
|
||||
# Default: 0 (do not show)
|
||||
|
||||
UI.ShowQuestLevelsInDialogs = 0
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user