Remove SuperWoW and UnitXP SP3 integration

Drops the SuperWoW and UnitXP SP3 detection flags and all their code paths. GUID/unit-name resolution (GetNameFromGUID, IsPetGUID, EnsurePlayerGUID, player GUID caching) now relies solely on Nampower APIs; the spellId icon fast path keeps only its Nampower branch; and GetUnitIDFromName falls back to the raw-combat-logging path and name cache. UnitXP was detection-only and never read. README updated to reflect the removal.
This commit is contained in:
Brues
2026-06-22 18:12:51 -05:00
parent d13a4102b8
commit e8b3b81241
3 changed files with 15 additions and 45 deletions
+11 -38
View File
@@ -174,10 +174,8 @@ local lastFriendlyHealthPercentage = 0;
local recentlySelectedPlayers = {};
local elapsedTime = 0;
-- Feature detection flags for enhanced combat event mods.
-- Feature detection flag for Nampower structured combat events.
local hasNampower = false
local hasSuperWoW = false
local hasUnitXP = false
-- Runtime detection flags for Nampower events.
-- These start false and flip true on first invocation of the corresponding handler,
@@ -190,7 +188,7 @@ local nampowerBuffsActive = false
local nampowerPetAutoAttackActive = false
local nampowerPetSpellDamageActive = false
-- Cached player GUID for Nampower event handlers (set in Init when SuperWoW/Nampower present).
-- Cached player GUID for Nampower event handlers (set in Init when Nampower is present).
local playerGUID = nil
-- Event throttling for trigger checks.
@@ -349,10 +347,7 @@ function MikCEH.OnEvent()
elseif (event == "PLAYER_ENTERING_WORLD") then
this:UnregisterEvent("PLAYER_ENTERING_WORLD");
if not playerGUID then
if hasSuperWoW and UnitExists("player") then
local _, _, guid = pcall(UnitExists, "player")
if guid then playerGUID = guid end
elseif hasNampower and UnitGUID then
if hasNampower and UnitGUID then
local ok, guid = pcall(UnitGUID, "player")
if ok and guid then playerGUID = guid end
end
@@ -663,13 +658,9 @@ function MikCEH.Init()
playerName = UnitName("player");
_, playerClass = UnitClass("player");
-- Detect enhanced combat event mods.
-- Detect Nampower structured combat event support.
hasNampower = (GetNampowerVersion ~= nil)
hasSuperWoW = (SUPERWOW_VERSION ~= nil) or (SetAutoloot ~= nil and SpellInfo ~= nil)
hasUnitXP = pcall(UnitXP, "nop", "nop")
MikCEH.hasNampower = hasNampower
MikCEH.hasSuperWoW = hasSuperWoW
MikCEH.hasUnitXP = hasUnitXP
MikCEH.nampowerHealsActive = false
MikCEH.nampowerAutoAttackActive = false
MikCEH.nampowerEnergizeActive = false
@@ -690,11 +681,8 @@ function MikCEH.Init()
end
end
-- Cache the player GUID when SuperWoW or Nampower is available.
if hasSuperWoW and UnitExists("player") then
local _, _, guid = pcall(UnitExists, "player")
if guid then playerGUID = guid end
elseif hasNampower and UnitGUID then
-- Cache the player GUID when Nampower is available.
if hasNampower and UnitGUID then
local ok, guid = pcall(UnitGUID, "player")
if ok and guid then playerGUID = guid end
end
@@ -702,7 +690,7 @@ end
-------------------------------------------------------------------------------------
-- Nampower / SuperWoW / UnitXP Infrastructure.
-- Nampower Infrastructure.
-------------------------------------------------------------------------------------
-- Spell school index (Nampower) to MikCEH damage type mapping.
@@ -762,14 +750,10 @@ local nampowerPowerTypeToString = {
-- **********************************************************************************
-- Resolves a name from a GUID using SuperWoW or Nampower APIs.
-- Resolves a name from a GUID using Nampower APIs.
-- **********************************************************************************
local function GetNameFromGUID(guid)
if not guid then return nil end
if hasSuperWoW then
local ok, exists, uid = pcall(UnitExists, guid)
if ok and exists then return UnitName(uid) end
end
if hasNampower and GetUnitField then
local ok, name = pcall(GetUnitField, guid, "name")
if ok and name then return name end
@@ -791,10 +775,6 @@ end
-- **********************************************************************************
local function IsPetGUID(guid)
if not guid or not UnitExists("pet") then return false end
if hasSuperWoW then
local ok, exists, uid = pcall(UnitExists, guid)
if ok and exists then return uid == "pet" or UnitName(uid) == UnitName("pet") end
end
if hasNampower and UnitGUID then
local ok, petGuid = pcall(UnitGUID, "pet")
if ok and petGuid then return guid == petGuid end
@@ -813,7 +793,7 @@ end
-- **********************************************************************************
-- Gets a spell name from a spellId, using SuperWoW or Nampower APIs with caching.
-- Gets a spell name from a spellId via ClassicAPI (C_Spell), with caching.
-- **********************************************************************************
local function GetSpellNameFromId(spellId)
if not spellId or spellId == 0 then return nil end
@@ -857,10 +837,6 @@ end
-- **********************************************************************************
local function EnsurePlayerGUID()
if playerGUID then return true end
if hasSuperWoW and UnitExists("player") then
local _, _, guid = pcall(UnitExists, "player")
if guid then playerGUID = guid; return true end
end
if hasNampower and UnitGUID then
local ok, guid = pcall(UnitGUID, "player")
if ok and guid then playerGUID = guid; return true end
@@ -4571,11 +4547,8 @@ end
function MikCEH.GetUnitIDFromName(uName)
local unitID, unitName;
-- SuperWoW fast path: O(1) unit lookup by name.
if hasSuperWoW then
local ok, exist, uid = pcall(UnitExists, uName)
if ok and exist then return uid, UnitName(uid) end
elseif LoggingCombat and LoggingCombat("RAW") == 1 then
-- Fast path when raw combat logging is enabled: O(1) unit lookup by name.
if LoggingCombat and LoggingCombat("RAW") == 1 then
local _, exist, uid = pcall(UnitExists, uName)
if _ and exist then
unitName = UnitName(uid)
@@ -1841,9 +1841,6 @@ function MikSBT.AddAnimation(animationEvent)
local sid = animationEvent.SpellId
if spellIdIconCache[sid] then
texture = spellIdIconCache[sid]
elseif MikCEH.hasSuperWoW and SpellInfo then
local ok, _, _, tex = pcall(SpellInfo, sid)
if ok and tex then texture = tex; spellIdIconCache[sid] = tex end
elseif MikCEH.hasNampower and GetSpellRecField and GetSpellIconTexture then
local ok, iconId = pcall(GetSpellRecField, sid, "spellIconID")
if ok and iconId then
+4 -4
View File
@@ -72,19 +72,19 @@ When Nampower is detected, MSBT automatically switches from string-based combat
- **Nampower**: Registers for structured events (`SPELL_DAMAGE_EVENT_SELF`, `AUTO_ATTACK_SELF`, `SPELL_HEAL_ON_SELF`, etc.) that provide pre-parsed combat data. Redundant `CHAT_MSG_*` events are unregistered to avoid duplicates. Enables `NP_EnableAutoAttackEvents`, `NP_EnableSpellHealEvents`, and `NP_EnableSpellEnergizeEvents` CVars.
### Deprecated: SuperWoW / UnitXP SP3
### Removed: SuperWoW / UnitXP SP3
SuperWoW and UnitXP SP3 integration is being removed in favor of ClassicAPI (for spell/item lookups) and Nampower (for structured combat events). The detection paths (`SuperWoW`: O(1) `UnitExists(name)` lookups and `SpellInfo` icon resolution; `UnitXP SP3`: GUID-based unit resolution) still exist for now but should not be relied on and will be deleted.
SuperWoW and UnitXP SP3 integration has been removed in favor of ClassicAPI (for spell/item lookups) and Nampower (for structured combat events). GUID and unit-name resolution now go through Nampower APIs, and spell/item icon and name resolution through ClassicAPI.
### Fallback
When none of these mods are present, the addon falls back to the original string-parsing pipeline with no changes in behavior.
When Nampower is not present, the addon falls back to the original string-parsing pipeline with no changes in behavior.
### Verification
```lua
-- Check detection status in-game:
/run MikSBT.Print("NP="..tostring(MikCEH.hasNampower).." SW="..tostring(MikCEH.hasSuperWoW).." UXP="..tostring(MikCEH.hasUnitXP))
/run MikSBT.Print("NP="..tostring(MikCEH.hasNampower))
```
## Performance Optimizations