4,685
edits
(Synced with Live GolbinRaid) |
(Updated getRaidModifierList to remove Sign and Redesigned) |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local Constants = require('Module:Constants') | local Constants = require('Module:Sandbox/Constants') | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local Items = require('Module:Items') | local Items = require('Module:Sandbox/Items') | ||
function p.getCrateContents(frame) | function p.getCrateContents(frame) | ||
Line 85: | Line 85: | ||
local modList = {} | local modList = {} | ||
for i, modDet in ipairs(GameData.rawData.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) | ||
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 | ||
prefix = string.sub(baseName, 1, 9) | prefix = string.sub(baseName, 1, 9) | ||
end | end | ||
local modVal = {1, 5} | |||
local mult = modDet.multiplier | local mult = modDet.multiplier | ||
if mult ~= nil then | if mult ~= nil then | ||
modVal = {modVal[1] * mult, modVal[2] * mult} | modVal = {modVal[1] * mult, modVal[2] * mult} | ||
end | end | ||
if modList[baseName] == nil then | |||
modText = Constants._getModifierText(modDet.key, modVal, false) | modText = Constants._getModifierText(modDet.key, modVal, false) | ||
modList[baseName] = { | modList[baseName] = {["modText"] = {modText}, ["ord"] = i} | ||
else | else | ||
table.insert(modList[baseName][ | table.insert(modList[baseName]["modText"], Constants._getModifierText(modDet.key, modVal, false)) | ||
end | end | ||
end | end | ||
Line 112: | Line 112: | ||
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[1] | local modText = modDet['modText'][1] | ||
if | local replPat = '<br/>' | ||
modText = string.gsub(modText, replPat, ' to ', 1) | |||
if modDet['modText'][2] ~= nil then | |||
modText = | modText2 = modDet['modText'][2] | ||
modText2 = string.gsub(modText2, replPat, ' to ', 1) | |||
modText = modText .. '<br/>' .. modText2 | |||
end | end | ||
resultTable:tag('tr') | resultTable:tag('tr') | ||
:tag('td'):wikitext(modText):done() | :tag('td'):wikitext(modText):done() | ||
end | end | ||
--tostring(resultTable) | |||
return tostring(resultTable) | return tostring(resultTable) | ||
end | end | ||
return p | return p |