56 TC_LOG_INFO(
"server.loading",
">> Loaded 0 waypoint paths. DB table `waypoint_path` is empty!");
66 }
while (result->NextRow());
83 TC_LOG_INFO(
"server.loading",
">> Loaded 0 waypoint path nodes. DB table `waypoint_path_node` is empty!");
94 while (result->NextRow());
101 uint32 pathId = fields.PathId().GetUInt32();
114 path.
Velocity = fields.Velocity().GetFloatOrNull();
118 TC_LOG_ERROR(
"sql.sql",
"PathId {} in `waypoint_path` has invalid velocity {}, using default velocity instead", pathId, *path.
Velocity);
127 uint32 pathId = fields.PathId().GetUInt32();
132 TC_LOG_ERROR(
"sql.sql",
"PathId {} in `waypoint_path_node` does not exist in `waypoint_path`, ignoring", pathId);
136 float x = fields.PositionX().GetFloat();
137 float y = fields.PositionY().GetFloat();
138 float z = fields.PositionZ().GetFloat();
142 if (
uint32 delayMs = fields.Delay().GetUInt32())
143 delay.emplace(delayMs);
148 path->
Nodes.emplace_back(fields.NodeId().GetUInt32(), x, y, z, o, delay);
155 pathInfo.BuildSegments();
157 if (pathInfo.Nodes.empty())
158 TC_LOG_ERROR(
"sql.sql",
"PathId {} in `waypoint_path` has no assigned nodes in `waypoint_path_node`", pathInfo.Id);
183 TC_LOG_ERROR(
"sql.sql",
"PathId {} in `waypoint_path` not found, ignoring", pathId);
190 }
while (result->NextRow());
203 TC_LOG_ERROR(
"sql.sql",
"PathId {} in `waypoint_path_node` not found, ignoring", pathId);
210 }
while (result->NextRow());
213 path->BuildSegments();
221 std::pair<uint32, uint32> pathNodePair(path->
Id, node.Id);
246 std::pair<uint32, uint32> pathNodePair(path->
Id, node.Id);
309 if (node.Id == nodeId)
330 return itr->second.first;
339 return itr->second.second;
354 for (std::size_t i = 0; i <
Nodes.size(); ++i)
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_INFO(filterType__, message__,...)
std::optional< T > Optional
Optional helper class to wrap optional values within.
#define DEFINE_FIELD_ACCESSOR_CACHE(namespace_name, struct_name, result_type, fields_list)
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
static constexpr std::size_t WAYPOINT_PATH_FLAG_FOLLOW_PATH_BACKWARDS_MINIMUM_NODES
@ FollowPathBackwardsFromEndToStart
@ WORLD_SEL_WAYPOINT_PATH_NODE
@ WORLD_DEL_WAYPOINT_PATH_NODE
@ WORLD_UPD_WAYPOINT_PATH_NODE
@ WORLD_UPD_WAYPOINT_PATH_NODE_POSITION
@ WORLD_SEL_WAYPOINT_PATH
ObjectGuid const & GetGUID() const
void SetObjectScale(float scale) override
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetDisplayId(uint32 displayId, bool setNative=false) override
static ObjectGuid const Empty
void setUInt32(uint8 index, uint32 value)
void setFloat(uint8 index, float value)
void DoPostLoadingChecks()
void DeleteNode(WaypointPath const *path, WaypointNode const *node)
void LoadPathNodesFromDB(PathNodeQueryResult const &fields)
std::unordered_map< std::pair< uint32, uint32 >, ObjectGuid > _nodeToVisualWaypointGUIDsMap
std::unordered_map< ObjectGuid, std::pair< WaypointPath const *, WaypointNode const * > > _visualWaypointGUIDToNodeMap
WaypointNode const * GetNodeByVisualGUID(ObjectGuid guid) const
WaypointPath const * GetPathByVisualGUID(ObjectGuid guid) const
std::unordered_map< uint32, WaypointPath > _pathStore
void MoveNode(WaypointPath const *path, WaypointNode const *node, Position const &pos)
WaypointNode const * GetNode(WaypointPath const *path, uint32 nodeId) const
static WaypointMgr * instance()
void ReloadPath(uint32 pathId)
WaypointPath const * GetPath(uint32 pathId) const
void VisualizePath(Unit *owner, WaypointPath const *path, Optional< uint32 > displayId)
void LoadPathFromDB(PathQueryResult const &fields)
ObjectGuid const & GetVisualGUIDByNode(uint32 pathId, uint32 nodeId) const
void DevisualizePath(Unit *owner, WaypointPath const *path)
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
auto MapGetValuePtr(M &map, typename M::key_type const &key)
void NormalizeMapCoord(float &c)
constexpr float GetPositionX() const
constexpr float GetPositionY() const
constexpr float GetOrientation() const
constexpr float GetPositionZ() const
std::vector< std::pair< std::size_t, std::size_t > > ContinuousSegments
std::vector< WaypointNode > Nodes
EnumFlag< WaypointPathFlags > Flags
Optional< float > Velocity
WaypointMoveType MoveType