From b1dd53d6d961947a969396f17e6b646590275d94 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 22 Dec 2024 14:11:25 +0100 Subject: [PATCH] Add 1s timer to remove buffs --- Dechickenator.lua | 25 ++++++++++++++++++++++++- Dechickenator.zip | Bin 4466 -> 4613 bytes 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Dechickenator.lua b/Dechickenator.lua index 6e0d26f..38420ac 100644 --- a/Dechickenator.lua +++ b/Dechickenator.lua @@ -1,6 +1,10 @@ local addonname, shared = ... ---@cast addonname string +---@class shared +---@field timer number? +shared = { timer = nil } + ---@class DechickenatorData ---@field blacklistedBuffs table @@ -8,6 +12,25 @@ if not Dechickenator_Data then Dechickenator_Data = {} end if not Dechickenator_Data.blacklistedBuffs then Dechickenator_Data.blacklistedBuffs = {} end if not Dechickenator_Data.message then Dechickenator_Data.message = "Индивидуум %s хочет поделиться своим истинным обликом" end local function init() + local function RemoveBuff(buff) + if UnitAffectingCombat("player") then return end + CancelUnitBuff("player", buff) + end + local function RemoveBuffs() + if UnitAffectingCombat("player") then return end + for buff, enabled in pairs(Dechickenator_Data.blacklistedBuffs) do + if enabled then + RemoveBuff(buff) + end + end + end + + if not shared.timer then + shared.timer = C_Timer.NewTicker(1, function() + RemoveBuffs() + end) + end + local cleuFrame = CreateFrame("Frame") cleuFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") cleuFrame:SetScript("OnEvent", function(self, event, ...) @@ -19,7 +42,7 @@ local function init() if not Dechickenator_Data.blacklistedBuffs[spellName] then return end local source = CLEUParser.GetSourceName(...) local msg = string.format(Dechickenator_Data.message, tostring(source)) - CancelUnitBuff("player", spellName) + RemoveBuff(spellName) SendChatMessage(msg, "EMOTE") DoEmote("spit", source) end diff --git a/Dechickenator.zip b/Dechickenator.zip index e4624832b6498cf014140470cd9565875d7e9972..36d2ba6f97355fc0335372b2f808eda1ea7d3410 100644 GIT binary patch delta 1123 zcmV-p1f2WwB84QdAq);ha+X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