Beispiel #1
0
unsigned char _stdcall IsPKable(classUSER* user, unsigned short targetid){
	CObjCHAR* targetObj = g_pObjMGR->Get_CharOBJ(targetid, true);	// CheckHP = true -> no dead mobs plx :D
	if(!targetObj) return false;
	if(!targetObj->IsUSER()) return true;

	classUSER* target = static_cast<classUSER*>(targetObj);
	CustomAvatarData* userData = CustomAvatarData::Get(user);
	CustomAvatarData* targetData = CustomAvatarData::Get(targetObj);

	if(targetData->pDuel.mInDuel || userData->pDuel.mInDuel){
		if(!targetData->pDuel.mIsDead && !userData->pDuel.mIsDead){
			if(targetData->pDuel.mRequestID == user->Get_INDEX() && userData->pDuel.mRequestID == target->Get_INDEX())
				return true;
		}

		return false;
	}

	return g_TblZONE[target->m_nZoneNO][18].GetINT() != PVP_CANT;
}
Beispiel #2
0
/// 타겟 필터링 검사
bool CSkillManager::CheckCastingTargetFilter( int iSkillIDX, CObjCHAR* pCaster, int iTargetObjIDX )
{
	if( pCaster == NULL )
		return false;

	int iSkillTargetType = CSkillManager::GetSkillTargetType( iSkillIDX );

	switch( iSkillTargetType )
	{
		case SKILL_TARGET_NONE:			
			return true;
	}


	CObjCHAR *pTargetCHAR = g_pObjMGR->Get_CharOBJ( iTargetObjIDX, false );

	int iTargetFilterType = SKILL_CLASS_FILTER( iSkillIDX );

	switch( iTargetFilterType )
	{
		case SKILL_TARGET_FILTER_SELF:
			return true;

		case SKILL_TARGET_FILTER_GROUP:
			{	
				/// 타겟이 있을경우.. 타겟이 우리편이 아니면.. false
				if( pTargetCHAR != NULL )
				{
					/// 파티원이 아니다.
					if( !CParty::GetInstance().IsPartyMember( g_pObjMGR->Get_ServerObjectIndex( iTargetObjIDX ) ))
					{				
						g_itMGR.AppendChatMsg( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_01 ), IT_MGR::CHAT_TYPE_SYSTEM );
						return false;
					}
				}
			}
			break;
		case SKILL_TARGET_FILTER_GUILD:
			{
				//AddMsgToChatWND ( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_02, g_dwRED,CChatDLG::CHAT_TYPE_SYSTEM );
			}
			break;
		case SKILL_TARGET_FILTER_FRIEND_ALL:
			{
				/// 타겟이 있을경우 나랑 동맹이 아닐경우 false
				if( pTargetCHAR != NULL )
				{
					if( CUserInputState::IsEnemy( pTargetCHAR ) )
					{
						g_itMGR.AppendChatMsg( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_03 ), IT_MGR::CHAT_TYPE_SYSTEM );
						return false;
					}
				}
			}
			break;
		case SKILL_TARGET_FILTER_MOB:
			{
				if( pTargetCHAR == NULL )
					return false;

				if( !pTargetCHAR->IsA( OBJ_MOB ) )
				{
					g_itMGR.AppendChatMsg( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_04 ), IT_MGR::CHAT_TYPE_SYSTEM );
					return false;
				}
			}
			break;
		case SKILL_TARGET_FILTER_ENEMY_ALL:
			{
				if( pTargetCHAR == NULL )
					return false;

				if( CUserInputState::IsEnemy( pTargetCHAR ) == false )
				{
					g_itMGR.AppendChatMsg( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_05 ), IT_MGR::CHAT_TYPE_SYSTEM );
					return false;
				}
			}
			break;
		case SKILL_TARGET_FILTER_ENEMY_PC:
			{
				if( pTargetCHAR == NULL )
					return false;

				/// 동맹이거나.. 아바타가 아닐경우는..
				if( CUserInputState::IsEnemy( pTargetCHAR ) == false || !pTargetCHAR->IsA( OBJ_AVATAR ) )
				{
					g_itMGR.AppendChatMsg( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_05 ), IT_MGR::CHAT_TYPE_SYSTEM );
					return false;
				}
			}
			break;

		case SKILL_TARGET_FILTER_ALL_PC:
			{
				if( pTargetCHAR == NULL )
					return false;

				if( !pTargetCHAR->IsUSER( ) )
				{
					g_itMGR.AppendChatMsg( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_06 ), IT_MGR::CHAT_TYPE_SYSTEM );
					return false;
				}
			}			
			break;
		case SKILL_TARGET_FILTER_ALL_CHAR:
			{
				if( pTargetCHAR == NULL )
					return false;

				if( !( pTargetCHAR->IsUSER() || pTargetCHAR->IsA( OBJ_MOB ) ) )
				{
					g_itMGR.AppendChatMsg( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_07 ), IT_MGR::CHAT_TYPE_SYSTEM );
					return false;
				}
			}
			break;

		/// 죽은 유져일 경우는 아군만
		case SKILL_TARGET_FILTER_DEAD_USER:
			{
				/// 타겟이 있을경우 나랑 동맹이 아닐경우 false
				if( pTargetCHAR != NULL )
				{
					if( CUserInputState::IsEnemy( pTargetCHAR ) )
					{
						g_itMGR.AppendChatMsg( CStr::Printf("%s", STR_SKILL_TARGET_FILTER_NOTIFY_03 ), IT_MGR::CHAT_TYPE_SYSTEM );
						return false;
					}
				}
			}
			break;

		default:
			break;
	}

	return true;
}