Skip to content

Commit

Permalink
fix(Core/Gossip): Fix gossip menu for locale clients (azerothcore#16531)
Browse files Browse the repository at this point in the history
* fix(Core/Gossip): Fix gossip menu for locale clients

* using gossip_menu_option texts by default

---------

Co-authored-by: wzw1990 <>
  • Loading branch information
wzw1990 authored Jul 12, 2023
1 parent e4d64ec commit 3a3dc64
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/server/game/Entities/Player/PlayerGossip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 3a3dc64

Please sign in to comment.