Skip to content

Commit 533641d

Browse files
committed
Add note about trade hashes
1 parent 1bddcdc commit 533641d

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/Export/Scripts/mods.lua

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,31 @@ local function writeMods(outName, condFunc)
110110
out:write('nodeType = ', mod.NodeType, ', ')
111111
end
112112

113+
-- Note that some of the resulting hashes might not be correct.
114+
-- Some of the tradehashes are also associated with another
115+
-- value. For example the "only affects passives in # ring" is
116+
-- correct here, but has a variant value appended to it like:
117+
-- explicit.stat_3642528642|7. Some stats may also be handled in
118+
-- a way similar to radius jewels that this script doesn't do.
113119
local modIdx = 1
114120
local tradeHashes = {}
115121
while mod["Stat" .. modIdx] do
116122
local currentStats = {}
117-
currentStats[mod["Stat" .. modIdx].Id] = {
123+
local stat = mod["Stat" .. modIdx]
124+
currentStats[stat.Id] = {
118125
min = mod["Stat" .. modIdx .. "Value"][1], max = mod["Stat" .. modIdx .. "Value"][2]
119126
}
120127
if modIdx == 6 then
121128
break
122129
end
123-
local bytes = intToBytes(mod["Stat" .. modIdx].Hash)
130+
local bytes = intToBytes(stat.Hash)
124131
-- # to # stats consist of two different stats as the min and max have different ranges
125-
if mod["Stat" .. modIdx].Id:match("minimum") then
132+
if stat.Id:match("minimum") then
126133
local nextStat = mod["Stat" .. (modIdx + 1)]
127134
if nextStat and nextStat.Id:match("maximum") then
128135
modIdx = modIdx + 1
129-
bytes = bytes .. intToBytes(mod["Stat" .. modIdx].Hash)
130-
currentStats[mod["Stat" .. modIdx].Id] = {
136+
bytes = bytes .. intToBytes(nextStat.Hash)
137+
currentStats[nextStat.Id] = {
131138
min = mod["Stat" .. modIdx .. "Value"][1], max = mod["Stat" .. modIdx .. "Value"][2]
132139
}
133140
end

0 commit comments

Comments
 (0)