Module:Infobox Recipe: Difference between revisions
no edit summary
The Gaffer (talk | contribs) (Tidy) |
The Gaffer (talk | contribs) No edit summary |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1:
local currency = require('Module:Currency')
local
local yn = require('Module:Yesno')
local editButton = require('Module:Edit button')
local function currency_cell(amount)
Line 27 ⟶ 28:
--get the value for the output product
local output1Value =
if args.output1 then
output1Value = mw.smw.ask('[[:+]][[' .. args.output1 .. ']]|?Value|limit=1') or 0
end
--Calculate total value of output material(s)
local output1TotalValue = 0
if type(output1Value
output1TotalValue = output1Value[1]['Value'] * (tonumber(args.output1qty) or 1)
output1TotalValue = 0
end
end
Line 157 ⟶ 163:
:tag('td')
:attr{ colspan = '11' }
:wikitext(hc(args.facility) and ('[[File:%s.png|link=%s|30px]] [[%s]]'):format(args.facility, args.facility, args.facility) or editButton("'
:done()
:done()
Line 177 ⟶ 184:
:attr{ colspan = '2' }
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.profession) and ('[[' .. args.profession .. ']]') or editButton("'
:done()
:tag('td')
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.level) and (args.level) or editButton("'
:done()
:tag('td')
:attr{ colspan = '10' }
:css{ ['text-align'] = 'center' }
:wikitext(hc(args.exp) and (args.exp) or editButton("'
:done()
:done()
Line 263 ⟶ 270:
:done()
:done()
if args.output1 then
out
-- Values
:tag('tr')
:tag('td')
:css{ ['border-right'] = 'none' }
:wikitext('[[File:' .. args.output1 .. '.png|30px|link=' .. args.output1 .. ']]' or 'Unknown')
:done()
:tag('td')
:css{ ['border-left'] = 'none' }
:wikitext(
:done()
:tag('td')
Line 280 ⟶ 289:
:wikitext(currency_cell(output1TotalValue))
:done()
end
-- Add profit data
out
:tag('tr')
:tag('th')
|