Module:PotionList: Difference between revisions
Undo revision 49590 by Artoire (talk): Sorting breaks up cells with rowspan
(Use multiple rows for multiple reagents) |
Tag: Undo |
||
Line 1:
require('Module:Mw.html extension')
local param = require( 'Module:Paramtest' )
local currency = require('Module:Currency')
local lang = mw.getContentLanguage()
require("Module:Mw.html extension")
Line 36 ⟶ 37:
-- makes the html for the cells containing currency directly
-- Replaces nil with an "unknown" cell
local function currency_cell(amount
if not amount then
return tostring(mw.html.create('td')
:addClass('table-bg-gray')
:css{ ['text-align'] = 'center' }
:attr{ colspan = '10'
:wikitext("''unknown''")
:done())
end
return currency._cell(amount, { html = 'yes'
end
Line 123 ⟶ 122:
:done()
:tag('th')
:wikitext('Reagents (plus bottle)')
:done()
Line 153 ⟶ 151:
:done()
:done()
for i,item in ipairs(results) do
local reagent = item.reagents[i]▼
-- need to generate the text for the reagent cell before starting the row
local reagentCell = ''
reagentCell = reagentCell .. '[[File:' .. reagent .. '.png|30px|link=' .. reagent .. ']] [[' .. reagent .. ']]<br>'
:tag('span')▼
:done()▼
end
▲ :wikitext("''unknown''")
out
:IF(item.lvl)
:tag('td')
:css{ ['text-align'] = 'center' }
:wikitext(item.lvl)
:done()
Line 205 ⟶ 178:
:tag('td')
:wikitext('[[File:' .. item.name .. '.png|30px|link=' .. item.name .. ']] [[' .. item.name .. ']]')
:done()
:wikitext(currency_cell(item.buy
:wikitext(currency_cell(item.sell
:wikitext(currency_cell(item.profit
:wikitext(currency_cell(item.profitPerHour
:IF(item.XP)
:tag('td')
:wikitext(item.XP and lang:formatNum(tonumber(item.XP)))
:done()
Line 230 ⟶ 203:
:IF(item.XPPerHour)
:tag('td')
:wikitext(item.XPPerHour and lang:formatNum(tonumber(item.XPPerHour)))
:done()
Line 237 ⟶ 209:
:END()
:wikitext(currency_cell(item.profitPerXP
:done()
▲ :wikitext(createReagentCell(i))
end
|