Core/WaypointMgr: Allow to set orientation to waypoints.
- Instead of the need to use a waypoint_script to change orientation on waypoint arrival.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
struct WaypointData
|
||||
{
|
||||
uint32 id;
|
||||
float x, y, z;
|
||||
float x, y, z, orientation;
|
||||
bool run;
|
||||
uint32 delay;
|
||||
uint32 event_id;
|
||||
|
||||
Reference in New Issue
Block a user