本文整理汇总了C++中MailItemsInfo::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ MailItemsInfo::begin方法的具体用法?C++ MailItemsInfo::begin怎么用?C++ MailItemsInfo::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MailItemsInfo
的用法示例。
在下文中一共展示了MailItemsInfo::begin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleSendMail
//.........这里部分代码省略.........
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();
}
else
{
rc_team = objmgr.GetPlayerTeamByGUID(rc);
QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", GUID_LOPART(rc));
if(result)
{
Field *fields = result->Fetch();
mails_count = fields[0].GetUInt32();
delete result;
}
}
//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, 0, MAIL_ERR_INTERNAL_ERROR);
return;
}
// test the receiver's Faction...
if (!sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && GetSecurity() == SEC_PLAYER)
{
pl->SendMailResult(0, 0, MAIL_ERR_NOT_YOUR_TEAM);
return;
}
if (items_count)
{
for(MailItemMap::iterator mailItemIter = mi.begin(); mailItemIter != mi.end(); ++mailItemIter)
{
MailItem& mailItem = mailItemIter->second;
if(!mailItem.item_guidlow)
{
pl->SendMailResult(0, 0, MAIL_ERR_INTERNAL_ERROR);
return;
}
mailItem.item = pl->GetItemByGuid(MAKE_NEW_GUID(mailItem.item_guidlow, 0, HIGHGUID_ITEM));
// prevent sending bag with items (cheat: can be placed in bag after adding equipped empty bag to mail)
if(!mailItem.item || !mailItem.item->CanBeTraded())
{
pl->SendMailResult(0, 0, MAIL_ERR_INTERNAL_ERROR);
return;
}
if (mailItem.item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_CONJURED) || mailItem.item->GetUInt32Value(ITEM_FIELD_DURATION))
{
pl->SendMailResult(0, 0, MAIL_ERR_INTERNAL_ERROR);
return;
}
if(COD && mailItem.item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))
{
pl->SendMailResult(0, 0, MAIL_ERR_CANT_SEND_WRAPPED_COD);
return;
}
}
}
pl->SendMailResult(0, 0, MAIL_OK);
uint32 itemTextId = 0;