Rework chickenator command
This commit is contained in:
@@ -2,21 +2,26 @@ local addonname, shared = ...
|
|||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
|
||||||
---@class DechickenatorData
|
---@class DechickenatorData
|
||||||
---@field blacklistedBuffs table<string, boolean>
|
---@field alerts table<string, Alert>
|
||||||
|
|
||||||
---@alias auraType
|
---@alias auraType
|
||||||
---| 'BUFF'
|
---| 'BUFF'
|
||||||
---| 'DEBUFF'
|
---| 'DEBUFF'
|
||||||
|
|
||||||
-- Lifebloom;B;R;e:spit;m:cuntfucker;c:YELL
|
--/dechicken a:Lifebloom;B;R;e:spit;m:cuntfucker;c:YELL
|
||||||
|
--/dechicken a:Lifebloom;B;R;e:spit;m:cuntfucker
|
||||||
|
--/dechicken a:Lifebloom;R;e:spit;m:cuntfucker
|
||||||
|
--/dechicken a:Lifebloom;B;R;m:cuntfucker
|
||||||
|
--/dechicken a:Lifebloom;B;R
|
||||||
---@class Alert
|
---@class Alert
|
||||||
---@field message string?
|
---@field message string?
|
||||||
---@field channel string?
|
---@field channel string?
|
||||||
---@field emote string?
|
---@field emote string?
|
||||||
---@field spellName string
|
---@field spellName string
|
||||||
---@field auraType string?
|
---@field auraType string?
|
||||||
---@field remove boolean
|
---@field remove boolean?
|
||||||
|
|
||||||
|
--/run Dechickenator_Data = nil
|
||||||
if not Dechickenator_Data then Dechickenator_Data = {} end
|
if not Dechickenator_Data then Dechickenator_Data = {} end
|
||||||
if not Dechickenator_Data.alerts then Dechickenator_Data.alerts = {} end
|
if not Dechickenator_Data.alerts then Dechickenator_Data.alerts = {} end
|
||||||
local function init()
|
local function init()
|
||||||
@@ -61,14 +66,56 @@ loadedFrame:SetScript("OnEvent", function(self, event, addonName)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
SlashCmdList["DECHICKENATOR_TOGGLE_BLACKLISTED_BUFF"] = function(input)
|
---@param table table
|
||||||
print("Toggling blacklisted buff: " .. tostring(input))
|
---@param depth number?
|
||||||
if Dechickenator_Data.blacklistedBuffs[input] then
|
function DumpTable(table, depth)
|
||||||
Dechickenator_Data.blacklistedBuffs[input] = nil
|
if depth == nil then
|
||||||
else
|
depth = 0
|
||||||
Dechickenator_Data.blacklistedBuffs[input] = true
|
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 == "b" then
|
||||||
|
aura.auraType = "BUFF"
|
||||||
|
elseif key == "d" then
|
||||||
|
aura.auraType = "DEBUFF"
|
||||||
|
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
|
end
|
||||||
print(Dechickenator_Data.blacklistedBuffs[input])
|
|
||||||
end
|
end
|
||||||
SLASH_DECHICKENATOR_TOGGLE_BLACKLISTED_BUFF1 = "/dechicken"
|
SLASH_DECHICKENATOR_TOGGLE_BLACKLISTED_BUFF1 = "/dechicken"
|
||||||
|
|
||||||
@@ -77,4 +124,4 @@ SlashCmdList["DECHICKENATOR_SET_MESSAGE"] = function(input)
|
|||||||
Dechickenator_Data.message = input
|
Dechickenator_Data.message = input
|
||||||
print(Dechickenator_Data.message)
|
print(Dechickenator_Data.message)
|
||||||
end
|
end
|
||||||
SLASH_DECHICKENATOR_SET_MESSAGE1 = "/dechicken_message"
|
SLASH_DECHICKENATOR_SET_MESSAGE1 = "/dechicken_message"
|
||||||
|
|||||||
Reference in New Issue
Block a user