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


C++ Obj_Character::GetName方法代码示例

本文整理汇总了C++中Obj_Character::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj_Character::GetName方法的具体用法?C++ Obj_Character::GetName怎么用?C++ Obj_Character::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Obj_Character的用法示例。


在下文中一共展示了Obj_Character::GetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Execute

UINT CGCharUseSkillHandler::Execute( CGCharUseSkill* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION
    GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
    Assert( pGamePlayer != NULL ) ;
    if ( pGamePlayer == NULL )
    {
        g_pLog->FastSaveLog( LOG_FILE_1, "CGCharUseSkillHandler: Error (pGamePlayer == NULL) " ) ;
        return PACKET_EXE_CONTINUE ;
    }

    Obj_Human* pHuman = pGamePlayer->GetHuman() ;
    Assert( pHuman != NULL ) ;
    if ( pHuman == NULL )
    {
        g_pLog->FastSaveLog( LOG_FILE_1, "CGCharUseSkillHandler: Error (pHuman == NULL) " ) ;
        return PACKET_EXE_CONTINUE ;
    }

    Scene* pScene = pHuman->getScene() ;
    Assert( pScene != NULL ) ;
    if ( pScene == NULL )
    {
        g_pLog->FastSaveLog( LOG_FILE_1, "CGCharUseSkillHandler: Error Obj = %d (pScene == NULL) ", pHuman->GetID() ) ;
        return PACKET_EXE_CONTINUE ;
    }

    //检查线程执行资源是否正确
    Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;
    if ( MyGetCurrentThreadID() != pScene->m_ThreadID )
    {
        g_pLog->FastSaveLog( LOG_FILE_1, "CGCharUseSkillHandler: Error Obj = %d (MyGetCurrentThreadID() != pScene->m_ThreadID) ", pHuman->GetID() ) ;
        return PACKET_EXE_CONTINUE ;
    }

    ObjID_t ObjID            = pHuman->GetID() ;
    SkillID_t idSkill        = pPacket->getSkillDataID() / 100;
    BYTE nLevel                = pPacket->getSkillDataID() % 100;
    ObjID_t idTarget        = pPacket->getTargetID();
    WORLD_POS posTarget        = pPacket->getTargetPos() ;
    FLOAT fDir                = pPacket->getDir() ;
    //now the target guid only use to call of human(拉人去指定位置的操作)
    GUID_t    guidTarget        = pPacket->getTargetGUID();

    Obj_Character *pTarget = (Obj_Character*)(pScene->GetObjManager()->GetObj(idTarget));
    if( pTarget )
    {
        //技能 类型
        Skill_Module::SkillTemplateData_T const* pSkillTemplate = g_SkillTemplateDataMgr.GetInstanceByID(idSkill);
        INT SkillType = pSkillTemplate->GetStandFlag();
        if (SkillType > 0)
        {    
            //相同阵营,可以释放
            if( pHuman->IsEnemy( pTarget ) == TRUE )
            {
                g_pLog->FastSaveLog( LOG_FILE_1, "CGCharUseSkillHandler: %s and %s  isn't the same camp! ", pHuman->GetName(), pTarget->GetName() ) ;
                return    PACKET_EXE_CONTINUE;
            }
        }else if(SkillType < 0)
        {
            // 不同阵营,可以释放
            if( pHuman->IsEnemy( pTarget ) == FALSE )
            {
                g_pLog->FastSaveLog( LOG_FILE_1, "CGCharUseSkillHandler: %s and %s  is the same camp! ", pHuman->GetName(), pTarget->GetName() ) ;
                return    PACKET_EXE_CONTINUE;
            }
        }
    }
    else
    {
        //g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGCharUseSkillHandler::ObjName=%s, ERR_OWNER_INVALID"
        //    ,pHuman->GetName()) ;
        //return PACKET_EXE_CONTINUE;
    }

    if ( pPacket->getObjID() == pHuman->GetID() )
    {
        ORESULT oResult = pHuman->GetHumanAI()->PushCommand_UseSkill( idSkill, nLevel, idTarget, posTarget.m_fX, posTarget.m_fZ, fDir, guidTarget );
        if ( OR_FAILED( oResult ) )
        {
            pHuman->SendOperateResultMsg(oResult);
        }
    }
    else
    {
        Obj_Pet *pPet = pHuman->GetPet();
        if ( pPet != NULL && pPet->GetID() == pPacket->getObjID() )
        {
            ORESULT oResult = pPet->GetPetAI()->PushCommand_UseSkill( idSkill, idTarget, posTarget.m_fX, posTarget.m_fZ, fDir, guidTarget );
            if ( OR_FAILED( oResult ) )
            {
                pHuman->SendOperateResultMsg(oResult);
            }
        }
    }

    g_pLog->FastSaveLog( LOG_FILE_1, "CGCharUseSkillHandler: S:%d D:%d Skill:%d (%f,%f) DIR = %f", 
        pPacket->getObjID(), 
        pPacket->getTargetID(), 
        idSkill, 
//.........这里部分代码省略.........
开发者ID:gangzi4494,项目名称:web-pap,代码行数:101,代码来源:CGCharUseSkillHandler.cpp


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