diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/Globals/ObjectMgr.h | 6 | ||||
| -rw-r--r-- | src/game/Handlers/NPCHandler.h | 1 | ||||
| -rw-r--r-- | src/game/Handlers/QueryHandler.cpp | 42 |
3 files changed, 40 insertions, 9 deletions
diff --git a/src/game/Globals/ObjectMgr.h b/src/game/Globals/ObjectMgr.h index 06689df0ed..85572634af 100644 --- a/src/game/Globals/ObjectMgr.h +++ b/src/game/Globals/ObjectMgr.h @@ -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); diff --git a/src/game/Handlers/NPCHandler.h b/src/game/Handlers/NPCHandler.h index 6727f60106..efd2cb254f 100644 --- a/src/game/Handlers/NPCHandler.h +++ b/src/game/Handlers/NPCHandler.h @@ -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]; diff --git a/src/game/Handlers/QueryHandler.cpp b/src/game/Handlers/QueryHandler.cpp index 6389b3510a..bb0df7fa5b 100644 --- a/src/game/Handlers/QueryHandler.cpp +++ b/src/game/Handlers/QueryHandler.cpp @@ -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; |
