本文整理汇总了C++中ObjectGuid::IsAnyTypeCreature方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectGuid::IsAnyTypeCreature方法的具体用法?C++ ObjectGuid::IsAnyTypeCreature怎么用?C++ ObjectGuid::IsAnyTypeCreature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectGuid
的用法示例。
在下文中一共展示了ObjectGuid::IsAnyTypeCreature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanOpenMailBox
bool WorldSession::CanOpenMailBox(ObjectGuid guid)
{
if (guid == _player->GetGUID())
{
if (!HasPermission(rbac::RBAC_PERM_COMMAND_MAILBOX))
{
TC_LOG_WARN("cheat", "%s attempted to open mailbox by using a cheat.", _player->GetName().c_str());
return false;
}
}
else if (guid.IsGameObject())
{
if (!_player->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX))
return false;
}
else if (guid.IsAnyTypeCreature())
{
if (!_player->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_MAILBOX))
return false;
}
else
return false;
return true;
}
示例2: CheckMailBox
bool WorldSession::CheckMailBox(ObjectGuid guid)
{
// GM case
if (guid == GetPlayer()->GetObjectGuid())
{
// command case will return only if player have real access to command
if (!ChatHandler(GetPlayer()).FindCommand("mailbox"))
{
DEBUG_LOG("%s attempt open mailbox in cheating way.", guid.GetString().c_str());
return false;
}
}
// mailbox case
else if (guid.IsGameObject())
{
if (!GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX))
{
DEBUG_LOG("Mailbox %s not found or %s can't interact with him.", guid.GetString().c_str(), GetPlayer()->GetGuidStr().c_str());
return false;
}
}
// squire case
else if (guid.IsAnyTypeCreature())
{
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
if (!creature)
{
DEBUG_LOG("%s not found or %s can't interact with him.", creature->GetGuidStr().c_str(), GetPlayer()->GetGuidStr().c_str());
return false;
}
if (!(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_SQUIRE))
{
DEBUG_LOG("%s not have access to mailbox.", creature->GetGuidStr().c_str());
return false;
}
if (creature->GetOwnerGuid() != GetPlayer()->GetObjectGuid())
{
DEBUG_LOG("%s not owned by %s for access to mailbox.", creature->GetGuidStr().c_str(), GetPlayer()->GetGuidStr().c_str());
return false;
}
}
else
return false;
return true;
}
示例3: HandleQuestgiverStatusMultipleQuery
void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket*/)
{
DEBUG_LOG("WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY");
uint32 count = 0;
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
data << uint32(count); // placeholder
for(GuidSet::const_iterator itr = _player->GetClientGuids().begin(); itr != _player->GetClientGuids().end(); ++itr)
{
uint8 dialogStatus = DIALOG_STATUS_NONE;
ObjectGuid guid = *itr;
if (guid.IsEmpty())
continue;
if (guid.IsAnyTypeCreature())
{
// need also pet quests case support
Creature* questgiver = GetPlayer()->GetMap()->GetAnyTypeCreature(guid);
if (!questgiver || questgiver->IsHostileTo(_player))
continue;
if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
continue;
dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver);
if (dialogStatus > DIALOG_STATUS_REWARD_REP)
dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE);
data << guid;
data << uint8(dialogStatus);
++count;
}
else if (guid.IsGameObject())
{
GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(guid);
if (!questgiver)
continue;
if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
continue;
dialogStatus = sScriptMgr.GetDialogStatus(_player, questgiver);
if (dialogStatus > DIALOG_STATUS_REWARD_REP)
dialogStatus = getDialogStatus(_player, questgiver, DIALOG_STATUS_NONE);
data << guid;
data << uint8(dialogStatus);
++count;
}
}
data.put<uint32>(0, count); // write real count
SendPacket(&data);
}