Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
166 stars 7 forks source link

GetTotemInfo's startTime / duration is wrong #651

Open mrbuds opened 2 weeks ago

mrbuds commented 2 weeks ago

Tests with some shaman totems show that time data from GetTotemInfo and GetTotemTimeLeft does not match, with sometime more than 1 second of difference

When using a totem that give a buff, GetTotemTimeLeft timer is much closer to the timer of the buff GetTotemTimeLeft returned value is rounded with math.ceil, which make it not precise / usable

local f = CreateFram("Frame")
f:SetScript("OnUpdate", function()
      local a = GetTotemTimeLeft(1)

      local _, _, startTime, duration = GetTotemInfo(1)
      local expirationTime = startTime and (startTime + duration) or 0;
      local b =  startTime and startTime > 0 and expirationTime - GetTime() or 0

      local sltInfo = C_UnitAuras.GetPlayerAuraBySpellID(325174) -- spirit link totem buff
      local slt = sltInfo and true or false 

      print(a, b, slt)
end)
f:Show()

https://private-user-images.githubusercontent.com/189656/363988546-27144c8d-7ae2-48cc-a9c1-973af582c15b.mp4?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0Njg4NjMsIm5iZiI6MTcyNTQ2ODU2MywicGF0aCI6Ii8xODk2NTYvMzYzOTg4NTQ2LTI3MTQ0YzhkLTdhZTItNDhjYy1hOWMxLTk3M2FmNTgyYzE1Yi5tcDQ_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTA0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwNFQxNjQ5MjNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hMjFmMmI4NTM5YmFkYzc1YWFjMTcxY2JiZDc4NjFlZmQ1Yjg0YTk4ZWZkYjU1NDg4YmE0YzQyYTI4Nzc4ZTNjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.cNIlmb99FPlqcx8gpbEmfGv9KWGIlYGUc959x-Hji5I

With this demo using SLT, note how when SLT buff fade the timer from GetTotemInfo is off by 1.138s and timer from GetTotemTimeLeft is off by 0.189s

Also not shown with this code, PLAYER_TOTEM_UPDATE event time match closer to GetTotemTimeLeft too but isn't perfect

InfusOnWoW commented 2 weeks ago

This is quite annoying for us in WeakAuras, we have looked into whether we can workaround that but couldn't come up with an workaround that does feel reasonably robust. So we would love to have this fixed. (And we'd love to see an spell id added when this eventually moves to C_Spell.)