Thread: Seals
View Single Post
12-17-12, 01:14 AM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Kendian View Post
I was actually trying to script a panel (KGPanels) that would show when I had a seal on.
You deleted your original post, so I'm not entirely sure whether you cared which seal was active or not, but this will show you the icon of whichever seal is active, or a red square if you don't have a seal:

OnLoad:
Code:
self.textures = {
    [1] = "Interface\\Icons\\Spell_Holy_SealOfVengeance", -- Seal of Truth
    [2] = "Interface\\Icons\\Spell_Holy_RighteousnessAura", -- Seal of Righteousness
    [3] = "Interface\\Icons\\Spell_Holy_HealingAura", -- Seal of Insight
}

self.icon = self:CreateTexture(nil, "ARTWORK")
self.icon:SetAllPoints(true)
self.icon:SetTexCoord(0.06, 0.94, 0.06, 0.94) -- to trim the ugly icon border

self:RegisterEvent("UPDATE_SHAPESHIFT_FORM")

local seal = GetShapeshiftForm()
seal = seal and self.textures[seal]
return seal and self.icon:SetTexture(seal) or self.icon:SetTexture(1, 0, 0)
OnEvent:
Code:
local seal = GetShapeshiftForm()
seal = seal and self.textures[seal]
return seal and self.icon:SetTexture(seal) or self.icon:SetTexture(1, 0, 0)
On my level 60 prot paladin, GetShapeshiftForm() returns:
  1. Truth
  2. Righteousness
  3. Insight
I'm not sure where ret paladins' Seal of Justice fits in, so if you're ret, you should double-check what GetShapeshiftForm() returns for each of your seals, and update the textures table accordingly.

Originally Posted by Kendian View Post
The second was just wondering why showing a panel when your in combat, and hiding it when out, no longer worked. Or, at least it doesn't work after you reload, it always shows.
OnLoad:
Code:
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("PLAYER_REGEN_DISABLED")
return UnitAffectingCombat("player") and self:Show() or self:Hide()
OnEvent:
Code:
return UnitAffectingCombat("player") and self:Show() or self:Hide()
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote