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:
parent
e4d64ec319
commit
3a3dc6446b
1 changed files with 5 additions and 7 deletions
|
|
@ -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)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue