mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11743] Fixed auction crash in case missing localization for only some items
Source crash in missing locale strings array size check before access to it in locale structure. Also move repeating code for access to wide used localization string arrays to ObjectMgr functions.
This commit is contained in:
parent
bc171d5f97
commit
3e0cacbdaf
15 changed files with 203 additions and 315 deletions
|
|
@ -13528,36 +13528,13 @@ void Player::SendPreparedQuest(ObjectGuid guid)
|
|||
{
|
||||
qe = gossiptext->Options[0].Emotes[0];
|
||||
|
||||
if(!gossiptext->Options[0].Text_0.empty())
|
||||
{
|
||||
title = gossiptext->Options[0].Text_0;
|
||||
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
|
||||
|
||||
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid);
|
||||
if (nl)
|
||||
{
|
||||
if ((int32)nl->Text_0[0].size() > loc_idx && !nl->Text_0[0][loc_idx].empty())
|
||||
title = nl->Text_0[0][loc_idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
title = gossiptext->Options[0].Text_1;
|
||||
std::string title0 = gossiptext->Options[0].Text_0;
|
||||
std::string title1 = gossiptext->Options[0].Text_1;
|
||||
sObjectMgr.GetNpcTextLocaleStrings0(textid, loc_idx, &title0, &title1);
|
||||
|
||||
int loc_idx = GetSession()->GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
NpcTextLocale const *nl = sObjectMgr.GetNpcTextLocale(textid);
|
||||
if (nl)
|
||||
{
|
||||
if ((int32)nl->Text_1[0].size() > loc_idx && !nl->Text_1[0][loc_idx].empty())
|
||||
title = nl->Text_1[0][loc_idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
title = !title0.empty() ? title0 : title1;
|
||||
}
|
||||
}
|
||||
PlayerTalkClass->SendQuestGiverQuestList(qe, title, guid);
|
||||
|
|
@ -15223,22 +15200,13 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver)
|
|||
{
|
||||
if (pReceiver)
|
||||
{
|
||||
std::string strTitle = pQuest->GetTitle();
|
||||
|
||||
int loc_idx = pReceiver->GetSession()->GetSessionDbLocaleIndex();
|
||||
std::string title = pQuest->GetTitle();
|
||||
sObjectMgr.GetQuestLocaleStrings(pQuest->GetQuestId(), loc_idx, &title);
|
||||
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
if (const QuestLocale* pLocale = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if ((int32)pLocale->Title.size() > loc_idx && !pLocale->Title[loc_idx].empty())
|
||||
strTitle = pLocale->Title[loc_idx];
|
||||
}
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + strTitle.size() + 8));
|
||||
WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + title.size() + 8));
|
||||
data << uint32(pQuest->GetQuestId());
|
||||
data << strTitle;
|
||||
data << title;
|
||||
data << GetObjectGuid();
|
||||
pReceiver->GetSession()->SendPacket(&data);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue