Tercioo / Open-Raid-Library

Library for World of Warcraft game, help to transmit data among players in a group
GNU Lesser General Public License v2.1
7 stars 15 forks source link

Wrong cooldown info after PLAYER_ENTERING_WORLD or /reload #47

Open izyspania opened 11 months ago

izyspania commented 11 months ago

It seems that the addon is sending wrong cooldown info after a /reload or when changing zone and stuff , the problem seems to be with AceComm-3.0 , i think because of the ChatThrottleLib , it delays the sending of cooldown updates from 3 to 8 seconds so all the cooldowns are 3 to 8 seconds behind, tested without the AceComm-3.0 and it works ok.

The problem with is if you /reload in the middle of a Arena/Dung/Raid etc .. .or you get a crash and you have to log in again you will send delayed cooldown data to everybody.

What i was thinking is to use GetServerTime() (seems to work fine now) to keep the cooldowns data in sync, for compatibility reasons an workaround could be something like:

      local serverTime = GetServerTime()
      local data = data .. ",Q," .. serverTime
...

for cooldowns sending part, doing something like this seems not to interfere with the actual code and we can do, for ex, something like this for the receiving part:

            local localServerTime = GetServerTime()
            local timeLeft = start + duration - GetTime() - (localServerTime  - serverTime )
...

Ofc , ideal would be to make everything to use GetServerTime() instead of GetTime() or maybe a GetTime() sync before cooldown updates ( i like the GetServerTime() option more) .