当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectGuid::IsAnyTypeCreature方法代码示例

本文整理汇总了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;
}
开发者ID:kemlg,项目名称:trinitycore-conciens,代码行数:25,代码来源:MailHandler.cpp

示例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;
}
开发者ID:Sar777,项目名称:mangos3,代码行数:48,代码来源:MailHandler.cpp

示例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);
}
开发者ID:Naincapable,项目名称:mangos,代码行数:61,代码来源:QuestHandler.cpp


注:本文中的ObjectGuid::IsAnyTypeCreature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。