Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d494c1d
add MP5 from items only in classic
Alessandro-Barbieri Jun 2, 2026
cf07fd0
Refactor GetMP5FromSpirit to use GetUnitManaRegenRateFromSpirit
Alessandro-Barbieri Jun 2, 2026
30da78d
remove unused variable
Alessandro-Barbieri Jun 2, 2026
25ab019
Add GetUnitManaRegenRateFromSpirit to luacheckrc
Alessandro-Barbieri Jun 2, 2026
0283a05
more mp5 fixes
Alessandro-Barbieri Jun 2, 2026
ee9bea2
manually calculate spirit regen in classic
Alessandro-Barbieri Jun 2, 2026
19c6c34
luacheck
Alessandro-Barbieri Jun 2, 2026
501ece5
Add LE_UNIT_STAT_SPIRIT to .luacheckrc
Alessandro-Barbieri Jun 2, 2026
c15adc3
Fix UnitStat call to use 'player' instead of 'unit'
Alessandro-Barbieri Jun 2, 2026
97cfb41
Add PowerRegenPercentModifier data
Alessandro-Barbieri Jun 3, 2026
2458c3b
wip
Alessandro-Barbieri Jun 3, 2026
49ed929
wip
Alessandro-Barbieri Jun 4, 2026
e12e31e
wip
Alessandro-Barbieri Jun 4, 2026
f040733
wip
Alessandro-Barbieri Jun 4, 2026
1bdeaa6
wip
Alessandro-Barbieri Jun 11, 2026
31e411b
wip
Alessandro-Barbieri Jun 11, 2026
8693e42
wip
Alessandro-Barbieri Jun 11, 2026
0aa5709
profile
Alessandro-Barbieri Jun 11, 2026
ee5d528
wip
Alessandro-Barbieri Jun 11, 2026
087af75
wip
Alessandro-Barbieri Jun 11, 2026
e5aa280
Refactor MP5 calculations and remove gem checks
Alessandro-Barbieri Jun 11, 2026
1005194
Merge branch 'BreakBB:master' into patch-1
Alessandro-Barbieri Jun 11, 2026
027d0ee
Fix
Alessandro-Barbieri Jun 11, 2026
3ab17de
Fix variable name for periodic mana in GetMP5WhileCasting
Alessandro-Barbieri Jun 11, 2026
7603aa9
Fix formatting for mp5NotCasting category
Alessandro-Barbieri Jun 11, 2026
021001a
fixes
Alessandro-Barbieri Jun 11, 2026
e12bc30
Fix MP5 property names in migration logic
Alessandro-Barbieri Jun 13, 2026
1a80185
Rename and update MP5 translation keys
Alessandro-Barbieri Jun 13, 2026
9a487d5
fix
Alessandro-Barbieri Jun 13, 2026
39693fd
Change translation values to false for multiple languages
Alessandro-Barbieri Jun 13, 2026
a618b0c
Change translation values to boolean false
Alessandro-Barbieri Jun 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ stds.ecs = {
"GetUICameraInfo",
"GetUITextureKitInfo",
"GetUnitHealthModifier",
"GetUnitManaRegenRateFromSpirit",
"GetUnitMaxHealthModifier",
"GetUnitPowerModifier",
"GetUnitSpeed",
Expand Down Expand Up @@ -2767,6 +2768,7 @@ stds.ecs = {
"WOW_PROJECT_WRATH_CLASSIC",
"-----------------------------------------------------> Enums",
"LE_EXPANSION_BURNING_CRUSADE",
"LE_UNIT_STAT_SPIRIT",
"-----------------------------------------------------> GlobalStrings",
"CLOSE",
"DEFENSE",
Expand Down
20 changes: 10 additions & 10 deletions Modules/Config/ManaSection.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ function _Config:LoadManaSection()
Stats.RebuildStatInfos()
end,
},
mp5Items = {
mp5CastingModifier = {
type = "toggle",
order = 1,
name = function() return i18n("MP5 Items") end,
desc = function() return i18n("Shows/Hides the MP5 value from items.") end,
name = function() return i18n("MP5 Casting Modifier") end,
desc = function() return i18n("Shows/Hides the MP5 casting modifier.") end,
width = 1.5,
disabled = function() return (not ExtendedCharacterStats.profile.regen.display); end,
get = function () return ExtendedCharacterStats.profile.regen.mp5Items.display; end,
get = function () return ExtendedCharacterStats.profile.regen.mp5CastingModifier.display; end,
set = function (_, value)
ExtendedCharacterStats.profile.regen.mp5Items.display = value
ExtendedCharacterStats.profile.regen.mp5CastingModifier.display = value
Stats.RebuildStatInfos()
end,
},
Expand All @@ -54,16 +54,16 @@ function _Config:LoadManaSection()
Stats.RebuildStatInfos()
end,
},
mp5Buffs = {
mp5Periodic = {
type = "toggle",
order = 3,
name = function() return i18n("MP5 Buffs") end,
desc = function() return i18n("Shows/Hides the MP5 value from buffs.") end,
name = function() return i18n("MP5 Periodic") end,
desc = function() return i18n("Shows/Hides the periodic MP5 value.") end,
width = 1.5,
disabled = function() return (not ExtendedCharacterStats.profile.regen.display); end,
get = function () return ExtendedCharacterStats.profile.regen.mp5Buffs.display; end,
get = function () return ExtendedCharacterStats.profile.regen.mp5Periodic.display; end,
set = function (_, value)
ExtendedCharacterStats.profile.regen.mp5Buffs.display = value
ExtendedCharacterStats.profile.regen.mp5Periodic.display = value
Stats.RebuildStatInfos()
end,
},
Expand Down
40 changes: 40 additions & 0 deletions Modules/Data/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,46 @@ Data.Aura = {
[25894] = (ECS.IsClassic and 1 or nil), -- Greater Blessing of Wisdom rank 1
[25918] = (ECS.IsClassic and 1 or nil), -- Greater Blessing of Wisdom rank 2
},
PowerRegenPercentModifier = {
[Enum.PowerType.Energy] = {
[13750] = 1, -- Adrenaline Rush
[58427] = 0.3, -- Overkill
[66203] = -1, -- Steam Blast
[69470] = -1, -- Heat Drain
[70385] = -1, -- Abomination Vehicle Power Drain
[72242] = -1, -- Zero Power
[1231381] = 0.26, -- Feral Dedication
},
[Enum.PowerType.Mana] = {
[5419] = (ECS.IsTBC and -0.11 or nil), -- Travel Form (Passive)
[5421] = (ECS.IsTBC and -0.11 or nil), -- Aquatic Form (Passive)
[12051] = (ECS.IsClassic and 15 or nil), -- Evocation
[18371] = (ECS.IsClassic and 0.5 or nil), -- Soul Siphon
[24705] = (ECS.IsClassic and 0.25 or nil), -- Invocation of the Wickerman
[27747] = -1, -- Steam Tank Passive
[29166] = ((not ECS.IsWotlk) and 4 or nil), -- Innervate
[33948] = (ECS.IsTBC and -0.11 or nil), -- Flight Form (Passive)
[34754] = (ECS.IsWotlk and 0.16 or nil), -- Holy Concentration
[40121] = (ECS.IsTBC and -0.11 or nil), -- Swift Flight Form (Passive)
[42514] = 1, -- Arcane Surge
[49307] = 1, -- Full Mana Regen
[51623] = 5, -- Sholazar Guardian Heartbeat
[63724] = 0.32, -- Holy Concentration
[63725] = 0.5, -- Holy Concentration
[456195] = 4, -- Innervate
[468466] = 1, -- Unmaking the Simulacrum
},
[Enum.PowerType.RuneBlood] = {
[50469] = -0.5, -- Rhythm of the Fallen
[50779] = 1, -- Blood Rune Mastery
},
[Enum.PowerType.RuneFrost] = {
[50469] = -0.5, -- Rhythm of the Fallen
},
[Enum.PowerType.RuneUnholy] = {
[50469] = -0.5, -- Rhythm of the Fallen
},
},
SpellCrit = {
[24907] = ((not ECS.IsClassic) and 5 or nil), -- Moonkin Aura
[29177] = 6, -- Elemental Devastation Rank 2
Expand Down
10 changes: 5 additions & 5 deletions Modules/Data/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ dataFunctionRefs = {
["SpellHasteBonus"] = function() return Data:GetSpellHasteBonus() end,
["SpellPenetration"] = function() return Data:GetSpellPenetration() end,
-- MP5
["MP5Items"] = function() return Data:GetMP5FromItems() end,
["MP5Spirit"] = function() return Data:GetMP5FromSpirit() end,
["MP5Buffs"] = function()
local _, mp5Buffs = Data:GetMP5FromBuffs()
return mp5Buffs
["MP5Periodic"] = function()
local _, _, _, periodicMana = Data:GetMP5FromBuffs()
return periodicMana
end,
["MP5Spirit"] = function() return Data:GetMP5FromSpirit() end,
["MP5CastingModifier"] = function() return Data:GetMP5CastingModifier() end,
["MP5Casting"] = function() return Data:GetMP5WhileCasting() end,
["MP5NotCasting"] = function() return Data:GetMP5OutsideCasting() end,
-- Spell Power by school
Expand Down
85 changes: 48 additions & 37 deletions Modules/Data/MP5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ function _MP5:GetMP5ValueOnItems()
if enchant then
mp5 = mp5 + (Data.Enchant.MP5[enchant] or 0)
end
-- Check for socketed gems (TODO: check for socket bonus)
local gem1, gem2, gem3 = DataUtils:GetSocketedGemsFromItemLink(itemLink)
if gem1 then
mp5 = mp5 + (Data.Gem.MP5[tonumber(gem1)] or 0)
end
if gem2 then
mp5 = mp5 + (Data.Gem.MP5[tonumber(gem2)] or 0)
end
if gem3 then
mp5 = mp5 + (Data.Gem.MP5[tonumber(gem3)] or 0)
end
end
end

Expand All @@ -78,48 +67,69 @@ function _MP5:GetMP5ValueOnItems()
return mp5
end

local lastManaReg = 0

---@return number
function Data:GetMP5FromSpirit()
local base, _ = GetManaRegen() -- Returns mana reg per 1 second (including talent and buff modifiers)
if base < 1 then
base = lastManaReg
local regen
if ECS.IsClassic then
-- GetUnitManaRegenRateFromSpirit uses TBC formula in classic
local _, spirit, _, _ = UnitStat("player", LE_UNIT_STAT_SPIRIT)
if spirit < 50 then
regen = 0.25 * spirit
else
if classId == Data.PRIEST or classId == Data.MAGE then
regen = (12.5 + spirit/4)/2
elseif classId == Data.DRUID and (not DataUtils:IsShapeshifted()) then
regen = (15 + spirit/4.5)/2
else
regen = (15 + spirit/5)/2
end
end
else
regen = GetUnitManaRegenRateFromSpirit("player")
end
lastManaReg = base
return DataUtils:Round(regen * 5, 1)
end

return DataUtils:Round(base * 5, 2)
-- Get mana regen while casting
---@return number
function Data:GetMP5CastingModifier()
local _, castingModifier, _, _ = Data:GetMP5FromBuffs()
castingModifier = min(1,castingModifier + _MP5:GetTalentModifier() + Data:GetSetBonusModifierMP5()) -- capped at 100%
return DataUtils:Round(castingModifier, 2)
end

-- Get mana regen while casting
---@return number
function Data:GetMP5WhileCasting()
local _, casting = GetManaRegen() -- Returns mana reg per 1 second (including talent and buff modifiers)
if casting < 0.1 then
casting = 0
-- Returns mana reg per 1 second (including talent and buff casting modifiers)
local _, casting = GetManaRegen()
local modifier, _, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs()
casting = casting * 5
if ECS.IsClassic then
-- in classic GetManaRegen doesn't account for mp5 from items nor buffs
casting = casting + Data:GetMP5FromItems() + mp5BuffBonus
end

local castingModifier, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs()
castingModifier = min(1,castingModifier + _MP5:GetTalentModifier() + Data:GetSetBonusModifierMP5()) -- capped at 100%
local mp5Items = Data:GetMP5FromItems()
casting = (casting * 5) + mp5Items + mp5BuffBonus * castingModifier + periodicMana

return DataUtils:Round(casting, 2)
casting = casting * modifier + mp5BuffBonus + periodicMana
return DataUtils:Round(casting, 1)
end

---@return number
function Data:GetMP5OutsideCasting()
local mp5FromSpirit = Data:GetMP5FromSpirit()
local _, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs()
local mp5FromItems = Data:GetMP5FromItems()

local totalMP5 = mp5FromSpirit + mp5FromItems + mp5BuffBonus + periodicMana
return DataUtils:Round(totalMP5, 2)
local base, _ = GetManaRegen()
local modifier, mp5BuffBonus, periodicMana = Data:GetMP5FromBuffs()
local totalMP5 = base * 5
if ECS.IsClassic then
-- in classic GetManaRegen doesn't account for mp5 from items nor buffs
totalMP5 = totalMP5 + Data:GetMP5FromItems() + mp5BuffBonus
end
totalMP5 = totalMP5 * modifier + periodicMana
return DataUtils:Round(totalMP5, 1)
end

---@return number, number, number
function Data:GetMP5FromBuffs()
local mod = 0
local mod = 1
local castingMod = 0
local bonus = 0
local periodic = 0
local maxmana = UnitPowerMax("player", Enum.PowerType.Mana)
Expand All @@ -131,7 +141,8 @@ function Data:GetMP5FromBuffs()
bonus = bonus + (Data.Aura.MP5[aura.spellId] or 0)
bonus = bonus + (Data.Aura.PercentageMp5[aura.spellId] or 0) * maxmana
periodic = periodic + (Data.Aura.PeriodicallyGiveMana[aura.spellId] or 0)
mod = mod + (Data.Aura.AllowCastingManaRegeneration[aura.spellId] or 0) -- assuming buffs stacking, to be investigated
castingMod = castingMod + (Data.Aura.AllowCastingManaRegeneration[aura.spellId] or 0)
mod = mod + (Data.Aura.PowerRegenPercentModifier[Enum.PowerType.Mana][aura.spellId] or 0)
if Data.Aura.IsLightningShield[aura.spellId] and Data:IsSetBonusActive(Data.setNames.THE_EARTHSHATTERER, 8) then
bonus = bonus + 15 -- 15 MP5 from Shaman T3 8 piece bonus when Lightning Shield is active
end
Expand All @@ -157,7 +168,7 @@ function Data:GetMP5FromBuffs()
end
i = i + 1
until (not aura)
return min(mod,1), bonus, periodic
return max(mod,0), min(castingMod,1), bonus, periodic
end

---@return number
Expand Down
8 changes: 8 additions & 0 deletions Modules/Migration.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ function Migration:ToLatestProfileVersion(profileVersion)
return
end

local defaultProfile = Profile:GetDefaultProfile()

if profileVersion < 24 then
ExtendedCharacterStats.profile.defense.resilienceRating = ExtendedCharacterStats.profile.defense.resilience
ExtendedCharacterStats.profile.defense.resilience = nil
end
if profileVersion < 25 then
ExtendedCharacterStats.profile.defense.resilience = nil
end
if profileVersion < 26 then
ExtendedCharacterStats.profile.regen.mp5Buffs = nil
ExtendedCharacterStats.profile.regen.mp5Items = nil
ExtendedCharacterStats.profile.regen.mp5Periodic = defaultProfile.profile.regen.mp5Periodic
ExtendedCharacterStats.profile.regen.mp5CastingModifier = defaultProfile.profile.regen.mp5CastingModifier
end
end
14 changes: 7 additions & 7 deletions Modules/Profile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local Utils = ECSLoader:ImportModule("Utils")

---@return number
function Profile.GetProfileVersion()
return 25
return 26
end

---@return ECSProfile
Expand Down Expand Up @@ -296,10 +296,10 @@ local function GetDefaultStatsProfile()
refName = "ManaHeader",
text = "Mana",

mp5Items = {
mp5CastingModifier = {
display = true,
refName = "MP5Items",
text = "MP5 (Items)",
refName = "MP5CastingModifier",
text = "MP5 Casting Modifier",
textColor = colors.MP5_SECONDARY,
statColor = colors.MP5_PRIMARY
},
Expand All @@ -310,10 +310,10 @@ local function GetDefaultStatsProfile()
textColor = colors.MP5_SECONDARY,
statColor = colors.MP5_PRIMARY
},
mp5Buffs = {
mp5Periodic = {
display = true,
refName = "MP5Buffs",
text = "MP5 (Buffs)",
refName = "MP5Periodic",
text = "MP5 (Periodic)",
textColor = colors.MP5_SECONDARY,
statColor = colors.MP5_PRIMARY
},
Expand Down
9 changes: 8 additions & 1 deletion Modules/Stats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,14 @@ _CreateStatInfos = function()

if UnitHasMana("player") then
category = profile.regen
_CreateStatInfo(category, category.mp5Items, category.mp5Spirit, category.mp5Buffs, category.mp5Casting, category.mp5NotCasting)
_CreateStatInfo(
category,
category.mp5Spirit,
category.mp5Periodic,
category.mp5CastingModifier,
category.mp5Casting,
category.mp5NotCasting
)
end

category = profile.spell
Expand Down
Loading
Loading