Skip to content

Commit

Permalink
Added showing EHP in the left panel as a configurable option
Browse files Browse the repository at this point in the history
  • Loading branch information
Subtractem committed Oct 17, 2024
1 parent 2421f13 commit a147674
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Modules/Build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
{ },
{ stat = "Devotion", label = "Devotion", color = colorCodes.RARE, fmt = "d" },
{ },
{ stat = "TotalEHP", label = "Effective Hit Pool", fmt = ".0f", compPercent = true},
{ stat = "PvPTotalTakenHit", label = "PvP Hit Taken", fmt = ".1f", flag = "isPvP", lowerIsBetter = true },
{ stat = "PhysicalMaximumHitTaken", label = "Phys Max Hit", fmt = ".0f", color = colorCodes.PHYS, compPercent = true, },
{ stat = "LightningMaximumHitTaken", label = "Elemental Max Hit", fmt = ".0f", color = colorCodes.LIGHTNING, compPercent = true, condFunc = function(v,o) return o.LightningMaximumHitTaken == o.ColdMaximumHitTaken and o.LightningMaximumHitTaken == o.FireMaximumHitTaken end },
Expand Down Expand Up @@ -1321,6 +1322,9 @@ function buildMode:OnFrame(inputEvents)
if main.decimalSeparator ~= self.lastShowDecimalSeparator then
self:RefreshStatList()
end
if main.showEHPInBuildPanel ~= self.showEHPInBuildPanel then
self:RefreshStatList()
end
if main.showTitlebarName ~= self.lastShowTitlebarName then
self.spec:SetWindowTitleWithBuildClass()
end
Expand Down Expand Up @@ -1679,6 +1683,7 @@ function buildMode:FormatStat(statData, statVal, overCapStatVal, colorOverride)
self.lastShowThousandsSeparators = main.showThousandsSeparators
self.lastShowThousandsSeparator = main.thousandsSeparator
self.lastShowDecimalSeparator = main.decimalSeparator
self.showEHPInBuildPanel = main.showEHPInBuildPanel
self.lastShowTitlebarName = main.showTitlebarName
return valStr
end
Expand All @@ -1700,6 +1705,11 @@ function buildMode:AddDisplayStatList(statList, actor)
end
if statVal and ((statData.condFunc and statData.condFunc(statVal,actor.output)) or (not statData.condFunc and statVal ~= 0)) then
local overCapStatVal = actor.output[statData.overCapStat] or nil

if statData.stat == "TotalEHP" then
statData.hideStat = not self.showEHPInBuildPanel
end

if statData.stat == "SkillDPS" then
labelColor = colorCodes.CUSTOM
table.sort(actor.output.SkillDPS, function(a,b) return (a.dps * a.count) > (b.dps * b.count) end)
Expand Down
14 changes: 13 additions & 1 deletion src/Modules/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function main:Init()
self.slotOnlyTooltips = true
self.POESESSID = ""
self.showPublicBuilds = true
self.showEHPInBuildPanel = false

if self.userPath then
self:ChangeUserPath(self.userPath, ignoreBuild)
Expand Down Expand Up @@ -617,6 +618,9 @@ function main:LoadSettings(ignoreBuild)
if node.attrib.showPublicBuilds then
self.showPublicBuilds = node.attrib.showPublicBuilds == "true"
end
if node.attrib.showEHPInBuildPanel then
self.showEHPInBuildPanel = node.attrib.showEHPInBuildPanel == "true"
end
end
end
end
Expand Down Expand Up @@ -727,7 +731,8 @@ function main:SaveSettings()
POESESSID = self.POESESSID,
invertSliderScrollDirection = tostring(self.invertSliderScrollDirection),
disableDevAutoSave = tostring(self.disableDevAutoSave),
showPublicBuilds = tostring(self.showPublicBuilds)
showPublicBuilds = tostring(self.showPublicBuilds),
showEHPInBuildPanel = tostring(self.showEHPInBuildPanel)
} })
local res, errMsg = common.xml.SaveXMLFile(setXML, self.userPath.."Settings.xml")
if not res then
Expand Down Expand Up @@ -975,6 +980,13 @@ function main:OpenOptionsPopup()
controls.invertSliderScrollDirection.tooltipText = "Default scroll direction is:\nScroll Up = Move right\nScroll Down = Move left"
controls.invertSliderScrollDirection.state = self.invertSliderScrollDirection

nextRow()
controls.showEHPInBuildPanel = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Show EHP In Build Panel:", function(state)
self.showEHPInBuildPanel = state
end)
controls.showEHPInBuildPanel.tooltipText = "Display Effective Health Pool In The Left Build Panel"
controls.showEHPInBuildPanel.state = self.showEHPInBuildPanel

if launch.devMode then
nextRow()
controls.disableDevAutoSave = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, { defaultLabelPlacementX, currentY, 20 }, "^7Disable Dev AutoSave:", function(state)
Expand Down

0 comments on commit a147674

Please sign in to comment.