Dota 2 Wiki
Advertisement

Documentação para Módulo:Build order Pular para o código ↴ [ editar | atualizar ]

Reality Rift icon
▶️ Planeshift.
A documentação deste módulo pode ser encontrada em Predefinição:Build order.
Você pode ser redirecionado para uma wiki em outro idioma, se de não houver tradução disponível.


local p = {}
local cargo = mw.ext.cargo
local getArgs = require( 'Módulo:Arguments' ).getArgs

local i18n = {
  default_title = 'Configuração de habilidade',
  talent = 'Talento'
}


function p.main(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Predefinição:Build order'
    }
  })
  return p._main(args)
end

function p._main(args)
  local hero = args.hero or mw.title.getCurrentTitle().baseText
  
  -- Creates a table with the format ["Ability"] = "image"
  local abilities = { [i18n.talent] = 'Ficheiro:Talent icon.png' }
  for k,v in pairs(cargo.query('abilities', 'title, image', { where='_pageName="' .. hero .. '"', groupBy='source, title' })) do
    abilities[v.title] = v.image
  end
  
  local levels = mw.html.create('tr')
  local images = mw.html.create('tr')
  for i=1,25 do
    if args['lvl' .. i] then
      -- Add the current level to the levels row.
      levels:tag('td'):wikitext(i):done()
      -- Add the ability icon to the ability icon row.
      local image = string.format('[[%s|40px|link=%s#%s]]', (abilities[args['lvl' .. i]] or 'Ficheiro:Unknown icon.png'), hero, args['lvl' .. i])
      images:tag('td'):wikitext(image):done()
    end
  end

  local wikitable = mw.html.create('table')
    :addClass('wikitable')
    :css('text-align', 'center')
    -- The table header.
    :newline()
    :tag('tr')
      :tag('th')
        :addClass('header')
        :attr('colspan', 25)
        :wikitext(args.title or i18n.default_title)
        :done()
      :done()
    :newline()
    -- The levels row.
    :node(levels)
    :newline()
    -- The ability icon row.
    :node(images)
    :newline()

  return wikitable
end


return p
Advertisement