Dota 2 Wiki
Register
mNo edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
local p = {}
 
local p = {}
local get_args = require('Module:Arguments').main
+
local get_args = require('Module:Arguments').getArgs
   
 
local i18n = {
 
local i18n = {
Line 9: Line 9:
   
 
function p.main(frame)
 
function p.main(frame)
local args = get_args(frame)
+
local args = get_args(frame, {
  +
wrappers = {
  +
'Template:Talents'
  +
}
  +
})
 
 
 
local talents = mw.html.create('table')
 
local talents = mw.html.create('table')

Latest revision as of 13:12, 20 April 2018

Documentation for Module:Talents Jump to code ↴ [ edit | purge ]

Reality Rift icon
▶️ Planeshift.
The documentation for this module can be found at Template:Talents.
You may be forwarded to another wiki language, in case a translation is not available.


Dependencies

local p = {}
local get_args = require('Module:Arguments').getArgs

local i18n = {
  talents_article = 'Talents',
  table_title = 'Hero Talents',
}


function p.main(frame)
  local args = get_args(frame, {
    wrappers = {
      'Template:Talents'
    }
  })
  
  local talents = mw.html.create('table')
    :addClass('wikitable')
    :css('text-align', 'center')
    :css('margin-right', '15px')
    -- Add the table header.
    :tag('tr')
      :tag('th')
        :attr('colspan', 3)
        :css('height', '40px')
        :css('background-color', '#0C2A5A')
        :wikitext(string.format('[[%s|<span style="color:white; font-size:14pt;">%s</span>]]', i18n.talents_article, i18n.table_title))
        :done()
      :done()
      :newline()

  for i=4,1,-1 do
    talents
      :tag('tr')
        :tag('td')
          :css('width', '240px')
          :wikitext(frame:expandTemplate({ title = 'Talent class', args = { args['t'..i..'left'], args['v'..i..'left'] }}))
          :done()
        :tag('th')
          :css('padding', '10px')
          :css('background-color', string.format('hsl(217, 76%%, %i%%)', 60-10*i))
          :css('font-size', '13pt')
          :css('color', 'white')
          :wikitext(5+5*i)
          :done()
        :tag('td')
          :css('width', '240px')
          :wikitext(frame:expandTemplate({ title = 'Talent class', args = { args['t'..i..'right'], args['v'..i..'right'] }}))
          :done()
        :done()
        :newline()
  end

  return talents
end


return p