Skip to content

Commit 9b58355

Browse files
committed
Guess the main socket group based on DPS instead of number of gems
1 parent 1ecc3df commit 9b58355

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/Classes/ImportTab.lua

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,11 @@ function ImportTabClass:ImportItemsAndSkills(charData)
824824
end)
825825
end
826826
if mainSkillEmpty then
827-
self.build.mainSocketGroup = self:GuessMainSocketGroup()
827+
local mainSocketGroup = self:GuessMainSocketGroup()
828+
self.build.mainSocketGroup = mainSocketGroup
829+
if mainSocketGroup ~= nil then
830+
self.build.skillsTab.socketGroupList[mainSocketGroup].includeInFullDPS = true
831+
end
828832
end
829833
self.build.itemsTab:PopulateSlots()
830834
self.build.itemsTab:AddUndoState()
@@ -1111,17 +1115,22 @@ function ImportTabClass:ImportSocketedItems(item, socketedItems, slotName)
11111115
end
11121116
end
11131117

1114-
-- Return the index of the group with the most gems
1118+
-- Return the index of the group with the most DPS
11151119
function ImportTabClass:GuessMainSocketGroup()
1116-
local largestGroupSize = 0
1117-
local largestGroupIndex = 1
1118-
for i, socketGroup in ipairs(self.build.skillsTab.socketGroupList) do
1119-
if #socketGroup.gemList > largestGroupSize then
1120-
largestGroupSize = #socketGroup.gemList
1121-
largestGroupIndex = i
1120+
local bestDps = 0
1121+
local bestSocketGroup = nil
1122+
for i, socketGroup in pairs(self.build.skillsTab.socketGroupList) do
1123+
self.build.mainSocketGroup = i
1124+
socketGroup.includeInFullDPS = true
1125+
local mainOutput = self.build.calcsTab.calcs.buildOutput(self.build, "MAIN").player.output
1126+
socketGroup.includeInFullDPS = false
1127+
local dps = mainOutput.FullDPS
1128+
if dps > bestDps then
1129+
bestDps = dps
1130+
bestSocketGroup = i
11221131
end
11231132
end
1124-
return largestGroupIndex
1133+
return bestSocketGroup
11251134
end
11261135

11271136
function HexToChar(x)

0 commit comments

Comments
 (0)