@@ -1014,6 +1014,18 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
10141014 if self .base then
10151015 if self .base .weapon or self .base .armour or self .base .tags .wand or self .base .tags .staff or self .base .tags .sceptre then
10161016 local shouldFixRunesOnItem = # self .runes == 0
1017+ if not shouldFixRunesOnItem and # self .runeModLines > 0 then
1018+ local canRebuildRunes = true
1019+ for _ , rune in ipairs (self .runes ) do
1020+ if rune ~= " None" and not data .itemMods .Runes [rune ] then
1021+ canRebuildRunes = false
1022+ break
1023+ end
1024+ end
1025+ if canRebuildRunes then
1026+ self :UpdateRunes ()
1027+ end
1028+ end
10171029
10181030 local function getRuneLineParts (modLine )
10191031 local values = { }
@@ -1105,17 +1117,17 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11051117 local broadItemType = self .base .weapon and " weapon" or (self .base .tags .wand or self .base .tags .staff ) and " caster" or " armour" -- minor optimisation
11061118 local specificItemType = self .base .type :lower ()
11071119 for runeName , runeMods in pairs (data .itemMods .Runes ) do
1108- local addModToGroupedRunes = function (modLine )
1120+ local addModToGroupedRunes = function (modLine , augmentType )
11091121 local runeStrippedModLine , runeValues = getRuneLineParts (modLine )
11101122 if statGroupedRunes [runeStrippedModLine ] == nil then
11111123 statGroupedRunes [runeStrippedModLine ] = { }
11121124 end
1113- t_insert (statGroupedRunes [runeStrippedModLine ], { name = runeName , values = runeValues })
1125+ t_insert (statGroupedRunes [runeStrippedModLine ], { name = runeName , type = augmentType , values = runeValues })
11141126 end
11151127 for slotType , slotMod in pairs (runeMods ) do
11161128 if slotType == broadItemType or slotType == specificItemType then
11171129 for _ , mod in ipairs (slotMod ) do
1118- addModToGroupedRunes (mod )
1130+ addModToGroupedRunes (mod , slotMod . type )
11191131 end
11201132 end
11211133 end
@@ -1137,7 +1149,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11371149 remainingRunes = remainingRunes - numRunes
11381150 -- this code should probably be refactored to based off stored self.runes rather than the recomputed amounts off the runeModLines this
11391151 -- is too avoid having to run the relatively expensive recomputation every time the item is parsed even if we know the runes on the item already.
1140- modLine .soulCore = groupedRunes [1 ].name : match ( " Soul Core " ) ~= nil
1152+ modLine .augmentType = groupedRunes [1 ].type
11411153 modLine .runeCount = numRunes
11421154
11431155 if shouldFixRunesOnItem then
@@ -1526,7 +1538,7 @@ function ItemClass:UpdateRunes()
15261538 for _ , mod in ipairs (gatheredMods ) do
15271539 for i , modLine in ipairs (mod ) do
15281540 local order = mod .statOrder [i ]
1529- local orderKey = modLine :match (" ^Bonded:" ) and " Bonded:" .. order or order
1541+ local orderKey = mod . type .. " : " .. ( modLine :match (" ^Bonded:" ) and " Bonded:" .. order or order )
15301542 if statOrder [orderKey ] then
15311543 -- Combine stats
15321544 local start = 1
@@ -1535,8 +1547,12 @@ function ItemClass:UpdateRunes()
15351547 start = e + 1
15361548 return tonumber (num ) + tonumber (other )
15371549 end )
1550+ local modList , extra = modLib .parseMod (statOrder [orderKey ].line )
1551+ statOrder [orderKey ].modList = modList or { }
1552+ statOrder [orderKey ].extra = extra
15381553 else
1539- local modLine = { line = modLine , order = order , rune = true , enchant = true }
1554+ local modList , extra = modLib .parseMod (modLine )
1555+ local modLine = { line = modLine , order = order , modList = modList or { }, extra = extra , rune = true , enchant = true , augmentType = mod .type }
15401556 for l = 1 , # self .runeModLines + 1 do
15411557 if not self .runeModLines [l ] or self .runeModLines [l ].order > order then
15421558 t_insert (self .runeModLines , l , modLine )
@@ -2020,6 +2036,17 @@ function ItemClass:BuildModList()
20202036 for _ , modLine in ipairs (self .explicitModLines ) do
20212037 processModLine (modLine )
20222038 end
2039+ self .socketedSoulCoreEffectModifier = calcLocal (baseList , " SocketedSoulCoreEffect" , " INC" , 0 ) / 100
2040+ self .socketedRuneEffectModifier = calcLocal (baseList , " SocketedRuneEffect" , " INC" , 0 ) / 100
2041+ for _ , modLine in ipairs (self .runeModLines ) do
2042+ local effectModifier = modLine .augmentType == " SoulCore" and self .socketedSoulCoreEffectModifier
2043+ or modLine .augmentType == " Rune" and self .socketedRuneEffectModifier
2044+ if effectModifier and effectModifier ~= 0 and self :CheckModLineVariant (modLine ) and not modLine .extra then
2045+ for _ , mod in ipairs (modLine .modList ) do
2046+ baseList :ScaleAddMod (mod , effectModifier )
2047+ end
2048+ end
2049+ end
20232050 self .grantedSkills = { }
20242051 for _ , skill in ipairs (baseList :List (nil , " ExtraSkill" )) do
20252052 if skill .name ~= " Unknown" then
@@ -2129,5 +2156,4 @@ function ItemClass:BuildModList()
21292156 else
21302157 self .modList = self :BuildModListForSlotNum (baseList )
21312158 end
2132- self .socketedSoulCoreEffectModifier = calcLocal (baseList , " SocketedSoulCoreEffect" , " INC" , 0 ) / 100
21332159end
0 commit comments