2,875
edits
No edit summary |
(Add more parameters to output) |
||
Line 49: | Line 49: | ||
local function parseItemInOut(args, prefix) | local function parseItemInOut(args, prefix) | ||
local items = {} | local items = {} | ||
local totalValue = 0 | |||
for i = 1, MaxDynamicArgs do | for i = 1, MaxDynamicArgs do | ||
local numPrefix = prefix .. i | local numPrefix = prefix .. i | ||
Line 71: | Line 73: | ||
pValue = tonumber(pValue) | pValue = tonumber(pValue) | ||
end | end | ||
-- Default to 0 to add to totals. | |||
local totVal = pValue or 0 | |||
local totAmt = pAmount or 0 | |||
totalValue = totalValue + (totVal * totAmt) | |||
table.insert(items, { | table.insert(items, { | ||
Line 79: | Line 86: | ||
end | end | ||
return items | return { | ||
TotalValue = totalValue, | |||
Items = items | |||
} | |||
end | end | ||
Line 128: | Line 138: | ||
local pInputs = parseItemInOut(args, 'input') | local pInputs = parseItemInOut(args, 'input') | ||
local pOutputs = parseItemInOut(args, 'output') | local pOutputs = parseItemInOut(args, 'output') | ||
local dlcIcons = p.getDLCIcons(args['dlc']) | local dlcIcons = p.getDLCIcons(args['dlc'], ' ') | ||
local tbl = mw.html.create() | local tbl = mw.html.create() | ||
tbl:tag("table") | local html = tbl:tag("table") | ||
:addClass("wikitable") | :addClass("wikitable") | ||
:attr('style', 'width: 100%; text-align: center;') | :attr('style', 'width: 100%; text-align: center;') | ||
Line 138: | Line 148: | ||
:tag("td") | :tag("td") | ||
:attr("colspan", 2) | :attr("colspan", 2) | ||
:wikitext(table.concat(dlcIcons)) | :wikitext(table.concat(dlcIcons) .. ' ') | ||
:wikitext(args['guideName']) | :wikitext(args['guideName']) | ||
:tag("tr") | :tag("tr") | ||
Line 151: | Line 161: | ||
:tag("tr") | :tag("tr") | ||
:tag("td") | :tag("td") | ||
:wikitext(paramtest.default_to(args['skills'], 'None')) | |||
:tag("td") | :tag("td") | ||
:attr("rowspan", 3) | :attr("rowspan", 3) | ||
:wikitext( | :wikitext(paramtest.default_to(args['other'], 'None')) | ||
:tag("tr") | :tag("tr") | ||
:tag("th") | :tag("th") | ||
Line 160: | Line 170: | ||
:tag("tr") | :tag("tr") | ||
:tag("td") | :tag("td") | ||
:wikitext( | :wikitext(paramtest.default_to(args['items'], 'None')) | ||
:tag("tr") | :tag("tr") | ||
:tag("th") | :tag("th") | ||
Line 172: | Line 182: | ||
:tag("tr") | :tag("tr") | ||
:tag("td") | :tag("td") | ||
if args['profit'] then | |||
html:wikitext(icons.GP(args['profit'])) | |||
else | |||
html:wikitext(icons.GP(pOutputs.total - pInputs.total)) | |||
end | |||
html = html | |||
:done() | :done() | ||
:tag("td") | :tag("td") |
edits