mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 04:42:10 +01:00
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Handlers/MiscHandler.cpp src/server/scripts/Commands/cs_reload.cpp
This commit is contained in:
@@ -270,18 +270,18 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
|
||||
uint64 guid;
|
||||
|
||||
recvData >> textID;
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_NPC_TEXT_QUERY ID '%u'", textID);
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_NPC_TEXT_QUERY TextId: %u", textID);
|
||||
|
||||
recvData >> guid;
|
||||
|
||||
GossipText const* pGossip = sObjectMgr->GetGossipText(textID);
|
||||
GossipText const* gossip = sObjectMgr->GetGossipText(textID);
|
||||
|
||||
WorldPacket data(SMSG_NPC_TEXT_UPDATE, 100); // guess size
|
||||
data << textID;
|
||||
|
||||
if (!pGossip)
|
||||
if (!gossip)
|
||||
{
|
||||
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";
|
||||
@@ -297,46 +297,50 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string Text_0[MAX_LOCALES], Text_1[MAX_LOCALES];
|
||||
for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
|
||||
{
|
||||
Text_0[i]=pGossip->Options[i].Text_0;
|
||||
Text_1[i]=pGossip->Options[i].Text_1;
|
||||
}
|
||||
std::string text0[MAX_GOSSIP_TEXT_OPTIONS], text1[MAX_GOSSIP_TEXT_OPTIONS];
|
||||
LocaleConstant locale = GetSessionDbLocaleIndex();
|
||||
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
|
||||
{
|
||||
if (NpcTextLocale const* nl = sObjectMgr->GetNpcTextLocale(textID))
|
||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(gossip->Options[i].BroadcastTextID);
|
||||
if (bct)
|
||||
{
|
||||
for (int i = 0; i < MAX_LOCALES; ++i)
|
||||
ObjectMgr::GetLocaleString(bct->MaleText, locale, text0[i]);
|
||||
ObjectMgr::GetLocaleString(bct->FemaleText, locale, text1[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
text0[i] = gossip->Options[i].Text_0;
|
||||
text1[i] = gossip->Options[i].Text_1;
|
||||
}
|
||||
|
||||
if (locale != DEFAULT_LOCALE && !bct)
|
||||
{
|
||||
if (NpcTextLocale const* npcTextLocale = sObjectMgr->GetNpcTextLocale(textID))
|
||||
{
|
||||
ObjectMgr::GetLocaleString(nl->Text_0[i], loc_idx, Text_0[i]);
|
||||
ObjectMgr::GetLocaleString(nl->Text_1[i], loc_idx, Text_1[i]);
|
||||
ObjectMgr::GetLocaleString(npcTextLocale->Text_0[i], locale, text0[i]);
|
||||
ObjectMgr::GetLocaleString(npcTextLocale->Text_1[i], locale, text1[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
|
||||
{
|
||||
data << pGossip->Options[i].Probability;
|
||||
data << gossip->Options[i].Probability;
|
||||
|
||||
if (Text_0[i].empty())
|
||||
data << Text_1[i];
|
||||
if (text0[i].empty())
|
||||
data << text1[i];
|
||||
else
|
||||
data << Text_0[i];
|
||||
data << text0[i];
|
||||
|
||||
if (Text_1[i].empty())
|
||||
data << Text_0[i];
|
||||
if (text1[i].empty())
|
||||
data << text0[i];
|
||||
else
|
||||
data << Text_1[i];
|
||||
data << text1[i];
|
||||
|
||||
data << pGossip->Options[i].Language;
|
||||
data << gossip->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;
|
||||
data << gossip->Options[i].Emotes[j]._Delay;
|
||||
data << gossip->Options[i].Emotes[j]._Emote;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user