Created
August 13, 2014 21:12
-
-
Save anonymous/55cbe42ae6a68b3de58b 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. | |
-- obble & lyn | |
local frame = CreateFrame("Frame", nil, UIParent) | |
-- spell database ----------------------------------------------------------------------- | |
-- new style of table that I want | |
local spellList = { | |
["Fingers of Frost"] = { | |
Show = true, | |
ID = 44544, | |
Text = "•", | |
Size = 34, | |
Colour = { 0/255, 231/255, 217/255 }, -- light blue | |
Tier = 1, | |
}, | |
["Brain Freeze"] = { | |
Show = true, | |
ID = 57761, | |
Text = "*", | |
Size = 32, | |
Colour = { 255/255, 120/255, 0/255 }, -- orange | |
Tier = 2, | |
}, | |
} | |
-- create frames & strings -------------------------------------------------------------- | |
frame:SetPoint("CENTER", 0, -60) | |
frame:SetSize(150, 13) | |
frame:Hide() | |
local Bar = CreateFrame("Frame", nil, frame) | |
Bar:SetAllPoints() | |
-- implement --------------------------------------------------------------------------- | |
frame:RegisterEvent("PLAYER_ENTERING_WORLD") | |
frame:RegisterEvent("UNIT_AURA") | |
frame:SetScript("OnEvent", function(self, event, ...) | |
local unit = ... | |
if unit~="player" then return end | |
for buff in pairs(spellList) do | |
self:Hide() | |
if UnitBuff("player", buff) then | |
local _, _, _, stacks = UnitBuff("player", buff) | |
print(stacks) | |
local string = Bar:CreateFontString(nil, "ARTWORK") | |
string:SetJustifyH("CENTER") | |
string:SetFont(STANDARD_TEXT_FONT, spellList[buff].Size, "OUTLINE") | |
string:SetShadowOffset(0, -0) | |
for i = 1, stacks do | |
string:SetText(spellList[buff].Text) | |
end | |
string:ClearAllPoints() | |
if (spellList[buff].Tier==1) then | |
string:SetPoint("CENTER", Bar, 0, -40) | |
elseif (spellList[buff].Tier==2) then | |
string:SetPoint("CENTER", Bar, 0, -80) | |
end | |
string:SetTextColor(unpack(spellList[buff].Colour)) | |
self:Show() | |
end | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment