[Bug?] SetCooldown on the PTR

UI and Macro
First, here's my test code:
hooksecurefunc(getmetatable(ActionButton1Cooldown).__index, 'SetCooldown', function(cd, start, duration)
print(cd:GetName(), start, duration)

Here's the new cooldown behavior I've noticed on the PTR:

When casting Grounding Totem on the PTR, SetCooldown does not seem to be called for anything but the spell icon in my spellbook for it. However, if I then pick up the icon for Grounding Totem from either my action bar or my totem bar, SetCooldown is called for the button as soon as I place it back on my action bar/totem bar.

In other cases (I'm looking at Stoneform on dwarves), CooldownModel.SetCooldown seems to fire as it normally did.

And finally, in other cases (Sprint on my rogues), it appears as if CooldownModel.SetCooldown is fired only after the sprint buff expires on the rogue.

I also noticed that in the latest PTR build, this bit in ActionButton.lua
--self:RegisterEvent("ACTIONBAR_UPDATE_STATE"); not updating state from lua anymore, see SetActionUIButton

Going forward, should I expect that CooldownModel.SetCooldown will no longer be a reliable method to determine cooldown information for action buttons anymore?
A monday evening bump, hurray! :P

So to reiterate my question:
Are calls to CooldownModel.SetCooldown going away with patch 4.3?
Help us, Blizzard! You're our only hope!
https://github.com/tullamods/OmniCC/issues/29 This is a huge deal, a lot of people rely on omnicc to manage their rotation, and if its broken it will create a lot of issues, could this be addressed, please?
So, what's happened is that in 4.3 the core UI delegates some of its ActionButton presentation management code into the C layer, and bypasses the lua API's - which is why you're not seeing the calls to SetCooldown. This is managed by the SetActionUIButton method.

Now, none of the events that would normally have triggered these activities to occur have gone anywhere, so if you're trying to track cooldown state then you should register for those events yourself (and it's recommended to register on ONE frame and dispatch to appropriate cooldowns, rather than the old action button style of having every button register for the event) and act accordingly.

There currently isn't a means to UN-register an action button, so if you need to modify the existing buttons (rather than making your own) then you'll want to do something with the cooldown frame (anchor it offscreen, or set its alpha to zero, or re-parent it onto a hidden frame) so that it doesn't show up.

I'm not sure the developers anticipated folks using some but not all of their action button rendering, so if there are specific problems that can't be solved by the suggestions above can you share them here.
Given that the necessary events still fire, I think that OmniCC is really the only addon negatively impacted by the change, since it relies on CooldownModel.SetCooldown to always be a surefire indicator of when a cooldown starts (and thus an effective method to inject cooldown text on every possible icon (actions, inventory icons, buffs, spells, etc).

From Jaliborc on the EU side:
I have no idea how the C layer is coded, or what the SetActionUIButton is (is it new, or already existed?), but why not making the CooldownModel have an "OnStart" script? My guess is it should have no hit on the performance of the default UI, while allowing add ons to register and screw it up :P

I think an OnStart script would definitely be more than sufficient for injecting cooldown text.

And finally, here's my quick and dirty hack that forces Blizzard action buttons to fire SetCooldown :)

if ActionBarButtonEventsFrame.frames then
local hooked = {}
local active = {}

local abEventWatcher = CreateFrame('Frame'); abEventWatcher:Hide()
abEventWatcher:SetScript('OnEvent', function(self, event)
for cooldown in pairs(active) do
local button = cooldown:GetParent()
local start, duration, enable = GetActionCooldown(button.action)
cooldown:SetCooldown(start, duration)

local function cooldown_OnShow(self)
active[self] = true

local function cooldown_OnHide(self)
active[self] = nil

local function actionButton_Register(frame)
local cooldown = frame.cooldown
if not hooked[cooldown] then
cooldown:HookScript('OnShow', cooldown_OnShow)
cooldown:HookScript('OnHide', cooldown_OnHide)
hooked[cooldown] = true

for i, frame in pairs(ActionBarButtonEventsFrame.frames) do
hooksecurefunc('ActionBarButtonEventsFrame_RegisterFrame', actionButton_Register)
so im a coding nub, where would we go to place this fix? in the omnicc code somewhere? cuz i love this addon, and will miss it very much if i can't use it :(

edit: i've noticed that the cd text displaying even after the spell in question is no longer on cooldown to be most problematic with the dynamic cds, like adrenaline rush and killing spree for combat rogues

Join the Conversation

Return to Forum