Core/Mail: Implemented sending battle.net account bound items
This commit is contained in:
1 parent
6e35288d5c
commit
41daea5b4e
5 files changed
+22
-3
No files matched your search
@@ -28,6 +28,7 @@
|
||||
#include "DBCStores.h"
|
||||
#include "Item.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "BattlenetAccountMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
|
||||
bool WorldSession::CanOpenMailBox(uint64 guid)
|
||||
@@ -192,6 +193,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
uint8 mailsCount = 0; //do not allow to send to one player more than 100 mails
|
||||
uint8 receiverLevel = 0;
|
||||
uint32 receiverAccountId = 0;
|
||||
uint32 receiverBnetAccountId = 0;
|
||||
|
||||
if (receiver)
|
||||
{
|
||||
@@ -199,6 +201,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
mailsCount = receiver->GetMailSize();
|
||||
receiverLevel = receiver->getLevel();
|
||||
receiverAccountId = receiver->GetSession()->GetAccountId();
|
||||
receiverBnetAccountId = receiver->GetSession()->GetBattlenetAccountId();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -225,6 +228,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
receiverAccountId = sObjectMgr->GetPlayerAccountIdByGUID(receiverGuid);
|
||||
receiverBnetAccountId = Battlenet::AccountMgr::GetIdByGameAccount(receiverAccountId);
|
||||
}
|
||||
|
||||
// do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
|
||||
@@ -288,8 +292,11 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
|
||||
if (item->IsBoundAccountWide() && item->IsSoulBound() && player->GetSession()->GetAccountId() != receiverAccountId)
|
||||
{
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_NOT_SAME_ACCOUNT);
|
||||
return;
|
||||
if (!item->IsBattlenetAccountBound() || !player->GetSession()->GetBattlenetAccountId() || player->GetSession()->GetBattlenetAccountId() != receiverBnetAccountId)
|
||||
{
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_NOT_SAME_ACCOUNT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION))
|
||||
|
||||
Reference in new issue
Block a user