From 0a88aa9abee299db0acfc2c5c47d7b91a7511bf7 Mon Sep 17 00:00:00 2001 From: bash Date: Sun, 19 Oct 2025 03:27:04 +0200 Subject: [PATCH] Revert "another related core refactor fixes" This reverts commit bcc173d9202cb9c519706a00de0b28387f122831. --- .../raids/naxxramas/RaidNaxxActions.cpp | 28 +++++-------------- .../raids/naxxramas/RaidNaxxActions.h | 10 +++---- .../raids/naxxramas/RaidNaxxBossHelper.h | 8 +++--- .../raids/naxxramas/RaidNaxxMultipliers.cpp | 15 ++++------ .../raids/naxxramas/RaidNaxxTriggers.cpp | 9 ++---- .../raids/naxxramas/RaidNaxxTriggers.h | 7 ++--- 6 files changed, 25 insertions(+), 52 deletions(-) diff --git a/src/strategy/raids/naxxramas/RaidNaxxActions.cpp b/src/strategy/raids/naxxramas/RaidNaxxActions.cpp index 8b3b331e..cf12bb8e 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxActions.cpp +++ b/src/strategy/raids/naxxramas/RaidNaxxActions.cpp @@ -57,14 +57,8 @@ uint32 GrobbulusRotateAction::GetCurrWaypoint() return false; } EventMap* eventMap = &boss_ai->events; - - // avoids division/modulo by zero - if (!eventMap->HasTimeUntilEvent(2) || intervals == 0) - return 0; - - const Milliseconds event_time = eventMap->GetTimeUntilEvent(2); - uint32 event_ms = static_cast(event_time.count()); - return (event_ms / 15000) % intervals; + const uint32 event_time = eventMap->GetNextEventTime(2); + return (event_time / 15000) % intervals; } bool HeiganDanceAction::CalculateSafe() @@ -79,17 +73,12 @@ bool HeiganDanceAction::CalculateSafe() { return false; } - EventMap* eventMap = &boss_ai->events; uint32 curr_phase = boss_ai->currentPhase; - - // Get remaining time until events - Milliseconds curr_erupt = eventMap->GetTimeUntilEvent(3); - Milliseconds curr_dance = eventMap->GetTimeUntilEvent(4); - - // Replace timer subtraction with the fact that GetTimeUntilEvent() already gives remaining time - if ((curr_phase == 0 && curr_dance >= Milliseconds(85000)) || - (curr_phase == 1 && curr_dance >= Milliseconds(40000))) + uint32 curr_erupt = eventMap->GetNextEventTime(3); + uint32 curr_dance = eventMap->GetNextEventTime(4); + uint32 curr_timer = eventMap->GetTimer(); + if ((curr_phase == 0 && curr_dance - curr_timer >= 85000) || (curr_phase == 1 && curr_dance - curr_timer >= 40000)) { ResetSafe(); } @@ -97,11 +86,8 @@ bool HeiganDanceAction::CalculateSafe() { NextSafe(); } - - // Save previous values prev_phase = curr_phase; prev_erupt = curr_erupt; - return true; } @@ -1127,4 +1113,4 @@ bool LoathebChooseTargetAction::Execute(Event event) return false; } return Attack(target); -} +} \ No newline at end of file diff --git a/src/strategy/raids/naxxramas/RaidNaxxActions.h b/src/strategy/raids/naxxramas/RaidNaxxActions.h index 3949094e..506fa626 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxActions.h +++ b/src/strategy/raids/naxxramas/RaidNaxxActions.h @@ -9,7 +9,6 @@ #include "Playerbots.h" #include "RaidNaxxBossHelper.h" #include "RaidNaxxScripts.h" -#include "SharedDefines.h" // just for test // class TryToGetBossAIAction : public Action @@ -63,8 +62,8 @@ public: HeiganDanceAction(PlayerbotAI* ai) : MovementAction(ai, "heigan dance") { this->prev_phase = 0; - this->prev_erupt = Milliseconds(0); - this->prev_timer = Milliseconds(0); + this->prev_erupt = 0; + this->prev_timer = 0; ResetSafe(); waypoints.push_back(std::make_pair(2794.88f, -3668.12f)); waypoints.push_back(std::make_pair(2775.49f, -3674.43f)); @@ -87,8 +86,7 @@ protected: curr_dir = -curr_dir; } } - uint32 prev_phase; - Milliseconds prev_erupt, prev_timer; + uint32 prev_phase, prev_erupt, prev_timer; uint32 curr_safe, curr_dir; std::vector> waypoints; }; @@ -323,4 +321,4 @@ private: LoathebBossHelper helper; }; -#endif +#endif \ No newline at end of file diff --git a/src/strategy/raids/naxxramas/RaidNaxxBossHelper.h b/src/strategy/raids/naxxramas/RaidNaxxBossHelper.h index 83e48ddf..a5c781f9 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxBossHelper.h +++ b/src/strategy/raids/naxxramas/RaidNaxxBossHelper.h @@ -60,7 +60,7 @@ public: { return false; } - _timer = _event_map->GetTimer(); + _timer = 0; //_event_map->GetTimer(); TODO: change back, still testing return true; } virtual void Reset() @@ -218,7 +218,7 @@ public: private: const uint32 POSITION_TIME_AFTER_LANDED = 5000; const uint32 EVENT_FLIGHT_INTERVAL = 45000; - Milliseconds lastEventGround = Milliseconds(0); + Milliseconds lastEventGround = 0ms; }; class GluthBossHelper : public GenericBossHelper @@ -298,7 +298,7 @@ public: lady = nullptr; ladyAI = nullptr; ladyEvent = nullptr; - lastEventVoidZone = Milliseconds(0); + lastEventVoidZone = 0ms; voidZoneCounter = 0; posToGo = 0; } @@ -367,7 +367,7 @@ protected: Unit* lady = nullptr; FourHorsemen::boss_four_horsemen::boss_four_horsemenAI* ladyAI = nullptr; EventMap* ladyEvent = nullptr; - Milliseconds lastEventVoidZone = Milliseconds(0); + Milliseconds lastEventVoidZone = 0ms; uint32 voidZoneCounter = 0; int posToGo = 0; }; diff --git a/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp b/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp index ec029b71..3b41ec0d 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp +++ b/src/strategy/raids/naxxramas/RaidNaxxMultipliers.cpp @@ -19,7 +19,6 @@ #include "ShamanActions.h" #include "UseMeetingStoneAction.h" #include "WarriorActions.h" -#include "SharedDefines.h" float GrobbulusMultiplier::GetValue(Action* action) { @@ -49,20 +48,16 @@ float HeiganDanceMultiplier::GetValue(Action* action) } EventMap* eventMap = &boss_ai->events; uint32 curr_phase = boss_ai->currentPhase; - - // Get remaining time until events - Milliseconds curr_dance = eventMap->GetTimeUntilEvent(4); - Milliseconds curr_erupt = eventMap->GetTimeUntilEvent(3); - + uint32 curr_dance = eventMap->GetNextEventTime(4); + uint32 curr_timer = eventMap->GetTimer(); + uint32 curr_erupt = eventMap->GetNextEventTime(3); if (dynamic_cast(action) || dynamic_cast(action) || - dynamic_cast(action)) + dynamic_cast(action) ) { return 0.0f; } - - // Replace old subtraction with direct comparison - if (curr_phase != 1 && curr_dance >= Milliseconds(3000)) + if (curr_phase != 1 && (int32)curr_dance - curr_timer >= 3000) { return 1.0f; } diff --git a/src/strategy/raids/naxxramas/RaidNaxxTriggers.cpp b/src/strategy/raids/naxxramas/RaidNaxxTriggers.cpp index d2f3c2de..f4575141 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxTriggers.cpp +++ b/src/strategy/raids/naxxramas/RaidNaxxTriggers.cpp @@ -4,7 +4,6 @@ #include "Playerbots.h" #include "ScriptedCreature.h" #include "Trigger.h" -#include "SharedDefines.h" bool AuraRemovedTrigger::IsActive() { @@ -42,16 +41,12 @@ bool BossEventTrigger::IsActive() { return false; } - Milliseconds event_time = eventMap->GetTimeUntilEvent(event_id); - if (event_time == Milliseconds::max()) - return false; - - if (last_event_time.count() == 0 || event_time != last_event_time) + const uint32 event_time = eventMap->GetNextEventTime(event_id); + if (event_time != last_event_time) { last_event_time = event_time; return true; } - return false; } diff --git a/src/strategy/raids/naxxramas/RaidNaxxTriggers.h b/src/strategy/raids/naxxramas/RaidNaxxTriggers.h index 56a4e726..ec10c5de 100644 --- a/src/strategy/raids/naxxramas/RaidNaxxTriggers.h +++ b/src/strategy/raids/naxxramas/RaidNaxxTriggers.h @@ -41,13 +41,12 @@ public: { this->boss_entry = boss_entry; this->event_id = event_id; - this->last_event_time = Milliseconds(0); + this->last_event_time = -1; } virtual bool IsActive(); protected: - uint32 boss_entry, event_id; - Milliseconds last_event_time; + uint32 boss_entry, event_id, last_event_time; }; class GrobbulusCloudTrigger : public BossEventTrigger @@ -222,4 +221,4 @@ private: LoathebBossHelper helper; }; -#endif +#endif \ No newline at end of file