Use ClassicAPI UnitPower* for power reads; drop GetUnitField/SuperWoW paths

Add ClassicAPI UnitPower/UnitPowerMax/UnitPowerMissing/UnitPowerType wrappers
and route the power conditionals through them:
- ValidatePower/ValidateRawPower/GetCachedPlayerPower(Percent) use UnitPower /
  UnitPowerMax (omitted type = primary power, matching the old UnitMana path).
- ValidatePowerLost uses UnitPowerMissing (one call vs max - current).
- powertype/nopowertype use ClassicAPI.UnitPowerType.

Replace the SuperWoW "2nd return of UnitMana = caster mana" druid hack in
ValidateDruidRawMana and the #showtooltip OOM check with UnitPower(unit, 0),
which reads the mana slot directly and survives shapeshift. Verified in Cat
Form: UnitPower('player', 0) returns caster mana while UnitPower('player', 3)
returns energy.

Remove the now-dead Nampower GetUnitField-based GetUnitPower/GetUnitMaxPower
wrappers and POWER_FIELDS tables (no caller passed a powerType, so that path
never ran).
This commit is contained in:
Brues
2026-07-27 19:27:25 -05:00
parent efc98bcd6a
commit 7c71f8fc26
4 changed files with 51 additions and 62 deletions
+8 -7
View File
@@ -947,13 +947,14 @@ function CleveRoids.TestForActiveAction(actions)
-- Prefer IsSpellUsable result if available (Nampower)
actions.active.oom = (notEnoughPower == 1)
else
-- SuperWoW: UnitMana returns (current power, caster mana) for druids
local currentPower, casterMana = UnitMana("player")
-- For druids with SuperWoW, use caster mana for spell cost checks
local manaToCheck = currentPower
if CleveRoids.playerClass == "DRUID" and type(casterMana) == "number" then
manaToCheck = casterMana
-- Read caster mana directly for druids (the mana slot survives
-- shapeshift, 0 = Enum.PowerType.Mana); other classes use their
-- primary power. Replaces the SuperWoW UnitMana 2nd-return hack.
local manaToCheck
if CleveRoids.playerClass == "DRUID" then
manaToCheck = CleveRoids.ClassicAPI.UnitPower("player", 0)
else
manaToCheck = CleveRoids.ClassicAPI.UnitPower("player")
end
actions.active.oom = (manaToCheck < actions.active.spell.cost)