Originally Posted by Kendian
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:
- Truth
- Righteousness
- 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
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()