WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF - canel buffs (https://www.wowinterface.com/forums/showthread.php?t=56323)

Lolzen 07-01-18 03:32 AM

oUF - canel buffs
 
I searched around and got very old info (2010ish) including haste confirming plans to implement the secure template Auras to enable canceling buffs. Obviously this never came to fruition and was regarded low priority anyways.
I still want to have that and it kinda works using the PostUpdateIcon func, however obviously tainting because of SetAllPoints().
I'm out of ideas for now how to implement it without touching oUFs core, and in addition to that ask if this feature would ever make it into oUF or is regarded useless/niche/wontdo.

Below is my current implementation snippet:
Lua Code:
  1. local PostUpdateIcon = function(icons, unit, button, index, offset, filter, isDebuff)
  2.     local texture = button.icon
  3.     if button.isPlayer then
  4.         texture:SetDesaturated(false)
  5.     else
  6.         texture:SetDesaturated(true)
  7.     end
  8.                
  9.     if not button.clickablearea then
  10.         button.clickablearea = CreateFrame("Button", nil, UIParent, "SecureActionButtonTemplate")
  11.         button.clickablearea:SetAttribute("*type2", "cancelaura")
  12.         button.clickablearea:SetAttribute("index", index)
  13.         button.clickablearea:SetAllPoints(button)
  14.         button.clickablearea:RegisterForClicks("RightButtonUp")
  15.     end
  16. end

I'm just surfacing on grasping the SecureTemplates, so i might have overseen something.

runamonk 07-01-18 07:16 AM

I added support to my layout, granted it only works while not in combat which is all I wanted/needed. This will work for now until we can get a more correct way to do it.

Lua Code:
  1. local function PostCreateIcon(Auras, button)
  2.     button.count = mnkLibs.createFontString(button, mnkLibs.Fonts.ap, 10,  nil, nil, true)
  3.     button.count:ClearAllPoints()
  4.     button.count:SetPoint('TOPRIGHT', button, 0, 2)
  5.     button.timer = mnkLibs.createFontString(button, mnkLibs.Fonts.ap, 10,  nil, nil, true)
  6.     button.timer:ClearAllPoints()
  7.     button.timer:SetPoint('BOTTOMLEFT', button, 0, 0)
  8.     button.icon:SetTexCoord(.07, .93, .07, .93)
  9.     button:SetScript('OnClick', function(self, button) CancelUnitBuff('player', self:GetName():match('%d')) end)
  10.     mnkLibs.createBorder(button, 1,-1,-1,1, {0,0,0,1})
  11. end

lightspark 07-01-18 09:16 AM

Quote:

Originally Posted by Lolzen (Post 328483)
I'm out of ideas for now how to implement it without touching oUFs core

Use runamonk's solution, it's good enough, just add InCombatLockdown check around CancelUnitBuff, and you're good to go.

Quote:

Originally Posted by Lolzen (Post 328483)
and in addition to that ask if this feature would ever make it into oUF or is regarded useless/niche/wontdo.

Nah, simply because it's something that doesn't work all the time, but only works when you're out of combat.

lightspark 07-01-18 09:24 AM

Quote:

Originally Posted by runamonk (Post 328487)
This will work for now until we can get a more correct way to do it.

What did you mean by "a more correct way to do it"? Yours is fine, I'd change it a bit though.

Lua Code:
  1. button:SetScript('OnClick', function(self, button)
  2.     if not InCombatLockdown() and button == "RightButton" then
  3.         CancelUnitBuff("player", self:GetID(), self.filter)
  4.     end
  5. end)

Lolzen 07-01-18 09:24 AM

Quote:

Originally Posted by runamonk (Post 328487)
I added support to my layout, granted it only works while not in combat which is all I wanted/needed. This will work for now until we can get a more correct way to do it.

Lua Code:
  1. local function PostCreateIcon(Auras, button)
  2.     button.count = mnkLibs.createFontString(button, mnkLibs.Fonts.ap, 10,  nil, nil, true)
  3.     button.count:ClearAllPoints()
  4.     button.count:SetPoint('TOPRIGHT', button, 0, 2)
  5.     button.timer = mnkLibs.createFontString(button, mnkLibs.Fonts.ap, 10,  nil, nil, true)
  6.     button.timer:ClearAllPoints()
  7.     button.timer:SetPoint('BOTTOMLEFT', button, 0, 0)
  8.     button.icon:SetTexCoord(.07, .93, .07, .93)
  9.     button:SetScript('OnClick', function(self, button) CancelUnitBuff('player', self:GetName():match('%d')) end)
  10.     mnkLibs.createBorder(button, 1,-1,-1,1, {0,0,0,1})
  11. end

Yes, that was what i had when i started tinkering with that idea, but i wanted to be able to cancel the buffs in combat too, hence why i'm exploring this :)

Quote:

Originally Posted by lightspark (Post 328489)
Use runamonk's solution, it's good enough, just add InCombatLockdown check around CancelUnitBuff, and you're good to go.

Nah, simply because it's something that doesn't work all the time, but only works when you're out of combat.

See above :D
My solution kind of works in combat, however taints. The idea back the was to add a secure version, which isn't as flexible as the current implementation due to limitations.

Thanks for the answers guys, i'll try to find a solution and will probably miserably fail and give up - however iÄm grateful for the official statement, thanks!

lightspark 07-01-18 09:29 AM

Quote:

Originally Posted by Lolzen (Post 328491)
My solution kind of works in combat, however taints. The idea back the was to add a secure version, which isn't as flexible as the current implementation due to limitations.

Which means it doesn't work :D

Using secure templates for stuff that gets shown/hidden "insecurely" via basic :Show() and :Hide() in combat is a very bad idea.

The correct way to do it securely is to use Blizz secure aura headers, but then you won't be able to use custom filters, you'll have to rely on fairly basic Blizz aura filtering options.

runamonk 07-01-18 09:34 AM

Quote:

Originally Posted by lightspark (Post 328490)
What did you mean by "a more correct way to do it"? Yours is fine, I'd change it a bit though.

Lua Code:
  1. button:SetScript('OnClick', function(self, button)
  2.     if not InCombatLockdown() and button == "RightButton" then
  3.         CancelUnitBuff("player", self:GetID(), self.filter)
  4.     end
  5. end)

Just a hope that one day blizzard will let us cancel auras while in combat. ;)

