mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 01:37:01 +00:00
Second attempt to fix mail.
This commit is contained in:
parent
0b8a22d063
commit
7b4a7def8a
1 changed files with 39 additions and 33 deletions
|
|
@ -591,10 +591,11 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
||||||
// client can't work with packets > max int16 value
|
// client can't work with packets > max int16 value
|
||||||
const uint32 maxPacketSize = 32767;
|
const uint32 maxPacketSize = 32767;
|
||||||
|
|
||||||
uint32 mails_count = 0; // real send to client mails amount
|
uint32 mailsCount = 0; // send to client mails amount
|
||||||
|
uint32 realCount = 0; // real mails amount
|
||||||
|
|
||||||
WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size
|
WorldPacket data(SMSG_MAIL_LIST_RESULT, 200); // guess size
|
||||||
data << uint32(0); // 3.2.0
|
data << uint32(0); // real mail's count
|
||||||
data << uint8(0); // mail's count
|
data << uint8(0); // mail's count
|
||||||
time_t cur_time = time(NULL);
|
time_t cur_time = time(NULL);
|
||||||
|
|
||||||
|
|
@ -609,7 +610,10 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
||||||
size_t next_mail_size = 2+4+1+8+4*8+((*itr)->subject.size()+1)+1+item_count*(1+4+4+6*3*4+4+4+1+4+4+4);
|
size_t next_mail_size = 2+4+1+8+4*8+((*itr)->subject.size()+1)+1+item_count*(1+4+4+6*3*4+4+4+1+4+4+4);
|
||||||
|
|
||||||
if(data.wpos()+next_mail_size > maxPacketSize)
|
if(data.wpos()+next_mail_size > maxPacketSize)
|
||||||
break;
|
{
|
||||||
|
realCount += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 show_flags = 0;
|
uint32 show_flags = 0;
|
||||||
if ((*itr)->messageType != MAIL_NORMAL)
|
if ((*itr)->messageType != MAIL_NORMAL)
|
||||||
|
|
@ -619,9 +623,9 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
||||||
if ((*itr)->COD)
|
if ((*itr)->COD)
|
||||||
show_flags |= MAIL_SHOW_COD;
|
show_flags |= MAIL_SHOW_COD;
|
||||||
|
|
||||||
data << (uint16) 0x0040; // unknown 2.3.0, different values
|
data << uint16(0x0040); // unknown 2.3.0, different values
|
||||||
data << (uint32) (*itr)->messageID; // Message ID
|
data << uint32((*itr)->messageID); // Message ID
|
||||||
data << (uint8) (*itr)->messageType; // Message Type
|
data << uint8((*itr)->messageType); // Message Type
|
||||||
|
|
||||||
switch((*itr)->messageType)
|
switch((*itr)->messageType)
|
||||||
{
|
{
|
||||||
|
|
@ -631,63 +635,65 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
||||||
case MAIL_CREATURE:
|
case MAIL_CREATURE:
|
||||||
case MAIL_GAMEOBJECT:
|
case MAIL_GAMEOBJECT:
|
||||||
case MAIL_AUCTION:
|
case MAIL_AUCTION:
|
||||||
data << (uint32) (*itr)->sender; // creature/gameobject entry, auction id
|
data << uint32((*itr)->sender); // creature/gameobject entry, auction id
|
||||||
break;
|
break;
|
||||||
case MAIL_ITEM: // item entry (?) sender = "Unknown", NYI
|
case MAIL_ITEM: // item entry (?) sender = "Unknown", NYI
|
||||||
|
data << uint32(0); // item entry
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
data << (uint32) (*itr)->COD; // COD
|
data << uint32((*itr)->COD); // COD
|
||||||
data << (uint32) (*itr)->itemTextId; // sure about this
|
data << uint32((*itr)->itemTextId); // sure about this
|
||||||
data << (uint32) 0; // unknown
|
data << uint32(0); // unknown
|
||||||
data << (uint32) (*itr)->stationery; // stationery (Stationery.dbc)
|
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
|
||||||
data << (uint32) (*itr)->money; // Gold
|
data << uint32((*itr)->money); // Gold
|
||||||
data << (uint32) show_flags; // unknown, 0x4 - auction, 0x10 - normal
|
data << uint32(show_flags); // unknown, 0x4 - auction, 0x10 - normal
|
||||||
// Time
|
data << float(((*itr)->expire_time-time(NULL))/DAY);// Time
|
||||||
data << (float) ((*itr)->expire_time-time(NULL))/DAY;
|
data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc)
|
||||||
data << (uint32) (*itr)->mailTemplateId; // mail template (MailTemplate.dbc)
|
|
||||||
data << (*itr)->subject; // Subject string - once 00, when mail type = 3
|
data << (*itr)->subject; // Subject string - once 00, when mail type = 3
|
||||||
|
|
||||||
data << (uint8) item_count; // client limit is 0x10
|
data << uint8(item_count); // client limit is 0x10
|
||||||
|
|
||||||
for(uint8 i = 0; i < item_count; ++i)
|
for(uint8 i = 0; i < item_count; ++i)
|
||||||
{
|
{
|
||||||
Item *item = pl->GetMItem((*itr)->items[i].item_guid);
|
Item *item = pl->GetMItem((*itr)->items[i].item_guid);
|
||||||
// item index (0-6?)
|
// item index (0-6?)
|
||||||
data << (uint8) i;
|
data << uint8(i);
|
||||||
// item guid low?
|
// item guid low?
|
||||||
data << (uint32) (item ? item->GetGUIDLow() : 0);
|
data << uint32(item ? item->GetGUIDLow() : 0);
|
||||||
// entry
|
// entry
|
||||||
data << (uint32) (item ? item->GetEntry() : 0);
|
data << uint32(item ? item->GetEntry() : 0);
|
||||||
for(uint8 j = 0; j < MAX_INSPECTED_ENCHANTMENT_SLOT; ++j)
|
for(uint8 j = 0; j < MAX_INSPECTED_ENCHANTMENT_SLOT; ++j)
|
||||||
{
|
{
|
||||||
// unsure
|
// unsure
|
||||||
data << (uint32) (item ? item->GetEnchantmentCharges((EnchantmentSlot)j) : 0);
|
data << uint32(item ? item->GetEnchantmentCharges((EnchantmentSlot)j) : 0);
|
||||||
// unsure
|
// unsure
|
||||||
data << (uint32) (item ? item->GetEnchantmentDuration((EnchantmentSlot)j) : 0);
|
data << uint32(item ? item->GetEnchantmentDuration((EnchantmentSlot)j) : 0);
|
||||||
// unsure
|
// unsure
|
||||||
data << (uint32) (item ? item->GetEnchantmentId((EnchantmentSlot)j) : 0);
|
data << uint32(item ? item->GetEnchantmentId((EnchantmentSlot)j) : 0);
|
||||||
}
|
}
|
||||||
// can be negative
|
// can be negative
|
||||||
data << (uint32) (item ? item->GetItemRandomPropertyId() : 0);
|
data << uint32(item ? item->GetItemRandomPropertyId() : 0);
|
||||||
// unk
|
// unk
|
||||||
data << (uint32) (item ? item->GetItemSuffixFactor() : 0);
|
data << uint32(item ? item->GetItemSuffixFactor() : 0);
|
||||||
// stack count
|
// stack count
|
||||||
data << (uint32) (item ? item->GetCount() : 0);
|
data << uint32(item ? item->GetCount() : 0);
|
||||||
// charges
|
// charges
|
||||||
data << (uint32) (item ? item->GetSpellCharges() : 0);
|
data << uint32(item ? item->GetSpellCharges() : 0);
|
||||||
// durability
|
// durability
|
||||||
data << (uint32) (item ? item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY) : 0);
|
data << uint32(item ? item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY) : 0);
|
||||||
// durability
|
// durability
|
||||||
data << (uint32) (item ? item->GetUInt32Value(ITEM_FIELD_DURABILITY) : 0);
|
data << uint32(item ? item->GetUInt32Value(ITEM_FIELD_DURABILITY) : 0);
|
||||||
// unknown wotlk
|
// unknown wotlk
|
||||||
data << (uint8) 0;
|
data << uint8(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
mails_count += 1;
|
mailsCount += 1;
|
||||||
|
realCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.put<uint8>(0, mails_count); // set real send mails to client
|
data.put<uint32>(0, realCount); // this will display warning about undelivered mail to player if realCount > mails_count
|
||||||
|
data.put<uint8>(4, mailsCount); // set real send mails to client
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
|
|
||||||
// recalculate m_nextMailDelivereTime and unReadMails
|
// recalculate m_nextMailDelivereTime and unReadMails
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue