WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   A Few Questions Regarding oUF_Karma (https://www.wowinterface.com/forums/showthread.php?t=42729)

MiRai 03-01-12 04:45 AM

A Few Questions Regarding oUF_Karma
 
I would normally ask these questions on the add-on's page itself but, there hasn't been much activity over there lately so I thought I would ask here in the oUF forum.

These questions are regarding oUF_Karma.

1. How would I go about adding the player (myself) into the list of party members? Right now, the party list only shows my other party members but not myself.

2. Is it possible to sort the party members? Either by index or alphabetically?

3. How would I go about fading out the player frame when I do not have a target and then once a target is acquired, having the frame fade back in? I was hoping to get a nice smooth fade and not a hard on/off look.

4. If #3 is possible, how would I go about fading out the list of party members and focus in sync with the player frame?

Thank you for your time.
-MiRai (ilillillil)

p3lim 03-01-12 12:54 PM

1:
Line 478: "showPlayer", true,

2:
Below that line, add the following:
"sortMethod", "INDEX",
or
"sortMethod", "NAME",

MiRai 03-01-12 03:30 PM

Quote:

Originally Posted by p3lim (Post 253291)
1:
Line 478: "showPlayer", true,

2:
Below that line, add the following:
"sortMethod", "INDEX",
or
"sortMethod", "NAME",

Thanks. I'm slightly disappointed I didn't see the answer to number 1 myself this morning; it must've been too early. ;)

MiRai 03-01-12 05:07 PM

Digging a little deeper I found this thread about getting oUF_BarFader to work.

In an attempt to get this working, does post #3 from that thread still hold true or is this now completely outdated with the newest version of oUF?

Quote:

Originally Posted by Rainrider (Post 237634)
oUF_BarFader is outdated but easy to fix.

UNIT_FOCUS, UNIT_ENERGY, UNIT_RAGE, UNIT_MANA and UNIT_RUNIC_POWER got merged into UNIT_POWER.

UNIT_HAPPINESS, GetPetHappiness(), UnitMana(), UnitManaMax() are no more.

For party/raid check you could try registering PARTY_LEADER_CHANGED (not sure right now if this gets fired upon joining a raid) and check GetNumPartyMembers() and GetNumRaidMembers(). Alternatively use PARTY_MEMBERS_CHANGED and RAID_ROSTER_UPDATE if PARTY_LEADER_CHANGED is not fired as wished.

You then have to add oUF_BarFader as OptDep to the .toc of your layout and set 'self.BarFade = true' and 'self.BarFadeMinAlpha = 0' for your player frame.


p3lim 03-02-12 04:25 AM

Due to the high amount of requests, I have updated the plug-in.
http://www.wowinterface.com/download...-oUFFader.html

MiRai 03-02-12 03:57 PM

Quote:

Originally Posted by p3lim (Post 253335)
Due to the high amount of requests, I have updated the plug-in.
http://www.wowinterface.com/download...-oUFFader.html

Much appreciated.

My next issue is, after adding oUF_Fader to Karma's TOC optional dependencies, all of my unit frames are at a lowered opacity and they will not change based on anything I do in game. I'm sure I should be adding values such as "self.something" into Karma's core.lua but, I'm unclear of what I should be adding and where. I've tried a few entries myself with no joy so, I've returned here.

Thanks.

oUF_Karma's core.lua
lua Code:
  1. local addon, ns = ...
  2.  
  3.   local cfg = ns.cfg
  4.   local lib = ns.lib
  5.  
  6.     -- Unit has an Aura
  7.     function hasUnitAura(unit, name)
  8.    
  9.         local _, _, _, count, _, _, _, caster = UnitAura(unit, name)
  10.         if (caster and caster == "player") then
  11.             return count
  12.         end
  13.     end
  14.    
  15.     -- Unit has a Debuff
  16.     function hasUnitDebuff(unit, name)
  17.        
  18.         local _, _, _, count, _, _, _, _ = UnitDebuff(unit, name)
  19.         if (count) then return count
  20.         end
  21.     end
  22.            
  23. local MyPvPUpdate = function(self, event, unit)
  24.     if(unit ~= self.unit) then return end
  25.  
  26.     local pvp = self.MyPvP
  27.     if(pvp) then
  28.         local factionGroup = UnitFactionGroup(unit)
  29.         -- FFA!
  30.         if(UnitIsPVPFreeForAll(unit)) then
  31.             pvp:SetTexture([[Interface\TargetingFrame\UI-PVP-FFA]])
  32.             pvp:Show()
  33.         elseif(UnitIsPVP(unit) and factionGroup) then
  34.             if(factionGroup == 'Horde') then
  35.                 pvp:SetTexture([[Interface\Addons\oUF_Fail\media\Horde]])
  36.             else
  37.                 pvp:SetTexture([[Interface\Addons\oUF_Fail\media\Alliance]])
  38.             end
  39.             pvp:Show()
  40.         else
  41.             pvp:Hide()
  42.         end
  43.     end
  44. end
  45.  
  46. oUF.colors.smooth = {42/255,48/255,50/255, 42/255,48/255,50/255, 42/255,48/255,50/255}
  47.   -----------------------------
  48.   -- STYLE FUNCTIONS
  49.   -----------------------------
  50.  
  51. local UnitSpecific = {
  52.  
  53.     player = function(self, ...)
  54.  
  55.         self.mystyle = "player"
  56.        
  57.         -- Size and Scale
  58.         self:SetScale(cfg.scale)
  59.         self:SetSize(250, 29)
  60.  
  61.         -- Generate Bars
  62.         lib.gen_hpbar(self)
  63.         lib.gen_hpstrings(self)
  64.         lib.gen_highlight(self)
  65.         lib.gen_ppbar(self)
  66.         lib.gen_RaidMark(self)
  67.         lib.gen_combat_feedback(self)
  68.         lib.gen_InfoIcons(self)
  69.         lib.HealPred(self)
  70.        
  71.         -- Buffs and Debuffs
  72.         if cfg.showPlayerAuras then
  73.             BuffFrame:Hide()
  74.             lib.createBuffs(self)
  75.             lib.createDebuffs(self)
  76.             lib.gen_WeaponEnchant(self)
  77.         end
  78.  
  79.         self.Health.frequentUpdates = true
  80.         self.Health.colorSmooth = true
  81.         self.Health.Smooth = true
  82.         -- self.Health.bg.multiplier = 0.2
  83.         self.Power.colorPower = true
  84.         self.Power.Smooth = true
  85.         self.Power.frequentUpdates = true
  86.         self.Power.bg.multiplier = 0.5
  87.         lib.gen_castbar(self)
  88.         lib.debuffHighlight(self)
  89.  
  90.         -- PvP Icon
  91.         local pvp = self.Health:CreateTexture(nil, "OVERLAY")
  92.         pvp:SetHeight(32)
  93.         pvp:SetWidth(32)
  94.         pvp:SetPoint("TOPRIGHT", 10, 10)
  95.         self.MyPvP = pvp
  96.  
  97.         -- This makes oUF update the information.
  98.         self:RegisterEvent("UNIT_FACTION", MyPvPUpdate)
  99.         -- This makes oUF update the information on forced updates.
  100.         table.insert(self.__elements, MyPvPUpdate)
  101.  
  102.         if cfg.showRunebar then lib.genRunes(self) end
  103.         if cfg.showHolybar then lib.genHolyPower(self) end
  104.         if cfg.showShardbar then lib.genShards(self) end
  105.         if cfg.showEclipsebar then lib.addEclipseBar(self) end
  106.        
  107.         -- Addons
  108.         if cfg.showTotemBar then lib.gen_TotemBar(self) end
  109.         if cfg.showVengeance then lib.gen_Vengeance(self) end
  110.        
  111.     end,
  112.    
  113.     target = function(self, ...)
  114.    
  115.         self.mystyle = "target"
  116.        
  117.         -- Size and Scale
  118.         self:SetScale(cfg.scale)
  119.         self:SetSize(250,29)
  120.  
  121.         -- Generate Bars
  122.         lib.gen_hpbar(self)
  123.         lib.gen_hpstrings(self)
  124.         lib.gen_highlight(self)
  125.         lib.gen_ppbar(self)
  126.         lib.gen_RaidMark(self)
  127.         lib.gen_combat_feedback(self)
  128.         lib.RogueComboPoints(self)
  129.  
  130.         --style specific stuff
  131.         self.Health.frequentUpdates = true
  132.         self.Health.colorSmooth = true
  133.         self.Health.Smooth = true
  134.         -- self.Health.bg.multiplier = 0.3
  135.         self.Power.frequentUpdates = true
  136.         self.Power.Smooth = true
  137.         self.Power.colorTapping = true
  138.         self.Power.colorDisconnected = true
  139.         self.Power.colorHappiness = false
  140.         self.Power.colorHealth = true
  141.         self.Power.colorReaction = true
  142.         self.Power.colorClass = true
  143.         self.Power.bg.multiplier = 0.5
  144.         lib.gen_castbar(self)
  145.         lib.gen_mirrorcb(self)
  146.         lib.debuffHighlight(self)
  147.         lib.HealPred(self)
  148.  
  149.         if cfg.showTargetBuffs then lib.createBuffs(self) end
  150.         if cfg.showTargetDebuffs then lib.createDebuffs(self) end
  151.  
  152.     end,
  153.    
  154.     focus = function(self, ...)
  155.    
  156.         self.mystyle = "focus"
  157.        
  158.         -- Size and Scale
  159.         self:SetScale(cfg.scale)
  160.         self:SetSize(120, 29)
  161.        
  162.         -- Generate Bars
  163.         lib.gen_hpbar(self)
  164.         lib.gen_hpstrings(self)
  165.         lib.gen_highlight(self)
  166.         lib.gen_ppbar(self)
  167.         lib.gen_RaidMark(self)
  168.  
  169.         --style specific stuff
  170.         self.Health.frequentUpdates = true
  171.         self.Health.Smooth = true
  172.         self.Health.colorSmooth = true
  173.         -- self.Health.bg.multiplier = 0.3
  174.         self.Power.Smooth = true
  175.         self.Power.colorTapping = true
  176.         self.Power.colorDisconnected = true
  177.         self.Power.colorHappiness = false
  178.         self.Power.colorClass = true
  179.         self.Power.colorReaction = true
  180.         self.Power.colorHealth = true
  181.         self.Power.bg.multiplier = 0.5
  182.         lib.gen_castbar(self)
  183.        
  184.     end,
  185.    
  186.     targettarget = function(self, ...)
  187.  
  188.         self.mystyle = "tot"
  189.        
  190.         -- Size and Scale
  191.         self:SetScale(cfg.scale)
  192.         self:SetSize(120, 29)
  193.  
  194.         -- Generate Bars
  195.         lib.gen_hpbar(self)
  196.         lib.gen_hpstrings(self)
  197.         lib.gen_highlight(self)
  198.         lib.gen_ppbar(self)
  199.         lib.gen_RaidMark(self)
  200.  
  201.         --style specific stuff
  202.         self.Health.frequentUpdates = true
  203.         self.Health.colorSmooth = true
  204.         self.Health.Smooth = true
  205.         -- self.Health.bg.multiplier = 0.3
  206.         self.Power.Smooth = true
  207.         self.Power.colorTapping = true
  208.         self.Power.colorDisconnected = true
  209.         self.Power.colorHappiness = false
  210.         self.Power.colorClass = true
  211.         self.Power.colorReaction = true
  212.         self.Power.colorHealth = true
  213.         self.Power.bg.multiplier = 0.5
  214.         --lib.gen_castbar(self)
  215.  
  216.     end,
  217.    
  218.     focustarget = function(self, ...)
  219.        
  220.         self.mystyle = "focustarget"
  221.        
  222.         -- Size and Scale
  223.         self:SetScale(cfg.scale)
  224.         self:SetSize(120, 29)
  225.  
  226.         -- Generate Bars
  227.         lib.gen_hpbar(self)
  228.         lib.gen_hpstrings(self)
  229.         lib.gen_highlight(self)
  230.         lib.gen_ppbar(self)
  231.         lib.gen_RaidMark(self)
  232.        
  233.         --style specific stuff
  234.         self.Health.frequentUpdates = true
  235.         self.Health.colorSmooth = true
  236.         -- self.Health.bg.multiplier = 0.3
  237.         self.Power.colorTapping = true
  238.         self.Power.colorDisconnected = true
  239.         self.Power.colorHappiness = false
  240.         self.Power.colorClass = true
  241.         self.Power.colorReaction = true
  242.         self.Power.colorHealth = true
  243.         self.Power.bg.multiplier = 0.5
  244.         lib.gen_castbar(self)
  245.    
  246.     end,
  247.    
  248.     pet = function(self, ...)
  249.         local _, playerClass = UnitClass("player")
  250.        
  251.         self.mystyle = "pet"
  252.        
  253.         -- Size and Scale
  254.         self:SetScale(cfg.scale)
  255.         self:SetSize(90,29)
  256.  
  257.         -- Generate Bars
  258.         lib.gen_hpbar(self)
  259.         lib.gen_hpstrings(self)
  260.         lib.gen_highlight(self)
  261.         lib.gen_ppbar(self)
  262.         lib.gen_RaidMark(self)
  263.        
  264.         --style specific stuff
  265.         self.Health.frequentUpdates = true
  266.         self.Health.colorSmooth = true
  267.         self.Health.Smooth = true
  268.         -- self.Health.bg.multiplier = 0.3
  269.         self.Power.Smooth = true
  270.         self.Power.colorTapping = true
  271.         self.Power.colorDisconnected = true
  272.         self.Power.colorHappiness = false
  273.         self.Power.colorClass = true
  274.         self.Power.colorReaction = true
  275.         self.Power.colorPower = true
  276.         self.Power.bg.multiplier = 0.5
  277.         lib.gen_castbar(self)
  278.  
  279.     end,
  280.  
  281.   raid = function(self, ...)
  282.                
  283.         self.mystyle = "raid"
  284.        
  285.         self.Range = {
  286.             insideAlpha = 1,
  287.             outsideAlpha = .3,
  288.         }
  289.  
  290.         -- Generate Bars
  291.         lib.gen_hpbar(self)
  292.         lib.gen_hpstrings(self)
  293.         lib.gen_highlight(self)
  294.         lib.gen_ppbar(self)
  295.         lib.gen_RaidMark(self)
  296.         lib.ReadyCheck(self)
  297.  
  298.         --style specific stuff
  299.         self.Health.frequentUpdates = true
  300.         self.Health.colorSmooth = true
  301.         -- self.Health.bg.multiplier = 0.3
  302.         self.Power.colorClass = true
  303.         self.Power.bg.multiplier = 0.5
  304.         lib.gen_InfoIcons(self)
  305.         lib.CreateTargetBorder(self)
  306.         lib.CreateThreatBorder(self)
  307.         lib.HealPred(self)
  308.         lib.debuffHighlight(self)
  309.         lib.raidDebuffs(self)
  310.         lib.addPhaseIcon(self)
  311.         lib.createAuraWatch(self, unit)
  312.  
  313.         self.Health.PostUpdate = lib.PostUpdateRaidFrame
  314.         self:RegisterEvent('PLAYER_TARGET_CHANGED', lib.ChangedTarget)
  315.         self:RegisterEvent('RAID_ROSTER_UPDATE', lib.ChangedTarget)
  316.         self:RegisterEvent("UNIT_THREAT_LIST_UPDATE", lib.UpdateThreat)
  317.         self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", lib.UpdateThreat)
  318.     end,
  319.  
  320.     party = function(self, ...)
  321.                
  322.         self.mystyle = "party"
  323.  
  324.         self.Range = {
  325.             insideAlpha = 1,
  326.             outsideAlpha = .3,
  327.         }
  328.  
  329.         -- Generate Bars
  330.         lib.gen_hpbar(self)
  331.         lib.gen_hpstrings(self)
  332.         lib.gen_highlight(self)
  333.         lib.gen_ppbar(self)
  334.         lib.gen_RaidMark(self)
  335.         lib.ReadyCheck(self)
  336.         lib.gen_LFDRole(self)
  337.        
  338.         --style specific stuff
  339.         self.Health.frequentUpdates = true
  340.         self.Health.colorSmooth = true
  341.         -- self.Health.bg.multiplier = 0.3
  342.         self.Power.colorClass = true
  343.         self.Power.bg.multiplier = 0.5
  344.         lib.gen_InfoIcons(self)
  345.         lib.CreateTargetBorder(self)
  346.         lib.CreateThreatBorder(self)
  347.         lib.HealPred(self)
  348.         lib.debuffHighlight(self)
  349.         lib.raidDebuffs(self)
  350.         lib.addPhaseIcon(self)
  351.         lib.createAuraWatch(self, unit)
  352.  
  353.         self.Health.PostUpdate = lib.PostUpdateRaidFrame
  354.         self:RegisterEvent('PLAYER_TARGET_CHANGED', lib.ChangedTarget)
  355.         self:RegisterEvent('RAID_ROSTER_UPDATE', lib.ChangedTarget)
  356.         self:RegisterEvent("UNIT_THREAT_LIST_UPDATE", lib.UpdateThreat)
  357.         self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", lib.UpdateThreat)
  358.     end,
  359.  
  360.  
  361.     bossStyle = function(self, ...)
  362.  
  363.         self.mystyle = "boss"
  364.                
  365.         self.Range = {
  366.             insideAlpha = 1,
  367.             outsideAlpha = .3,
  368.         }
  369.  
  370.         -- Size and Scale
  371.         self:SetSize(180,29)
  372.  
  373.         -- Generate Bars
  374.         lib.gen_hpbar(self)
  375.         lib.gen_hpstrings(self)
  376.         lib.gen_highlight(self)
  377.         lib.gen_ppbar(self)
  378.         lib.gen_RaidMark(self)
  379.         lib.gen_combat_feedback(self)
  380.  
  381.         --style specific stuff
  382.         self.Health.frequentUpdates = true
  383.         self.Health.colorSmooth = true
  384.         self.Health.Smooth = true
  385.         self.Power.frequentUpdates = true
  386.         self.Power.Smooth = true
  387.         self.Power.colorTapping = true
  388.         self.Power.colorHealth = true
  389.         self.Power.colorReaction = true
  390.         self.Power.colorClass = true
  391.         self.Power.bg.multiplier = 0.5
  392.         lib.gen_castbar(self)
  393.         lib.gen_mirrorcb(self)
  394.  
  395.         if cfg.showBossBuffs then   lib.createBuffs(self) end
  396.         if cfg.showBossDebuffs then lib.createDebuffs(self) end
  397.  
  398.     end,
  399. }  
  400.  
  401. -- The Shared Style Function
  402. local GlobalStyle = function(self, unit, isSingle)
  403.  
  404.     self.menu = lib.spawnMenu
  405.     self:RegisterForClicks('AnyDown')
  406.     -- if(cfg.show_mirrorbars) then MirrorBars() end
  407.    
  408.     -- Call Unit Specific Styles
  409.     if(UnitSpecific[unit]) then
  410.         return UnitSpecific[unit](self)
  411.     end
  412. end
  413.  
  414. -- The Shared Style Function for Party and Raid
  415. local GroupGlobalStyle = function(self, unit)
  416.  
  417.     self.menu = lib.spawnMenu
  418.     self:RegisterForClicks('AnyDown')
  419.    
  420.     -- Call Unit Specific Styles
  421.     if(UnitSpecific[unit]) then
  422.         return UnitSpecific[unit](self)
  423.     end
  424. end
  425.  
  426. local bossStyle = function(self, unit, isSingle)
  427.  
  428.         self.menu = lib.spawnMenu
  429.         self:RegisterForClicks('AnyDown')
  430.                
  431.     -- Call Unit Specific Styles
  432.     if(UnitSpecific[unit]) then
  433.         return UnitSpecific[unit](self)
  434.     end
  435.  
  436. end,
  437.    
  438.   -----------------------------
  439.   -- SPAWN UNITS
  440.   -----------------------------
  441.  
  442. oUF:RegisterStyle('karma', GlobalStyle)
  443. oUF:RegisterStyle('karmaGroup', GroupGlobalStyle)
  444. oUF:RegisterStyle('karmaBoss', bossStyle)
  445.  
  446. oUF:Factory(function(self)
  447.     -- Single Frames
  448.     self:SetActiveStyle('karma')
  449.     self:Spawn('player'):SetPoint("CENTER", UIParent, cfg.PlayerRelativePoint, cfg.PlayerX, cfg.PlayerY)
  450.     self:Spawn('target'):SetPoint("CENTER", UIParent, cfg.TargetRelativePoint, cfg.TargetX, cfg.TargetY)
  451.     if cfg.showtot then self:Spawn('targettarget'):SetPoint("BOTTOMRIGHT",oUF_karmaTarget,cfg.TotRelativePoint, cfg.TotX, cfg.TotY) end
  452.     if cfg.showpet then self:Spawn('pet'):SetPoint("TOPRIGHT",oUF_karmaPlayer,"TOPLEFT", -10, 0) end
  453.     if cfg.showfocus then self:Spawn('focus'):SetPoint("BOTTOMRIGHT", oUF_karmaPlayer, cfg.FocusRelativePoint, cfg.FocusX, cfg.FocusY) end
  454.     if cfg.showfocustarget then self:Spawn('focustarget'):SetPoint("BOTTOMLEFT",oUF_karmaTarget,"TOPLEFT", 0, 8) end
  455.    
  456.     -- Boss frames
  457.     if cfg.showBossFrames then
  458.         self:SetActiveStyle('karmaBoss')
  459.         local boss = {}
  460.         for i = 1, MAX_BOSS_FRAMES do
  461.             boss[i] = self:Spawn("boss"..i, "oUF_Boss"..i)
  462.             boss[i]:SetScale(cfg.scale)
  463.             if i == 1 then
  464.                 boss[i]:SetPoint('BOTTOMLEFT', boss[i - 1], 'TOPLEFT', 0, 8)
  465.             else
  466.                 boss[i]:SetPoint('BOTTOMLEFT', UIParent, 'TOPLEFT', cfg.BossX, cfg.BossY)
  467.             end
  468.         end
  469.     end
  470.    
  471.     -- Party Frames
  472.     if cfg.ShowParty then
  473.         self:SetActiveStyle('karmaGroup')
  474.  
  475.         local party = oUF:SpawnHeader('oUF_Party', nil, 'custom  [group:party,nogroup:raid][@raid6,noexists,group:raid] show;hide',
  476.         --local party = oUF:SpawnHeader('oUF_Party', nil, "solo", "showSolo", true,  -- debug
  477.         "showParty", cfg.ShowParty,
  478.         "showPlayer", false,
  479.         "yoffset", -15,
  480.         "oUF-initialConfigFunction", ([[
  481.             self:SetWidth(%d)
  482.             self:SetHeight(%d)
  483.         ]]):format(128, 25))
  484.         party:SetScale(cfg.raidScale)
  485.         party:SetPoint('CENTER', UIParent, 'CENTER', cfg.PartyX, cfg.PartyY)
  486.     end
  487.    
  488.     -- Raid Frames
  489.     if cfg.ShowRaid then
  490.         -- Hide the Blizzard raid frames
  491.         CompactRaidFrameManager:UnregisterAllEvents()
  492.         CompactRaidFrameManager:Hide()
  493.         CompactRaidFrameContainer:UnregisterAllEvents()
  494.         CompactRaidFrameContainer:Hide()
  495.  
  496.         self:SetActiveStyle('karmaGroup')
  497.         local raid10 = oUF:SpawnHeader("oUF_Raid10", nil, "custom [@raid11,exists] hide; [@raid6,exists] show; hide", -- Raid frames for 6-10 players.
  498.         "showRaid", cfg.ShowRaid,  
  499.         "showSolo", false,
  500.         "showPlayer", true,
  501.         "showParty", false,
  502.         "xoffset", 9,
  503.         "yOffset", -10,
  504.         "groupFilter", "1,2,3,4,5,6,7,8",
  505.         "groupBy", "GROUP",
  506.         "groupingOrder", "1,2,3,4,5,6,7,8",
  507.         "sortMethod", "INDEX",
  508.         "maxColumns", 2,
  509.         "unitsPerColumn", 5,
  510.         "columnSpacing", 9,
  511.         "point", "TOP",
  512.         "columnAnchorPoint", "LEFT",
  513.         "oUF-initialConfigFunction", ([[
  514.         self:SetWidth(%d)
  515.         self:SetHeight(%d)
  516.         ]]):format(96, 25))
  517.         raid10:SetScale(cfg.raidScale)
  518.         raid10:SetPoint('CENTER', UIParent, 'CENTER', cfg.RaidX+200, cfg.RaidY+100)
  519.  
  520.         local raid25 = oUF:SpawnHeader("oUF_Raid25", nil, "custom [@raid26,exists] hide; [@raid11,exists] show; hide", -- Raid frames for 11-25 players.
  521.         "showRaid", cfg.ShowRaid,  
  522.         "showPlayer", true,
  523.         "showParty", false,
  524.         "xoffset", 9,
  525.         "yOffset", -10,
  526.         "groupFilter", "1,2,3,4,5",
  527.         "groupBy", "GROUP",
  528.         "groupingOrder", "1,2,3,4,5",
  529.         "sortMethod", "INDEX",
  530.         "maxColumns", 5,
  531.         "unitsPerColumn", 5,
  532.         "columnSpacing", 9,
  533.         "point", "TOP",
  534.         "columnAnchorPoint", "LEFT",
  535.         "oUF-initialConfigFunction", ([[
  536.         self:SetWidth(%d)
  537.         self:SetHeight(%d)
  538.         ]]):format(80, 25))
  539.         raid25:SetScale(cfg.raidScale)
  540.         raid25:SetPoint('CENTER', UIParent, 'CENTER', cfg.RaidX+80, cfg.RaidY)
  541.  
  542.         local raid40 = oUF:SpawnHeader("oUF_Raid40", nil, "custom [@raid26,exists] show; hide", -- Raid frames for 26-40 players.
  543.         "showRaid", cfg.ShowRaid,  
  544.         "showPlayer", true,
  545.         "showParty", false,
  546.         "xoffset", 9,
  547.         "yOffset", -10,
  548.         "groupFilter", "1,2,3,4,5,6,7,8",
  549.         "groupBy", "GROUP",
  550.         "groupingOrder", "1,2,3,4,5,6,7,8",
  551.         "sortMethod", "INDEX",
  552.         "maxColumns", 8,
  553.         "unitsPerColumn", 5,
  554.         "columnSpacing", 9,
  555.         "point", "TOP",
  556.         "columnAnchorPoint", "LEFT",
  557.         "oUF-initialConfigFunction", ([[
  558.         self:SetWidth(%d)
  559.         self:SetHeight(%d)
  560.         ]]):format(64, 25))
  561.         raid40:SetScale(cfg.raidScale)
  562.         raid40:SetPoint('CENTER', UIParent, 'CENTER', cfg.RaidX, cfg.RaidY)
  563.  
  564.     end
  565. end)

p3lim 03-03-12 01:50 AM

Read the description on the addon page and you will find this:
https://github.com/p3lim/oUF_Fader/wiki

MiRai 03-03-12 02:18 AM

Quote:

Originally Posted by p3lim (Post 253362)
Read the description on the addon page and you will find this:
https://github.com/p3lim/oUF_Fader/wiki

I apologize for completely missing that.

So, I added that to Karma's core.lua file and it works perfect for my player frame. However, my target, tot, target's castbar, and focus are all stuck at a lower opacity as can be seen here.

Also, I didn't get a chance to test it out on that level 1 character but, does this also work for party members as well?

Thanks for all of your help.

EDIT: I get it now. I was confused and was attempting to use target.whatever or focus.whatever and it was giving me errors. I didn't realize that each section in the config was its own and used self.whatever just like the player frame.

MiRai 03-03-12 02:35 AM

I guess I only have one more question at the moment and that is...

In addition to "sortMethod", "INDEX", and "sortMethod", "NAME", is it possible to hardcode (for lack of a better term) my party's names into the party list?

For example:
Code:

"sortMethod", "Player1, Player2, Player3, Player4, Player5",
If it is currently not possible to achieve that; how would this be done? Could I somehow keep the same party I join a BG with listed in the party frames while in a raid?

I ask because when I join a battleground with my friends, we usually end up in different groups and it can be difficult to heal them through the raid frames. I would like to "hardcode" their names into my party list so that I can just click heal them through there. Grid paired up with GridCustomLayouts can achieve this but I would really like to not have to use Grid just for this and would like to keep everything consolidated and neat within the oUF frames.

I don't want p3lim to feel like he is obligated to answer my questions. This thread has had many views yet only one author has replied. I am hoping that this last question of mine could get some feedback if there isn't a straightforward way to do this.

Thank you so much for dealing with me thus far. ;)

Phanx 03-03-12 03:42 AM

You would need to filter on a nameList instead of groups or classes. See the comments in Blizzard's FrameXML/SecureGroupHeaders.lua file for more detail, or someone not on a phone can post it for you :p

MiRai 03-03-12 04:19 AM

Quote:

Originally Posted by Phanx (Post 253369)
You would need to filter on a nameList instead of groups or classes. See the comments in Blizzard's FrameXML/SecureGroupHeaders.lua file for more detail, or someone not on a phone can post it for you :p

Here's what I pulled from go-hero.net for 4.3.0.15005:

lua Code:
  1. --
  2. -- SecurePartyHeader and SecureRaidGroupHeader contributed with permission by: Esamynn, Cide, and Iriel
  3. --
  4.  
  5. local strsplit = strsplit;
  6. local select = select;
  7. local tonumber = tonumber;
  8. local type = type;
  9. local floor = math.floor;
  10. local ceil = math.ceil;
  11. local min = math.min;
  12. local max = math.max;
  13. local abs = math.abs;
  14.  
  15. --[[
  16. List of the various configuration attributes
  17. ======================================================
  18. showRaid = [BOOLEAN] -- true if the header should be shown while in a raid
  19. showParty = [BOOLEAN] -- true if the header should be shown while in a party and not in a raid
  20. showPlayer = [BOOLEAN] -- true if the header should show the player when not in a raid
  21. showSolo = [BOOLEAN] -- true if the header should be shown while not in a group (implies showPlayer)
  22. nameList = [STRING] -- a comma separated list of player names (not used if 'groupFilter' is set)
  23. groupFilter = [1-8, STRING] -- a comma seperated list of raid group numbers and/or uppercase class names and/or uppercase roles
  24. strictFiltering = [BOOLEAN] - if true, then characters must match both a group and a class from the groupFilter list
  25. point = [STRING] -- a valid XML anchoring point (Default: "TOP")
  26. xOffset = [NUMBER] -- the x-Offset to use when anchoring the unit buttons (Default: 0)
  27. yOffset = [NUMBER] -- the y-Offset to use when anchoring the unit buttons (Default: 0)
  28. sortMethod = ["INDEX", "NAME", "NAMELIST"] -- defines how the group is sorted (Default: "INDEX")
  29. sortDir = ["ASC", "DESC"] -- defines the sort order (Default: "ASC")
  30. template = [STRING] -- the XML template to use for the unit buttons
  31. templateType = [STRING] - specifies the frame type of the managed subframes (Default: "Button")
  32. groupBy = [nil, "GROUP", "CLASS", "ROLE"] - specifies a "grouping" type to apply before regular sorting (Default: nil)
  33. groupingOrder = [STRING] - specifies the order of the groupings (ie. "1,2,3,4,5,6,7,8")
  34. maxColumns = [NUMBER] - maximum number of columns the header will create (Default: 1)
  35. unitsPerColumn = [NUMBER or nil] - maximum units that will be displayed in a singe column, nil is infinite (Default: nil)
  36. startingIndex = [NUMBER] - the index in the final sorted unit list at which to start displaying units (Default: 1)
  37. columnSpacing = [NUMBER] - the amount of space between the rows/columns (Default: 0)
  38. columnAnchorPoint = [STRING] - the anchor point of each new column (ie. use LEFT for the columns to grow to the right)
  39. --]]
  40.  
  41. function SecureGroupHeader_OnLoad(self)
  42.     self:RegisterEvent("PARTY_MEMBERS_CHANGED");
  43.     self:RegisterEvent("UNIT_NAME_UPDATE");
  44. end
  45.  
  46. function SecureGroupHeader_OnEvent(self, event, ...)
  47.     if ( (event == "PARTY_MEMBERS_CHANGED" or event == "UNIT_NAME_UPDATE") and self:IsVisible() ) then
  48.         SecureGroupHeader_Update(self);
  49.     end
  50. end
  51.  
  52. function SecureGroupHeader_OnAttributeChanged(self, name, value)
  53.     if ( name == "_ignore" or self:GetAttribute("_ignore" ) ) then
  54.         return
  55.     end
  56.     if ( self:IsVisible() ) then
  57.         SecureGroupHeader_Update(self);
  58.     end
  59. end
  60.  
  61. -- relativePoint, xMultiplier, yMultiplier = getRelativePointAnchor( point )
  62. -- Given a point return the opposite point and which axes the point
  63. -- depends on.
  64. local function getRelativePointAnchor( point )
  65.     point = point:upper();
  66.     if (point == "TOP") then
  67.         return "BOTTOM", 0, -1;
  68.     elseif (point == "BOTTOM") then
  69.         return "TOP", 0, 1;
  70.     elseif (point == "LEFT") then
  71.         return "RIGHT", 1, 0;
  72.     elseif (point == "RIGHT") then
  73.         return "LEFT", -1, 0;
  74.     elseif (point == "TOPLEFT") then
  75.         return "BOTTOMRIGHT", 1, -1;
  76.     elseif (point == "TOPRIGHT") then
  77.         return "BOTTOMLEFT", -1, -1;
  78.     elseif (point == "BOTTOMLEFT") then
  79.         return "TOPRIGHT", 1, 1;
  80.     elseif (point == "BOTTOMRIGHT") then
  81.         return "TOPLEFT", -1, 1;
  82.     else
  83.         return "CENTER", 0, 0;
  84.     end
  85. end
  86.  
  87. local function setAttributesWithoutResponse(self, ...)
  88.     local oldIgnore = self:GetAttribute("_ignore");
  89.     self:SetAttribute("_ignore", "attributeChanges");
  90.     for i = 1, select('#', ...), 2 do
  91.         self:SetAttribute(select(i, ...));
  92.     end
  93.     self:SetAttribute("_ignore", oldIgnore);
  94. end
  95.  
  96. local CallRestrictedClosure = CallRestrictedClosure;
  97. local GetManagedEnvironment = GetManagedEnvironment;
  98. local GetFrameHandle = GetFrameHandle;
  99. local wipe = table.wipe;
  100. local tinsert = table.insert;
  101.  
  102. local function SetupUnitButtonConfiguration( header, newChild, defaultConfigFunction )
  103.     local configCode = header:GetAttribute("initialConfigFunction") or defaultConfigFunction;
  104.  
  105.     if ( type(configCode) == "string" ) then
  106.         local selfHandle = GetFrameHandle(newChild);
  107.         if ( selfHandle ) then
  108.             CallRestrictedClosure("self", GetManagedEnvironment(header, true),
  109.                                   selfHandle, configCode, selfHandle);
  110.         end
  111.     end
  112. end
  113.  
  114. -- creates child frames and finished configuring them
  115. local function configureChildren(self, unitTable)
  116.     local point = self:GetAttribute("point") or "TOP"; --default anchor point of "TOP"
  117.     local relativePoint, xOffsetMult, yOffsetMult = getRelativePointAnchor(point);
  118.     local xMultiplier, yMultiplier =  abs(xOffsetMult), abs(yOffsetMult);
  119.     local xOffset = self:GetAttribute("xOffset") or 0; --default of 0
  120.     local yOffset = self:GetAttribute("yOffset") or 0; --default of 0
  121.     local sortDir = self:GetAttribute("sortDir") or "ASC"; --sort ascending by default
  122.     local columnSpacing = self:GetAttribute("columnSpacing") or 0;
  123.     local startingIndex = self:GetAttribute("startingIndex") or 1;
  124.  
  125.     local unitCount = #unitTable;
  126.     local numDisplayed = unitCount - (startingIndex - 1);
  127.     local unitsPerColumn = self:GetAttribute("unitsPerColumn");
  128.     local numColumns;
  129.     if ( unitsPerColumn and numDisplayed > unitsPerColumn ) then
  130.         numColumns = min( ceil(numDisplayed / unitsPerColumn), (self:GetAttribute("maxColumns") or 1) );
  131.     else
  132.         unitsPerColumn = numDisplayed;
  133.         numColumns = 1;
  134.     end
  135.     local loopStart = startingIndex;
  136.     local loopFinish = min((startingIndex - 1) + unitsPerColumn * numColumns, unitCount)
  137.     local step = 1;
  138.  
  139.     numDisplayed = loopFinish - (loopStart - 1);
  140.  
  141.     if ( sortDir == "DESC" ) then
  142.         loopStart = unitCount - (startingIndex - 1);
  143.         loopFinish = loopStart - (numDisplayed - 1);
  144.         step = -1;
  145.     end
  146.  
  147.     -- ensure there are enough buttons
  148.     local needButtons = max(1, numDisplayed);
  149.     if not ( self:GetAttribute("child"..needButtons) ) then
  150.         local buttonTemplate = self:GetAttribute("template");
  151.         local templateType = self:GetAttribute("templateType") or "Button";
  152.         local name = self:GetName();
  153.         for i = 1, needButtons, 1 do
  154.             local childAttr = "child" .. i;
  155.             if not ( self:GetAttribute(childAttr) ) then
  156.                 local newButton = CreateFrame(templateType, name and (name.."UnitButton"..i), self, buttonTemplate);
  157.                 self[i] = newButton;
  158.                 SetupUnitButtonConfiguration(self, newButton);
  159.                 setAttributesWithoutResponse(self, childAttr, newButton, "frameref-"..childAttr, GetFrameHandle(newButton));
  160.             end
  161.         end
  162.     end
  163.  
  164.     local columnAnchorPoint, columnRelPoint, colxMulti, colyMulti;
  165.     if ( numColumns > 1 ) then
  166.         columnAnchorPoint = self:GetAttribute("columnAnchorPoint");
  167.         columnRelPoint, colxMulti, colyMulti = getRelativePointAnchor(columnAnchorPoint);
  168.     end
  169.  
  170.     local buttonNum = 0;
  171.     local columnNum = 1;
  172.     local columnUnitCount = 0;
  173.     local currentAnchor = self;
  174.     for i = loopStart, loopFinish, step do
  175.         buttonNum = buttonNum + 1;
  176.         columnUnitCount = columnUnitCount + 1;
  177.         if ( columnUnitCount > unitsPerColumn ) then
  178.             columnUnitCount = 1;
  179.             columnNum = columnNum + 1;
  180.         end
  181.  
  182.         local unitButton = self:GetAttribute("child"..buttonNum);
  183.         if ( buttonNum == 1 ) then
  184.             unitButton:SetPoint(point, currentAnchor, point, 0, 0);
  185.             if ( columnAnchorPoint ) then
  186.                 unitButton:SetPoint(columnAnchorPoint, currentAnchor, columnAnchorPoint, 0, 0);
  187.             end
  188.  
  189.         elseif ( columnUnitCount == 1 ) then
  190.             local columnAnchor = self:GetAttribute("child"..(buttonNum - unitsPerColumn));
  191.             unitButton:SetPoint(columnAnchorPoint, columnAnchor, columnRelPoint, colxMulti * columnSpacing, colyMulti * columnSpacing);
  192.         else
  193.             unitButton:SetPoint(point, currentAnchor, relativePoint, xMultiplier * xOffset, yMultiplier * yOffset);
  194.         end
  195.         unitButton:SetAttribute("unit", unitTable[i]);
  196.  
  197.         local configCode = unitButton:GetAttribute("refreshUnitChange");
  198.         if ( type(configCode) == "string" ) then
  199.             local selfHandle = GetFrameHandle(unitButton);
  200.             if ( selfHandle ) then
  201.                 CallRestrictedClosure("self",
  202.                                       GetManagedEnvironment(unitButton, true),
  203.                                       selfHandle, configCode, selfHandle);
  204.             end
  205.         end
  206.  
  207.         if not unitButton:GetAttribute("statehidden") then
  208.             unitButton:Show();
  209.         end
  210.  
  211.         currentAnchor = unitButton;
  212.     end
  213.     repeat
  214.         buttonNum = buttonNum + 1;
  215.         local unitButton = self:GetAttribute("child"..buttonNum);
  216.         if ( unitButton ) then
  217.             unitButton:Hide();
  218.             unitButton:ClearAllPoints();
  219.             unitButton:SetAttribute("unit", nil);
  220.         end
  221.     until not ( unitButton )
  222.  
  223.     local unitButton = self:GetAttribute("child1");
  224.     local unitButtonWidth = unitButton:GetWidth();
  225.     local unitButtonHeight = unitButton:GetHeight();
  226.     if ( numDisplayed > 0 ) then
  227.         local width = xMultiplier * (unitsPerColumn - 1) * unitButtonWidth + ( (unitsPerColumn - 1) * (xOffset * xOffsetMult) ) + unitButtonWidth;
  228.         local height = yMultiplier * (unitsPerColumn - 1) * unitButtonHeight + ( (unitsPerColumn - 1) * (yOffset * yOffsetMult) ) + unitButtonHeight;
  229.  
  230.         if ( numColumns > 1 ) then
  231.             width = width + ( (numColumns -1) * abs(colxMulti) * (width + columnSpacing) );
  232.             height = height + ( (numColumns -1) * abs(colyMulti) * (height + columnSpacing) );
  233.         end
  234.  
  235.         self:SetWidth(width);
  236.         self:SetHeight(height);
  237.     else
  238.         local minWidth = self:GetAttribute("minWidth") or (yMultiplier * unitButtonWidth);
  239.         local minHeight = self:GetAttribute("minHeight") or (xMultiplier * unitButtonHeight);
  240.         self:SetWidth( max(minWidth, 0.1) );
  241.         self:SetHeight( max(minHeight, 0.1) );
  242.     end
  243. end
  244.  
  245. local function GetGroupHeaderType(self)
  246.     local kind, start, stop;
  247.  
  248.     local nRaid = GetNumRaidMembers();
  249.     local nParty = GetNumPartyMembers();
  250.     if ( nRaid > 0 and self:GetAttribute("showRaid") ) then
  251.         kind = "RAID";
  252.     elseif ( (nRaid > 0 or nParty > 0) and self:GetAttribute("showParty") ) then
  253.         kind = "PARTY";
  254.     elseif ( self:GetAttribute("showSolo") ) then
  255.         kind = "SOLO";
  256.     end
  257.     if ( kind ) then
  258.         if ( kind == "RAID" ) then
  259.             start = 1;
  260.             stop = nRaid;
  261.         else
  262.             if ( kind == "SOLO" or self:GetAttribute("showPlayer") ) then
  263.                 start = 0;
  264.             else
  265.                 start = 1;
  266.             end
  267.             stop = nParty;
  268.         end
  269.     end
  270.     return kind, start, stop;
  271. end
  272.  
  273. local function GetGroupRosterInfo(kind, index)
  274.     local _, unit, name, subgroup, className, role, server;
  275.     if ( kind == "RAID" ) then
  276.         unit = "raid"..index;
  277.         name, _, subgroup, _, _, className, _, _, _, role = GetRaidRosterInfo(index);
  278.     else
  279.         if ( index > 0 ) then
  280.             unit = "party"..index;
  281.         else
  282.             unit = "player";
  283.         end
  284.         if ( UnitExists(unit) ) then
  285.             name, server = UnitName(unit);
  286.             if (server and server ~= "") then
  287.                 name = name.."-"..server
  288.             end
  289.             _, className = UnitClass(unit);
  290.             if ( GetPartyAssignment("MAINTANK", unit) ) then
  291.                 role = "MAINTANK";
  292.             elseif ( GetPartyAssignment("MAINASSIST", unit) ) then
  293.                 role = "MAINASSIST";
  294.             end
  295.         end
  296.         subgroup = 1;
  297.     end
  298.     return unit, name, subgroup, className, role;
  299. end
  300.  
  301. local pairs = pairs;
  302. local ipairs = ipairs;
  303. local strtrim = string.trim;
  304.  
  305. -- empties tbl and assigns the value true to each key passed as part of ...
  306. local function fillTable( tbl, ... )
  307.     for i = 1, select("#", ...), 1 do
  308.         local key = select(i, ...);
  309.         key = tonumber(key) or strtrim(key);
  310.         tbl[key] = i;
  311.     end
  312. end
  313.  
  314. -- same as fillTable() except that each key is also stored in
  315. -- the array portion of the table in order
  316. local function doubleFillTable( tbl, ... )
  317.     fillTable(tbl, ...);
  318.     for i = 1, select("#", ...), 1 do
  319.         tbl[i] = strtrim(select(i, ...));
  320.     end
  321. end
  322.  
  323. --working tables
  324. local tokenTable = {};
  325. local sortingTable = {};
  326. local groupingTable = {};
  327. local tempTable = {};
  328.  
  329. local function sortOnGroupWithNames(a, b)
  330.     local order1 = tokenTable[ groupingTable[a] ];
  331.     local order2 = tokenTable[ groupingTable[b] ];
  332.     if ( order1 ) then
  333.         if ( not order2 ) then
  334.             return true;
  335.         else
  336.             if ( order1 == order2 ) then
  337.                 return sortingTable[a] < sortingTable[b];
  338.             else
  339.                 return order1 < order2;
  340.             end
  341.         end
  342.     else
  343.         if ( order2 ) then
  344.             return false;
  345.         else
  346.             return sortingTable[a] < sortingTable[b];
  347.         end
  348.     end
  349. end
  350.  
  351. local function sortOnGroupWithIDs(a, b)
  352.     local order1 = tokenTable[ groupingTable[a] ];
  353.     local order2 = tokenTable[ groupingTable[b] ];
  354.     if ( order1 ) then
  355.         if ( not order2 ) then
  356.             return true;
  357.         else
  358.             if ( order1 == order2 ) then
  359.                 return tonumber(a:match("%d+") or -1) < tonumber(b:match("%d+") or -1);
  360.             else
  361.                 return order1 < order2;
  362.             end
  363.         end
  364.     else
  365.         if ( order2 ) then
  366.             return false;
  367.         else
  368.             return tonumber(a:match("%d+") or -1) < tonumber(b:match("%d+") or -1);
  369.         end
  370.     end
  371. end
  372.  
  373. local function sortOnNames(a, b)
  374.     return sortingTable[a] < sortingTable[b];
  375. end
  376.  
  377. local function sortOnNameList(a, b)
  378.     return tokenTable[ sortingTable[a] ] < tokenTable[ sortingTable[b] ];
  379. end
  380.  
  381. function SecureGroupHeader_Update(self)
  382.     local nameList = self:GetAttribute("nameList");
  383.     local groupFilter = self:GetAttribute("groupFilter");
  384.     local sortMethod = self:GetAttribute("sortMethod");
  385.     local groupBy = self:GetAttribute("groupBy");
  386.  
  387.     wipe(sortingTable);
  388.  
  389.     -- See if this header should be shown
  390.     local kind, start, stop = GetGroupHeaderType(self);
  391.     if ( not kind ) then
  392.         configureChildren(self, sortingTable);
  393.         return;
  394.     end
  395.  
  396.     if ( not groupFilter and not nameList ) then
  397.         groupFilter = "1,2,3,4,5,6,7,8";
  398.     end
  399.  
  400.     if ( groupFilter ) then
  401.         -- filtering by a list of group numbers and/or classes
  402.         fillTable(wipe(tokenTable), strsplit(",", groupFilter));
  403.         local strictFiltering = self:GetAttribute("strictFiltering"); -- non-strict by default
  404.         for i = start, stop, 1 do
  405.             local unit, name, subgroup, className, role = GetGroupRosterInfo(kind, i);
  406.             if ( name and
  407.                 ((not strictFiltering) and
  408.                     (tokenTable[subgroup] or tokenTable[className] or (role and tokenTable[role])) -- non-strict filtering
  409.                 ) or
  410.                     (tokenTable[subgroup] and tokenTable[className]) -- strict filtering
  411.             ) then
  412.                 tinsert(sortingTable, unit);
  413.                 sortingTable[unit] = name;
  414.                 if ( groupBy == "GROUP" ) then
  415.                     groupingTable[unit] = subgroup;
  416.  
  417.                 elseif ( groupBy == "CLASS" ) then
  418.                     groupingTable[unit] = className;
  419.  
  420.                 elseif ( groupBy == "ROLE" ) then
  421.                     groupingTable[unit] = role;
  422.  
  423.                 end
  424.             end
  425.         end
  426.  
  427.         if ( groupBy ) then
  428.             local groupingOrder = self:GetAttribute("groupingOrder");
  429.             doubleFillTable(wipe(tokenTable), strsplit(",", groupingOrder:gsub("%s+", "")));
  430.             if ( sortMethod == "NAME" ) then
  431.                 table.sort(sortingTable, sortOnGroupWithNames);
  432.             else
  433.                 table.sort(sortingTable, sortOnGroupWithIDs);
  434.             end
  435.         elseif ( sortMethod == "NAME" ) then -- sort by ID by default
  436.             table.sort(sortingTable, sortOnNames);
  437.         end
  438.  
  439.     else
  440.         -- filtering via a list of names
  441.         doubleFillTable(wipe(tokenTable), strsplit(",", nameList));
  442.         for i = start, stop, 1 do
  443.             local unit, name = GetGroupRosterInfo(kind, i);
  444.             if ( tokenTable[name] ) then
  445.                 tinsert(sortingTable, unit);
  446.                 sortingTable[unit] = name;
  447.             end
  448.         end
  449.         if ( sortMethod == "NAME" ) then
  450.             table.sort(sortingTable, sortOnNames);
  451.         elseif ( sortMethod == "NAMELIST" ) then
  452.             table.sort(sortingTable, sortOnNameList)
  453.         end
  454.  
  455.     end
  456.  
  457.     configureChildren(self, sortingTable);
  458. end
  459.  
  460. --[[
  461. The Pet Header accepts all of the various configuration attributes of the
  462. regular raid header, as well as the following
  463. ======================================================
  464. useOwnerUnit = [BOOLEAN] - if true, then the owner's unit string is set on managed frames "unit" attribute (instead of pet's)
  465. filterOnPet = [BOOLEAN] - if true, then pet names are used when sorting/filtering the list
  466. --]]
  467.  
  468. function SecureGroupPetHeader_OnLoad(self)
  469.     self:RegisterEvent("PARTY_MEMBERS_CHANGED");
  470.     self:RegisterEvent("UNIT_NAME_UPDATE");
  471.     self:RegisterEvent("UNIT_PET");
  472. end
  473.  
  474. function SecureGroupPetHeader_OnEvent(self, event, ...)
  475.     if ( (event == "PARTY_MEMBERS_CHANGED" or event == "UNIT_NAME_UPDATE" or event == "UNIT_PET") and self:IsVisible() ) then
  476.         SecureGroupPetHeader_Update(self);
  477.     end
  478. end
  479.  
  480. function SecureGroupPetHeader_OnAttributeChanged(self, name, value)
  481.     if ( name == "_ignore" or self:GetAttribute("_ignore" ) ) then
  482.         return
  483.     end
  484.     if ( self:IsVisible() ) then
  485.         SecureGroupPetHeader_Update(self);
  486.     end
  487. end
  488.  
  489. local function GetPetUnit(kind, index)
  490.     if ( kind == "RAID" ) then
  491.         return "raidpet"..index;
  492.     elseif ( index > 0 ) then
  493.         return "partypet"..index;
  494.     else
  495.         return "pet";
  496.     end
  497. end
  498.  
  499. function SecureGroupPetHeader_Update(self)
  500.     local nameList = self:GetAttribute("nameList");
  501.     local groupFilter = self:GetAttribute("groupFilter");
  502.     local sortMethod = self:GetAttribute("sortMethod");
  503.     local groupBy = self:GetAttribute("groupBy");
  504.     local useOwnerUnit = self:GetAttribute("useOwnerUnit");
  505.     local filterOnPet = self:GetAttribute("filterOnPet");
  506.  
  507.     wipe(sortingTable);
  508.  
  509.     -- See if this header should be shown
  510.     local kind, start, stop = GetGroupHeaderType(self);
  511.     if ( not kind ) then
  512.         configureChildren(self, sortingTable);
  513.         return;
  514.     end
  515.  
  516.     if ( not groupFilter and not nameList ) then
  517.         groupFilter = "1,2,3,4,5,6,7,8";
  518.     end
  519.  
  520.     if ( groupFilter ) then
  521.         -- filtering by a list of group numbers and/or classes
  522.         fillTable(wipe(tokenTable), strsplit(",", groupFilter));
  523.         local strictFiltering = self:GetAttribute("strictFiltering"); -- non-strict by default
  524.         for i = start, stop, 1 do
  525.             local unit, name, subgroup, className, role = GetGroupRosterInfo(kind, i);
  526.             local petUnit = GetPetUnit(kind, i);
  527.             if ( filterOnPet ) then
  528.                 name = UnitName(petUnit);
  529.             end
  530.             if not ( useOwnerUnit ) then
  531.                 unit = petUnit;
  532.             end
  533.             if ( UnitExists(petUnit) ) then
  534.                 if ( name and
  535.                     ((not strictFiltering) and
  536.                      (tokenTable[subgroup] or tokenTable[className] or (role and tokenTable[role])) -- non-strict filtering
  537.                  ) or
  538.                     (tokenTable[subgroup] and tokenTable[className]) -- strict filtering
  539.                 ) then
  540.                     tinsert(sortingTable, unit);
  541.                     sortingTable[unit] = name;
  542.                     if ( groupBy == "GROUP" ) then
  543.                         groupingTable[unit] = subgroup;
  544.  
  545.                     elseif ( groupBy == "CLASS" ) then
  546.                         groupingTable[unit] = className;
  547.  
  548.                     elseif ( groupBy == "ROLE" ) then
  549.                         groupingTable[unit] = role;
  550.  
  551.                     end
  552.                 end
  553.             end
  554.         end
  555.  
  556.         if ( groupBy ) then
  557.             local groupingOrder = self:GetAttribute("groupingOrder");
  558.             doubleFillTable(wipe(tokenTable), strsplit(",", groupingOrder));
  559.             if ( sortMethod == "NAME" ) then
  560.                 table.sort(sortingTable, sortOnGroupWithNames);
  561.             else
  562.                 table.sort(sortingTable, sortOnGroupWithIDs);
  563.             end
  564.         elseif ( sortMethod == "NAME" ) then -- sort by ID by default
  565.             table.sort(sortingTable, sortOnNames);
  566.  
  567.         end
  568.  
  569.     else
  570.         -- filtering via a list of names
  571.         doubleFillTable(tokenTable, strsplit(",", nameList));
  572.         for i = start, stop, 1 do
  573.             local unit, name = GetGroupRosterInfo(kind, i);
  574.             local petUnit = GetPetUnit(kind, i);
  575.             if ( filterOnPet ) then
  576.                 name = UnitName(petUnit);
  577.             end
  578.             if not ( useOwnerUnit ) then
  579.                 unit = petUnit;
  580.             end
  581.             if ( tokenTable[name] and UnitExists(petUnit) ) then
  582.                 tinsert(sortingTable, unit);
  583.                 sortingTable[unit] = name;
  584.             end
  585.         end
  586.         if ( sortMethod == "NAME" ) then
  587.             table.sort(sortingTable, sortOnNames);
  588.         end
  589.  
  590.     end
  591.  
  592.     configureChildren(self, sortingTable);
  593. end
  594.  
  595. -- SecureAuraHeader contributed by [email][email protected][/email]
  596.  
  597. --[[
  598. filter = [STRING] -- a pipe-separated list of aura filter options ("RAID" will be ignored)
  599. 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.
  600. sortMethod = ["INDEX", "NAME", "TIME"] -- defines how the group is sorted (Default: "INDEX")
  601. sortDirection = ["+", "-"] -- defines the sort order (Default: "+")
  602. 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
  603. includeWeapons = [nil, NUMBER] -- The aura sub-stream before which to include temporary weapon enchants. If nil or 0, they are ignored.
  604. consolidateTo = [nil, NUMBER] -- The aura sub-stream before which to place a proxy for the consolidated header. If nil or 0, consolidation is ignored.
  605. consolidateDuration = [nil, NUMBER] -- the minimum total duration an aura should have to be considered for consolidation (Default: 30)
  606. consolidateThreshold = [nil, NUMBER] -- buffs with less remaining duration than this many seconds should not be consolidated (Default: 10)
  607. consolidateFraction = [nil, NUMBER] -- The fraction of remaining duration a buff should still have to be eligible for consolidation (Default: .10)
  608.  
  609. 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.
  610. 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.
  611. consolidateProxy = [STRING|Frame] -- Either the button which represents consolidated buffs, or the name of the template used to construct one.
  612. consolidateHeader = [STRING|Frame] -- Either the aura header which contains consolidated buffs, or the name of the template used to construct one.
  613.  
  614. point = [STRING] -- a valid XML anchoring point (Default: "TOPRIGHT")
  615. minWidth = [nil, NUMBER] -- the minimum width of the container frame
  616. minHeight = [nil, NUMBER] -- the minimum height of the container frame
  617. xOffset = [NUMBER] -- the x-Offset to use when anchoring the unit buttons. This should typically be set to at least the width of your buff template.
  618. yOffset = [NUMBER] -- the y-Offset to use when anchoring the unit buttons. This should typically be set to at least the height of your buff template.
  619. wrapAfter = [NUMBER] -- begin a new row or column after this many auras. If 0 or nil, never wrap or limit the first row
  620. wrapXOffset = [NUMBER] -- the x-offset from one row or column to the next
  621. wrapYOffset = [NUMBER] -- the y-offset from one row or column to the next
  622. maxWraps = [NUMBER] -- limit the number of rows or columns. If 0 or nil, the number of rows or columns will not be limited.
  623. --]]
  624.  
  625. local function SetupAuraButtonConfiguration( header, newChild, defaultConfigFunction )
  626.     local configCode = newChild:GetAttribute("initialConfigFunction") or header:GetAttribute("initialConfigFunction") or defaultConfigFunction;
  627.  
  628.     if ( type(configCode) == "string" ) then
  629.         local selfHandle = GetFrameHandle(newChild);
  630.         if ( selfHandle ) then
  631.             CallRestrictedClosure("self", GetManagedEnvironment(header, true),
  632.                                   selfHandle, configCode, selfHandle);
  633.         end
  634.     end
  635. end
  636.  
  637. function SecureAuraHeader_OnLoad(self)
  638.     self:RegisterEvent("UNIT_AURA");
  639. end
  640.  
  641. function SecureAuraHeader_OnUpdate(self)
  642.     local hasMainHandEnchant, hasOffHandEnchant, _;
  643.     hasMainHandEnchant, _, _, hasOffHandEnchant, _, _ = GetWeaponEnchantInfo();
  644.     if ( hasMainHandEnchant ~= self:GetAttribute("_mainEnchanted") ) then
  645.         self:SetAttribute("_mainEnchanted", hasMainHandEnchant);
  646.     end
  647.     if ( hasOffHandEnchant ~= self:GetAttribute("_secondaryEnchanted") ) then
  648.         self:SetAttribute("_secondaryEnchanted", hasOffHandEnchant);
  649.     end
  650. end
  651.  
  652. function SecureAuraHeader_OnEvent(self, event, ...)
  653.     if ( self:IsVisible() ) then
  654.         local unit = SecureButton_GetUnit(self);
  655.         if ( event == "UNIT_AURA" and ... == unit ) then
  656.             SecureAuraHeader_Update(self);
  657.         end
  658.     end
  659. end
  660.  
  661. function SecureAuraHeader_OnAttributeChanged(self, name, value)
  662.     if ( name == "_ignore" or self:GetAttribute("_ignore") ) then
  663.         return;
  664.     end
  665.     if ( self:IsVisible() ) then
  666.         SecureAuraHeader_Update(self);
  667.     end
  668. end
  669.  
  670. local buttons = {};
  671.  
  672. local function extractTemplateInfo(template, defaultWidget)
  673.     local widgetType;
  674.  
  675.     if ( template ) then
  676.         template, widgetType = strsplit(",", (tostring(template):trim():gsub("%s*,%s*", ",")) );
  677.         if ( template ~= "" ) then
  678.             if ( not widgetType or widgetType == "" ) then
  679.                 widgetType = defaultWidget;
  680.             end
  681.             return template, widgetType;
  682.         end
  683.     end
  684.     return nil;
  685. end
  686.  
  687. local function constructChild(kind, name, parent, template)
  688.     local new = CreateFrame(kind, name, parent, template);
  689.     SetupAuraButtonConfiguration(parent, new);
  690.     return new;
  691. end
  692.  
  693. local enchantableSlots = {
  694.     [1] = "MainHandSlot",
  695.     [2] = "SecondaryHandSlot",
  696.     [3] = "RangedSlot",
  697. }
  698.  
  699. local function configureAuras(self, auraTable, consolidateTable, weaponPosition)
  700.     local point = self:GetAttribute("point") or "TOPRIGHT";
  701.     local xOffset = tonumber(self:GetAttribute("xOffset")) or 0;
  702.     local yOffset = tonumber(self:GetAttribute("yOffset")) or 0;
  703.     local wrapXOffset = tonumber(self:GetAttribute("wrapXOffset")) or 0;
  704.     local wrapYOffset = tonumber(self:GetAttribute("wrapYOffset")) or 0;
  705.     local wrapAfter = tonumber(self:GetAttribute("wrapAfter"));
  706.     if ( wrapAfter == 0 ) then wrapAfter = nil; end
  707.     local maxWraps = self:GetAttribute("maxWraps");
  708.     if ( maxWraps == 0 ) then maxWraps = nil; end
  709.     local minWidth = tonumber(self:GetAttribute("minWidth")) or 0;
  710.     local minHeight = tonumber(self:GetAttribute("minHeight")) or 0;
  711.  
  712.     if ( consolidateTable and #consolidateTable == 0 ) then
  713.         consolidateTable = nil;
  714.     end
  715.     local name = self:GetName();
  716.  
  717.     wipe(buttons);
  718.     local buffTemplate, buffWidget = extractTemplateInfo(self:GetAttribute("template"), "Button");
  719.     if ( buffTemplate ) then
  720.         for i=1, #auraTable do
  721.             local childAttr = "child"..i;
  722.             local button = self:GetAttribute("child"..i);
  723.             if ( button ) then
  724.                 button:ClearAllPoints();
  725.             else
  726.                 button = constructChild(buffWidget, name and name.."AuraButton"..i, self, buffTemplate);
  727.                 setAttributesWithoutResponse(self, childAttr, button, "frameref-"..childAttr, GetFrameHandle(button));
  728.             end
  729.             local buffInfo = auraTable[i];
  730.             button:SetID(buffInfo.index);
  731.             button:SetAttribute("index", buffInfo.index);
  732.             button:SetAttribute("filter", buffInfo.filter);
  733.             buttons[i] = button;
  734.         end
  735.     end
  736.  
  737.     local consolidateProxy = self:GetAttribute("consolidateProxy");
  738.     if ( consolidateTable ) then
  739.         if ( type(consolidateProxy) == 'string' ) then
  740.             local template, widgetType = extractTemplateInfo(consolidateProxy, "Button");
  741.             if ( template ) then
  742.                 consolidateProxy = constructChild(widgetType, name and name.."ProxyButton", self, template);
  743.                 setAttributesWithoutResponse(self, "consolidateProxy", consolidateProxy, "frameref-proxy", GetFrameHandle(consolidateProxy));
  744.             else
  745.                 consolidateProxy = nil;
  746.             end
  747.         end
  748.         if ( consolidateProxy ) then
  749.             if ( consolidateTable.position ) then
  750.                 tinsert(buttons, consolidateTable.position, consolidateProxy);
  751.             else
  752.                 tinsert(buttons, consolidateProxy);
  753.             end
  754.             consolidateProxy:ClearAllPoints();
  755.         end
  756.     else
  757.         if ( consolidateProxy and type(consolidateProxy.Hide) == 'function' ) then
  758.             consolidateProxy:Hide();
  759.         end
  760.     end
  761.     if ( weaponPosition ) then
  762.         local hasMainHandEnchant, hasOffHandEnchant, hasRangedEnchant, _;
  763.         hasMainHandEnchant, _, _, hasOffHandEnchant, _, _, hasRangedEnchant, _, _ = GetWeaponEnchantInfo();
  764.  
  765.         for weapon=3,1,-1 do
  766.             local weaponAttr = "tempEnchant"..weapon
  767.             local tempEnchant = self:GetAttribute(weaponAttr)
  768.             if ( (select(weapon, hasMainHandEnchant, hasOffHandEnchant, hasRangedEnchant)) ) then
  769.                 if ( not tempEnchant ) then
  770.                     local template, widgetType = extractTemplateInfo(self:GetAttribute("weaponTemplate"), "Button");
  771.                     if ( template ) then
  772.                         tempEnchant = constructChild(widgetType, name and name.."TempEnchant"..weapon, self, template);
  773.                         setAttributesWithoutResponse(self, weaponAttr, tempEnchant);
  774.                     end
  775.                 end
  776.                 if ( tempEnchant ) then
  777.                     tempEnchant:ClearAllPoints();
  778.                     local slot = GetInventorySlotInfo(enchantableSlots[weapon]);
  779.                     tempEnchant:SetAttribute("target-slot", slot);
  780.                     tempEnchant:SetID(slot);
  781.                     if ( weaponPosition == 0 ) then
  782.                         tinsert(buttons, tempEnchant);
  783.                     else
  784.                         tinsert(buttons, weaponPosition, tempEnchant);
  785.                     end
  786.                 end
  787.             else
  788.                 if ( tempEnchant and type(tempEnchant.Hide) == 'function' ) then
  789.                     tempEnchant:Hide();
  790.                 end
  791.             end
  792.         end
  793.     end
  794.  
  795.     local display = #buttons
  796.     if ( wrapAfter and maxWraps ) then
  797.         display = min(display, wrapAfter * maxWraps);
  798.     end
  799.  
  800.     local left, right, top, bottom = math.huge, -math.huge, -math.huge, math.huge;
  801.     for index=1,display do
  802.         local button = buttons[index];
  803.         local wrapAfter = wrapAfter or index
  804.         local tick, cycle = floor((index - 1) % wrapAfter), floor((index - 1) / wrapAfter);
  805.         button:SetPoint(point, self, cycle * wrapXOffset + tick * xOffset, cycle * wrapYOffset + tick * yOffset);
  806.         button:Show();
  807.         left = min(left, button:GetLeft() or math.huge);
  808.         right = max(right, button:GetRight() or -math.huge);
  809.         top = max(top, button:GetTop() or -math.huge);
  810.         bottom = min(bottom, button:GetBottom() or math.huge);
  811.     end
  812.     local deadIndex = display + 1;
  813.     local button = self:GetAttribute("child"..deadIndex);
  814.     while ( button ) do
  815.         button:Hide();
  816.         deadIndex = deadIndex + 1;
  817.         button = self:GetAttribute("child"..deadIndex)
  818.     end
  819.    
  820.     if ( display >= 1 ) then
  821.         self:SetWidth(max(right - left, minWidth));
  822.         self:SetHeight(max(top - bottom, minHeight));
  823.     else
  824.         self:SetWidth(minWidth);
  825.         self:SetHeight(minHeight);
  826.     end
  827.     if ( consolidateTable ) then
  828.         local header = self:GetAttribute("consolidateHeader");
  829.         if ( type(header) == 'string' ) then
  830.             local template, widgetType = extractTemplateInfo(header, "Frame");
  831.             if ( template ) then
  832.                 header = constructChild(widgetType, name and name.."ProxyHeader", consolidateProxy, template);
  833.                 setAttributesWithoutResponse(self, "consolidateHeader", header);
  834.                 consolidateProxy:SetAttribute("header", header);
  835.                 consolidateProxy:SetAttribute("frameref-header", GetFrameHandle(header))
  836.             end
  837.         end
  838.         if ( header ) then
  839.             configureAuras(header, consolidateTable);
  840.         end
  841.     end
  842. end
  843.  
  844. local tremove = table.remove;
  845.  
  846. local function stripRAID(filter)
  847.     return filter and tostring(filter):upper():gsub("RAID", ""):gsub("|+", "|"):match("^|?(.+[^|])|?$");
  848. end
  849.  
  850. local freshTable;
  851. local releaseTable;
  852. do
  853.     local tableReserve = {};
  854.     freshTable = function ()
  855.         local t = next(tableReserve) or {};
  856.         tableReserve[t] = nil;
  857.         return t;
  858.     end
  859.     releaseTable = function (t)
  860.         tableReserve[t] = wipe(t);
  861.     end
  862. end
  863.  
  864. local sorters = {};
  865.  
  866. local function sortFactory(key, separateOwn, reverse)
  867.     if ( separateOwn ~= 0 ) then
  868.         if ( reverse ) then
  869.             return function (a, b)
  870.                 if ( groupingTable[a.filter] == groupingTable[b.filter] ) then
  871.                     local ownA, ownB = a.caster == "player", b.caster == "player";
  872.                     if ( ownA ~= ownB ) then
  873.                         return ownA == (separateOwn > 0)
  874.                     end
  875.                     return a[key] > b[key];
  876.                 else
  877.                     return groupingTable[a.filter] < groupingTable[b.filter];
  878.                 end
  879.             end;
  880.         else
  881.             return function (a, b)
  882.                 if ( groupingTable[a.filter] == groupingTable[b.filter] ) then
  883.                     local ownA, ownB = a.caster == "player", b.caster == "player";
  884.                     if ( ownA ~= ownB ) then
  885.                         return ownA == (separateOwn > 0)
  886.                     end
  887.                     return a[key] < b[key];
  888.                 else
  889.                     return groupingTable[a.filter] < groupingTable[b.filter];
  890.                 end
  891.             end;
  892.         end
  893.     else
  894.         if ( reverse ) then
  895.             return function (a, b)
  896.                 if ( groupingTable[a.filter] == groupingTable[b.filter] ) then
  897.                     return a[key] > b[key];
  898.                 else
  899.                     return groupingTable[a.filter] < groupingTable[b.filter];
  900.                 end
  901.             end;
  902.         else
  903.             return function (a, b)
  904.                 if ( groupingTable[a.filter] == groupingTable[b.filter] ) then
  905.                     return a[key] < b[key];
  906.                 else
  907.                     return groupingTable[a.filter] < groupingTable[b.filter];
  908.                 end
  909.             end;
  910.         end
  911.     end
  912. end
  913.  
  914. for i, key in ipairs{"index", "name", "expires"} do
  915.     local label = key:upper();
  916.     sorters[label] = {};
  917.     for bool in pairs{[true] = true, [false] = false} do
  918.         sorters[label][bool] = {}
  919.         for sep=-1,1 do
  920.             sorters[label][bool][sep] = sortFactory(key, sep, bool);
  921.         end
  922.     end
  923. end
  924. sorters.TIME = sorters.EXPIRES;
  925.  
  926. function SecureAuraHeader_Update(self)
  927.     local filter = self:GetAttribute("filter");
  928.     local groupBy = self:GetAttribute("groupBy");
  929.     local unit = SecureButton_GetUnit(self) or "player";
  930.     local includeWeapons = tonumber(self:GetAttribute("includeWeapons"));
  931.     if ( includeWeapons == 0 ) then
  932.         includeWeapons = nil
  933.     end
  934.     local consolidateTo = tonumber(self:GetAttribute("consolidateTo"));
  935.     local consolidateDuration, consolidateThreshold, consolidateFraction;
  936.     if ( consolidateTo ) then
  937.         consolidateDuration = tonumber(self:GetAttribute("consolidateDuration")) or 30;
  938.         consolidateThreshold = tonumber(self:GetAttribute("consolidateThreshold")) or 10;
  939.         consolidateFraction = tonumber(self:GetAttribute("consolidateFraction")) or 0.1;
  940.     end
  941.     local sortDirection = self:GetAttribute("sortDirection");
  942.     local separateOwn = tonumber(self:GetAttribute("separateOwn")) or 0;
  943.     if ( separateOwn > 0 ) then
  944.         separateOwn = 1;
  945.     elseif (separateOwn < 0 ) then
  946.         separateOwn = -1;
  947.     end
  948.     local sortMethod = (sorters[tostring(self:GetAttribute("sortMethod")):upper()] or sorters["INDEX"])[sortDirection == "-"][separateOwn];
  949.  
  950.     local time = GetTime();
  951.  
  952.     local consolidateTable;
  953.     if ( consolidateTo and consolidateTo ~= 0 ) then
  954.         consolidateTable = wipe(tokenTable);
  955.     end
  956.  
  957.     wipe(sortingTable);
  958.     wipe(groupingTable);
  959.  
  960.     if ( groupBy ) then
  961.         local i = 1;
  962.         for subFilter in groupBy:gmatch("[^,]+") do
  963.             if ( filter ) then
  964.                 subFilter = stripRAID(filter.."|"..subFilter);
  965.             else
  966.                 subFilter = stripRAID(subFilter);
  967.             end
  968.             groupingTable[subFilter], groupingTable[i] = i, subFilter;
  969.             i = i + 1;
  970.         end
  971.     else
  972.         filter = stripRAID(filter);
  973.         groupingTable[filter], groupingTable[1] = 1, filter;
  974.     end
  975.     if ( consolidateTable and consolidateTo < 0 ) then
  976.         consolidateTo = #groupingTable + consolidateTo + 1;
  977.     end
  978.     if ( includeWeapons and includeWeapons < 0 ) then
  979.         includeWeapons = #groupingTable + includeWeapons + 1;
  980.     end
  981.     local weaponPosition;
  982.     for filterIndex, fullFilter in ipairs(groupingTable) do
  983.         if ( consolidateTable and not consolidateTable.position and filterIndex >= consolidateTo ) then
  984.             consolidateTable.position = #sortingTable + 1;
  985.         end
  986.         if ( includeWeapons and not weaponPosition and filterIndex >= includeWeapons ) then
  987.             weaponPosition = #sortingTable + 1;
  988.         end
  989.  
  990.         local i = 1;
  991.         repeat
  992.             local aura, _, duration = freshTable();
  993.             aura.name, _, _, _, _, duration, aura.expires, aura.caster, _, aura.shouldConsolidate, _ = UnitAura(unit, i, fullFilter);
  994.             if ( aura.name ) then
  995.                 aura.filter = fullFilter;
  996.                 aura.index = i;
  997.                 local targetList = sortingTable;
  998.                 if ( consolidateTable and aura.shouldConsolidate ) then
  999.                     if ( not aura.expires or duration > consolidateDuration or (aura.expires - time >= max(consolidateThreshold, duration * consolidateFraction)) ) then
  1000.                         targetList = consolidateTable;
  1001.                     end
  1002.                 end
  1003.                 tinsert(targetList, aura);
  1004.             else
  1005.                 releaseTable(aura);
  1006.             end
  1007.             i = i + 1;
  1008.         until ( not aura.name );
  1009.     end
  1010.     if ( includeWeapons and not weaponPosition ) then
  1011.         weaponPosition = 0;
  1012.     end
  1013.     table.sort(sortingTable, sortMethod);
  1014.     if ( consolidateTable ) then
  1015.         table.sort(consolidateTable, sortMethod);
  1016.     end
  1017.  
  1018.     configureAuras(self, sortingTable, consolidateTable, weaponPosition);
  1019.     while ( sortingTable[1] ) do
  1020.         releaseTable(tremove(sortingTable));
  1021.     end
  1022.     while ( consolidateTable and consolidateTable[1] ) do
  1023.         releaseTable(tremove(consolidateTable));
  1024.     end
  1025. end

EDIT: Should I start a new topic about this?
EDIT2: I'll start a new topic. ;)
EDIT3: New thread about expanding the party sort options can be found here.


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

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