aboutsummaryrefslogtreecommitdiff
path: root/src/server/database/Database
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2025-06-25 12:16:03 +0200
committerShauren <shauren.trinity@gmail.com>2025-06-25 12:16:03 +0200
commite284dc0a8025c5e4da65271914c88d9afac95667 (patch)
tree225f9bd64fd7a6d37b2e3a5b02c7a088da998456 /src/server/database/Database
parent53f71a9838adf466783bde5240434961bf82f8ce (diff)
Core/Commands: Waypoint command fixes
* .wp add will now add data to waypoint_path table * .wp reload will no longer crash the server * Replace deprecated command handler arguments
Diffstat (limited to 'src/server/database/Database')
-rw-r--r--src/server/database/Database/Implementation/WorldDatabase.cpp5
-rw-r--r--src/server/database/Database/Implementation/WorldDatabase.h5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/server/database/Database/Implementation/WorldDatabase.cpp b/src/server/database/Database/Implementation/WorldDatabase.cpp
index 9ddb30f8a8c..d26903117d4 100644
--- a/src/server/database/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/database/Database/Implementation/WorldDatabase.cpp
@@ -44,14 +44,15 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_UPD_CREATURE_WANDER_DISTANCE, "UPDATE creature SET wander_distance = ?, MovementType = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_UPD_CREATURE_SPAWN_TIME_SECS, "UPDATE creature SET spawntimesecs = ? WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_INS_CREATURE_FORMATION, "INSERT INTO creature_formations (leaderGUID, memberGUID, dist, angle, groupAI) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
- PrepareStatement(WORLD_SEL_WAYPOINT_PATH_BY_PATHID, "SELECT PathId, MoveType, Flags FROM waypoint_path WHERE PathId = ?", CONNECTION_SYNCH);
+ PrepareStatement(WORLD_SEL_WAYPOINT_PATH, "SELECT PathId, MoveType, Flags, Velocity FROM waypoint_path WHERE PathId = ? OR 1 = ?", CONNECTION_SYNCH);
+ PrepareStatement(WORLD_INS_WAYPOINT_PATH, "INSERT INTO waypoint_path (PathId, MoveType, Flags, Velocity, Comment) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(WORLD_INS_WAYPOINT_PATH_NODE, "INSERT INTO waypoint_path_node (PathId, NodeId, PositionX, PositionY, PositionZ, Orientation) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(WORLD_SEL_WAYPOINT_PATH_NODE, "SELECT PathId, NodeId, PositionX, PositionY, PositionZ, Orientation, Delay FROM waypoint_path_node WHERE PathId = ? OR 1 = ? ORDER BY NodeId", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_WAYPOINT_PATH_NODE, "DELETE FROM waypoint_path_node WHERE PathId = ? AND NodeId = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_UPD_WAYPOINT_PATH_NODE, "UPDATE waypoint_path_node SET NodeId = NodeId - 1 WHERE PathId = ? AND NodeId > ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_UPD_WAYPOINT_PATH_NODE_POSITION, "UPDATE waypoint_path_node SET PositionX = ?, PositionY = ?, PositionZ = ?, Orientation = ? WHERE PathId = ? AND NodeId = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_SEL_WAYPOINT_PATH_NODE_MAX_PATHID, "SELECT MAX(PathId) FROM waypoint_path_node", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_PATH_NODE_MAX_NODEID, "SELECT MAX(NodeId) FROM waypoint_path_node WHERE PathId = ?", CONNECTION_SYNCH);
- PrepareStatement(WORLD_SEL_WAYPOINT_PATH_NODE_BY_PATHID, "SELECT PathId, NodeId, PositionX, PositionY, PositionZ, Orientation, Delay FROM waypoint_path_node WHERE PathId = ? ORDER BY NodeId", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_PATH_NODE_POS_BY_PATHID, "SELECT NodeId, PositionX, PositionY, PositionZ, Orientation FROM waypoint_path_node WHERE PathId = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_PATH_NODE_POS_FIRST_BY_PATHID, "SELECT PositionX, PositionY, PositionZ, Orientation FROM waypoint_path_node WHERE NodeId = 1 AND PathId = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_PATH_NODE_POS_LAST_BY_PATHID, "SELECT PositionX, PositionY, PositionZ, Orientation FROM waypoint_path_node WHERE PathId = ? ORDER BY NodeId DESC LIMIT 1", CONNECTION_SYNCH);
diff --git a/src/server/database/Database/Implementation/WorldDatabase.h b/src/server/database/Database/Implementation/WorldDatabase.h
index d24be6862b1..4bc54d47d5f 100644
--- a/src/server/database/Database/Implementation/WorldDatabase.h
+++ b/src/server/database/Database/Implementation/WorldDatabase.h
@@ -49,13 +49,14 @@ enum WorldDatabaseStatements : uint32
WORLD_UPD_CREATURE_WANDER_DISTANCE,
WORLD_UPD_CREATURE_SPAWN_TIME_SECS,
WORLD_INS_CREATURE_FORMATION,
- WORLD_SEL_WAYPOINT_PATH_BY_PATHID,
+ WORLD_SEL_WAYPOINT_PATH,
+ WORLD_INS_WAYPOINT_PATH,
+ WORLD_SEL_WAYPOINT_PATH_NODE,
WORLD_INS_WAYPOINT_PATH_NODE,
WORLD_DEL_WAYPOINT_PATH_NODE,
WORLD_UPD_WAYPOINT_PATH_NODE,
WORLD_UPD_WAYPOINT_PATH_NODE_POSITION,
WORLD_SEL_WAYPOINT_PATH_NODE_MAX_PATHID,
- WORLD_SEL_WAYPOINT_PATH_NODE_BY_PATHID,
WORLD_SEL_WAYPOINT_PATH_NODE_POS_BY_PATHID,
WORLD_SEL_WAYPOINT_PATH_NODE_POS_FIRST_BY_PATHID,
WORLD_SEL_WAYPOINT_PATH_NODE_POS_LAST_BY_PATHID,