Skip to content

Commit f8735d4

Browse files
authored
Add customization of 'Mana Regen' and 'HealPower' datatext (#1465)
* Update Global.lua Added settings for the Mana Regen datatext * Update ManaRegen.lua Make use of added datatext settings * Update Global.lua Added settings for 'HealPower' datatext * Update HealPower.lua Make use of new settings
1 parent 9ec9389 commit f8735d4

File tree

3 files changed

+27
-9
lines changed

3 files changed

+27
-9
lines changed

ElvUI/Core/Defaults/Global.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ G.datatexts = {
9595
Versatility = { Label = '', NoLabel = false, decimalLength = 1 },
9696
Dodge = { decimalLength = 1 },
9797
Parry = { decimalLength = 1 },
98-
Block = { decimalLength = 1 }
98+
Block = { decimalLength = 1 },
99+
['Mana Regen'] = { Label = '', NoLabel = false, decimalLength = 1 },
100+
HealPower = { Label = '', NoLabel = false }
99101
},
100102
newPanelInfo = {
101103
growth = 'HORIZONTAL',

ElvUI/Core/Modules/DataTexts/HealPower.lua

+12-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,22 @@ local strjoin = strjoin
55
local GetSpellBonusHealing = GetSpellBonusHealing
66
local STAT_CATEGORY_ENHANCEMENTS = STAT_CATEGORY_ENHANCEMENTS
77

8-
local displayString = ''
8+
local displayString, db = ''
99

1010
local function OnEvent(self)
11-
self.text:SetFormattedText(displayString, L["HP"], GetSpellBonusHealing())
11+
if db.NoLabel then
12+
self.text:SetFormattedText(displayString, GetSpellBonusHealing())
13+
else
14+
self.text:SetFormattedText(displayString, db.Label ~= '' and db.Label or L["HP"]..': ', GetSpellBonusHealing())
15+
end
1216
end
1317

14-
local function ApplySettings(_, hex)
15-
displayString = strjoin('', '%s: ', hex, '%d|r')
18+
local function ApplySettings(self, hex)
19+
if not db then
20+
db = E.global.datatexts.settings[self.name]
21+
end
22+
23+
displayString = strjoin('', db.NoLabel and '' or '%s', hex, '%d|r')
1624
end
1725

1826
DT:RegisterDatatext('HealPower', STAT_CATEGORY_ENHANCEMENTS, { 'UNIT_STATS', 'UNIT_AURA' }, OnEvent, nil, nil, nil, nil, L["Heal Power"], nil, ApplySettings)

ElvUI/Core/Modules/DataTexts/ManaRegen.lua

+12-4
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@ local InCombatLockdown = InCombatLockdown
99
local MANA_REGEN = MANA_REGEN
1010
local STAT_CATEGORY_ENHANCEMENTS = STAT_CATEGORY_ENHANCEMENTS
1111

12-
local displayString = ''
12+
local displayString, db = ''
1313

1414
local function OnEvent(self)
1515
local baseMR, castingMR = GetManaRegen()
1616

17-
self.text:SetFormattedText(displayString, MANA_REGEN, (InCombatLockdown() and castingMR or baseMR) * 5)
17+
if db.NoLabel then
18+
self.text:SetFormattedText(displayString, (InCombatLockdown() and castingMR or baseMR) * 5)
19+
else
20+
self.text:SetFormattedText(displayString, db.Label ~= '' and db.Label or MANA_REGEN..': ', (InCombatLockdown() and castingMR or baseMR) * 5)
21+
end
1822
end
1923

20-
local function ApplySettings(_, hex)
21-
displayString = strjoin('', '%s: ', hex, '%.2f|r')
24+
local function ApplySettings(self, hex)
25+
if not db then
26+
db = E.global.datatexts.settings[self.name]
27+
end
28+
29+
displayString = strjoin('', db.NoLabel and '' or '%s', hex, '%.'..db.decimalLength..'f|r')
2230
end
2331

2432
DT:RegisterDatatext('Mana Regen', STAT_CATEGORY_ENHANCEMENTS, {'UNIT_STATS', 'PLAYER_REGEN_DISABLED', 'PLAYER_REGEN_ENABLED'}, OnEvent, nil, nil, nil, nil, MANA_REGEN, nil, ApplySettings)

0 commit comments

Comments
 (0)