Dota 2 Wiki

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

了解更多

Dota 2 Wiki
Advertisement

Displays a navbox for cosmetic items sorted by their rarity.

Usage[]

{{#invoke:Cosmetic rarity navbox|main
| name = 
| title = 
| border = 
| state = 
| where = 
| size = 
}}
  • |where= is a Cargo where clause with %s in place of the rarity (e.g. |where = type="Ward" AND rarity="%s").
  • |size= sets the size of the individual cosmetic items.
  • |name=, |title=, |border= and |state= are identical to {{Navbox}}.

Example[]



local p = {}

local cargo_query = mw.ext.cargo.query
local cosmetic = require( 'Module:Cosmetic' )._main
local getArgs = require( 'Module:Arguments' ).getArgs

local en_name = {
  ['普通'] = 'Common',
  ['罕见'] = 'Uncommon',
  ['稀有'] = 'Rare',
  ['神话'] = 'Mythical',
  ['传说'] = 'Legendary',
  ['至宝'] = 'Arcana',
  ['不朽'] = 'Immortal',
  ['远古'] = 'Ancient',
  ['赛季'] = 'Seasonal',
  ['刀塔Plus'] = 'Dota Plus Access',
}


function p.main( frame )
  local args = getArgs( frame )

  local rarities = { '普通', '罕见', '稀有', '神话', '传说', '不朽', '至宝', '远古', '赛季', '刀塔Plus' }

  local template_args = {
    name = args.name,
    border = args.border,
    state = args.state or 'uncollapsed',
    style = 'text-align: center;',
    title = args.title
  }
  
  for i,rarity in ipairs( rarities ) do
    local items = cargo_query( 'cosmetic_items', '_pageName', {
      where = string.format( args.where, en_name[rarity] ),
      groupBy = '_pageID'
    } )
    local cosmetics = {}
    for _,v in ipairs( items ) do
      cosmetics[#cosmetics+1] = tostring( cosmetic{ v._pageName, args.size } )
    end
    
    template_args['group' .. i] = rarity
    template_args['list' .. i] = table.concat( cosmetics, ' ' )
  end

  return frame:expandTemplate{ title = 'Navbox', args = template_args }
end


return p
Advertisement