aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/QueryHandler.cpp
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2014-04-25 23:24:29 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2014-04-25 23:25:59 +0200
commitc81d6e9b4bec14a46fd4eb01ce51d874a12bf5f7 (patch)
treeb59e12749120651458fe9d80e477bfd6d78a35ce /src/server/game/Handlers/QueryHandler.cpp
parentf27057bf2406797f12b995f1fb40d6750c83af87 (diff)
Core/Texts:
* Enable some BroadcastTexts stuff (is not finish) * Added reload command for broadcast_text table ToDo: - Enable: Sound/Emote stuff, etc. - Auth base need refresh
Diffstat (limited to 'src/server/game/Handlers/QueryHandler.cpp')
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp64
1 files changed, 34 insertions, 30 deletions
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index e30260d34e2..3d083b3aa05 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -264,18 +264,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";
@@ -291,46 +291,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)
+ {
+ 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)
{
- for (int i = 0; i < MAX_LOCALES; ++i)
+ 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;
}
}
}