mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Mail: Naming sync with 3.3.5
This commit is contained in:
@@ -61,21 +61,21 @@ bool WorldSession::CanOpenMailBox(ObjectGuid guid)
|
||||
return true;
|
||||
}
|
||||
|
||||
void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& sendMail)
|
||||
{
|
||||
if (packet.Info.Attachments.size() > MAX_CLIENT_MAIL_ITEMS) // client limit
|
||||
if (sendMail.Info.Attachments.size() > MAX_CLIENT_MAIL_ITEMS) // client limit
|
||||
{
|
||||
GetPlayer()->SendMailResult(0, MAIL_SEND, MAIL_ERR_TOO_MANY_ATTACHMENTS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanOpenMailBox(packet.Info.Mailbox))
|
||||
if (!CanOpenMailBox(sendMail.Info.Mailbox))
|
||||
return;
|
||||
|
||||
if (packet.Info.Target.empty())
|
||||
if (sendMail.Info.Target.empty())
|
||||
return;
|
||||
|
||||
if (!ValidateHyperlinksAndMaybeKick(packet.Info.Subject) || !ValidateHyperlinksAndMaybeKick(packet.Info.Body))
|
||||
if (!ValidateHyperlinksAndMaybeKick(sendMail.Info.Subject) || !ValidateHyperlinksAndMaybeKick(sendMail.Info.Body))
|
||||
return;
|
||||
|
||||
Player* player = _player;
|
||||
@@ -87,39 +87,39 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
}
|
||||
|
||||
ObjectGuid receiverGuid;
|
||||
if (normalizePlayerName(packet.Info.Target))
|
||||
receiverGuid = sCharacterCache->GetCharacterGuidByName(packet.Info.Target);
|
||||
if (normalizePlayerName(sendMail.Info.Target))
|
||||
receiverGuid = sCharacterCache->GetCharacterGuidByName(sendMail.Info.Target);
|
||||
|
||||
if (!receiverGuid)
|
||||
{
|
||||
TC_LOG_INFO("network", "Player %s is sending mail to %s (GUID: non-existing!) with subject %s "
|
||||
"and body %s includes " SZFMTD " items, " SI64FMTD " copper and " SI64FMTD " COD copper with StationeryID = %d",
|
||||
GetPlayerInfo().c_str(), packet.Info.Target.c_str(), packet.Info.Subject.c_str(), packet.Info.Body.c_str(),
|
||||
packet.Info.Attachments.size(), packet.Info.SendMoney, packet.Info.Cod, packet.Info.StationeryID);
|
||||
GetPlayerInfo().c_str(), sendMail.Info.Target.c_str(), sendMail.Info.Subject.c_str(), sendMail.Info.Body.c_str(),
|
||||
sendMail.Info.Attachments.size(), sendMail.Info.SendMoney, sendMail.Info.Cod, sendMail.Info.StationeryID);
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.Info.SendMoney < 0)
|
||||
if (sendMail.Info.SendMoney < 0)
|
||||
{
|
||||
GetPlayer()->SendMailResult(0, MAIL_SEND, MAIL_ERR_INTERNAL_ERROR);
|
||||
TC_LOG_WARN("cheat", "Player %s attempted to send mail to %s (%s) with negative money value (SendMoney: " SI64FMTD ")",
|
||||
GetPlayerInfo().c_str(), packet.Info.Target.c_str(), receiverGuid.ToString().c_str(), packet.Info.SendMoney);
|
||||
GetPlayerInfo().c_str(), sendMail.Info.Target.c_str(), receiverGuid.ToString().c_str(), sendMail.Info.SendMoney);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.Info.Cod < 0)
|
||||
if (sendMail.Info.Cod < 0)
|
||||
{
|
||||
GetPlayer()->SendMailResult(0, MAIL_SEND, MAIL_ERR_INTERNAL_ERROR);
|
||||
TC_LOG_WARN("cheat", "Player %s attempted to send mail to %s (%s) with negative COD value (Cod: " SI64FMTD ")",
|
||||
GetPlayerInfo().c_str(), packet.Info.Target.c_str(), receiverGuid.ToString().c_str(), packet.Info.Cod);
|
||||
GetPlayerInfo().c_str(), sendMail.Info.Target.c_str(), receiverGuid.ToString().c_str(), sendMail.Info.Cod);
|
||||
return;
|
||||
}
|
||||
|
||||
TC_LOG_INFO("network", "Player %s is sending mail to %s (%s) with subject %s and body %s "
|
||||
"includes " SZFMTD " items, " SI64FMTD " copper and " SI64FMTD " COD copper with StationeryID = %d",
|
||||
GetPlayerInfo().c_str(), packet.Info.Target.c_str(), receiverGuid.ToString().c_str(), packet.Info.Subject.c_str(),
|
||||
packet.Info.Body.c_str(), packet.Info.Attachments.size(), packet.Info.SendMoney, packet.Info.Cod, packet.Info.StationeryID);
|
||||
GetPlayerInfo().c_str(), sendMail.Info.Target.c_str(), receiverGuid.ToString().c_str(), sendMail.Info.Subject.c_str(),
|
||||
sendMail.Info.Body.c_str(), sendMail.Info.Attachments.size(), sendMail.Info.SendMoney, sendMail.Info.Cod, sendMail.Info.StationeryID);
|
||||
|
||||
if (player->GetGUID() == receiverGuid)
|
||||
{
|
||||
@@ -127,12 +127,12 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 cost = !packet.Info.Attachments.empty() ? 30 * packet.Info.Attachments.size() : 30; // price hardcoded in client
|
||||
uint32 cost = !sendMail.Info.Attachments.empty() ? 30 * sendMail.Info.Attachments.size() : 30; // price hardcoded in client
|
||||
|
||||
int64 reqmoney = cost + packet.Info.SendMoney;
|
||||
int64 reqmoney = cost + sendMail.Info.SendMoney;
|
||||
|
||||
// Check for overflow
|
||||
if (reqmoney < packet.Info.SendMoney)
|
||||
if (reqmoney < sendMail.Info.SendMoney)
|
||||
{
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
@@ -190,8 +190,8 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
}
|
||||
|
||||
// test the receiver's Faction... or all items are account bound
|
||||
bool accountBound = !packet.Info.Attachments.empty();
|
||||
for (auto const& att : packet.Info.Attachments)
|
||||
bool accountBound = !sendMail.Info.Attachments.empty();
|
||||
for (auto const& att : sendMail.Info.Attachments)
|
||||
{
|
||||
if (Item* item = player->GetItemByGuid(att.ItemGUID))
|
||||
{
|
||||
@@ -218,7 +218,7 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
|
||||
std::vector<Item*> items;
|
||||
|
||||
for (auto const& att : packet.Info.Attachments)
|
||||
for (auto const& att : sendMail.Info.Attachments)
|
||||
{
|
||||
if (att.ItemGUID.IsEmpty())
|
||||
{
|
||||
@@ -256,7 +256,7 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet.Info.Cod && item->IsWrapped())
|
||||
if (sendMail.Info.Cod && item->IsWrapped())
|
||||
{
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANT_SEND_WRAPPED_COD);
|
||||
return;
|
||||
@@ -278,14 +278,14 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
|
||||
bool needItemDelay = false;
|
||||
|
||||
MailDraft draft(packet.Info.Subject, packet.Info.Body);
|
||||
MailDraft draft(sendMail.Info.Subject, sendMail.Info.Body);
|
||||
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
if (!packet.Info.Attachments.empty() || packet.Info.SendMoney > 0)
|
||||
if (!sendMail.Info.Attachments.empty() || sendMail.Info.SendMoney > 0)
|
||||
{
|
||||
bool log = HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE);
|
||||
if (!packet.Info.Attachments.empty())
|
||||
if (!sendMail.Info.Attachments.empty())
|
||||
{
|
||||
for (auto const& item : items)
|
||||
{
|
||||
@@ -294,7 +294,7 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
sLog->outCommand(GetAccountId(), "GM %s (%s) (Account: %u) mail item: %s (Entry: %u Count: %u) "
|
||||
"to: %s (%s) (Account: %u)", GetPlayerName().c_str(), _player->GetGUID().ToString().c_str(), GetAccountId(),
|
||||
item->GetTemplate()->GetDefaultLocaleName(), item->GetEntry(), item->GetCount(),
|
||||
packet.Info.Target.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
|
||||
sendMail.Info.Target.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
|
||||
}
|
||||
|
||||
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
|
||||
@@ -312,10 +312,10 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
needItemDelay = player->GetSession()->GetAccountId() != receiverAccountId;
|
||||
}
|
||||
|
||||
if (log && packet.Info.SendMoney > 0)
|
||||
if (log && sendMail.Info.SendMoney > 0)
|
||||
{
|
||||
sLog->outCommand(GetAccountId(), "GM %s (%s) (Account: %u) mail money: " SI64FMTD " to: %s (%s) (Account: %u)",
|
||||
GetPlayerName().c_str(), _player->GetGUID().ToString().c_str(), GetAccountId(), packet.Info.SendMoney, packet.Info.Target.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
|
||||
GetPlayerName().c_str(), _player->GetGUID().ToString().c_str(), GetAccountId(), sendMail.Info.SendMoney, sendMail.Info.Target.c_str(), receiverGuid.ToString().c_str(), receiverAccountId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,27 +328,27 @@ void WorldSession::HandleSendMail(WorldPackets::Mail::SendMail& packet)
|
||||
deliver_delay = 0;
|
||||
|
||||
// don't ask for COD if there are no items
|
||||
if (packet.Info.Attachments.empty())
|
||||
packet.Info.Cod = 0;
|
||||
if (sendMail.Info.Attachments.empty())
|
||||
sendMail.Info.Cod = 0;
|
||||
|
||||
// will delete item or place to receiver mail list
|
||||
draft
|
||||
.AddMoney(packet.Info.SendMoney)
|
||||
.AddCOD(packet.Info.Cod)
|
||||
.SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), MailSender(player), packet.Info.Body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
.AddMoney(sendMail.Info.SendMoney)
|
||||
.AddCOD(sendMail.Info.Cod)
|
||||
.SendMailTo(trans, MailReceiver(receiver, receiverGuid.GetCounter()), MailSender(player), sendMail.Info.Body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
//called when mail is read
|
||||
void WorldSession::HandleMailMarkAsRead(WorldPackets::Mail::MailMarkAsRead& packet)
|
||||
void WorldSession::HandleMailMarkAsRead(WorldPackets::Mail::MailMarkAsRead& markAsRead)
|
||||
{
|
||||
if (!CanOpenMailBox(packet.Mailbox))
|
||||
if (!CanOpenMailBox(markAsRead.Mailbox))
|
||||
return;
|
||||
|
||||
Player* player = _player;
|
||||
Mail* m = player->GetMail(packet.MailID);
|
||||
Mail* m = player->GetMail(markAsRead.MailID);
|
||||
if (m && m->state != MAIL_STATE_DELETED)
|
||||
{
|
||||
if (player->unReadMails)
|
||||
@@ -360,9 +360,9 @@ void WorldSession::HandleMailMarkAsRead(WorldPackets::Mail::MailMarkAsRead& pack
|
||||
}
|
||||
|
||||
//called when client deletes mail
|
||||
void WorldSession::HandleMailDelete(WorldPackets::Mail::MailDelete& packet)
|
||||
void WorldSession::HandleMailDelete(WorldPackets::Mail::MailDelete& mailDelete)
|
||||
{
|
||||
Mail* m = _player->GetMail(packet.MailID);
|
||||
Mail* m = _player->GetMail(mailDelete.MailID);
|
||||
Player* player = _player;
|
||||
player->m_mailsUpdated = true;
|
||||
if (m)
|
||||
@@ -370,39 +370,39 @@ void WorldSession::HandleMailDelete(WorldPackets::Mail::MailDelete& packet)
|
||||
// delete shouldn't show up for COD mails
|
||||
if (m->COD)
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(mailDelete.MailID, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
m->state = MAIL_STATE_DELETED;
|
||||
}
|
||||
player->SendMailResult(packet.MailID, MAIL_DELETED, MAIL_OK);
|
||||
player->SendMailResult(mailDelete.MailID, MAIL_DELETED, MAIL_OK);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMailReturnToSender(WorldPackets::Mail::MailReturnToSender& packet)
|
||||
void WorldSession::HandleMailReturnToSender(WorldPackets::Mail::MailReturnToSender& returnToSender)
|
||||
{
|
||||
if (!CanOpenMailBox(_player->PlayerTalkClass->GetInteractionData().SourceGuid))
|
||||
return;
|
||||
|
||||
Player* player = _player;
|
||||
Mail* m = player->GetMail(packet.MailID);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime() || m->sender != packet.SenderGUID.GetCounter())
|
||||
Mail* m = player->GetMail(returnToSender.MailID);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime() || m->sender != returnToSender.SenderGUID.GetCounter())
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(returnToSender.MailID, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
//we can return mail now, so firstly delete the old one
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
|
||||
stmt->setUInt32(0, packet.MailID);
|
||||
stmt->setUInt32(0, returnToSender.MailID);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM_BY_ID);
|
||||
stmt->setUInt32(0, packet.MailID);
|
||||
stmt->setUInt32(0, returnToSender.MailID);
|
||||
trans->Append(stmt);
|
||||
|
||||
player->RemoveMail(packet.MailID);
|
||||
player->RemoveMail(returnToSender.MailID);
|
||||
|
||||
// only return mail if the player exists (and delete if not existing)
|
||||
if (m->messageType == MAIL_NORMAL && m->sender)
|
||||
@@ -426,49 +426,49 @@ void WorldSession::HandleMailReturnToSender(WorldPackets::Mail::MailReturnToSend
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
delete m; //we can deallocate old mail
|
||||
player->SendMailResult(packet.MailID, MAIL_RETURNED_TO_SENDER, MAIL_OK);
|
||||
player->SendMailResult(returnToSender.MailID, MAIL_RETURNED_TO_SENDER, MAIL_OK);
|
||||
}
|
||||
|
||||
//called when player takes item attached in mail
|
||||
void WorldSession::HandleMailTakeItem(WorldPackets::Mail::MailTakeItem& packet)
|
||||
void WorldSession::HandleMailTakeItem(WorldPackets::Mail::MailTakeItem& takeItem)
|
||||
{
|
||||
uint32 AttachID = packet.AttachID;
|
||||
uint32 AttachID = takeItem.AttachID;
|
||||
|
||||
if (!CanOpenMailBox(packet.Mailbox))
|
||||
if (!CanOpenMailBox(takeItem.Mailbox))
|
||||
return;
|
||||
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(packet.MailID);
|
||||
Mail* m = player->GetMail(takeItem.MailID);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime())
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(takeItem.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// verify that the mail has the item to avoid cheaters taking COD items without paying
|
||||
if (std::find_if(m->items.begin(), m->items.end(), [AttachID](MailItemInfo info){ return info.item_guid == AttachID; }) == m->items.end())
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(takeItem.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent cheating with skip client money check
|
||||
if (!player->HasEnoughMoney(m->COD))
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
player->SendMailResult(takeItem.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
}
|
||||
|
||||
Item* it = player->GetMItem(packet.AttachID);
|
||||
Item* it = player->GetMItem(takeItem.AttachID);
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
m->RemoveItem(packet.AttachID);
|
||||
m->removedItems.push_back(packet.AttachID);
|
||||
m->RemoveItem(takeItem.AttachID);
|
||||
m->removedItems.push_back(takeItem.AttachID);
|
||||
|
||||
if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail
|
||||
{
|
||||
@@ -522,30 +522,30 @@ void WorldSession::HandleMailTakeItem(WorldPackets::Mail::MailTakeItem& packet)
|
||||
player->_SaveMail(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
player->SendMailResult(packet.MailID, MAIL_ITEM_TAKEN, MAIL_OK, 0, packet.AttachID, count);
|
||||
player->SendMailResult(takeItem.MailID, MAIL_ITEM_TAKEN, MAIL_OK, 0, takeItem.AttachID, count);
|
||||
}
|
||||
else
|
||||
player->SendMailResult(packet.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
player->SendMailResult(takeItem.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMailTakeMoney(WorldPackets::Mail::MailTakeMoney& packet)
|
||||
void WorldSession::HandleMailTakeMoney(WorldPackets::Mail::MailTakeMoney& takeMoney)
|
||||
{
|
||||
if (!CanOpenMailBox(packet.Mailbox))
|
||||
if (!CanOpenMailBox(takeMoney.Mailbox))
|
||||
return;
|
||||
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(packet.MailID);
|
||||
Mail* m = player->GetMail(takeMoney.MailID);
|
||||
if ((!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime()) ||
|
||||
(packet.Money > 0 && m->money != uint64(packet.Money)))
|
||||
(takeMoney.Money > 0 && m->money != uint64(takeMoney.Money)))
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(takeMoney.MailID, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->ModifyMoney(m->money, false))
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_MONEY_TAKEN, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_TOO_MUCH_GOLD);
|
||||
player->SendMailResult(takeMoney.MailID, MAIL_MONEY_TAKEN, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_TOO_MUCH_GOLD);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ void WorldSession::HandleMailTakeMoney(WorldPackets::Mail::MailTakeMoney& packet
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
player->m_mailsUpdated = true;
|
||||
|
||||
player->SendMailResult(packet.MailID, MAIL_MONEY_TAKEN, MAIL_OK);
|
||||
player->SendMailResult(takeMoney.MailID, MAIL_MONEY_TAKEN, MAIL_OK);
|
||||
|
||||
// save money and mail to prevent cheating
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
@@ -563,9 +563,9 @@ void WorldSession::HandleMailTakeMoney(WorldPackets::Mail::MailTakeMoney& packet
|
||||
}
|
||||
|
||||
//called when player lists his received mails
|
||||
void WorldSession::HandleGetMailList(WorldPackets::Mail::MailGetList& packet)
|
||||
void WorldSession::HandleGetMailList(WorldPackets::Mail::MailGetList& getList)
|
||||
{
|
||||
if (!CanOpenMailBox(packet.Mailbox))
|
||||
if (!CanOpenMailBox(getList.Mailbox))
|
||||
return;
|
||||
|
||||
Player* player = _player;
|
||||
@@ -587,7 +587,7 @@ void WorldSession::HandleGetMailList(WorldPackets::Mail::MailGetList& packet)
|
||||
}
|
||||
|
||||
player->PlayerTalkClass->GetInteractionData().Reset();
|
||||
player->PlayerTalkClass->GetInteractionData().SourceGuid = packet.Mailbox;
|
||||
player->PlayerTalkClass->GetInteractionData().SourceGuid = getList.Mailbox;
|
||||
SendPacket(response.Write());
|
||||
|
||||
// recalculate m_nextMailDelivereTime and unReadMails
|
||||
@@ -595,17 +595,17 @@ void WorldSession::HandleGetMailList(WorldPackets::Mail::MailGetList& packet)
|
||||
}
|
||||
|
||||
//used when player copies mail body to his inventory
|
||||
void WorldSession::HandleMailCreateTextItem(WorldPackets::Mail::MailCreateTextItem& packet)
|
||||
void WorldSession::HandleMailCreateTextItem(WorldPackets::Mail::MailCreateTextItem& createTextItem)
|
||||
{
|
||||
if (!CanOpenMailBox(packet.Mailbox))
|
||||
if (!CanOpenMailBox(createTextItem.Mailbox))
|
||||
return;
|
||||
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(packet.MailID);
|
||||
Mail* m = player->GetMail(createTextItem.MailID);
|
||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime() || (m->checked & MAIL_CHECK_MASK_COPIED))
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
player->SendMailResult(createTextItem.MailID, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -640,16 +640,16 @@ void WorldSession::HandleMailCreateTextItem(WorldPackets::Mail::MailCreateTextIt
|
||||
player->m_mailsUpdated = true;
|
||||
|
||||
player->StoreItem(dest, bodyItem, true);
|
||||
player->SendMailResult(packet.MailID, MAIL_MADE_PERMANENT, MAIL_OK);
|
||||
player->SendMailResult(createTextItem.MailID, MAIL_MADE_PERMANENT, MAIL_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
player->SendMailResult(createTextItem.MailID, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
delete bodyItem;
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleQueryNextMailTime(WorldPackets::Mail::MailQueryNextMailTime& /*packet*/)
|
||||
void WorldSession::HandleQueryNextMailTime(WorldPackets::Mail::MailQueryNextMailTime& /*queryNextMailTime*/)
|
||||
{
|
||||
WorldPackets::Mail::MailQueryNextTimeResult result;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user