示例#1
0
BOOL RootTrap01_T::EffectOnChar(Obj_Special& rThis, Obj_Character& rTar) const
{
    SpecialObjData_T const* pData = rThis.GetDataRecord();
    if(NULL==pData)
    {
        AssertEx(FALSE,"[RootTrap01_T::EffectOnChar]: Can't find Data record.");
        return FALSE;
    }
    INT nImpactID = pData->GetDescriptorByIndex(0)->GetValue();
    Time_t nContinuance = pData->GetDescriptorByIndex(1)->GetValue();
    OWN_IMPACT impact;
    SOT_Root_T ImpactLogic;
    ImpactLogic.InitStruct(impact);
    impact.m_nCasterID = rThis.GetOwnerID();
    impact.m_nSkillID = INVALID_ID;
    impact.m_nImpactID = nImpactID;
    ImpactLogic.SetContinuance(impact, nContinuance);
    impact.m_nPRI = rThis.GetXinFaLevelForBuffMutex();

    Scene* pScene = rThis.getScene();
    if(NULL!=pScene)
    {
        pScene->GetEventCore().RegisterBeSkillEvent(rTar.GetID(), rThis.GetOwnerID(), BEHAVIOR_TYPE_HOSTILITY, 500);
        pScene->GetEventCore().RegisterImpactEvent(rTar.GetID(), rThis.GetOwnerID(), impact, 500);
    }
    return FALSE;
}
示例#2
0
 VOID StdImpact030_T::OnFadeOut(OWN_IMPACT& rImp, Obj_Character& rMe) const
 {
     __ENTER_FUNCTION
     Obj_Character* pTar=NULL;
     Scene* pScene = rMe.getScene();
     if(NULL==pScene)
     {
         AssertEx(FALSE, "[StdImpact030_T::OnFadeOut]: Empty scene pointer found!!");
         return;
     }
     OBJLIST Targets;
     if(FALSE==ScanUnitForTarget(rImp, rMe, *(rMe.getWorldPos()), (FLOAT)GetScanRadius(rImp), GetEffectedObjCount(rImp), Targets))
     {
         return;
     }
     INT nImpact = GetSubImpactIndex(rImp);
     if(INVALID_ID==nImpact)
     {
         return;
     }
     // impacts init finished
     for(INT nIdx=0; Targets.m_Count>nIdx;++nIdx)
     {
         pTar = (Obj_Character*)Targets.m_aObj[nIdx];
         if(NULL!=pTar)
         {
             pScene->GetEventCore().RegisterBeSkillEvent(pTar->GetID(), rMe.GetID(), BEHAVIOR_TYPE_HOSTILITY, 500);
             g_ImpactCore.SendImpactToUnit(*pTar, nImpact, rMe.GetID(), 500);
         }
     }
     return;
     __LEAVE_FUNCTION
 }
示例#3
0
		BOOL StdImpact059_T::HitThisTarget(Obj_Character& rMe, Obj_Character& rTar, SkillID_t nSkillID) const
		{
			__ENTER_FUNCTION
			//SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
			TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();
			Scene* pScene = rMe.getScene();
			if(TRUE==rMe.IsFriend(&rTar))
			{
				//给友方使用的技能100%命中
				return TRUE;
			}
			//Hit Or Miss
			//根据命中率判断是否击中
			//注意:此时对技能释放而言,目标已验证为合法,因此只受技能本身的命中率影响
			//如果没有命中
			if(FALSE == IsHit(rMe, rTar, m_iAccuracy))
			{
				if(NULL!=pScene)
				{
					//直接向全局event对象注册没有命中的事件
					pScene->GetEventCore().RegisterSkillMissEvent(rTar.GetID(), rMe.GetID(), nSkillID, 0);
				}
				return FALSE;
			}
			//如果最终命中,向全局event对象注册技能命中目标事件
			if(NULL!=pScene)
			{
				pScene->GetEventCore().RegisterSkillHitEvent(rTar.GetID(), rMe.GetID(), nSkillID, 0);
			}
			return TRUE;
			__LEAVE_FUNCTION
				return FALSE;
		}
