Add Class Filter to Aura Groups #9


  • New
  • Enhancment
Open
  • _ForgeUser5076 created this issue Oct 11, 2011

    What is the enhancement in mind? How should it look and feel?

    Allow all aura groups to specify which classes they apply to, like standard Grid Auras.

    Please provide any additional information below.

    Simple, elegant solution provided below. Concept and most code copied from core GridStatusAuras.

    @@ -39,6 +39,15 @@
         Poison = {r = 0, g = 0.6, b = 0, a = 1.0},
         Curse = {r = 0.8, g = 0, b = 1, a = 1.0},
     }
    +
    +local classes = { }
    +do
    +	local t = { }
    +	FillLocalizedClassList(t, false)
    +	for token, name in pairs(t) do
    +		classes[token:lower()] = name
    +	end
    +end
    
    @@ -225,6 +234,30 @@
                     end,
                     order = 149,
                 }
    +	elseif setting == "classes" then
    +	    set = {
    +		type = "group",
    +		name = L["Class Filter"],
    +		desc = L["Show status for the selected classes."],
    +		order = 150,
    +		type = "group", dialogInline = true,
    +		args = {},
    +	    }
    +	    for class, name in pairs(classes) do
    +		local class, name = class,name
    +		set.args[class] = {
    +			type = "toggle",
    +			name = name,
    +			desc = string.format(L["Show on %s."], name),
    +			get = function()
    +				return GridStatusAurasExt.db.profile[status][class] ~= false
    +			end,
    +			set = function(_, v)
    +				GridStatusAurasExt.db.profile[status][class] = v
    +				GridStatusAurasExt:UpdateAllUnitAuras()
    +			end,
    +		}
    +	    end
    
    @@ -245,7 +278,8 @@
                     "auraheader",
                     "addbyid","addbyname",
                     "colorbytype",
    -                "mobauras"})
    +                "mobauras",
    +		"classes"})
    
    @@ -266,7 +300,7 @@
             end,
             getOpts = function(status)
                 local opts = {}
    -            addOptionsForSettings(opts, status, {"ignorepets","auraheader","addbyid","addbyname","onlybuffs","onlydebuffs"})
    +            addOptionsForSettings(opts, status, {"ignorepets","auraheader","addbyid","addbyname","onlybuffs","onlydebuffs","classes"})
    
    @@ -287,7 +321,7 @@
             end,
             getOpts = function(status)
                 local opts = {}
    -            addOptionsForSettings(opts, status, {"ignorepets","auraheader","addbyid","addbyname"})
    +            addOptionsForSettings(opts, status, {"ignorepets","auraheader","addbyid","addbyname","classes"})
    
    @@ -324,7 +358,7 @@
                         order = 182,
                     },
                 }
    -            addOptionsForSettings(opts, status, {"ignorepets","auraheader","colorbytype"})
    +            addOptionsForSettings(opts, status, {"ignorepets","auraheader","colorbytype","classes"})
    
    @@ -1021,6 +1056,11 @@
         end
         
         local isPet = isGUIDPet(guid)
    +    
    +    local _, class = UnitClass(unit)
    +	if class then
    +	    class = strlower(class)
    +    end
    
    @@ -1048,7 +1088,7 @@
         for status, data in pairs(groupList) do
             if data.settings.mobAuras == isTarget then
    -            if not(data.settings.ignorePets and isPet) and data.active == (not data.settings.allMissing) then
    +            if not(data.settings.ignorePets and isPet) and data.active == (not data.settings.allMissing) and data.settings[class] ~= false then
    
  • _ForgeUser5076 added the tags New Enhancment Oct 11, 2011
  • _ForgeUser5076 added an attachment GridStatusAurasExt.lua Oct 11, 2011

    GridStatusAurasExt.lua

    <p>Updated File from latest release with class filters added</p>


To post a comment, please login or register a new account.