diff options
author | kaelima <kaelima@live.se> | 2011-10-15 18:38:27 +0200 |
---|---|---|
committer | kaelima <kaelima@live.se> | 2011-10-15 18:38:27 +0200 |
commit | 97e5140a1d442608902524e64828ac3a355b062a (patch) | |
tree | a4fab6498fe095ccedb76dc5ea50bfb2fe65ccff /src | |
parent | 83a3da2630a1f51fafef3fa6c9bdb609ccb55649 (diff) |
Core/WaypointMgr: Allow to set orientation to waypoints.
- Instead of the need to use a waypoint_script to change orientation on waypoint arrival.
Diffstat (limited to 'src')
4 files changed, 27 insertions, 17 deletions
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 99deef200a6..808d8318ea9 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -206,7 +206,13 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 diff) MovementInform(unit); unit.UpdateWaypointID(i_currentNode); unit.ClearUnitState(UNIT_STAT_ROAMING); - unit.Relocate(node->x, node->y, node->z); + if (node->orientation) + { + unit.Relocate(node->x, node->y, node->z, node->orientation); + unit.SetFacing(node->orientation, NULL); + } + else + unit.Relocate(node->x, node->y, node->z); } } else diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 0ce2a097422..2859fb9227b 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -43,7 +43,7 @@ void WaypointMgr::Load() { uint32 oldMSTime = getMSTime(); - QueryResult result = WorldDatabase.Query("SELECT id, point, position_x, position_y, position_z, move_flag, delay, action, action_chance FROM waypoint_data ORDER BY id, point"); + QueryResult result = WorldDatabase.Query("SELECT id, point, position_x, position_y, position_z, orientation, move_flag, delay, action, action_chance FROM waypoint_data ORDER BY id, point"); if (!result) { @@ -65,6 +65,7 @@ void WaypointMgr::Load() float x = fields[2].GetFloat(); float y = fields[3].GetFloat(); float z = fields[4].GetFloat(); + float o = fields[5].GetFloat(); Trinity::NormalizeMapCoord(x); Trinity::NormalizeMapCoord(y); @@ -73,10 +74,11 @@ void WaypointMgr::Load() wp->x = x; wp->y = y; wp->z = z; - wp->run = fields[5].GetBool(); - wp->delay = fields[6].GetUInt32(); - wp->event_id = fields[7].GetUInt32(); - wp->event_chance = fields[8].GetUInt8(); + wp->orientation = o; + wp->run = fields[6].GetBool(); + wp->delay = fields[7].GetUInt32(); + wp->event_id = fields[8].GetUInt32(); + wp->event_chance = fields[9].GetUInt8(); path.push_back(wp); ++count; @@ -98,7 +100,7 @@ void WaypointMgr::ReloadPath(uint32 id) _waypointStore.erase(itr); } - QueryResult result = WorldDatabase.PQuery("SELECT point, position_x, position_y, position_z, move_flag, delay, action, action_chance FROM waypoint_data WHERE id = %u ORDER BY point", id); + QueryResult result = WorldDatabase.PQuery("SELECT point, position_x, position_y, position_z, orientation, move_flag, delay, action, action_chance FROM waypoint_data WHERE id = %u ORDER BY point", id); if (!result) return; @@ -112,6 +114,7 @@ void WaypointMgr::ReloadPath(uint32 id) float x = fields[1].GetFloat(); float y = fields[2].GetFloat(); float z = fields[3].GetFloat(); + float o = fields[4].GetFloat(); Trinity::NormalizeMapCoord(x); Trinity::NormalizeMapCoord(y); @@ -120,10 +123,11 @@ void WaypointMgr::ReloadPath(uint32 id) wp->x = x; wp->y = y; wp->z = z; - wp->run = fields[4].GetBool(); - wp->delay = fields[5].GetUInt32(); - wp->event_id = fields[6].GetUInt32(); - wp->event_chance = fields[7].GetUInt8(); + wp->orientation = o; + wp->run = fields[5].GetBool(); + wp->delay = fields[6].GetUInt32(); + wp->event_id = fields[7].GetUInt32(); + wp->event_chance = fields[8].GetUInt8(); path.push_back(wp); diff --git a/src/server/game/Movement/Waypoints/WaypointManager.h b/src/server/game/Movement/Waypoints/WaypointManager.h index 4b374984232..be4a0c8f9bf 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.h +++ b/src/server/game/Movement/Waypoints/WaypointManager.h @@ -26,7 +26,7 @@ struct WaypointData { uint32 id; - float x, y, z; + float x, y, z, orientation; bool run; uint32 delay; uint32 event_id; diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 75904764f23..c3bfe1a05b9 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -858,7 +858,7 @@ public: else Maxpoint = 0; - result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z FROM waypoint_data WHERE point ='%u' AND id = '%u'", Maxpoint, pathid); + result = WorldDatabase.PQuery("SELECT position_x, position_y, position_z, orientation FROM waypoint_data WHERE point ='%u' AND id = '%u'", Maxpoint, pathid); if (!result) { handler->PSendSysMessage(LANG_WAYPOINT_NOTFOUNDLAST, pathid); @@ -866,13 +866,13 @@ public: return false; } Field* fields = result->Fetch(); - float x = fields[0].GetFloat(); - float y = fields[1].GetFloat(); - float z = fields[2].GetFloat(); + float x = fields[0].GetFloat(); + float y = fields[1].GetFloat(); + float z = fields[2].GetFloat(); + float o = fields[3].GetFloat(); uint32 id = VISUAL_WAYPOINT; Player* chr = handler->GetSession()->GetPlayer(); - float o = chr->GetOrientation(); Map* map = chr->GetMap(); Creature* creature = new Creature; |