From 61bab6c734e646f67a9252bca57841059c5cdb0e Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Wed, 2 Sep 2026 14:40:21 -0500 Subject: [PATCH] Require ClassicAPI v1.12.1; scan dispel auras via positional UnitAura scanDispel now reads each slot through the positional C_UnitAuras.UnitAura (added in ClassicAPI v1.12.1) instead of the table-return GetAuraDataByIndex, dropping a throwaway AuraData table per slot on the up-to-48-slot scan behind the [magic]/[curse]/[disease]/[poison]/[dispellable] conditionals. Since UnitAura is called directly with no fallback, gate on it: the load-time check in Core.lua warns (matching its warn-don't-disable design) when ClassicAPI is older than v1.12.1, wiring up the previously-unused ClassicAPI.HasMinimumVersion. --- ClassicAPI.lua | 21 ++++++++++++--------- Core.lua | 8 +++++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ClassicAPI.lua b/ClassicAPI.lua index cfa34d6..5224412 100644 --- a/ClassicAPI.lua +++ b/ClassicAPI.lua @@ -3,9 +3,11 @@ ClassicAPI is a client mod (sibling to Nampower/SuperWoW) that backports the modern C_* API into the 1.12.1 Lua environment. It is a HARD REQUIREMENT of - this addon, so the wrappers below call the API directly — no fallbacks. The - load-time requirement check (Core.lua) uses IsAvailable() to warn when the - DLL is missing; users who don't want ClassicAPI should run the upstream addon. + this addon (ClassicAPI v1.12.1+, which added the positional + C_UnitAuras.UnitAura), so the wrappers below call the API directly — no + fallbacks. The load-time requirement check (Core.lua) uses IsAvailable() to + warn when the DLL is missing and HasMinimumVersion() when it's too old; users + who don't want ClassicAPI should run the upstream addon. Detection: the global CLASSIC_API_VERSION is defined once the client has booted, encoded as X*10000 + Y*100 + Z for a vX.Y.Z tag (untagged dev builds @@ -53,15 +55,16 @@ end -------------------------------------------------------------------------------- -- Scan one aura range of `unit` (filter = "HELPFUL" or "HARMFUL") for an aura --- matching the dispel type. The filtered index self-terminates at the end of the --- range (nil); 48 is a backstop over vanilla's 32 helpful / 16 harmful slots. +-- matching the dispel type. Uses the positional C_UnitAuras.UnitAura (added in +-- ClassicAPI v1.12.1, this addon's minimum) -- no table allocated per slot, with +-- dispelName as the 4th return. The filtered index self-terminates at the end of +-- the range (nil name); 48 is a backstop over vanilla's 32 helpful / 16 harmful slots. local function scanDispel(unit, filter, dispelType, wantAny) local i = 1 while i <= 48 do - local data = C_UnitAuras.GetAuraDataByIndex(unit, i, filter) - if not data then return false end - local dn = data.dispelName - if dn and dn ~= "" and (wantAny or dn == dispelType) then + local name, _, _, dispelName = C_UnitAuras.UnitAura(unit, i, filter) + if not name then return false end + if dispelName and dispelName ~= "" and (wantAny or dispelName == dispelType) then return true end i = i + 1 diff --git a/Core.lua b/Core.lua index 1272139..948de8a 100644 --- a/Core.lua +++ b/Core.lua @@ -198,8 +198,10 @@ requirementCheckFrame:SetScript("OnEvent", function() local hasNampower30 = hasNampower and CleveRoids.NampowerAPI and CleveRoids.NampowerAPI.HasMinimumVersion(3, 0, 0) local hasClassicAPI = CleveRoids.ClassicAPI and CleveRoids.ClassicAPI.IsAvailable() + -- v1.12.1 added the positional C_UnitAuras.UnitAura the dispel conditionals use. + local hasClassicAPI1121 = hasClassicAPI and CleveRoids.ClassicAPI.HasMinimumVersion(1, 12, 1) - if not hasNampower30 or not hasUnitXP or not hasClassicAPI then + if not hasNampower30 or not hasUnitXP or not hasClassicAPI or not hasClassicAPI1121 then -- Show warnings (don't disable — tearing down a partially-initialized addon causes hangs) if not hasNampower then CleveRoids.Print("|cFFFF9900WARNING:|r |cFF00FFFFAvitasia's Nampower v3.0.0+|r is required:") @@ -219,6 +221,10 @@ requirementCheckFrame:SetScript("OnEvent", function() CleveRoids.Print("|cFFFF9900WARNING:|r |cFF00FFFFClassicAPI|r is required:") CleveRoids.Print("https://github.com/brues-code/ClassicAPI") CleveRoids.Print("Dispel-type and movement conditionals will be unavailable without it.") + elseif not hasClassicAPI1121 then + CleveRoids.Print("|cFFFF9900WARNING:|r |cFF00FFFFClassicAPI v1.12.1+|r is required:") + CleveRoids.Print("https://github.com/brues-code/ClassicAPI") + CleveRoids.Print("Dispel-type conditionals will be unavailable with this older version.") end end