[DiscordArchive] Good evening, there is a way to grab a gossip from the database in a c++ code but that takes it tran
[DiscordArchive] Good evening, there is a way to grab a gossip from the database in a c++ code but that takes it tran
Archived author: stevej • Posted: 2018-11-20T05:34:19.267000+00:00
Original source
Good evening, there is a way to grab a gossip from the database in a c++ code but that takes it translated from local_gossip_menu_id?
Archived author: stevej • Posted: 2018-11-20T05:38:59.412000+00:00
Original source
```c
void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItemID, uint32 sender, uint32 action);
```
That method, takes the gossip from the database but doesn't show it translated.
tring strOptionText = itr->second.OptionText;
tring strBoxText = itr->second.BoxText;Archived author: stevej • Posted: 2018-11-20T05:42:41.033000+00:00
Original source
```c
void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action)
{
/// Find items for given menu id.
GossipMenuItemsMapBounds bounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
/// Return if there are none.
if (bounds.first == bounds.second)
return;
/// Iterate over each of them.
for (GossipMenuItemsContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
{
/// Find the one with the given menu item id.
if (itr->second.OptionIndex != menuItemId)
continue;
/// Store texts for localization.
std:
tring strOptionText = itr->second.OptionText;
std:
tring strBoxText = itr->second.BoxText;
/// Check need of localization.
if (GetLocale() != DEFAULT_LOCALE)
/// Find localizations from database.
if (GossipMenuItemsLocale const* no = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, menuItemId)))
{
/// Translate texts if there are any.
ObjectMgr::GetLocaleString(no->OptionText, GetLocale(), strOptionText);
ObjectMgr::GetLocaleString(no->BoxText, GetLocale(), strBoxText);
}
/// Add menu item with existing method. Menu item id -1 is also used in ADD_GOSSIP_ITEM macro.
AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
}
}
```
Although looking at this code it seems that the method takes the translations in case they exist, but as never use it yet. Anyone who has used it?