mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
feat(Core/Player): add helper for send large count mail items (#8460)
This commit is contained in:
@@ -677,9 +677,9 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
|
||||
RemoveTimedQuest(quest_id);
|
||||
|
||||
std::vector<std::pair<uint32, uint32> > problematicItems;
|
||||
std::vector<std::pair<uint32, uint32>> problematicItems;
|
||||
|
||||
if (quest->GetRewChoiceItemsCount() > 0)
|
||||
if (quest->GetRewChoiceItemsCount())
|
||||
{
|
||||
if (uint32 itemId = quest->RewardChoiceItemId[reward])
|
||||
{
|
||||
@@ -692,11 +692,13 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
sScriptMgr->OnQuestRewardItem(this, item, quest->RewardChoiceItemCount[reward]);
|
||||
}
|
||||
else
|
||||
problematicItems.push_back(std::pair<uint32, uint32>(itemId, quest->RewardChoiceItemCount[reward]));
|
||||
{
|
||||
problematicItems.emplace_back(itemId, quest->RewardChoiceItemCount[reward]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (quest->GetRewItemsCount() > 0)
|
||||
if (quest->GetRewItemsCount())
|
||||
{
|
||||
for (uint32 i = 0; i < quest->GetRewItemsCount(); ++i)
|
||||
{
|
||||
@@ -711,7 +713,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
sScriptMgr->OnQuestRewardItem(this, item, quest->RewardItemIdCount[i]);
|
||||
}
|
||||
else
|
||||
problematicItems.push_back(std::pair<uint32, uint32>(itemId, quest->RewardItemIdCount[i]));
|
||||
problematicItems.emplace_back(itemId, quest->RewardItemIdCount[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -719,21 +721,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
|
||||
// Xinef: send items that couldn't be added properly by mail
|
||||
if (!problematicItems.empty())
|
||||
{
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
MailSender sender(MAIL_CREATURE, 34337 /* The Postmaster */ );
|
||||
MailDraft draft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed."); // This is the text used in Cataclysm, it probably wasn't changed.
|
||||
|
||||
for (std::vector<std::pair<uint32, uint32> >::const_iterator itr = problematicItems.begin(); itr != problematicItems.end(); ++itr)
|
||||
{
|
||||
if(Item* item = Item::CreateItem(itr->first, itr->second))
|
||||
{
|
||||
item->SaveToDB(trans);
|
||||
draft.AddItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
draft.SendMailTo(trans, MailReceiver(this, GetGUID().GetCounter()), sender);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
SendItemRetrievalMail(problematicItems);
|
||||
}
|
||||
|
||||
RewardReputation(quest);
|
||||
|
||||
Reference in New Issue
Block a user