bool CPathFind::RoamAround(position_t point, uint8 roamFlags) { Clear(); m_roamFlags = roamFlags; if (isNavMeshEnabled()) { // all mobs will default to this distance float maxRadius = 25.0f; // sight aggro mobs will move a bit farther // this is until this data is put in the database if (m_roamFlags & ROAMFLAG_MEDIUM) { maxRadius = 35.0f; } // TODO: finish roam flags. distance should have a distance limit if (FindRandomPath(&point, maxRadius)) { return true; } else { Clear(); return false; } } else { // no point worm roaming cause it'll move one inch if (m_roamFlags & ROAMFLAG_WORM) { Clear(); return false; } // ew, we gotta use the old way m_pathLength = 1; m_points[0].x = point.x - 1 + rand() % 2; m_points[0].y = point.y; m_points[0].z = point.z - 1 + rand() % 2; } return true; }
bool CPathFind::RoamAround(position_t point, float maxRadius, uint8 maxTurns, uint8 roamFlags) { Clear(); m_roamFlags = roamFlags; if (isNavMeshEnabled()) { if (FindRandomPath(&point, maxRadius, maxTurns, roamFlags)) { return true; } else { Clear(); return false; } } else { // no point worm roaming cause it'll move one inch if (m_roamFlags & ROAMFLAG_WORM) { Clear(); return false; } // ew, we gotta use the old way m_pathLength = 1; m_points[0].x = point.x - 1 + rand() % 2; m_points[0].y = point.y; m_points[0].z = point.z - 1 + rand() % 2; } return true; }