599
edits
(Update for v1.1) |
(Removed prefix code in getRaidModifierList) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 32: | Line 32: | ||
end | end | ||
for i, crateEntry in Shared.spairs(GameData.golbinRaid.crateItems, sortFunc) do | for i, crateEntry in Shared.spairs(GameData.rawData.golbinRaid.crateItems, sortFunc) do | ||
local item = Items.getItemByID(crateEntry.itemID) | local item = Items.getItemByID(crateEntry.itemID) | ||
if item ~= nil then | if item ~= nil then | ||
Line 57: | Line 57: | ||
-- If the item has special attacks, use those | -- If the item has special attacks, use those | ||
local spAttText = {} | local spAttText = {} | ||
for j, | for j, spAttID in ipairs(item.specialAttacks) do | ||
table.insert(spAttText, '<b>' .. spAtt.name .. ' (' .. Shared.round(spAtt.defaultChance, 2, 0) .. '%)</b> - ' .. spAtt.description) | local spAtt = GameData.getEntityByID('attacks', spAttID) | ||
if spAtt ~= nil then | |||
table.insert(spAttText, '<b>' .. spAtt.name .. ' (' .. Shared.round(spAtt.defaultChance, 2, 0) .. '%)</b> - ' .. spAtt.description) | |||
end | |||
end | end | ||
descText = table.concat(spAttText, '<br/>') | descText = table.concat(spAttText, '<br/>') | ||
Line 81: | Line 84: | ||
function p.getRaidModifierList() | function p.getRaidModifierList() | ||
local modList = {} | local modList = {} | ||
for i, modDet in ipairs(GameData.golbinRaid.possibleModifiers) do | for i, modDet in ipairs(GameData.rawData.golbinRaid.possibleModifiers) do | ||
local baseName, modText | local baseName, modText, isNeg, modifyValue = Constants.getModifierDetails(modDet.key) | ||
if modList[baseName] == nil then | if modList[baseName] == nil then | ||
local modVal = {1, 5} | local modVal = {1, 5} | ||
Line 94: | Line 93: | ||
end | end | ||
modText = Constants._getModifierText(modDet.key, modVal, false) | modText = Constants._getModifierText(modDet.key, modVal, false) | ||
modList[baseName] = {modText, ["ord"] = i, [" | modList[baseName] = {modText, ["ord"] = i, ["mods"] = 1} | ||
else | else | ||
modList[baseName]["mods"] = modList[baseName]["mods"] + 1 | |||
end | end | ||
end | end | ||
Line 110: | Line 109: | ||
for baseName, modDet in Shared.spairs(modList, sortFunc) do | for baseName, modDet in Shared.spairs(modList, sortFunc) do | ||
local modText = modDet[1] | local modText = modDet[1] | ||
if | if modDet['mods'] > 1 then | ||
local replPat = | local replPat = '[+-]' | ||
modText = string.gsub(modDet[1], replPat, '+/-', 2) | |||
modText = string.gsub(modDet[1], replPat, | |||
end | end | ||
resultTable:tag('tr') | resultTable:tag('tr') | ||
:tag('td'):wikitext(modText):done() | :tag('td'):wikitext(modText):done() | ||
end | end | ||
return tostring(resultTable) | return tostring(resultTable) | ||
end | end | ||
return p | return p |
edits