示例#4
0
		VOID StdImpact081_T::SendImpactToMe( OWN_IMPACT& rImp, Obj_Character& rMe ) const
		{
			//第一个技能是否可以被触发
			BOOL bFirstHappend = IsHappend(rMe, rImp, 0);

			for(INT nID = 0; nID < MAX_IMPACT_NUM_AT_SAME_TIME; nID++)
			{
				INT iImpactID = GetImpactID(rImp, nID);
				if(INVALID_ID == iImpactID)
				{
					break;
				}
				if(0 == nID)
				{
					//如果第一个技能没有概率触发
					if(!bFirstHappend)
					{
						continue;
					}
				}
				else
				{
					if(INVALID_ID == GetEffectRate( rImp , nID))
					{
						//其它的impact的概率值写-1,认为应该取第一项计算出的概率值
						if(!bFirstHappend)
						{
							continue;
						}
					}
					else
					{
						//单独计算其概率值
						if(!IsHappend(rMe, rImp, nID))
						{
							continue;
						}
					}
				}
				
				Obj_Character* pAttacker = GetBeHitTarget( rMe, rImp );
				if(pAttacker)
				{
					INT iTargetType = GetTargetType( rImp, nID );
					if( iTargetType == TargetTypeMe )
					{
						g_ImpactCore.SendImpactToUnit(rMe, iImpactID, pAttacker->GetID(), 0);
					}
					else
					{
						g_ImpactCore.SendImpactToUnit(*pAttacker, iImpactID, rMe.GetID(), 0);
					}				
				}
			}
		}
示例#5
0
uint CGAskDetailXinFaListHandler::Execute( CGAskDetailXinFaList* 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 = pHuman->GetID();
	if( ObjID == INVALID_ID )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	Obj_Character *pTarget = (Obj_Character*)(pScene->GetObjManager()->GetObj(pPacket->getTargetID()));
	if( pTarget==NULL )
	{
		Assert( pTarget ) ;
		return PACKET_EXE_ERROR ;
	}

	// 权限判断
	// to be continue...
	if ( pTarget->GetObjType() != Obj::OBJ_TYPE_HUMAN
		&& pTarget->GetObjType() != Obj::OBJ_TYPE_PET )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGAskDetailXinFaListHandler: faile obj=%d scene=%d", 
			ObjID, pScene->SceneID() ) ;
		return PACKET_EXE_CONTINUE;
	}

	GCDetailXinFaList	Msg;

	Msg.setObjID( pTarget->GetID() );

	Msg.setXinFaList(pHuman->Skill_GetXinFaList().m_Count, pHuman->Skill_GetXinFaList().m_aXinFa);
	pGamePlayer->SendPacket( &Msg ) ;

	g_pLog->FastSaveLog( LOG_FILE_1, "CGAskDetailXinFaListHandler: ok obj=%d scene=%d", 
		ObjID, pScene->SceneID() ) ;

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}
示例#6
0
		BOOL CommonSkill001_T::OnCancel(Obj_Character& rMe) const
		{
			__ENTER_FUNCTION
			SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
			TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();

			Obj_Character* pTar = (Obj_Character*)(GetTargetObj(rMe));
			if(NULL==pTar)
			{
				rParams.SetErrCode(OR_INVALID_TARGET);
				return FALSE;
			}
			if(NULL==pTar || FALSE==pTar->IsAlive() || FALSE == pTar->IsActiveObj() || Obj::OBJ_TYPE_PET != pTar->GetObjType())
			{
				rParams.SetErrCode(OR_INVALID_TARGET);
				return FALSE;
			}

			GCManipulatePetRet msg;
			msg.SetGUID(((Obj_Human*)&rMe)->GetGUIDOfCallUpPet());
			msg.SetFightingFlag(FALSE);
			msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_CALLUPFALID);

			((Obj_Human*)&rMe)->GetPlayer()->SendPacket(&msg);
			// 减少该宠物身上的捕获玩家数
			((Obj_Horse*)pTar)->DelCapturer(rMe.GetID());

			return TRUE;
		__LEAVE_FUNCTION
		return FALSE;
		}
示例#7
0
		VOID DS_EMei014_T::OnFadeOut(OWN_IMPACT& rImp, Obj_Character& rMe) const
		{
			__ENTER_FUNCTION
			Obj_Character* pTar=NULL;

			OBJLIST Targets;
			if(FALSE==ScanUnitForTarget(rImp, rMe, *(rMe.getWorldPos()), (FLOAT)GetScanRadius(rImp), GetEffectedObjNumber(rImp), Targets))
			{
				return;
			}
			// init impact
			OWN_IMPACT impact;
			DI_ModifyRage_T const* pImpactLogic = (DI_ModifyRage_T const*)g_ImpactLogicList.GetLogicById(DI_MODIFY_RAGE);
			if(NULL==pImpactLogic)
			{
				AssertEx(FALSE,"[SOT_EMei014_T::OnFadeOut]:Can't find the logic for DI_MODIFY_RAGE. check now.");
				return;
			}

			pImpactLogic->InitStruct(impact);	
			impact.m_nSkillID = rImp.m_nSkillID;
			impact.m_nCasterID = rMe.GetID();
			impact.m_nImpactID = GetSubImpactID(rImp);
			INT nRage = GetRageModification(rImp);
			0<nRage?nRage=-nRage:NULL;
			pImpactLogic->SetRageModification(impact, nRage);
			Scene* pScene = rMe.getScene();
			if(NULL==pScene)
			{
				AssertEx(FALSE,"[SOT_EMei014_T::OnFadeOut]:Empty Scene pointer. check now.");
				return;
			}
			// impacts init finished
			for(INT nIdx=0; Targets.m_Count>nIdx;++nIdx)
			{
				pTar = (Obj_Character*)Targets.m_aObj[nIdx];
				if(NULL==pTar)
				{
					continue;
				}
				pScene->GetEventCore().RegisterBeSkillEvent(pTar->GetID(), rMe.GetID(), BEHAVIOR_TYPE_HOSTILITY, 500);
				pScene->GetEventCore().RegisterImpactEvent(pTar->GetID(), rMe.GetID(), impact, 500);
			}
			return;
			__LEAVE_FUNCTION
		}
示例#8
0
		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;
		}
示例#9
0
		VOID StdImpact059_T::DoHitTarget( OWN_IMPACT& rImp, Obj_Character& rMe, OBJLIST& rTargets, HitFlagsForOBJLIST_T& HitFlagList, UINT& nCount ) const
		{
			__ENTER_FUNCTION

			WORLD_POS const* pPos = rMe.getWorldPos();
			//搜索目标列表
			if(NULL!=pPos)
			{
				ScanUnitForTarget( rImp, rMe, pPos->m_fX, pPos->m_fZ, rTargets );
			}
			SkillID_t nSkillID = rImp.GetSkillID();
			////根据技能ID从全局技能模板管理器中获得技能模板实例
			//const SkillTemplateData_T* pSkillTemplate = g_SkillTemplateDataMgr.GetInstanceByID( iID );
			HitFlagList.ClearAllFlags();
			INT nIdx	= 0;
			for(nIdx=0; rTargets.m_Count>nIdx; ++nIdx)
			{
				Obj* pTarget = rTargets.m_aObj[nIdx];
				if(NULL!=pTarget)
				{
					Obj_Character* pChar = (Obj_Character*)pTarget;
					//如果命中,则把命中与否的列表置为命中
					if(TRUE==HitThisTarget(rMe, *pChar, nSkillID))
					{
						//判断小球投送对象身上是否已经有同类型的效果存在,如果有
						if( !IsCanSendToUnit( rImp, rMe, pChar ) )
						{
							continue;
						}
						////记录小球投送的对象
						//(Obj_Character*)(m_aBallUniqueID[nIdx].m_pCharacter)	= pChar;
						////记录小球的全局ID
						//(UINT)(m_aBallUniqueID[nIdx].m_uUniqueID)				= g_ImpactCore.GetUniqueID();
						//pChar->Impact_SetImpactUniqueID( m_aBallUniqueID[nIdx].m_uUniqueID );
						INT nDataIndex = GetSubImpactDataIndexByIndex(rImp, 0);
						if(0<nDataIndex)
						{
							g_ImpactCore.SendImpactToUnit( *pChar, nDataIndex, rMe.GetID(), nSkillID );
						}

						//g_ImpactCore.SendBallImpactToUnit( *pChar, STD_IMPACT_058, rMe.GetID() );
						//Mark this Target Hitted
						HitFlagList.MarkFlagByIndex(nIdx); 
						++nCount;
					}
				}
			}
			__LEAVE_FUNCTION

		}
