@@ -669,16 +669,18 @@ function ImportTabClass:ImportItem(itemData, slotName)
669669 item .explicitModLines = { }
670670 if itemData .enchantMods then
671671 for _ , line in ipairs (itemData .enchantMods ) do
672- line = line :gsub (" \n " ," " )
673- local modList , extra = modLib .parseMod [self .build .targetVersion ](line )
674- t_insert (item .enchantModLines , { line = line , extra = extra , mods = modList or { }, crafted = true })
672+ for line in line :gmatch (" [^\n ]+" ) do
673+ local modList , extra = modLib .parseMod [self .build .targetVersion ](line )
674+ t_insert (item .enchantModLines , { line = line , extra = extra , mods = modList or { }, crafted = true })
675+ end
675676 end
676677 end
677678 if itemData .implicitMods then
678679 for _ , line in ipairs (itemData .implicitMods ) do
679- line = line :gsub (" \n " ," " )
680- local modList , extra = modLib .parseMod [self .build .targetVersion ](line )
681- t_insert (item .implicitModLines , { line = line , extra = extra , mods = modList or { } })
680+ for line in line :gmatch (" [^\n ]+" ) do
681+ local modList , extra = modLib .parseMod [self .build .targetVersion ](line )
682+ t_insert (item .implicitModLines , { line = line , extra = extra , mods = modList or { } })
683+ end
682684 end
683685 end
684686 if itemData .fracturedMods then
@@ -739,26 +741,34 @@ function ImportTabClass:ImportSocketedItems(item, socketedItems, slotName)
739741 self :ImportItem (socketedItem , slotName .. " Abyssal Socket " .. abyssalSocketId )
740742 abyssalSocketId = abyssalSocketId + 1
741743 else
742- local gemInstance = { level = 20 , quality = 0 , enabled = true , enableGlobal1 = true }
743- gemInstance .nameSpec = socketedItem .typeLine :gsub (" Support" ," " )
744- gemInstance .support = socketedItem .support
745- for _ , property in pairs (socketedItem .properties ) do
746- if property .name == " Level" then
747- gemInstance .level = tonumber (property .values [1 ][1 ]:match (" %d+" ))
748- elseif property .name == " Quality" then
749- gemInstance .quality = tonumber (property .values [1 ][1 ]:match (" %d+" ))
750- end
744+ local gemId = self .build .data .gemForBaseName [socketedItem .typeLine ]
745+ if not gemId and socketedItem .hybrid then
746+ -- Dual skill gems (currently just Stormbind) show the second skill as the typeLine, which won't match the actual gem
747+ -- Luckily the primary skill name is also there, so we can find the gem using that
748+ gemId = self .build .data .gemForBaseName [socketedItem .hybrid .baseTypeName ]
751749 end
752- local groupID = item .sockets [socketedItem .socket + 1 ].group
753- if not itemSocketGroupList [groupID ] then
754- itemSocketGroupList [groupID ] = { label = " " , enabled = true , gemList = { }, slot = slotName }
755- end
756- local socketGroup = itemSocketGroupList [groupID ]
757- if not socketedItem .support and socketGroup .gemList [1 ] and socketGroup .gemList [1 ].support then
758- -- If the first gemInstance is a support gemInstance, put the first active gemInstance before it
759- t_insert (socketGroup .gemList , 1 , gemInstance )
760- else
761- t_insert (socketGroup .gemList , gemInstance )
750+ if gemId then
751+ local gemInstance = { level = 20 , quality = 0 , enabled = true , enableGlobal1 = true , gemId = gemId }
752+ gemInstance .nameSpec = self .build .data .gems [gemId ].name
753+ gemInstance .support = socketedItem .support
754+ for _ , property in pairs (socketedItem .properties ) do
755+ if property .name == " Level" then
756+ gemInstance .level = tonumber (property .values [1 ][1 ]:match (" %d+" ))
757+ elseif property .name == " Quality" then
758+ gemInstance .quality = tonumber (property .values [1 ][1 ]:match (" %d+" ))
759+ end
760+ end
761+ local groupID = item .sockets [socketedItem .socket + 1 ].group
762+ if not itemSocketGroupList [groupID ] then
763+ itemSocketGroupList [groupID ] = { label = " " , enabled = true , gemList = { }, slot = slotName }
764+ end
765+ local socketGroup = itemSocketGroupList [groupID ]
766+ if not socketedItem .support and socketGroup .gemList [1 ] and socketGroup .gemList [1 ].support then
767+ -- If the first gemInstance is a support gemInstance, put the first active gemInstance before it
768+ t_insert (socketGroup .gemList , 1 , gemInstance )
769+ else
770+ t_insert (socketGroup .gemList , gemInstance )
771+ end
762772 end
763773 end
764774 end
0 commit comments