diff options
Diffstat (limited to 'src')
3 files changed, 18 insertions, 4 deletions
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 4676ebb8141..afbaae40562 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -417,6 +417,9 @@ void WaypointMovementGenerator<Creature>::StartMove(Creature* owner, bool relaun break; } + if (GetPath()->Velocity && !_speed) + _speed = GetPath()->Velocity; + if (_speed) init.SetVelocity(*_speed); diff --git a/src/server/game/Movement/Waypoints/WaypointDefines.h b/src/server/game/Movement/Waypoints/WaypointDefines.h index af47ccfd0db..ebd31ea3da7 100644 --- a/src/server/game/Movement/Waypoints/WaypointDefines.h +++ b/src/server/game/Movement/Waypoints/WaypointDefines.h @@ -81,6 +81,7 @@ struct WaypointPath uint32 Id = 0; WaypointMoveType MoveType = WaypointMoveType::Walk; EnumFlag<WaypointPathFlags> Flags = WaypointPathFlags::None; + Optional<float> Velocity; }; #endif diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index eec635bf6d1..dd21721a66c 100644 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -38,8 +38,8 @@ void WaypointMgr::_LoadPaths() _pathStore.clear(); - // 0 1 2 - QueryResult result = WorldDatabase.Query("SELECT PathId, MoveType, Flags FROM waypoint_path"); + // 0 1 2 3 + QueryResult result = WorldDatabase.Query("SELECT PathId, MoveType, Flags, Velocity FROM waypoint_path"); if (!result) { @@ -88,15 +88,25 @@ void WaypointMgr::LoadPathFromDB(Field* fields) uint32 pathId = fields[0].GetUInt32(); WaypointPath& path = _pathStore[pathId]; - path.Id = pathId; - path.MoveType = WaypointMoveType(fields[1].GetUInt8()); + path.MoveType = WaypointMoveType(fields[1].GetUInt8());; if (path.MoveType >= WaypointMoveType::Max) { TC_LOG_ERROR("sql.sql", "PathId {} in `waypoint_path` has invalid MoveType {}, ignoring", pathId, AsUnderlyingType(path.MoveType)); return; } + + path.Id = pathId; path.Flags = WaypointPathFlags(fields[2].GetUInt8()); + + if (!fields[3].IsNull()) + { + if (fields[3].GetFloat() > 0.0f) + path.Velocity = fields[3].GetFloat(); + else + TC_LOG_ERROR("sql.sql", "PathId {} in `waypoint_path` has invalid velocity {}, using default velocity instead", pathId, fields[3].GetFloat()); + } + path.Nodes.clear(); } |
