Reply
 
Thread Tools Display Modes
Old 11-29-12, 05:49 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,289
Killing the loss of control actionbutton cooldown

Source: http://www.arenajunkies.com/topic/23...orking-method/

Lua Code:
  1. local disableLossOfControlCooldown = function()
  2.   for _, b in pairs(ActionBarActionEventsFrame.frames) do
  3.     b.cooldown:SetLossOfControlCooldown(0,0)
  4.   end
  5. end
  6.  
  7. local f = CreateFrame("Frame")
  8. f:RegisterEvent("LOSS_OF_CONTROL_ADDED")
  9. f:RegisterEvent("LOSS_OF_CONTROL_UPDATE")
  10. f:SetScript("OnEvent", disableLossOfControlCooldown)

Not sure if there is anything better. Maybe it even possible to just kill SetLossOfControlCooldown.
__________________
| Simple is beautiful.
| Blog | Roth UI | Roth UI FAQ | GoogleCode | Zork | Guild | zorker.de

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
zork is offline   Reply With Quote
Old 11-29-12, 08:04 AM   #2
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 741
Is it triggered by an event or on the C-side? If event, just unregistered it would suffice. :P If not then you could override SetLossOfControlCooldown to simply do nothing on the action bar cooldown widgets.
__________________
Profile: Curse | Wowhead
Vlad is online now   Reply With Quote
Old 11-29-12, 08:26 AM   #3
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,176
Wish I'd seen this before I uploaded a small addon.

It's not using this exact method but it's close.

@Vlad: unfortunately the red-out cooldown on the actionbars is triggered c-side, unregistering the events accomplishes nothing.

Last edited by Dridzt : 11-29-12 at 04:17 PM.
Dridzt is offline   Reply With Quote
Old 11-29-12, 08:27 AM   #4
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 741
Why would they make this C-side when the API is lua side? ... makes no sense!
__________________
Profile: Curse | Wowhead
Vlad is online now   Reply With Quote
Old 11-29-12, 03:46 PM   #5
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,706
Couldn't you just securehook the actual SetLossOfControlCooldown method on the button metatable, like OmniCC does for SetCooldown, and turn it off every time it's turned on?
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Old 11-29-12, 05:40 PM   #6
semlar
An Onyxian Warder
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 379
Lua Code:
  1. local x = ActionButton1Cooldown.SetLossOfControlCooldown
  2. hooksecurefunc(getmetatable(ActionButton1Cooldown).__index, 'SetLossOfControlCooldown', function(s) x(s,0,0) end)

Still causes a cooldown shine, probably not the ideal solution.

I think replacing the function outright will end up causing taint though.
semlar is offline   Reply With Quote
Old 11-29-12, 07:56 PM   #7
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 3,706
Wouldn't it work better to just hide the cooldown entirely:

Code:
hooksecurefunc(getmetatable(ActionButton1Cooldown).__index, 'SetLossOfControlCooldown', function(cd) cd:Hide() end)
?
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Old 11-29-12, 09:04 PM   #8
semlar
An Onyxian Warder
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 379
It's the same frame that handles the action button's regular cooldown, but it may be split into regions somehow. I don't know if it's possible to only hide the LoC part.

You could try just doing this, no idea if the taint will interfere with anything:
lua Code:
  1. getmetatable(ActionButton1Cooldown).__index.SetLossOfControlCooldown = function() end

Last edited by semlar : 11-29-12 at 09:26 PM.
semlar is offline   Reply With Quote
Old 11-30-12, 02:55 AM   #9
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,176
Just dropping it here that we do have 2-3 solutions to this already in case you didn't notice previous posts.

Not to take anything away from looking for a better solution, mostly for users coming upon the thread looking for a fix.

Among them my own little addon that's been linked further up this thread:
(it was waiting in the approval queue when I saw this post or I'd probably have used one of the existing solutions)
  • Lose Control Options Fix (only tested with default Blizz actionbars, only suppresses the red-out when you have the relevant game option unchecked)
  • Loss of Control Remover (unconditionally suppresses it, uses LibActionButton, tested with BT4, Dominos etc according to author)
  • NoRed (from ArenaJunkies, the one Zork posted about at the OP, also unconditionally removes it)

Last edited by Dridzt : 11-30-12 at 03:22 AM.
Dridzt is offline   Reply With Quote
Old 11-30-12, 05:52 AM   #10
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 741
1. Using "Hide" would also break it if you actually have a cooldown on the button that is locked out from casting, so yeah you can't do that, but nice try Phanx.

2. Replacing it with a empty function is one possibility but the taint has to be evaluated, for now it's a possibility but not sure if it's a good one. In any case it's a good suggestion, Semlar.

3. The best one so far is simply to have the shine appear for a moment but hide the effect.

My suggestion is something like:
Code:
hooksecurefunc(getmetatable(ActionButton1.cooldown).__index, "SetLossOfControlCooldown", function(self, _, _, arg) if arg ~= true then self:SetLossOfControlCooldown(0, 0, true) end end)
The purpose is to still allow it to set a loss of control animation in specific cases, but still block out the default Blizzard once.

The current addons like Lose Control Options Fix and NoRed is that they use the default actionbar frames, i.e. if you have custom bars then they won't work for you. My only issue with Loss of Control Remover is that it uses a library that needs to be updated, so the more "solid" way to fix this is going for an approach like hooking the metatables or something, as it will affect all cooldown widgets.

Also, NoRed is front page mmochamp material, so all those using it will have a global "f" variable, hehe. :P
__________________
Profile: Curse | Wowhead

Last edited by Vlad : 11-30-12 at 05:56 AM.
Vlad is online now   Reply With Quote
Old 11-30-12, 06:31 AM   #11
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,176
I kinda explored those possibilities the last couple days before uploading.
Your suggestion alone will not work because that is not actually called nearly as often as you may think.
(that whole c-side thing we were talking about earlier)

I only tested it with default actionbars, in reality I don't know if it does or does not work with popular actionbar mods.
Are they reusing the default actionbuttons or making their own?
If they're making their own why would they replicate the red-out effect unless purposely (in which case their authors can put options for it)
If they are, my addon "should" work for them as well. (I think I'll actually install a couple to test)

Last edited by Dridzt : 11-30-12 at 06:34 AM.
Dridzt is offline   Reply With Quote
Reply

Go BackWoWInterface » MoP Beta » MoP Beta API and Graphics Changes » Killing the loss of control actionbutton cooldown

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off