3 Commits

Author SHA1 Message Date
57be5140aa Remove auratype 2024-12-21 10:58:25 +01:00
01550ebb67 Rework chickenator command 2024-12-21 10:53:21 +01:00
d064e8b64d Rework data structure
To be a little more versatile
2024-12-21 10:42:38 +01:00
5 changed files with 85 additions and 126 deletions

1
.gitattributes vendored
View File

@@ -1,2 +1 @@
.zip filter=lfs diff=lfs merge=lfs -text .zip filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

View File

@@ -1,36 +1,30 @@
local addonname, shared = ... local addonname, shared = ...
---@cast addonname string ---@cast addonname string
---@class shared
---@field timer number?
shared = { timer = nil }
---@class DechickenatorData ---@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 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 function RemoveBuff(buff)
if UnitAffectingCombat("player") then return end
CancelUnitBuff("player", buff)
end
local function RemoveBuffs()
if UnitAffectingCombat("player") then return end
for buff, enabled in pairs(Dechickenator_Data.blacklistedBuffs) do
if enabled then
RemoveBuff(buff)
end
end
end
if not shared.timer then
shared.timer = C_Timer.NewTicker(1, function()
RemoveBuffs()
end)
end
local cleuFrame = CreateFrame("Frame") local cleuFrame = CreateFrame("Frame")
cleuFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") cleuFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
cleuFrame:SetScript("OnEvent", function(self, event, ...) cleuFrame:SetScript("OnEvent", function(self, event, ...)
@@ -39,12 +33,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
RemoveBuff(spellName) local msg = Dechickenator_Data.alerts[spellName].message
SendChatMessage(msg, "EMOTE") if string.find(msg, "%s") then
DoEmote("spit", source) 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
end) end)
@@ -59,14 +66,52 @@ 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 == "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"

Binary file not shown.

View File

@@ -1,81 +0,0 @@
# Dechickenator
## Overview
Dechickenator is a World of Warcraft addon that automatically manages unwanted buffs with custom messaging.
## Versions
- **v1 (Master)**: Simple buff removal with predefined actions
- **v2.0**: More complex alert system with customizable actions
## Features
- Automatically remove unwanted buffs
- Send custom emote messages when buffs are applied
- Perform "spit" emote on buff source
## Installation
1. Download the [addon](https://git.site.quack-lab.dev/dave/wow_dechickenator/raw/branch/master/Dechickenator.zip)
2. Extract the addon to your World of Warcraft `Interface/AddOns` directory
3. Ensure the addon is enabled in the character selection screen
## Usage
### Toggling Blacklisted Buffs
Use `/dechicken BuffName` to add or remove a buff from the blacklist.
### Customizing Message
Use `/dechicken_message Your custom message with %s for source name`
### Examples
```
# Toggle "Greater Blessing of Kings" blacklist
/dechicken Greater Blessing of Kings
# Set a custom message
/dechicken_message %s thinks they're special!
```
## Default Behavior
- When a blacklisted buff is applied, it will be automatically removed
- An emote message will be sent (default: "Индивидуум %s хочет поделиться своим истинным обликом")
- A "spit" emote will be performed towards the buff source
# Dechickenator; Ruski
## Обзор
Dechickenator - это аддон для World of Warcraft, который автоматически управляет нежелательными баффами с настраиваемыми сообщениями.
## Версии
- **v1 (Master)**: Простое удаление баффов с предустановленными действиями
- **v2.0**: Более сложная система оповещений с настраиваемыми действиями
## Возможности
- Автоматическое удаление нежелательных баффов
- Отправка пользовательских эмоций при получении баффов
- Выполнение эмоции "плевок" в сторону источника баффа
## Установка
1. Скачайте [аддон](https://git.site.quack-lab.dev/dave/wow_dechickenator/raw/branch/master/Dechickenator.zip)
2. Распакуйте аддон в директорию World of Warcraft `Interface/AddOns`
3. Убедитесь, что аддон включен на экране выбора персонажа
## Использование
### Управление черным списком баффов
Используйте `/dechicken НазваниеБаффа` для добавления или удаления баффа из черного списка.
### Настройка сообщения
Используйте `/dechicken_message Ваше сообщение с %s для имени источника`
### Примеры
```
# Переключить "Великое благословение королей" в черном списке
/dechicken Великое благословение королей
# Установить пользовательское сообщение
/dechicken_message %s считает себя особенным!
```
## Поведение по умолчанию
- При получении баффа из черного списка он будет автоматически удален
- Будет отправлено сообщение с эмоцией (по умолчанию: "Индивидуум %s хочет поделиться своим истинным обликом")
- В сторону источника баффа будет выполнена эмоция "плевок"

View File

@@ -1,5 +1 @@
rm Dechickenator.zip 7z a Dechickenator.zip Dechickenator.toc Dechickenator.lua CLEUParser.lua
mkdir Dechickenator
cp *.lua *.toc Dechickenator
7z a Dechickenator.zip Dechickenator
rm -rf Dechickenator