mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 11:10:00 +00:00
cooldown: a weird fix for weird cooldown issues
Some items with huge cooldowns (like Salt Shaker) send remaining cooldown times that are way higher than they should be. You often see a cooldown of 52d and alike. This seems to have "reasons" and is fixed by this commit. All credits to the guys at: https://github.com/Stanzilla/WoWUIBugs/issues/47
This commit is contained in:
+23
-4
@@ -25,11 +25,30 @@ pfUI:RegisterModule("cooldown", "vanilla:tbc", function ()
|
||||
-- fix own alpha value (should be inherited, but somehow isn't always)
|
||||
this:SetAlpha(parent:GetAlpha())
|
||||
|
||||
local remaining = this.duration - (GetTime() - this.start)
|
||||
if remaining >= 0 then
|
||||
this.text:SetText(GetColoredTimeString(remaining))
|
||||
if this.start < GetTime() then
|
||||
-- calculating remaining time as it should be
|
||||
local remaining = this.duration - (GetTime() - this.start)
|
||||
if remaining >= 0 then
|
||||
this.text:SetText(GetColoredTimeString(remaining))
|
||||
else
|
||||
this:Hide()
|
||||
end
|
||||
else
|
||||
this:Hide()
|
||||
-- I have absolutely no idea, but it works:
|
||||
-- https://github.com/Stanzilla/WoWUIBugs/issues/47
|
||||
local time = time()
|
||||
local startupTime = time - GetTime()
|
||||
-- just a simplification of: ((2^32) - (start * 1000)) / 1000
|
||||
local cdTime = (2 ^ 32) / 1000 - this.start
|
||||
local cdStartTime = startupTime - cdTime
|
||||
local cdEndTime = cdStartTime + this.duration
|
||||
local remaining = cdEndTime - time
|
||||
|
||||
if remaining >= 0 then
|
||||
this.text:SetText(GetColoredTimeString(remaining))
|
||||
else
|
||||
this:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user