Ejemplo n.º 1
0
void CAPet::Mount( bool bMount )
{
	m_bMount = bMount;

	// 주인관련 처리
	if( m_pOwner )
	{
		CArea* area = m_pOwner->m_pArea;

		if( bMount )		// 탈때
		{
			if(m_pArea != NULL) // NULL이 아니면 실행, NULL이면 건너뛸것.
				m_pArea->MoveChar( this, GET_YLAYER(m_pOwner), GET_X(m_pOwner), GET_Z(m_pOwner), GET_H(m_pOwner), GET_R(m_pOwner), MSG_MOVE_STOP, NULL );

			// 소환 해제
			while ( m_pOwner->m_elementalList)
				m_pOwner->UnsummonElemental(m_pOwner->m_elementalList);
		}

		if(area)
		{
			{
				// 사라졌다 나타나기
				CNetMsg::SP rmsg(new CNetMsg);
				DisappearMsg(rmsg, this);
				area->SendToCell(rmsg, this, true);
			}

			{
				CNetMsg::SP rmsg(new CNetMsg);
				AppearMsg(rmsg, this);
				area->SendToCell(rmsg, this, true);
			}
		}


		if (m_pArea)
		{
			CNetMsg::SP rmsg(new CNetMsg);
			ExAPetStatusMsg( rmsg, this );
			m_pArea->SendToCell(rmsg, GetOwner(), true);
		}

		m_pOwner->CalcStatus(true);

		{
			CNetMsg::SP rmsg(new CNetMsg);
			ExAPetFuntionMsg( rmsg, MSG_SUB_MOUNT_REP, this , 0 );
			m_pOwner->m_pArea->SendToCell(rmsg, m_pOwner, true);
		}
	}
}
Ejemplo n.º 2
0
void CAPet::Disappear()
{
	CArea* area = m_pArea;

//#ifdef MONSTER_COMBO_BUGFIX
//	GAMELOG << init("APET DISAPPEAR PREV")
//			<< m_index
//			<< end;
//#endif // MONSTER_COMBO_BUGFIX

	if (area == NULL)
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX") << "AREA NULL" << end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	if (!IS_IN_CELL(this))
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX")
//				<< "IS_IN_CELL" << delim
//				<< m_cellX
//				<< end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	if (!m_bSummon)
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX") << "SUMMON FALSE" << end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	// 어택 리스트 지우고
	DelAttackList(this);

	{
		// 사라짐을 알리고
		CNetMsg::SP rmsg(new CNetMsg);
		DisappearMsg(rmsg, this);
		area->SendToCell(rmsg, this, true);
	}

	// 셀에서 제거
	area->CharFromCell(this, true);
	m_pZone = NULL;
	m_pArea = NULL;

	m_bSummon = false;
//#ifdef MONSTER_COMBO_BUGFIX
//	GAMELOG << init("APET DISAPPEAR AFTER")
//			<< m_index << delim
//			<< m_cellX << delim
//			<< m_cellZ << end;
//#endif // MONSTER_COMBO_BUGFIX
}
Ejemplo n.º 3
0
void CAPet::Appear(bool bIncludeOwner, bool bAction )
{
//#ifdef MONSTER_COMBO_BUGFIX
//	GAMELOG << init("APET APEAR PREV")
//			<< m_index << end;
//#endif // MONSTER_COMBO_BUGFIX"

	if (m_pOwner == NULL)
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX") << "OWNER NULL"<< end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	CArea* area = m_pOwner->m_pArea;
	if (area == NULL)
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX") << "AREA NULL" << end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	if (m_bSummon)
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX") << "SUMMON FALSE" << end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	// 셀에 넣기
	m_pZone = area->m_zone;
	m_pArea = area;
	m_pos = m_pOwner->m_pos;
	int cx, cz;
	area->PointToCellNum(GET_X(this), GET_Z(this), &cx, &cz);
	area->CharToCell(this, GET_YLAYER(this), cx, cz);

	{
		CNetMsg::SP rmsg(new CNetMsg);
		// 나타남을 알림
		AppearMsg(rmsg, this, true, true);
		area->SendToCell(rmsg, this, bIncludeOwner);
	}

	CalcStatus(false);

	{
		CNetMsg::SP rmsg(new CNetMsg);
		ExAPetStatusMsg( rmsg, this );
		m_pArea->SendToCell(rmsg, GetOwner(), true);
	}

	for( int i=0 ; i < APET_WEARPOINT; i++ )
	{
		if( m_wearing[i] )
		{
			CNetMsg::SP rmsg(new CNetMsg);
			AddItemExAPetMsg(rmsg, m_wearing[i]);
			SEND_Q(rmsg, GetOwner()->m_desc);
		}
	}

	m_bSummon = true;
//#ifdef MONSTER_COMBO_BUGFIX
//	GAMELOG << init("APET APEAR AFTER")
//			<< m_index << delim
//			<< m_cellX << delim
//			<< m_cellZ << end;
//#endif // MONSTER_COMBO_BUGFIX
}
Ejemplo n.º 4
0
bool CAPet::TransFormationCheck()
{
	if( m_pProto->m_TansType !=  APET_TRANS_NONE )
	{
		int comp = 0;
		char oldState = this->m_cTransSate;

		switch( m_pProto->m_TansType)
		{
		case APET_TRANS_TIME:
			{
				int nowsec = gserver->getNowSecond() % 3600;

				if (nowsec == (3600 - 30) || nowsec == (3600 / 2) - 30)	// 30초 전
				{
					CNetMsg::SP rmsg(new CNetMsg);
					SysMsg(rmsg, MSG_SYS_TRANSLATE_START );
					SEND_Q(rmsg, m_pOwner->m_desc);
				}
				else if (nowsec >= 0 && nowsec <= (3600 / 2)) // 정각s
				{
					m_cTransSate = 0;
				}
				else
				{
					m_cTransSate = 1;
				}
			}
			break;
		case APET_TRANS_FAITH:
			comp = m_nFaith;
			break;
		case APET_TRANS_STM:
			comp = m_nStm;
			break;
		}

		// 옵션이 0 또는 100 이상일때 강제로 설정해주는 부분
		if( m_cForceTrans == 1 )			// 무조건 변신
			this->m_cTransSate = 1;
		else if ( m_cForceTrans == 2 )		// 무조건 변신 안함
			this->m_cTransSate = 0;

		if( oldState != m_cTransSate )
		{
			// 변신했는데 마운트 타입이 아닌경우
			if( m_pProto->m_nMount[ (unsigned int)m_cTransSate ] < 1 && IsMount() )
			{
				Mount(false);
			}
			else
			{
				CArea* area = m_pOwner->m_pArea;

				{
					CNetMsg::SP rmsg(new CNetMsg);
					DisappearMsg(rmsg, this);
					area->SendToCell(rmsg, this, true);
				}

				{
					CNetMsg::SP rmsg(new CNetMsg);
					AppearMsg(rmsg, this);
					area->SendToCell(rmsg, this, true);
				}
			}

			CalcStatus(false);

			return true;
		}
	}
	return false;
}