MaNGOS merge: Mail System.
* Store loot in mail_loot_template indexed by mail template ids. * Implement proper creating mail text copy item from mail template based mail. * Move send functions to new MailDraft class from WorldSession. * Implement mails sending at player levelup. * Autor VladimirMangos, converted by me. --HG-- branch : trunk
This commit is contained in:
+12
-11
@@ -1708,16 +1708,6 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
|
||||
{
|
||||
Item* item = reward->itemId ? Item::CreateItem(reward->itemId,1,GetPlayer ()) : NULL;
|
||||
|
||||
MailItemsInfo mi;
|
||||
if(item)
|
||||
{
|
||||
// save new item before send
|
||||
item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
|
||||
|
||||
// item
|
||||
mi.AddItem(item->GetGUIDLow(), item->GetEntry(), item);
|
||||
}
|
||||
|
||||
int loc_idx = GetPlayer()->GetSession()->GetSessionDbLocaleIndex();
|
||||
|
||||
// subject and text
|
||||
@@ -1736,7 +1726,18 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
|
||||
|
||||
uint32 itemTextId = objmgr.CreateItemText( text );
|
||||
|
||||
WorldSession::SendMailTo(GetPlayer(), MAIL_CREATURE, MAIL_STATIONERY_NORMAL, reward->sender, GetPlayer()->GetGUIDLow(), subject, itemTextId , &mi, 0, 0, MAIL_CHECK_MASK_NONE);
|
||||
MailDraft draft(subject, itemTextId);
|
||||
|
||||
if(item)
|
||||
{
|
||||
// save new item before send
|
||||
item->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
|
||||
|
||||
// item
|
||||
draft.AddItem(item);
|
||||
}
|
||||
|
||||
draft.SendMailTo(GetPlayer(), MailSender(MAIL_CREATURE, reward->sender));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user