Skip to content

Commit

Permalink
fix and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jordonwow committed Dec 19, 2022
1 parent 95db4e5 commit e34b3e3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 29 deletions.
5 changes: 4 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ ignore = {
"432",
}
read_globals = {
"ActionBarButtonEventsFrame",
"AuraUtil",
"BOSS_DEBUFF_SIZE_INCREASE",
"BUFF_STACKS_OVERFLOW",
"C_NamePlate",
"C_Timer",
"C_UnitAuras",
"Cell",
"CombatLogGetCurrentEventInfo",
"CompactUnitFrame_HideAllBuffs",
"CompactUnitFrame_HideAllDebuffs",
"CompactUnitFrame_HideAllDispelDebuffs",
"CompactUnitFrame_SetMaxBuffs",
"CompactUnitFrame_UpdateAuras",
"CompactUnitFrame_Util_IsBossAura",
"CompactUnitFrame_Util_IsPriorityDebuff",
Expand All @@ -34,7 +37,6 @@ read_globals = {
"CompactUnitFrame_UtilSetDebuff",
"CompactUnitFrame_UtilSetDispelDebuff",
"CompactUnitFrame_UtilShouldDisplayBuff",
"CompactUnitFrame_SetMaxBuffs",
"CooldownFrame_Clear",
"CooldownFrame_Set",
"CreateFrame",
Expand All @@ -52,6 +54,7 @@ read_globals = {
"InCombatLockdown",
"InterfaceOptionsFrame_OpenToCategory",
"IsInInstance",
"issecurevariable",
"IsUsableSpell",
"KuiNameplates",
"LibStub",
Expand Down
39 changes: 20 additions & 19 deletions BigDebuffs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ else
Magic = function() return IsUsableSpell(GetSpellInfo(19736)) or IsUsableSpell(GetSpellInfo(19476)) end,
},
EVOKER = {
Poison = true
Poison = true,
Disease = function() return IsUsableSpell(GetSpellInfo(374251)) end,
Curse = function() return IsUsableSpell(GetSpellInfo(374251)) end,
},
Expand Down Expand Up @@ -1304,17 +1304,17 @@ function BigDebuffs:AddBigDebuffs(frame)
end

local pending = {}
function checkFrame(frame)
local function checkFrame(frame)
if not issecurevariable(frame, "action") and not InCombatLockdown() then
frame.action = nil
frame:SetAttribute("action");
end
end

hooksecurefunc("CompactUnitFrame_UpdateAll", function(frame)
for _, frame in ipairs(ActionBarButtonEventsFrame.frames) do
hooksecurefunc(frame, "UpdateAction", checkFrame);
end
for _, f in ipairs(ActionBarButtonEventsFrame.frames) do
if f.UpdateAction then hooksecurefunc(f, "UpdateAction", checkFrame) end
end
if not BigDebuffs.db.profile then return end
if not BigDebuffs.db.profile.raidFrames then return end
if not BigDebuffs.db.profile.raidFrames.enabled then return end
Expand Down Expand Up @@ -1465,9 +1465,9 @@ end

if LibClassicDurations then
hooksecurefunc("CompactUnitFrame_UtilSetBuff", function(buffFrame, unit, index, filter)
for _, frame in ipairs(ActionBarButtonEventsFrame.frames) do
hooksecurefunc(frame, "UpdateAction", checkFrame);
end
for _, frame in ipairs(ActionBarButtonEventsFrame.frames) do
if frame.UpdateAction then hooksecurefunc(frame, "UpdateAction", checkFrame) end
end
if not LibClassicDurations then return end
local name, icon, count, debuffType, duration, expirationTime, unitCaster,
canStealOrPurge, _, spellId, canApplyAura = UnitBuff(unit, index, filter);
Expand All @@ -1489,6 +1489,7 @@ end

--classic and BigDebuffs:ShowBigDebuffs()

local CompactUnitFrame_UtilSetDebuff = CompactUnitFrame_UtilSetDebuff

if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
local Default_CompactUnitFrame_Util_IsPriorityDebuff = CompactUnitFrame_Util_IsPriorityDebuff
Expand Down Expand Up @@ -1542,9 +1543,9 @@ if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
end

hooksecurefunc("CompactUnitFrame_UpdateAuras", function(frame, unitAuraUpdateInfo)
for _, frame in ipairs(ActionBarButtonEventsFrame.frames) do
hooksecurefunc(frame, "UpdateAction", checkFrame);
end
for _, f in ipairs(ActionBarButtonEventsFrame.frames) do
if f.UpdateAction then hooksecurefunc(f, "UpdateAction", checkFrame) end
end

if (not frame) or frame:IsForbidden() then return end

Expand Down Expand Up @@ -1697,7 +1698,7 @@ if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
BigDebuffs:ShowBigDebuffs(frame)
end)
else
local function CompactUnitFrame_UtilSetDebuff(debuffFrame, unit, index, filter, isBossAura, isBossBuff, ...)
CompactUnitFrame_UtilSetDebuff = function(debuffFrame, unit, index, filter, isBossAura, isBossBuff, ...)
local UnitDebuff = BigDebuffs.test and UnitDebuffTest or UnitDebuff
-- make sure you are using the correct index here!
--isBossAura says make this look large.
Expand Down Expand Up @@ -1813,9 +1814,9 @@ else
end

hooksecurefunc("CompactUnitFrame_UpdateDebuffs", function(frame)
for _, frame in ipairs(ActionBarButtonEventsFrame.frames) do
hooksecurefunc(frame, "UpdateAction", checkFrame);
end
for _, f in ipairs(ActionBarButtonEventsFrame.frames) do
if f.UpdateAction then hooksecurefunc(f, "UpdateAction", checkFrame) end
end
if (not frame.debuffFrames or not frame.optionTable.displayDebuffs) then
CompactUnitFrame_HideAllDebuffs(frame);
return;
Expand Down Expand Up @@ -1913,9 +1914,9 @@ else

-- Show extra buffs
hooksecurefunc("CompactUnitFrame_UpdateBuffs", function(frame)
for _, frame in ipairs(ActionBarButtonEventsFrame.frames) do
hooksecurefunc(frame, "UpdateAction", checkFrame);
end
for _, f in ipairs(ActionBarButtonEventsFrame.frames) do
if f.UpdateAction then hooksecurefunc(f, "UpdateAction", checkFrame) end
end
if (not frame.buffFrames or not frame.optionTable.displayBuffs) then
CompactUnitFrame_HideAllBuffs(frame);
return;
Expand Down Expand Up @@ -2527,7 +2528,7 @@ end

function BigDebuffs:NAME_PLATE_UNIT_REMOVED(_, unit)
local frame = self.Nameplates[unit]

-- Seems like a good idea to remove old nameplate frames from the group.
if Masque ~= nil then
BigDebuffs.MasqueGroup.NamePlate:RemoveButton(frame)
Expand Down
12 changes: 3 additions & 9 deletions BigDebuffs_Mainline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,6 @@ addon.Spells = {
[274837] = { type = DEBUFF_OFFENSIVE }, -- Feral Frenzy
[363498] = { type = DEBUFF_OFFENSIVE }, -- Sickle of the Lion


-- Evoker

[360806] = { type = ROOT }, -- Landslide
[358385] = { type = CROWD_CONTROL }, -- Sleep Walk

-- Hunter

[136] = { type = BUFF_DEFENSIVE }, -- Mend Pet
Expand Down Expand Up @@ -600,9 +594,9 @@ addon.Spells = {

-- Evoker

[360806] = { type = CROWD_CONTROL } -- Sleep Walk
[358385] = { type = ROOT }, -- LandSlide
[375087] = { type = BUFF_OFFENSIVE }, -- DragonRage
[360806] = { type = CROWD_CONTROL }, -- Sleep Walk
[358385] = { type = ROOT }, -- Landslide
[375087] = { type = BUFF_OFFENSIVE }, -- Dragonrage


-- Other
Expand Down

0 comments on commit e34b3e3

Please sign in to comment.