Core/Cleanup: move repeating code for locale strings retrieval into separate method. Related code cleanup.
--HG-- branch : trunk
This commit is contained in:
@@ -1946,10 +1946,8 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
|
||||
{
|
||||
if (AchievementRewardLocale const* loc = sAchievementMgr.GetAchievementRewardLocale(achievement))
|
||||
{
|
||||
if (loc->subject.size() > size_t(loc_idx) && !loc->subject[loc_idx].empty())
|
||||
subject = loc->subject[loc_idx];
|
||||
if (loc->text.size() > size_t(loc_idx) && !loc->text[loc_idx].empty())
|
||||
text = loc->text[loc_idx];
|
||||
sObjectMgr.GetLocaleString(loc->subject, loc_idx, subject);
|
||||
sObjectMgr.GetLocaleString(loc->text, loc_idx, text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2420,30 +2418,12 @@ void AchievementGlobalMgr::LoadRewardLocales()
|
||||
|
||||
for (int i = 1; i < MAX_LOCALE; ++i)
|
||||
{
|
||||
std::string str = fields[1+2*(i-1)].GetCppString();
|
||||
if (!str.empty())
|
||||
{
|
||||
int idx = sObjectMgr.GetOrNewIndexForLocale(LocaleConstant(i));
|
||||
if (idx >= 0)
|
||||
{
|
||||
if (data.subject.size() <= size_t(idx))
|
||||
data.subject.resize(idx+1);
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
std::string str = fields[1 + 2 * (i - 1)].GetCppString();
|
||||
sObjectMgr.AddLocaleString(str, locale, data.subject);
|
||||
|
||||
data.subject[idx] = str;
|
||||
}
|
||||
}
|
||||
str = fields[1+2*(i-1)+1].GetCppString();
|
||||
if (!str.empty())
|
||||
{
|
||||
int idx = sObjectMgr.GetOrNewIndexForLocale(LocaleConstant(i));
|
||||
if (idx >= 0)
|
||||
{
|
||||
if (data.text.size() <= size_t(idx))
|
||||
data.text.resize(idx+1);
|
||||
|
||||
data.text[idx] = str;
|
||||
}
|
||||
}
|
||||
str = fields[1 + 2 * (i - 1) + 1].GetCppString();
|
||||
sObjectMgr.AddLocaleString(str, locale, data.text);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
|
||||
@@ -674,14 +674,8 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
|
||||
|
||||
// local name
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
ItemLocale const *il = sObjectMgr.GetItemLocale(proto->ItemId);
|
||||
if (il)
|
||||
{
|
||||
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
|
||||
name = il->Name[loc_idx];
|
||||
}
|
||||
}
|
||||
if (ItemLocale const *il = sObjectMgr.GetItemLocale(proto->ItemId))
|
||||
sObjectMgr.GetLocaleString(il->Name, loc_idx, name);
|
||||
|
||||
// DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result
|
||||
// that matches the search but it may not equal item->GetItemRandomPropertyId()
|
||||
|
||||
@@ -2948,8 +2948,7 @@ bool ChatHandler::HandleLookupItemCommand(const char *args)
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId);
|
||||
if (il)
|
||||
if (ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId))
|
||||
{
|
||||
if (il->Name.size() > uloc_idx && !il->Name[uloc_idx].empty())
|
||||
{
|
||||
@@ -3263,8 +3262,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args)
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
QuestLocale const *il = sObjectMgr.GetQuestLocale(qinfo->GetQuestId());
|
||||
if (il)
|
||||
if (QuestLocale const *il = sObjectMgr.GetQuestLocale(qinfo->GetQuestId()))
|
||||
{
|
||||
if (il->Title.size() > uloc_idx && !il->Title[uloc_idx].empty())
|
||||
{
|
||||
@@ -3368,8 +3366,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args)
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale (id);
|
||||
if (cl)
|
||||
if (CreatureLocale const *cl = sObjectMgr.GetCreatureLocale (id))
|
||||
{
|
||||
if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty ())
|
||||
{
|
||||
@@ -3439,8 +3436,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args)
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(id);
|
||||
if (gl)
|
||||
if (GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(id))
|
||||
{
|
||||
if (gl->Name.size() > uloc_idx && !gl->Name[uloc_idx].empty())
|
||||
{
|
||||
|
||||
@@ -171,14 +171,11 @@ void PlayerMenu::SendGossipMenu(uint32 TitleTextId, uint64 objectGUID)
|
||||
data << uint8(0); // 3.3.3 changes icon: blue question or yellow exclamation
|
||||
std::string Title = pQuest->GetTitle();
|
||||
|
||||
int8 loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
int loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID))
|
||||
if (ql->Title.size() > uloc_idx && !ql->Title[uloc_idx].empty())
|
||||
Title = ql->Title[uloc_idx];
|
||||
}
|
||||
sObjectMgr.GetLocaleString(ql->Title, loc_idx, Title);
|
||||
|
||||
data << Title; // max 0x200
|
||||
}
|
||||
|
||||
@@ -217,17 +214,10 @@ void PlayerMenu::SendPointOfInterest(uint32 poi_id)
|
||||
|
||||
std::string icon_name = poi->icon_name;
|
||||
|
||||
int8 loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
int loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
PointOfInterestLocale const *pl = sObjectMgr.GetPointOfInterestLocale(poi_id);
|
||||
if (pl)
|
||||
{
|
||||
if (pl->IconName.size() > uloc_idx && !pl->IconName[uloc_idx].empty())
|
||||
icon_name = pl->IconName[uloc_idx];
|
||||
}
|
||||
}
|
||||
if (PointOfInterestLocale const *pl = sObjectMgr.GetPointOfInterestLocale(poi_id))
|
||||
sObjectMgr.GetLocaleString(pl->IconName, loc_idx, icon_name);
|
||||
|
||||
WorldPacket data(SMSG_GOSSIP_POI, (4+4+4+4+4+10)); // guess size
|
||||
data << uint32(poi->flags);
|
||||
@@ -266,29 +256,25 @@ void PlayerMenu::SendTalking(uint32 textID)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string Text_0[8],Text_1[8];
|
||||
for (int i=0; i<8; ++i)
|
||||
std::string Text_0[8], Text_1[8];
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
Text_0[i]=pGossip->Options[i].Text_0;
|
||||
Text_1[i]=pGossip->Options[i].Text_1;
|
||||
Text_0[i] = pGossip->Options[i].Text_0;
|
||||
Text_1[i] = pGossip->Options[i].Text_1;
|
||||
}
|
||||
int8 loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
int loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textID);
|
||||
if (nl)
|
||||
if (NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textID))
|
||||
{
|
||||
for (int i=0; i<8; ++i)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if (nl->Text_0[i].size() > uloc_idx && !nl->Text_0[i][uloc_idx].empty())
|
||||
Text_0[i]=nl->Text_0[i][uloc_idx];
|
||||
if (nl->Text_1[i].size() > uloc_idx && !nl->Text_1[i][uloc_idx].empty())
|
||||
Text_1[i]=nl->Text_1[i][uloc_idx];
|
||||
sObjectMgr.GetLocaleString(nl->Text_0[i], loc_idx, Text_0[i]);
|
||||
sObjectMgr.GetLocaleString(nl->Text_1[i], loc_idx, Text_1[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<8; ++i)
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
data << pGossip->Options[i].Probability;
|
||||
|
||||
@@ -406,16 +392,10 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title
|
||||
{
|
||||
std::string title = pQuest->GetTitle();
|
||||
|
||||
int8 loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
int loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(questID))
|
||||
{
|
||||
if (ql->Title.size() > uloc_idx && !ql->Title[uloc_idx].empty())
|
||||
title = ql->Title[uloc_idx];
|
||||
}
|
||||
}
|
||||
sObjectMgr.GetLocaleString(ql->Title, loc_idx, title);
|
||||
|
||||
data << uint32(questID);
|
||||
data << uint32(qmi.m_qIcon);
|
||||
@@ -448,21 +428,15 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID,
|
||||
std::string Objectives = pQuest->GetObjectives();
|
||||
std::string EndText = pQuest->GetEndText();
|
||||
|
||||
int8 loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
int loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
|
||||
if (ql)
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (ql->Title.size() > uloc_idx && !ql->Title[uloc_idx].empty())
|
||||
Title=ql->Title[uloc_idx];
|
||||
if (ql->Details.size() > uloc_idx && !ql->Details[uloc_idx].empty())
|
||||
Details=ql->Details[uloc_idx];
|
||||
if (ql->Objectives.size() > uloc_idx && !ql->Objectives[uloc_idx].empty())
|
||||
Objectives=ql->Objectives[uloc_idx];
|
||||
if (ql->EndText.size() > uloc_idx && !ql->EndText[uloc_idx].empty())
|
||||
EndText=ql->EndText[uloc_idx];
|
||||
sObjectMgr.GetLocaleString(ql->Title, loc_idx, Title);
|
||||
sObjectMgr.GetLocaleString(ql->Details, loc_idx, Details);
|
||||
sObjectMgr.GetLocaleString(ql->Objectives, loc_idx, Objectives);
|
||||
sObjectMgr.GetLocaleString(ql->EndText, loc_idx, EndText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,24 +547,16 @@ void PlayerMenu::SendQuestQueryResponse(Quest const *pQuest)
|
||||
int loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
|
||||
if (ql)
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (ql->Title.size() > uloc_idx && !ql->Title[uloc_idx].empty())
|
||||
Title=ql->Title[uloc_idx];
|
||||
if (ql->Details.size() > uloc_idx && !ql->Details[uloc_idx].empty())
|
||||
Details=ql->Details[uloc_idx];
|
||||
if (ql->Objectives.size() > uloc_idx && !ql->Objectives[uloc_idx].empty())
|
||||
Objectives=ql->Objectives[uloc_idx];
|
||||
if (ql->EndText.size() > uloc_idx && !ql->EndText[uloc_idx].empty())
|
||||
EndText=ql->EndText[uloc_idx];
|
||||
if (ql->CompletedText.size() > uloc_idx && !ql->CompletedText[uloc_idx].empty())
|
||||
CompletedText=ql->CompletedText[uloc_idx];
|
||||
sObjectMgr.GetLocaleString(ql->Title, loc_idx, Title);
|
||||
sObjectMgr.GetLocaleString(ql->Details, loc_idx, Details);
|
||||
sObjectMgr.GetLocaleString(ql->Objectives, loc_idx, Objectives);
|
||||
sObjectMgr.GetLocaleString(ql->EndText, loc_idx, EndText);
|
||||
sObjectMgr.GetLocaleString(ql->CompletedText, loc_idx, CompletedText);
|
||||
|
||||
for (int i=0; i<QUEST_OBJECTIVES_COUNT; ++i)
|
||||
if (ql->ObjectiveText[i].size() > uloc_idx && !ql->ObjectiveText[i][uloc_idx].empty())
|
||||
ObjectiveText[i]=ql->ObjectiveText[i][uloc_idx];
|
||||
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
|
||||
sObjectMgr.GetLocaleString(ql->ObjectiveText[i], loc_idx, ObjectiveText[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,14 +680,10 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID,
|
||||
int loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
|
||||
if (ql)
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (ql->Title.size() > uloc_idx && !ql->Title[uloc_idx].empty())
|
||||
Title=ql->Title[uloc_idx];
|
||||
if (ql->OfferRewardText.size() > uloc_idx && !ql->OfferRewardText[uloc_idx].empty())
|
||||
OfferRewardText=ql->OfferRewardText[uloc_idx];
|
||||
sObjectMgr.GetLocaleString(ql->Title, loc_idx, Title);
|
||||
sObjectMgr.GetLocaleString(ql->OfferRewardText, loc_idx, OfferRewardText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,14 +780,10 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID,
|
||||
int loc_idx = pSession->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId());
|
||||
if (ql)
|
||||
if (QuestLocale const *ql = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (ql->Title.size() > uloc_idx && !ql->Title[uloc_idx].empty())
|
||||
Title=ql->Title[uloc_idx];
|
||||
if (ql->RequestItemsText.size() > uloc_idx && !ql->RequestItemsText[uloc_idx].empty())
|
||||
RequestItemsText=ql->RequestItemsText[uloc_idx];
|
||||
sObjectMgr.GetLocaleString(ql->Title, loc_idx, Title);
|
||||
sObjectMgr.GetLocaleString(ql->RequestItemsText, loc_idx, RequestItemsText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1716,7 +1716,7 @@ void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisp
|
||||
return;
|
||||
|
||||
uint32 loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
|
||||
char const* text = sObjectMgr.GetTrinityString(textId,loc_idx);
|
||||
char const* text = sObjectMgr.GetTrinityString(textId, loc_idx);
|
||||
|
||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||
BuildMonsterChat(&data,IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER,text,LANG_UNIVERSAL,GetNameForLocaleIdx(loc_idx),receiver);
|
||||
|
||||
@@ -13543,18 +13543,13 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId, bool showQue
|
||||
std::string strBoxText = itr->second.box_text;
|
||||
|
||||
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
|
||||
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.id);
|
||||
|
||||
if (GossipMenuItemsLocale const *no = sObjectMgr.GetGossipMenuItemsLocale(idxEntry))
|
||||
{
|
||||
if (no->OptionText.size() > (size_t)loc_idx && !no->OptionText[loc_idx].empty())
|
||||
strOptionText = no->OptionText[loc_idx];
|
||||
|
||||
if (no->BoxText.size() > (size_t)loc_idx && !no->BoxText[loc_idx].empty())
|
||||
strBoxText = no->BoxText[loc_idx];
|
||||
sObjectMgr.GetLocaleString(no->OptionText, loc_idx, strOptionText);
|
||||
sObjectMgr.GetLocaleString(no->BoxText, loc_idx, strBoxText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13921,15 +13916,8 @@ void Player::SendPreparedQuest(uint64 guid)
|
||||
|
||||
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid);
|
||||
if (nl)
|
||||
{
|
||||
if (nl->Text_0[0].size() > uloc_idx && !nl->Text_0[0][uloc_idx].empty())
|
||||
title = nl->Text_0[0][uloc_idx];
|
||||
}
|
||||
}
|
||||
if (NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid))
|
||||
sObjectMgr.GetLocaleString(nl->Text_0[0], loc_idx, title);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -13937,15 +13925,8 @@ void Player::SendPreparedQuest(uint64 guid)
|
||||
|
||||
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
uint8 uloc_idx = uint8(loc_idx);
|
||||
NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid);
|
||||
if (nl)
|
||||
{
|
||||
if (nl->Text_1[0].size() > uloc_idx && !nl->Text_1[0][uloc_idx].empty())
|
||||
title = nl->Text_1[0][uloc_idx];
|
||||
}
|
||||
}
|
||||
if (NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid))
|
||||
sObjectMgr.GetLocaleString(nl->Text_1[0], loc_idx, title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15612,11 +15593,9 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver)
|
||||
std::string strTitle = pQuest->GetTitle();
|
||||
|
||||
int loc_idx = pReceiver->GetSession()->GetSessionDbLocaleIndex();
|
||||
|
||||
if (loc_idx >= 0)
|
||||
if (const QuestLocale* pLocale = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
if (int(pLocale->Title.size()) > loc_idx && !pLocale->Title[loc_idx].empty())
|
||||
strTitle = pLocale->Title[loc_idx];
|
||||
sObjectMgr.GetLocaleString(pLocale->Title, loc_idx, strTitle);
|
||||
|
||||
WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + strTitle.size() + 8));
|
||||
data << uint32(pQuest->GetQuestId());
|
||||
|
||||
@@ -416,7 +416,7 @@ void ObjectMgr::AddLocaleString(std::string& s, LocaleConstant locale, StringVec
|
||||
int idx = GetOrNewIndexForLocale(locale);
|
||||
if (idx >= 0)
|
||||
{
|
||||
if (int(data.size()) <= idx)
|
||||
if (data.size() <= size_t(idx))
|
||||
data.resize(idx + 1);
|
||||
|
||||
data[idx] = s;
|
||||
|
||||
@@ -995,6 +995,14 @@ class ObjectMgr
|
||||
|
||||
// for wintergrasp only
|
||||
GraveYardMap mGraveYardMap;
|
||||
|
||||
void AddLocaleString(std::string& s, LocaleConstant locale, StringVector& data);
|
||||
inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value) const
|
||||
{
|
||||
if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
|
||||
value = data[loc_idx];
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// first free id for selected id type
|
||||
@@ -1071,8 +1079,6 @@ class ObjectMgr
|
||||
|
||||
int DBCLocaleIndex;
|
||||
|
||||
void AddLocaleString(std::string& s, LocaleConstant locale, StringVector& data);
|
||||
|
||||
private:
|
||||
void LoadScripts(ScriptsType type);
|
||||
void CheckScripts(ScriptsType type, std::set<int32>& ids);
|
||||
|
||||
@@ -296,13 +296,10 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId);
|
||||
if (il)
|
||||
if (ItemLocale const *il = sObjectMgr.GetItemLocale(pProto->ItemId))
|
||||
{
|
||||
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
|
||||
Name = il->Name[loc_idx];
|
||||
if (il->Description.size() > size_t(loc_idx) && !il->Description[loc_idx].empty())
|
||||
Description = il->Description[loc_idx];
|
||||
sObjectMgr.GetLocaleString(il->Name, loc_idx, Name);
|
||||
sObjectMgr.GetLocaleString(il->Description, loc_idx, Description);
|
||||
}
|
||||
}
|
||||
// guess size
|
||||
@@ -1026,12 +1023,8 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
|
||||
std::string Name = pName->name;
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
ItemSetNameLocale const *isnl = sObjectMgr.GetItemSetNameLocale(itemid);
|
||||
if (isnl)
|
||||
if (isnl->Name.size() > size_t(loc_idx) && !isnl->Name[loc_idx].empty())
|
||||
Name = isnl->Name[loc_idx];
|
||||
}
|
||||
if (ItemSetNameLocale const *isnl = sObjectMgr.GetItemSetNameLocale(itemid))
|
||||
sObjectMgr.GetLocaleString(isnl->Name, loc_idx, Name);
|
||||
|
||||
WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+Name.size()+1+4));
|
||||
data << uint32(itemid);
|
||||
|
||||
@@ -168,13 +168,10 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data)
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(entry);
|
||||
if (cl)
|
||||
if (CreatureLocale const *cl = sObjectMgr.GetCreatureLocale(entry))
|
||||
{
|
||||
if (cl->Name.size() > size_t(loc_idx) && !cl->Name[loc_idx].empty())
|
||||
Name = cl->Name[loc_idx];
|
||||
if (cl->SubName.size() > size_t(loc_idx) && !cl->SubName[loc_idx].empty())
|
||||
SubName = cl->SubName[loc_idx];
|
||||
sObjectMgr.GetLocaleString(cl->Name, loc_idx, Name);
|
||||
sObjectMgr.GetLocaleString(cl->SubName, loc_idx, SubName);
|
||||
}
|
||||
}
|
||||
sLog.outDetail("WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name, entry);
|
||||
@@ -237,13 +234,10 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data)
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(entryID);
|
||||
if (gl)
|
||||
if (GameObjectLocale const *gl = sObjectMgr.GetGameObjectLocale(entryID))
|
||||
{
|
||||
if (gl->Name.size() > size_t(loc_idx) && !gl->Name[loc_idx].empty())
|
||||
Name = gl->Name[loc_idx];
|
||||
if (gl->CastBarCaption.size() > size_t(loc_idx) && !gl->CastBarCaption[loc_idx].empty())
|
||||
CastBarCaption = gl->CastBarCaption[loc_idx];
|
||||
sObjectMgr.GetLocaleString(gl->Name, loc_idx, Name);
|
||||
sObjectMgr.GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption);
|
||||
}
|
||||
}
|
||||
sLog.outDetail("WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name, entryID);
|
||||
@@ -369,15 +363,12 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data)
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textID);
|
||||
if (nl)
|
||||
if (NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textID))
|
||||
{
|
||||
for (int i = 0; i < 8; ++i)
|
||||
{
|
||||
if (nl->Text_0[i].size() > size_t(loc_idx) && !nl->Text_0[i][loc_idx].empty())
|
||||
Text_0[i]=nl->Text_0[i][loc_idx];
|
||||
if (nl->Text_1[i].size() > size_t(loc_idx) && !nl->Text_1[i][loc_idx].empty())
|
||||
Text_1[i]=nl->Text_1[i][loc_idx];
|
||||
sObjectMgr.GetLocaleString(nl->Text_0[i], loc_idx, Text_0[i]);
|
||||
sObjectMgr.GetLocaleString(nl->Text_1[i], loc_idx, Text_1[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -439,14 +430,8 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
|
||||
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
PageTextLocale const *pl = sObjectMgr.GetPageTextLocale(pageID);
|
||||
if (pl)
|
||||
{
|
||||
if (pl->Text.size() > size_t(loc_idx) && !pl->Text[loc_idx].empty())
|
||||
Text = pl->Text[loc_idx];
|
||||
}
|
||||
}
|
||||
if (PageTextLocale const *pl = sObjectMgr.GetPageTextLocale(pageID))
|
||||
sObjectMgr.GetLocaleString(pl->Text, loc_idx, Text);
|
||||
|
||||
data << Text;
|
||||
data << uint32(pPage->Next_Page);
|
||||
|
||||
@@ -531,7 +531,7 @@ void WorldSession::SendNotification(int32 string_id,...)
|
||||
|
||||
const char * WorldSession::GetTrinityString(int32 entry) const
|
||||
{
|
||||
return sObjectMgr.GetTrinityString(entry,GetSessionDbLocaleIndex());
|
||||
return sObjectMgr.GetTrinityString(entry, GetSessionDbLocaleIndex());
|
||||
}
|
||||
|
||||
void WorldSession::Handle_NULL(WorldPacket& recvPacket)
|
||||
|
||||
Reference in New Issue
Block a user