PathOfBuilding
PathOfBuilding copied to clipboard
FEAT: Allow partial Pantheon upgrades
Fixes #897
Description of the problem being solved:
Crash Fix
- Fixed an unexpected crash which occurs when
innerShownis false, in theConfigTab.luafile.
Pantheon Gods Section
- Added a separated section for Pantheon Gods selection to make the interface cleaner, since a few checkboxes were added and the general section was a bit messy
Soul Checkboxes
- Added a checkbox for each Soul (3 for Major God and 1 for Minor God).
- Hiding checkboxes when "Nothing" is selected from the Pantheon list.
- Updating checkboxes labels with the corresponding Soul name, based on the selected God from the Pantheon list.
- Showing a tooltip while hovering the checkbox, which contains the corresponding Soul name and mod.
Pantheon Lists
- Updating list tootltip to show which Soul has been selected from the checkboxes. If a Soul has been selected, its name colour will be light grey and its mod colour will be electric blue (like before). If a Soul has not been selected, both its name colour and its mod colour will be dark grey.
Parsed Mods
- Now only the mods of the Soul selected from the checkboxes are parsed, instead of parsing them all.
After screenshot:
https://github.com/PathOfBuildingCommunity/PathOfBuilding/assets/43402870/2b3a9630-6aa9-4283-a1ee-ec1b29ecdd77
Suggested changes:
diff --git a/src/Classes/ConfigTab.lua b/src/Classes/ConfigTab.lua
index 93b9313d..960c13f6 100644
--- a/src/Classes/ConfigTab.lua
+++ b/src/Classes/ConfigTab.lua
@@ -215,6 +215,9 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont
t_insert(tooltipFuncs, varData.tooltip)
end
+ if varData.defaltHidden then
+ control.shown = false
+ end
if varData.ifNode then
t_insert(shownFuncs, listOrSingleIfOption(varData.ifNode, function(ifOption)
if self.build.spec.allocNodes[ifOption] then
diff --git a/src/Modules/ConfigOptions.lua b/src/Modules/ConfigOptions.lua
index 0b838c88..df4cbaf0 100644
--- a/src/Modules/ConfigOptions.lua
+++ b/src/Modules/ConfigOptions.lua
@@ -79,6 +79,31 @@ local function pantheonMinorGodTooltip(modList, build)
end
end
+local function pantheonSoulToolTip(godSource, soulSource)
+ return function(_, build)
+ local input = build.configTab.input
+ local god = input[godSource]
+ local soulSourceControl = build.configTab.varControls[soulSource]
+ local tooltip = soulSourceControl.tooltip
+ local souls = data.pantheons[god].souls
+ for i, soul in ipairs(souls) do
+ if soul.name == soulSourceControl.label then
+ tooltip:Clear()
+ local mods = { }
+
+ for _, mod in ipairs(soul.mods) do
+ table.insert(mods, mod.line)
+ end
+
+ tooltip:AddLine(20, '^8'..soul.name) --light grey
+ tooltip:AddLine(14, '^6'..table.concat(mods, '\n')) -- electric blue
+ tooltip:AddSeparator(10)
+ return
+ end
+ end
+ end
+end
+
local function banditTooltip(tooltip, mode, index, value)
local banditBenefits = {
["None"] = "Grants 2 Passive Skill Points",
@@ -184,38 +209,6 @@ return {
{ section = "General", col = 1 },
{ var = "resistancePenalty", type = "list", label = "Resistance penalty:", list = {{val=0,label="None"},{val=-30,label="Act 5 (-30%)"},{val=-60,label="Act 10
(-60%)"}}, defaultIndex = 3 },
{ var = "bandit", type = "list", label = "Bandit quest:", tooltipFunc = banditTooltip, list = {{val="None",label="Kill all"},{val="Oak",label="Help Oak"},{val
="Kraityn",label="Help Kraityn"},{val="Alira",label="Help Alira"}} },
- { var = "pantheonMajorGod", type = "list", label = "Major God:", tooltip = pantheonMajorGodTooltip, list = {
- { label = "Nothing", val = "None" },
- { label = "Soul of the Brine King", val = "TheBrineKing" },
- { label = "Soul of Lunaris", val = "Lunaris" },
- { label = "Soul of Solaris", val = "Solaris" },
- { label = "Soul of Arakaali", val = "Arakaali" },
- }, apply = function(val, modList, enemyModList, build)
- local god = data.pantheons[val] --nil if val == "None"
- for i=2, 4 do
- build.configTab.varControls["pantheonMajorGodSoul"..tostring(i-1)].shown = val ~= "None" --hide checkbox if "Nothing" is selected
- build.configTab.varControls["pantheonMajorGodSoul"..tostring(i-1)].label = god and god.souls[i].name or tostring(i-1) --soul name if god ~= nil
- end
- end },
- { var = "pantheonMajorGodSoul1", type = "check", label = "1", defaultState = true },
- { var = "pantheonMajorGodSoul2", type = "check", label = "2", defaultState = true },
- { var = "pantheonMajorGodSoul3", type = "check", label = "3", defaultState = true },
- { var = "pantheonMinorGod", type = "list", label = "Minor God:", tooltip = pantheonMinorGodTooltip, list = {
- { label = "Nothing", val = "None" },
- { label = "Soul of Gruthkul", val = "Gruthkul" },
- { label = "Soul of Yugul", val = "Yugul" },
- { label = "Soul of Abberath", val = "Abberath" },
- { label = "Soul of Tukohama", val = "Tukohama" },
- { label = "Soul of Garukhan", val = "Garukhan" },
- { label = "Soul of Ralakesh", val = "Ralakesh" },
- { label = "Soul of Ryslatha", val = "Ryslatha" },
- { label = "Soul of Shakari", val = "Shakari" },
- }, apply = function(val, modList, enemyModList, build)
- local god = data.pantheons[val]
- build.configTab.varControls["pantheonMinorGodSoul1"].shown = val ~= "None"
- build.configTab.varControls["pantheonMinorGodSoul1"].label = god and god.souls[2].name or '1'
- end },
- { var = "pantheonMinorGodSoul1", type = "check", label = "1", defaultState = true },
{ var = "detonateDeadCorpseLife", type = "count", label = "Enemy Corpse ^xE05030Life:", ifSkillData = "explodeCorpse", tooltip = "Sets the maximum ^xE05030lif
e ^7of the target corpse for Detonate Dead and similar skills.\nFor reference, a level 70 monster has "..data.monsterLifeTable[70].." base ^xE05030life^7, and a level
80 monster has "..data.monsterLifeTable[80]..".", apply = function(val, modList, enemyModList)
modList:NewMod("SkillData", "LIST", { key = "corpseLife", value = val }, "Config")
end },
@@ -307,6 +300,39 @@ return {
{ var = "overrideEmptyGreenSockets", type = "count", label = "# of Empty ^x70FF70Green^7 Sockets", ifMult = "EmptyGreenSocketsInAnySlot", tooltip = "This opti
on allows you to override the default calculation for the number of Empty ^x70FF70Green^7 Sockets.\nThe default calculation assumes enabled gems in skill socket group
s fill the item in socket order disregarding gem colour.\nLeave blank for default calculation." },
{ var = "overrideEmptyBlueSockets", type = "count", label = "# of Empty ^x7070FFBlue^7 Sockets", ifMult = "EmptyBlueSocketsInAnySlot", tooltip = "This option
allows you to override the default calculation for the number of Empty ^x7070FFBlue^7 Sockets.\nThe default calculation assumes enabled gems in skill socket groups fi
ll the item in socket order disregarding gem colour.\nLeave blank for default calculation." },
{ var = "overrideEmptyWhiteSockets", type = "count", label = "# of Empty White Sockets", ifMult = "EmptyWhiteSocketsInAnySlot", tooltip = "This option allows
you to override the default calculation for the number of Empty White Sockets.\nThe default calculation assumes enabled gems in skill socket groups fill the item in s
ocket order disregarding gem colour.\nLeave blank for default calculation." },
+ { label = "Pantheon Gods:" },
+ { var = "pantheonMajorGod", type = "list", label = "Major God:", tooltip = pantheonMajorGodTooltip, list = {
+ { label = "Nothing", val = "None" },
+ { label = "Soul of the Brine King", val = "TheBrineKing" },
+ { label = "Soul of Lunaris", val = "Lunaris" },
+ { label = "Soul of Solaris", val = "Solaris" },
+ { label = "Soul of Arakaali", val = "Arakaali" },
+ }, apply = function(val, modList, enemyModList, build)
+ local god = data.pantheons[val] --nil if val == "None"
+ for i=2, 4 do
+ build.configTab.varControls["pantheonMajorGodSoul"..tostring(i-1)].shown = val ~= "None" --hide checkbox if "Nothing" is selected
+ build.configTab.varControls["pantheonMajorGodSoul"..tostring(i-1)].label = god and god.souls[i].name or tostring(i-1) --soul name if god ~= nil
+ end
+ end },
+ { var = "pantheonMajorGodSoul1", type = "check", label = "1", defaultState = true, defualtHidden = true, tooltip = pantheonSoulToolTip("pantheonMajorGod", "pantheonMajorGodSoul1") },
+ { var = "pantheonMajorGodSoul2", type = "check", label = "2", defaultState = true, defualtHidden = true, tooltip = pantheonSoulToolTip("pantheonMajorGod", "pantheonMajorGodSoul2") },
+ { var = "pantheonMajorGodSoul3", type = "check", label = "3", defaultState = true, defualtHidden = true, tooltip = pantheonSoulToolTip("pantheonMajorGod", "pantheonMajorGodSoul3") },
+ { var = "pantheonMinorGod", type = "list", label = "Minor God:", tooltip = pantheonMinorGodTooltip, list = {
+ { label = "Nothing", val = "None" },
+ { label = "Soul of Gruthkul", val = "Gruthkul" },
+ { label = "Soul of Yugul", val = "Yugul" },
+ { label = "Soul of Abberath", val = "Abberath" },
+ { label = "Soul of Tukohama", val = "Tukohama" },
+ { label = "Soul of Garukhan", val = "Garukhan" },
+ { label = "Soul of Ralakesh", val = "Ralakesh" },
+ { label = "Soul of Ryslatha", val = "Ryslatha" },
+ { label = "Soul of Shakari", val = "Shakari" },
+ }, apply = function(val, modList, enemyModList, build)
+ local god = data.pantheons[val]
+ build.configTab.varControls["pantheonMinorGodSoul1"].shown = val ~= "None"
+ build.configTab.varControls["pantheonMinorGodSoul1"].label = god and god.souls[2].name or '1'
+ end },
+ { var = "pantheonMinorGodSoul1", type = "check", label = "1", defaultState = true, defualtHidden = true, tooltip = pantheonSoulToolTip("pantheonMinorGod", "pantheonMinorGodSoul1") },
-- Section: Skill-specific options
{ section = "Skill Options", col = 2 },
The options were not hidden by default because the apply function only runs when you change the selection of the god. Also added tooltip for each option and moved it lower to separate pantheon settings from rest of the general settings slightly.
Fix for the shown crash:
diff --git a/src/Classes/ConfigTab.lua b/src/Classes/ConfigTab.lua
index 93b9313d..01075552 100644
--- a/src/Classes/ConfigTab.lua
+++ b/src/Classes/ConfigTab.lua
@@ -215,6 +215,9 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont
t_insert(tooltipFuncs, varData.tooltip)
end
+ if varData.defaultHidden then
+ control.shown = false
+ end
if varData.ifNode then
t_insert(shownFuncs, listOrSingleIfOption(varData.ifNode, function(ifOption)
if self.build.spec.allocNodes[ifOption] then
@@ -519,7 +522,12 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont
local innerShown = control.shown
if not varData.doNotHighlight then
control.borderFunc = function()
- local shown = type(innerShown) == "boolean" and innerShown or innerShown()
+ local shown
+ if type(innerShown) == "function" then
+ shown = innerShown()
+ else
+ shown = innerShown
+ end
local cur = self.input[varData.var]
local def = self:GetDefaultState(varData.var, type(cur))
if cur ~= nil and cur ~= def then
@@ -537,14 +545,24 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont
if not searchMatch(varData) then
return false
end
- local shown = type(innerShown) == "boolean" and innerShown or innerShown()
+ local shown
+ if type(innerShown) == "function" then
+ shown = innerShown()
+ else
+ shown = innerShown
+ end
local cur = self.input[varData.var]
local def = self:GetDefaultState(varData.var, type(cur))
return not shown and cur ~= nil and cur ~= def or shown
end
local innerLabel = labelControl.label
labelControl.label = function()
- local shown = type(innerShown) == "boolean" and innerShown or innerShown()
+ local shown
+ if type(innerShown) == "function" then
+ shown = innerShown()
+ else
+ shown = innerShown
+ end
local cur = self.input[varData.var]
local def = self:GetDefaultState(varData.var, type(cur))
if not shown and cur ~= nil and cur ~= def then
@@ -565,7 +583,12 @@ local ConfigTabClass = newClass("ConfigTab", "UndoHandler", "ControlHost", "Cont
end
end
- local shown = type(innerShown) == "boolean" and innerShown or innerShown()
+ local shown
+ if type(innerShown) == "function" then
+ shown = innerShown()
+ else
+ shown = innerShown
+ end
local cur = self.input[varData.var]
local def = self:GetDefaultState(varData.var, type(cur))
if not shown and cur ~= nil and cur ~= def then
diff --git a/src/Modules/ConfigOptions.lua b/src/Modules/ConfigOptions.lua
index 0b838c88..a30e5add 100644
--- a/src/Modules/ConfigOptions.lua
+++ b/src/Modules/ConfigOptions.lua
@@ -197,9 +197,9 @@ return {
build.configTab.varControls["pantheonMajorGodSoul"..tostring(i-1)].label = god and god.souls[i].name or tostring(i-1) --soul name if god ~= nil
end
end },
- { var = "pantheonMajorGodSoul1", type = "check", label = "1", defaultState = true },
- { var = "pantheonMajorGodSoul2", type = "check", label = "2", defaultState = true },
- { var = "pantheonMajorGodSoul3", type = "check", label = "3", defaultState = true },
+ { var = "pantheonMajorGodSoul1", type = "check", label = "1", defaultState = true, defaultHidden = true },
+ { var = "pantheonMajorGodSoul2", type = "check", label = "2", defaultState = true, defaultHidden = true },
+ { var = "pantheonMajorGodSoul3", type = "check", label = "3", defaultState = true, defaultHidden = true },
{ var = "pantheonMinorGod", type = "list", label = "Minor God:", tooltip = pantheonMinorGodTooltip, list = {
{ label = "Nothing", val = "None" },
{ label = "Soul of Gruthkul", val = "Gruthkul" },
@@ -215,7 +215,7 @@ return {
build.configTab.varControls["pantheonMinorGodSoul1"].shown = val ~= "None"
build.configTab.varControls["pantheonMinorGodSoul1"].label = god and god.souls[2].name or '1'
end },
- { var = "pantheonMinorGodSoul1", type = "check", label = "1", defaultState = true },
+ { var = "pantheonMinorGodSoul1", type = "check", label = "1", defaultState = true, defaultHidden = true },
{ var = "detonateDeadCorpseLife", type = "count", label = "Enemy Corpse ^xE05030Life:", ifSkillData = "explodeCorpse", tooltip = "Sets the maximum ^xE05030life ^7of the target corpse for Detonate Dead and similar skills.\nFor reference, a level 70 monster has "..data.monsterLifeTable[70].." base ^xE05030life^7, and a level 80 monster has "..data.monsterLifeTable[80]..".", apply = function(val, modList, enemyModList)
modList:NewMod("SkillData", "LIST", { key = "corpseLife", value = val }, "Config")
end },
].name or '1'
end },
- { var = "pantheonMinorGodSoul1", type = "check", label = "1", defaultState = true },
+ { var = "pantheonMinorGodSoul1", type = "check", label = "1", defaultState = true, defaultHidden = true },
{ var = "detonateDeadCorpseLife", type = "count", label = "Enemy Corpse ^xE05030Life:", ifSkillData = "explodeCorpse", tooltip = "Sets the maximum ^xE05030life ^7of the target corpse for Detonate Dead and similar skills.\nFor reference, a level 70 monster has "..data.monsterLifeTable[70].." base ^xE05030life^7, and a level 80 monster has "..data.monsterLifeTable[80]..".", apply = function(val, modList, enemyModList)
modList:NewMod("SkillData", "LIST", { key = "corpseLife", value = val }, "Config")
end },
Tooltip update code for when it's dropped down:
diff --git a/src/Modules/ConfigOptions.lua b/src/Modules/ConfigOptions.lua
index d72587f7..5072dadc 100644
--- a/src/Modules/ConfigOptions.lua
+++ b/src/Modules/ConfigOptions.lua
@@ -30,7 +30,6 @@ local function applyPantheonDescription(tooltip, mode, index, value)
end
local function pantheonTooltip(modList, build, selectedGod, selectedSouls, tooltip)
- tooltip:Clear()
local souls = data.pantheons[selectedGod].souls
for i, soul in ipairs(souls) do
local name = soul.name
@@ -53,29 +52,46 @@ end
local function pantheonMajorGodTooltip(modList, build)
local input = build.configTab.input
- local majorGod = input.pantheonMajorGod
- if majorGod ~= "None" then --tooltip not generated if god is not selected
+ local majorGodControl = build.configTab.varControls.pantheonMajorGod
+ local mOver, mOverComp = majorGodControl:IsMouseOver()
+ local index
+ if mOver and mOverComp ~= "DROP" then
+ index = majorGodControl.selIndex
+ elseif mOver and majorGodControl.dropped and majorGodControl.hoverSel then
+ index = majorGodControl.hoverSel
+ end
+ local majorGod = majorGodControl.list[index]
+ majorGodControl.tooltip:Clear()
+ if majorGod and majorGod.val ~= "None" then --tooltip not generated if god is not selected
local majorGodSouls = { --table containing selected souls checkboxes state (booleans)
true, --forcing to true the major god, since it has been selected for sure (make pantheonTooltip cleaner)
input.pantheonMajorGodSoul1,
input.pantheonMajorGodSoul2,
input.pantheonMajorGodSoul3
}
- local majorGodTooltip = build.configTab.varControls.pantheonMajorGod.tooltip
- pantheonTooltip(modList, build, majorGod, majorGodSouls, majorGodTooltip)
+ pantheonTooltip(modList, build, majorGod.val, majorGodSouls, majorGodControl.tooltip)
end
end
local function pantheonMinorGodTooltip(modList, build)
local input = build.configTab.input
- local minorGod = input.pantheonMinorGod
- if minorGod ~= "None" then
+ local minorGodControl = build.configTab.varControls.pantheonMinorGod
+ local mOver, mOverComp = minorGodControl:IsMouseOver()
+ local index
+ if mOver and mOverComp ~= "DROP" then
+ index = minorGodControl.selIndex
+ elseif mOver and minorGodControl.dropped and minorGodControl.hoverSel then
+ index = minorGodControl.hoverSel
+ end
+ local minorGod = minorGodControl.list[index]
+ minorGodControl.tooltip:Clear()
+ if minorGod and minorGod.val ~= "None" then --tooltip not generated if god is not selected
local minorGodSouls = {
true,
input.pantheonMinorGodSoul1
}
local minorGodTooltip = build.configTab.varControls.pantheonMinorGod.tooltip
- pantheonTooltip(modList, build, minorGod, minorGodSouls, minorGodTooltip)
+ pantheonTooltip(modList, build, minorGod.val, minorGodSouls, minorGodTooltip)
end
end