mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 21:56:22 +00:00
fix(Core/Gossip): Fix gossip menu for locale clients (#16531)
* fix(Core/Gossip): Fix gossip menu for locale clients * using gossip_menu_option texts by default --------- Co-authored-by: wzw1990 <>
This commit is contained in:
@@ -164,33 +164,31 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
|
||||
|
||||
if (canTalk)
|
||||
{
|
||||
// using gossip_menu_option texts by default
|
||||
std::string strOptionText = itr->second.OptionText;
|
||||
std::string strBoxText = itr->second.BoxText;
|
||||
// search in broadcast_text and broadcast_text_locale
|
||||
std::string strOptionText, strBoxText;
|
||||
BroadcastText const* optionBroadcastText = sObjectMgr->GetBroadcastText(itr->second.OptionBroadcastTextID);
|
||||
BroadcastText const* boxBroadcastText = sObjectMgr->GetBroadcastText(itr->second.BoxBroadcastTextID);
|
||||
LocaleConstant locale = GetSession()->GetSessionDbLocaleIndex();
|
||||
|
||||
if (optionBroadcastText)
|
||||
ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? optionBroadcastText->MaleText : optionBroadcastText->FemaleText, locale, strOptionText);
|
||||
else
|
||||
strOptionText = itr->second.OptionText;
|
||||
|
||||
if (boxBroadcastText)
|
||||
ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? boxBroadcastText->MaleText : boxBroadcastText->FemaleText, locale, strBoxText);
|
||||
else
|
||||
strBoxText = itr->second.BoxText;
|
||||
|
||||
// if the language is not default and the texts weren't found, maybe they're in gossip_menu_option_locale table
|
||||
if (locale != DEFAULT_LOCALE)
|
||||
{
|
||||
if (strOptionText.empty())
|
||||
if (!optionBroadcastText)
|
||||
{
|
||||
/// Find localizations from database.
|
||||
if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
|
||||
ObjectMgr::GetLocaleString(gossipMenuLocale->OptionText, locale, strOptionText);
|
||||
}
|
||||
|
||||
if (strBoxText.empty())
|
||||
if (!boxBroadcastText)
|
||||
{
|
||||
/// Find localizations from database.
|
||||
if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
|
||||
|
||||
Reference in New Issue
Block a user