Thread Tools Display Modes
Old 10-10-10, 09:00 PM   #1
Schnorki
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 14
CancelUnitBuff in Cata

So, since CancelUnitBuff has become protected in Cata, did anyone get the new secure aura header working yet?

Don't have enough time atm to play around forever to get it working, but in what little time I had to try it so far...well, needless to say I couldn't get it running yet otherwise I wouldn't be posting this.

If anyone got new aura icons running yet, including the ability to remove them upon clicking, without getting the protected error msg, I'd much appreciate if you could hook me up with a quick solution here. Thanks.
Schnorki is offline  
Old 10-26-10, 05:55 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,303
Any updates on this topic?
__________________
| Simple is beautiful.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
zork is offline  
Old 10-26-10, 06:17 AM   #3
Syxx
A Rage Talon Dragon Guard
 
Syxx's Avatar
AddOn Author - Click to view addons
Join Date: May 2005
Posts: 334
Is this what you're looking for or even relevant?
__________________
Syxx is online now  
Old 10-26-10, 06:45 AM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,303
Thx.

Addition:

Snippets from the new Blizzard FrameXML files including some documentation on attributes.

FrameXML\SecureGroupHeaders.lua
Code:
--[[
filter = [STRING] -- a pipe-separated list of aura filter options ("RAID" will be ignored)
separateOwn = [NUMBER] -- indicate whether buffs you cast yourself should be separated before (1) or after (-1) others. If 0 or nil, no separation is done.
sortMethod = ["INDEX", "NAME", "TIME"] -- defines how the group is sorted (Default: "INDEX")
sortDir = ["+", "-"] -- defines the sort order (Default: "+")
groupBy = [nil, auraFilter] -- if present, a series of comma-separated filters, appended to the base filter to separate auras into groups within a single stream
includeWeapons = [nil, NUMBER] -- The aura sub-stream before which to include temporary weapon enchants. If nil or 0, they are ignored.
consolidateTo = [nil, NUMBER] -- The aura sub-stream before which to place a proxy for the consolidated header. If nil or 0, consolidation is ignored.
consolidateDuration = [nil, NUMBER] -- the minimum total duration an aura should have to be considered for consolidation (Default: 30)
consolidateThreshold = [nil, NUMBER] -- buffs with less remaining duration than this many seconds should not be consolidated (Default: 10)
consolidateFraction = [nil, NUMBER] -- The fraction of remaining duration a buff should still have to be eligible for consolidation (Default: .10)

template = [STRING] -- the XML template to use for the unit buttons. If the created widgets should be something other than Buttons, append the Widget name after a comma.
weaponTemplate = [STRING] -- the XML template to use for temporary enchant buttons. Can be nil if you preset the tempEnchant1 and tempEnchant2 attributes, or if you don't include temporary enchants.
consolidateProxy = [STRING|Frame] -- Either the button which represents consolidated buffs, or the name of the template used to construct one.
consolidateHeader = [STRING|Frame] -- Either the aura header which contains consolidated buffs, or the name of the template used to construct one.

point = [STRING] -- a valid XML anchoring point (Default: "TOPRIGHT")
minWidth = [nil, NUMBER] -- the minimum width of the container frame
minHeight = [nil, NUMBER] -- the minimum height of the container frame
xOffset = [NUMBER] -- the x-Offset to use when anchoring the unit buttons (Default: width)
yOffset = [NUMBER] -- the y-Offset to use when anchoring the unit buttons (Default: height)
wrapAfter = [NUMBER] -- begin a new row or column after this many auras
wrapXOffset = [NUMBER] -- the x-offset from one row or column to the next
wrapYOffset = [NUMBER] -- the y-offset from one row or column to the next
maxWraps = [NUMBER] -- limit the number of rows or columns
--]]

function SecureAuraHeader_OnLoad(self)
    self:RegisterEvent("UNIT_AURA");
--    self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
end

function SecureAuraHeader_OnUpdate(self)
        local hasMainHandEnchant, hasOffHandEnchant, _;
        hasMainHandEnchant, _, _, hasOffHandEnchant, _, _ = GetWeaponEnchantInfo();
        if ( hasMainHandEnchant ~= self:GetAttribute("_mainEnchanted") ) then
                self:SetAttribute("_mainEnchanted", hasMainHandEnchant);
        end
        if ( hasOffHandEnchant ~= self:GetAttribute("_secondaryEnchanted") ) then
                self:SetAttribute("_secondaryEnchanted", hasOffHandEnchant);
        end
end

function SecureAuraHeader_OnEvent(self, event, ...)
    if ( self:IsVisible() ) then
        local unit = SecureButton_GetUnit(self);
        if ( event == "UNIT_AURA" and ... == unit ) then
                SecureAuraHeader_Update(self);
        end
    end
end

function SecureAuraHeader_OnAttributeChanged(self, name, value)
    if ( name == "_ignore" or self:GetAttribute("_ignore") ) then
        return;
    end
    if ( self:IsVisible() ) then
        SecureAuraHeader_Update(self);
    end
end

local buttons = {};

local function extractTemplateInfo(template, defaultWidget)
        local widgetType;

        if ( template ) then
                template, widgetType = strsplit(",", tostring(template):trim():gsub("%s*,%s*", ","));
                if ( template ~= "" ) then
                        if ( not widgetType or widgetType == "" ) then
                                widgetType = defaultWidget;
                        end
                        return template, widgetType;
                end
        end
        return nil;
end

