Skip to content

Commit e08c9ce

Browse files
committed
Guess the main socket group based on DPS instead of number of gems
1 parent 6c654d1 commit e08c9ce

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
@@ -827,7 +827,11 @@ function ImportTabClass:ImportItemsAndSkills(charData)
827827
end)
828828
end
829829
if mainSkillEmpty then
830-
self.build.mainSocketGroup = self:GuessMainSocketGroup()
830+
local mainSocketGroup = self:GuessMainSocketGroup()
831+
self.build.mainSocketGroup = mainSocketGroup
832+
if mainSocketGroup ~= nil then
833+
self.build.skillsTab.socketGroupList[mainSocketGroup].includeInFullDPS = true
834+
end
831835
end
832836
self.build.itemsTab:PopulateSlots()
833837
self.build.itemsTab:AddUndoState()
@@ -1114,17 +1118,22 @@ function ImportTabClass:ImportSocketedItems(item, socketedItems, slotName)
11141118
end
11151119
end
11161120

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

11301139
function HexToChar(x)

0 commit comments

Comments
 (0)