Module:Sandbox/GolbinRaid: Difference between revisions

Updated getRaidModifierList
(Updated getRaidModifierList to remove Sign and Redesigned)
(Updated getRaidModifierList)
Line 86: Line 86:
for i, modDet in ipairs(GameData.rawData.golbinRaid.possibleModifiers) do
for i, modDet in ipairs(GameData.rawData.golbinRaid.possibleModifiers) do
local baseName, modText, isNeg, modifyValue = Constants.getModifierDetails(modDet.key)
local baseName, modText, isNeg, modifyValue = Constants.getModifierDetails(modDet.key)
--TODO: Is this necessary? getModifierDetails has the same code and this function doesn't have params
local prefix = ''
local prefix = ''
if Shared.startsWith(baseName, 'increased') or Shared.startsWith(baseName, 'decreased') then
if Shared.startsWith(baseName, 'increased') or Shared.startsWith(baseName, 'decreased') then
Line 97: Line 98:
if modList[baseName] == nil then
if modList[baseName] == nil then
modText = Constants._getModifierText(modDet.key, modVal, false)
modText = Constants._getModifierText(modDet.key, modVal, false)
modList[baseName] = {["modText"] = {modText}, ["ord"] = i}
modList[baseName] = {modText, ["ord"] = i, ["mods"] = 1}
else
else
table.insert(modList[baseName]["modText"], Constants._getModifierText(modDet.key, modVal, false))
modList[baseName]["mods"] = modList[baseName]["mods"] + 1
end
end
end
end
Line 112: Line 113:
local sortFunc = function(t, a, b) return t[a].ord < t[b].ord end
local sortFunc = function(t, a, b) return t[a].ord < t[b].ord end
for baseName, modDet in Shared.spairs(modList, sortFunc) do
for baseName, modDet in Shared.spairs(modList, sortFunc) do
local modText = modDet['modText'][1]
local modText = modDet[1]
local replPat = '<br/>'
if modDet['mods'] > 1 then
modText = string.gsub(modText, replPat, ' to ', 1)
local replPat = '[+-]'
if modDet['modText'][2] ~= nil then
modText = string.gsub(modDet[1], replPat, '+/-', 2)
modText2 = modDet['modText'][2]
modText2 = string.gsub(modText2, replPat, ' to ', 1)
modText = modText .. '<br/>' .. modText2
end
end
resultTable:tag('tr')
resultTable:tag('tr')
1,002

edits