示例#10
0
		BOOL CommonSkill001_T::EffectOnUnitOnce(Obj_Character& rMe, Obj_Character& rTar, BOOL bCriticalFlag) const
		{
			__ENTER_FUNCTION
			SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
			TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();

			if(FALSE==rTar.IsAlive() || FALSE == rTar.IsActiveObj() || Obj::OBJ_TYPE_HORSE != rTar.GetObjType())
			{
				rParams.SetErrCode(OR_INVALID_TARGET);
				return FALSE;
			}
			if(Obj::OBJ_TYPE_HUMAN != rMe.GetObjType())
			{
				rParams.SetErrCode(OR_U_CANNT_DO_THIS_RIGHT_NOW);
				return FALSE;
			}
			{// Test code
				
				INT nDataIndex = Skill_GetSkillInfoDescriptorValueByIndex(rSkillInfo, 0);
				g_ImpactCore.SendImpactToUnit(rTar, nDataIndex, rMe.GetID(), 500);
			}
			PET_LOG_PARAM	PetLogParam;
			BOOL bRet = ((Obj_Human*)&rMe)->CaptureHorse(&PetLogParam,rTar.GetID());
			GCManipulatePetRet msg;
			if(bRet)
			{
				msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_CAPTURESUCC);

				((Obj_Human*)&rMe)->GetPlayer()->SendPacket(&msg);
				// 向正在捕获的其它玩家发送失败消息
				((Obj_Horse&)rTar).SendCaptureFailedToOthers(rMe.GetID());
				// 清空宠物身上所有的玩家数
				((Obj_Horse&)rTar).DelCapturer(rMe.GetID());
				HorseManager* pHorseMgr = rMe.getScene()->GetHorseManager();
				if (pHorseMgr)
				{
					pHorseMgr->RemoveHorse(rTar.GetID());
				}
				
				PetLogParam.OPType	=	PET_OP_CATCH;
				SavePetLog(&PetLogParam);
			}
			else
			{
				// 减少该宠物身上的捕获玩家数
				((Obj_Horse&)rTar).DelCapturer(rMe.GetID());

				msg.SetManipulateRet(GCManipulatePetRet::MANIPULATEPET_RET_CAPTUREFALID);

				((Obj_Human*)&rMe)->GetPlayer()->SendPacket(&msg);
			}
			return TRUE;
			__LEAVE_FUNCTION
			return FALSE;
		}
示例#11
0
		VOID StdImpact059_T::BroadcastTargetListMessage( OWN_IMPACT& rImp, Obj_Character& rMe, OBJLIST& rTargets, HitFlagsForOBJLIST_T& rHitFlagsForObjList ) const
		{
			__ENTER_FUNCTION
			SkillInfo_T& rSkillInfo = rMe.GetSkillInfo();
			TargetingAndDepletingParams_T& rParams = rMe.GetTargetingAndDepletingParams();
			GCTargetListAndHitFlags msg;
			GCTargetListAndHitFlags::HitFlagList_T& rHitFlags		= msg.GetHitFlagList();
			msg.SetDataType(msg.BUFF_ACTIVETE);
			msg.SetObjID(rMe.GetID());
			msg.SetUserPos(*(rMe.getWorldPos()));
			msg.SetLogicCount(rMe.GetLogicCount());
			msg.SetSkillOrSpecialObjDataID(rImp.GetSkillID());
			msg.SetTargetID(rParams.GetTargetObj());
			msg.SetTargetPos(rParams.GetTargetPosition());
			msg.SetDir(rParams.GetTargetDirection());
			BYTE nNum = rTargets.m_Count;
			if(msg.MAX_TARGET_LIST_SIZE<nNum)
			{
				nNum = msg.MAX_TARGET_LIST_SIZE;
			}
			msg.SetTargetNum(nNum);
			int iTemp = nNum;

			INT nIdx=0;
			for(nIdx=0; nNum>nIdx; ++nIdx)
			{
				Obj* pTarget = rTargets.m_aObj[nIdx];
				if(NULL!=pTarget)
				{
					msg.SetTargetObjIDByIndex(nIdx, pTarget->GetID());
					if(TRUE == rHitFlagsForObjList.GetFlagByIndex(nIdx))
					{
						rHitFlags.MarkFlagByIndex(nIdx);
						//msg.SetBallIDByIndex( nIdx, m_aBallUniqueID[nIdx].m_uUniqueID );
					}
				}
			}
			Scene* pScene = rMe.getScene();
			if(NULL!=pScene)
			{
				pScene->BroadCast(&msg, &rMe, TRUE);
			}
			__LEAVE_FUNCTION
		}
