Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Core/Movement: updated smartAI waypoint support to use the new smooth…
Browse files Browse the repository at this point in the history
… transition field as well
  • Loading branch information
Ovahlord committed Jul 16, 2021
1 parent 64a2487 commit b236bd3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions sql/updates/world/4.3.4/2021_07_16_00_world.sql
Original file line number Diff line number Diff line change
@@ -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`;
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down

0 comments on commit b236bd3

Please sign in to comment.