From 1aa78d32eb3d7f09fbd69dd488abc0435721b49d Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 6 Apr 2021 23:42:49 -0400 Subject: [PATCH] Core/Groups: Use std::chrono type for Group::m_readyCheckTimer Port From (https://github.com/TrinityCore/TrinityCore/commit/48b63c4c6721fa9a38f74f8fa92255ac0938da42) --- Source/Game/Groups/Group.cs | 14 +++++++------- Source/Game/Handlers/GroupHandler.cs | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Game/Groups/Group.cs b/Source/Game/Groups/Group.cs index 0755a6a21..7a6f47e75 100644 --- a/Source/Game/Groups/Group.cs +++ b/Source/Game/Groups/Group.cs @@ -2160,12 +2160,12 @@ namespace Game.Groups if (!m_readyCheckStarted) return; - m_readyCheckTimer -= (int)diff; - if (m_readyCheckTimer <= 0) + m_readyCheckTimer -= TimeSpan.FromMilliseconds(diff); + if (m_readyCheckTimer <= TimeSpan.Zero) EndReadyCheck(); } - public void StartReadyCheck(ObjectGuid starterGuid, sbyte partyIndex, uint duration = MapConst.ReadycheckDuration) + public void StartReadyCheck(ObjectGuid starterGuid, sbyte partyIndex, TimeSpan duration) { if (m_readyCheckStarted) return; @@ -2175,7 +2175,7 @@ namespace Game.Groups return; m_readyCheckStarted = true; - m_readyCheckTimer = (int)duration; + m_readyCheckTimer = duration; SetOfflineMembersReadyChecked(); @@ -2185,7 +2185,7 @@ namespace Game.Groups readyCheckStarted.PartyGUID = m_guid; readyCheckStarted.PartyIndex = partyIndex; readyCheckStarted.InitiatorGUID = starterGuid; - readyCheckStarted.Duration = duration; + readyCheckStarted.Duration = (uint)duration.TotalMilliseconds; BroadcastPacket(readyCheckStarted, false); } @@ -2195,7 +2195,7 @@ namespace Game.Groups return; m_readyCheckStarted = false; - m_readyCheckTimer = 0; + m_readyCheckTimer = TimeSpan.Zero; ResetMemberReadyChecked(); @@ -2623,7 +2623,7 @@ namespace Game.Groups // Ready Check bool m_readyCheckStarted; - int m_readyCheckTimer; + TimeSpan m_readyCheckTimer; // Raid markers RaidMarker[] m_markers = new RaidMarker[MapConst.RaidMarkersCount]; diff --git a/Source/Game/Handlers/GroupHandler.cs b/Source/Game/Handlers/GroupHandler.cs index c7f5a5619..55840844a 100644 --- a/Source/Game/Handlers/GroupHandler.cs +++ b/Source/Game/Handlers/GroupHandler.cs @@ -20,6 +20,7 @@ using Game.Entities; using Game.Groups; using Game.Networking; using Game.Networking.Packets; +using System; namespace Game { @@ -569,7 +570,7 @@ namespace Game return; // everything's fine, do it - group.StartReadyCheck(GetPlayer().GetGUID(), packet.PartyIndex); + group.StartReadyCheck(GetPlayer().GetGUID(), packet.PartyIndex, TimeSpan.FromMilliseconds(MapConst.ReadycheckDuration)); } [WorldPacketHandler(ClientOpcodes.ReadyCheckResponse, Processing = PacketProcessing.Inplace)]