mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10802] Use ObjectGuid in Mail code.
Some catched bugs fixed in mixed uint32/guid values using cases.
This commit is contained in:
parent
3de8212e03
commit
938622bedc
9 changed files with 59 additions and 54 deletions
|
|
@ -129,7 +129,7 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPri
|
|||
|
||||
MailDraft(msgAuctionOutbiddedSubject.str(), "") // TODO: fix body
|
||||
.AddMoney(auction->bid)
|
||||
.SendMailTo(MailReceiver(oldBidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(MailReceiver(oldBidder, oldBidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ void WorldSession::SendAuctionCancelledToBidderMail( AuctionEntry* auction )
|
|||
|
||||
MailDraft(msgAuctionCancelledSubject.str(), "") // TODO: fix body
|
||||
.AddMoney(auction->bid)
|
||||
.SendMailTo(MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(MailReceiver(bidder, bidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ void AuctionHouseMgr::SendAuctionWonMail( AuctionEntry *auction )
|
|||
// will delete item or place to receiver mail list
|
||||
MailDraft(msgAuctionWonSubject.str(), msgAuctionWonBody.str())
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(MailReceiver(bidder,auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(MailReceiver(bidder, bidder_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
// receiver not exist
|
||||
else
|
||||
|
|
@ -192,7 +192,7 @@ void AuctionHouseMgr::SendAuctionSalePendingMail( AuctionEntry * auction )
|
|||
DEBUG_LOG("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str());
|
||||
|
||||
MailDraft(msgAuctionSalePendingSubject.str(), msgAuctionSalePendingBody.str())
|
||||
.SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(MailReceiver(owner, owner_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail( AuctionEntry * auction )
|
|||
|
||||
MailDraft(msgAuctionSuccessfulSubject.str(), auctionSuccessfulBody.str())
|
||||
.AddMoney(profit)
|
||||
.SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED, HOUR);
|
||||
.SendMailTo(MailReceiver(owner, owner_guid), auction, MAIL_CHECK_MASK_COPIED, HOUR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail( AuctionEntry * auction )
|
|||
// will delete item or place to receiver mail list
|
||||
MailDraft(subject.str(), "") // TODO: fix body
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(MailReceiver(owner,auction->owner), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(MailReceiver(owner, owner_guid), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
// owner not found
|
||||
else
|
||||
|
|
@ -418,7 +418,7 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
// item will deleted or added to received mail list
|
||||
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(MailReceiver(auction->owner), auction, MAIL_CHECK_MASK_COPIED);
|
||||
.SendMailTo(MailReceiver(ObjectGuid(HIGHGUID_PLAYER, auction->owner)), auction, MAIL_CHECK_MASK_COPIED);
|
||||
|
||||
RemoveAItem(auction->item_guidlow);
|
||||
auction->DeleteFromDB();
|
||||
|
|
|
|||
|
|
@ -1769,10 +1769,10 @@ bool ChatHandler::HandleSendMailCommand(char* args)
|
|||
std::string text = msgText;
|
||||
|
||||
// from console show nonexistent sender
|
||||
MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
|
||||
MailSender sender(m_session ? m_session->GetPlayer() : NULL, MAIL_STATIONERY_GM);
|
||||
|
||||
MailDraft(subject, text)
|
||||
.SendMailTo(MailReceiver(target,GUID_LOPART(target_guid)),sender);
|
||||
.SendMailTo(MailReceiver(target, target_guid),sender);
|
||||
|
||||
std::string nameLink = playerLink(target_name);
|
||||
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||
|
|
|
|||
|
|
@ -6545,7 +6545,7 @@ bool ChatHandler::HandleSendItemsCommand(char* args)
|
|||
}
|
||||
|
||||
// from console show nonexistent sender
|
||||
MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
|
||||
MailSender sender(m_session ? m_session->GetPlayer() : NULL, MAIL_STATIONERY_GM);
|
||||
|
||||
// fill mail
|
||||
MailDraft draft(subject, text);
|
||||
|
|
@ -6559,7 +6559,7 @@ bool ChatHandler::HandleSendItemsCommand(char* args)
|
|||
}
|
||||
}
|
||||
|
||||
draft.SendMailTo(MailReceiver(receiver,GUID_LOPART(receiver_guid)), sender);
|
||||
draft.SendMailTo(MailReceiver(receiver, receiver_guid), sender);
|
||||
|
||||
std::string nameLink = playerLink(receiver_name);
|
||||
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||
|
|
@ -6597,11 +6597,11 @@ bool ChatHandler::HandleSendMoneyCommand(char* args)
|
|||
std::string text = msgText;
|
||||
|
||||
// from console show nonexistent sender
|
||||
MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
|
||||
MailSender sender(m_session ? m_session->GetPlayer() : NULL, MAIL_STATIONERY_GM);
|
||||
|
||||
MailDraft(subject, text)
|
||||
.AddMoney(money)
|
||||
.SendMailTo(MailReceiver(receiver,GUID_LOPART(receiver_guid)),sender);
|
||||
.SendMailTo(MailReceiver(receiver, receiver_guid),sender);
|
||||
|
||||
std::string nameLink = playerLink(receiver_name);
|
||||
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||
|
|
|
|||
|
|
@ -107,21 +107,22 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
|
||||
Player* pl = _player;
|
||||
|
||||
uint64 rc = 0;
|
||||
ObjectGuid rc;
|
||||
if (normalizePlayerName(receiver))
|
||||
rc = sObjectMgr.GetPlayerGUIDByName(receiver);
|
||||
|
||||
if (!rc)
|
||||
if (rc.IsEmpty())
|
||||
{
|
||||
DETAIL_LOG("Player %u is sending mail to %s (GUID: nonexistent!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
|
||||
pl->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
DETAIL_LOG("%s is sending mail to %s (GUID: nonexistent!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
|
||||
pl->GetGuidStr().c_str(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
DETAIL_LOG("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", pl->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
DETAIL_LOG("%s is sending mail to %s with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
|
||||
pl->GetGuidStr().c_str(), rc.GetString().c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
|
||||
if (pl->GetGUID() == rc)
|
||||
if (pl->GetObjectGuid() == rc)
|
||||
{
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANNOT_SEND_TO_SELF);
|
||||
return;
|
||||
|
|
@ -150,7 +151,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
else
|
||||
{
|
||||
rc_team = sObjectMgr.GetPlayerTeamByGUID(rc);
|
||||
if (QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", GUID_LOPART(rc)))
|
||||
if (QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", rc.GetCounter()))
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
mails_count = fields[0].GetUInt32();
|
||||
|
|
@ -249,7 +250,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
item->DeleteFromInventoryDB(); // deletes item from character's inventory
|
||||
item->SaveToDB(); // recursive and not have transaction guard into self, item not in inventory and can be save standalone
|
||||
// owner in data will set at mail receive and item extracting
|
||||
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", GUID_LOPART(rc), item->GetGUIDLow());
|
||||
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", rc.GetCounter(), item->GetGUIDLow());
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
draft.AddItem(item);
|
||||
|
|
@ -273,7 +274,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
draft
|
||||
.AddMoney(money)
|
||||
.AddCOD(COD)
|
||||
.SendMailTo(MailReceiver(receive, GUID_LOPART(rc)), pl, body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
.SendMailTo(MailReceiver(receive, rc), pl, body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
|
||||
CharacterDatabase.BeginTransaction();
|
||||
pl->SaveInventoryAndGoldToDB();
|
||||
|
|
@ -403,7 +404,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
draft.AddMoney(m->money).SendReturnToSender(GetAccountId(), m->receiver, m->sender);
|
||||
draft.AddMoney(m->money).SendReturnToSender(GetAccountId(), m->receiverGuid, ObjectGuid(HIGHGUID_PLAYER, m->sender));
|
||||
}
|
||||
|
||||
delete m; // we can deallocate old mail
|
||||
|
|
@ -453,17 +454,17 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
|
|||
if (m->COD > 0) // if there is COD, take COD money from player and send them to sender by mail
|
||||
{
|
||||
ObjectGuid sender_guid = ObjectGuid(HIGHGUID_PLAYER, m->sender);
|
||||
Player *receive = sObjectMgr.GetPlayer(sender_guid);
|
||||
Player *sender = sObjectMgr.GetPlayer(sender_guid);
|
||||
|
||||
uint32 sender_accId = 0;
|
||||
|
||||
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE) )
|
||||
{
|
||||
std::string sender_name;
|
||||
if(receive)
|
||||
if(sender)
|
||||
{
|
||||
sender_accId = receive->GetSession()->GetAccountId();
|
||||
sender_name = receive->GetName();
|
||||
sender_accId = sender->GetSession()->GetAccountId();
|
||||
sender_name = sender->GetName();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -476,15 +477,15 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
|
|||
sLog.outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
|
||||
GetPlayerName(), GetAccountId(), it->GetProto()->Name1, it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId);
|
||||
}
|
||||
else if(!receive)
|
||||
else if(!sender)
|
||||
sender_accId = sObjectMgr.GetPlayerAccountIdByGUID(sender_guid);
|
||||
|
||||
// check player existence
|
||||
if(receive || sender_accId)
|
||||
if(sender || sender_accId)
|
||||
{
|
||||
MailDraft(m->subject, "")
|
||||
.AddMoney(m->COD)
|
||||
.SendMailTo(MailReceiver(receive, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
|
||||
.SendMailTo(MailReceiver(sender, sender_guid), MailSender(MAIL_NORMAL, m->receiverGuid.GetCounter()), MAIL_CHECK_MASK_COD_PAYMENT);
|
||||
}
|
||||
|
||||
pl->ModifyMoney( -int32(m->COD) );
|
||||
|
|
@ -764,7 +765,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /**recv_data*/ )
|
|||
if(now < m->deliver_time)
|
||||
continue;
|
||||
|
||||
data << uint64(m->sender); // sender guid
|
||||
data << ObjectGuid(HIGHGUID_PLAYER, m->sender); // sender guid
|
||||
|
||||
switch(m->messageType)
|
||||
{
|
||||
|
|
@ -843,7 +844,7 @@ MailSender::MailSender( AuctionEntry* sender )
|
|||
*
|
||||
* @param receiver The player receiving the mail.
|
||||
*/
|
||||
MailReceiver::MailReceiver( Player* receiver ) : m_receiver(receiver), m_receiver_lowguid(receiver->GetGUIDLow())
|
||||
MailReceiver::MailReceiver(Player* receiver) : m_receiver(receiver), m_receiver_guid(receiver->GetObjectGuid())
|
||||
{
|
||||
}
|
||||
/**
|
||||
|
|
@ -852,9 +853,9 @@ MailReceiver::MailReceiver( Player* receiver ) : m_receiver(receiver), m_receive
|
|||
* @param receiver The player receiving the mail.
|
||||
* @param receiver_lowguid The GUID to use instead of the receivers.
|
||||
*/
|
||||
MailReceiver::MailReceiver( Player* receiver,uint32 receiver_lowguid ) : m_receiver(receiver), m_receiver_lowguid(receiver_lowguid)
|
||||
MailReceiver::MailReceiver(Player* receiver, ObjectGuid receiver_guid) : m_receiver(receiver), m_receiver_guid(receiver_guid)
|
||||
{
|
||||
MANGOS_ASSERT(!receiver || receiver->GetGUIDLow() == receiver_lowguid);
|
||||
MANGOS_ASSERT(!receiver || receiver->GetObjectGuid() == receiver_guid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -921,9 +922,8 @@ void MailDraft::deleteIncludedItems( bool inDB /**= false*/ )
|
|||
* @param sender_guid The low part of the GUID of the sender.
|
||||
* @param receiver_guid The low part of the GUID of the receiver.
|
||||
*/
|
||||
void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_lowguid, uint32 receiver_lowguid)
|
||||
void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid sender_guid, ObjectGuid receiver_guid)
|
||||
{
|
||||
ObjectGuid receiver_guid = ObjectGuid(HIGHGUID_PLAYER, receiver_lowguid);
|
||||
Player *receiver = sObjectMgr.GetPlayer(receiver_guid);
|
||||
|
||||
uint32 rc_account = 0;
|
||||
|
|
@ -951,7 +951,7 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_lowguid, uin
|
|||
Item* item = mailItemIter->second;
|
||||
item->SaveToDB(); // item not in inventory and can be save standalone
|
||||
// owner in data will set at mail receive and item extracting
|
||||
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", receiver_lowguid, item->GetGUIDLow());
|
||||
CharacterDatabase.PExecute("UPDATE item_instance SET owner_guid = '%u' WHERE guid='%u'", receiver_guid.GetCounter(), item->GetGUIDLow());
|
||||
}
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
|
|
@ -960,7 +960,7 @@ void MailDraft::SendReturnToSender(uint32 sender_acc, uint32 sender_lowguid, uin
|
|||
uint32 deliver_delay = needItemDelay ? sWorld.getConfig(CONFIG_UINT32_MAIL_DELIVERY_DELAY) : 0;
|
||||
|
||||
// will delete item or place to receiver mail list
|
||||
SendMailTo(MailReceiver(receiver,receiver_lowguid), MailSender(MAIL_NORMAL, sender_lowguid), MAIL_CHECK_MASK_RETURNED, deliver_delay);
|
||||
SendMailTo(MailReceiver(receiver,receiver_guid), MailSender(MAIL_NORMAL, sender_guid.GetCounter()), MAIL_CHECK_MASK_RETURNED, deliver_delay);
|
||||
}
|
||||
/**
|
||||
* Sends a mail.
|
||||
|
|
@ -1006,12 +1006,13 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
|||
|
||||
CharacterDatabase.PExecute("INSERT INTO mail (id,messageType,stationery,mailTemplateId,sender,receiver,subject,body,has_items,expire_time,deliver_time,money,cod,checked) "
|
||||
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%s', '%u', '" UI64FMTD "','" UI64FMTD "', '%u', '%u', '%u')",
|
||||
mailId, sender.GetMailMessageType(), sender.GetStationery(), GetMailTemplateId(), sender.GetSenderId(), receiver.GetPlayerGUIDLow(), safe_subject.c_str(), safe_body.c_str(), (m_items.empty() ? 0 : 1), (uint64)expire_time, (uint64)deliver_time, m_money, m_COD, checked);
|
||||
mailId, sender.GetMailMessageType(), sender.GetStationery(), GetMailTemplateId(), sender.GetSenderId(), receiver.GetPlayerGuid().GetCounter(), safe_subject.c_str(), safe_body.c_str(), (m_items.empty() ? 0 : 1), (uint64)expire_time, (uint64)deliver_time, m_money, m_COD, checked);
|
||||
|
||||
for(MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
{
|
||||
Item* item = mailItemIter->second;
|
||||
CharacterDatabase.PExecute("INSERT INTO mail_items (mail_id,item_guid,item_template,receiver) VALUES ('%u', '%u', '%u','%u')", mailId, item->GetGUIDLow(), item->GetEntry(), receiver.GetPlayerGUIDLow());
|
||||
CharacterDatabase.PExecute("INSERT INTO mail_items (mail_id,item_guid,item_template,receiver) VALUES ('%u', '%u', '%u','%u')",
|
||||
mailId, item->GetGUIDLow(), item->GetEntry(), receiver.GetPlayerGuid().GetCounter());
|
||||
}
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
|
|
@ -1037,7 +1038,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
|||
m->messageType = sender.GetMailMessageType();
|
||||
m->stationery = sender.GetStationery();
|
||||
m->sender = sender.GetSenderId();
|
||||
m->receiver = receiver.GetPlayerGUIDLow();
|
||||
m->receiverGuid = receiver.GetPlayerGuid();
|
||||
m->expire_time = expire_time;
|
||||
m->deliver_time = deliver_time;
|
||||
m->checked = checked;
|
||||
|
|
|
|||
|
|
@ -133,6 +133,9 @@ class MailSender
|
|||
/// The stationary associated with this MailSender
|
||||
MailStationery GetStationery() const { return m_stationery; }
|
||||
private:
|
||||
// Trap for wrong used guid as low guid, no body
|
||||
MailSender(MailMessageType messageType, uint64 wrong_guid, MailStationery stationery = MAIL_STATIONERY_DEFAULT);
|
||||
|
||||
MailMessageType m_messageType;
|
||||
uint32 m_senderId; // player low guid or other object entry
|
||||
MailStationery m_stationery;
|
||||
|
|
@ -143,9 +146,9 @@ class MailSender
|
|||
class MailReceiver
|
||||
{
|
||||
public: // Constructors
|
||||
explicit MailReceiver(uint32 receiver_lowguid) : m_receiver(NULL), m_receiver_lowguid(receiver_lowguid) {}
|
||||
explicit MailReceiver(ObjectGuid receiver_guid) : m_receiver(NULL), m_receiver_guid(receiver_guid) {}
|
||||
MailReceiver(Player* receiver);
|
||||
MailReceiver(Player* receiver,uint32 receiver_lowguid);
|
||||
MailReceiver(Player* receiver, ObjectGuid receiver_guid);
|
||||
public: // Accessors
|
||||
/**
|
||||
* Gets the player associated with this MailReciever
|
||||
|
|
@ -161,10 +164,10 @@ class MailReceiver
|
|||
*
|
||||
* @returns the low part of the GUID of the player associated with this MailReciever
|
||||
*/
|
||||
uint32 GetPlayerGUIDLow() const { return m_receiver_lowguid; }
|
||||
ObjectGuid const& GetPlayerGuid() const { return m_receiver_guid; }
|
||||
private:
|
||||
Player* m_receiver;
|
||||
uint32 m_receiver_lowguid;
|
||||
ObjectGuid m_receiver_guid;
|
||||
};
|
||||
/**
|
||||
* The class to represent the draft of a mail.
|
||||
|
|
@ -221,7 +224,7 @@ class MailDraft
|
|||
*/
|
||||
MailDraft& AddCOD(uint32 COD) { m_COD = COD; return *this; }
|
||||
public: // finishers
|
||||
void SendReturnToSender(uint32 sender_acc, uint32 sender_lowguid, uint32 receiver_lowguid);
|
||||
void SendReturnToSender(uint32 sender_acc, ObjectGuid sender_guid, ObjectGuid receiver_guid);
|
||||
void SendMailTo(MailReceiver const& receiver, MailSender const& sender, MailCheckMask checked = MAIL_CHECK_MASK_NONE, uint32 deliver_delay = 0);
|
||||
private:
|
||||
void deleteIncludedItems(bool inDB = false);
|
||||
|
|
@ -264,10 +267,10 @@ struct Mail
|
|||
uint8 stationery;
|
||||
/// the ID of the template this mail is based on.
|
||||
uint16 mailTemplateId;
|
||||
/// the GUID of the player that sent this mail.
|
||||
/// the LowGUID of the player that sent this mail, or creature low guid, or other id
|
||||
uint32 sender;
|
||||
/// the GUID of the player that this mail is sent to.
|
||||
uint32 receiver;
|
||||
ObjectGuid receiverGuid;
|
||||
/// the subject of the mail
|
||||
std::string subject;
|
||||
/// the body of the mail
|
||||
|
|
|
|||
|
|
@ -5472,7 +5472,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|||
m->messageID = fields[0].GetUInt32();
|
||||
m->messageType = fields[1].GetUInt8();
|
||||
m->sender = fields[2].GetUInt32();
|
||||
m->receiver = fields[3].GetUInt32();
|
||||
m->receiverGuid = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
|
||||
bool has_items = fields[4].GetBool();
|
||||
m->expire_time = (time_t)fields[5].GetUInt64();
|
||||
m->deliver_time = 0;
|
||||
|
|
@ -5482,7 +5482,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|||
|
||||
Player *pl = 0;
|
||||
if (serverUp)
|
||||
pl = GetPlayer((uint64)m->receiver);
|
||||
pl = GetPlayer(m->receiverGuid);
|
||||
if (pl)
|
||||
{ //this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
|
||||
//his in mailbox and he has already listed his mails )
|
||||
|
|
@ -5518,7 +5518,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|||
else
|
||||
{
|
||||
//mail will be returned:
|
||||
CharacterDatabase.PExecute("UPDATE mail SET sender = '%u', receiver = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',cod = '0', checked = '%u' WHERE id = '%u'", m->receiver, m->sender, (uint64)(basetime + 30*DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID);
|
||||
CharacterDatabase.PExecute("UPDATE mail SET sender = '%u', receiver = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "',cod = '0', checked = '%u' WHERE id = '%u'",
|
||||
m->receiverGuid.GetCounter(), m->sender, (uint64)(basetime + 30*DAY), (uint64)basetime, MAIL_CHECK_MASK_RETURNED, m->messageID);
|
||||
delete m;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4260,7 +4260,7 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
|
|||
|
||||
uint32 pl_account = sObjectMgr.GetPlayerAccountIdByGUID(playerguid);
|
||||
|
||||
draft.AddMoney(money).SendReturnToSender(pl_account, lowguid, sender);
|
||||
draft.AddMoney(money).SendReturnToSender(pl_account, playerguid, ObjectGuid(HIGHGUID_PLAYER, sender));
|
||||
}
|
||||
while (resultMail->NextRow());
|
||||
|
||||
|
|
@ -16155,7 +16155,7 @@ void Player::_LoadMails(QueryResult *result)
|
|||
m->messageID = fields[0].GetUInt32();
|
||||
m->messageType = fields[1].GetUInt8();
|
||||
m->sender = fields[2].GetUInt32();
|
||||
m->receiver = fields[3].GetUInt32();
|
||||
m->receiverGuid = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
|
||||
m->subject = fields[4].GetCppString();
|
||||
m->body = fields[5].GetCppString();
|
||||
m->expire_time = (time_t)fields[6].GetUInt64();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10801"
|
||||
#define REVISION_NR "10802"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue