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


C++ Obj::GetObjType方法代码示例

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


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

示例1: CanUseAbility

ORESULT Ability::CanUseAbility(Obj_Human* pHuman)
{
__ENTER_FUNCTION

    Assert( pHuman );

    AbilityOpera* pAbilityOpera;

    pAbilityOpera = pHuman->GetAbilityOpera();
    Assert( pAbilityOpera );

    // 判断玩家是否已经学会这项技能
    if( pHuman->__IsAbilityHaveLearned(m_AbilityID) == FALSE )
    {
        return OR_WARNING;
    }

    // 判断玩家是否有技能所需要的工具
    if( m_OperationToolID!=INVALID_ID && HumanItemLogic::CalcEquipItemCount(pHuman,m_OperationToolID)<1 )
    {
        return OR_NO_TOOL;
    }

    Obj* pObj;

    pObj = pHuman->getScene()->GetObjManager()->GetObj( pAbilityOpera->m_Obj );
    if( pObj != NULL )
    {
        if( pHuman->IsInValidRadius( pObj, m_PlatformDistance ) == FALSE )
        { // 判断 pObj 是否在有效距离内
            return OR_OUT_PLATFORM;
        }

        // 让玩家面对操作台(对象)
        pHuman->FaceTo( pObj );
    }

    // 判断玩家是否符合技能的要求(在操作台旁边)
    if( (m_PlatformID >= 0) )
    {
        if( pObj == NULL )
        {
            return OR_NO_PLATFORM;
        }

        // 这里需要判断 pPlatformObj 是否就是 m_PlatformID 指定的东西
        if( pObj->GetObjType() != Obj::OBJ_TYPE_PLATFORM
         || ((Obj_Platform*)pObj)->GetPlatformClass() != PlatformID()
         )
        {
            return OR_NO_PLATFORM;
        }
    }

    return OR_OK;

__LEAVE_FUNCTION

    return OR_ERROR;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:60,代码来源:Ability.cpp

示例2: AI_Logic_Approach

VOID AI_Monster::AI_Logic_Approach( UINT uTime )
{
__ENTER_FUNCTION
	/** 先进行Approach类型的判断 */
	GET_MONSTER_SCENE((VOID)0)

	Obj* pObj = pScene->GetObjManager()->GetObj(m_CurEnemyID);
	if (!pObj 
		|| !IsCharacterObj(pObj->GetObjType()) 
		|| !((Obj_Character*)pObj)->IsAlive() 
		|| !((Obj_Character*)pObj)->IsCanViewMe(pMonster) 
		)
	{/** 当前敌人无效后转向下一个敌人,直到全部找完为止 */
		DelEnemy(m_CurEnemyID);
		m_CurEnemyID = GetNextEnemy();
		if (INVALID_ID == m_CurEnemyID) {
			ToGoHome();
		}
		return ;
	}
	Obj_Character* pCurEnemy = (Obj_Character*)pObj;

	
	FLOAT fMTDist,fETDist;
	if (!pCurEnemy)
	{
		Assert(NULL && "AI_Monster::Logic_Approach...pCurEnemy=NULL...");
		ToGoHome();
		return  ;
	}
	FLOAT fDist = MySqrt(pMonster->getWorldPos(), pCurEnemy->getWorldPos());
	if ( IsToGoHome(fMTDist, fETDist) ) 
	{
		return ;
	}

	if (ZERO_VALUE > fMTDist) 
	{/** 如果到达目的地 */
		ToAttack();
	}
	else
	{
		if( fETDist > (FLOAT)AIParam(AIPARAM_RESETTARGET_DIST)/1000.0f)
		{/** 如果目标位置和敌人位置的距离大与一定值则需要重新制定移动目标 */
			ToApproachTar( ) ;
		}
		else if(!GetCharacter()->IsMoving())
		{
			ToApproachTar( );
		}
	}
	ExcuteAIScript(SAPPROACH);

__LEAVE_FUNCTION
}
开发者ID:,项目名称:,代码行数:55,代码来源:

示例3: Execute

uint CGLockTargetHandler::Execute( CGLockTarget* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;

	if(NULL==pHuman)
	{
		AssertEx(FALSE,"[CGLockTargetHandler::Execute]: NULL Obj_Human pointer found!!");
		return PACKET_EXE_ERROR ;
	}
	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	ObjID_t nMeID = pHuman->GetID();
	if( nMeID == INVALID_ID )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}
	//update target
	if(NULL==pPacket)
	{
		AssertEx(FALSE,"[CGLockTargetHandler::Execute]: NULL packet pointer found!!");
		return PACKET_EXE_ERROR ;
	}

	pHuman->SetLockedTarget(pPacket->getTargetID());
	// 当锁定的目标是NPC时将会触发NPC的泡泡说话
	Obj* pTarget = pScene->GetObjManager()->GetObj(pPacket->getTargetID());
	if (pTarget->GetObjType() == Obj::OBJ_TYPE_MONSTER)
	{
		((Obj_Monster*)pTarget)->ProcessPaoPao();
	}
	
	g_pLog->FastSaveLog( LOG_FILE_1, "CGLockTargetHandler: ok obj=%d scene=%d", 
		nMeID, pScene->SceneID() ) ;

	return PACKET_EXE_CONTINUE ;

	__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:54,代码来源:CGLockTargetHandler.cpp

示例4: SendImpactToUnit

		BOOL ImpactCore_T::SendImpactToUnit(Obj_Character& rTar, ID_t nDataIndex, ObjID_t nSender, Time_t nDelayTime, BOOL bCriticalFlag, INT nRefixRate, INT nReserveParam1, INT nReserveParam2) const
		{
			__ENTER_FUNCTION
			OWN_IMPACT impact;
			if(INVALID_ID == nDataIndex)
			{
				return FALSE;
			}
			//根据nDataIndex对应的效果逻辑初始化rImp
			if(TRUE == InitImpactFromData(nDataIndex, impact, rTar, nReserveParam1))
			{
				//获得逻辑对象
				ImpactLogic_T const* pLogic = Impact_GetLogic(impact);
				if(NULL==pLogic)
				{
					Assert(NULL=="[ImpactCore_T::SendImpactToUnit]: Can't find sprcific logic for this impact.");
					return FALSE;
				}
				//设置会心标记
				if(TRUE == bCriticalFlag)
				{
					impact.MarkCriticalFlag();
				}
				if(0!=nRefixRate)
				{
					//向效果逻辑设置修正率
					pLogic->RefixPowerByRate(impact, nRefixRate);
				}
				if(0>nDelayTime)
				{
					nDelayTime = 0;
				}
				Scene* pScene = rTar.getScene();
				Obj_Character* pChar = NULL;
				if(NULL!=pScene)
				{
					Obj* pObj = pScene->GetSpecificObjByID( nSender );
					
					if( IsCharacterObj(pObj->GetObjType()) )
					{
						pChar = static_cast<Obj_Character*>(pObj);
						SkillInfo_T& rSkillInfo = pChar->GetSkillInfo();
						impact.SetSkillID( rSkillInfo.GetSkillID() );
						rSkillInfo.SetSendSkillImpactID(impact.GetDataIndex());
					}
					pScene->GetEventCore().RegisterImpactEvent(rTar.GetID(), nSender, impact, nDelayTime);
					return TRUE;
				}
			}
			// start to fill impact struct
			return TRUE;
			__LEAVE_FUNCTION
			return FALSE;
		}
开发者ID:uvbs,项目名称:wx2Server,代码行数:54,代码来源:Impact_Core.cpp

示例5: Execute

uint CGCharAskBaseAttribHandler::Execute( CGCharAskBaseAttrib* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;
	
	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	ObjID_t ObjID = pPacket->getTargetID() ;
	if( ObjID == INVALID_ID )
	{
		return PACKET_EXE_ERROR ;
	}
	
	Obj* pObj = pScene->GetObjManager()->GetObj( ObjID ) ;
	if( pObj==NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskBaseAttribHandler: not find obj=%d", ObjID ) ;
		return PACKET_EXE_CONTINUE ;
	}

	if( !IsCharacterObj( pObj->GetObjType() ) )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskBaseAttribHandler: not character obj=%d", ObjID ) ;
		return PACKET_EXE_CONTINUE ;
	}

	Obj_Character* pCharacter = (Obj_Character*)pObj ;
	pCharacter->AskMsg_BaseAttrib( pHuman );

	//影响效率关掉Log
	//g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskBaseAttribHandler: obj=%d", ObjID ) ;

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
开发者ID:,项目名称:,代码行数:51,代码来源:

示例6: RemovePet

BOOL PetManager::RemovePet( ObjID_t idObj )
{
__ENTER_FUNCTION

	Scene* pScene = GetScene();
	if (pScene)
	{
		Obj* pPet = pScene->GetPetManager()->GetPet(idObj);
		if (pPet && pPet->GetObjType() == Obj::OBJ_TYPE_PET)
		{
			pPet->SetActiveFlag( FALSE );
			pPet->CleanUp();
			pScene->DeleteObject( pPet );
		}
	}

	return TRUE;
__LEAVE_FUNCTION
	return TRUE;
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例7: IsSupportStillOn

		BOOL ImpactLogic_T::IsSupportStillOn(OWN_IMPACT& rImp, Obj_Character& rMe) const
		{
			__ENTER_FUNCTION
			Obj* pObj = Impact_GetCaster(rMe, rImp);
			if(NULL==pObj)
			{
				return FALSE;
			}
			if(FALSE==IsCharacterObj(pObj->GetObjType()))
			{
				return FALSE;
			}
			Obj_Character& rCaster = *(Obj_Character*)pObj;
			if(FALSE == GetGlobalActionDelegator().IsChanneling(rCaster))
			{
				return FALSE;
			}
			return TRUE;
			__LEAVE_FUNCTION
			return FALSE;
		}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例8: Execute

uint CGManipulatePetHandler::Execute( CGManipulatePet* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;
	
	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	Item *pPetItem = pHuman->GetPetItem(pPacket->GetGUID());
	if(pPetItem == NULL)
		return PACKET_EXE_CONTINUE;

	if(pPetItem->IsLock())
	{
		return PACKET_EXE_CONTINUE;
	}

	INT nType = pPacket->GetManipulateType();
	switch(nType)
	{
	case MANIPULATE_CREATEPET:
		{// 召唤宠物
			ORESULT oResult = pHuman->TestCallUpPet(pPacket->GetGUID() );
			if( OR_SUCCEEDED(oResult) )
			{
				AI_Human* pHumanAI = (AI_Human*)(pHuman->GetAIObj());
				if (pHumanAI)
				{
					ObjID_t idSkill = CALL_UP_PET;
					oResult = pHumanAI->PushCommand_UseSkill(idSkill, 1, -1, -1.f, -1.f, 0.f, INVALID_GUID);
				}
			}
			if( OR_FAILED(oResult) )
			{
				GCManipulatePetRet msg;
				msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_CALLUPFALID);
				pGamePlayer->SendPacket(&msg);

				pHuman->SendOperateResultMsg(oResult);
				return PACKET_EXE_CONTINUE;
			}

			pHuman->ReCallPet();
			pHuman->SetGUIDOfCallUpPet(pPacket->GetGUID());
		}
		break;
	case MANIPULATE_DELETEPET:
		{// 收回宠物
			ORESULT oResult = pHuman->ReCallPet();
			GCManipulatePetRet msg;
			if (OR_FAILED(oResult))
			{
				msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_RECALLFALID);
			}
			else if (OR_SUCCEEDED(oResult))
			{
				msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_RECALLSUCC);
			}
			pGamePlayer->SendPacket(&msg);
		}
		break;
	case MANIPULATE_FREEPET:
		{// 放生宠物
			PET_LOG_PARAM	PetLogParam;
			ORESULT oResult = pHuman->FreePetToNature(&PetLogParam,pPacket->GetGUID());
			GCManipulatePetRet msg;
			if (OR_FAILED(oResult))
			{
				msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_FREEFALID);
			}
			else if (OR_SUCCEEDED(oResult))
			{
				msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_FREESUCC);
			}
			pGamePlayer->SendPacket(&msg);
		}
		break;
	case MANIPULATE_ASKOTHERPETINFO:
		{// 察看其他玩家的宠物信息
			ObjID_t objID = pPacket->GetObjID();
			Obj* pObj = pScene->GetObjManager()->GetObj(objID);
			if (pObj && pObj->GetObjType() == Obj::OBJ_TYPE_PET)
			{
				Obj_Human* pCreator = ((Obj_Pet*)pObj)->GetCreator();
				if (pCreator)
				{
					PET_GUID_t guidpet = ((Obj_Pet*)pObj)->GetPetGUID();
					if(guidpet.IsNull())
//.........这里部分代码省略.........
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:101,代码来源:CGManipulatePetHandler.cpp

示例9: Execute

uint CGCharAskEquipmentHandler::Execute( CGCharAskEquipment* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

		GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
		Assert( pGamePlayer ) ;

		Obj_Human* pHuman = pGamePlayer->GetHuman() ;
		Assert( pHuman ) ;

		Scene* pScene = pHuman->getScene() ;
		if( pScene==NULL )
		{
			Assert(FALSE) ;
			return PACKET_EXE_ERROR ;
		}

		//检查线程执行资源是否正确
		Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;



		ObjID_t ObjID = pPacket->getObjID();
		if( ObjID == INVALID_ID )
		{
			Assert(FALSE) ;
			return PACKET_EXE_ERROR ;
		}

		Obj* pObj = pScene->GetObjManager()->GetObj( ObjID ) ;
		if( pObj==NULL )
		{
			g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskEquipmentHandler: not find obj=%d", ObjID ) ;
			return PACKET_EXE_CONTINUE ;
		}

		if( !IsCharacterObj( pObj->GetObjType() ) )
		{
			g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskEquipmentHandler: not character obj=%d", ObjID ) ;
			return PACKET_EXE_CONTINUE ;
		}

		Obj_Character* pCharacter = (Obj_Character*)pObj ;

		GCCharEquipment	Msg;
		Msg.setObjID(pCharacter->GetID());
		if ( pCharacter->GetObjType() == Obj::OBJ_TYPE_HUMAN )
		{
			Obj_Human* pDest = (Obj_Human*)pCharacter ;
			if(pDest->GetEquipID(HEQUIP_WEAPON)> 0)
			{
				Msg.setWeaponID(pDest->GetEquipID(HEQUIP_WEAPON));
				UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_WEAPON));
				Msg.setWeaponGemID(uGemID);
			}
			if(pDest->GetEquipID(HEQUIP_BOOT)>0)
			{
				Msg.setBootID(pDest->GetEquipID(HEQUIP_BOOT));
				UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_BOOT));
				Msg.setBootGemID(uGemID);
			}
			if(pDest->GetEquipID(HEQUIP_CUFF)>0)
			{
				Msg.setCuffID(pDest->GetEquipID(HEQUIP_CUFF));
				UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_CUFF));
				Msg.setCuffGemID(uGemID);
			}
			if(pDest->GetEquipID(HEQUIP_CAP)>0)
			{
				Msg.setCapID(pDest->GetEquipID(HEQUIP_CAP));
				UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_CAP));
				Msg.setCapGemID(uGemID);
			}
			if(pDest->GetEquipID(HEQUIP_ARMOR)>0)
			{
				Msg.setArmourID(pDest->GetEquipID(HEQUIP_ARMOR));
				UINT uGemID = GetEquipmentMaxLevelGemID(pDest->GetEquipContain()->GetItem(HEQUIP_ARMOR));
				Msg.setArmourGemID(uGemID);
			}

			pGamePlayer->SendPacket( &Msg ) ;
		}
		g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskEquipmentHandler: ok obj=%d scene=%d", 
		ObjID, pScene->SceneID() ) ;

		return PACKET_EXE_CONTINUE ;
		

		__LEAVE_FUNCTION
		return PACKET_EXE_ERROR ;
}
开发者ID:ueverything,项目名称:mmo-resourse,代码行数:91,代码来源:CGCharAskEquipmentHandler.cpp

示例10: Execute

UINT CGCharAskBaseAttribHandler::Execute( CGCharAskBaseAttrib* pPacket, Player* pPlayer )
{
__ENTER_FUNCTION

    GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
    Assert( pGamePlayer ) ;

    Obj_Human* pHuman = pGamePlayer->GetHuman() ;
    Assert( pHuman ) ;
    
    Scene* pScene = pHuman->getScene() ;
    if( pScene==NULL )
    {
        Assert(FALSE) ;
        return PACKET_EXE_ERROR ;
    }

    //检查线程执行资源是否正确
    Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

    ObjID_t ObjID = pPacket->getTargetID() ;
    if( ObjID == INVALID_ID )
    {
        Assert(FALSE) ;
        return PACKET_EXE_ERROR ;
    }
    
    Obj* pObj = pScene->GetObjManager()->GetObj( ObjID ) ;
    if( pObj==NULL )
    {
        g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskBaseAttribHandler: not find obj=%d", ObjID ) ;
        return PACKET_EXE_CONTINUE ;
    }

    if( !IsCharacterObj( pObj->GetObjType() ) )
    {
        g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskBaseAttribHandler: not character obj=%d", ObjID ) ;
        return PACKET_EXE_CONTINUE ;
    }

    Obj_Character* pCharacter = (Obj_Character*)pObj ;
    pCharacter->AskMsg_BaseAttrib( pHuman );

    //GCCharBaseAttrib Msg ;
    //BOOL bResult = pCharacter->FillAttribMsg( &Msg, TRUE );
    //if ( bResult )
    //{
    //    pGamePlayer->SendPacket( &Msg ) ;

    //    g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskBaseAttribHandler: ok obj=%d scene=%d", 
    //        ObjID, pScene->SceneID() ) ;
    //}
    //else
    //{
    //    g_pLog->FastSaveLog( LOG_FILE_1, "Error: CGCharAskBaseAttribHandler: obj=%d scene=%d", 
    //        ObjID, pScene->SceneID() ) ;
    //}
    g_pLog->FastSaveLog( LOG_FILE_1, "CGCharAskBaseAttribHandler: obj=%d", ObjID ) ;

    return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

    return PACKET_EXE_ERROR ;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:65,代码来源:CGCharAskBaseAttribHandler.cpp

示例11: AI_Logic_Flee

VOID AI_Monster::AI_Logic_Flee( UINT uTime )
{
	__ENTER_FUNCTION
	GET_MONSTER_SCENE((VOID)0)

	Obj* pObj = pScene->GetObjManager()->GetObj(m_CurEnemyID);
	if (!pObj 
		|| !IsCharacterObj(pObj->GetObjType()) 
		|| !((Obj_Character*)pObj)->IsAlive() 
		|| !((Obj_Character*)pObj)->IsCanViewMe(pMonster) 
		)
	{/** 当前敌人无效后转向下一个敌人,直到全部找完为止 */
		DelEnemy(m_CurEnemyID);
		m_CurEnemyID = GetNextEnemy();
		if (INVALID_ID == m_CurEnemyID) {
			ToGoHome();
		}
		return ;	
	}
	Obj_Character* pCurEnemy = (Obj_Character*)pObj;

	/** 当前位置和目的地之间的距离 */
	FLOAT fDist  = MySqrt(GetCharacter()->getWorldPos(),GetCharacter()->GetFinalTarPos());
	if( pCurEnemy==NULL			/** 无效敌人 */
		|| !pCurEnemy->IsAlive()	/** 敌人死了 */
		|| fDist < ZERO_VALUE		/** 到达目的地 */
		)	
	{/** 忘掉当前目标 */
		/** 将自身的移动速度还原 */
		GetCharacter()->SetMoveMode(Obj_Monster::MOVE_MODE_WALK);

		switch(m_FleeType) 
		{
			/** 返回继续攻击敌人 */
		case MONSTERAI_FLEE_RANDOM:
			ToApproachTar();
			break;
			/** 将自己的仇恨列表copy给队友 */
		case MONSTERAI_FLEE_NEARESTFRIEND:
			for (INT i = 0; i < MAX_TEAMMATE_COUNT; ++i)
			{
				Obj* pObj = pScene->GetObjManager()->GetObj(m_TeammateID[i]);
				if( pObj==NULL || !IsCharacterObj( pObj->GetObjType() ) )
				{
					continue;
				}
				/** 活着的;非敌对的;没有敌人的 */
				if (((Obj_Character*)pObj)->IsAlive() 
					&& !((Obj_Monster*)pObj)->IsEnemy(GetCharacter())
					&& !((Obj_Monster*)pObj)->GetMonsterAI()->HasEnemy()	
					)
				{
					((Obj_Monster*)pObj)->GetMonsterAI()->AddPrimaryEnemy( GetPrimaryEnemyID() );
					//((Monster*)pObj)->GetMonsterAI()->ToApproachTar();
					Log::SaveLog( SERVER_LOGFILE, "Logic_Flee NearestFriend Find Obj! ID:%d",
						pObj->GetID() ) ;
				}
			}
			ToApproachTar();
			break;
			/** 将自己的仇恨列表copy给周围一定范围的队友 */
		case MONSTERAI_FLEE_NEARESTPOINT:
			{
				Scene* pScene = GetCharacter()->getScene() ;

				SCANOPERATOR_TEAMMATE_INIT Init ;
				Init.m_pScene = pScene ;
				Init.m_nZoneRadius = 1 ;
				Init.m_Type = MONSTERAI_SUMMON_REGION;
				Init.m_nCount = 3;
				Init.m_bScanHuman = FALSE ;
				Init.m_ZoneID = GetCharacter()->getZoneID() ;
				Init.m_pMonster = (Obj_Monster*)GetCharacter() ;
				Init.m_fRadius = (FLOAT)AIParam(AIPARAM_SCANTEAMMATEDIST)/1000.0f ;

				ScanOperator_Teammate	sc;
				sc.Init( &Init ) ;

				pScene->Scan( &sc ) ;

				if (HasTeammate()) 
				{
					Obj* pObj = NULL;
					for (INT i = 0; i < MAX_TEAMMATE_COUNT; ++i)
					{
						Obj* pObj = pScene->GetObjManager()->GetObj(m_TeammateID[i]);
						if( pObj==NULL || !IsCharacterObj( pObj->GetObjType() ) )
						{
							continue;
						}
						((Obj_Monster*)pObj)->GetMonsterAI()->AddPrimaryEnemy( GetPrimaryEnemyID() );
						//((Monster*)pObj)->GetMonsterAI()->ToApproachTar();
						Log::SaveLog( SERVER_LOGFILE, "Logic_Flee NearestPoINT Find Obj! ID:%d",
							pObj->GetID() ) ;
					}
				}
				ToApproachTar();
			}
			break;
		default:
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例12: Execute

uint CGBBSSychMessagesHandler::Execute( CGBBSSychMessages* pPacket, Player* pPlayer )
{
	__ENTER_FUNCTION

	GamePlayer* pGamePlayer = (GamePlayer*)pPlayer ;
	Assert( pGamePlayer ) ;

	Obj_Human* pHuman = pGamePlayer->GetHuman() ;
	Assert( pHuman ) ;

	Scene* pScene = pHuman->getScene() ;
	if( pScene==NULL )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}
	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID ) ;

	ObjID_t	ObjID			=	pPacket->GetObjID();
	BYTE	Opt				=	pPacket->GetOpt();
	UINT	nID				=	pPacket->GetID();
	BYTE	nLength			=	pPacket->GetLength();
	CHAR*	m_MessageData	=	pPacket->GetMessage();

	if (nLength != strlen(m_MessageData))
	{
		return PACKET_EXE_ERROR;
	}
	//请求者一定是人
	Obj* pOther = pScene->GetObjManager()->GetObj(ObjID);
	if (pOther == NULL)
	{
		return PACKET_EXE_ERROR;
	}
	else
	{
		if( pOther->GetObjType() != Obj::OBJ_TYPE_HUMAN )
		{
			return PACKET_EXE_ERROR;
		}
	}

	Obj_Human* pTargetHuman = (Obj_Human*)pOther;
	if( pTargetHuman == NULL )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGBBSApplyHandler::ObjID=%d, ObjId = %d"
			,pHuman->GetID(), ObjID) ;
		return PACKET_EXE_CONTINUE ;
	}

	if(pTargetHuman->m_StallBox.GetStallStatus() != ServerStallBox::STALL_OPEN)
	{
		GCStallError	Msg;
		Msg.SetID(STALL_MSG::ERR_CLOSE);
		pGamePlayer->SendPacket(&Msg);
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGStallOpenHandler::ObjID=%d, ERR_CLOSE"
			,pHuman->GetID()) ;
		return PACKET_EXE_CONTINUE;
	}

	ServerBBS*	pBBS	=	pTargetHuman->m_StallBox.GetBBS();
	switch(Opt)
	{
		case CGBBSSychMessages::OPT_NEW_MESSAGE:
			{
				CHAR szDisplayName[MAX_BBS_MESSAGE_AUTHORLENGTH];
				sprintf(szDisplayName, "#{_INFOUSR%s}(%X)", pHuman->GetName(), (UINT)(pHuman->GetGUID()));
				UINT	NewID = pBBS->NewMessageID();
				if(pBBS->AddNewMessageByID( NewID, m_MessageData, nLength, szDisplayName ) == FALSE)
				{
					g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGBBSSychMessagesHandler::ObjID=%d, NewID = %d"
					,pHuman->GetID(), NewID) ;
					return PACKET_EXE_CONTINUE;
				}
			}
			break;
		case CGBBSSychMessages::OPT_REPLY_MESSAGE:
			{
				if(pBBS->ReplyMessageByID(nID, m_MessageData, nLength) == FALSE)
				{
					g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGBBSSychMessagesHandler::ObjID=%d, nID = %d"
						,pHuman->GetID(), nID) ;
					return PACKET_EXE_CONTINUE;
				}
			}
			break;
		case CGBBSSychMessages::OPT_DEL_MESSAGE:
			{
				//...
			}
			break;
		case CGBBSSychMessages::OPT_SET_TITLE:
			{
				if(pBBS->SetBBSTitle( m_MessageData, nLength) == FALSE)
				{
					g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: CGBBSSychMessagesHandler::ObjID=%d"
						,pHuman->GetID()) ;
					return PACKET_EXE_CONTINUE;
				}
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:wx2Server,代码行数:101,代码来源:CGBBSSychMessagesHandler.cpp

示例13: Assert

ORESULT    AbilityGather::OnProcSuccess(Obj_Human* pHuman)
{
__ENTER_FUNCTION

    Assert(pHuman);
    AbilityOpera* pOpera    =    pHuman->GetAbilityOpera();
    Assert(pOpera);
    
    ObjID_t        TargetID    =    pOpera->m_Obj;
    AbilityID_t    AbilityID    =    pOpera->m_AbilityID;

    Assert(TargetID!=INVALID_ID);

    Obj* pObj        =   pHuman->getScene()->GetObjManager()->GetObj(TargetID);

    if(pObj->GetObjType()==Obj::OBJ_TYPE_ITEM_BOX)
    {
        Obj_ItemBox* pItemBox = static_cast<Obj_ItemBox*>(pObj);
        Assert(pItemBox);

        if(pItemBox->GetItemCount()>0)
        {
            if(pItemBox->GetOpenFlag()!=TRUE)
            {
                pItemBox->SetOpenFlag(TRUE);
            }
            
            GCBoxItemList    Msg;
            int j = 0;
            for(int i =0;i<MAX_BOXITEM_NUMBER;i++)
            {
                _ITEM* pItem = pItemBox->GetItem(i);
                Assert(pItem);

                if(pItem->IsNullType())
                    continue;

                Msg.setItemData(pItem,j);
                j++;
            }
            Msg.setItemNum(pItemBox->GetItemCount());
            Msg.setItemBoxId(pItemBox->GetID());
            Msg.setItemBoxType(pItemBox->GetType());
            pHuman->GetPlayer()->SendPacket(&Msg);
        }
        else
        {
            Scene* pScene = pHuman->getScene();
            Assert(pScene);
            INT ItemBoxType = pItemBox->GetType();
            _GROW_POINT_INFO*    pGET = g_GrowPointInfoTbl.Get(ItemBoxType);
            Assert(pGET);
            if(pGET->m_ScriptID>0)
            {
                if(pScene->GetGrowPointManager()->CallScriptRecycleFunc(pGET->m_ScriptID,pHuman->GetID(),TargetID,pScene->SceneID()))
                {
                    pItemBox->Recycle();
                }
            }

        }

        GCAbilitySucc SuccMsg;
        SuccMsg.SetAbilityID( AbilityID );
        SuccMsg.SetPrescriptionID( INVALID_ID );
        pHuman->GetPlayer()->SendPacket( &SuccMsg );
    
    }
    else
    {
        return OR_INVALID_TARGET;
    }
    return OR_OK;
__LEAVE_FUNCTION
    return OR_ERROR;
}
开发者ID:gangzi4494,项目名称:web-pap,代码行数:76,代码来源:AbilityGather.cpp

示例14: Execute

uint CGEquipExChangePaiTypeHandler::Execute(CGEquipExChangePaiType* pPacket,Player* pPlayer)
{
	__ENTER_FUNCTION

		GamePlayer* pGamePlayer = (GamePlayer*)pPlayer;
	Assert( pGamePlayer );

	Obj_Human* pHuman = pGamePlayer->GetHuman();
	Assert( pHuman );

	Scene* pScene = pHuman->getScene();
	if( pScene==NULL )
	{
		Assert(FALSE);
		return PACKET_EXE_ERROR;
	}

	//检查线程执行资源是否正确
	Assert( MyGetCurrentThreadID()==pScene->m_ThreadID );
	//交易状态不可操作
	if(pHuman->m_ExchangBox.m_Status > 0)
	{//丢弃
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: ObjID=%d, ExchangBox::m_Status>0" ,pHuman->GetID()) ;
		return PACKET_EXE_CONTINUE ;
	}
	//摆摊状态不可操作
	if(pHuman->m_StallBox.GetStallStatus() == ServerStallBox::STALL_OPEN)
	{//丢弃
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: ObjID=%d, ServerStallBox::STALL_OPEN" ,pHuman->GetID()) ;
		return PACKET_EXE_CONTINUE ;
	}

	//摆摊不可操作
	if(pHuman->m_StallBox.GetStallStatus() == ServerStallBox::STALL_OPEN)
	{//丢弃
		g_pLog->FastSaveLog( LOG_FILE_1, "ERROR: ObjID=%d, ServerStallBox::STALL_OPEN" ,pHuman->GetID()) ;
		return PACKET_EXE_CONTINUE ;
	}

	ObjID_t		NpcObjID=	pPacket->GetUniqueID();
	Obj* pNpcObj = pScene->GetObjManager()->GetObj(NpcObjID);
	if (pNpcObj == NULL)
	{
		return PACKET_EXE_ERROR;
	}
	else
	{
		if( pNpcObj->GetObjType() != Obj::OBJ_TYPE_MONSTER )
		{
			return PACKET_EXE_ERROR;
		}
	}

	FLOAT fDist = MySqrt(pNpcObj->getWorldPos(), pHuman->getWorldPos());

	if(fDist>MAX_NPC_DISTANCE)
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipExChangePaiTypeHandler Out Of Range ObjName = %s", pHuman->GetName()) ;
		return PACKET_EXE_CONTINUE ; 
	}


	EQUIPEXCHANGEPAITTYPE_RESULT	Result = EQUIPEXCHANGEPAITTYPE_FAIL;
	GCEquipExChangePaiTypeResult  ResultPacket;

	Item*		pEquip1Item		= NULL;
	Item*		pEquip2Item		= NULL;
	INT			Equip1Point		= INVALID_ITEM_POS;
	INT			Equip2Point		= INVALID_ITEM_POS;
	if(pPacket->GetEquip1PosType()>=INVALID_ITEM_POS_TYPE)
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipExChangePaiTypeHandler Equip posType error, posType=%d", pPacket->GetEquip1PosType()) ;
		return PACKET_EXE_ERROR;
	}

	if(pPacket->GetEquip1PosType() == ENUM_BAG)
	{
		ItemContainer* pItemContainer1 = HumanItemLogic::GetBagContainer(pHuman,pPacket->GetPos1());
		if( pItemContainer1 == NULL )
		{
			g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipExChangePaiTypeHandler: BagIndex error, BagIndex=%d", pPacket->GetPos1()) ;
			return PACKET_EXE_ERROR;
		}
		if (!pItemContainer1->IsCanUse())
		{
			Result = EQUIPEXCHANGEPAITTYPE_BAG_INVALID;
			ResultPacket.SetResult(Result);
			pGamePlayer->SendPacket(&ResultPacket);;
			g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipExChangePaiTypeHandler: ItemContainer is invalid, ContainerType=%d, BagIndex=%d", 
				pItemContainer1->GetContainerType(), pPacket->GetPos1()) ;
				return PACKET_EXE_ERROR;
		}

		pEquip1Item		=	pItemContainer1->GetItem(pItemContainer1->BagIndex2ConIndex(pPacket->GetPos1()));
		if(pEquip1Item->IsEmpty())
		{
			Result = EQUIPEXCHANGEPAITTYPE_EQUIP_FAIL;
			ResultPacket.SetResult(Result);
			pGamePlayer->SendPacket(&ResultPacket);
			g_pLog->FastSaveLog( LOG_FILE_1, "CGEquipExChangePaiTypeHandler Equip empyty, bagpos=%d", pPacket->GetPos1()) ;
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:wx2Server,代码行数:101,代码来源:CGEquipExChangePaiTypeHandler.cpp


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