Updated to client build 11723.

This commit is contained in:
tomrus88 2010-03-27 03:50:35 +03:00
parent 811f0e7ebf
commit dd3d5eec69
14 changed files with 102 additions and 110 deletions

View file

@ -41,17 +41,7 @@
#include "BattleGroundMgr.h"
#include "Item.h"
#include "AuctionHouseMgr.h"
/**
* Flags that specify special action to be take by the client when displaying this mail.
*/
enum MailShowFlags
{
MAIL_SHOW_UNK0 = 0x0001,
MAIL_SHOW_DELETE = 0x0002, ///< forced show of the delete button instead of the return button
MAIL_SHOW_AUCTION = 0x0004, ///< from old comment
MAIL_SHOW_UNK2 = 0x0008, ///< unknown, COD will be shown even without that flag
MAIL_SHOW_RETURN = 0x0010,
};
/**
* Handles the Packet sent by the client when sending a mail.
*
@ -168,7 +158,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
}
}
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
// do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
if (mails_count > 100)
{
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
@ -312,8 +302,8 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data )
return;
Player *pl = _player;
Mail *m = pl->GetMail(mailId);
if (m)
if (Mail *m = pl->GetMail(mailId))
{
if (pl->unReadMails)
--pl->unReadMails;
@ -344,8 +334,8 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data )
Player* pl = _player;
pl->m_mailsUpdated = true;
Mail *m = pl->GetMail(mailId);
if(m)
if(Mail *m = pl->GetMail(mailId))
{
// delete shouldn't show up for COD mails
if (m->COD)
@ -385,6 +375,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
return;
}
//we can return mail now
//so firstly delete the old one
CharacterDatabase.BeginTransaction();
@ -399,19 +390,14 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
{
MailDraft draft(m->subject, m->body);
if (m->mailTemplateId)
draft = MailDraft(m->mailTemplateId,false); // items already included
draft = MailDraft(m->mailTemplateId, false); // items already included
if(m->HasItems())
{
for(std::vector<MailItemInfo>::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
{
Item *item = pl->GetMItem(itr2->item_guid);
if(item)
if(Item *item = pl->GetMItem(itr2->item_guid))
draft.AddItem(item);
else
{
//WTF?
}
pl->RemoveMItem(itr2->item_guid);
}
@ -559,7 +545,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data )
/**
* Handles the packet sent by the client when requesting the current mail list.
* It will send a list of all avaible mails in the players mailbox to the client.
* It will send a list of all available mails in the players mailbox to the client.
*/
void WorldSession::HandleGetMailList(WorldPacket & recv_data )
{
@ -625,7 +611,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
data << uint32((*itr)->COD); // COD
data << uint32(0); // unknown, probably changed in 3.3.3
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
data << uint32((*itr)->money); // Gold
data << uint32((*itr)->money); // copper
data << uint32((*itr)->checked); // flags
data << float(((*itr)->expire_time-time(NULL))/DAY);// Time
data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc)
@ -693,20 +679,18 @@ void WorldSession::HandleItemTextQuery(WorldPacket & recv_data )
sLog.outDebug("CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10));// guess size
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size
Item *item = _player->GetItemByGuid(itemGuid);
if(!item)
{
data << uint8(1); // no text
}
else
if(Item *item = _player->GetItemByGuid(itemGuid))
{
data << uint8(0); // has text
data << uint64(itemGuid); // item guid
data << sObjectMgr.GetItemText(item->GetGUIDLow()); // max 8000
}
else
{
data << uint8(1); // no text
}
SendPacket(&data);
}
@ -787,7 +771,6 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
*/
void WorldSession::HandleQueryNextMailTime(WorldPacket & /**recv_data*/ )
{
//TODO Fix me! ... this void has probably bad condition, but good data are sent
WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8);
if( _player->unReadMails > 0 )