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)
|
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
|
// search in broadcast_text and broadcast_text_locale
|
||||||
std::string strOptionText, strBoxText;
|
|
||||||
BroadcastText const* optionBroadcastText = sObjectMgr->GetBroadcastText(itr->second.OptionBroadcastTextID);
|
BroadcastText const* optionBroadcastText = sObjectMgr->GetBroadcastText(itr->second.OptionBroadcastTextID);
|
||||||
BroadcastText const* boxBroadcastText = sObjectMgr->GetBroadcastText(itr->second.BoxBroadcastTextID);
|
BroadcastText const* boxBroadcastText = sObjectMgr->GetBroadcastText(itr->second.BoxBroadcastTextID);
|
||||||
LocaleConstant locale = GetSession()->GetSessionDbLocaleIndex();
|
LocaleConstant locale = GetSession()->GetSessionDbLocaleIndex();
|
||||||
|
|
||||||
if (optionBroadcastText)
|
if (optionBroadcastText)
|
||||||
ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? optionBroadcastText->MaleText : optionBroadcastText->FemaleText, locale, strOptionText);
|
ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? optionBroadcastText->MaleText : optionBroadcastText->FemaleText, locale, strOptionText);
|
||||||
else
|
|
||||||
strOptionText = itr->second.OptionText;
|
|
||||||
|
|
||||||
if (boxBroadcastText)
|
if (boxBroadcastText)
|
||||||
ObjectMgr::GetLocaleString(getGender() == GENDER_MALE ? boxBroadcastText->MaleText : boxBroadcastText->FemaleText, locale, strBoxText);
|
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 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 (locale != DEFAULT_LOCALE)
|
||||||
{
|
{
|
||||||
if (strOptionText.empty())
|
if (!optionBroadcastText)
|
||||||
{
|
{
|
||||||
/// Find localizations from database.
|
/// Find localizations from database.
|
||||||
if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
|
if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
|
||||||
ObjectMgr::GetLocaleString(gossipMenuLocale->OptionText, locale, strOptionText);
|
ObjectMgr::GetLocaleString(gossipMenuLocale->OptionText, locale, strOptionText);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strBoxText.empty())
|
if (!boxBroadcastText)
|
||||||
{
|
{
|
||||||
/// Find localizations from database.
|
/// Find localizations from database.
|
||||||
if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
|
if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID)))
|
||||||
|
|||||||
Reference in New Issue
Block a user