mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10969] Some cleanups in MailDraft API
* Use Set* names for cases when function replace old value by new (instead Add*) * Prevent hidden MailDraft copy create becase if draft have items its can't be just shared and need preoprtly cloned, but item close is high price operation (guid use, DB tiuched and etc) So this must be explictly operation. In next commits will be added clone function for this. * Some MailDraft overwrite by assign cases rewrited to more clean way.
This commit is contained in:
parent
22115a8d04
commit
231c6d77ce
8 changed files with 39 additions and 31 deletions
|
|
@ -4233,9 +4233,11 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
|||
continue;
|
||||
}
|
||||
|
||||
MailDraft draft(subject, body);
|
||||
MailDraft draft;
|
||||
if (mailTemplateId)
|
||||
draft = MailDraft(mailTemplateId, false); // items already included
|
||||
draft.SetMailTemplate(mailTemplateId, false);// items already included
|
||||
else
|
||||
draft.SetSubjectAndBody(subject, body);
|
||||
|
||||
if (has_items)
|
||||
{
|
||||
|
|
@ -4278,7 +4280,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
|||
|
||||
uint32 pl_account = sObjectMgr.GetPlayerAccountIdByGUID(playerguid);
|
||||
|
||||
draft.AddMoney(money).SendReturnToSender(pl_account, playerguid, ObjectGuid(HIGHGUID_PLAYER, sender));
|
||||
draft.SetMoney(money).SendReturnToSender(pl_account, playerguid, ObjectGuid(HIGHGUID_PLAYER, sender));
|
||||
}
|
||||
while (resultMail->NextRow());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue