-
-
Save anonymous/1bcb3a092180fa6cf71b 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
-- config ------------------------------------------------------------------------------- | |
-- hide/show default blizzard spell overlay textures | |
-- default is hidden | |
local hideblizzoverlays = true | |
-- unpack info from ListOfSpells -------------------------------------------------------- | |
-- namespace | |
local _, ns = ... | |
local cfg = ns | |
-- 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", fontstrings[i-1], "TOPRIGHT", 0, -5) | |
else | |
line:SetPoint("RIGHT", UIParent, "CENTER", 96, 75) | |
end | |
line:SetJustifyH("RIGHT") | |
line:SetSpacing(2) | |
t[i] = line | |
return line | |
end}) | |
frame:SetScript("OnEvent", function(self, event, ...) | |
local shown = 0 | |
-- hide any unused ones first | |
for i = shown + 1, #fontstrings do | |
fontstrings[i]:Hide() | |
end | |
for i = 1, #cfg.spells do | |
local spell = cfg.spells[i] | |
local _, _, _, stacks = UnitBuff("player", spell.name) | |
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") -- have to do these both here? can't seem to access our | |
fontstring:SetTextColor(spell.colour[1], spell.colour[2], spell.colour[3]) -- table of spells (spell.size etc.) correctly otherwise. | |
fontstring:SetShadowOffset(0, 0) | |
fontstring:Show() | |
end | |
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