-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upvalues, add debug mode, addMessage function
- Loading branch information
Showing
3 changed files
with
57 additions
and
27 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,50 @@ | ||
local addon = CreateFrame('Frame') | ||
addon.name = "HideButtonGlow" | ||
addon:SetScript('OnEvent', function(self, event, ...) | ||
local addonName, addon = ... | ||
|
||
-- globals | ||
local CreateFrame, GetSpellInfo = CreateFrame, GetSpellInfo | ||
|
||
local addonFrame = CreateFrame('Frame') | ||
addonFrame:SetScript('OnEvent', function(self, event, ...) | ||
if self[event] then return self[event](...) end | ||
end) | ||
addon:RegisterEvent('PLAYER_LOGIN') | ||
addonFrame:RegisterEvent('PLAYER_LOGIN') | ||
|
||
function addon:PLAYER_LOGIN() | ||
function addonFrame:PLAYER_LOGIN() | ||
if not HideButtonGlowDB then | ||
HideButtonGlowDB = {} | ||
HideButtonGlowDB.hideAll = false | ||
HideButtonGlowDB.debugMode = false | ||
HideButtonGlowDB.spells = {} | ||
end | ||
end | ||
|
||
function addon:addMessage(message, debugOnly) | ||
if not debugOnly or HideButtonGlowDB.debugMode then | ||
DEFAULT_CHAT_FRAME:AddMessage(message) | ||
end | ||
end | ||
|
||
local glowLib = LibStub("LibButtonGlow-1.0", true) | ||
local showGlow = glowLib.ShowOverlayGlow | ||
function glowLib.ShowOverlayGlow(self) | ||
local spellId = self:GetSpellId() | ||
local spellName = GetSpellInfo(spellId) | ||
|
||
-- check if the 'hide all' option is set | ||
if HideButtonGlowDB.hideAll then | ||
--print("hiding all") | ||
addon:addMessage("Hide All is checked, hiding spell glow for "..spellName.." (ID"..spellId..").", true) | ||
return | ||
end | ||
|
||
-- else iterate through filter list | ||
for _, spellToFilter in ipairs(HideButtonGlowDB.spells) do | ||
--print("checking filter value " .. spellToFilter) | ||
if self:GetSpellId() == spellToFilter then | ||
--print("filter match") | ||
if spellId == spellToFilter then | ||
addon:addMessage("Filter matched, hiding spell glow for "..spellName.." (ID "..spellId..").", true) | ||
return | ||
end | ||
--print("filter didn't match spell id: " .. self:GetSpellId()) | ||
end | ||
|
||
-- else show the glow | ||
--print("showing glow for spell id: " .. self:GetSpellId()) | ||
showGlow(self) | ||
addon:addMessage("No filters matched, allowing spell glow for "..spellName.." (ID "..spellId..").", true) | ||
return showGlow(self) | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,5 @@ | |
|
||
libs\AceConfig-3.0\AceConfig-3.0.xml | ||
|
||
options.lua | ||
HideButtonGlow.lua | ||
options.lua |
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