Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-integer catalyst scaling issues #2544

Merged
merged 1 commit into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ local influenceInfo = itemLib.influenceInfo

local catalystQualityFormat = {
"^x7F7F7FQuality (Attack Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Speed Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Life and Mana Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Caster Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Attribute Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Physical and Chaos Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Resistance Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Defense Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Elemental Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
"^x7F7F7FQuality (Critical Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
}

local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Control", function(self, build)
Expand Down Expand Up @@ -2006,7 +2009,11 @@ function ItemsTabClass:CorruptDisplayItem()
if control.selIndex > 1 then
local mod = control.list[control.selIndex].mod
for _, modLine in ipairs(mod) do
t_insert(newImplicit, { line = modLine })
if mod.modTags[1] then
t_insert(newImplicit, { line = "{tags:" .. table.concat(mod.modTags, ",") .. "}" .. modLine })
else
t_insert(newImplicit, { line = modLine })
end
end
end
end
Expand Down
19 changes: 11 additions & 8 deletions src/Modules/ItemTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ itemLib.influenceInfo = {
-- Apply a value scalar to any numbers present
function itemLib.applyValueScalar(line, valueScalar)
if valueScalar and type(valueScalar) == "number" and valueScalar ~= 1 then
return line:gsub("(%d+%.%d*)", function(num)
local numVal = (m_floor(tonumber(num) * valueScalar * 10 + 0.001) / 10)
return tostring(numVal)
end)
:gsub("(%d+)([^%.])", function(num, suffix)
local numVal = m_floor(num * valueScalar + 0.001)
return tostring(numVal)..suffix
end)
if line:match("(%d+%.%d*)") then
return line:gsub("(%d+%.%d*)", function(num)
local numVal = (m_floor(tonumber(num) * valueScalar * 100 + 0.001) / 100)
return tostring(numVal)
end)
else
return line:gsub("(%d+)([^%.])", function(num, suffix)
local numVal = m_floor(num * valueScalar + 0.001)
return tostring(numVal)..suffix
end)
end
end
return line
end
Expand Down