Files
github-actions[bot] 9588a9cf0a WeakestAuras 0.18.0
ClassicAPI 1.18 is now the only requirement

Requirements
- Needs ClassicAPI 1.18.0 or newer. SuperWoW is no longer used, and Nampower is optional.
- On an older ClassicAPI the addon stays off, and a popup links the download.
- Custom triggers on SuperWoW or Nampower events only fire while that mod is installed.

Triggers
- New Combat Log trigger, with lists of spell IDs, spell names and NPC IDs.
  WeakAuras2 auras that use one now import.
- Custom triggers can listen to the combat log with CLEU or CLEU:SUBEVENT.
- Crowd Control matches a specific type (stun, fear, root, silence, disarm and
  more) or a school lockout, with the effect's real timer.
- Saved Crowd Control auras: Root, Silence and Disarm filters carry over; CC and
  Snare become "any type", and snares are no longer detected.
- Cast bars follow pushback and channel updates.

Displays
- Icon cooldown swipes are drawn by the client's own cooldown frame.
- Sound actions play on a chosen channel, and a new Stop sound type ends a
  looping sound.

Fixes
- Cooldown auras no longer sweep on every wand shot.
- The Global Cooldown trigger ignores wand and Auto Shot shots.
2026-10-29 20:41:53 +00:00

91 lines
3.9 KiB
Lua

-- WeakestAuras -- creates the addon's global and refuses to load on a client
-- whose ClassicAPI is missing or older than CLASSICAPI_REQUIRED.
--
-- This file must stay Lua 5.0 and call only stock 1.12 API. Every other file
-- is written in the 5.1 syntax ClassicAPI rewrites at load time, so on a client
-- without a new enough ClassicAPI they may not even compile, and this file is
-- the only one left to tell the player why.
WeakestAuras = CreateFrame("Frame")
-- Builds the saved-variable table and the one field every reader assumes,
-- returning it. Must be called again after the SavedVariables file has run --
-- it executes *after* every addon file on this client and assigns the global
-- outright, so it replaces whatever was built here rather than merging into it.
-- That includes replacing it with nothing: the client writes a registered
-- variable that was nil at logout back out as a literal `WeakestAurasDB = nil`
-- (any 1.12 WTF folder shows the same line for BigWigs' optional profiles), and
-- a session that took the bail-out below never created one. A saved file from
-- such a session therefore wipes the table on every later login, which is why
-- this runs ahead of that bail-out as well as at ADDON_LOADED.
function WeakestAuras.EnsureDB()
if type(WeakestAurasDB) ~= "table" then WeakestAurasDB = {} end
if type(WeakestAurasDB.displays) ~= "table" then WeakestAurasDB.displays = {} end
return WeakestAurasDB
end
WeakestAuras.EnsureDB()
-- ClassicAPI packs its version as X*10000 + Y*100 + Z; untagged local builds
-- carry a sentinel meaning "newer than every release".
local CLASSICAPI_DEV = 99999999
-- "X.Y.Z" from a packed ClassicAPI version, "dev" for the sentinel. With no
-- argument, the running client's own; nil when it cannot answer.
function WeakestAuras.ClassicAPIVersionString(packed)
if packed == nil then packed = CLASSIC_API_VERSION end
if type(packed) ~= "number" then return nil end
if packed == CLASSICAPI_DEV then return "dev" end
return math.floor(packed / 10000) .. "."
.. math.floor(math.mod(packed, 10000) / 100) .. "."
.. math.mod(packed, 100)
end
-- The only ClassicAPI this addon supports. Everything it provides up to this
-- release is called directly, with no capability or version checks; raise this
-- when the addon starts using something newer.
WeakestAuras.CLASSICAPI_REQUIRED = 11800 -- 1.18.0
WeakestAuras.CLASSICAPI_URL = "https://github.com/brues-code/ClassicAPI/releases/latest"
if type(CLASSIC_API_VERSION) ~= "number" or CLASSIC_API_VERSION < WeakestAuras.CLASSICAPI_REQUIRED then
WeakestAuras.disabled = true
local need = WeakestAuras.ClassicAPIVersionString(WeakestAuras.CLASSICAPI_REQUIRED)
local have = WeakestAuras.ClassicAPIVersionString()
local detail
if have then
detail = "It needs ClassicAPI " .. need .. " or newer, and this client has " .. have .. "."
else
detail = "It needs ClassicAPI " .. need .. " or newer, which this client does not have."
end
detail = detail .. " Install the latest release from:"
StaticPopupDialogs["WEAKESTAURAS_CLASSICAPI_REQUIRED"] = {
text = "|cffff0000WeakestAuras|r has been disabled.\n\n" .. detail,
button1 = OKAY,
hasEditBox = 1,
editBoxWidth = 280,
timeout = 0,
whileDead = 1,
hideOnEscape = 1,
OnShow = function()
local editBox = getglobal(this:GetName() .. "EditBox")
if editBox then
editBox:SetText(WeakestAuras.CLASSICAPI_URL)
editBox:HighlightText()
editBox:SetFocus()
end
end,
}
-- Deferred to the first world entry: a line printed while addons load is
-- buried under every other addon's.
WeakestAuras:RegisterEvent("PLAYER_ENTERING_WORLD")
WeakestAuras:SetScript("OnEvent", function()
WeakestAuras:UnregisterEvent("PLAYER_ENTERING_WORLD")
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000WeakestAuras|r disabled: " .. detail .. " "
.. WeakestAuras.CLASSICAPI_URL, 1, 0.3, 0.3)
StaticPopup_Show("WEAKESTAURAS_CLASSICAPI_REQUIRED")
end)
end