Files
DucielandClaude Opus 5.5 1f6e8540ea Snapshot of the installed OctoWoW BigWigs addon
Full state of the live install: prodigeomix fork content plus local
OctoWoW patches (MC/Onyxia/ZG/Karazhan timers, Golemagg, Thaurissan,
aura-scan perf, world markers), and the BWL changes from raid feedback:
- Razorgore: exact egg count via SuperWoW cast events, count synced
- Firemaw: Flame Buffet timer on by default, retimed from logs
- Blackwing Alchemist: assist marking, no Skull/Cross or mob marks,
  mark follows the fire chain
- Wyrmguard/Overseer: vulnerability read from the buff, one bar per mob
  with its raid mark and click-to-target
- Bars: BigWigs_SetBarRaidMark event to show a raid mark beside a bar

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:57:02 +01:00

273 lines
7.8 KiB
Lua

local module, L = BigWigs:ModuleDeclaration("Blackwing Alchemist", "Blackwing Lair")
-- module variables
module.revision = 30141
module.trashMod = true
module.enabletrigger = module.translatedName
module.toggleoptions = { "fire", "firesay", "fireother", "firemark" }
-- module defaults
module.defaultDB = {
fire = true,
firesay = true,
fireother = true,
firemark = false,
}
-- localization
L:RegisterTranslations("enUS", function()
return {
cmd = "BlackwingAlchemist",
fire_cmd = "fire",
fire_name = "Alchemist's Fire Alert",
fire_desc = "Get a personal warning when a Blackwing Alchemist puts Alchemist's Fire on you",
firesay_cmd = "firesay",
firesay_name = "Alchemist's Fire Say",
firesay_desc = "Announce to /say that you have the Alchemist's Fire debuff",
fireother_cmd = "fireother",
fireother_name = "Alchemist's Fire Warning",
fireother_desc = "Get warnings about other players suffering from Alchemist's Fire",
firemark_cmd = "firemark",
firemark_name = "Alchemist's Fire Mark",
firemark_desc = "Mark players suffering from Alchemist's Fire (raid leader or assist only; enable it on ONE person). Never uses Skull/Cross or a mark already on a mob; the mark follows the fire when it jumps.",
trigger_fire = "(.+) ...? afflicted by Alchemist's Fire",
msg_fire = "Get out of the raid! - Alchemist's Fire",
msg_fireOther = "Alchemist's Fire on %s",
bar_fire = "Alchemist's Fire",
say_fire = "Don't be near me - Alchemist's Fire!",
}
end)
-- timer and icon variables
local timer = {
fire = 8,
}
local icon = {
fire = "INV_Potion_33",
}
local syncName = {
fire = "BlackwingAlchemistFire" .. module.revision,
}
-- marks never used for players: Skull and Cross are kill targets
local reservedMarks = { 8, 7 }
local lastFire = {} -- player -> GetTime() of last handled affliction (dedupe of raid-wide syncs)
local fireMarks = {} -- player -> { mark = n, prev = n, expires = t }
function module:OnEnable()
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE", "AfflictionEvent")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE", "AfflictionEvent")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE", "AfflictionEvent")
self:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE", "AfflictionEvent") -- for pets
self:ThrottleSync(1, syncName.fire)
end
function module:OnSetup()
end
function module:OnEngage()
end
function module:OnDisengage()
-- scheduled un-marks were cancelled by Disengage: restore now so marks don't stick
for player in pairs(fireMarks) do
self:UnmarkFire(player)
end
fireMarks = {}
lastFire = {}
end
function module:AfflictionEvent(msg)
local _, _, player = string.find(msg, L["trigger_fire"])
if player then
player = player == "You" and UnitName("player") or player
-- player name inside the sync name: the comm throttle is per sync name, so two
-- players afflicted within 1s would otherwise drop the second one
self:Sync(syncName.fire .. player)
return
end
end
function module:BigWigs_RecvSync(sync, rest, nick)
if sync == syncName.fire and rest then
self:AlchemistsFire(rest)
return
end
local _, _, player = string.find(sync, syncName.fire .. "(.+)")
if player then
self:AlchemistsFire(player)
return
end
end
function module:AlchemistsFire(player)
local now = GetTime()
if lastFire[player] and now - lastFire[player] < 2 then return end
lastFire[player] = now
if player == UnitName("player") and self.db.profile.fire then
self:Message(L["msg_fire"], "Important", true, "RunAway")
self:Bar(L["bar_fire"], timer.fire, icon.fire, true, "Red")
if self.db.profile.firesay then
SendChatMessage(L["say_fire"], "SAY")
end
elseif self.db.profile.fireother then
self:Message(string.format(L["msg_fireOther"],player), "Urgent")
end
if self.db.profile.firemark then
self:MarkFire(player)
end
end
local function FindRaidUnit(player)
for i = 1, GetNumRaidMembers() do
if UnitName("raid" .. i) == player then
return "raid" .. i
end
end
return nil
end
-- marks currently on hostile units: raid members' targets, plus SuperWoW "markN" units
local function MarksOnMobs()
local exclude = {}
for _, m in ipairs(reservedMarks) do
table.insert(exclude, m)
end
for i = 1, GetNumRaidMembers() do
local unit = "raid" .. i .. "target"
if UnitExists(unit) and not UnitIsPlayer(unit) then
local m = GetRaidTargetIndex(unit)
if m then table.insert(exclude, m) end
end
end
if SUPERWOW_VERSION then
for m = 1, 8 do
local ok, exists = pcall(UnitExists, "mark" .. m)
if ok and exists and not UnitIsPlayer("mark" .. m) then
table.insert(exclude, m)
end
end
end
return exclude
end
-- Own marking instead of the core helpers: those only work for the raid leader.
-- Raid leader or assist may mark here, so only one person should enable the option.
function module:MarkFire(player)
if not (IsRaidLeader() or IsRaidOfficer()) then return end
local unit = FindRaidUnit(player)
if not unit then return end -- pets can catch it too, they can't be marked this way
local now = GetTime()
local mark, prev
-- the fire jumps when it expires (logs: within 0.1s): hand the expiring victim's mark over
for name, info in pairs(fireMarks) do
if name ~= player and info.expires - now < 1.5 then
mark = info.mark
self:UnmarkFire(name)
break
end
end
if fireMarks[player] then
-- re-applied on the same player: keep their original mark to restore later
prev = fireMarks[player].prev
mark = mark or fireMarks[player].mark
else
prev = GetRaidTargetIndex(unit) or 0
end
if not mark then
mark = self:GetAvailableRaidMark(MarksOnMobs(), true) -- from Star upward
end
if not mark then return end
SetRaidTarget(unit, mark)
fireMarks[player] = { mark = mark, prev = prev, expires = now + timer.fire }
self:CancelScheduledEvent("AlchemistFireUnmark" .. player)
self:ScheduleEvent("AlchemistFireUnmark" .. player, self.UnmarkFire, timer.fire + 0.5, self, player)
end
function module:UnmarkFire(player)
local info = fireMarks[player]
if not info then return end
fireMarks[player] = nil
self:CancelScheduledEvent("AlchemistFireUnmark" .. player)
local unit = FindRaidUnit(player)
if unit and GetRaidTargetIndex(unit) == info.mark then
SetRaidTarget(unit, info.prev or 0)
end
end
function module:Test()
self:Engage()
-- test characters
local player = UnitName("player")
local raid1 = UnitName("raid1") or "Raid1"
local raid2 = UnitName("raid2") or "Raid2"
local raid3 = UnitName("raid3") or "Raid2"
local events = {
-- Party Victim
{ time = 2, func = function()
local msg = raid1.." is afflicted by Alchemist's Fire."
print("Test: " .. msg)
self:TriggerEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE", msg)
end },
-- Self
{ time = 10, func = function()
local msg = "You are afflicted by Alchemist's Fire."
print("Test: " .. msg)
self:TriggerEvent("CHAT_MSG_SPELL_PERIODIC_SELF_DAMAGE", msg)
end },
-- Spread
{ time = 18, func = function()
local msg = raid1.." is afflicted by Alchemist's Fire."
print("Test: " .. msg)
self:TriggerEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_DAMAGE", msg)
end },
{ time = 18, func = function()
local msg = raid2.." is afflicted by Alchemist's Fire."
print("Test: " .. msg)
self:TriggerEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE", msg)
end },
{ time = 18, func = function()
local msg = raid3.." is afflicted by Alchemist's Fire."
print("Test: " .. msg)
self:TriggerEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_DAMAGE", msg)
end },
-- End of Test
{ time = 28, func = function()
print("Test: Disengage")
module:Disengage()
end },
}
-- Schedule each event
for i, event in ipairs(events) do
self:ScheduleEvent("BlackwingAlchemistTest" .. i, event.func, event.time)
end
self:Message(module.translatedName .. " test started", "Positive")
return true
end
-- Test command: /run BigWigs:GetModule("Blackwing Alchemist"):Test()