diff options
author | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-07-14 18:11:07 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-01-23 15:36:37 +0100 |
commit | c76f6e08793895a2bc810c56f16a656d4a5e160c (patch) | |
tree | 3a703e13e253473eb37437e9e03a9ae28c56b88c | |
parent | e188a75c683dafa3aefddfb76539fd047dc7bca3 (diff) |
Core/Battlegrounds: Use std::chrono::duration overloads of EventMap (#25015)
Contributes to #25012
(cherry picked from commit e372f9badb252f67abc29236e715bcce7fe1155d)
5 files changed, 12 insertions, 20 deletions
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index 5aaa03380a1..7d7c68b41e9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -42,10 +42,7 @@ enum BattlegroundBEGameObjects BG_BE_OBJECT_TYPE_BUFF_2 = 184664 }; -enum BattlegroundBEData -{ - BG_BE_REMOVE_DOORS_TIMER = 5000 -}; +constexpr Seconds BG_BE_REMOVE_DOORS_TIMER = 5s; enum BattlegroundBEEvents { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index a07d32017dc..59b8fe8fc07 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -58,7 +58,7 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff) DoorOpen(BG_DS_OBJECT_WATER_1); DoorOpen(BG_DS_OBJECT_WATER_2); _events.CancelEvent(BG_DS_EVENT_WATERFALL_KNOCKBACK); - _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_WARNING, urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); + _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_WARNING, BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX); break; case BG_DS_EVENT_WATERFALL_KNOCKBACK: // Repeat knockback while the waterfall still active @@ -104,7 +104,7 @@ void BattlegroundDS::StartingEventOpenDoors() for (uint32 i = BG_DS_OBJECT_BUFF_1; i <= BG_DS_OBJECT_BUFF_2; ++i) SpawnBGObject(i, 60); - _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_WARNING, urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); + _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_WARNING, BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX); //for (uint8 i = 0; i < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT; ++i) // _events.ScheduleEvent(BG_DS_EVENT_PIPE_KNOCKBACK, BG_DS_PIPE_KNOCKBACK_FIRST_DELAY + i * BG_DS_PIPE_KNOCKBACK_DELAY); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index a54c54aad98..a2ee050bbd9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -67,17 +67,18 @@ enum BattlegroundDSSpells enum BattlegroundDSData { // These values are NOT blizzlike... need the correct data! - BG_DS_WATERFALL_TIMER_MIN = 30000, - BG_DS_WATERFALL_TIMER_MAX = 60000, - BG_DS_WATERFALL_WARNING_DURATION = 5000, - BG_DS_WATERFALL_DURATION = 30000, - BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500, - BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000, BG_DS_PIPE_KNOCKBACK_DELAY = 3000, BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT = 2, }; +// These values are NOT blizzlike... need the correct data! +constexpr Seconds BG_DS_WATERFALL_TIMER_MIN = 30s; +constexpr Seconds BG_DS_WATERFALL_TIMER_MAX = 60s; +constexpr Seconds BG_DS_WATERFALL_WARNING_DURATION = 5s; +constexpr Seconds BG_DS_WATERFALL_DURATION = 30s; +constexpr Milliseconds BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500ms; + enum BattlegroundDSEvents { BG_DS_EVENT_WATERFALL_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index a509f16f2a9..fc782025e52 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -41,10 +41,7 @@ enum BattlegroundNAGameObjects BG_NA_OBJECT_TYPE_BUFF_2 = 184664 }; -enum BattlegroundNAData -{ - BG_NA_REMOVE_DOORS_TIMER = 5000 -}; +constexpr Seconds BG_NA_REMOVE_DOORS_TIMER = 5s; enum BattlegroundNAEvents { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index d553a1f6aca..8d77c1f5bb2 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -37,10 +37,7 @@ enum BattlegroundRLGameObjects BG_RL_OBJECT_TYPE_BUFF_2 = 184664 }; -enum BattlegroundRLData -{ - BG_RL_REMOVE_DOORS_TIMER = 5000 -}; +constexpr Seconds BG_RL_REMOVE_DOORS_TIMER = 5s; enum BattlegroundRLEvents { |