* What bug does the patch fix? What features does the patch add?
Item owner is not switched when returning an expired mail with items, so the new receiver can't see them.
Removed also redundant check.
* For which repository revision was the patch created?
10859
* Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.
Not found any.
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 0281510..0fac2ba 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -5509,7 +5509,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
delete resultItems;
}
//if it is mail from AH, it shouldn't be returned, but deleted
- if (m->messageType != MAIL_NORMAL || m->messageType == MAIL_AUCTION || (m->checked & (MAIL_CHECK_MASK_COD_PAYMENT | MAIL_CHECK_MASK_RETURNED)))
+ if (m->messageType != MAIL_NORMAL || (m->checked & (MAIL_CHECK_MASK_COD_PAYMENT | MAIL_CHECK_MASK_RETURNED)))
{
// mail open and then not returned
for(std::vector<MailItemInfo>::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
@@ -5520,6 +5520,11 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
//mail will be returned:
CharacterDatabase.PExecute("UPDATE mail SET sender = '%u', receiver = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',cod
m->receiverGuid.GetCounter(), m->sender, (uint64)(basetime + 30*DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID);
+ for (std::vector<MailItemInfo>::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
+ {
+ CharacterDatabase.PExecute("UPDATE mail_items SET receiver = %u WHERE item_guid = '%u'", m->sender, itr2->item_guid);
+ CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = %u WHERE guid = '%u'", m->sender, itr2->item_guid);
+ }
delete m;
continue;
}