Dota 2 Wiki

你现在尚未登录,许多功能可能无法正常使用,若已有账号,请登录,若没有,请先注册Twitch账号
目前我们有非常多的待翻译条目,你也可以看一下目前我们需要优先处理的有哪些目前我们有非常多的待翻译条目,你也可以看一下目前我们需要优先处理的有哪些英雄页面的攻略、克制和物品页面的推荐英雄、小贴士等均为社区玩家编写的,你也可以把自己的心得写上去哦。英雄页面的攻略、克制和物品页面的推荐英雄、小贴士等均为社区玩家编写的,你也可以把自己的心得写上去哦。看不懂技能的buff/debuff是哪个跟哪个?鼠标移动到名称上就能看到游戏内显示的名字和描述了。看不懂技能的buff/debuff是哪个跟哪个?鼠标移动到名称上就能看到游戏内显示的名字和描述了。目前我們沒有善於製作其他中文變體的人員,如果您善於或擁有相關技術,請幫忙補充其他中文變體的空白。目前我們沒有善於製作其他中文變體的人員,如果您善於或擁有相關技術,請幫忙補充其他中文變體的空白。

了解更多

Dota 2 Wiki
Advertisement
Reality Rift icon
▶️ Planeshift.
该module的文档可以在Template:Cosmetic找到。
You may be forwarded to another wiki language, in case a translation is not available.



--------------------------------------------------------------------------------
-- Imports
--------------------------------------------------------------------------------

local cargo = require('Module:Cargo')
local color = require('Module:Color')._main
local fileExists = require('Module:FileExists')
local getArgs = require('Module:Arguments').getArgs

--------------------------------------------------------------------------------
-- Template
--------------------------------------------------------------------------------

local p = {}

function p.main(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Template:Cosmetic'
    }
  })
  return p._main(args)
end

function p._main(args)
  local icon = 'File:Cosmetic icon ' .. args[1] .. '.png'
  local size = args.userparam or args[2] or '100px'
  local border_color = '#a55858'
  local page = args.link or args[1]
  local name = args.text or args[1]

  local output = ( cargo.query('cosmetic_items', 'image, rarity, title', {
    where='_pageName="' .. args[1] .. '"',
    groupBy='_pageID'
  }) or {} )[1]

  if output then
    if output.image then icon = output.image end
    if output.rarity then border_color = color{('cos_' .. output.rarity):lower()} end
    if output.title then name = output.title end
  end

  local image = string.format('[[%s|%s|link=%s|%s]]', icon, size, page, name)
  local link = string.format('[[%s|%s]]', page, name)

  return mw.html.create('div')
    :addClass('cosmetic-label')
    :css('width', size)
    :tag('div')
      :css('box-shadow', '0px 0px 2px 4px ' .. border_color)
      :wikitext(image)
      :done()
    :wikitext(link)
end

--------------------------------------------------------------------------------
-- Return
--------------------------------------------------------------------------------

return p
Advertisement