Skip to content

Commit c2e8a97

Browse files
authored
move EstimatePlayerProgress call to on buildFlag instead of onFrame (PathOfBuildingCommunity#1972)
1 parent cc69353 commit c2e8a97

1 file changed

Lines changed: 72 additions & 70 deletions

File tree

src/Modules/Build.lua

Lines changed: 72 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin
172172
end
173173
self.controls.pointDisplay = new("Control", {"LEFT",self.anchorTopBarRight,"RIGHT"}, {function() return getPointDisplayX() end, 0, 0, 20})
174174
self.controls.pointDisplay.width = function(control)
175-
control.str, control.req = self:EstimatePlayerProgress()
176175
return DrawStringWidth(16, "FIXED", control.str) + 8
177176
end
178177
self.controls.pointDisplay.Draw = function(control)
@@ -831,78 +830,80 @@ function buildMode:SyncLoadouts()
831830
end
832831

833832
function buildMode:EstimatePlayerProgress()
834-
local PointsUsed, AscUsed, SecondaryAscUsed, socketsUsed, weaponSet1Used, weaponSet2Used = self.spec:CountAllocNodes()
835-
local extra = self.calcsTab.mainOutput and self.calcsTab.mainOutput.ExtraPoints or 0
836-
local maxWeaponSets = self.maxWeaponSets
837-
local extraWeaponSets = self.calcsTab.mainOutput and self.calcsTab.mainOutput.PassivePointsToWeaponSetPoints or 0
838-
local usedMax, ascMax, secondaryAscMax, level, act = 99 + maxWeaponSets + extra, 8, 8, 1, 0
839-
840-
repeat
841-
act = act + 1
842-
level = m_min(m_max(PointsUsed + 1 - self.acts[act].questPoints - extra - m_min(weaponSet1Used, weaponSet2Used), self.acts[act].level), 100)
843-
until act == self.maxActs or level <= self.acts[act + 1].level
844-
845-
if self.characterLevelAutoMode and self.characterLevel ~= level then
846-
self.characterLevel = level
847-
self.controls.characterLevel:SetText(self.characterLevel)
848-
self.configTab:BuildModList()
849-
end
850-
851-
-- Ascendancy points for lab
852-
-- this is a recommendation for beginners who are using Path of Building for the first time and trying to map out progress in PoB
853-
local labSuggest = level < 33 and ""
854-
or level < 55 and "\nLabyrinth: Normal Lab"
855-
or level < 68 and "\nLabyrinth: Cruel Lab"
856-
or level < 75 and "\nLabyrinth: Merciless Lab"
857-
or level < 90 and "\nLabyrinth: Uber Lab"
858-
or ""
859-
860-
local normalPassives = PointsUsed - m_min(weaponSet1Used, weaponSet2Used)
861-
if normalPassives > usedMax then InsertIfNew(self.controls.warnings.lines, "You have too many passive points allocated") end
862-
if AscUsed > ascMax then InsertIfNew(self.controls.warnings.lines, "You have too many ascendancy points allocated") end
863-
if SecondaryAscUsed > secondaryAscMax then InsertIfNew(self.controls.warnings.lines, "You have too many secondary ascendancy points allocated") end
864-
865-
-- if you are using more than maxWeaponSets + extraWeaponSets, you are using too many weapon sets
866-
local warningsWeaponSet = false
867-
if weaponSet1Used > (maxWeaponSets + extraWeaponSets) then
868-
warningsWeaponSet = true
869-
InsertIfNew(self.controls.warnings.lines, string.format(
870-
"You have allocated %d too many weapon set 1 passives",
871-
math.abs((maxWeaponSets + extraWeaponSets) - weaponSet1Used)
872-
))
873-
end
874-
if weaponSet2Used > (maxWeaponSets + extraWeaponSets) then
875-
warningsWeaponSet = true
876-
InsertIfNew(self.controls.warnings.lines, string.format(
877-
"You have allocated %d too many weapon set 2 passives",
878-
math.abs((maxWeaponSets + extraWeaponSets) - weaponSet2Used)
879-
))
880-
end
881-
882-
if not warningsWeaponSet and weaponSet1Used ~= weaponSet2Used then
883-
InsertIfNew(self.controls.warnings.lines, string.format(
884-
"You have %d Weapon set 2 passives available",
885-
math.abs(weaponSet2Used - weaponSet1Used)
886-
))
887-
end
888-
889-
self.Act = act == self.maxActs and "Endgame" or "Act " .. act
890-
891-
return string.format(
892-
"%s%3d / %3d %s%2d / %2d %s%2d / %2d %s%d / %d",
893-
normalPassives > usedMax and colorCodes.NEGATIVE or "^7",
894-
normalPassives, usedMax,
895-
colorCodes.NEGATIVE,
896-
weaponSet1Used, maxWeaponSets + extraWeaponSets,
897-
colorCodes.POSITIVE,
898-
weaponSet2Used, maxWeaponSets + extraWeaponSets,
899-
AscUsed > ascMax and colorCodes.NEGATIVE or "^7",
900-
AscUsed, ascMax
901-
),
902-
string.format(
833+
if self.spec then
834+
local PointsUsed, AscUsed, SecondaryAscUsed, socketsUsed, weaponSet1Used, weaponSet2Used = self.spec:CountAllocNodes()
835+
local extra = self.calcsTab.mainOutput and self.calcsTab.mainOutput.ExtraPoints or 0
836+
local maxWeaponSets = self.maxWeaponSets
837+
local extraWeaponSets = self.calcsTab.mainOutput and self.calcsTab.mainOutput.PassivePointsToWeaponSetPoints or 0
838+
local usedMax, ascMax, secondaryAscMax, level, act = 99 + maxWeaponSets + extra, 8, 8, 1, 0
839+
840+
repeat
841+
act = act + 1
842+
level = m_min(m_max(PointsUsed + 1 - self.acts[act].questPoints - extra - m_min(weaponSet1Used, weaponSet2Used), self.acts[act].level), 100)
843+
until act == self.maxActs or level <= self.acts[act + 1].level
844+
845+
if self.characterLevelAutoMode and self.characterLevel ~= level then
846+
self.characterLevel = level
847+
self.controls.characterLevel:SetText(self.characterLevel)
848+
self.configTab:BuildModList()
849+
end
850+
851+
-- Ascendancy points for lab
852+
-- this is a recommendation for beginners who are using Path of Building for the first time and trying to map out progress in PoB
853+
local labSuggest = level < 33 and ""
854+
or level < 55 and "\nLabyrinth: Normal Lab"
855+
or level < 68 and "\nLabyrinth: Cruel Lab"
856+
or level < 75 and "\nLabyrinth: Merciless Lab"
857+
or level < 90 and "\nLabyrinth: Uber Lab"
858+
or ""
859+
860+
local normalPassives = PointsUsed - m_min(weaponSet1Used, weaponSet2Used)
861+
if normalPassives > usedMax then InsertIfNew(self.controls.warnings.lines, "You have too many passive points allocated") end
862+
if AscUsed > ascMax then InsertIfNew(self.controls.warnings.lines, "You have too many ascendancy points allocated") end
863+
if SecondaryAscUsed > secondaryAscMax then InsertIfNew(self.controls.warnings.lines, "You have too many secondary ascendancy points allocated") end
864+
865+
-- if you are using more than maxWeaponSets + extraWeaponSets, you are using too many weapon sets
866+
local warningsWeaponSet = false
867+
if weaponSet1Used > (maxWeaponSets + extraWeaponSets) then
868+
warningsWeaponSet = true
869+
InsertIfNew(self.controls.warnings.lines, string.format(
870+
"You have allocated %d too many weapon set 1 passives",
871+
math.abs((maxWeaponSets + extraWeaponSets) - weaponSet1Used)
872+
))
873+
end
874+
if weaponSet2Used > (maxWeaponSets + extraWeaponSets) then
875+
warningsWeaponSet = true
876+
InsertIfNew(self.controls.warnings.lines, string.format(
877+
"You have allocated %d too many weapon set 2 passives",
878+
math.abs((maxWeaponSets + extraWeaponSets) - weaponSet2Used)
879+
))
880+
end
881+
882+
if not warningsWeaponSet and weaponSet1Used ~= weaponSet2Used then
883+
InsertIfNew(self.controls.warnings.lines, string.format(
884+
"You have %d Weapon set 2 passives available",
885+
math.abs(weaponSet2Used - weaponSet1Used)
886+
))
887+
end
888+
889+
self.Act = act == self.maxActs and "Endgame" or "Act " .. act
890+
891+
self.controls.pointDisplay.str = string.format(
892+
"%s%3d / %3d %s%2d / %2d %s%2d / %2d %s%d / %d",
893+
normalPassives > usedMax and colorCodes.NEGATIVE or "^7",
894+
normalPassives, usedMax,
895+
colorCodes.NEGATIVE,
896+
weaponSet1Used, maxWeaponSets + extraWeaponSets,
897+
colorCodes.POSITIVE,
898+
weaponSet2Used, maxWeaponSets + extraWeaponSets,
899+
AscUsed > ascMax and colorCodes.NEGATIVE or "^7",
900+
AscUsed, ascMax
901+
)
902+
self.controls.pointDisplay.req = string.format(
903903
"Required Level: %d\nEstimated Progress:\nAct: %s\nExtra Skillpoints: %d%s",
904904
level, self.Act, extra, labSuggest
905905
)
906+
end
906907
end
907908

908909
function buildMode:CanExit(mode)
@@ -2078,6 +2079,7 @@ function buildMode:RefreshStatList()
20782079
end
20792080
self:AddDisplayStatList(self.displayStats, self.calcsTab.mainEnv.player)
20802081
self:InsertItemWarnings()
2082+
self:EstimatePlayerProgress()
20812083
end
20822084

20832085
function buildMode:CompareStatList(tooltip, statList, actor, baseOutput, compareOutput, header, nodeCount)

0 commit comments

Comments
 (0)