164164--- the hash that was found
165165--- @return number ? hash , table[] ? optionsIfApplicable , number[] ? matchedOptionId
166166function M .findTradeHash (item , modLine , modType )
167- -- these mod results in false positives and are either useless, or
168- -- effectively found by searching for the unique item's name
169- if modLine == " Passage" or modLine == " Passive Skills in Radius can be Allocated without being connected to your tree" then
170- return nil
171- end
172-
173167 local formattedLine = M .formatDatabaseText (modLine )
174168 -- the data export splits some mods into different parts, even though they
175169 -- are technically just one stat. we handle that here
@@ -180,23 +174,16 @@ function M.findTradeHash(item, modLine, modType)
180174 -- cluster jewel mod weights are weird
181175 local isMatchingClusterMod = dbMod .group and dbMod .group :match (" ^Affliction" ) and
182176 item .base .subType == " Cluster"
183- if not (isMatchingClusterMod or ignoreWeights ) and # (dbMod .weightKey or {}) > 0 and not (item :GetModSpawnWeight (dbMod , nil , excludeTags ) > 0 ) then
177+ local modCanSpawnOnItem = # (dbMod .weightKey or {}) > 0 and
178+ (item :GetModSpawnWeight (dbMod , nil , excludeTags ) > 0 )
179+ if (not (isMatchingClusterMod or ignoreWeights )) and not modCanSpawnOnItem then
184180 return nil
185181 end
186182 for tradeHash , description in pairs (dbMod .tradeHashes ) do
187183 local tradeLine = table.concat (description , " \n " )
188184 if formattedLine == M .formatDatabaseText (tradeLine ) then
189185 return tradeHash
190186 end
191-
192- -- the mod line splitting between the stat export and item parsing
193- -- can be different. hence we test both a combined line and separate
194- -- lines
195- for _ , descLine in ipairs (description ) do
196- if formattedLine == M .formatDatabaseText (descLine ) then
197- return tradeHash
198- end
199- end
200187 end
201188 end
202189
@@ -218,7 +205,7 @@ function M.findTradeHash(item, modLine, modType)
218205 end
219206 if item .foulborn then
220207 for _ , dbMod in pairs (data .itemMods .Foulborn ) do
221- local tradeHashMaybe = findStat (dbMod )
208+ local tradeHashMaybe = findStat (dbMod , true )
222209 if tradeHashMaybe then
223210 return tradeHashMaybe
224211 end
0 commit comments