@@ -850,8 +850,8 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
850850 gameModeStage = " IMPLICIT"
851851 end
852852 local catalystScalar = 1
853- if line :match (" %- Unscalable Value$" ) then
854- line = line :gsub (" %- Unscalable Value$" , " " )
853+ if line :match (" %- Unscalable Value$" ) or line : match ( " — Unscalable Value$ " ) then
854+ line = line :gsub (" %- Unscalable Value$" , " " ): gsub ( " — Unscalable Value$ " , " " )
855855 modLine .unscalable = true
856856 else
857857 catalystScalar = getCatalystScalar (self .catalyst , modLine , self .catalystQuality )
@@ -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
@@ -1126,19 +1138,45 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
11261138 table.sort (runes , function (a , b ) return compareRuneValueSets (a .values , b .values ) end )
11271139 end
11281140
1141+ local gameSocketedRuneEffectModifier = 0
1142+ if mode == " GAME" and shouldFixRunesOnItem then
1143+ for _ , modLines in ipairs ({ self .enchantModLines , self .implicitModLines , self .explicitModLines }) do
1144+ for _ , effectModLine in ipairs (modLines ) do
1145+ for _ , mod in ipairs (effectModLine .modList or { }) do
1146+ if mod .name == " SocketedRuneEffect" and mod .type == " INC" then
1147+ gameSocketedRuneEffectModifier = gameSocketedRuneEffectModifier + mod .value / 100
1148+ end
1149+ end
1150+ end
1151+ end
1152+ end
1153+
11291154 local remainingRunes = self .itemSocketCount
11301155 for i , modLine in ipairs (self .runeModLines ) do
11311156 local strippedModLine , targetValues = getRuneLineParts (modLine .line )
11321157 local groupedRunes = statGroupedRunes [strippedModLine ]
11331158 if groupedRunes and not modLine .bonded then -- found the rune category with the relevant stat.
1134- local result , numRunes = findRuneCombination (groupedRunes , targetValues , remainingRunes )
1159+ local result , numRunes
1160+ local socketedRuneEffectAlreadyApplied
1161+ if gameSocketedRuneEffectModifier ~= 0 then
1162+ local unscaledTargetValues = { }
1163+ for valueIndex , value in ipairs (targetValues ) do
1164+ unscaledTargetValues [valueIndex ] = value / (1 + gameSocketedRuneEffectModifier )
1165+ end
1166+ result , numRunes = findRuneCombination (groupedRunes , unscaledTargetValues , remainingRunes )
1167+ socketedRuneEffectAlreadyApplied = result ~= nil
1168+ end
1169+ if not result then
1170+ result , numRunes = findRuneCombination (groupedRunes , targetValues , remainingRunes )
1171+ end
11351172
11361173 if result then -- we have found a valid combo for that rune category
11371174 remainingRunes = remainingRunes - numRunes
11381175 -- this code should probably be refactored to based off stored self.runes rather than the recomputed amounts off the runeModLines this
11391176 -- 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
1177+ modLine .augmentType = groupedRunes [1 ].type
11411178 modLine .runeCount = numRunes
1179+ modLine .socketedRuneEffectAlreadyApplied = socketedRuneEffectAlreadyApplied
11421180
11431181 if shouldFixRunesOnItem then
11441182 for index , rune in ipairs (groupedRunes ) do
@@ -1286,6 +1324,9 @@ end
12861324
12871325function ItemClass :BuildRaw ()
12881326 local rawLines = { }
1327+ if self .runeModLines and self .runeModLines [1 ] then
1328+ self :ApplySocketedRuneDisplayScalars ()
1329+ end
12891330 t_insert (rawLines , " Rarity: " .. self .rarity )
12901331 if self .title then
12911332 t_insert (rawLines , self .title )
@@ -1345,7 +1386,8 @@ function ItemClass:BuildRaw()
13451386 t_insert (rawLines , " Item Level: " .. self .itemLevel )
13461387 end
13471388 local function writeModLine (modLine )
1348- local line = modLine .line
1389+ local displayValueScalar = modLine .displayValueScalar and (modLine .valueScalar or 1 ) * modLine .displayValueScalar
1390+ local line = displayValueScalar and itemLib .applyRange (modLine .line , modLine .range or main .defaultItemAffixQuality , displayValueScalar , modLine .corruptedRange ) or modLine .line
13491391 if modLine .range and line :match (" %(%-?[%d%.]+%-%-?[%d%.]+%)" ) then
13501392 line = " {range:" .. round (modLine .range , 3 ) .. " }" .. line
13511393 end
@@ -1526,7 +1568,7 @@ function ItemClass:UpdateRunes()
15261568 for _ , mod in ipairs (gatheredMods ) do
15271569 for i , modLine in ipairs (mod ) do
15281570 local order = mod .statOrder [i ]
1529- local orderKey = modLine :match (" ^Bonded:" ) and " Bonded:" .. order or order
1571+ local orderKey = mod . type .. " : " .. ( modLine :match (" ^Bonded:" ) and " Bonded:" .. order or order )
15301572 if statOrder [orderKey ] then
15311573 -- Combine stats
15321574 local start = 1
@@ -1535,8 +1577,12 @@ function ItemClass:UpdateRunes()
15351577 start = e + 1
15361578 return tonumber (num ) + tonumber (other )
15371579 end )
1580+ local modList , extra = modLib .parseMod (statOrder [orderKey ].line )
1581+ statOrder [orderKey ].modList = modList or { }
1582+ statOrder [orderKey ].extra = extra
15381583 else
1539- local modLine = { line = modLine , order = order , rune = true , enchant = true }
1584+ local modList , extra = modLib .parseMod (modLine )
1585+ local modLine = { line = modLine , order = order , modList = modList or { }, extra = extra , rune = true , enchant = true , augmentType = mod .type }
15401586 for l = 1 , # self .runeModLines + 1 do
15411587 if not self .runeModLines [l ] or self .runeModLines [l ].order > order then
15421588 t_insert (self .runeModLines , l , modLine )
@@ -1551,6 +1597,18 @@ function ItemClass:UpdateRunes()
15511597 end
15521598end
15531599
1600+ function ItemClass :ApplySocketedRuneDisplayScalars ()
1601+ for _ , modLine in ipairs (self .runeModLines or { }) do
1602+ local effectModifier = modLine .augmentType == " SoulCore" and (self .socketedSoulCoreEffectModifier or 0 )
1603+ or modLine .augmentType == " Rune" and (self .socketedRuneEffectModifier or 0 )
1604+ if effectModifier and effectModifier ~= 0 and not modLine .socketedRuneEffectAlreadyApplied then
1605+ modLine .displayValueScalar = 1 + effectModifier
1606+ else
1607+ modLine .displayValueScalar = nil
1608+ end
1609+ end
1610+ end
1611+
15541612-- Rebuild explicit modifiers using the item's affixes
15551613function ItemClass :Craft ()
15561614 -- Save off any custom mods so they can be re-added at the end
@@ -2020,6 +2078,20 @@ function ItemClass:BuildModList()
20202078 for _ , modLine in ipairs (self .explicitModLines ) do
20212079 processModLine (modLine )
20222080 end
2081+ self .socketedSoulCoreEffectModifier = calcLocal (baseList , " SocketedSoulCoreEffect" , " INC" , 0 ) / 100
2082+ self .socketedRuneEffectModifier = calcLocal (baseList , " SocketedRuneEffect" , " INC" , 0 ) / 100
2083+ if self .runeModLines [1 ] then
2084+ self :ApplySocketedRuneDisplayScalars ()
2085+ end
2086+ for _ , modLine in ipairs (self .runeModLines ) do
2087+ local effectModifier = modLine .augmentType == " SoulCore" and self .socketedSoulCoreEffectModifier
2088+ or modLine .augmentType == " Rune" and self .socketedRuneEffectModifier
2089+ if effectModifier and effectModifier ~= 0 and self :CheckModLineVariant (modLine ) and not modLine .extra and not modLine .socketedRuneEffectAlreadyApplied then
2090+ for _ , mod in ipairs (modLine .modList ) do
2091+ baseList :ScaleAddMod (mod , effectModifier )
2092+ end
2093+ end
2094+ end
20232095 self .grantedSkills = { }
20242096 for _ , skill in ipairs (baseList :List (nil , " ExtraSkill" )) do
20252097 if skill .name ~= " Unknown" then
@@ -2085,6 +2157,9 @@ function ItemClass:BuildModList()
20852157 baseList :NewMod (" ArmourData" , " LIST" , { key = " EnergyShield" , value = 0 })
20862158 self .requirements .int = 0
20872159 end
2160+ if self .name == " Geofri's Sanctuary, Revered Vestments" then
2161+ baseList :NewMod (" ArmourData" , " LIST" , { key = " EnergyShield" , value = 0 })
2162+ end
20882163 if calcLocal (baseList , " NoAttributeRequirements" , " FLAG" , 0 ) then
20892164 self .requirements .strMod = 0
20902165 self .requirements .dexMod = 0
@@ -2126,5 +2201,4 @@ function ItemClass:BuildModList()
21262201 else
21272202 self .modList = self :BuildModListForSlotNum (baseList )
21282203 end
2129- self .socketedSoulCoreEffectModifier = calcLocal (baseList , " SocketedSoulCoreEffect" , " INC" , 0 ) / 100
21302204end
0 commit comments