Skip to content

Commit

Permalink
Code Updates
Browse files Browse the repository at this point in the history
Rewrite Bad Buffs Module
Increase New Item Glow To 100% & Speed It Up
  • Loading branch information
Kkthnx committed Aug 13, 2022
1 parent c732264 commit c724f62
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
2 changes: 2 additions & 0 deletions KkthnxUI/Config/Elements/BadBuffs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ C.CheckBadBuffs = {
[SpellName(61734)] = true, -- Noblegarden Bunny
[SpellName(61781)] = true, -- Turkey Feathers
[SpellName(261477)] = true, -- Dervish

-- [SpellName(308078)] = true, -- Debug
}
34 changes: 19 additions & 15 deletions KkthnxUI/Modules/Automation/Elements/BadBuffs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@ local _G = _G
local UnitBuff = _G.UnitBuff
local InCombatLockdown = _G.InCombatLockdown

local function SetupAutoBadBuffs(_, unit)
if unit == "player" and not InCombatLockdown() then
local i = 1
while true do
local name = UnitBuff(unit, i)
if not name then
return
end
local function SetupAutoBadBuffs(event)
if InCombatLockdown() then
return K:RegisterEvent("PLAYER_REGEN_ENABLED", SetupAutoBadBuffs)
elseif event == "PLAYER_REGEN_ENABLED" then
K:UnregisterEvent("PLAYER_REGEN_ENABLED", SetupAutoBadBuffs)
end

if C.CheckBadBuffs[name] then
CancelSpellByName(name)
K.Print(K.SystemColor .. ACTION_SPELL_AURA_REMOVED .. " [" .. name .. "].|r")
end
local index = 1
while true do
local name = UnitBuff("player", index)
if not name then
return
end

i = i + 1
if C.CheckBadBuffs[name] then
CancelSpellByName(name)
K.Print(K.SystemColor .. "Removed" .. " " .. GetSpellLink(name) .. "|r")
end

index = index + 1
end
end

function Module:CreateAutoBadBuffs()
if C["Automation"].NoBadBuffs then
K:RegisterEvent("UNIT_AURA", SetupAutoBadBuffs)
K:RegisterEvent("UNIT_AURA", SetupAutoBadBuffs, "player")
else
K:UnregisterEvent("UNIT_AURA", SetupAutoBadBuffs)
K:UnregisterEvent("UNIT_AURA", SetupAutoBadBuffs, "player")
end
end
8 changes: 4 additions & 4 deletions KkthnxUI/Modules/Inventory/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1100,18 +1100,18 @@ function Module:OnEnable()
self.bindType:SetFont(select(1, self.iLvl:GetFont()), 12, select(3, self.iLvl:GetFont()))

if showNewItem then
self.glowFrame = self.glowFrame or CreateFrame("Frame", nil, self, "BackdropTemplate")
self.glowFrame = CreateFrame("Frame", nil, self, "BackdropTemplate")
self.glowFrame:SetBackdrop({ edgeFile = C["Media"].Borders.GlowBorder, edgeSize = 12 })
self.glowFrame:SetPoint("TOPLEFT", self, -5, 5)
self.glowFrame:SetPoint("BOTTOMRIGHT", self, 5, -5)
self.glowFrame:Hide()

self.glowFrame.Animation = self.glowFrame.Animation or self.glowFrame:CreateAnimationGroup()
self.glowFrame.Animation = self.glowFrame:CreateAnimationGroup()
self.glowFrame.Animation:SetLooping("BOUNCE")
self.glowFrame.Animation.Fader = self.glowFrame.Animation:CreateAnimation("Alpha")
self.glowFrame.Animation.Fader:SetFromAlpha(0.8)
self.glowFrame.Animation.Fader:SetFromAlpha(1)
self.glowFrame.Animation.Fader:SetToAlpha(0.2)
self.glowFrame.Animation.Fader:SetDuration(1)
self.glowFrame.Animation.Fader:SetDuration(0.9)
self.glowFrame.Animation.Fader:SetSmoothing("OUT")
end

Expand Down

0 comments on commit c724f62

Please sign in to comment.