Anonymous

Module:Skills/Gathering: Difference between revisions

From Melvor Idle
Added initial pass at grouping together different Astrology bonuses on the same modifier
(getToolTable: Add variable header support for each tool type)
(Added initial pass at grouping together different Astrology bonuses on the same modifier)
Line 730: Line 730:
end
end
result = result..'||'..table.concat(skillIconArray, '<br/>')
result = result..'||'..table.concat(skillIconArray, '<br/>')
--Adding a function that converts an array of connected bonuses into text [Falterfire 22/10/27]
local groupedModsToText = function(allMods)
local outArray = {}
for i, group in ipairs(allMods) do
table.insert(outArray, table.concat(group, ' & '))
end
return table.concat(outArray, '<br/>')
end


local standModsRaw = Skills._buildAstrologyModifierArray(cons, nil, true, false, false, false)
local standModsRaw = Skills._buildAstrologyModifierArray(cons, nil, true, false, false, false)
local standMods = {}
local standMods = {}
--Building the list of Standard modifiers:
--Building the list of Standard modifiers:
for j, modifier in ipairs(standModsRaw) do
for j, modifier in ipairs(standModsRaw) do
local modMagnitude = type(modifier[2]) == 'table' and {modifier[2]} or modifier[2]
local modMagnitude = type(modifier[2]) == 'table' and {modifier[2]} or modifier[2]
table.insert(standMods, Constants._getModifierText(modifier[1], modMagnitude, false))
local groupNum = modifier.group
if standMods[groupNum] == nil then standMods[groupNum] = {} end
table.insert(standMods[groupNum], Constants._getModifierText(modifier[1], modMagnitude, false))
end
end
result = result..'|| '..table.concat(standMods, '<br/>')
result = result..'|| '..groupedModsToText(standMods)


--Building the list of all Unique Modifiers
--Building the list of all Unique Modifiers
Line 745: Line 757:
for j, modifier in ipairs(uModsRaw) do
for j, modifier in ipairs(uModsRaw) do
local modMagnitude = type(modifier[2]) == 'table' and {modifier[2]} or modifier[2]
local modMagnitude = type(modifier[2]) == 'table' and {modifier[2]} or modifier[2]
table.insert(uMods, Constants._getModifierText(modifier[1], modMagnitude, false))
local groupNum = modifier.group
if uMods[groupNum] == nil then uMods[groupNum] = {} end
table.insert(uMods[groupNum], Constants._getModifierText(modifier[1], modMagnitude, false))
end
end
result = result..'||'..table.concat(uMods, '<br/>')
result = result..'|| '..groupedModsToText(uMods)
end
end
result = result..'\r\n|}'
result = result..'\r\n|}'