Scripts/Commands: update .wp commands to use orientation field from DB
Port From (https://github.com/TrinityCore/TrinityCore/commit/61cc88731c8941289352a1aaa6410bc3dce83faa)
This commit is contained in:
@@ -44,16 +44,16 @@ namespace Framework.Database
|
||||
PrepareStatement(WorldStatements.UPD_CREATURE_SPAWN_DISTANCE, "UPDATE creature SET spawndist = ?, MovementType = ? WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.UPD_CREATURE_SPAWN_TIME_SECS, "UPDATE creature SET spawntimesecs = ? WHERE guid = ?");
|
||||
PrepareStatement(WorldStatements.INS_CREATURE_FORMATION, "INSERT INTO creature_formations (leaderGUID, memberGUID, dist, angle, groupAI) VALUES (?, ?, ?, ?, ?)");
|
||||
PrepareStatement(WorldStatements.INS_WAYPOINT_DATA, "INSERT INTO waypoint_data (id, point, position_x, position_y, position_z) VALUES (?, ?, ?, ?, ?)");
|
||||
PrepareStatement(WorldStatements.INS_WAYPOINT_DATA, "INSERT INTO waypoint_data (id, point, position_x, position_y, position_z, orientation) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
PrepareStatement(WorldStatements.DEL_WAYPOINT_DATA, "DELETE FROM waypoint_data WHERE id = ? AND point = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_DATA_POINT, "UPDATE waypoint_data SET point = point - 1 WHERE id = ? AND point > ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_DATA_POSITION, "UPDATE waypoint_data SET position_x = ?, position_y = ?, position_z = ? where id = ? AND point = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_DATA_POSITION, "UPDATE waypoint_data SET position_x = ?, position_y = ?, position_z = ?, orientation = ? where id = ? AND point = ?");
|
||||
PrepareStatement(WorldStatements.UPD_WAYPOINT_DATA_WPGUID, "UPDATE waypoint_data SET wpguid = ? WHERE id = ? and point = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_MAX_ID, "SELECT MAX(id) FROM waypoint_data");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_MAX_POINT, "SELECT MAX(point) FROM waypoint_data WHERE id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_ID, "SELECT point, position_x, position_y, position_z, orientation, move_type, delay, action, action_chance FROM waypoint_data WHERE id = ? ORDER BY point");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_BY_ID, "SELECT point, position_x, position_y, position_z FROM waypoint_data WHERE id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_FIRST_BY_ID, "SELECT position_x, position_y, position_z FROM waypoint_data WHERE point = 1 AND id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_BY_ID, "SELECT point, position_x, position_y, position_z, orientation FROM waypoint_data WHERE id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_FIRST_BY_ID, "SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE point = 1 AND id = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_POS_LAST_BY_ID, "SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE id = ? ORDER BY point DESC LIMIT 1");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_BY_WPGUID, "SELECT id, point FROM waypoint_data WHERE wpguid = ?");
|
||||
PrepareStatement(WorldStatements.SEL_WAYPOINT_DATA_ALL_BY_WPGUID, "SELECT id, point, delay, move_type, action, action_chance FROM waypoint_data WHERE wpguid = ?");
|
||||
|
||||
@@ -1114,7 +1114,7 @@ namespace Game.Chat
|
||||
{
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
|
||||
Log.outInfo(LogFilter.SqlDev, "(@PATH, XX, {0}, {1}, {2}, 0, 0, 0, 100, 0),", player.GetPositionX(), player.GetPositionY(), player.GetPositionZ());
|
||||
Log.outInfo(LogFilter.SqlDev, $"(@PATH, XX, {player.GetPositionX():3F}, {player.GetPositionY():3F}, {player.GetPositionZ():5F}, {player.GetOrientation():5F}, 0, 0, 0, 100, 0)");
|
||||
|
||||
handler.SendSysMessage("Waypoint SQL written to SQL Developer log");
|
||||
return true;
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace Game.Chat.Commands
|
||||
stmt.AddValue(2, player.GetPositionX());
|
||||
stmt.AddValue(3, player.GetPositionY());
|
||||
stmt.AddValue(4, player.GetPositionZ());
|
||||
stmt.AddValue(5, player.GetOrientation());
|
||||
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
@@ -579,8 +580,9 @@ namespace Game.Chat.Commands
|
||||
stmt.AddValue(0, chr.GetPositionX());
|
||||
stmt.AddValue(1, chr.GetPositionY());
|
||||
stmt.AddValue(2, chr.GetPositionZ());
|
||||
stmt.AddValue(3, pathid);
|
||||
stmt.AddValue(4, point);
|
||||
stmt.AddValue(3, chr.GetOrientation());
|
||||
stmt.AddValue(4, pathid);
|
||||
stmt.AddValue(5, point);
|
||||
DB.World.Execute(stmt);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.WaypointChanged);
|
||||
@@ -753,14 +755,14 @@ namespace Game.Chat.Commands
|
||||
float x = result.Read<float>(1);
|
||||
float y = result.Read<float>(2);
|
||||
float z = result.Read<float>(3);
|
||||
float o = result.Read<float>(4);
|
||||
|
||||
uint id = 1;
|
||||
|
||||
Player chr = handler.GetSession().GetPlayer();
|
||||
Map map = chr.GetMap();
|
||||
Position pos = new(x, y, z, chr.GetOrientation());
|
||||
|
||||
Creature creature = Creature.CreateCreature(id, map, pos);
|
||||
Creature creature = Creature.CreateCreature(id, map, new Position(x, y, z, o));
|
||||
if (!creature)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, id);
|
||||
@@ -821,12 +823,12 @@ namespace Game.Chat.Commands
|
||||
float x = result.Read<float>(0);
|
||||
float y = result.Read<float>(1);
|
||||
float z = result.Read<float>(2);
|
||||
float o = result.Read<float>(3);
|
||||
|
||||
Player chr = handler.GetSession().GetPlayer();
|
||||
Map map = chr.GetMap();
|
||||
Position pos = new(x, y, z, chr.GetOrientation());
|
||||
|
||||
Creature creature = Creature.CreateCreature(1, map, pos);
|
||||
Creature creature = Creature.CreateCreature(1, map, new Position(x, y, z, 0));
|
||||
if (!creature)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WaypointVpNotcreated, 1);
|
||||
|
||||
Reference in New Issue
Block a user