Thread Tools Display Modes
01-27-16, 12:46 PM   #1
Baggyman
A Deviate Faerie Dragon
Join Date: Jan 2016
Posts: 12
Purge Addon Request

Would it be possible to make an addon that only shows debuffs and purgeable buffs on the enemy unit and focus frames?

So essentially just get rid of all the buffs that I cannot purge.

Last edited by Baggyman : 01-27-16 at 01:22 PM.
  Reply With Quote
01-27-16, 02:02 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Yes it's possible, check the documentation for UnitBuff and UnitDebuff and note the "dispelType" return of each.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-27-16, 04:55 PM   #3
Baggyman
A Deviate Faerie Dragon
Join Date: Jan 2016
Posts: 12
Can anyone help me out with the code on this.

I tried editing some other peoples existing code but it still isn't working. Are any of these 2 trys close:


UIParent:SetScript("OnUpdate", function()
if TargetFrame:IsShown() then
numBuffs = 0
for i=1, MAX_TARGET_BUFFS do
if (select(3,UnitBuff("target",i)) ~= 'Magic') then
numBuffs = numBuffs + 1
end
end
for i=1, numBuffs do
local frame = _G["TargetFrameBuff"..i]
frame:Hide()
end
end


OR


hooksecurefunc("TargetFrame_UpdateAuras", function(s)
for i=1, MAX_TARGET_BUFFS do
if select(5,UnitAura(s.unit,i)) ~= 'Magic' then
_G[s:GetName()..i]:Hide()
end
end
end)
  Reply With Quote
01-28-16, 04:59 PM   #4
Baggyman
A Deviate Faerie Dragon
Join Date: Jan 2016
Posts: 12
Alright I figured it out! This is what I used if anyone else is interested:

hooksecurefunc("TargetFrame_UpdateAuras", function(s)
for i = 1, MAX_TARGET_BUFFS do
_, _, ic, _, dT = UnitBuff(s.unit, i)
if(ic and (not s.maxBuffs or i<=s.maxBuffs)) then
local frame = _G["TargetFrameBuff"..i]
if(dT~='Magic') then
frame:Hide()
end
end
end
end)


Also could someone explain to me what "not s.maxBuffs or i<=s.maxbuffs" is checking for? I got some of this code from around the web and am not quite sure what that part is for.
  Reply With Quote
01-28-16, 05:29 PM   #5
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
The logic you posted about is to prevent your loop from doing work on anything not visible. MAX_TARGET_BUFFS, which is the boundary for your loop, is a constant -- 32. self.maxBuffs is the current amount of buffs on the target, but understand that all 32 buff frames exist, and are used dynamically. So, that bit of logic prevents the loop from iterating past what buffs are currently displayed.

The code you posted leaks some very generic variables into the global name space, I posted a cleaned up version.

Lua Code:
  1. hooksecurefunc("TargetFrame_UpdateAuras", function(self)
  2.     for i = 1, MAX_TARGET_BUFFS do
  3.         local _, _, icon, _, dispelType = UnitBuff(self.unit, i)
  4.  
  5.         if (icon and (not self.maxBuffs or i <= self.maxBuffs) ) then
  6.             if (dispelType ~= "Magic") then
  7.                 _G["TargetFrameBuff"..i]:Hide()
  8.             end
  9.         end
  10.     end
  11. end)

Last edited by Clamsoda : 01-28-16 at 06:09 PM.
  Reply With Quote
01-28-16, 05:53 PM   #6
Baggyman
A Deviate Faerie Dragon
Join Date: Jan 2016
Posts: 12
Thanks for the insight! But I'm not sure I quite fully understand what you are saying. What is the downside or implication if it can not iterate past what buffs are currently displayed?

Also I just tried out your revised logic, and it no longer seems to be hiding buffs.

Last edited by Baggyman : 01-28-16 at 05:55 PM.
  Reply With Quote
01-28-16, 06:11 PM   #7
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
I revised the code, typo =[.

Well, your intention is to manipulate the buffs that the target has, so there is no sense in iterating into the buff frames that are not currently being used.

Remember, frames for buff 1-32 exist, but only the buffs the target has are being used. So, if your target has 5 buffs, there is no point in iterating over the frames for buff 6-32 because they aren't being displayed to begin with.
  Reply With Quote
01-28-16, 06:15 PM   #8
Baggyman
A Deviate Faerie Dragon
Join Date: Jan 2016
Posts: 12
Ok that makes sense. But does your logic fix that? It seems you just changed out s with self, made line 3 local, and changed line 7.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Purge Addon Request


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