diff --git a/src/Modules/Build.lua b/src/Modules/Build.lua index 62f51783bc..d7e124cb5c 100644 --- a/src/Modules/Build.lua +++ b/src/Modules/Build.lua @@ -172,7 +172,6 @@ function buildMode:Init(dbFileName, buildName, buildXML, convertBuild, importLin end self.controls.pointDisplay = new("Control", {"LEFT",self.anchorTopBarRight,"RIGHT"}, {function() return getPointDisplayX() end, 0, 0, 20}) self.controls.pointDisplay.width = function(control) - control.str, control.req = self:EstimatePlayerProgress() return DrawStringWidth(16, "FIXED", control.str) + 8 end self.controls.pointDisplay.Draw = function(control) @@ -831,78 +830,80 @@ function buildMode:SyncLoadouts() end function buildMode:EstimatePlayerProgress() - local PointsUsed, AscUsed, SecondaryAscUsed, socketsUsed, weaponSet1Used, weaponSet2Used = self.spec:CountAllocNodes() - local extra = self.calcsTab.mainOutput and self.calcsTab.mainOutput.ExtraPoints or 0 - local maxWeaponSets = self.maxWeaponSets - local extraWeaponSets = self.calcsTab.mainOutput and self.calcsTab.mainOutput.PassivePointsToWeaponSetPoints or 0 - local usedMax, ascMax, secondaryAscMax, level, act = 99 + maxWeaponSets + extra, 8, 8, 1, 0 - - repeat - act = act + 1 - level = m_min(m_max(PointsUsed + 1 - self.acts[act].questPoints - extra - m_min(weaponSet1Used, weaponSet2Used), self.acts[act].level), 100) - until act == self.maxActs or level <= self.acts[act + 1].level - - if self.characterLevelAutoMode and self.characterLevel ~= level then - self.characterLevel = level - self.controls.characterLevel:SetText(self.characterLevel) - self.configTab:BuildModList() - end - - -- Ascendancy points for lab - -- this is a recommendation for beginners who are using Path of Building for the first time and trying to map out progress in PoB - local labSuggest = level < 33 and "" - or level < 55 and "\nLabyrinth: Normal Lab" - or level < 68 and "\nLabyrinth: Cruel Lab" - or level < 75 and "\nLabyrinth: Merciless Lab" - or level < 90 and "\nLabyrinth: Uber Lab" - or "" - - local normalPassives = PointsUsed - m_min(weaponSet1Used, weaponSet2Used) - if normalPassives > usedMax then InsertIfNew(self.controls.warnings.lines, "You have too many passive points allocated") end - if AscUsed > ascMax then InsertIfNew(self.controls.warnings.lines, "You have too many ascendancy points allocated") end - if SecondaryAscUsed > secondaryAscMax then InsertIfNew(self.controls.warnings.lines, "You have too many secondary ascendancy points allocated") end - - -- if you are using more than maxWeaponSets + extraWeaponSets, you are using too many weapon sets - local warningsWeaponSet = false - if weaponSet1Used > (maxWeaponSets + extraWeaponSets) then - warningsWeaponSet = true - InsertIfNew(self.controls.warnings.lines, string.format( - "You have allocated %d too many weapon set 1 passives", - math.abs((maxWeaponSets + extraWeaponSets) - weaponSet1Used) - )) - end - if weaponSet2Used > (maxWeaponSets + extraWeaponSets) then - warningsWeaponSet = true - InsertIfNew(self.controls.warnings.lines, string.format( - "You have allocated %d too many weapon set 2 passives", - math.abs((maxWeaponSets + extraWeaponSets) - weaponSet2Used) - )) - end - - if not warningsWeaponSet and weaponSet1Used ~= weaponSet2Used then - InsertIfNew(self.controls.warnings.lines, string.format( - "You have %d Weapon set 2 passives available", - math.abs(weaponSet2Used - weaponSet1Used) - )) - end - - self.Act = act == self.maxActs and "Endgame" or "Act " .. act - - return string.format( - "%s%3d / %3d %s%2d / %2d %s%2d / %2d %s%d / %d", - normalPassives > usedMax and colorCodes.NEGATIVE or "^7", - normalPassives, usedMax, - colorCodes.NEGATIVE, - weaponSet1Used, maxWeaponSets + extraWeaponSets, - colorCodes.POSITIVE, - weaponSet2Used, maxWeaponSets + extraWeaponSets, - AscUsed > ascMax and colorCodes.NEGATIVE or "^7", - AscUsed, ascMax - ), - string.format( + if self.spec then + local PointsUsed, AscUsed, SecondaryAscUsed, socketsUsed, weaponSet1Used, weaponSet2Used = self.spec:CountAllocNodes() + local extra = self.calcsTab.mainOutput and self.calcsTab.mainOutput.ExtraPoints or 0 + local maxWeaponSets = self.maxWeaponSets + local extraWeaponSets = self.calcsTab.mainOutput and self.calcsTab.mainOutput.PassivePointsToWeaponSetPoints or 0 + local usedMax, ascMax, secondaryAscMax, level, act = 99 + maxWeaponSets + extra, 8, 8, 1, 0 + + repeat + act = act + 1 + level = m_min(m_max(PointsUsed + 1 - self.acts[act].questPoints - extra - m_min(weaponSet1Used, weaponSet2Used), self.acts[act].level), 100) + until act == self.maxActs or level <= self.acts[act + 1].level + + if self.characterLevelAutoMode and self.characterLevel ~= level then + self.characterLevel = level + self.controls.characterLevel:SetText(self.characterLevel) + self.configTab:BuildModList() + end + + -- Ascendancy points for lab + -- this is a recommendation for beginners who are using Path of Building for the first time and trying to map out progress in PoB + local labSuggest = level < 33 and "" + or level < 55 and "\nLabyrinth: Normal Lab" + or level < 68 and "\nLabyrinth: Cruel Lab" + or level < 75 and "\nLabyrinth: Merciless Lab" + or level < 90 and "\nLabyrinth: Uber Lab" + or "" + + local normalPassives = PointsUsed - m_min(weaponSet1Used, weaponSet2Used) + if normalPassives > usedMax then InsertIfNew(self.controls.warnings.lines, "You have too many passive points allocated") end + if AscUsed > ascMax then InsertIfNew(self.controls.warnings.lines, "You have too many ascendancy points allocated") end + if SecondaryAscUsed > secondaryAscMax then InsertIfNew(self.controls.warnings.lines, "You have too many secondary ascendancy points allocated") end + + -- if you are using more than maxWeaponSets + extraWeaponSets, you are using too many weapon sets + local warningsWeaponSet = false + if weaponSet1Used > (maxWeaponSets + extraWeaponSets) then + warningsWeaponSet = true + InsertIfNew(self.controls.warnings.lines, string.format( + "You have allocated %d too many weapon set 1 passives", + math.abs((maxWeaponSets + extraWeaponSets) - weaponSet1Used) + )) + end + if weaponSet2Used > (maxWeaponSets + extraWeaponSets) then + warningsWeaponSet = true + InsertIfNew(self.controls.warnings.lines, string.format( + "You have allocated %d too many weapon set 2 passives", + math.abs((maxWeaponSets + extraWeaponSets) - weaponSet2Used) + )) + end + + if not warningsWeaponSet and weaponSet1Used ~= weaponSet2Used then + InsertIfNew(self.controls.warnings.lines, string.format( + "You have %d Weapon set 2 passives available", + math.abs(weaponSet2Used - weaponSet1Used) + )) + end + + self.Act = act == self.maxActs and "Endgame" or "Act " .. act + + self.controls.pointDisplay.str = string.format( + "%s%3d / %3d %s%2d / %2d %s%2d / %2d %s%d / %d", + normalPassives > usedMax and colorCodes.NEGATIVE or "^7", + normalPassives, usedMax, + colorCodes.NEGATIVE, + weaponSet1Used, maxWeaponSets + extraWeaponSets, + colorCodes.POSITIVE, + weaponSet2Used, maxWeaponSets + extraWeaponSets, + AscUsed > ascMax and colorCodes.NEGATIVE or "^7", + AscUsed, ascMax + ) + self.controls.pointDisplay.req = string.format( "Required Level: %d\nEstimated Progress:\nAct: %s\nExtra Skillpoints: %d%s", level, self.Act, extra, labSuggest ) + end end function buildMode:CanExit(mode) @@ -2078,6 +2079,7 @@ function buildMode:RefreshStatList() end self:AddDisplayStatList(self.displayStats, self.calcsTab.mainEnv.player) self:InsertItemWarnings() + self:EstimatePlayerProgress() end function buildMode:CompareStatList(tooltip, statList, actor, baseOutput, compareOutput, header, nodeCount)