Implement dechickenation

This commit is contained in:
2024-12-21 00:02:45 +01:00
parent e0d736f01e
commit 4a55ffb0eb

View File

@@ -4,18 +4,25 @@ local addonname, shared = ...
---@class DechickenatorData
---@field blacklistedBuffs table<string, boolean>
if not Dechickenator_Data then Dechickenator_Data = {} end
if not Dechickenator_Data.blacklistedBuffs then Dechickenator_Data.blacklistedBuffs = {} end
local function init()
local cleuFrame = CreateFrame("Frame")
cleuFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
cleuFrame:SetScript("OnEvent", function(self, event, ...)
local subevent = CLEUParser.GetSubevent(...)
if subevent == "SPELL_AURA_APPLIED" then
if subevent == "SPELL_AURA_APPLIED" or subevent == "SPELL_AURA_REFRESH" then
local target = CLEUParser.GetDestName(...)
if target ~= UnitName("player") then return end
local spellName = CLEUParser.GetSpellName(...)
if not shared.Dechickenator_Data.blacklistedBuffs[spellName] then return end
print(spellName)
if not Dechickenator_Data.blacklistedBuffs[spellName] then return end
local source = CLEUParser.GetSourceName(...)
print(source)
local msg = string.format("Индивидуум %s хочет поделиться своим истинным обликом", tostring(source))
CancelUnitBuff("player", spellName)
SendChatMessage(msg, "SAY")
DoEmote("spit", source)
end
end)
@@ -32,11 +39,11 @@ end)
SlashCmdList["DECHICKENATOR_TOGGLE_BLACKLISTED_BUFF"] = function(input)
print("Toggling blacklisted buff: " .. tostring(input))
if shared.Dechickenator_Data.blacklistedBuffs[input] then
shared.Dechickenator_Data.blacklistedBuffs[input] = nil
if Dechickenator_Data.blacklistedBuffs[input] then
Dechickenator_Data.blacklistedBuffs[input] = nil
else
shared.Dechickenator_Data.blacklistedBuffs[input] = true
Dechickenator_Data.blacklistedBuffs[input] = true
end
print(shared.Dechickenator_Data.blacklistedBuffs[input])
print(Dechickenator_Data.blacklistedBuffs[input])
end
SLASH_DECHICKENATOR_TOGGLE_BLACKLISTED_BUFF1 = "/dechicken"