本文整理汇总了C++中MailMessage::Expired方法的典型用法代码示例。如果您正苦于以下问题:C++ MailMessage::Expired方法的具体用法?C++ MailMessage::Expired怎么用?C++ MailMessage::Expired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailMessage
的用法示例。
在下文中一共展示了MailMessage::Expired方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleReturnToSender
void WorldSession::HandleReturnToSender(WorldPacket & recv_data )
{
uint64 mailbox;
uint32 message_id;
recv_data >> mailbox >> message_id;
WorldPacket data(SMSG_SEND_MAIL_RESULT, 12);
data << message_id << uint32(MAIL_RES_RETURNED_TO_SENDER);
MailMessage * msg = _player->m_mailBox->GetMessage(message_id);
if(msg == 0 || msg->Expired())
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
if(msg->returned_flag)
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
sMailSystem.ReturnToSender(msg);
// finish the packet
data << uint32(MAIL_OK);
SendPacket(&data);
}
示例2: HandleTakeMoney
void WorldSession::HandleTakeMoney(WorldPacket & recv_data )
{
uint64 mailbox;
uint32 message_id;
recv_data >> mailbox >> message_id;
WorldPacket data(SMSG_SEND_MAIL_RESULT, 12);
data << message_id << uint32(MAIL_RES_MONEY_TAKEN);
MailMessage * message = _player->m_mailBox->GetMessage(message_id);
if(message == 0 || message->Expired() || !message->money)
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
// add the money to the player
if((_player->GetUInt32Value(PLAYER_FIELD_COINAGE) + message->money) >= PLAYER_MAX_GOLD )
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
else
_player->ModUnsigned32Value(PLAYER_FIELD_COINAGE, message->money);
// force save
_player->SaveToDB(false);
// message no longer has any money
message->money = 0;
if ((message->items.size() == 0) && (message->money == 0))
{
// mail now has a 3 day expiry time
if(!sMailSystem.MailOption(MAIL_FLAG_NO_EXPIRY))
message->expire_time = (uint32)UNIXTIME + (TIME_DAY * 3);
}
// update in sql!
message->SaveToDB();
// send result
data << uint32(MAIL_OK);
SendPacket(&data);
}
示例3: HandleMailCreateTextItem
void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
{
uint64 mailbox;
uint32 message_id;
recv_data >> mailbox >> message_id;
WorldPacket data(SMSG_SEND_MAIL_RESULT, 12);
data << message_id << uint32(MAIL_RES_MADE_PERMANENT);
ItemPrototype * proto = ItemPrototypeStorage.LookupEntry(8383);
MailMessage * message = _player->m_mailBox->GetMessage(message_id);
if(message == 0 || message->Expired() || message->copy_made || !proto)
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
SlotResult result = _player->GetItemInterface()->FindFreeInventorySlot(proto);
if(result.Result == 0)
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
ItemPointer pItem = objmgr.CreateItem(8383, _player);
pItem->SetUInt32Value(ITEM_FIELD_ITEM_TEXT_ID, message_id);
if( _player->GetItemInterface()->AddItemToFreeSlot(pItem) )
{
// mail now has an item after it
message->copy_made = true;
// update in sql
message->SaveToDB();
data << uint32(MAIL_OK);
SendPacket(&data);
}
else
{
pItem->Destructor();
pItem = NULLITEM;
}
}
示例4: HandleMarkAsRead
void WorldSession::HandleMarkAsRead(WorldPacket & recv_data )
{
uint64 mailbox;
uint32 message_id;
recv_data >> mailbox >> message_id;
MailMessage * message = _player->m_mailBox->GetMessage(message_id);
if(message == 0 || message->Expired()) return;
message->read_flag = true;
if(!message->returned_flag)
{
// mail now has a 3 day expiry time
if(!sMailSystem.MailOption(MAIL_FLAG_NO_EXPIRY))
message->expire_time = (uint32)UNIXTIME + (TIME_DAY * 3);
}
message->SaveToDB();
}
示例5: HandleMailDelete
void WorldSession::HandleMailDelete(WorldPacket & recv_data )
{
uint64 mailbox;
uint32 message_id;
recv_data >> mailbox >> message_id;
WorldPacket data(SMSG_SEND_MAIL_RESULT, 12);
data << message_id << uint32(MAIL_RES_DELETED);
MailMessage * message = _player->m_mailBox->GetMessage(message_id);
if(message == 0 || message->Expired())
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
_player->m_mailBox->DeleteMessage(message);
data << uint32(MAIL_OK);
SendPacket(&data);
}
示例6: HandleTakeItem
void WorldSession::HandleTakeItem(WorldPacket & recv_data )
{
uint64 mailbox;
uint32 message_id;
uint32 lowguid;
vector< uint64 >::iterator itr;
recv_data >> mailbox >> message_id >> lowguid;
WorldPacket data(SMSG_SEND_MAIL_RESULT, 12);
data << message_id << uint32(MAIL_RES_ITEM_TAKEN);
MailMessage * message = _player->m_mailBox->GetMessage(message_id);
if(message == 0 || message->Expired() || message->items.empty())
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
for( itr = message->items.begin( ); itr != message->items.end( ); ++itr )
{
if ( (*itr) == lowguid )
break;
}
if( itr == message->items.end( ) )
{
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
// check for cod credit
if(message->cod > 0)
{
if(_player->GetUInt32Value(PLAYER_FIELD_COINAGE) < message->cod)
{
data << uint32(MAIL_ERR_NOT_ENOUGH_MONEY);
SendPacket(&data);
return;
}
}
// grab the item
ItemPointer item = objmgr.LoadItem( *itr );
if(item == 0)
{
// doesn't exist
data << uint32(MAIL_ERR_INTERNAL_ERROR);
SendPacket(&data);
return;
}
// find a free bag slot
SlotResult result = _player->GetItemInterface()->FindFreeInventorySlot(item->GetProto());
if(result.Result == 0)
{
// no free slots left!
data << uint32(MAIL_ERR_BAG_FULL);
SendPacket(&data);
item->Destructor();
item = NULLITEM;
return;
}
item->m_isDirty = true;
if( !_player->GetItemInterface()->SafeAddItem(item, result.ContainerSlot, result.Slot) )
{
if( !_player->GetItemInterface()->AddItemToFreeSlot(item) )
{
// no free slots left!
data << uint32(MAIL_ERR_BAG_FULL);
SendPacket(&data);
item->Destructor();
item = NULLITEM;
return;
}
}
else // true so it waitexecute's
item->SaveToDB(result.ContainerSlot, result.Slot, true, NULL);
// send complete packet
data << uint32(MAIL_OK);
data << item->GetUInt32Value(OBJECT_FIELD_GUID);
data << item->GetUInt32Value(ITEM_FIELD_STACK_COUNT);
message->items.erase( itr );
if ((message->items.size() == 0) && (message->money == 0))
{
// mail now has a 3 day expiry time
if(!sMailSystem.MailOption(MAIL_FLAG_NO_EXPIRY))
message->expire_time = (uint32)UNIXTIME + (TIME_DAY * 3);
}
//.........这里部分代码省略.........