示例#12
0
		BOOL StdImpact059_T::IsCanSendToUnit( OWN_IMPACT& rImp, Obj_Character& rMe, Obj_Character* pChar ) const
		{		
			//获得技能使用者身上的效果列表
			__ENTER_FUNCTION
			OWN_IMPACT* pImpact = pChar->Impact_GetFirstImpactOfSpecificSkillID( rImp.GetSkillID() );
			if( NULL == pImpact )
			{
				if( pChar->Impact_IsCanReciveBallImpact( rImp ) )
				return TRUE;
			}
			else if( pImpact->GetCasterObjID()!=rMe.GetID() )
			{
				return TRUE;
			}

			return FALSE;
			__LEAVE_FUNCTION
			return FALSE;
		}
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 ;
}
示例#14
0
		BOOL ExplosionTrap02_T::EffectOnChar(Obj_Special& rThis, Obj_Character& rTar) const
		{
			SpecialObjData_T const* pData = rThis.GetDataRecord();
			if(NULL==pData)
			{
				AssertEx(FALSE,"[ExplosionTrap02_T::EffectOnChar]: Can't find Data record.");				
				return FALSE;
			}
			SpecialObjData_T::Descriptor_T const* pDescriptor0 = pData->GetDescriptorByIndex(0);
			INT nDamagePhysics = 0;
			if(NULL != pDescriptor0)
			{
				nDamagePhysics = pDescriptor0->GetValue();
			}
			SpecialObjData_T::Descriptor_T const* pDescriptor1 = pData->GetDescriptorByIndex(1);
			INT nDamageMagic = 0;
			if(NULL != pDescriptor1)
			{
				nDamageMagic = pDescriptor1->GetValue();
			}
			SpecialObjData_T::Descriptor_T const* pDescriptor2 = pData->GetDescriptorByIndex(2);
			INT nDamageCold = 0;
			if(NULL != pDescriptor2)
			{
				nDamageCold = pDescriptor2->GetValue();
			}
			SpecialObjData_T::Descriptor_T const* pDescriptor3 = pData->GetDescriptorByIndex(3);
			INT nDamageFire = 0;
			if(NULL != pDescriptor3)
			{
				nDamageFire = pDescriptor3->GetValue();
			}
			SpecialObjData_T::Descriptor_T const* pDescriptor4 = pData->GetDescriptorByIndex(4);
			INT nDamageLight = 0;
			if(NULL != pDescriptor4)
			{
				nDamageLight = pDescriptor4->GetValue();
			}
			SpecialObjData_T::Descriptor_T const* pDescriptor5 = pData->GetDescriptorByIndex(5);
			INT nDamagePoison = 0;
			if(NULL != pDescriptor5)
			{
				nDamageLight = pDescriptor5->GetValue();
			}
			INT nBodyEnchaneImpactID = pData->GetDescriptorByIndex(6)->GetValue();
			INT nBodyEnchanceContinuance = pData->GetDescriptorByIndex(7)->GetValue();
			INT nActiveOdds = pData->GetDescriptorByIndex(8)->GetValue();
			INT nAttackRefixRate = pData->GetDescriptorByIndex(9)->GetValue();
			INT nDefenceRefixRate = pData->GetDescriptorByIndex(10)->GetValue();
			
			OWN_IMPACT impact1;
			DI_Damages_T impLogic1;
			impLogic1.InitStruct(impact1);
			impact1.m_nCasterID = rThis.GetOwnerID();
			impact1.m_nSkillID = Skill_Module::MELEE_ATTACK;
 			impLogic1.SetDamagePhy(impact1, nDamagePhysics);
			impLogic1.SetDamageMagic(impact1, nDamageMagic);
			impLogic1.SetDamageCold(impact1, nDamageCold);
			impLogic1.SetDamageFire(impact1, nDamageFire);
			impLogic1.SetDamageLight(impact1, nDamageLight);
			impLogic1.SetDamagePoison(impact1, nDamagePoison);

			
			Scene* pScene = rThis.getScene();
			if(NULL!=pScene)
			{
				pScene->GetEventCore().RegisterBeSkillEvent(rTar.GetID(), rThis.GetOwnerID(), BEHAVIOR_TYPE_HOSTILITY, 500);
				pScene->GetEventCore().RegisterImpactEvent(rTar.GetID(), rThis.GetOwnerID(), impact1, 500);
				INT nRand = pScene->GetRand100();
				if(nActiveOdds>nRand)
				{
					OWN_IMPACT impact2;
					SOT_BodyEnhance_T impLogic2;
					impLogic2.InitStruct(impact2);
					impact2.m_nCasterID = rThis.GetOwnerID();
					impact2.m_nSkillID = Skill_Module::MELEE_ATTACK;
					impact2.m_nImpactID = nBodyEnchaneImpactID;
					impLogic2.SetContinuance(impact2, nBodyEnchanceContinuance);
					INT nAttackRefix=0;
					INT nDefenceRefix=0;
					//Calculate Physics attack refix
					nAttackRefix = Float2Int((rTar.GetAttackPhysics() * nAttackRefixRate + 50) / 100);
					impLogic2.SetAttackPhysicsRefix(impact2, nAttackRefix);
					//Calculate Magic attack refix
					nAttackRefix = Float2Int((rTar.GetAttackMagic() * nAttackRefixRate + 50) / 100);
					impLogic2.SetAttackMagicRefix(impact2, nAttackRefix);
					//Calculate Physics Defence refix
					nDefenceRefix = Float2Int((rTar.GetDefencePhysics() * nDefenceRefixRate + 50) / 100);
					impLogic2.SetDefencePhysicsRefix(impact2, nDefenceRefix);
					//Calculate Magic Defence refix
					nDefenceRefix = Float2Int((rTar.GetDefenceMagic() * nDefenceRefixRate + 50) / 100);
					impLogic2.SetDefencePhysicsRefix(impact2, nDefenceRefix);
					//don't refix Max_Health
					impLogic2.SetMaxHealthRefix(impact2, 0);
					
					pScene->GetEventCore().RegisterImpactEvent(rTar.GetID(), rThis.GetOwnerID(), impact2, 500);
				}
			}
			return FALSE;
		}
uint CGAskSkillClassHandler::Execute( CGAskSkillClass* 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 = pHuman->GetID();
	if( ObjID == INVALID_ID )
	{
		Assert(FALSE) ;
		return PACKET_EXE_ERROR ;
	}

	Obj_Character *pTarget = (Obj_Character*)(pScene->GetObjManager()->GetObj(pPacket->getTargetID()));
	if( pTarget==NULL )
	{
		Assert( pTarget ) ;
		return PACKET_EXE_ERROR ;
	}

	// 权限判断
	// to be continue...
	if ( pTarget->GetObjType() != Obj::OBJ_TYPE_HUMAN
		&& pTarget->GetObjType() != Obj::OBJ_TYPE_PET )
	{
		g_pLog->FastSaveLog( LOG_FILE_1, "CGAskSkillClassHandler: faile obj=%d scene=%d", 
			ObjID, pScene->SceneID() ) ;
		return PACKET_EXE_CONTINUE;
	}

	_XINFA_DB_LOAD	XinFa;
	XinFa.m_Count = 0;
	INT nID, nScaned;
	for( nID = 0, nScaned = 0; nID < g_XinFaDataMgr.MAXSIZE && nScaned < g_XinFaDataMgr.Size(); )
	{
		Combat_Module::Skill_Module::XinFaData_T const* pXinFaData = g_XinFaDataMgr.GetInstanceByID(nID);
		if( pXinFaData != NULL )
		{
			nScaned ++;
			if( pHuman->GetMenPai() == pXinFaData->GetMenPai() )
			{
				XinFa.m_aXinFa[XinFa.m_Count].m_nXinFaID	=	nID;
				XinFa.m_aXinFa[XinFa.m_Count].m_nXinFaLevel	=	1;
				XinFa.m_Count ++;
			}
			if( XinFa.m_Count >= 3 )
				break;
		}
		nID ++;
	}

	GCSkillClass	Msg;
	Msg.setObjID( pTarget->GetID() );
	Msg.setXinFaList(XinFa.m_Count, XinFa.m_aXinFa);
	pGamePlayer->SendPacket( &Msg ) ;

	g_pLog->FastSaveLog( LOG_FILE_1, "CGAskSkillClassHandler: ok obj=%d scene=%d", 
		ObjID, pScene->SceneID() ) ;

	return PACKET_EXE_CONTINUE ;

__LEAVE_FUNCTION

	return PACKET_EXE_ERROR ;
}