diff --git a/ClassicAPI.lua b/ClassicAPI.lua index b18498e..0ac50ae 100644 --- a/ClassicAPI.lua +++ b/ClassicAPI.lua @@ -181,6 +181,22 @@ function API.GetSpellEffectMechanics(spellID) return nil end +-- Flat spell-damage bonus (spell power) for a magic school, as a number. +-- school is 1-based: 1=Physical, 2=Holy, 3=Fire, 4=Nature, 5=Frost, 6=Shadow, +-- 7=Arcane. Reads the same client field nampower's GetSpellPower does -- exact, +-- with gear/enchants/buffs/talents/set bonuses baked in. +function API.GetSpellBonusDamage(school) + return GetSpellBonusDamage(school) +end + +-- Flat healing bonus (+healing), as a number. Vanilla has no healing-done field, +-- so ClassicAPI derives it from gear/enchant/buff MOD_HEALING_DONE plus +-- stat-conversion talents (e.g. Spiritual Guidance) -- exact, not a holy-damage +-- proxy. +function API.GetSpellBonusHealing() + return GetSpellBonusHealing() +end + -------------------------------------------------------------------------------- -- State -------------------------------------------------------------------------------- diff --git a/Conditionals.lua b/Conditionals.lua index 266d976..152c43c 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -444,24 +444,26 @@ local stat_checks = { attackpower = function() local base, pos, neg = UnitAttackPower("player"); return base + pos + neg end, rap = function() local base, pos, neg = UnitRangedAttackPower("player"); return base + pos + neg end, rangedattackpower = function() local base, pos, neg = UnitRangedAttackPower("player"); return base + pos + neg end, - healing = function() local _, h = CleveRoids.NampowerAPI.GetSpellPower(); return h or 0 end, - healingpower = function() local _, h = CleveRoids.NampowerAPI.GetSpellPower(); return h or 0 end, + healing = function() return CleveRoids.ClassicAPI.GetSpellBonusHealing() or 0 end, + healingpower = function() return CleveRoids.ClassicAPI.GetSpellBonusHealing() or 0 end, - -- Bonus Spell Damage by School (Nampower v2.31+ GetSpellPower) - -- GetSpellPower() returns: physical, holy, fire, nature, frost, shadow, arcane - arcane_power = function() return select(7, CleveRoids.NampowerAPI.GetSpellPower()) or 0 end, - fire_power = function() return select(3, CleveRoids.NampowerAPI.GetSpellPower()) or 0 end, - frost_power = function() return select(5, CleveRoids.NampowerAPI.GetSpellPower()) or 0 end, - nature_power = function() return select(4, CleveRoids.NampowerAPI.GetSpellPower()) or 0 end, - shadow_power = function() return select(6, CleveRoids.NampowerAPI.GetSpellPower()) or 0 end, + -- Bonus Spell Damage by School (ClassicAPI GetSpellBonusDamage) + -- school: 1=Physical, 2=Holy, 3=Fire, 4=Nature, 5=Frost, 6=Shadow, 7=Arcane + arcane_power = function() return CleveRoids.ClassicAPI.GetSpellBonusDamage(7) or 0 end, + fire_power = function() return CleveRoids.ClassicAPI.GetSpellBonusDamage(3) or 0 end, + frost_power = function() return CleveRoids.ClassicAPI.GetSpellBonusDamage(5) or 0 end, + nature_power = function() return CleveRoids.ClassicAPI.GetSpellBonusDamage(4) or 0 end, + shadow_power = function() return CleveRoids.ClassicAPI.GetSpellBonusDamage(6) or 0 end, -- Highest spell power across all schools spell_power = function() - local p, h, fi, n, fr, s, a = CleveRoids.NampowerAPI.GetSpellPower() - if p then - return math.max(p, h, fi, n, fr, s, a) + local API = CleveRoids.ClassicAPI + local best = 0 + for s = 1, 7 do + local v = API.GetSpellBonusDamage(s) or 0 + if v > best then best = v end end - return 0 + return best end, -- Defensive Stats diff --git a/NampowerAPI.lua b/NampowerAPI.lua index da7e12c..6ab97c0 100644 --- a/NampowerAPI.lua +++ b/NampowerAPI.lua @@ -71,7 +71,6 @@ Spell Miss Events (v2.31+): - SPELL_MISS_SELF / SPELL_MISS_OTHER - Spell miss/resist/immune/dodge/etc. - - GetSpellPower([mode]) - Player mod damage done for all 7 schools Aura Event State Parameter (v2.32+): - Buff/debuff events include 7th `state` parameter (0=added, 1=removed, 2=modified) @@ -364,9 +363,8 @@ API.VERSION_REQUIREMENTS = { ["AuraDurationEvents"] = { 2, 30, 0 }, ["GetPlayerAuraDuration"] = { 2, 30, 0, "GetPlayerAuraDuration" }, - -- v2.31+ - Spell miss events and spell power query + -- v2.31+ - Spell miss events ["SpellMissEvents"] = { 2, 31, 0 }, -- SPELL_MISS_SELF/OTHER events - ["GetSpellPower"] = { 2, 31, 0, "GetSpellPower" }, -- v2.32+ - Aura event state parameter and stack removal fix ["AuraEventState"] = { 2, 32, 0 }, @@ -575,9 +573,8 @@ local function InitializeFeatures() f.hasAuraDurationEvents = API.HasFeature("AuraDurationEvents") f.hasGetPlayerAuraDuration = API.HasFeature("GetPlayerAuraDuration") - -- v2.31+ Spell miss events and spell power + -- v2.31+ Spell miss events f.hasSpellMissEvents = API.HasFeature("SpellMissEvents") - f.hasGetSpellPower = API.HasFeature("GetSpellPower") -- v2.32+ Aura event state parameter f.hasAuraEventState = API.HasFeature("AuraEventState") @@ -3387,15 +3384,6 @@ API.MISS_INFO = { -- SPELL POWER QUERY (v2.31+) -------------------------------------------------------------------------------- --- Get spell power for all 7 damage schools (v2.31+) --- mode: optional mode parameter passed to GetSpellPower --- Returns: physical, holy, fire, nature, frost, shadow, arcane (or nil if unavailable) -function API.GetSpellPower(mode) - if not API.features.hasGetSpellPower or not _G.GetSpellPower then - return nil, nil, nil, nil, nil, nil, nil - end - return _G.GetSpellPower(mode) -end -- Get duration of a spell in milliseconds (v2.38+) -- For channeling spells: returns the channel duration.