Lolzen 07-01-18 09:35 AM

Quote:

Originally Posted by lightspark (Post 328492)
Which means it doesn't work :D

True :P

Basically i liked how oUF handled the Auras for me, so i loved the idea to use oUF as a bufframe replacement.
I get it simply isn't possible with my vision without basically implementing a plugin which is a secureAuraTemplate itself which kinda defeats the purpose entirely.

lightspark 07-01-18 09:36 AM

Quote:

Originally Posted by runamonk (Post 328493)
Just a hope that one day blizzard will let us cancel auras while in combat. ;)

Not gonna happen, if they do, we'll just go back to Vanilla days of automated aura cancelling in raids/bgs/etc.

lightspark 07-01-18 09:39 AM

Quote:

Originally Posted by Lolzen (Post 328494)
True :P

Basically i liked how oUF handled the Auras for me, so i loved the idea to use oUF as a bufframe replacement.
I get it simply isn't possible with my vision without basically implementing a plugin which is a secureAuraTemplate itself which kinda defeats the purpose entirely.

Buff frame? O_o Do you mean the one that's next to your minimap in the default UI? o_O If that's the case, you def shouldn't be using oUF for that, just use "SecureAuraHeaderTemplate" and build a custom addon around it.

Lolzen 07-01-18 09:43 AM

Quote:

Originally Posted by lightspark (Post 328496)
Buff frame? O_o Do you mean the one that's next to your minimap in the default UI? o_O If that's the case, you def shouldn't be using oUF for that, just use "SecureAuraHeaderTemplate" and build a custom addon around it.

Yup, Well not the "Frame" aspect of it - but exactly that. I'm not filtering anything or using consolided bufframe, so that's why it seemed "possible".
I had my reasons for trying this - i'm really that mad *shrug*
(Yes, i had/have various versions of standalone auras)

lightspark 07-01-18 09:50 AM

Quote:

Originally Posted by Lolzen (Post 328497)
Yup, Well not the "Frame" aspect of it - but exactly that. I'm not filtering anything or using consolided bufframe, so that's why it seemed "possible".
I had my reasons for trying this - i'm really that mad *shrug*
(Yes, i had/have various versions of standalone auras)

Welp, secure aura header is what you need then. It's there to let people implement this kind of relatively simple aura displays w/ cancellable buffs :p

Also, consolidated buffs are long gone.


All times are GMT -6. The time now is 09:07 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI