From b236bd39df6710783f64c6c6339b7ca4e4cf98a2 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Fri, 16 Jul 2021 16:56:35 +0200 Subject: [PATCH] Core/Movement: updated smartAI waypoint support to use the new smooth transition field as well --- sql/updates/world/4.3.4/2021_07_16_00_world.sql | 8 ++++++++ .../database/Database/Implementation/WorldDatabase.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/4.3.4/2021_07_16_00_world.sql diff --git a/sql/updates/world/4.3.4/2021_07_16_00_world.sql b/sql/updates/world/4.3.4/2021_07_16_00_world.sql new file mode 100644 index 00000000000..31bd9c52e7a --- /dev/null +++ b/sql/updates/world/4.3.4/2021_07_16_00_world.sql @@ -0,0 +1,8 @@ +ALTER TABLE `waypoints` +ADD COLUMN `smoothTransition` tinyint UNSIGNED NOT NULL DEFAULT 0 AFTER `delay`; + +UPDATE `waypoints` SET `smoothTransition`= 1 WHERE `delay` < 0; +UPDATE `waypoints` SET `delay`= 0 WHERE `delay` < 0; + +ALTER TABLE `waypoints` +MODIFY COLUMN `delay` int UNSIGNED NOT NULL DEFAULT 0 AFTER `velocity`; diff --git a/src/server/database/Database/Implementation/WorldDatabase.cpp b/src/server/database/Database/Implementation/WorldDatabase.cpp index 87f86c1efd4..9365d763058 100644 --- a/src/server/database/Database/Implementation/WorldDatabase.cpp +++ b/src/server/database/Database/Implementation/WorldDatabase.cpp @@ -27,7 +27,7 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_REP_CREATURE_LINKED_RESPAWN, "REPLACE INTO linked_respawn (guid, linkedGuid) VALUES (?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT CreatureID, GroupID, ID, Text, Type, Language, Probability, Emote, Duration, Sound, SoundType, BroadcastTextId, TextRange FROM creature_text", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_SMART_SCRIPTS, "SELECT entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, event_param5, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o FROM smart_scripts ORDER BY entryorguid, source_type, id, link", CONNECTION_SYNCH); - PrepareStatement(WORLD_SEL_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z, orientation, velocity, delay FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH); + PrepareStatement(WORLD_SEL_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z, orientation, velocity, delay, smoothTransition FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH); PrepareStatement(WORLD_DEL_GAMEOBJECT, "DELETE FROM gameobject WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_EVENT_GAMEOBJECT, "DELETE FROM game_event_gameobject WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_INS_GRAVEYARD_ZONE, "INSERT INTO graveyard_zone (ID, GhostZone, Faction) VALUES (?, ?, ?)", CONNECTION_ASYNC); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 5e74f36f442..54091af37ca 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -74,7 +74,8 @@ void SmartWaypointMgr::LoadFromDB() o = fields[5].GetFloat(); float velocity = fields[6].GetFloat(); - int32 delay = fields[7].GetInt32(); + uint32 delay = fields[7].GetUInt32(); + bool smoothTransition = fields[8].GetBool(); if (lastEntry != entry) { @@ -89,7 +90,7 @@ void SmartWaypointMgr::LoadFromDB() WaypointPath& path = _waypointStore[entry]; path.Id = entry; - path.Nodes.emplace_back(id, x, y, z, o, velocity, delay); + path.Nodes.emplace_back(id, x, y, z, o, velocity, delay, smoothTransition); lastEntry = entry; ++total;