Módulo:Criação de benefícios
Ir para navegação
Ir para pesquisar
Documentação do módulo
Esta documentação é transcluída de Predefinição:Sem documentação/doc. [editar] [atualizar]
Este módulo não possui nenhuma documentação. Por favor, considere adicionar uma documentação em Módulo:Criação de benefícios/doc. [editar]
Módulo:Criação de benefícios's a função main é invocada por Predefinição:Criação de benefícios.
Módulo:Criação de benefícios carrega dados de Módulo:Benefícios/data.
Módulo:Criação de benefícios carrega dados de Módulo:Benefícios/materiais.
-- <pre>
local p = {}
local mdata = mw.loadData('Módulo:Benefícios/materiais')
local pdata = mw.loadData('Módulo:Benefícios/data')
local checkmark = '[[Ficheiro:Sim.svg|18px|center|link=]]'
function p.main(frame)
local arg = frame:getParent().args[1] or ''
local _arg = mw.text.decode(arg)
_arg = string.lower(_arg)
_arg = _arg:gsub('%(benefício%)','')
_arg = mw.text.trim(_arg)
local argdata = pdata[_arg]
if not argdata then
return 'Nenhum benefício como '..arg
end
local ret = mw.html.create('table')
:addClass('wikitable perklist perklist-creation')
:tag('tr')
:tag('th')
:attr('colspan','2')
:attr('rowspan','3')
:wikitext('Material')
:done()
:tag('th')
:attr('rowspan','3')
:wikitext('Raridade')
:done()
:tag('th')
:attr('colspan','14')
:wikitext('Classes do benefício com X materiais')
:done()
:done()
:tag('tr')
:tag('th')
:attr('colspan','5')
:wikitext("Aparato normal")
:done()
:tag('th')
:attr('colspan','9')
:addClass('perklist-ancient')
:wikitext("Aparato antigo")
:done()
:done()
:tag('tr')
:tag('th')
:css('width','35px')
:wikitext('1')
:done()
:tag('th')
:css('width','35px')
:wikitext('2')
:done()
:tag('th')
:css('width','35px')
:wikitext('3')
:done()
:tag('th')
:css('width','35px')
:wikitext('4')
:done()
:tag('th')
:css('width','35px')
:wikitext('5')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('1')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('2')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('3')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('4')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('5')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('6')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('7')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('8')
:done()
:tag('th')
:css('width','35px')
:addClass('perklist-ancient')
:wikitext('9')
:done()
:done()
local listmats = {}
for x, v in pairs(mdata) do
if v.perks[_arg] then
table.insert(listmats,{ v.name, v.rarity, v.perks[_arg], v.ancientperks[_arg] })
end
end
for x, v in pairs(listmats) do
local newrow = ret:tag('tr')
local matname = v[1]
local matrarity = v[2]
newrow
:tag('td')
:css('padding','4px')
:wikitext(string.format('[[Arquivo:%s.png|link=%s|center]]',matname,matname))
:done()
:tag('td')
:wikitext(string.format('[[%s]]',matname))
:done()
:tag('td')
:wikitext(v[2])
:done()
for _, w in ipairs(v[3]) do
local a,b = w[1],w[2]
local c
if a == b then
c = a
else
c = mw.ustring.format('%s–%s',a,b)
end
local newtd = newrow:tag('td')
newtd:addClass('perklist-ancient')
if c == 0 then
newtd:addClass('table-na')
end
newtd:css({ ['text-align'] = 'right' })
:wikitext(c)
:done()
end
for _, w in ipairs(v[4]) do
local a,b = w[1],w[2]
local c
if a == b then
c = a
else
c = mw.ustring.format('%s–%s',a,b)
end
local newtd = newrow:tag('td')
if c == 0 then
newtd:addClass('table-na')
end
newtd:css({ ['text-align'] = 'right' })
:wikitext(c)
:done()
end
newrow:done()
end
return ret
end
return p