Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
57be5140aa | |||
01550ebb67 | |||
d064e8b64d |
@@ -2,11 +2,28 @@ local addonname, shared = ...
|
||||
---@cast addonname string
|
||||
|
||||
---@class DechickenatorData
|
||||
---@field blacklistedBuffs table<string, boolean>
|
||||
---@field alerts table<string, Alert>
|
||||
|
||||
---@alias auraType
|
||||
---| 'BUFF'
|
||||
---| 'DEBUFF'
|
||||
|
||||
--/dechicken a:Greater Blessing of Kings;B;R;e:spit;m:cuntfucker;c:SAY
|
||||
--/dechicken a:Greater Blessing of Kings;B;R;e:spit;m:cuntfucker
|
||||
--/dechicken a:Greater Blessing of Kings;R;e:spit;m:cuntfucker
|
||||
--/dechicken a:Greater Blessing of Kings;B;R;m:cuntfucker
|
||||
--/dechicken a:Greater Blessing of Kings;R
|
||||
---@class Alert
|
||||
---@field message string?
|
||||
---@field channel string?
|
||||
---@field channelData string?
|
||||
---@field emote string?
|
||||
---@field spellName string
|
||||
---@field remove boolean?
|
||||
|
||||
--/run Dechickenator_Data = nil
|
||||
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 +33,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)
|
||||
|
||||
@@ -36,14 +66,52 @@ loadedFrame:SetScript("OnEvent", function(self, event, addonName)
|
||||
end
|
||||
end)
|
||||
|
||||
SlashCmdList["DECHICKENATOR_TOGGLE_BLACKLISTED_BUFF"] = function(input)
|
||||
print("Toggling blacklisted buff: " .. tostring(input))
|
||||
if Dechickenator_Data.blacklistedBuffs[input] then
|
||||
Dechickenator_Data.blacklistedBuffs[input] = nil
|
||||
else
|
||||
Dechickenator_Data.blacklistedBuffs[input] = true
|
||||
---@param table table
|
||||
---@param depth number?
|
||||
function DumpTable(table, depth)
|
||||
if depth == nil then
|
||||
depth = 0
|
||||
end
|
||||
if (depth > 200) then
|
||||
print("Error: Depth > 200 in dumpTable()")
|
||||
return
|
||||
end
|
||||
for k, v in pairs(table) do
|
||||
if (type(v) == "table") then
|
||||
print(string.rep(" ", depth) .. k .. ":")
|
||||
DumpTable(v, depth + 1)
|
||||
else
|
||||
print(string.rep(" ", depth) .. k .. ": ", v)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
SlashCmdList["DECHICKENATOR_TOGGLE_BLACKLISTED_BUFF"] = function(input)
|
||||
local fields = { strsplit(";", input) }
|
||||
---@type Alert
|
||||
local aura = { spellName = "" }
|
||||
|
||||
for _, field in ipairs(fields) do
|
||||
local data = { strsplit(":", field) }
|
||||
local key = strtrim(data[1])
|
||||
key = string.lower(key)
|
||||
if key == "a" then
|
||||
aura.spellName = strtrim(data[2])
|
||||
elseif key == "e" then
|
||||
aura.emote = strtrim(data[2])
|
||||
elseif key == "m" then
|
||||
aura.message = strtrim(data[2])
|
||||
elseif key == "c" then
|
||||
aura.channel = strtrim(data[2])
|
||||
elseif key == "r" then
|
||||
aura.remove = true
|
||||
end
|
||||
end
|
||||
|
||||
DumpTable(aura)
|
||||
if aura.spellName ~= "" then
|
||||
Dechickenator_Data.alerts[aura.spellName] = aura
|
||||
end
|
||||
print(Dechickenator_Data.blacklistedBuffs[input])
|
||||
end
|
||||
SLASH_DECHICKENATOR_TOGGLE_BLACKLISTED_BUFF1 = "/dechicken"
|
||||
|
||||
@@ -52,4 +120,4 @@ SlashCmdList["DECHICKENATOR_SET_MESSAGE"] = function(input)
|
||||
Dechickenator_Data.message = input
|
||||
print(Dechickenator_Data.message)
|
||||
end
|
||||
SLASH_DECHICKENATOR_SET_MESSAGE1 = "/dechicken_message"
|
||||
SLASH_DECHICKENATOR_SET_MESSAGE1 = "/dechicken_message"
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user