本文整理汇总了C++中MailItemsInfo::end方法的典型用法代码示例。如果您正苦于以下问题:C++ MailItemsInfo::end方法的具体用法?C++ MailItemsInfo::end怎么用?C++ MailItemsInfo::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailItemsInfo
的用法示例。
在下文中一共展示了MailItemsInfo::end方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleSendMail
void WorldSession::HandleSendMail(WorldPacket & recv_data )
{
CHECK_PACKET_SIZE(recv_data,8+1+1+1+4+4+1+4+4+8+1);
uint64 mailbox, unk3;
std::string receiver, subject, body;
uint32 unk1, unk2, money, COD;
uint8 unk4;
recv_data >> mailbox;
recv_data >> receiver;
// recheck
CHECK_PACKET_SIZE(recv_data, 8+(receiver.size()+1)+1+1+4+4+1+4+4+8+1);
recv_data >> subject;
// recheck
CHECK_PACKET_SIZE(recv_data, 8+(receiver.size()+1)+(subject.size()+1)+1+4+4+1+4+4+8+1);
recv_data >> body;
// recheck
CHECK_PACKET_SIZE(recv_data, 8+(receiver.size()+1)+(subject.size()+1)+(body.size()+1)+4+4+1+4+4+8+1);
recv_data >> unk1; // stationery?
recv_data >> unk2; // 0x00000000
MailItemsInfo mi;
uint8 items_count;
recv_data >> items_count; // attached items count
if(items_count > 12) // client limit
return;
// recheck
CHECK_PACKET_SIZE(recv_data, 8+(receiver.size()+1)+(subject.size()+1)+(body.size()+1)+4+4+1+items_count*(1+8)+4+4+8+1);
if(items_count)
{
for(uint8 i = 0; i < items_count; ++i)
{
uint8 item_slot;
uint64 item_guid;
recv_data >> item_slot;
recv_data >> item_guid;
mi.AddItem(GUID_LOPART(item_guid), item_slot);
}
}
recv_data >> money >> COD; // money and cod
recv_data >> unk3; // const 0
recv_data >> unk4; // const 0
items_count = mi.size(); // this is the real size after the duplicates have been removed
if (receiver.empty())
return;
Player* pl = _player;
uint64 rc = 0;
if(normalizePlayerName(receiver))
rc = objmgr.GetPlayerGUIDByName(receiver);
if (!rc)
{
sLog.outDetail("Player %u is sending mail to %s (GUID: not existed!) 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);
pl->SendMailResult(0, 0, MAIL_ERR_RECIPIENT_NOT_FOUND);
return;
}
sLog.outDetail("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);
if(pl->GetGUID() == rc)
{
pl->SendMailResult(0, 0, MAIL_ERR_CANNOT_SEND_TO_SELF);
return;
}
uint32 reqmoney = money + 30;
if (items_count)
reqmoney = money + (30 * items_count);
if (pl->GetMoney() < reqmoney)
{
pl->SendMailResult(0, 0, MAIL_ERR_NOT_ENOUGH_MONEY);
return;
}
Player *receive = objmgr.GetPlayer(rc);
uint32 rc_team = 0;
uint8 mails_count = 0; //do not allow to send to one player more than 100 mails
if(receive)
{
rc_team = receive->GetTeam();
mails_count = receive->GetMailSize();
//.........这里部分代码省略.........