local function configureAuras(self, auraTable, consolidateTable, weaponPosition)
        local point = self:GetAttribute("point") or "TOPRIGHT";
        local xOffset = tonumber(self:GetAttribute("xOffset")) or 0;
        local yOffset = tonumber(self:GetAttribute("yOffset")) or 0;
        local wrapXOffset = tonumber(self:GetAttribute("wrapXOffset")) or 0;
        local wrapYOffset = tonumber(self:GetAttribute("wrapYOffset")) or 0;
        local wrapAfter = tonumber(self:GetAttribute("wrapAfter"));
        if ( wrapAfter == 0 ) then wrapAfter = nil; end
        local maxWraps = self:GetAttribute("maxWraps");
        local minWidth = tonumber(self:GetAttribute("minWidth")) or 0;
        local minHeight = tonumber(self:GetAttribute("minHeight")) or 0;

        if ( consolidateTable and #consolidateTable == 0 ) then
                consolidateTable = nil;
        end
        local name = self:GetName();

        wipe(buttons);
        local buffTemplate, buffWidget = extractTemplateInfo(self:GetAttribute("template"), "Button");
        if ( buffTemplate ) then
                for i=1, #auraTable do
                        local childAttr = "child"..i;
                        local button = self:GetAttribute("child"..i);
                        if ( button ) then
                                button:ClearAllPoints();
                        else
                                button = CreateFrame(buffWidget, name and name.."AuraButton"..i, self, buffTemplate);
                                setAttributesWithoutResponse(self, childAttr, button, "frameref-"..childAttr, GetFrameHandle(button));
                        end
                        local buffInfo = auraTable[i];
                        button:SetID(buffInfo.index);
                        button:SetAttribute("index", buffInfo.index);
                        button:SetAttribute("filter", buffInfo.filter);
                        buttons[i] = button;
                end
        end
        local deadIndex = #buttons + 1;
        local button = self:GetAttribute("child"..deadIndex);
        while ( button ) do
                button:Hide();
                deadIndex = deadIndex + 1;
                button = self:GetAttribute("child"..deadIndex)
        end

        local consolidateProxy = nil;
        if ( consolidateTable ) then
                consolidateProxy = self:GetAttribute("consolidateProxy");
                if ( type(consolidateProxy) == 'STRING' ) then
                        local template, widgetType = extractTemplateInfo(consolidateProxy, "Button");
                        if ( template ) then
                                consolidateProxy = CreateFrame(widgetType, name and name.."ProxyButton", self, template);
                                setAttributesWithoutResponse(self, "consolidateProxy", consolidateProxy, "frameref-proxy", GetFrameHandle(consolidateProxy));
                        else
                                consolidateProxy = nil;
                        end
                end
                if ( consolidateProxy ) then
                        if ( consolidateTable.position ) then
                                tinsert(buttons, consolidateTable.position, consolidateProxy);
                        else
                                tinsert(buttons, consolidateProxy);
                        end
                        consolidateProxy:ClearAllPoints();
                end
        else
                local consolidateProxy = self:GetAttribute("consolidateProxy");
                if ( consolidateProxy and type(consolidateProxy.Hide) == 'function' ) then
                        consolidateProxy:Hide();
                end
        end
        if ( weaponPosition ) then
                local hasMainHandEnchant, hasOffHandEnchant, _, tempEnchant1, tempEnchant2;
                hasMainHandEnchant, _, _, hasOffHandEnchant, _, _ = GetWeaponEnchantInfo();

                if ( hasOffHandEnchant ) then
                        tempEnchant2 = self:GetAttribute("tempEnchant2");
                        if ( not tempEnchant2 ) then
                                local template, widgetType = extractTemplateInfo(self:GetAttribute("weaponTemplate"), "Button");
                                if ( template ) then
                                        tempEnchant2 = CreateFrame(widgetType, name and name.."TempEnchant2", self, template);
                                        setAttributesWithoutResponse(self, "tempEnchant2", tempEnchant2);
                                end
                        end
                        if ( tempEnchant2 ) then
                                tempEnchant2:ClearAllPoints();
                                local slot = GetInventorySlotInfo("MainHandSlot");
                                tempEnchant2:SetAttribute("target-slot", slot);
                                tempEnchant2:SetID(slot);
                                if ( weaponPosition == 0 ) then
                                        tinsert(buttons, tempEnchant2);
                                else
                                        tinsert(buttons, weaponPosition, tempEnchant2);
                                end
                        end
                else
                        tempEnchant2 = self:GetAttribute("tempEnchant2");
                        if ( tempEnchant2 and type(tempEnchant2.Hide) == 'function' ) then
                                tempEnchant2:Hide();
                        end
                end

                if ( hasMainHandEnchant ) then
                        tempEnchant1 = self:GetAttribute("tempEnchant1");
                        if ( not tempEnchant1 ) then
                                local template, widgetType = extractTemplateInfo(self:GetAttribute("weaponTemplate"), "Button");
                                if ( template ) then
                                        tempEnchant1 = CreateFrame(widgetType, name and name.."TempEnchant1", self, template);
                                        setAttributesWithoutResponse(self, "tempEnchant1", tempEnchant1);
                                end
                        end
                        if ( tempEnchant1 ) then
                                tempEnchant1:ClearAllPoints();
                                local slot = GetInventorySlotInfo("MainHandSlot");
                                tempEnchant1:SetAttribute("target-slot", slot);
                                tempEnchant1:SetID(slot);
                                if ( weaponPosition == 0 ) then
                                        tinsert(buttons, tempEnchant1);
                                else
                                        tinsert(buttons, weaponPosition, tempEnchant1);
                                end
                        end
                else
                        tempEnchant1 = self:GetAttribute("tempEnchant1");
                        if ( tempEnchant1 and type(tempEnchant1.Hide) == 'function' ) then
                                tempEnchant1:Hide();
                        end
                end
        end

        local display = #buttons
        if ( wrapAfter and maxWraps ) then
                display = min(display, wrapAfter * maxWraps);
        end

        local left, right, top, bottom = math.huge, 0, 0, math.huge;
        for index=1,display do
                local button = buttons[index];
                local tick, cycle = floor((index - 1) % wrapAfter), floor((index - 1) / wrapAfter);
                button:SetPoint(point, self, cycle * wrapXOffset + tick * xOffset, cycle * wrapYOffset + tick * yOffset);
                button:Show();
                left = min(left, button:GetLeft() or math.huge);
                right = max(right, button:GetRight() or 0);
                top = max(top, button:GetTop() or 0);
                bottom = min(bottom, button:GetBottom() or math.huge);
        end
        if ( display >= 1 ) then
                self:SetWidth(max(right - left, minWidth));
                self:SetHeight(max(top - bottom, minHeight));
        else
                self:SetWidth(minWidth);
                self:SetHeight(minHeight);
        end
        if ( consolidateTable ) then
                local header = self:GetAttribute("consolidateHeader");
                if ( type(header) == 'STRING' ) then
                        local template, widgetType = extractTemplateInfo(header, "Frame");
                        if ( template ) then
                                header = CreateFrame(widgetType, name and name.."ProxyHeader", consolidateProxy, template);
                                setAttributesWithoutResponse(self, "consolidateHeader", header);
                                consolidateProxy:SetAttribute("header", header);
                                consolidateProxy:SetAttribute("frameref-header", GetFrameHandle(header))
                        end
                end
                if ( header ) then
                        configureAuras(header, consolidateTable);
                end
        end
end

local tremove = table.remove;

local function stripRAID(filter)
        return filter and tostring(filter):upper():gsub("RAID", ""):gsub("|+", "|"):match("^|?(.+[^|])|?$");
end

local freshTable;
local releaseTable;
do
        local tableReserve = {};
        freshTable = function ()
                local t = next(tableReserve) or {};
                tableReserve[t] = nil;
                return t;
        end
        releaseTable = function (t)
                tableReserve[t] = wipe(t);
        end
end

local sorters = {};

local function sortFactory(key, separateOwn, reverse)
        if ( separateOwn ) then
                if ( reverse ) then
                        return function (a, b)
                                if ( groupingTable[a.filter] == groupingTable[b.filter] ) then
                                        local ownA, ownB = a.caster == "player", b.caster == "player";
                                        if ( ownA ~= ownB ) then
                                                return ownA == (separateOwn > 0)
                                        end
                                        return a[key] > b[key];
                                else
                                        return groupingTable[a.filter] < groupingTable[b.filter];
                                end
                        end;
                else
                        return function (a, b)
                                if ( groupingTable[a.filter] == groupingTable[b.filter] ) then
                                        local ownA, ownB = a.caster == "player", b.caster == "player";
                                        if ( ownA ~= ownB ) then
                                                return ownA == (separateOwn > 0)
                                        end
                                        return a[key] < b[key];
                                else
                                        return groupingTable[a.filter] < groupingTable[b.filter];
                                end
                        end;
                end
        else
                if ( reverse ) then
                        return function (a, b)
                                if ( groupingTable[a.filter] == groupingTable[b.filter] ) then
                                        return a[key] > b[key];
                                else
                                        return groupingTable[a.filter] < groupingTable[b.filter];
                                end
                        end;
                else
                        return function (a, b)
                                if ( groupingTable[a.filter] == groupingTable[b.filter] ) then
                                        return a[key] < b[key];
                                else
                                        return groupingTable[a.filter] < groupingTable[b.filter];
                                end
                        end;
                end
        end
end

for i, key in ipairs{"index", "name", "expires"} do
        local label = key:upper();
        sorters[label] = {};
        for bool in pairs{[true] = true, [false] = false} do
                sorters[label][bool] = {}
                for sep=-1,1 do
                        sorters[label][bool][sep] = sortFactory(key, sep, bool);
                end
        end
end
sorters.TIME = sorters.EXPIRES;

function SecureAuraHeader_Update(self)
        local filter = self:GetAttribute("filter");
        local groupBy = self:GetAttribute("groupBy");
        local unit = SecureButton_GetUnit(self) or "player";
        local includeWeapons = tonumber(self:GetAttribute("includeWeapons"));
        local consolidateTo = tonumber(self:GetAttribute("consolidateTo"));
        local consolidateDuration, consolidateThreshold, consolidateFraction;
        if ( consolidateTo ) then
                consolidateDuration = tonumber(self:GetAttribute("consolidateDuration")) or 30;
                consolidateThreshold = tonumber(self:GetAttribute("consolidateThreshold")) or 10;
                consolidateFraction = tonumber(self:GetAttribute("consolidateFraction")) or 0.1;
        end
        local sortDirection = self:GetAttribute("sortDirection");
        local separateOwn = tonumber(self:GetAttribute("separateOwn")) or 0;
        if ( separateOwn > 0 ) then
                separateOwn = 1;
        elseif (separateOwn < 0 ) then
                separateOwn = -1;
        end
        local sortMethod = (sorters[tostring(self:GetAttribute("sortMethod")):upper()] or sorters["INDEX"])[sortDirection == "-"][separateOwn];

        local time = GetTime();

        local consolidateTable;
        if ( consolidateTo and consolidateTo ~= 0 ) then
                consolidateTable = wipe(tokenTable);
        end

        wipe(sortingTable);
        wipe(groupingTable);

        if ( groupBy ) then
                local i = 1;
                for subFilter in groupBy:gmatch("[^,]+") do
                        if ( filter ) then
                                subFilter = stripRAID(filter.."|"..subFilter);
                        else
                                subFilter = stripRAID(subFilter);
                        end
                        groupingTable[subFilter], groupingTable[i] = i, subFilter;
                end
        else
                filter = stripRAID(filter);
                groupingTable[filter], groupingTable[1] = 1, filter;
        end
        if ( consolidateTable and consolidateTo < 0 ) then
                consolidateTo = #groupingTable + consolidateTo + 1;
        end
        if ( includeWeapons and includeWeapons < 0 ) then
                includeWeapons = #groupingTable + includeWeapons + 1;
        end
        local weaponPosition;
        for filterIndex, fullFilter in ipairs(groupingTable) do
                if ( consolidateTable and not consolidateTable.position and filterIndex >= consolidateTo ) then
                        consolidateTable.position = #sortingTable + 1;
                end
                if ( includeWeapons and not weaponPosition and filterIndex >= includeWeapons ) then
                        weaponPosition = #sortingTable + 1;
                end

                local i = 1;
                repeat
                        local aura, _, duration = freshTable();
                        aura.name, _, _, _, _, duration, aura.expires, aura.caster, _, aura.shouldConsolidate, _ = UnitAura(unit, i, fullFilter);
                        if ( aura.name ) then
                                aura.filter = fullFilter;
                                aura.index = i;
                                local targetList = sortingTable;
                                if ( consolidateTable and aura.shouldConsolidate ) then
                                        if ( not aura.expires or duration <= 30 or (aura.expires - time < max(consolidateThreshold, duration * consolidateFraction)) ) then
                                                targetList = consolidateTable;
                                        end
                                end
                                tinsert(targetList, aura);
                        else
                                releaseTable(aura);
                        end
                        i = i + 1;
                until ( not aura.name );
        end
        if ( includeWeapons and not weaponPosition ) then
                weaponPosition = 0;
        end
        table.sort(sortingTable, sortMethod);
        if ( consolidateTable ) then
                table.sort(consolidateTable, sortMethod);
        end

        configureAuras(self, sortingTable, consolidateTable, weaponPosition);
        while ( sortingTable[1] ) do
                releaseTable(tremove(sortingTable));
        end
        while ( consolidateTable and consolidateTable[1] ) do
                releaseTable(tremove(consolidateTable));
        end
end
FrameXML\SecureGroupHeaders.xml
Code:
    <!-- A frame used for managing group pets -->
    <Frame name="SecureAuraHeaderTemplate" inherits="SecureFrameTemplate" hidden="true" virtual="true">
        <Scripts>
            <OnLoad function="SecureAuraHeader_OnLoad"/>
            <OnEvent function="SecureAuraHeader_OnEvent"/>
            <OnShow function="SecureAuraHeader_Update"/>
            <OnUpdate function="SecureAuraHeader_OnUpdate" />
            <OnAttributeChanged function="SecureAuraHeader_OnAttributeChanged"/>
        </Scripts>
    </Frame>
__________________
| Simple is beautiful.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-26-10 at 06:47 AM.
zork is offline  
Old 10-26-10, 06:53 AM   #5
ms998
A Defias Bandit
Join Date: Dec 2006
Posts: 2
Elkbuffbars has something working that enables buffs to be cancelled out of combat. Perhaps look at that for initial code.

http://wow.curse.com/downloads/wow-a...kbuffbars.aspx
ms998 is offline  
Old 10-26-10, 07:10 AM   #6
Syxx
A Rage Talon Dragon Guard
 
Syxx's Avatar
AddOn Author - Click to view addons
Join Date: May 2005
Posts: 334
Goldpaw has it working fine with gbuff as well.
__________________

Last edited by Syxx : 10-26-10 at 07:11 AM. Reason: link stupid.
Syxx is online now  
Old 10-26-10, 07:12 AM   #7
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 317
Moving and styling Blizzards buffs shouldn't cause taint should it? Only filtering and sorting.
__________________
Oh, the simulated horror!
Ailae is offline  
Old 10-26-10, 08:09 AM   #8
Luzzifus
A Warpwood Thunder Caller
 
Luzzifus's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 94
nivBuffs works fine too.

Last edited by Luzzifus : 10-26-10 at 08:13 AM.
Luzzifus is offline  
Old 10-26-10, 01:34 PM   #9
p3lim
Mmmrrrggglll
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,167
Only issues I currently have are these:
- Buffs/debuffs doesnt show when gained
- Using negative sort direction is bugged, point is forced TOPRIGHT (atleast seems so) when losing buff/debuff

Havent tried out temp yet, as I have no use for them myself.
p3lim is offline  
Old 10-26-10, 02:06 PM   #10
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,303
Originally Posted by p3lim View Post
- Buffs/debuffs doesnt show when gained
What does that mean? That would make buffs not appear at all. Err...or is that a time?
__________________
| Simple is beautiful.
| Roth UI | Roth UI FAQ | GoogleCode | Zork | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
zork is offline  
Old 10-26-10, 02:53 PM   #11
p3lim
Mmmrrrggglll
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,167
Originally Posted by zork View Post
What does that mean? That would make buffs not appear at all. Err...or is that a time?
All the time, gotta reload to show them
p3lim is offline  
Old 10-26-10, 03:04 PM   #12
Luzzifus
A Warpwood Thunder Caller
 
Luzzifus's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 94
Originally Posted by p3lim View Post
Only issues I currently have are these:
- Buffs/debuffs doesnt show when gained
- Using negative sort direction is bugged, point is forced TOPRIGHT (atleast seems so) when losing buff/debuff

Havent tried out temp yet, as I have no use for them myself.
Which addon are you referring to?
Luzzifus is offline  
Old 10-26-10, 03:18 PM   #13
p3lim
Mmmrrrggglll
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,167
Originally Posted by Luzzifus View Post
Which addon are you referring to?
My own.
http://pastebin.com/y64KVuiZ
p3lim is offline  
Old 10-26-10, 03:45 PM   #14
Luzzifus
A Warpwood Thunder Caller
 
Luzzifus's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 94
I've had some issues with buffs not correctly updating myself. Basically, doing this ...
lua Code:
  1. header:SetScript('OnEvent', ParseAuras)
...before the headers are completely initialized seems to be a bad idea. I solved most of these problems by maintaining a structure like this:

lua Code:
  1. local nivBuffs = CreateFrame("Frame", "nivBuffs")
  2.  
  3. local buffHeader = CreateFrame("Frame", "nivBuffs_Buffs", nil, "SecureAuraHeaderTemplate")
  4. local debuffHeader = CreateFrame("Frame", "nivBuffs_Debuffs", nil, "SecureAuraHeaderTemplate")
  5.  
  6. do
  7.     local function setHeaderAttributes(header, template, filter, buff)
  8.         header:SetAttribute("unit", "player")
  9.         --set more attributes --
  10.     end
  11.  
  12.     setHeaderAttributes(buffHeader, "nivBuffButtonTemplate", "HELPFUL", true)
  13.     buffHeader:SetPoint(nivBuffDB.buffAnchorFrom, nivBuffDB.buffAnchorFrame, nivBuffDB.buffAnchorTo, nivBuffDB.buffXpos, nivBuffDB.buffYpos)
  14.     buffHeader:Show()
  15.  
  16.     setHeaderAttributes(debuffHeader, "nivDebuffButtonTemplate", "HARMFUL", false)
  17.     debuffHeader:SetPoint(nivBuffDB.debuffAnchorFrom, nivBuffDB.debuffAnchorFrame, nivBuffDB.debuffAnchorTo, nivBuffDB.debuffXpos, nivBuffDB.debuffYpos)
  18.     debuffHeader:Show()    
  19. end
  20.  
  21. --many local functions for updating --
  22.  
  23. local function updateStyle(self, event, unit)
  24.     --update style --
  25. end
  26.  
  27. -- hide blizz auras --
  28.  
  29. nivBuffs:RegisterEvent("PLAYER_ENTERING_WORLD")
  30. nivBuffs:RegisterEvent("UNIT_AURA")
  31. nivBuffs:SetScript("OnEvent", updateStyle)
Of course, you may also get more inspiration from my whole code, if that doesn't spoil too much of the fun for you.

Last edited by Luzzifus : 10-26-10 at 03:48 PM.
Luzzifus is offline  
Old 10-26-10, 04:03 PM   #15
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 317
I've been tinkering myself with a buff-addon, since such a nice tutorial was provided by sigg in that other thread. Most of the stuff work, although it bugs me that it sorts auras with 0 duration (=permanent) before auras with a short duration..

I also have a issue with vehiclebuffs at the moment, they gain/disappear correctly except for stacks - namely the vehicle-mounts at the Argent Tournament. The 'Defend'-skill buff shows up alright, but if I lose a charge, it doesn't update (since the returns are different depending on the unit you provide to UnitAura(unit, "Defend") I guess).

But I don't do anything fancy with my buffs, I basically just remade the old skinned Furbish-version I had - for funsies.
__________________
Oh, the simulated horror!
Ailae is offline  
Old 10-27-10, 02:59 AM   #16
sigg
Featured Artist
 
sigg's Avatar
Featured
Join Date: Aug 2008
Posts: 1,200
Your style function is registering the event UNIT_AURA.
The headeraura engine is also registering UNIT_AURA.

Your style function is always call before the headeraura ! That's the big problem. You can't do nothing for that.

So if you are able to delay your style function to the next frame, it should work as expected.
sigg is offline  
Old 10-27-10, 03:08 AM   #17
Luzzifus
A Warpwood Thunder Caller
 
Luzzifus's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 94
Originally Posted by sigg View Post
So if you are able to delay your style function to the next frame, it should work as expected.
In my experience that is not neccessary. And when I tried doing that in the beginning, it didn't change anything.
Luzzifus is offline  
Old 10-27-10, 03:20 AM   #18
sigg
Featured Artist
 
sigg's Avatar
Featured
Join Date: Aug 2008
Posts: 1,200
You are right.

this problem is only localize in RDX.

sigg is offline  
Old 10-27-10, 02:28 PM   #19
p3lim
Mmmrrrggglll
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,167
Replacing SetScript with HookScript should do the trick
p3lim is offline  
Old 10-27-10, 03:02 PM   #20
p3lim
Mmmrrrggglll
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,167
I've put together a very basic implemention of the SecureAuraHeaderTemplate using no libs or whatever for those who need it:

MyAddon.lua
lua Code:
  1. local function UpdateStyle(header, button, unit)
  2.     local name = UnitAura(unit, button:GetID(), header:GetAttribute('filter'))
  3.  
  4.     -- insert magic
  5. end
  6.  
  7. local function OnEvent(self, event, unit)
  8.     local secureUnit = SecureButton_GetUnit(self)
  9.     if(not self:IsShown() or (unit and unit ~= secureUnit)) then return end
  10.  
  11.     local col = self:GetAttribute('wrapAfter')
  12.     local row = self:GetAttribute('maxWraps')
  13.     for index = 1, col * row do
  14.         local child = self:GetAttribute('child' .. index)
  15.         if(child) then
  16.             UpdateStyle(self, child, secureUnit)
  17.         end
  18.     end
  19. end
  20.  
  21. local header = CreateFrame('Frame', nil, UIParent, 'SecureAuraHeaderTemplate')
  22. header:SetPoint('CENTER')
  23. header:HookScript('OnEvent', OnEvent)
  24.  
  25. -- Required attributes
  26. header:SetAttribute('unit', 'player')
  27. header:SetAttribute('minWidth', 350)
  28. header:SetAttribute('minHeight', 140)
  29. header:SetAttribute('template', 'MyAddonAuraTemplate') -- your XML template
  30. header:SetAttribute('filter', 'HELPFUL')
  31. header:SetAttribute('xOffset', 35)
  32. header:SetAttribute('wrapYOffset', 35)
  33. header:SetAttribute('wrapAfter', 10)
  34. header:SetAttribute('maxWraps', 4)
  35. header:Show()
  36.  
  37. -- Force update on login
  38. OnEvent(header)
  39.  
  40.  
  41. --[[
  42.     Full list of attributes
  43.  
  44.     filter = [STRING] -- a pipe-separated list of aura filter options ("RAID" will be ignored)
  45.     separateOwn = [NUMBER] -- indicate whether buffs you cast yourself should be separated before (1) or after (-1) others. If 0 or nil, no separation is done.
  46.     sortMethod = ["INDEX", "NAME", "TIME"] -- defines how the group is sorted (Default: "INDEX")
  47.     sortDirection = ["+", "-"] -- defines the sort order (Default: "+")
  48.     groupBy = [nil, auraFilter] -- if present, a series of comma-separated filters, appended to the base filter to separate auras into groups within a single stream
  49.     includeWeapons = [nil, NUMBER] -- The aura sub-stream before which to include temporary weapon enchants. If nil or 0, they are ignored.
  50.     consolidateTo = [nil, NUMBER] -- The aura sub-stream before which to place a proxy for the consolidated header. If nil or 0, consolidation is ignored.
  51.     consolidateDuration = [nil, NUMBER] -- the minimum total duration an aura should have to be considered for consolidation (Default: 30)
  52.     consolidateThreshold = [nil, NUMBER] -- buffs with less remaining duration than this many seconds should not be consolidated (Default: 10)
  53.     consolidateFraction = [nil, NUMBER] -- The fraction of remaining duration a buff should still have to be eligible for consolidation (Default: .10)
  54.  
  55.     template = [STRING] -- the XML template to use for the unit buttons. If the created widgets should be something other than Buttons, append the Widget name after a comma.
  56.     weaponTemplate = [STRING] -- the XML template to use for temporary enchant buttons. Can be nil if you preset the tempEnchant1 and tempEnchant2 attributes, or if you don't include temporary enchants.
  57.     consolidateProxy = [STRING|Frame] -- Either the button which represents consolidated buffs, or the name of the template used to construct one.
  58.     consolidateHeader = [STRING|Frame] -- Either the aura header which contains consolidated buffs, or the name of the template used to construct one.
  59.  
  60.     point = [STRING] -- a valid XML anchoring point (Default: "TOPRIGHT")
  61.     minWidth = [nil, NUMBER] -- the minimum width of the container frame
  62.     minHeight = [nil, NUMBER] -- the minimum height of the container frame
  63.     xOffset = [NUMBER] -- the x-Offset to use when anchoring the unit buttons (Default: width)
  64.     yOffset = [NUMBER] -- the y-Offset to use when anchoring the unit buttons (Default: height)
  65.     wrapAfter = [NUMBER] -- begin a new row or column after this many auras
  66.     wrapXOffset = [NUMBER] -- the x-offset from one row or column to the next
  67.     wrapYOffset = [NUMBER] -- the y-offset from one row or column to the next
  68.     maxWraps = [NUMBER] -- limit the number of rows or columns
  69. --]]

MyAddon.xml:
xml Code:
  1. <Ui xmlns='http://www.blizzard.com/wow/ui'>
  2.     <Button name='MyAddonAuraTemplate' inherits='SecureActionButtonTemplate' virtual='true'>
  3.         <Size x='26' y='26'/>
  4.         <Attributes>
  5.             <Attribute name='type' value='cancelaura'/>
  6.         </Attributes>
  7.         <Scripts>
  8.             <OnLoad>
  9.                 self:RegisterForClicks('RightButtonUp')
  10.             </OnLoad>
  11.             <OnEnter>
  12.                 GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT')
  13.                 GameTooltip:SetUnitAura(SecureButton_GetUnit(self:GetParent()), self:GetID(), self:GetParent():GetAttribute('filter'))
  14.             </OnEnter>
  15.             <OnLeave function='GameTooltip_Hide'/>
  16.         </Scripts>
  17.     </Button>
  18. </Ui>

Last edited by p3lim : 10-28-10 at 08:15 AM. Reason: typos
p3lim is offline  
 

Go BackWoWInterface » AddOns, Compilations, Macros » Cataclysm Beta » CancelUnitBuff in Cata

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