Skip to content

Commit 849132f

Browse files
committedDec 6, 2021
Fixes around Blizzard's GetManaRegen() - it should work mostly out of the box. It seems to be fixed. More testing to be done
1 parent e8e45f2 commit 849132f

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed
 

‎CharacterStatsTbcCore.lua

+7-24
Original file line numberDiff line numberDiff line change
@@ -1118,34 +1118,17 @@ function CSC_PaperDollFrame_SetManaRegen(statFrame, unit)
11181118
GameTooltip:Hide()
11191119
end)
11201120

1121-
-- There is a bug in GetManaRegen() so I have to manually calculate mp5
1122-
-- base == casting always and this is wrong
1121+
-- It looks like Blizzard fixed this. It also takes into account mana regen from talents and gear
11231122
local base, casting = GetManaRegen();
1124-
1125-
-- to avoid the wrongly reported "0" regen after an update
1126-
if base < 1 then base = g_lastSeenBaseManaRegen end
1127-
if casting < 1 then casting = g_lastSeenBaseManaRegen end
1128-
g_lastSeenBaseManaRegen = base;
1129-
g_lastSeenCastingManaRegen = casting;
1130-
1131-
local mp5FromGear = CSC_GetMP5FromGear(unit) + CSC_GetMP5FromSetBonus(unit);
1132-
local mp5ModifierCasting = CSC_GetMP5ModifierFromTalents(unit) + CSC_GetMP5ModifierFromSetBonus(unit);
1123+
local mp5FromGear = CSC_GetMP5FromGear(unit) + CSC_GetMP5FromSetBonus(unit); -- gems not included
11331124

1134-
local mp5FromAuras, mp5CombatModifier = CSC_GetMP5FromAuras();
1135-
if mp5CombatModifier > 0 then
1136-
mp5ModifierCasting = mp5ModifierCasting + mp5CombatModifier;
1137-
end
1138-
1139-
-- All mana regen stats are displayed as mana/5 sec.
1140-
local regenWhenNotCasting = (base * 5.0) + mp5FromGear + mp5FromAuras;
1141-
casting = mp5FromGear + mp5FromAuras; -- if GetManaRegen() gets fixed ever, this should be changed
1125+
-- Convert mana per sec to mp5
1126+
base = base * 5.0;
1127+
casting = casting * 5.0;
11421128

1143-
if mp5ModifierCasting > 0 then
1144-
casting = casting + base * mp5ModifierCasting * 5.0;
1145-
end
1146-
1147-
local regenWhenNotCastingText = BreakUpLargeNumbers(regenWhenNotCasting);
1129+
local regenWhenNotCastingText = BreakUpLargeNumbers(base);
11481130
local castingText = BreakUpLargeNumbers(casting);
1131+
11491132
-- While Casting mana regen is most important to the player, so we display it as the main value
11501133
CSC_PaperDollFrame_SetLabelAndText(statFrame, MANA_REGEN, castingText, false);
11511134
statFrame.mp5FromGear = BreakUpLargeNumbers(mp5FromGear);

0 commit comments

Comments
 (0)
Please sign in to comment.