diff options
author | Carbenium <carbenium@outlook.com> | 2020-07-25 21:47:10 +0200 |
---|---|---|
committer | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-07-25 23:45:01 +0200 |
commit | 4b9fdc5d3d1278269aaf218cea94f23688e4bca1 (patch) | |
tree | 9b45b60e0ce5ce915a080584125fdea5449f0fc1 /src | |
parent | f5076112cb25bff877a450a14fe20172e9044081 (diff) |
Core/EscortAI: std::chrono-ify AddWaypoint
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 4 | ||||
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedEscortAI.h | 2 | ||||
-rw-r--r-- | src/server/scripts/Kalimdor/zone_moonglade.cpp | 95 |
3 files changed, 55 insertions, 46 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index bd47759817b..1775549d4dc 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -254,7 +254,7 @@ void EscortAI::UpdateEscortAI(uint32 /*diff*/) DoMeleeAttackIfReady(); } -void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientation/* = 0*/, uint32 waitTime/* = 0*/) +void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientation/* = 0*/, Milliseconds waitTime/* = 0s*/) { Trinity::NormalizeMapCoord(x); Trinity::NormalizeMapCoord(y); @@ -266,7 +266,7 @@ void EscortAI::AddWaypoint(uint32 id, float x, float y, float z, float orientati waypoint.z = z; waypoint.orientation = orientation; waypoint.moveType = _running ? WAYPOINT_MOVE_TYPE_RUN : WAYPOINT_MOVE_TYPE_WALK; - waypoint.delay = waitTime; + waypoint.delay = waitTime.count(); waypoint.eventId = 0; waypoint.eventChance = 100; _path.nodes.push_back(std::move(waypoint)); diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 9ac6101e5b7..ef0a3ec47f5 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -48,7 +48,7 @@ struct TC_GAME_API EscortAI : public ScriptedAI void UpdateAI(uint32 diff) override; // the "internal" update, calls UpdateEscortAI() virtual void UpdateEscortAI(uint32 diff); // used when it's needed to add code in update (abilities, scripted events, etc) - void AddWaypoint(uint32 id, float x, float y, float z, float orientation = 0.f, uint32 waitTime = 0); // waitTime is in ms + void AddWaypoint(uint32 id, float x, float y, float z, float orientation = 0.f, Milliseconds waitTime = 0s); void Start(bool isActiveAttacker = true, bool run = false, ObjectGuid playerGUID = ObjectGuid::Empty, Quest const* quest = nullptr, bool instantRespawn = false, bool canLoopPath = false, bool resetWaypoints = true); void SetRun(bool on = true); diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp index 917ec766501..cf12a9b0ab7 100644 --- a/src/server/scripts/Kalimdor/zone_moonglade.cpp +++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp @@ -43,50 +43,59 @@ EndContentData */ ## npc_clintar_spirit ######*/ -float const Clintar_spirit_WP[41][5] = +struct Waypoint +{ + float X; + float Y; + float Z; + float O; + Milliseconds waitTime; +}; + +Waypoint const Clintar_spirit_WP[41] = { //pos_x pos_y pos_z orien waitTime - {7465.28f, -3115.46f, 439.327f, 0.83f, 4000}, - {7476.49f, -3101, 443.457f, 0.89f, 0}, - {7486.57f, -3085.59f, 439.478f, 1.07f, 0}, - {7472.19f, -3085.06f, 443.142f, 3.07f, 0}, - {7456.92f, -3085.91f, 438.862f, 3.24f, 0}, - {7446.68f, -3083.43f, 438.245f, 2.40f, 0}, - {7446.17f, -3080.21f, 439.826f, 1.10f, 6000}, - {7452.41f, -3085.8f, 438.984f, 5.78f, 0}, - {7469.11f, -3084.94f, 443.048f, 6.25f, 0}, - {7483.79f, -3085.44f, 439.607f, 6.25f, 0}, - {7491.14f, -3090.96f, 439.983f, 5.44f, 0}, - {7497.62f, -3098.22f, 436.854f, 5.44f, 0}, - {7498.72f, -3113.41f, 434.596f, 4.84f, 0}, - {7500.06f, -3122.51f, 434.749f, 5.17f, 0}, - {7504.96f, -3131.53f, 434.475f, 4.74f, 0}, - {7504.31f, -3133.53f, 435.693f, 3.84f, 6000}, - {7504.55f, -3133.27f, 435.476f, 0.68f, 15000}, - {7501.99f, -3126.01f, 434.93f, 1.83f, 0}, - {7490.76f, -3114.97f, 434.431f, 2.51f, 0}, - {7479.64f, -3105.51f, 431.123f, 1.83f, 0}, - {7474.63f, -3086.59f, 428.994f, 1.83f, 2000}, - {7472.96f, -3074.18f, 427.566f, 1.57f, 0}, - {7472.25f, -3063, 428.268f, 1.55f, 0}, - {7473.46f, -3054.22f, 427.588f, 0.36f, 0}, - {7475.08f, -3053.6f, 428.653f, 0.36f, 6000}, - {7474.66f, -3053.56f, 428.433f, 3.19f, 4000}, - {7471.81f, -3058.84f, 427.073f, 4.29f, 0}, - {7472.16f, -3064.91f, 427.772f, 4.95f, 0}, - {7471.56f, -3085.36f, 428.924f, 4.72f, 0}, - {7473.56f, -3093.48f, 429.294f, 5.04f, 0}, - {7478.94f, -3104.29f, 430.638f, 5.23f, 0}, - {7484.46f, -3109.61f, 432.769f, 5.79f, 0}, - {7490.23f, -3111.08f, 434.431f, 0.02f, 0}, - {7496.29f, -3108, 434.783f, 1.15f, 0}, - {7497.46f, -3100.66f, 436.191f, 1.50f, 0}, - {7495.64f, -3093.39f, 438.349f, 2.10f, 0}, - {7492.44f, -3086.01f, 440.267f, 1.38f, 0}, - {7498.26f, -3076.44f, 440.808f, 0.71f, 0}, - {7506.4f, -3067.35f, 443.64f, 0.77f, 0}, - {7518.37f, -3057.42f, 445.584f, 0.74f, 0}, - {7517.51f, -3056.3f, 444.568f, 2.49f, 4500} + {7465.28f, -3115.46f, 439.327f, 0.83f, 4s}, + {7476.49f, -3101, 443.457f, 0.89f, 0s}, + {7486.57f, -3085.59f, 439.478f, 1.07f, 0s}, + {7472.19f, -3085.06f, 443.142f, 3.07f, 0s}, + {7456.92f, -3085.91f, 438.862f, 3.24f, 0s}, + {7446.68f, -3083.43f, 438.245f, 2.40f, 0s}, + {7446.17f, -3080.21f, 439.826f, 1.10f, 6s}, + {7452.41f, -3085.8f, 438.984f, 5.78f, 0s}, + {7469.11f, -3084.94f, 443.048f, 6.25f, 0s}, + {7483.79f, -3085.44f, 439.607f, 6.25f, 0s}, + {7491.14f, -3090.96f, 439.983f, 5.44f, 0s}, + {7497.62f, -3098.22f, 436.854f, 5.44f, 0s}, + {7498.72f, -3113.41f, 434.596f, 4.84f, 0s}, + {7500.06f, -3122.51f, 434.749f, 5.17f, 0s}, + {7504.96f, -3131.53f, 434.475f, 4.74f, 0s}, + {7504.31f, -3133.53f, 435.693f, 3.84f, 6s}, + {7504.55f, -3133.27f, 435.476f, 0.68f, 15s}, + {7501.99f, -3126.01f, 434.93f, 1.83f, 0s}, + {7490.76f, -3114.97f, 434.431f, 2.51f, 0s}, + {7479.64f, -3105.51f, 431.123f, 1.83f, 0s}, + {7474.63f, -3086.59f, 428.994f, 1.83f, 2s}, + {7472.96f, -3074.18f, 427.566f, 1.57f, 0s}, + {7472.25f, -3063, 428.268f, 1.55f, 0s}, + {7473.46f, -3054.22f, 427.588f, 0.36f, 0s}, + {7475.08f, -3053.6f, 428.653f, 0.36f, 6s}, + {7474.66f, -3053.56f, 428.433f, 3.19f, 4s}, + {7471.81f, -3058.84f, 427.073f, 4.29f, 0s}, + {7472.16f, -3064.91f, 427.772f, 4.95f, 0s}, + {7471.56f, -3085.36f, 428.924f, 4.72f, 0s}, + {7473.56f, -3093.48f, 429.294f, 5.04f, 0s}, + {7478.94f, -3104.29f, 430.638f, 5.23f, 0s}, + {7484.46f, -3109.61f, 432.769f, 5.79f, 0s}, + {7490.23f, -3111.08f, 434.431f, 0.02f, 0s}, + {7496.29f, -3108, 434.783f, 1.15f, 0s}, + {7497.46f, -3100.66f, 436.191f, 1.50f, 0s}, + {7495.64f, -3093.39f, 438.349f, 2.10f, 0s}, + {7492.44f, -3086.01f, 440.267f, 1.38f, 0s}, + {7498.26f, -3076.44f, 440.808f, 0.71f, 0s}, + {7506.4f, -3067.35f, 443.64f, 0.77f, 0s}, + {7518.37f, -3057.42f, 445.584f, 0.74f, 0s}, + {7517.51f, -3056.3f, 444.568f, 2.49f, 4500ms} }; Position const AspectRavenSummon = {7472.96f, -3074.18f, 427.566f, 0.0f}; @@ -197,7 +206,7 @@ public: { for (uint8 i = 0; i < 41; ++i) { - AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], Clintar_spirit_WP[i][3], (uint32)Clintar_spirit_WP[i][4]); + AddWaypoint(i, Clintar_spirit_WP[i].X, Clintar_spirit_WP[i].Y, Clintar_spirit_WP[i].Z, Clintar_spirit_WP[i].O, Clintar_spirit_WP[i].waitTime); } PlayerGUID = player->GetGUID(); Start(true, false, PlayerGUID); |