Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/Classes/ConfigTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont
local cur = self.input[varData.var]
local def = self:GetDefaultState(varData.var, type(cur))
if not shown and cur ~= nil and cur ~= def then
return "^1"..StripEscapes(innerLabel)
return colorCodes.NEGATIVE..StripEscapes(innerLabel)
end
return innerLabel
end
Expand All @@ -488,7 +488,7 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont
local cur = self.input[varData.var]
local def = self:GetDefaultState(varData.var, type(cur))
if not shown and cur ~= nil and cur ~= def then
tooltip:AddLine(14, "^1This config option is conditional with missing source and is invalid.")
tooltip:AddLine(14, colorCodes.NEGATIVE.."This config option is conditional with missing source and is invalid.")
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3075,7 +3075,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
tooltip:AddLine(16, "^xFF5555Exclusive to: "..item.league)
end
if item.unreleased then
tooltip:AddLine(16, "^1Not yet available")
tooltip:AddLine(16, colorCodes.NEGATIVE.."Not yet available")
end
if item.source then
tooltip:AddLine(16, colorCodes.SOURCE.."Source: "..self:FormatItemSource(item.source))
Expand Down Expand Up @@ -3301,13 +3301,13 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
tooltip:AddSeparator(10)
end
if item.split then
tooltip:AddLine(16, "^1Split")
tooltip:AddLine(16, colorCodes.NEGATIVE.."Split")
end
if item.mirrored then
tooltip:AddLine(16, "^1Mirrored")
tooltip:AddLine(16, colorCodes.NEGATIVE.."Mirrored")
end
if item.corrupted then
tooltip:AddLine(16, "^1Corrupted")
tooltip:AddLine(16, colorCodes.NEGATIVE.."Corrupted")
end
end
tooltip:AddSeparator(14)
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/PassiveTreeView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ function PassiveTreeViewClass:AddNodeTooltip(tooltip, node, build)
modStr = (modStr and modStr..", " or "^2") .. modLib.formatMod(mod)
end
if node.mods[i].extra then
modStr = (modStr and modStr.." " or "") .. "^1" .. node.mods[i].extra
modStr = (modStr and modStr.." " or "") .. colorCodes.NEGATIVE .. node.mods[i].extra
end
if modStr then
line = line .. " " .. modStr
Expand Down
7 changes: 7 additions & 0 deletions src/Data/Global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ colorCodes.EVASION = colorCodes.POSITIVE
colorCodes.RAGE = colorCodes.WARNING
colorCodes.PHYS = colorCodes.NORMAL

defaultColorCodes = copyTable(colorCodes)
function updateColorCode(code, color)
if colorCodes[code] then
colorCodes[code] = color:gsub("^0", "^")
end
end

ModFlag = { }
-- Damage modes
ModFlag.Attack = 0x00000001
Expand Down
4 changes: 2 additions & 2 deletions src/Modules/Build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild)
if #self.controls.warnings.lines > 0 then
local count = 0
for _ in pairs(self.controls.warnings.lines) do count = count + 1 end
control.str = string.format("^1%d Warnings", count)
control.str = string.format(colorCodes.NEGATIVE.."%d Warnings", count)
local x, y = control:GetPos()
local width, height = control:GetSize()
DrawString(x, y + 2, "LEFT", 16, "FIXED", control.str)
Expand Down Expand Up @@ -776,7 +776,7 @@ function buildMode:EstimatePlayerProgress()
if AscUsed > ascMax then InsertIfNew(self.controls.warnings.lines, "You have too many ascendancy points allocated") end
self.Act = strAct

return string.format("%s%3d / %3d %s%d / %d", PointsUsed > usedMax and "^1" or "^7", PointsUsed, usedMax, AscUsed > ascMax and "^1" or "^7", AscUsed, ascMax), "Required Level: ".. levelreq .. "\nEstimated Progress:\nAct: ".. strAct .. "\nQuestpoints: " .. acts[currentAct].questPoints - extra .. "\nExtra Skillpoints: " .. extra .. labSuggest
return string.format("%s%3d / %3d %s%d / %d", PointsUsed > usedMax and colorCodes.NEGATIVE or "^7", PointsUsed, usedMax, AscUsed > ascMax and colorCodes.NEGATIVE or "^7", AscUsed, ascMax), "Required Level: ".. levelreq .. "\nEstimated Progress:\nAct: ".. strAct .. "\nQuestpoints: " .. acts[currentAct].questPoints - extra .. "\nExtra Skillpoints: " .. extra .. labSuggest
end

function buildMode:CanExit(mode)
Expand Down
8 changes: 4 additions & 4 deletions src/Modules/CalcOffence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ function calcs.offence(env, actor, activeSkill)
t_insert(storedSustainedTraumaBreakdown, s_format("x %.2f ^8(increased/reduced)", (1 + inc / 100)))
t_insert(storedSustainedTraumaBreakdown, s_format("/ %.4f ^8(1 / duration - trauma per second * increased attack speed per trauma / 100)", ( 1 / duration - traumaRateBeforeInc * incAttackSpeedPerTrauma / 100 )))
end
t_insert(storedSustainedTraumaBreakdown, s_format("= "..(invalid and "^1" or "").."%d ^8trauma", traumaBreakdown))
t_insert(storedSustainedTraumaBreakdown, s_format("= "..(invalid and colorCodes.NEGATIVE or "").."%d ^8trauma", traumaBreakdown))
if invalid then
t_insert(storedSustainedTraumaBreakdown, "Attack Speed exceeds cap; Recalculating")
breakdown.multiChain(storedSustainedTraumaBreakdown, {
Expand Down Expand Up @@ -3667,7 +3667,7 @@ function calcs.offence(env, actor, activeSkill)
end
if output.BleedDPS ~= BleedDPSUncapped then
t_insert(breakdown.BleedDPS, s_format("= %.1f ^8(Uncapped raw Bleed DPS)", BleedDPSUncapped))
t_insert(breakdown.BleedDPS, s_format("^8(Raw Bleed DPS is ^1overcapped ^8by^7 %.1f ^8:^7 %.1f%%^8", BleedDPSUncapped - BleedDPSCapped, (BleedDPSUncapped - BleedDPSCapped) / BleedDPSCapped * 100))
t_insert(breakdown.BleedDPS, s_format("^8(Raw Bleed DPS is "..colorCodes.NEGATIVE.."overcapped ^8by^7 %.1f ^8:^7 %.1f%%^8", BleedDPSUncapped - BleedDPSCapped, (BleedDPSUncapped - BleedDPSCapped) / BleedDPSCapped * 100))
t_insert(breakdown.BleedDPS, s_format("= %d ^8(Capped Bleed DPS)", BleedDPSCapped))
else
t_insert(breakdown.BleedDPS, s_format("= %.1f ^8per second", output.BleedDPS))
Expand Down Expand Up @@ -3867,7 +3867,7 @@ function calcs.offence(env, actor, activeSkill)
end
if output.PoisonDPS ~= PoisonDPSUncapped then
t_insert(breakdown.PoisonDPS, s_format("= %.1f ^8(Uncapped raw Poison DPS)", PoisonDPSUncapped))
t_insert(breakdown.PoisonDPS, s_format("^8(Raw Poison DPS is ^1overcapped ^8by^7 %.1f ^8:^7 %.1f%%^8)", PoisonDPSUncapped - PoisonDPSCapped, (PoisonDPSUncapped - PoisonDPSCapped) / PoisonDPSCapped * 100))
t_insert(breakdown.PoisonDPS, s_format("^8(Raw Poison DPS is "..colorCodes.NEGATIVE.."overcapped ^8by^7 %.1f ^8:^7 %.1f%%^8)", PoisonDPSUncapped - PoisonDPSCapped, (PoisonDPSUncapped - PoisonDPSCapped) / PoisonDPSCapped * 100))
t_insert(breakdown.PoisonDPS, s_format("= %d ^8(Capped Poison DPS)", PoisonDPSCapped))
else
t_insert(breakdown.PoisonDPS, s_format("= %.1f ^8per second", output.PoisonDPS))
Expand Down Expand Up @@ -4141,7 +4141,7 @@ function calcs.offence(env, actor, activeSkill)
end
if output.IgniteDPS ~= IgniteDPSUncapped then
t_insert(breakdown.IgniteDPS, s_format("= %.1f ^8(Uncapped raw Ignite DPS)", IgniteDPSUncapped))
t_insert(breakdown.IgniteDPS, s_format("^8(Raw Ignite DPS is ^1overcapped ^8by^7 %.1f ^8:^7 %.1f%%^8", IgniteDPSUncapped - IgniteDPSCapped, (IgniteDPSUncapped - IgniteDPSCapped) / IgniteDPSCapped * 100))
t_insert(breakdown.IgniteDPS, s_format("^8(Raw Ignite DPS is "..colorCodes.NEGATIVE.."overcapped ^8by^7 %.1f ^8:^7 %.1f%%^8", IgniteDPSUncapped - IgniteDPSCapped, (IgniteDPSUncapped - IgniteDPSCapped) / IgniteDPSCapped * 100))
t_insert(breakdown.IgniteDPS, s_format("= %d ^8(Capped Ignite DPS)", IgniteDPSCapped))
else
t_insert(breakdown.IgniteDPS, s_format("= %.1f ^8per second", output.IgniteDPS))
Expand Down
44 changes: 43 additions & 1 deletion src/Modules/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ function main:Init()
self.buildSortMode = "NAME"
self.connectionProtocol = 0
self.nodePowerTheme = "RED/BLUE"
self.colorPositive = defaultColorCodes.POSITIVE
self.colorNegative = defaultColorCodes.NEGATIVE
self.showThousandsSeparators = true
self.thousandsSeparator = ","
self.decimalSeparator = "."
Expand Down Expand Up @@ -189,7 +191,7 @@ function main:Init()
self.controls.versionLabel.label = function()
return "^8Version: "..launch.versionNumber..(launch.versionBranch == "dev" and " (Dev)" or launch.versionBranch == "beta" and " (Beta)" or "")
end
self.controls.devMode = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 0, -26, 0, 20, "^1Dev Mode")
self.controls.devMode = new("LabelControl", {"BOTTOMLEFT",self.anchorMain,"BOTTOMLEFT"}, 0, -26, 0, 20, colorCodes.NEGATIVE.."Dev Mode")
self.controls.devMode.shown = function()
return launch.devMode
end
Expand Down Expand Up @@ -484,6 +486,14 @@ function main:LoadSettings(ignoreBuild)
if node.attrib.nodePowerTheme then
self.nodePowerTheme = node.attrib.nodePowerTheme
end
if node.attrib.colorPositive then
updateColorCode("POSITIVE", node.attrib.colorPositive)
self.colorPositive = node.attrib.colorPositive
end
if node.attrib.colorNegative then
updateColorCode("NEGATIVE", node.attrib.colorNegative)
self.colorNegative = node.attrib.colorNegative
end
-- In order to preserve users' settings through renaming/merging this variable, we have this if statement to use the first found setting
-- Once the user has closed PoB once, they will be using the new `showThousandsSeparator` variable name, so after some time, this statement may be removed
if node.attrib.showThousandsCalcs then
Expand Down Expand Up @@ -619,6 +629,8 @@ function main:SaveSettings()
proxyURL = launch.proxyURL,
buildPath = (self.buildPath ~= self.defaultBuildPath and self.buildPath or nil),
nodePowerTheme = self.nodePowerTheme,
colorPositive = self.colorPositive,
colorNegative = self.colorNegative,
showThousandsSeparators = tostring(self.showThousandsSeparators),
thousandsSeparator = self.thousandsSeparator,
decimalSeparator = self.decimalSeparator,
Expand Down Expand Up @@ -714,6 +726,30 @@ function main:OpenOptionsPopup()
controls.nodePowerTheme.tooltipText = "Changes the colour scheme used for the node power display on the passive tree."
controls.nodePowerTheme:SelByValue(self.nodePowerTheme, "theme")

nextRow()
controls.colorPositive = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 100, 18, tostring(self.colorPositive:gsub('^(^)', '0')), nil, nil, 8, function(buf)
local match = string.match(buf, "0x%x+")
if match and #match == 8 then
updateColorCode("POSITIVE", buf)
self.colorPositive = buf
end
end)
controls.colorPositiveLabel = new("LabelControl", { "RIGHT", controls.colorPositive, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Hex colour for positive values:")
controls.colorPositive.tooltipText = "Overrides the default hex colour for positive values in breakdowns. \nExpected format is 0x000000. " ..
"The default value is " .. tostring(defaultColorCodes.POSITIVE:gsub('^(^)', '0')) .. ".\nIf updating while inside a build, please re-load the build after saving."

nextRow()
controls.colorNegative = new("EditControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 100, 18, tostring(self.colorNegative:gsub('^(^)', '0')), nil, nil, 8, function(buf)
local match = string.match(buf, "0x%x+")
if match and #match == 8 then
updateColorCode("NEGATIVE", buf)
self.colorNegative = buf
end
end)
controls.colorNegativeLabel = new("LabelControl", { "RIGHT", controls.colorNegative, "LEFT" }, defaultLabelSpacingPx, 0, 0, 16, "^7Hex colour for negative values:")
controls.colorNegative.tooltipText = "Overrides the default hex colour for negative values in breakdowns. \nExpected format is 0x000000. " ..
"The default value is " .. tostring(defaultColorCodes.NEGATIVE:gsub('^(^)', '0')) .. ".\nIf updating while inside a build, please re-load the build after saving."

nextRow()
controls.betaTest = new("CheckBoxControl", { "TOPLEFT", nil, "TOPLEFT" }, defaultLabelPlacementX, currentY, 20, "^7Opt-in to weekly beta test builds:", function(state)
self.betaTest = state
Expand Down Expand Up @@ -799,6 +835,8 @@ function main:OpenOptionsPopup()
controls.betaTest.state = self.betaTest
controls.titlebarName.state = self.showTitlebarName
local initialNodePowerTheme = self.nodePowerTheme
local initialColorPositive = self.colorPositive
local initialColorNegative = self.colorNegative
local initialThousandsSeparatorDisplay = self.showThousandsSeparators
local initialTitlebarName = self.showTitlebarName
local initialThousandsSeparator = self.thousandsSeparator
Expand Down Expand Up @@ -841,6 +879,10 @@ function main:OpenOptionsPopup()
end)
controls.cancel = new("ButtonControl", nil, 45, currentY, 80, 20, "Cancel", function()
self.nodePowerTheme = initialNodePowerTheme
self.colorPositive = initialColorPositive
updateColorCode("POSITIVE", self.colorPositive)
self.colorNegative = initialColorNegative
updateColorCode("NEGATIVE", self.colorNegative)
self.showThousandsSeparators = initialThousandsSeparatorDisplay
self.thousandsSeparator = initialThousandsSeparator
self.decimalSeparator = initialDecimalSeparator
Expand Down