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

2094 lines
63 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
------------------------------
-- Are you local? --
------------------------------
local BZ = AceLibrary("Babble-Zone-2.2")
local BB = AceLibrary("Babble-Boss-2.2")
local L = AceLibrary("AceLocale-2.2"):new("BigWigs")
local surface = AceLibrary("Surface-1.0")
surface:Register("Armory", "Interface\\AddOns\\BigWigs\\Textures\\Armory")
surface:Register("Otravi", "Interface\\AddOns\\BigWigs\\Textures\\otravi")
surface:Register("Smooth", "Interface\\AddOns\\BigWigs\\Textures\\smooth")
surface:Register("Glaze", "Interface\\AddOns\\BigWigs\\Textures\\glaze")
surface:Register("Charcoal", "Interface\\AddOns\\BigWigs\\Textures\\Charcoal")
surface:Register("BantoBar", "Interface\\AddOns\\BigWigs\\Textures\\default")
----------------------------
-- Localization --
----------------------------
L:RegisterTranslations("enUS", function()
return {
["%s mod enabled"] = true,
["Target monitoring enabled"] = true,
["Target monitoring disabled"] = true,
["%s engaged!"] = true,
["%s has been defeated"] = true, -- "<boss> has been defeated"
["%s have been defeated"] = true, -- "<bosses> have been defeated"
-- AceConsole strings
["boss"] = true,
["Bosses"] = true,
["Options for boss modules."] = true,
["Options for bosses in %s."] = true, -- "Options for bosses in <zone>"
["Options for %s (r%s)."] = true, -- "Options for <boss> (<revision>)"
["plugin"] = true,
["Plugins"] = true,
["Options for plugins."] = true,
["extra"] = true,
["Extras"] = true,
["Options for extras."] = true,
["toggle"] = true,
["Active"] = true,
["Activate or deactivate this module."] = true,
["reboot"] = true,
["rebootall"] = true,
["Reboot"] = true,
["Reboot All"] = true,
["Reboot this module."] = true,
["debug"] = true,
["Debugging"] = true,
["Show debug messages."] = true,
["Forces the module to reset for everyone in the raid.\n\n(Requires assistant or higher)"] = true,
["%s has requested forced reboot for the %s module."] = true,
bosskill_cmd = "kill",
bosskill_name = "Boss death",
bosskill_desc = "Announce when boss is defeated",
["Other"] = true,
["Load"] = true,
["Load All"] = true,
["Load all %s modules."] = true,
-- AceConsole zone commands
["Zul'Gurub"] = "ZG",
["Molten Core"] = "MC",
["Blackwing Lair"] = "BWL",
["Ahn'Qiraj"] = "AQ40",
["Ruins of Ahn'Qiraj"] = "AQ20",
["Onyxia's Lair"] = "Onyxia",
["Naxxramas"] = "Naxxramas",
["Emerald Sanctum"] = "EmeraldSanctum",
["Tower of Karazhan"] = "Karazhan",
["Dire Maul"] = "DireMaul",
["Blackrock Spire"] = "BlackrockSpire",
["The Black Morass"] = "BlackMorass",
["Timbermaw Hold"] = "TMH",
["Silithus"] = true,
["Outdoor Raid Bosses"] = "Outdoor",
["Outdoor Raid Bosses Zone"] = "Outdoor Raid Bosses", -- DO NOT EVER TRANSLATE untill I find a more elegant option
["Battlegrounds"] = true,
["Alterac Valley"] = true,
["Arathi Basin"] = true,
--Name for exception bosses (neutrals that enable modules)
["Vaelastrasz the Corrupt"] = true,
["Lord Victor Nefarius"] = true,
["Solnius"] = true,
["Lieutenant General Andorov"] = true,
["You have slain %s!"] = true,
}
end)
L:RegisterTranslations("esES", function()
return {
["%s mod enabled"] = "Módulo de %s activado",
["Target monitoring enabled"] = "Monitorización del objetivo activado",
["Target monitoring disabled"] = "Monitorización del objetivo desactivado",
["%s engaged!"] = "¡Entrando en combate con %s!",
["%s has been defeated"] = "%s fue derrotado", -- "<boss> has been defeated"
["%s have been defeated"] = "%s fueron derrotados", -- "<bosses> have been defeated"
-- AceConsole strings
--["boss"] = "jefe",
["Bosses"] = "Jefes",
["Options for boss modules."] = "Opciones para módulos del jefe",
["Options for bosses in %s."] = "Opciones para jefes en %s", -- "Options for bosses in <zone>"
["Options for %s (r%s)."] = "Opciones para %s (r%s).", -- "Options for <boss> (<revision>)"
--["plugin"] = "plugin",
["Plugins"] = "Plugins",
["Options for plugins."] = "Opciones para plugins",
--["extra"] = "extra",
["Extras"] = "Extras",
["Options for extras."] = "Opciones para extras",
--["toggle"] = "alternar",
["Active"] = "Activo",
["Activate or deactivate this module."] = "Activa o desactiva este módulo",
--["reboot"] = "reiniciar",
--["rebootall"] = "reiniciartodos",
["Reboot"] = "Reiniciar",
["Reboot All"] = "Reiniciar Todos",
["Reboot this module."] = "Reinicia este módulo",
--["debug"] = "depurar",
["Debugging"] = "Depurando",
["Show debug messages."] = "Muestra mensajes de depura",
["Forces the module to reset for everyone in the raid.\n\n(Requires assistant or higher)"] = "Obliga al módulo que se reinicia para todos en la banda.\n\n(Requiere que seas asistente o líder)",
["%s has requested forced reboot for the %s module."] = "%s solicita un reinicio para el módulo %s",
--bosskill_cmd = "kill",
bosskill_name = "Muerte del Jefe",
bosskill_desc = "Anuncia cuando sea derrotado el jefe",
["Other"] = "Otro",
["Load"] = "Cargar",
["Load All"] = "Cargar todos",
["Load all %s modules."] = "Carga todos los módulos %s",
-- AceConsole zone commands
["Zul'Gurub"] = "ZG",
["Molten Core"] = "NM",
["Blackwing Lair"] = "GAN",
["Ahn'Qiraj"] = "AQ40",
["Ruins of Ahn'Qiraj"] = "AQ20",
["Onyxia's Lair"] = "Onyxia",
["Naxxramas"] = "Naxxramas",
["Emerald Sanctum"] = "EmeraldSanctum",
["Silithus"] = "Silithus",
["Outdoor Raid Bosses"] = "Afuera",
-- ["Outdoor Raid Bosses Zone"] = "Outdoor Raid Bosses", -- DO NOT EVER TRANSLATE untill I find a more elegant option
--Name for exception bosses (neutrals that enable modules)
["Vaelastrasz the Corrupt"] = "Vaelastrasz el Corrupto",
["Lord Victor Nefarius"] = "Lord Victor Nefarius",
["You have slain %s!"] = "¡Has matado %s!",
}
end)
L:RegisterTranslations("deDE", function()
return {
["%s mod enabled"] = "%s Modul aktiviert",
["Target monitoring enabled"] = "Zielüberwachung aktiviert",
["Target monitoring disabled"] = "Zielüberwachung deaktiviert",
["%s engaged!"] = "%s angegriffen!",
["%s has been defeated"] = "%s wurde besiegt", -- "<boss> has been defeated"
["%s have been defeated"] = "%s wurden besiegt", -- "<bosses> have been defeated"
-- AceConsole strings
-- ["boss"] = true,
["Bosses"] = "Bosse",
["Options for boss modules."] = "Optionen für Boss Module.",
["Options for bosses in %s."] = "Optionen für Bosse in %s.", -- "Options for bosses in <zone>"
["Options for %s (r%s)."] = "Optionen für %s (r%s).", -- "Options for <boss> (<revision>)"
-- ["plugin"] = true,
["Plugins"] = "Plugins",
["Options for plugins."] = "Optionen für Plugins.",
-- ["extra"] = true,
["Extras"] = "Extras",
["Options for extras."] = "Optionen für Extras.",
-- ["toggle"] = true,
["Active"] = "Aktivieren",
["Activate or deactivate this module."] = "Aktiviert oder deaktiviert dieses Modul.",
-- ["reboot"] = true,
["Reboot"] = "Neustarten",
["Reboot All"] = "Alles Neustarten",
["Reboot this module."] = "Startet dieses Modul neu.",
-- ["debug"] = true,
["Debugging"] = "Debugging",
["Show debug messages."] = "Zeige Debug Nachrichten.",
["Forces the module to reset for everyone in the raid.\n\n(Requires assistant or higher)"] = "Erzwingt dass das Modul für jeden im Raid zurückgesetzt wird.\n\n(Benötigt Schlachtzugleiter oder Assistent)",
["%s has requested forced reboot for the %s module."] = "%s hat einen Zwangsneustart für das %s-Modul beantragt.",
-- bosskill_cmd = "kill",
bosskill_name = "Boss besiegt",
bosskill_desc = "Melde, wenn ein Boss besiegt wurde.",
-- AceConsole zone commands
["Zul'Gurub"] = "ZG",
["Molten Core"] = "MC",
["Blackwing Lair"] = "BWL",
["Ahn'Qiraj"] = "AQ40",
["Ruins of Ahn'Qiraj"] = "AQ20",
["Onyxia's Lair"] = "Onyxia",
["Naxxramas"] = "Naxxramas",
["Emerald Sanctum"] = "EmeraldSanctum",
-- ["Silithus"] = true,
["Outdoor Raid Bosses"] = "Outdoor",
-- ["Outdoor Raid Bosses Zone"] = "Outdoor Raid Bosses", -- DO NOT EVER TRANSLATE untill I find a more elegant option
["You have slain %s!"] = "Ihr habt %s getötet!",
}
end)
L:RegisterTranslations("zhCN", function()
return {
["%s mod enabled"] = "%s 模块已启用",
["Target monitoring enabled"] = "目标监视已启用",
["Target monitoring disabled"] = "目标监视已禁用",
["%s engaged!"] = "%s 开战!",
["%s has been defeated"] = "%s 已被击败",
["%s have been defeated"] = "%s 已被击败",
["boss"] = "boss",
["Bosses"] = "Boss 模块",
["Options for boss modules."] = "Boss 模块设置。",
["Options for bosses in %s."] = "%s 的 Boss 模块设置。",
["Options for %s (r%s)."] = "%s (r%s) 的设置。",
["plugin"] = "插件",
["Plugins"] = "插件模块",
["Options for plugins."] = "插件模块设置。",
["extra"] = "额外",
["Extras"] = "额外功能",
["Options for extras."] = "额外功能设置。",
["toggle"] = "切换",
["Active"] = "启用",
["Activate or deactivate this module."] = "启用或停用此模块。",
["reboot"] = "重启",
["rebootall"] = "重启全部",
["Reboot"] = "重启",
["Reboot All"] = "重启全部",
["Reboot this module."] = "重启此模块。",
["debug"] = "调试",
["Debugging"] = "调试",
["Show debug messages."] = "显示调试信息。",
["Forces the module to reset for everyone in the raid.\n\n(Requires assistant or higher)"] = "强制重置团队中所有人的模块。\n\n(需要助理或更高权限)",
["%s has requested forced reboot for the %s module."] = "%s 请求强制重启 %s 模块。",
bosskill_cmd = "kill",
bosskill_name = "Boss 死亡",
bosskill_desc = "当 Boss 被击败时通告",
["Other"] = "其他",
["Load"] = "加载",
["Load All"] = "加载全部",
["Load all %s modules."] = "加载所有 %s 模块。",
["Zul'Gurub"] = "ZG",
["Molten Core"] = "MC",
["Blackwing Lair"] = "BWL",
["Ahn'Qiraj"] = "AQ40",
["Ruins of Ahn'Qiraj"] = "AQ20",
["Onyxia's Lair"] = "Onyxia",
["Naxxramas"] = "Naxxramas",
["Emerald Sanctum"] = "EmeraldSanctum",
["Tower of Karazhan"] = "Karazhan",
["Dire Maul"] = "DireMaul",
["Blackrock Spire"] = "BlackrockSpire",
["The Black Morass"] = "BlackMorass",
["Silithus"] = "Silithus",
["Outdoor Raid Bosses"] = "Outdoor",
["Outdoor Raid Bosses Zone"] = "Outdoor Raid Bosses",
["Battlegrounds"] = "战场",
["Alterac Valley"] = "Alterac Valley",
["Arathi Basin"] = "Arathi Basin",
["Vaelastrasz the Corrupt"] = "堕落的瓦拉斯塔兹",
["Lord Victor Nefarius"] = "维克多·奈法里奥斯领主",
["Solnius"] = "索尔纽斯",
["Lieutenant General Andorov"] = "安多洛夫中将",
["You have slain %s!"] = "你击杀了 %s!",
}
end)
---------------------------------
-- Addon Declaration --
---------------------------------
BigWigs = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceDebug-2.0", "AceModuleCore-2.0", "AceConsole-2.0", "AceDB-2.0", "AceHook-2.1")
BigWigs:SetModuleMixins("AceDebug-2.0", "AceEvent-2.0", "CandyBar-2.2")
BigWigs:RegisterDB("BigWigsDB", "BigWigsDBPerChar")
BigWigs.cmdtable = {
type = "group",
handler = BigWigs,
args = {
[L["boss"]] = {
type = "group",
name = L["Bosses"],
desc = L["Options for boss modules."],
order = 1,
args = {},
disabled = function()
return not BigWigs:IsActive()
end,
},
[L["plugin"]] = {
type = "group",
name = L["Plugins"],
desc = L["Options for plugins."],
order = 2,
args = {},
disabled = function()
return not BigWigs:IsActive()
end,
},
[L["extra"]] = {
type = "group",
name = L["Extras"],
desc = L["Options for extras."],
order = 3,
args = {},
disabled = function()
return not BigWigs:IsActive()
end,
},
["editlayout"] = {
type = "execute",
name = "Edit Layout",
order = 4,
desc = "Edit frame layout and alert sizes",
func = function()
BigWigs:EditLayout()
end,
disabled = function()
return not BigWigs:IsActive()
end,
},
["priest"] = {
type = "execute",
name = "Priest Healer Profile",
order = 5,
desc = "Optimize BigWigs for Priest Healers (compact bars, no screen flash, clutter disabled).",
func = function()
BigWigs:OptimizeHealerProfile()
end,
},
["test"] = {
type = "execute",
name = "Test / Preview",
order = 6,
desc = "Start or stop a test of BigWigs timer bars, messages, and warning icons.",
func = function()
if not BigWigs:IsModuleActive("Test") and BigWigs:HasModule("Test") then
BigWigs:ToggleModuleActive("Test", true)
end
if BigWigsTest and BigWigsTest.BigWigs_Test then
BigWigsTest:BigWigs_Test()
else
BigWigs:TriggerEvent("BigWigs_Test")
end
end,
},
["preview"] = {
type = "execute",
name = "Preview Bars & Layout",
order = 7,
desc = "Preview timer bars, messages, and layout.",
func = function()
if not BigWigs:IsModuleActive("Test") and BigWigs:HasModule("Test") then
BigWigs:ToggleModuleActive("Test", true)
end
if BigWigsTest and BigWigsTest.BigWigs_Test then
BigWigsTest:BigWigs_Test()
else
BigWigs:TriggerEvent("BigWigs_Test")
end
end,
},
}
}
BigWigs:RegisterChatCommand({ "/bw", "/BigWigs" }, BigWigs.cmdtable)
BigWigs.debugFrame = ChatFrame1
BigWigs.revision = tonumber(GetAddOnMetadata("BigWigs", "X-Revision")) or 0
BigWigs.markUnitsWhenNotRaidLeader = false -- too many people marking causes issues, can turn on if needed
function BigWigs:OptimizeHealerProfile()
if not self:IsActive() then
self:ToggleActive(true)
end
-- 1. Configure Bars: compact, clean anchor, no screen flashes, no jumping
if BigWigsBars and BigWigsBars.db and BigWigsBars.db.profile then
BigWigsBars.db.profile.scale = 0.85
BigWigsBars.db.profile.width = 185
BigWigsBars.db.profile.height = 14
BigWigsBars.db.profile.growup = false
BigWigsBars.db.profile.texture = "BantoBar"
BigWigsBars.db.profile.posx = 960
BigWigsBars.db.profile.posy = 700
BigWigsBars.db.profile.emphasize = true
BigWigsBars.db.profile.emphasizeMove = false
BigWigsBars.db.profile.emphasizeFlash = false
BigWigsBars.db.profile.emphasizeScale = 1.05
BigWigsBars.db.profile.duration = 0.5
BigWigsBars.db.profile.intervalbar = true
if BigWigsBars.frames and BigWigsBars.frames.anchor then
BigWigsBars.frames.anchor:ClearAllPoints()
BigWigsBars.frames.anchor:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", 960, 700)
end
end
-- 2. Configure Messages: compact, clean top-center anchor
if BigWigsMessages and BigWigsMessages.db and BigWigsMessages.db.profile then
BigWigsMessages.db.profile.scale = 0.85
BigWigsMessages.db.profile.usecolors = true
BigWigsMessages.db.profile.posx = 650
BigWigsMessages.db.profile.posy = 720
if BigWigsMessages.frames and BigWigsMessages.frames.anchor then
BigWigsMessages.frames.anchor:ClearAllPoints()
BigWigsMessages.frames.anchor:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", 650, 720)
end
if BigWigsMessages.msgframe then
BigWigsMessages.msgframe:SetScale(0.85)
end
end
-- 3. Configure Common Auras: keep tank & dispel defensives, silence toy & portal spam
if BigWigsCommonAuras and BigWigsCommonAuras.db and BigWigsCommonAuras.db.profile then
local cap = BigWigsCommonAuras.db.profile
cap.fearward = true
cap.shieldwall = true
cap.laststand = true
cap.lifegivinggem = true
cap.challengingshout = true
cap.challengingroar = true
cap.spiritlink = true
cap.di = true
cap.bop = true
cap.powerinfusion = true
cap.lip = true
cap.portal = false
cap.wormhole = false
cap.orange = false
cap.soulwell = false
cap.shutdown = false
cap.invis = false
cap.deepwood = false
cap.broadcast = false
cap.aq40artifact = false
cap.aq40insignia = false
end
-- 4. Configure BossBlock: suppress chat and emote clutter during encounters
if BigWigsBossBlock and BigWigsBossBlock.db and BigWigsBossBlock.db.profile then
local bbp = BigWigsBossBlock.db.profile
bbp.hideraidchat = true
bbp.hideraidwarnchat = true
bbp.hideraidwarn = true
bbp.hideraidsay = true
bbp.hidetells = true
end
-- 5. Configure Spell Requests: disable floating button frames
if BigWigsSpellRequests and BigWigsSpellRequests.db and BigWigsSpellRequests.db.profile then
local srp = BigWigsSpellRequests.db.profile
srp.showrequestsframe = false
srp.showcooldownsframe = false
srp.barDuration = 4
end
-- 6. Configure Warning Sign: compact and clean
if BigWigsWarningSign and BigWigsWarningSign.db and BigWigsWarningSign.db.profile then
local wsp = BigWigsWarningSign.db.profile
wsp.scale = 0.65
wsp.alpha = 0.75
wsp.posx = 640
wsp.posy = 560
end
-- 7. Disable noisy non-healer plugins
local noiseModules = {
"MageTools",
"Tranq",
"Zombie Food",
"Target Monitor",
"Threat",
"Resist Check",
"RaidOfficer",
"Combat Announcement",
}
for _, modName in ipairs(noiseModules) do
if self:HasModule(modName) and self:IsModuleActive(modName) then
self:ToggleModuleActive(modName, false)
end
end
-- 8. Ensure essential plugins are active
local essentialPlugins = {
"Bars",
"Messages",
"Colors",
"Sounds",
"BossBlock",
"Common Auras",
"WarningSign",
"Range",
"Proximity",
}
for _, plugName in ipairs(essentialPlugins) do
if self:HasModule(plugName) and not self:IsModuleActive(plugName) then
self:ToggleModuleActive(plugName, true)
end
end
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00[BigWigs]|r Profile optimized for |cffffd100Priest Healer|r! Visual clutter reduced, timers slimmed, and screen flashes disabled.")
end
function BigWigs:EditLayout()
BigWigsBars:BigWigs_ShowAnchors()
BigWigsMessages:BigWigs_ShowAnchors()
BigWigsWarningSign:ShowAnchor()
-- if mage show mage tools anchor
local _, englishClass = UnitClass("player");
if englishClass == "MAGE" then
BigWigsMageTools:ShowAnchors()
end
end
function BigWigs:DebugMessage(msg, module)
if not msg then
msg = ""
end
local prefix = "|cfB34DFFf[BigWigs Debug]|r - ";
local core = BigWigs
local debugFrame = DEFAULT_CHAT_FRAME
if module then
if module.core then
core = module.core
end
if module.debugFrame then
debugFrame = self.debugFrame
end
end
if core:IsDebugging() then
(debugFrame or DEFAULT_CHAT_FRAME):AddMessage(prefix .. msg)
end
end
--------------------------------
-- Module Prototype --
--------------------------------
-- do not override
BigWigs.modulePrototype.core = BigWigs
BigWigs.modulePrototype.debugFrame = ChatFrame1
BigWigs.modulePrototype.engaged = false
BigWigs.modulePrototype.bossSync = nil -- "Ouro"
-- override
BigWigs.modulePrototype.revision = 1 -- To be overridden by the module!
BigWigs.modulePrototype.started = false
BigWigs.modulePrototype.zonename = nil -- AceLibrary("Babble-Zone-2.2")["Ahn'Qiraj"]
BigWigs.modulePrototype.enabletrigger = nil -- boss
BigWigs.modulePrototype.wipemobs = nil -- adds that will be considered in CheckForEngage
BigWigs.modulePrototype.toggleoptions = nil -- {"sweep", "sandblast", "scarab", -1, "emerge", "submerge", -1, "berserk", "bosskill"}
BigWigs.modulePrototype.proximityCheck = nil -- function(unit) return CheckInteractDistance(unit, 2) end
BigWigs.modulePrototype.proximitySilent = nil -- false
-- do not override
function BigWigs.modulePrototype:IsBossModule()
return self.zonename and self.enabletrigger and true
end
-- do not override
function BigWigs.modulePrototype:DebugMessage(msg)
self.core:DebugMessage(msg, self)
end
-- do not override
function BigWigs.modulePrototype:OnInitialize()
-- Unconditionally register, this shouldn't happen from any other place
-- anyway.
self.core:RegisterModule(self.name, self)
-- Notify observers that we have loaded.
self:TriggerEvent("BigWigs_ModuleLoaded", self.name, self)
-- workaround to trigger OnSetup if enabled manually
self:RegisterEvent("Ace2_AddonEnabled")
end
function BigWigs.modulePrototype:Ace2_AddonEnabled(module)
if module and type(module) == "table" and module:ToString() == self:ToString() and self:IsBossModule() then
BigWigs:SetupModule(module:ToString())
end
end
-- override
function BigWigs.modulePrototype:OnSetup()
end
function BigWigs.modulePrototype:OnEngage()
end
function BigWigs.modulePrototype:OnDisengage()
end
-- do not override
function BigWigs.modulePrototype:Engage()
self:DebugMessage("Engage() " .. self:ToString())
if not BigWigs:IsActive() then
BigWigs:ToggleActive(true)
end
if not BigWigs:IsModuleActive(self) then
BigWigs:EnableModule(self:ToString())
end
if self.bossSync and not self.engaged then
self.engaged = true
self:Message(string.format(L["%s engaged!"], self.translatedName), "Positive")
BigWigsBossRecords:StartBossfight(self)
self.storedPlayerMarks = {}
-- store initial marks for disengage
self.initialPlayerMarks = {}
self.recentlyUsedMarks = {}
if IsRaidLeader() or BigWigs.markUnitsWhenNotRaidLeader then
for i = 1, GetNumRaidMembers() do
local playerUnit = "raid" .. i
local playerName = UnitName(playerUnit)
if playerName then
self.initialPlayerMarks[playerName] = GetRaidTargetIndex(playerUnit) or 0
end
end
end
self:OnEngage()
end
end
function BigWigs.modulePrototype:Disengage()
if BigWigs:IsModuleActive(self) then
self.engaged = false
self.started = false
self:CancelAllScheduledEvents()
BigWigsAutoReply:EndBossfight()
self:RemoveIcon()
self:RemoveWarningSign("", true)
BigWigsBars:Disable(self)
if BigWigsBars.BigWigs_HideCounterBars then
BigWigsBars:BigWigs_HideCounterBars()
end
self:RemoveProximity()
if BigWigsWorldMarkers then
BigWigsWorldMarkers:OnFightEnd(self)
end
if self.initialPlayerMarks then
for player in pairs(self.initialPlayerMarks) do
self:RestoreInitialRaidTargetForPlayer(player)
end
self.initialPlayerMarks = {}
end
self.recentlyUsedMarks = {}
self:OnDisengage()
end
end
function BigWigs.modulePrototype:Victory()
if self.engaged then
if self.db.profile.bosskill then
self:Message(string.format(L["%s has been defeated"], self.translatedName), "Bosskill", nil)
--Screenshot()
end
BigWigsBossRecords:EndBossfight(self)
self:DebugMessage("Boss dead, disabling module [" .. self:ToString() .. "].")
self.core:DisableModule(self:ToString())
end
end
function BigWigs.modulePrototype:Disable()
self.castEventUnits = nil
self:Disengage()
self.core:ToggleModuleActive(self, false)
end
-- synchronize functions
function BigWigs.modulePrototype:GetEngageSync()
return "BossEngaged"
end
function BigWigs.modulePrototype:SendEngageSync()
if self.bossSync then
--self:TriggerEvent("BigWigs_SendSync", "BossEngaged "..self:ToString())
self:Sync(self:GetEngageSync() .. " " .. self.bossSync)
end
end
function BigWigs.modulePrototype:GetWipeSync()
return "BossWipe"
end
--[[function BigWigs.modulePrototype:SendWipeSync()
if self.bossSync then
--self:TriggerEvent("BigWigs_SendSync", "BossEngaged "..self:ToString())
self:Sync(self:GetWipeSync() .. " " .. self.bossSync)
end
end]]
function BigWigs.modulePrototype:GetBossDeathSync()
return "BossDeath"
end
function BigWigs.modulePrototype:SendBossDeathSync()
if self.bossSync then
--self:TriggerEvent("BigWigs_SendSync", "Bosskill "..self.bossSync)
self:Sync(self:GetBossDeathSync() .. " " .. self.bossSync)
end
end
-- Add to BigWigs.modulePrototype section in Core.lua
function BigWigs.modulePrototype:SetRaidTargetForPlayer(player, mark)
if not IsRaidLeader() and not BigWigs.markUnitsWhenNotRaidLeader then
return false
end
local playerUnit = nil
for i = 1, GetNumRaidMembers() do
if UnitName("raid" .. i) == player then
playerUnit = "raid" .. i
break
end
end
if not playerUnit then
return false
end
-- Store previous mark before changing it
local previousMark = GetRaidTargetIndex(playerUnit) or 0
if not self.storedPlayerMarks then
self.storedPlayerMarks = {}
end
self.storedPlayerMarks[player] = previousMark
-- Store initial mark if not already stored
if not self.initialPlayerMarks then
self.initialPlayerMarks = {}
end
if self.initialPlayerMarks[player] == nil then
self.initialPlayerMarks[player] = previousMark
end
-- look up mark index if name string was input
if type(mark) == "string" then
mark = BigWigs:RaidTargetLookup(mark)
end
SetRaidTarget(playerUnit, mark)
return true
end
function BigWigs.modulePrototype:GetAvailableRaidMark(excludeMarks, reverse)
excludeMarks = excludeMarks or {}
local usedMarks = {}
local currentTime = GetTime()
-- Initialize recentlyUsedMarks if needed
if not self.recentlyUsedMarks then
self.recentlyUsedMarks = {}
end
-- Mark existing raid targets as used
for i = 1, GetNumRaidMembers() do
local mark = GetRaidTargetIndex("raid" .. i)
if mark then
usedMarks[mark] = true
end
end
-- Add excluded marks to used marks
for _, mark in ipairs(excludeMarks) do
local markIndex = type(mark) == "string" and BigWigs:RaidTargetLookup(mark) or mark
if markIndex then
usedMarks[markIndex] = true
end
end
-- Add recently used marks (within the last second) to used marks
for mark, timestamp in pairs(self.recentlyUsedMarks) do
if currentTime - timestamp < 1 then
usedMarks[mark] = true
end
end
local start, stop, step = 8, 1, -1
if reverse then start, stop, step = 1, 8, 1 end
-- Find first available mark (prioritizing skull/8, then down to 1)
for i = start, stop, step do
if not usedMarks[i] then
-- Record this mark as recently used with current timestamp
self.recentlyUsedMarks[i] = currentTime
return i
end
end
return nil -- No marks available
end
function BigWigs.modulePrototype:RestorePreviousRaidTargetForPlayer(player)
if not IsRaidLeader() and not BigWigs.markUnitsWhenNotRaidLeader then
return false
end
if not self.storedPlayerMarks or not self.storedPlayerMarks[player] then
return false
end
local playerUnit = nil
for i = 1, GetNumRaidMembers() do
if UnitName("raid" .. i) == player then
playerUnit = "raid" .. i
break
end
end
if not playerUnit then
return false
end
SetRaidTarget(playerUnit, self.storedPlayerMarks[player])
self.storedPlayerMarks[player] = nil
return true
end
function BigWigs.modulePrototype:RestoreInitialRaidTargetForPlayer(player)
if not IsRaidLeader() and not BigWigs.markUnitsWhenNotRaidLeader then
return false
end
if not self.initialPlayerMarks or not self.initialPlayerMarks[player] then
return false
end
local playerUnit = nil
for i = 1, GetNumRaidMembers() do
if UnitName("raid" .. i) == player then
playerUnit = "raid" .. i
break
end
end
if not playerUnit then
return false
end
SetRaidTarget(playerUnit, self.initialPlayerMarks[player])
return true
end
-- event handler
local yellTriggers = {} -- [i] = {yell, bossmod}
function BigWigs.modulePrototype:RegisterYellEngage(yell)
-- Bosses with Yells as Engagetrigger should go through even when the bossmod isn't active yet.
tinsert(yellTriggers, { yell, self })
end
function BigWigs:CHAT_MSG_MONSTER_YELL(msg)
for i = 1, table.getn(yellTriggers) do
local yell = yellTriggers[i][1]
local mod = yellTriggers[i][2]
if string.find(msg, yell) then
-- enable and engage
self:EnableModule(mod:ToString())
--self:TriggerEvent("BigWigs_SendSync", "BossEngaged "..self:ToString())
mod:DebugMessage(mod:ToString() .. " CHAT_MSG_MONSTER_YELL Engage")
mod:SendEngageSync()
end
end
end
BigWigs:RegisterEvent("CHAT_MSG_MONSTER_YELL")
function BigWigs:CheckForEngage(module)
if module and module:IsBossModule() and not module.engaged then
local function IsBossInCombat()
local t = module.enabletrigger
local a = module.wipemobs
if not t then
return false
end
if type(t) == "string" then
t = { t }
end
if a then
if type(a) == "string" then
a = { a }
end
for k, v in pairs(a) do
table.insert(t, v)
end
end
if UnitExists("target") and UnitAffectingCombat("target") then
local target = UnitName("target")
for _, mob in pairs(t) do
if target == mob then
return true
end
end
end
local num = GetNumRaidMembers()
for i = 1, num do
local raidUnit = string.format("raid%starget", i)
if UnitExists(raidUnit) and UnitAffectingCombat(raidUnit) then
local target = UnitName(raidUnit)
for _, mob in pairs(t) do
if target == mob then
return true
end
end
end
end
return false
end
local inCombat = IsBossInCombat()
local running = module:IsEventScheduled(module:ToString() .. "_CheckStart")
if inCombat then
module:DebugMessage("Scan returned true, engaging [" .. module:ToString() .. "].")
module:CancelScheduledEvent(module:ToString() .. "_CheckStart")
module:Engage()
module:SendEngageSync()
elseif not running then
module:ScheduleRepeatingEvent(module:ToString() .. "_CheckStart", module.CheckForEngage, .5, module)
end
end
end
function BigWigs.modulePrototype:CheckForEngage()
BigWigs:CheckForEngage(self)
end
function BigWigs:CheckForWipe(module)
if module and module:IsBossModule() then
-- prevent reset from someone outside the instance
local isInZone = false
if type(module.zonename) == "string" and module.zonename == GetRealZoneText() then
isInZone = true
elseif type(module.zonename) == "table" then
for _, v in pairs(module.zonename) do
if v == GetRealZoneText() then
isInZone = true
break
end
end
end
if not isInZone then
return
end
--module:DebugMessage("BigWigs." .. module:ToString() .. ":CheckForWipe()")
-- start wipe check in regular intervals
local running = module:IsEventScheduled(module:ToString() .. "_CheckWipe")
if not running then
module:DebugMessage("CheckForWipe not running")
module:ScheduleRepeatingEvent(module:ToString() .. "_CheckWipe", module.CheckForWipe, 5, module)
return
end
local function RaidMemberInCombat()
if UnitAffectingCombat("player") then
return true
end
for i = 1, GetNumRaidMembers() do
local raidUnit = string.format("raid%s", i)
if UnitExists(raidUnit) and UnitAffectingCombat(raidUnit) then
return true
end
end
return false
end
local function RaidMemberAlive()
if not UnitIsDeadOrGhost("player") then
return true
end
for i = 1, GetNumRaidMembers() do
local raidUnit = string.format("raid%s", i)
if UnitExists(raidUnit) and not UnitIsDeadOrGhost(raidUnit) then
return true
end
end
return false
end
if not RaidMemberAlive() or not RaidMemberInCombat() then
module:DebugMessage("Wipe detected for module [" .. module:ToString() .. "].")
module:CancelScheduledEvent(module:ToString() .. "_CheckWipe")
self:TriggerEvent("BigWigs_RebootModule", module:ToString())
--module:SendWipeSync()
end
end
end
function BigWigs.modulePrototype:CheckForWipe()
BigWigs:CheckForWipe(self)
end
function BigWigs.modulePrototype:OnFriendlyDeath(msg)
end
-- don't override
function BigWigs.modulePrototype:CHAT_MSG_COMBAT_FRIENDLY_DEATH(msg)
self:OnFriendlyDeath(msg)
self:CheckForWipe()
end
function BigWigs:CheckForBossDeath(msg, module)
if module and module:IsBossModule() then
if msg == string.format(UNITDIESOTHER, module:ToString()) or msg == string.format(L["You have slain %s!"], module.translatedName) then
module:SendBossDeathSync()
end
end
end
function BigWigs.modulePrototype:CheckForBossDeath(msg)
BigWigs:CheckForBossDeath(msg, self)
end
function BigWigs.modulePrototype:OnEnemyDeath(msg)
end
-- don't override
function BigWigs.modulePrototype:CHAT_MSG_COMBAT_HOSTILE_DEATH(msg)
self:OnEnemyDeath(msg)
self:CheckForBossDeath(msg)
end
-- override
function BigWigs.modulePrototype:BigWigs_RecvSync(sync, rest, nick)
end
-- test function
function BigWigs.modulePrototype:Test()
BigWigs:Print("No tests defined for module " .. self:ToString())
end
if SUPERWOW_STRING or SetAutoloot then
local testGuids = {
["0xF13000F1F3276A33"] = "Keeper Gnarlmoon",
}
function BigWigs.modulePrototype:RegisterUnitCastEvent()
if not self:IsEventRegistered("UNIT_CASTEVENT") then
self:RegisterEvent("UNIT_CASTEVENT", function(casterGuid, targetGuid, eventType, spellId, castTime)
if self.castEventUnits then
local unitName = UnitName(casterGuid)
if not unitName or unitName == "Unknown" then
if testGuids[casterGuid] then
unitName = testGuids[casterGuid]
end
end
if unitName and self.castEventUnits[unitName] then
local callback = self.castEventUnits[unitName]
if type(callback) == "function" then
callback(self, casterGuid, targetGuid, eventType, spellId, castTime)
elseif type(callback) == "string" and type(self[callback]) == "function" then
self[callback](self, casterGuid, targetGuid, eventType, spellId, castTime)
else
DEFAULT_CHAT_FRAME:AddMessage("Invalid callback for unit " .. unitName)
self.castEventUnits[unitName] = nil
end
end
end
end)
end
end
function BigWigs.modulePrototype:RegisterCastEventsForUnitName(unitName, callback)
self:RegisterUnitCastEvent()
if not self.castEventUnits then
self.castEventUnits = {}
end
if not self.castEventUnits[unitName] then
self.castEventUnits[unitName] = callback
end
end
end
------------------------------
-- Provided API --
------------------------------
local delayPrefix = "ScheduledEventPrefix"
function BigWigs.modulePrototype:Sync(sync)
self:TriggerEvent("BigWigs_SendSync", sync)
end
function BigWigs.modulePrototype:DelayedSync(delay, sync)
self:ScheduleEvent(delayPrefix .. "Sync" .. self:ToString() .. sync, "BigWigs_SendSync", delay, sync)
end
function BigWigs.modulePrototype:CancelDelayedSync(sync)
self:CancelScheduledEvent(delayPrefix .. "Sync" .. self:ToString() .. sync)
end
function BigWigs.modulePrototype:ThrottleSync(throttle, sync)
self:TriggerEvent("BigWigs_ThrottleSync", sync, throttle)
end
function BigWigs.modulePrototype:Message(text, priority, noRaidSay, sound, broadcastOnly)
self:TriggerEvent("BigWigs_Message", text, priority, noRaidSay, sound, broadcastOnly)
end
function BigWigs.modulePrototype:DelayedMessage(delay, text, priority, noRaidSay, sound, broadcastOnly)
return self:ScheduleEvent(delayPrefix .. "Message" .. self:ToString() .. text, "BigWigs_Message", delay, text, priority, noRaidSay, sound, broadcastOnly)
end
function BigWigs.modulePrototype:CancelDelayedMessage(text)
self:CancelScheduledEvent(delayPrefix .. "Message" .. self:ToString() .. text)
end
function BigWigs.modulePrototype:Bar(text, time, icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize, target, spell)
self:TriggerEvent("BigWigs_StartBar", self, text, time, "Interface\\Icons\\" .. icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize, target, spell)
end
function BigWigs.modulePrototype:RemoveBar(text)
self:TriggerEvent("BigWigs_StopBar", self, text)
end
function BigWigs.modulePrototype:IntervalBar(text, intervalMin, intervalMax, icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
self:TriggerEvent("BigWigs_StartIntervalBar", self, text, intervalMin, intervalMax, "Interface\\Icons\\" .. icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
end
function BigWigs.modulePrototype:DelayedIntervalBar(delay, text, intervalMin, intervalMax, icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
return self:ScheduleEvent(delayPrefix .. "Bar" .. self:ToString() .. text, "BigWigs_StartIntervalBar", delay, self, text, intervalMin, intervalMax, "Interface\\Icons\\" .. icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
end
function BigWigs.modulePrototype:DelayedBar(delay, text, time, icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize, target, spell)
return self:ScheduleEvent(delayPrefix .. "Bar" .. self:ToString() .. text, "BigWigs_StartBar", delay, self, text, time, "Interface\\Icons\\" .. icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize, target, spell)
end
function BigWigs.modulePrototype:CancelDelayedBar(text)
self:CancelScheduledEvent(delayPrefix .. "Bar" .. self:ToString() .. text)
end
function BigWigs.modulePrototype:ClickBar(text, time, icon, target, spell, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize)
if not otherColor then otherColor = "ClickToTarget" end
if emphasize == nil then emphasize = false end
self:TriggerEvent("BigWigs_StartBar", self, text, time, "Interface\\Icons\\" .. icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize, target, spell)
end
function BigWigs.modulePrototype:DelayedClickBar(delay, text, time, icon, target, spell, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize)
if not otherColor then otherColor = "ClickToTarget" end
if emphasize == nil then emphasize = false end
return self:ScheduleEvent(delayPrefix .. "Bar" .. self:ToString() .. text, "BigWigs_StartBar", delay, self, text, time, "Interface\\Icons\\" .. icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize, target, spell)
end
function BigWigs.modulePrototype:MonitorBar(barName, icon, guid, type, displayText, insertMark, emphazise, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
self:TriggerEvent("BigWigs_StartMonitorBar", self, barName, "Interface\\Icons\\" .. icon, guid, type, displayText, insertMark, emphazise, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
end
function BigWigs.modulePrototype:DelayedMonitorBar(delay, barName, icon, guid, type, displayText, insertMark, emphazise, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
return self:ScheduleEvent(delayPrefix .. "Bar" .. self:ToString() .. barName, "BigWigs_StartMonitorBar", delay, self, barName, "Interface\\Icons\\" .. icon, guid, type, displayText, insertMark, emphazise, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
end
function BigWigs.modulePrototype:CounterBar(barName, max, icon, target, spell, emphasize, timeFormat, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
if emphasize == nil then emphasize = false end
self:TriggerEvent("BigWigs_StartCounterBar", self, barName, max, "Interface\\Icons\\" .. icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize, target, spell, timeFormat)
end
function BigWigs.modulePrototype:DelayedCounterBar(delay, barName, max, icon, target, spell, emphasize, timeFormat, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10)
return self:ScheduleEvent(delayPrefix .. "Bar" .. self:ToString() .. barName, "BigWigs_StartCounterBar", delay, self, barName, max, "Interface\\Icons\\" .. icon, otherColor, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, emphasize, target, spell, timeFormat)
end
function BigWigs.modulePrototype:UpdateBar(barName, value, displayText, paused)
self:TriggerEvent("BigWigs_UpdateBar", self, barName, value, displayText, paused)
end
function BigWigs.modulePrototype:SetBar(barName, timeLeft, timeTotal, timeFormat)
self:TriggerEvent("BigWigs_SetBar", self, barName, timeLeft, timeTotal, timeFormat)
end
function BigWigs.modulePrototype:ColorBar(barName, color, bgcolor)
self:TriggerEvent("BigWigs_ColorBar", self, barName, color, bgcolor)
end
function BigWigs.modulePrototype:BarStatus(text)
local registered, time, elapsed, running = BigWigsBars:GetBarStatus(self, text)
return registered, time, elapsed, running
end
function BigWigs.modulePrototype:Sound(sound)
self:TriggerEvent("BigWigs_Sound", sound)
end
function BigWigs.modulePrototype:DelayedSound(delay, sound, id)
if not id then
id = "_"
end
return self:ScheduleEvent(delayPrefix .. "Sound" .. self:ToString() .. sound .. id, "BigWigs_Sound", delay, sound)
end
function BigWigs.modulePrototype:CancelDelayedSound(sound, id)
if not id then
id = "_"
end
self:CancelScheduledEvent(delayPrefix .. "Sound" .. self:ToString() .. sound .. id)
end
function BigWigs.modulePrototype:Icon(name, iconnumber)
self:TriggerEvent("BigWigs_SetRaidIcon", name, iconnumber)
end
function BigWigs.modulePrototype:RemoveIcon()
self:TriggerEvent("BigWigs_RemoveRaidIcon")
end
-- World Markers (worldmarkers.dll, see Plugins/WorldMarkers.lua)
-- index: 1 blue square, 2 green triangle, 3 purple diamond, 4 red cross, 5 yellow star
-- self:WorldMarker(index, unit) or self:WorldMarker(index, x, y, z)
function BigWigs.modulePrototype:WorldMarker(index, a, b, c)
if BigWigsWorldMarkers then
return BigWigsWorldMarkers:Place(self, index, a, b, c)
end
end
-- same, cleared automatically after `duration` seconds
function BigWigs.modulePrototype:TimedWorldMarker(duration, index, a, b, c)
if BigWigsWorldMarkers then
return BigWigsWorldMarkers:PlaceTimed(self, duration, index, a, b, c)
end
end
function BigWigs.modulePrototype:ClearWorldMarker(index)
if BigWigsWorldMarkers then
BigWigsWorldMarkers:Clear(self, index)
end
end
function BigWigs.modulePrototype:ClearWorldMarkers()
if BigWigsWorldMarkers then
BigWigsWorldMarkers:ClearOwner(self)
end
end
-- true if this client would actually place markers (dll loaded, option on, allowed placer)
function BigWigs.modulePrototype:CanPlaceWorldMarkers()
return BigWigsWorldMarkers and BigWigsWorldMarkers:CanPlace() or false
end
function BigWigs.modulePrototype:WarningSign(icon, duration, force, text)
self:TriggerEvent("BigWigs_ShowWarningSign", "Interface\\Icons\\" .. icon, duration, force, text)
end
function BigWigs.modulePrototype:RemoveWarningSign(icon, forceHide)
self:TriggerEvent("BigWigs_HideWarningSign", "Interface\\Icons\\" .. icon, forceHide)
end
function BigWigs.modulePrototype:DelayedWarningSign(delay, icon, duration, id)
if not id then
id = "_"
end
self:ScheduleEvent(delayPrefix .. "WarningSign" .. self:ToString() .. icon .. id, "BigWigs_ShowWarningSign", delay, "Interface\\Icons\\" .. icon, duration)
end
function BigWigs.modulePrototype:CancelDelayedWarningSign(icon, id)
if not id then
id = "_"
end
self:CancelScheduledEvent(delayPrefix .. "WarningSign" .. self:ToString() .. icon .. id)
end
function BigWigs.modulePrototype:Say(msg)
SendChatMessage(msg, "SAY")
end
-- proximity
function BigWigs:Proximity(moduleName)
self:TriggerEvent("BigWigs_ShowProximity", moduleName)
end
function BigWigs.modulePrototype:Proximity()
BigWigs:Proximity(self:ToString())
end
function BigWigs:RemoveProximity()
self:TriggerEvent("BigWigs_HideProximity")
end
function BigWigs.modulePrototype:RemoveProximity()
BigWigs:RemoveProximity()
end
------------------------------
-- Initialization --
------------------------------
function BigWigs:OnInitialize()
if not self.version then
self.version = GetAddOnMetadata("BigWigs", "Version")
end
local rev = self.revision
for name, module in self:IterateModules() do
--self:RegisterModule(name,module)
rev = math.max(rev, module.revision)
end
self.version = (self.version or "2.0") .. " |cffff8888r" .. rev .. "|r"
--self:RegisterEvent("ADDON_LOADED")
self.loading = true
-- Activate ourselves, or at least try to. If we were disabled during a reloadUI, OnEnable isn't called,
-- and self.loading will never be set to something else, resulting in a BigWigs that doesn't enable.
self:ToggleActive(true)
end
function BigWigs:OnEnable()
if AceLibrary("AceEvent-2.0"):IsFullyInitialized() then
self:AceEvent_FullyInitialized()
else
self:RegisterEvent("AceEvent_FullyInitialized")
end
end
function BigWigs:AceEvent_FullyInitialized()
if (GetNumRaidMembers() > 0) or ((GetZoneText() == "The Black Morass") or (GetZoneText() == "Dire Maul") or (GetZoneText() == "Stratholme")) or not self.loading then
-- Enable all disabled modules that are not boss modules.
for name, module in self:IterateModules() do
if type(module.IsBossModule) ~= "function" or not module:IsBossModule() then
self:ToggleModuleActive(module, true)
end
end
if BigWigsLoD then
self:CreateLoDMenu()
end
self:TriggerEvent("BigWigs_CoreEnabled")
self:RegisterEvent("BigWigs_TargetSeen")
self:RegisterEvent("BigWigs_RebootModule")
self:RegisterEvent("BigWigs_RecvSync")
else
self:ToggleActive(false)
end
self.loading = nil
if self.db.profile.showfirsttimepopup == nil then
self.db.profile.showfirsttimepopup = false
self:ToggleActive(true)
BigWigs:ShowFirstTimePopup()
end
end
function BigWigs:ShowFirstTimePopup()
StaticPopupDialogs["BigWigsFirstTimeDialog"] = {
text = "Pepo's Bigwigs is now enabled! \n\n I recommend editing your alert positions and sizes to your liking by clicking 'Edit Layout'. If you don't want to do it now, you can always do it later right clicking the BigWigs minimap icon and choosing 'Edit Layout'.",
button1 = "Edit Layout",
button2 = "Close",
OnAccept = function()
StaticPopup_Hide("BigWigsFirstTimeDialog")
BigWigs:EditLayout()
end,
OnCancel = function()
StaticPopup_Hide("BigWigsFirstTimeDialog")
end,
timeout = 0,
whileDead = true,
hideOnEscape = true,
preferredIndex = 3, -- avoid some UI taint, see http://www.wowace.com/announcements/how-to-avoid-some-ui-taint/
}
StaticPopup_Show("BigWigsFirstTimeDialog")
end
function BigWigs:OnDisable()
-- Disable all modules
for name, module in self:IterateModules() do
self:ToggleModuleActive(module, false)
end
self:TriggerEvent("BigWigs_CoreDisabled")
end
-------------------------------
-- Module Handling --
-------------------------------
function BigWigs:ADDON_LOADED(addon)
local gname = GetAddOnMetadata(addon, "X-BigWigsModule")
if not gname then
return
end
local g = getglobal(gname)
if not g or not g.name then
return
end
g.external = true
self:RegisterModule(g.name, g)
end
function BigWigs:ModuleDeclaration(bossName, zoneName)
local translatedName = BB:HasTranslation(bossName) and BB[bossName] or bossName
local module = BigWigs:NewModule(translatedName)
local L = AceLibrary("AceLocale-2.2"):new("BigWigs" .. translatedName)
module.translatedName = translatedName
local name = string.gsub(bossName, "%s", "") -- untranslated, unique string
module.bossSync = bossName
-- zone
local raidZones = { "Blackwing Lair", "Ruins of Ahn'Qiraj", "Ahn'Qiraj", "Molten Core", "Naxxramas", "Emerald Sanctum", "Zul'Gurub", "Timbermaw Hold" }
local isOutdoorraid = true
for i, value in ipairs(raidZones) do
if value == zoneName then
module.zonename = BZ:HasTranslation(zoneName) and BZ[zoneName] or zoneName
isOutdoorraid = false
break
end
end
if isOutdoorraid then
module.zonename = {
AceLibrary("AceLocale-2.2"):new("BigWigs")["Outdoor Raid Bosses Zone"],
BZ:HasTranslation(zoneName) and BZ[zoneName] or zoneName
}
end
return module, L
end
function BigWigs:RegisterModule(name, module)
if module:IsBossModule() then
self:ToggleModuleActive(module, false)
end
-- Set up DB
local opts
if module:IsBossModule() and module.toggleoptions then
opts = {}
for _, v in pairs(module.toggleoptions) do
if module.defaultDB and module.defaultDB[v] ~= nil then
opts[v] = module.defaultDB[v]
elseif v ~= -1 then
opts[v] = true
end
end
end
if module.db and module.RegisterDefaults and type(module.RegisterDefaults) == "function" then
module:RegisterDefaults("profile", opts or module.defaultDB or {})
else
self:RegisterDefaults(name, "profile", opts or module.defaultDB or {})
end
if not module.db then
module.db = self:AcquireDBNamespace(name)
end
-- Set up AceConsole
local cons
if module:IsBossModule() then
local revision = type(module.revision) == "number" and module.revision or -1
local L2 = AceLibrary("AceLocale-2.2"):new("BigWigs" .. name)
if module.toggleoptions then
local m = module
cons = {
type = "group",
name = name,
desc = string.format(L["Options for %s (r%s)."], name, revision),
args = {
[L["toggle"]] = {
type = "toggle",
name = L["Active"],
order = 1,
desc = L["Activate or deactivate this module."],
get = function()
return m.core:IsModuleActive(m)
end,
set = function()
m.core:ToggleModuleActive(m)
end,
},
[L["reboot"]] = {
type = "execute",
name = L["Reboot"],
order = 2,
desc = L["Reboot this module."],
func = function()
m.core:TriggerEvent("BigWigs_RebootModule", m:ToString())
end,
hidden = function()
return not m.core:IsModuleActive(m)
end,
},
[L["rebootall"]] = {
type = "execute",
name = L["Reboot All"],
desc = L["Forces the module to reset for everyone in the raid.\n\n(Requires assistant or higher)"],
order = 3,
func = function()
if (IsRaidLeader() or IsRaidOfficer()) then
m.core:TriggerEvent("BigWigs_SendSync", "RebootModule " .. tostring(module))
end
end,
hidden = function()
return not m.core:IsModuleActive(m)
end,
},
[L["debug"]] = {
type = "toggle",
name = L["Debugging"],
desc = L["Show debug messages."],
order = 4,
get = function()
return m:IsDebugging()
end,
set = function(v)
m:SetDebugging(v)
end,
hidden = function()
return not m:IsDebugging() and not BigWigs:IsDebugging()
end,
},
},
}
local x = 10
for _, v in pairs(module.toggleoptions) do
local val = v
x = x + 1
if x == 11 and v ~= "bosskill" then
cons.args["headerblankspotthingy"] = {
type = "header",
order = 4,
}
end
if v == -1 then
cons.args["blankspacer" .. x] = {
type = "header",
order = x,
}
else
local l = v == "bosskill" and L or L2
if l:HasTranslation(v .. "_validate") then
cons.args[l[v .. "_cmd"]] = {
type = "text",
order = v == "bosskill" and -1 or x,
name = l[v .. "_name"],
desc = l[v .. "_desc"],
get = function()
return m.db.profile[val]
end,
set = function(v)
m.db.profile[val] = v
end,
validate = l[v .. "_validate"],
}
else
cons.args[l[v .. "_cmd"]] = {
type = "toggle",
order = v == "bosskill" and -1 or x,
name = l[v .. "_name"],
desc = l[v .. "_desc"],
get = function()
return m.db.profile[val]
end,
set = function(v)
m.db.profile[val] = v
end,
}
end
end
end
end
if cons or module.consoleOptions then
local zonename = type(module.zonename) == "table" and module.zonename[1] or module.zonename
local zone = zonename
if BZ:HasReverseTranslation(zonename) and L:HasTranslation(BZ:GetReverseTranslation(zonename)) then
zone = L[BZ:GetReverseTranslation(zonename)]
elseif L:HasTranslation(zonename) then
zone = L[zonename]
end
if not self.cmdtable.args[L["boss"]].args[zone] then
self.cmdtable.args[L["boss"]].args[zone] = {
type = "group",
name = zonename,
desc = string.format(L["Options for bosses in %s."], zonename),
args = {},
}
end
if module.external then
self.cmdtable.args[L["extra"]].args[L2["cmd"]] = cons or module.consoleOptions
else
self.cmdtable.args[L["boss"]].args[zone].args[L2["cmd"]] = cons or module.consoleOptions
end
end
elseif module.consoleOptions then
if module.external then
self.cmdtable.args[L["extra"]].args[module.consoleCmd or name] = cons or module.consoleOptions
else
self.cmdtable.args[L["plugin"]].args[module.consoleCmd or name] = cons or module.consoleOptions
end
end
module.registered = true
if module.OnRegister and type(module.OnRegister) == "function" then
module:OnRegister()
end
-- Set up target monitoring, in case the monitor module has already initialized
--if module.zonename and module.enabletrigger then
self:TriggerEvent("BigWigs_RegisterForTargetting", module.zonename, module.enabletrigger)
--end
end
function BigWigs:EnableModule(moduleName, nosync)
local m = self:GetModule(moduleName)
if m and not self:IsModuleActive(moduleName) then
self:ToggleModuleActive(moduleName, true)
if m:IsBossModule() then
if not m.translatedName then
m.translatedName = m:ToString()
self:DebugMessage("translatedName for module " .. m:ToString() .. " missing")
end
self:TriggerEvent("BigWigs_Message", string.format(L["%s mod enabled"], m.translatedName or "??"), "Core", true)
end
-- balakethelock -
--if not nosync then self:TriggerEvent("BigWigs_SendSync", (m.external and "EnableExternal " or "EnableModule ") .. (m.synctoken or BB:GetReverseTranslation(moduleName))) end
-- balakethelock +
if not nosync then
local syncToken = m.synctoken or BB:HasReverseTranslation(moduleName) and BB:GetReverseTranslation(moduleName) or moduleName
self:TriggerEvent("BigWigs_SendSync", (m.external and "EnableExternal " or "EnableModule ") .. syncToken)
end
self:SetupModule(moduleName)
end
end
-- registers generic events
function BigWigs:SetupModule(moduleName)
local m = self:GetModule(moduleName)
if m and m:IsBossModule() then
m:RegisterEvent("PLAYER_REGEN_DISABLED", "CheckForEngage") -- addition
m:RegisterEvent("PLAYER_REGEN_ENABLED", "CheckForWipe")
m:RegisterEvent("CHAT_MSG_COMBAT_FRIENDLY_DEATH")
m:RegisterEvent("CHAT_MSG_COMBAT_HOSTILE_DEATH") -- addition
m:RegisterEvent("BigWigs_RecvSync")
m.engaged = false
m:OnSetup()
end
end
function BigWigs:DisableModule(moduleName)
local m = self:GetModule(moduleName)
if m then
if m:IsBossModule() then
m:Disengage()
end
self:ToggleModuleActive(m, false)
end
end
-- event handler
function BigWigs:BigWigs_RebootModule(moduleName)
local moduleName = BB:HasTranslation(moduleName) and BB[moduleName] or moduleName
local m = self:GetModule(moduleName)
if m and m:IsBossModule() then
self:DebugMessage("BigWigs:BigWigs_RebootModule(): " .. m:ToString())
m:Disengage()
self:SetupModule(moduleName)
end
end
-------------------------------
-- Event Handler --
-------------------------------
function BigWigs:BigWigs_RecvSync(sync, moduleName, nick)
local s, m, n, playername = "-", "-", "-", UnitName("player")
if sync then
if type(sync) == "string" then
s = sync
else
s = type(sync)
end
end
if moduleName then
if type(moduleName) == "string" then
m = moduleName
else
m = type(moduleName)
end
end
if nick then
if type(nick) == "string" then
if nick == playername then
n = "you"
else
n = nick
end
else
n = type(nick)
end
end
self:DebugMessage("sync: " .. s .. " rest: " .. m .. " nick: " .. n)
local moduleName = BB:HasTranslation(moduleName) and BB[moduleName] or moduleName
local module = nil
if self:HasModule(moduleName) then
module = self:GetModule(moduleName)
end
if module and sync == "EnableModule" then
moduleName = BB:HasTranslation(moduleName) and BB[moduleName] or moduleName
local isInZone = false
if type(module.zonename) == "string" and module.zonename == GetRealZoneText() then
isInZone = true
elseif type(module.zonename) == "table" then
for _, v in pairs(module.zonename) do
if v == GetRealZoneText() then
isInZone = true
break
end
end
end
if isInZone then
self:EnableModule(moduleName, true)
end
elseif module and sync == "EnableExternal" then
if module.zonename == GetRealZoneText() then
self:EnableModule(moduleName, true)
end
elseif sync == "RebootModule" and moduleName then
if nick ~= UnitName("player") then
self:Print(string.format(L["%s has requested forced reboot for the %s module."], nick, moduleName))
end
self:TriggerEvent("BigWigs_RebootModule", moduleName)
elseif module and sync == module:GetEngageSync() then
if module:IsBossModule() then
module:Engage()
end
--[[elseif module and sync == module:GetWipeSync() then
if module:IsBossModule() and BigWigs:IsModuleActive(module) then
self:TriggerEvent("BigWigs_RebootModule", moduleName)
end]]
elseif module and sync == module:GetBossDeathSync() then
if module:IsBossModule() and BigWigs:IsModuleActive(module) then
module:Victory()
end
end
end
function BigWigs:BigWigs_TargetSeen(mobname, unit)
for name, module in self:IterateModules() do
if module:IsBossModule() and self:ZoneIsTrigger(module, GetRealZoneText()) and self:MobIsTrigger(module, mobname)
and (not module.VerifyEnable or module:VerifyEnable(unit)) then
self:EnableModule(name)
--[[if UnitExists(unit.."target") then
-- if this is true the boss is apparantely already in combat!
-- this situation can happen on bosses which spawn the same time they enter combat (Arlokk/Mandokir) or when a player without BigWigs engages the boss
module:SendEngageSync()
end]]
end
end
end
-------------------------------
-- Utility --
-------------------------------
function BigWigs:ZoneIsTrigger(module, zone)
local t = module.zonename
if type(t) == "string" then
return zone == t
elseif type(t) == "table" then
for _, mzone in pairs(t) do
if mzone == zone then
return true
end
end
end
end
function BigWigs:MobIsTrigger(module, name)
local t = module.enabletrigger
if type(t) == "string" then
return name == t
elseif type(t) == "table" then
for _, mob in pairs(t) do
if mob == name then
return true
end
end
end
end
function BigWigs:CreateLoDMenu()
local zonelist = BigWigsLoD:GetZones()
for k, v in pairs(zonelist) do
if type(v) ~= "table" then
self:AddLoDMenu(k)
else
self:AddLoDMenu(L["Other"])
end
end
end
function BigWigs:AddLoDMenu(zonename)
local zone = nil
if L:HasTranslation(zonename) then
zone = L[zonename]
else
zone = L["Other"]
end
if zone then
if BZ:HasReverseTranslation(zonename) and L:HasTranslation(BZ:GetReverseTranslation(zonename)) then
zone = L[BZ:GetReverseTranslation(zonename)]
elseif L:HasTranslation(zonename) then
zone = L[zonename]
end
if not self.cmdtable.args[L["boss"]].args[zone] then
self.cmdtable.args[L["boss"]].args[zone] = {
type = "group",
name = zonename,
desc = string.format(L["Options for bosses in %s."], zonename),
args = {}
}
end
end
end
-- Requires Superwow for GetPlayerBuffID
function BigWigs:CancelAuraId(spellId)
if not GetPlayerBuffID then
self:Print("Superwow required for CancelAuraId")
end
local i = 0
while true do
local buffIndex = GetPlayerBuff(i, "HELPFUL")
i = i + 1
if buffIndex == -1 then
break
end
local buffId = GetPlayerBuffID(buffIndex)
buffId = (buffId < -1) and (buffId + 65536) or buffId
if buffId == spellId then
CancelPlayerBuff(buffIndex)
return true
end
end
return false
end
function BigWigs:CancelAuraTexture(texture)
local i = 0
while true do
local buffIndex = GetPlayerBuff(i, "HELPFUL")
i = i + 1
if buffIndex == -1 then
break
end
local buffTexture = GetPlayerBuffTexture(buffIndex)
if string.find(buffTexture, texture) then
CancelPlayerBuff(buffIndex)
return true
end
end
return false
end
-- Virtual Tooltip to scan for strings
BigWigs.VTT = CreateFrame("GameTooltip", "BigWigsVTT", nil, "GameTooltipTemplate")
BigWigs.VTT:SetOwner(BigWigsVTT, "ANCHOR_NONE")
function BigWigs:BuffNameByIndex(buffIndex)
BigWigsVTT:SetPlayerBuff(buffIndex)
local line = getglobal("BigWigsVTTTextLeft1")
if line and line:IsVisible() then
return line:GetText()
else
BigWigs.VTT:SetOwner(BigWigsVTT, "ANCHOR_NONE")
end
end
function BigWigs:GetUnitIdByName(name, depth)
depth = depth or 0 -- default to raid members
local suffix = ""
for i = 1, depth do
suffix = suffix .. "target"
end
for i = 1, GetNumRaidMembers() do
local id = "raid" .. i .. suffix
if UnitName(id) == name then
return id
end
end
end
function BigWigs:GetTargetByName(name, depth)
depth = depth or 1 -- default to targets of raid members
local unitId = BigWigs:GetUnitIdByName(name, depth)
if unitId then
return UnitName(unitId .. "target")
end
end
function BigWigs:GetGUIDByName(name, depth, ignoredGUIDs)
depth = depth or 1 -- default to targets of raid members
local suffix = ""
for i = 1, depth do
suffix = suffix .. "target"
end
for i = 1, GetNumRaidMembers() do
local id = "raid" .. i .. suffix
if UnitName(id) == name then
local _, targetGUID = UnitExists(id)
if type(ignoredGUIDs) == "table" then
for _, excludedGUID in pairs(ignoredGUIDs) do
if targetGUID == excludedGUID then
targetGUID = nil
break
end
end
end
if targetGUID then
return targetGUID
end
end
end
end
function BigWigs:OffsetGUID(input, offset)
local max = 4294967295
local prefix, highInput, lowInput = string.sub(input, 1, -17), string.sub(input, -16, -9), string.sub(input, -8)
local lowOutput = tonumber(lowInput, 16) + offset
local highOutput = tonumber(highInput, 16)
if lowOutput < 0 then
lowOutput = lowOutput + max + 1
highOutput = highOutput - 1
elseif lowOutput > max then
lowOutput = lowOutput - max - 1
highOutput = highOutput + 1
end
return prefix .. string.format("%08X", highOutput) .. string.format("%08X", lowOutput)
end
function BigWigs:RaidTargetLookup(input, colorize)
local raidTargets = {
[0] = "none",
[1] = "Star",
[2] = "Circle",
[3] = "Diamond",
[4] = "Triangle",
[5] = "Moon",
[6] = "Square",
[7] = "Cross",
[8] = "Skull"
}
if type(input) == "number" then
local output = raidTargets[input]
if output then
if colorize then
return BigWigsColors:ColorizeString(L[output], output)
else
return L[output]
end
end
elseif type(input) == "string" then
input = string.lower(input)
for i = 0, 8 do
if input == string.lower(raidTargets[i]) then
return i
end
end
elseif type(input) == "nil" then
if colorize then
return BigWigsColors:ColorizeString(L["unmarked"], "unmarked")
else
return L["unmarked"]
end
end
end
function BigWigs:FormatLargeNumber(integer)
local integerString = tostring(integer)
local length = string.len(integerString)
if length < 5 then return integerString end
local suffix = "k"
if length > 7 then
suffix = "m"
length = length - 3
end
if length == 5 then
return string.sub(integerString, 1, 2) .. "." .. string.sub(integerString, 3, 4) .. suffix
elseif length == 6 then
return string.sub(integerString, 1, 3) .. "." .. string.sub(integerString, 4, 4) .. suffix
elseif length == 7 then
return string.sub(integerString, 1, 4) .. suffix
end
end
function BigWigs:BuffIsPresent(unitId, spellId)
if UnitExists(unitId) then
local i = 1
while UnitBuff(unitId, i) do
local _, _, foundId = UnitBuff(unitId, i)
if foundId == spellId then
return true
end
i = i + 1
end
end
end
function BigWigs:DebuffIsPresent(unitId, spellId)
if UnitExists(unitId) then
local i = 1
while UnitDebuff(unitId, i) do
local _, _, _, foundId = UnitDebuff(unitId, i)
if foundId == spellId then
return true
end
i = i + 1
end
end
end
function BigWigs:AuraIsPresent(unitId, spellId)
return BigWigs:DebuffIsPresent(unitId, spellId) or BigWigs:BuffIsPresent(unitId, spellId)
end
local castDebuffs = {
[1] = {11719, 1.6, 1}, -- Curse of Tongues Rank 2
[2] = {1714, 1.5, 0}, -- Curse of Tongues Rank 1
[3] = {11398, 1.6, 2}, -- Mind-numbing Poison III
[4] = {8692, 1.5, 1}, -- Mind-numbing Poison II
[5] = {5760, 1.4, 0}, -- Mind-numbing Poison I
}
function BigWigs:GetCastTimeCoefficient(unitId)
local coefficient = 1
if UnitExists(unitId) then
local i = 1
local n = table.getn(castDebuffs)
while i <= n do
if BigWigs:AuraIsPresent(unitId, castDebuffs[i][1]) then
coefficient = coefficient * castDebuffs[i][2]
i = i + castDebuffs[i][3]
end
i = i + 1
end
end
return coefficient
end
function BigWigs:GetHealthPercent(unitId, round)
if UnitExists(unitId) then
local maxHp = UnitHealthMax(unitId)
if maxHp and maxHp > 0 then
if round then
return math.floor(UnitHealth(unitId) / maxHp * 100)
else
return UnitHealth(unitId) / maxHp * 100
end
end
end
end