mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
Core/Text: Locales for npc_text.
Closes https://github.com/azerothcore/azerothcore-wotlk/issues/452#issuecomment-291891686
This commit is contained in:
@@ -1170,6 +1170,12 @@ class ObjectMgr
|
||||
if (itr == _pointOfInterestLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
NpcTextLocale const* GetNpcTextLocale(uint32 entry) const
|
||||
{
|
||||
NpcTextLocaleContainer::const_iterator itr = _npcTextLocaleStore.find(entry);
|
||||
if (itr == _npcTextLocaleStore.end()) return NULL;
|
||||
return &itr->second;
|
||||
}
|
||||
GameObjectData& NewGOData(uint32 guid) { return _gameObjectDataStore[guid]; }
|
||||
void DeleteGOData(uint32 guid);
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ struct GossipTextOption
|
||||
{
|
||||
std::string Text_0;
|
||||
std::string Text_1;
|
||||
uint32 BroadcastTextID;
|
||||
uint32 Language;
|
||||
float Probability;
|
||||
QEmote Emotes[MAX_GOSSIP_TEXT_EMOTES];
|
||||
|
||||
@@ -274,7 +274,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
|
||||
|
||||
if (!pGossip)
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
|
||||
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
|
||||
{
|
||||
data << float(0);
|
||||
data << "Greetings $N";
|
||||
@@ -290,23 +290,47 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recvData)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
|
||||
std::string text0[MAX_GOSSIP_TEXT_OPTIONS], text1[MAX_GOSSIP_TEXT_OPTIONS];
|
||||
LocaleConstant locale = GetSessionDbLocaleIndex();
|
||||
|
||||
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
|
||||
{
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(pGossip->Options[i].BroadcastTextID);
|
||||
if (bct)
|
||||
{
|
||||
text0[i] = bct->GetText(locale, GENDER_MALE, true);
|
||||
text1[i] = bct->GetText(locale, GENDER_FEMALE, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
text0[i] = pGossip->Options[i].Text_0;
|
||||
text1[i] = pGossip->Options[i].Text_1;
|
||||
}
|
||||
|
||||
if (locale != DEFAULT_LOCALE && !bct)
|
||||
{
|
||||
if (NpcTextLocale const* npcTextLocale = sObjectMgr->GetNpcTextLocale(textID))
|
||||
{
|
||||
ObjectMgr::GetLocaleString(npcTextLocale->Text_0[i], locale, text0[i]);
|
||||
ObjectMgr::GetLocaleString(npcTextLocale->Text_1[i], locale, text1[i]);
|
||||
}
|
||||
}
|
||||
|
||||
data << pGossip->Options[i].Probability;
|
||||
|
||||
if (pGossip->Options[i].Text_0.empty())
|
||||
data << pGossip->Options[i].Text_1;
|
||||
if (text0[i].empty())
|
||||
data << text1[i];
|
||||
else
|
||||
data << pGossip->Options[i].Text_0;
|
||||
data << text0[i];
|
||||
|
||||
if (pGossip->Options[i].Text_1.empty())
|
||||
data << pGossip->Options[i].Text_0;
|
||||
if (text1[i].empty())
|
||||
data << text0[i];
|
||||
else
|
||||
data << pGossip->Options[i].Text_1;
|
||||
data << text1[i];
|
||||
|
||||
data << pGossip->Options[i].Language;
|
||||
|
||||
for (int j = 0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
|
||||
for (uint8 j = 0; j < MAX_GOSSIP_TEXT_EMOTES; ++j)
|
||||
{
|
||||
data << pGossip->Options[i].Emotes[j]._Delay;
|
||||
data << pGossip->Options[i].Emotes[j]._Emote;
|
||||
|
||||
Reference in New Issue
Block a user