Rework data structure
To be a little more versatile
This commit is contained in:
@@ -4,9 +4,21 @@ local addonname, shared = ...
|
|||||||
---@class DechickenatorData
|
---@class DechickenatorData
|
||||||
---@field blacklistedBuffs table<string, boolean>
|
---@field blacklistedBuffs table<string, boolean>
|
||||||
|
|
||||||
|
---@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 then Dechickenator_Data = {} end
|
||||||
if not Dechickenator_Data.blacklistedBuffs then Dechickenator_Data.blacklistedBuffs = {} end
|
if not Dechickenator_Data.alerts then Dechickenator_Data.alerts = {} end
|
||||||
if not Dechickenator_Data.message then Dechickenator_Data.message = "Индивидуум %s хочет поделиться своим истинным обликом" end
|
|
||||||
local function init()
|
local function init()
|
||||||
local cleuFrame = CreateFrame("Frame")
|
local cleuFrame = CreateFrame("Frame")
|
||||||
cleuFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
cleuFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||||
@@ -16,12 +28,25 @@ local function init()
|
|||||||
local target = CLEUParser.GetDestName(...)
|
local target = CLEUParser.GetDestName(...)
|
||||||
if target ~= UnitName("player") then return end
|
if target ~= UnitName("player") then return end
|
||||||
local spellName = CLEUParser.GetSpellName(...)
|
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 source = CLEUParser.GetSourceName(...)
|
||||||
local msg = string.format(Dechickenator_Data.message, tostring(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)
|
CancelUnitBuff("player", spellName)
|
||||||
SendChatMessage(msg, "EMOTE")
|
end
|
||||||
DoEmote("spit", source)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user