You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- processes mods from the data exports to a format that is more useful for
189
+
-- generating weights.
190
+
191
+
-- this function generally uses the .tradeHashes field of each exported mod,
192
+
-- which contains a map from the trade hash to the mod lines/stats
193
+
194
+
-- at a high level, this function matches each stat / mod line to an entry in
195
+
-- https://www.pathofexile.com/api/trade2/data/stats via the trade hash. that
196
+
-- entry is then used to determine if the mod is inverted, i.e. that the mod
197
+
-- here is x increased by y, while the trade site has x decreased by -y. the
198
+
-- function also records the minimum and maximum values of each stat, so we can
199
+
-- later test for a midpoint of those values to generate a weight
200
+
fortradeHash, modLinesinpairs(mod.tradeHashes) do
201
+
-- the mod export sometimes splits stats to multiple lines. they should
202
+
-- still get parsed correctly if we combine them, and that makes it
203
+
-- simpler to process them
204
+
ifnotmodLinesthen
205
+
ConPrintf("")
206
+
end
207
+
localmodLine=table.concat(modLines, "")
189
208
ifmodLine:find("Grants Level") ormodLine:find("inflict Decay") then-- skip mods that grant skills / decay, as they will often be overwhelmingly powerful but don't actually fit into the build
190
209
gotonextModLine
191
210
end
@@ -214,8 +233,11 @@ function TradeQueryGeneratorClass:ProcessMod(mod, tradeQueryStatsParsed, itemCat
214
233
-- iterate trade mod category to find mod with matching text.
215
234
localfunctiongetTradeMod()
216
235
localentry
217
-
localtradeHashStr=tostring(mod.tradeHash)
236
+
localtradeHashStr=tostring(tradeHash)
218
237
for_, vinipairs(tradeQueryStatsParsed.result[tradeStatCategoryIndices[modType]].entries) do
238
+
if_==33then
239
+
ConPrintf("")
240
+
end
219
241
-- prefix removed
220
242
localids=v.id:gsub(".+..stat_", "").."|"
221
243
-- split by non-integer
@@ -247,7 +269,7 @@ function TradeQueryGeneratorClass:ProcessMod(mod, tradeQueryStatsParsed, itemCat
247
269
localtradeMod=nil
248
270
localinvert
249
271
250
-
localuniqueIndex=tostring(mod.tradeHash)
272
+
localuniqueIndex=tostring(tradeHash)
251
273
252
274
ifself.modData[modType][uniqueIndex] ==nilthen
253
275
iftradeMod==nilthen
@@ -306,7 +328,7 @@ function TradeQueryGeneratorClass:ProcessMod(mod, tradeQueryStatsParsed, itemCat
306
328
end
307
329
308
330
if#tokens~=0and#tokens~=2and#tokens~=4then
309
-
logToFile("Unexpected # of tokens found for mod: %s", mod[index])
331
+
logToFile("Unexpected # of tokens found for mod: %s", modLine)
310
332
gotonextModLine
311
333
end
312
334
@@ -461,7 +483,7 @@ function TradeQueryGeneratorClass:InitMods()
461
483
forname, runeModsinpairsSortByKey(data.itemMods.Runes) do
0 commit comments