void MotionMaster::MoveTargetedHome() { //if (i_owner->hasUnitState(UNIT_STAT_FLEEING)) // return; Clear(false); if (Unit *target = i_owner->GetCharmerOrOwner()) { DEBUG_LOG("Pet or controlled unit (Entry: %u GUID: %u) targeting home", i_owner->GetEntry(), i_owner->GetGUIDLow()); MoveFollow(i_owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE, MOTION_SLOT_IDLE); } else if (i_owner->GetTypeId() == TYPEID_UNIT) { DEBUG_LOG("Creature (Entry: %u GUID: %u) targeted home", i_owner->GetEntry(), i_owner->GetGUIDLow()); Mutate(new HomeMovementGenerator<Creature>(), MOTION_SLOT_ACTIVE); } else { sLog.outError("Player (GUID: %u) attempt targeted home", i_owner->GetGUIDLow()); } }
void MotionMaster::MoveTargetedHome() { // if (m_owner->hasUnitState(UNIT_STAT_LOST_CONTROL)) // return; if (m_owner->GetTypeId() == TYPEID_UNIT && !((Creature*)m_owner)->GetCharmerOrOwnerGuid()) { // Manual exception for linked mobs if (m_owner->IsLinkingEventTrigger() && m_owner->GetMap()->GetCreatureLinkingHolder()->TryFollowMaster((Creature*)m_owner)) DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "MotionMaster: %s refollowed linked master", m_owner->GetGuidStr().c_str()); else { DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "MotionMaster: %s targeted home", m_owner->GetGuidStr().c_str()); Mutate(new HomeMovementGenerator<Creature>(), UNIT_ACTION_HOME); } } else if (m_owner->GetTypeId() == TYPEID_UNIT && ((Creature*)m_owner)->GetCharmerOrOwnerGuid()) { if (Unit* target = ((Creature*)m_owner)->GetCharmerOrOwner()) { float angle = ((Creature*)m_owner)->IsPet() ? ((Pet*)m_owner)->GetPetFollowAngle() : PET_FOLLOW_ANGLE; DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "MotionMaster: %s follow to %s", m_owner->GetGuidStr().c_str(), target->GetGuidStr().c_str()); switch (((Creature*)m_owner)->GetCharmState(CHARM_STATE_COMMAND)) { case COMMAND_STAY: MoveIdle(); break; case COMMAND_FOLLOW: case COMMAND_ATTACK: default: MoveFollow(target, PET_FOLLOW_DIST, angle); break; } } else DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s attempt but fail to follow owner", m_owner->GetGuidStr().c_str()); } else sLog.outError("MotionMaster: %s attempt targeted home", m_owner->GetGuidStr().c_str()); }