Skip to content

Commit

Permalink
Made Tecrod's parsing more generic, fixed limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Wires77 committed Apr 9, 2021
1 parent 5cf37ed commit f9157e5
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Modules/ModParser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ local band = bit.band
local bor = bit.bor
local bnot = bit.bnot

local function upperCaseFirstLetter(str)
return (str:gsub("^%l", string.upper))
end

local conquerorList = {
["xibaqua"] = {id = 1, type = "vaal"},
["zerphi"] = {id = 2, type = "vaal"},
Expand Down Expand Up @@ -899,7 +903,7 @@ local modTagList = {
["per abyssa?l? jewel affecting you"] = { tag = { type = "Multiplier", var = "AbyssJewel" } },
["for each herald s?k?i?l?l? ?affecting you"] = { tag = { type = "Multiplier", var = "Herald" } },
["for each type of abyssa?l? jewel affecting you"] = { tag = { type = "Multiplier", var = "AbyssJewelType" } },
["per murderous eye jewel affecting you, up to a maximum of %+?(%d+)%%"] = function(num) return { tag = { type = "Multiplier", var = "MurderousEyeJewel", limit = tonumber(num) } } end,
["per (.+) eye jewel affecting you, up to a maximum of %+?(%d+)%%"] = function(type, _, num) return { tag = { type = "Multiplier", var = upperCaseFirstLetter(type) .. "EyeJewel", limit = tonumber(num), limitTotal = true } } end,
["per sextant affecting the area"] = { tag = { type = "Multiplier", var = "Sextant" } },
["per buff on you"] = { tag = { type = "Multiplier", var = "BuffOnSelf" } },
["per curse on enemy"] = { tag = { type = "Multiplier", var = "CurseOnEnemy" } },
Expand Down Expand Up @@ -1327,9 +1331,6 @@ local function triggerExtraSkill(name, level, noSupports)
}
end
end
local function upperCaseFirstLetter(str)
return (str:gsub("^%l", string.upper))
end

-- List of special modifiers
local specialModList = {
Expand Down Expand Up @@ -3286,12 +3287,20 @@ local function parseMod(line, order)
local modTag, modTag2, tagCap
modTag, line, tagCap = scan(line, modTagList)
if type(modTag) == "function" then
modTag = modTag(tonumber(tagCap[1]), unpack(tagCap))
if tagCap[1]:match("%d+") then
modTag = modTag(tonumber(tagCap[1]), unpack(tagCap))
else
modTag = modTag(tagCap[1], unpack(tagCap))
end
end
if modTag then
modTag2, line, tagCap = scan(line, modTagList)
if type(modTag2) == "function" then
modTag2 = modTag2(tonumber(tagCap[1]), unpack(tagCap))
if tagCap[1]:match("%d+") then
modTag2 = modTag2(tonumber(tagCap[1]), unpack(tagCap))
else
modTag2 = modTag2(tagCap[1], unpack(tagCap))
end
end
end

Expand Down

0 comments on commit f9157e5

Please sign in to comment.