Exemplo n.º 1
0
void CAIPetDummy::ActionRoaming()
{
	if( m_PPet->PMaster==NULL || m_PPet->PMaster->isDead()){
		m_ActionType = ACTION_FALL;
		ActionFall();
		return;
	}

	//wyvern behaviour
	if(m_PPet->getPetType()==PETTYPE_WYVERN){
		if(WyvernIsHealing()){
			m_PPathFind->LookAt(m_PPet->PMaster->loc.p);

			m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CEntityUpdatePacket(m_PPet, ENTITY_UPDATE));
			if(m_PPet->PMaster->objtype == TYPE_PC){
				((CCharEntity*)m_PPet->PMaster)->pushPacket(new CPetSyncPacket((CCharEntity*)m_PPet->PMaster));
			}
			return;
		}
	}

	if(m_PBattleTarget!=NULL){
		m_ActionType = ACTION_ENGAGE;
		ActionEngage();
		return;
	}

	float currentDistance = distance(m_PPet->loc.p, m_PPet->PMaster->loc.p);


	// this is broken until pet / mob relationship gets fixed
	// pets need to extend mob or be a mob because pet has no spell list!
	if(m_PPet->getPetType() == PETTYPE_AVATAR && m_PPet->m_Family == 104 && m_Tick >= m_LastActionTime + 30000 && currentDistance < PET_ROAM_DISTANCE * 2)
	{
		int16 spellID = 108;
		// define this so action picks it up
		m_PSpell = spell::GetSpell(spellID);
		m_PBattleSubTarget = m_PPet->PMaster;

		m_ActionType = ACTION_MAGIC_START;
		ActionMagicStart();
		return;
	}

	if (currentDistance > PET_ROAM_DISTANCE)
	{
		if(currentDistance < 35.0f && m_PPathFind->PathAround(m_PPet->PMaster->loc.p, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK))
		{
			m_PPathFind->FollowPath();
		}
		else
		{
			m_PPathFind->WarpTo(m_PPet->PMaster->loc.p, PET_ROAM_DISTANCE);
		}

        m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CEntityUpdatePacket(m_PPet, ENTITY_UPDATE));
	}
}
Exemplo n.º 2
0
void CAIPetDummy::ActionRoaming()
{
	if( m_PPet->PMaster==NULL || m_PPet->PMaster->isDead()){
		m_ActionType = ACTION_FALL;
		ActionFall();
		return;
	}

	//wyvern behaviour
	if(m_PPet->getPetType()==PETTYPE_WYVERN){
		//see if master is engaged on something, if so, help attack
		if(m_PPet->PMaster->PBattleAI->GetBattleTarget()!=NULL){
			m_PBattleTarget = m_PPet->PMaster->PBattleAI->GetBattleTarget();
		}
		if(WyvernIsHealing()){
			m_PPathFind->LookAt(m_PPet->PMaster->loc.p);

			m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CEntityUpdatePacket(m_PPet, ENTITY_UPDATE));
			if(m_PPet->PMaster->objtype == TYPE_PC){
				((CCharEntity*)m_PPet->PMaster)->pushPacket(new CPetSyncPacket((CCharEntity*)m_PPet->PMaster));
			}
			return;
		}
	}

	if(m_PBattleTarget!=NULL){
		m_ActionType = ACTION_ENGAGE;
		ActionEngage();
		return;
	}

	float currentDistance = distance(m_PPet->loc.p, m_PPet->PMaster->loc.p);

	if (currentDistance > PET_ROAM_DISTANCE)
	{
		if(currentDistance < 35.0f && m_PPathFind->PathAround(m_PPet->PMaster->loc.p, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK))
		{
			m_PPathFind->FollowPath();
		}
		else
		{
			m_PPathFind->WarpTo(m_PPet->PMaster->loc.p, PET_ROAM_DISTANCE);
		}

        m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CEntityUpdatePacket(m_PPet, ENTITY_UPDATE));
	}
}