diff --git a/Dechickenator.lua b/Dechickenator.lua index 6e0d26f..b45d5a8 100644 --- a/Dechickenator.lua +++ b/Dechickenator.lua @@ -4,9 +4,21 @@ local addonname, shared = ... ---@class DechickenatorData ---@field blacklistedBuffs table +---@alias auraType +---| 'BUFF' +---| 'DEBUFF' + +-- Lifebloom;B;R;e:spit;m:cuntfucker;c:YELL +---@class Alert +---@field message string? +---@field channel string? +---@field emote string? +---@field spellName string +---@field auraType string? +---@field remove boolean + 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 +if not Dechickenator_Data.alerts then Dechickenator_Data.alerts = {} end local function init() local cleuFrame = CreateFrame("Frame") cleuFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") @@ -16,12 +28,25 @@ local function init() local target = CLEUParser.GetDestName(...) if target ~= UnitName("player") then return end local spellName = CLEUParser.GetSpellName(...) - if not Dechickenator_Data.blacklistedBuffs[spellName] then return end + if not Dechickenator_Data.alerts[spellName] then return end local source = CLEUParser.GetSourceName(...) - local msg = string.format(Dechickenator_Data.message, tostring(source)) - CancelUnitBuff("player", spellName) - SendChatMessage(msg, "EMOTE") - DoEmote("spit", source) + if Dechickenator_Data.alerts[spellName].message then + local msg = Dechickenator_Data.alerts[spellName].message + if string.find(msg, "%s") then + msg = string.format(msg, tostring(source)) + end + local channel = "SAY" + if Dechickenator_Data.alerts[spellName].channel then + channel = Dechickenator_Data.alerts[spellName].channel + end + SendChatMessage(msg, channel) + end + if Dechickenator_Data.alerts[spellName].emote then + DoEmote(Dechickenator_Data.alerts[spellName].emote, source) + end + if Dechickenator_Data.alerts[spellName].remove then + CancelUnitBuff("player", spellName) + end end end)