Skip to content

Instantly share code, notes, and snippets.

Created August 13, 2014 20:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d23ffb8dfd3124659c46 to your computer and use it in GitHub Desktop.
Save anonymous/d23ffb8dfd3124659c46 to your computer and use it in GitHub Desktop.
-- building a simple SpellActivationOverlay replacement
-- using text strings.
-- obble & Lyn
-- spell database -----------------------------------------------------------------------
local spellList = {
[44544] = {
Show = true,
Name = "Fingers of Frost",
Text = "•",
Size = 34,
Colour = { 0/255, 231/255, 217/255 }, -- light blue
Tier = 1,
},
[57761] = {
Show = true,
Name = "Brain Freeze",
Text = "*",
Size = 32,
Colour = { 255/255, 120/255, 0/255 }, -- orange
Tier = 2,
},
}
-- create frames & strings --------------------------------------------------------------
local frame = CreateFrame("Frame", nil, UIParent)
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, ...)
if (event=="PLAYER_ENTERING_WORLD") then
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
else
local _, event, _, source, _, _, _, _, _, _, _, spell, _, _, _, amount = ...
if(not PlayerGUID) then
PlayerGUID = UnitGUID("player")
end
if(source==PlayerGUID and spellList[spell]) then
-- debug
-- print("OK")
if (event=="SPELL_AURA_REMOVED") then
self:Hide()
elseif (event=="SPELL_AURA_APPLIED" or event=="SPELL_AURA_REFRESH") then
-- debug
-- print(spellList[spell].Show)
if spellList[spell].Show==true then
local _, _, _, stacks = UnitBuff("player", spellList[spell].Name)
local string = Bar:CreateFontString(nil, "ARTWORK")
string:SetJustifyH("CENTER")
string:SetFont(STANDARD_TEXT_FONT, spellList[spell].Size, "OUTLINE")
string:SetShadowOffset(0, -0)
-- debug
print(stacks)
for i = 1, stacks do
string:SetText(spellList[spell].Text)
end
string:ClearAllPoints()
if (spellList[spell].Tier==1) then
string:SetPoint("CENTER", Bar, 0, -40)
elseif (spellList[spell].Tier==2) then
string:SetPoint("CENTER", Bar, 0, -80)
end
string:SetTextColor(unpack(spellList[spell].Colour))
end
self:Show()
end
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment