Skip to content

Commit 08b3131

Browse files
Wires77Regisle
andauthored
Fix integer Glorious Vanity notables, load LUTs from compressed files (#4536)
* Inflate/Deflate LUTs * Fixed integer Glorious Vanity notables * move stuff to helper function and add support for "g" format mods * Fixed loading of compressed GV timeless jewel * Add generated .zip files * defer table creation of specific nodes until that node is read * cleanup * Code cleanup * Implement logic to load from binary file by default, and to decompress and create it from .zip if it doesn't exist Co-authored-by: Regisle <Regisle.godform@gmail.com>
1 parent 40d3c3e commit 08b3131

File tree

14 files changed

+4726
-3269
lines changed

14 files changed

+4726
-3269
lines changed

src/Classes/PassiveSpec.lua

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,25 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
689689
if jewelType == 5 then
690690
seed = seed / 20
691691
end
692+
693+
local replaceHelperFunc = function(statToFix, statKey, statMod, value)
694+
if statMod.fmt == "g" then -- note the only one we actualy care about is "Ritual of Flesh" life regen
695+
if statKey:find("per_minute") then
696+
value = round(value / 60, 1)
697+
elseif statKey:find("permyriad") then
698+
value = value / 100
699+
elseif statKey:find("_ms") then
700+
value = value / 1000
701+
end
702+
end
703+
--if statMod.fmt == "d" then --only ever d or g, and we want both past here
704+
if statMod.min ~= statMod.max then
705+
return statToFix:gsub("%("..statMod.min.."%-"..statMod.max.."%)", value)
706+
elseif statMod.min ~= value then -- only true for might/legacy of the vaal which can combine stats
707+
return statToFix:gsub(statMod.min, value)
708+
end
709+
return statToFix -- if it doesnt need to be changed
710+
end
692711

693712
if node.type == "Notable" then
694713
local jewelDataTbl = { }
@@ -707,6 +726,13 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
707726
-- based on their `fmt` specification
708727
if headerSize == 2 or headerSize == 3 then
709728
self:ReplaceNode(node, legionNodes[jewelDataTbl[1] - 94])
729+
730+
for i, repStat in ipairs(legionNodes[jewelDataTbl[1] - 94].sd) do
731+
local statKey = legionNodes[jewelDataTbl[1] - 94].sortedStats[i]
732+
local statMod = legionNodes[jewelDataTbl[1] - 94].stats[statKey]
733+
repStat = replaceHelperFunc(repStat, statKey, statMod, jewelDataTbl[statMod.index + 1])
734+
self:NodeAdditionOrReplacementFromString(node, repStat, i == 1) -- wipe mods on first run
735+
end
710736
-- should fix the stat values here (note headerSize == 3 has 2 values)
711737
elseif headerSize == 6 or headerSize == 8 then
712738
local bias = 0
@@ -740,14 +766,8 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
740766
for add,val in pairs(additions) do
741767
local addition = legionAdditions[add]
742768
for _, addStat in ipairs(addition.sd) do
743-
for k,statMod in pairs(addition.stats) do -- should only be 1 big
744-
if statMod.fmt == "d" then
745-
if statMod.min == statMod.max then
746-
addStat = addStat:gsub(statMod.min,val)
747-
else
748-
addStat = addStat:gsub("%("..statMod.min.."%-"..statMod.max.."%)",val)
749-
end
750-
end
769+
for k,statMod in pairs(addition.stats) do -- should only be 1 big, these didnt get changed so cant just grab index
770+
addStat = replaceHelperFunc(addStat, k, statMod, val)
751771
end
752772
self:NodeAdditionOrReplacementFromString(node, addStat)
753773
end
@@ -796,11 +816,13 @@ function PassiveSpecClass:BuildAllDependsAndPaths()
796816
if not next(jewelDataTbl) then
797817
ConPrintf("Missing LUT: " .. data.timelessJewelTypes[jewelType])
798818
else
799-
local stat1 = jewelDataTbl[1] - 94
800-
local roll1 = jewelDataTbl[2]
801-
self:ReplaceNode(node, legionNodes[stat1])
802-
--local legionNode = legionNodes[38] -- vaal_small_fire_resistance
803-
--self:ReplaceNode(node, legionNode)
819+
self:ReplaceNode(node, legionNodes[jewelDataTbl[1] - 94])
820+
for i, repStat in ipairs(node.sd) do
821+
local statKey = legionNodes[jewelDataTbl[1] - 94].sortedStats[i]
822+
local statMod = legionNodes[jewelDataTbl[1] - 94].stats[statKey]
823+
repStat = replaceHelperFunc(repStat, statKey, statMod, jewelDataTbl[2])
824+
self:NodeAdditionOrReplacementFromString(node, repStat, true)
825+
end
804826
end
805827
elseif conqueredBy.conqueror.type == "karui" then
806828
local str = isValueInArray(attributes, node.dn) and "2" or "4"

0 commit comments

Comments
 (0)