Module:Build order

From Dota 2 Wiki
Jump to: navigation, search

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

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


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

local i18n = {
  default_title = 'Skill Build',
  talent = 'Talent'

function p.main(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Template:Build order'
  return p._main(args)

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] = 'File: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
  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.
      -- Add the ability icon to the ability icon row.
      local image = string.format('[[%s|40px|link=%s#%s]]', (abilities[args['lvl' .. i]] or 'File:Unknown icon.png'), hero, args['lvl' .. i])

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

  return wikitable

return p