-
-
Save anonymous/483fc65cde3339f6ab8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- simple SpellActivationOverlay replacement using text strings. | |
-- thanks Lyn, Semlar, PHANX! | |
-- obble | |
-- config ------------------------------------------------------------------------------- | |
-- hide/show default blizzard spell overlay textures | |
-- default is hidden | |
local hideblizzoverlays = true | |
-- unpack info from ListOfSpells -------------------------------------------------------- | |
-- namespace | |
local _, cfg = ... | |
-- get info | |
for i = 1, #cfg.spells do | |
local spell = cfg.spells[i] | |
spell.name = GetSpellInfo(spell.id) | |
end | |
-- sort | |
local function sortSpells(a, b) | |
-- Show lower priority first, or alphabetically within same priority | |
return a.priority < b.priority or a.priority==b.priority and a.name < b.name | |
end | |
table.sort(cfg.spells, sortSpells) | |
-- implement --------------------------------------------------------------------------- | |
local frame = CreateFrame("Frame", nil, UIParent) | |
frame:RegisterEvent("PLAYER_ENTERING_WORLD") | |
frame:RegisterUnitEvent("UNIT_AURA", "player") | |
local fontstrings = setmetatable({}, { __index = function(t, i) | |
local line = UIParent:CreateFontString(nil, "OVERLAY", "GameFontNormal") | |
if i > 1 then | |
line:SetPoint("BOTTOMRIGHT", t[i-1], "TOPRIGHT", 0, -5) | |
else | |
line:SetPoint("RIGHT", UIParent, "CENTER", 96, 75) | |
end | |
line:SetJustifyH("RIGHT") | |
line:SetShadowOffset(0, 0) | |
line:SetSpacing(2) | |
t[i] = line | |
return line | |
end}) | |
frame:SetScript("OnEvent", function(self, event, ...) | |
local shown = 0 | |
for i = 1, #cfg.spells do | |
local spell = cfg.spells[i] | |
local _, _, _, stacks = UnitAura("player", spell.name, nil, spell.auratype) | |
if stacks and spell.show==true then | |
shown = shown + 1 | |
local fontstring = fontstrings[shown] -- keep them all in another indexed table | |
fontstring:SetText(string.rep(spell.symbol, stacks > 0 and stacks or 1)) | |
fontstring:SetFont(STANDARD_TEXT_FONT, spell.size, "OUTLINE") | |
fontstring:SetTextColor(spell.colour[1], spell.colour[2], spell.colour[3]) | |
fontstring:Show() | |
end | |
end | |
-- hide any unused | |
for i = shown + 1, #fontstrings do | |
fontstrings[i]:Hide() | |
end | |
end) | |
-- hide blizzard overlay ---------------------------------------------------------------- | |
if (hideblizzoverlays) then | |
SetCVar("displaySpellActivationOverlays", 0) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment