Dota 2 Вики
мНет описания правки
мНет описания правки
Строка 1: Строка 1:
 
local p = {}
 
local p = {}
local getArgs = require('Модуль:Arguments').main
+
local colors = mw.loadData('Модуль:Color/data')
  +
local getArgs = require('Модуль:Arguments').getArgs
   
local colors = {
 
-- GENERAL WIKI COLORS
 
["wiki1"] = "#B44335",
 
["wiki2"] = "#CD5F51",
 
["wiki3"] = "#FFAEA3",
 
["wiki4"] = "#FDE6E3",
 
["wiki5"] = "#E4C62E",
 
["wiki6"] = "#E38800",
 
-- DOTA 2 UI
 
["ui1"] = "#1B1E21",
 
["ui2"] = "#2F363D",
 
-- HEROES
 
["strength"] = "#B9500B",
 
["agility"] = "#167C13 ",
 
["intelligence"] = "#257DAE",
 
["сила"] = "#B9500B",
 
["ловкость"] = "#167C13",
 
["интеллект"] = "#257DAE",
 
["radiant"] = "#598307",
 
["свет"] = "#598307",
 
["dire"] = "#A83806",
 
["тьма"] = "#A83806",
 
["neutral"] = "#434137",
 
-- UNITS
 
["creep"] = "#2277AA",
 
["крип"] = "#2277AA",
 
["creep-hero"] = "#FFBE66",
 
["крип-герой"] = "#FFBE66",
 
["lane creep"] = "#2277AA",
 
["линейный крип"] = "#2277AA",
 
["jungle creep"] = "#2277AA",
 
["лесной крип"] = "#2277AA",
 
["ancient creep"] = "#2277AA",
 
["древний крип"] = "#2277AA",
 
["summon"] = "#FFBE66",
 
["призываемое существо"] = "#FFBE66",
 
["ward"] = "#64D74A",
 
["вард"] = "#64D74A",
 
["building"] = "#2277AA",
 
["строение"] = "#2277AA",
 
["other"] = "pink",
 
["другое"] = "pink",
 
["courier"] = "#FFBE66",
 
["курьер"] = "#FFBE66",
 
-- ABILITIES
 
["hero"] = "#B44335",
 
["герой"] = "#B44335",
 
["ultimate"] = "#414141",
 
["ульт"] = "#414141",
 
["item"] = "#227722",
 
["предмет"] = "#227722",
 
["npc"] = "#2277AA",
 
["нип"] = "#2277AA",
 
["aghanims"] = "#5B388F",
 
["talent"] = "#BDB76B",
 
["талант"] = "#BDB76B",
 
["rune"] = "#E3B505",
 
["руна"] = "#E3B505",
 
-- ITEMS
 
["gold"] = "#DAA520",
 
["золото"] = "#DAA520",
 
["armor"] = "#B911FC",
 
["броня"] = "#B911FC",
 
["caster"] = "#1A88FC",
 
["магия"] = "#1A88FC",
 
["support"] = "#1A88FC",
 
["поддержка"] = "#1A88FC",
 
["artifacts"] = "#DB9702",
 
["артефакты"] = "#DB9702",
 
["common"] = "#2BAC00",
 
["общее"] = "#2BAC00",
 
["basic"] = "#FEFEFE",
 
["attributes"] = "#FEFEFE",
 
["атрибуты"] = "#FEFEFE",
 
["armaments"] = "#FEFEFE",
 
["вооружение"] = "#FEFEFE",
 
["arcane"] = "#FEFEFE",
 
["мистика"] = "#FEFEFE",
 
-- COSMETIC ITEMS - RARITY
 
["cos_common"] = "#b0c3d9",
 
["cos_uncommon"] = "#5e98d9",
 
["cos_rare"] = "#4b69ff",
 
["cos_mythical"] = "#8847ff",
 
["cos_legendary"] = "#d32ce6",
 
["cos_ancient"] = "#eb4b4b",
 
["cos_immortal"] = "#b28a33",
 
["cos_arcana"] = "#ade55c",
 
["cos_seasonal"] = "#FFF34F",
 
-- COSMETIC ITEMS - QUALITY
 
["cos_normal"] = "#B2B2B2",
 
["cos_genuine"] = "#4D7455",
 
["cos_elder"] = "#476291", -- Internal name: vintage
 
["cos_unusual"] = "#8650AC",
 
["cos_unique"] = "#D2D2D2",
 
["cos_community"] = "#70B04A",
 
["cos_developer"] = "#A50F79",
 
["cos_selfmade"] = "#70B04A",
 
["cos_customized"] = "#00FF00",
 
["cos_inscribed"] = "#CF6A32", -- Internal name: strange
 
["cos_completed"] = "#8650AC",
 
["cos_cursed"] = "#8650AC",
 
["cos_heroic"] = "#8650AC", -- Internal name: tournament
 
["cos_favored"] = "#FFFF00",
 
["cos_ascendant"] = "#EB4B4B",
 
["cos_autographed"] = "#ADE55C",
 
["cos_legacy"] = "#FFFFFF",
 
["cos_exalted"] = "#CCCCCC",
 
["cos_frozen"] = "#4682B4",
 
["cos_corrupted"] = "#A52A2A",
 
["cos_auspicious"] = "#32CD32", -- Internal name: lucky
 
["cos_unusual_text"] = "#e4ae39",
 
-- RANKINGS
 
["proceed"] = "#CFC",
 
["up"] = "#CFC",
 
["stayup"] = "#EFA",
 
["stay"] = "#FF9",
 
["staydown"] = "#FDA",
 
["drop"] = "#FCC",
 
["down"] = "#FCC"
 
}
 
   
function p.main()
+
function p.main(frame)
local args = getArgs()
+
local args = getArgs(frame, {
  +
wrappers = {
return mw.text.nowiki(p._main(args))
 
  +
'Шаблон:Color'
end
 
 
}
  +
})
   
function p._main(args)
+
local success, result = pcall(p._main, args)
if args[1] then
+
if success then
 
return mw.text.nowiki(result)
local input = string.lower(args[1])
 
 
-- Make the table return the input if no entry was found.
 
setmetatable(colors, { __index = function() return input end })
 
 
return colors[input]
 
 
else
 
else
 
-- Returning an empty string to prevent old templates from breaking.
 
-- Returning an empty string to prevent old templates from breaking.
-- TODO: Update all templates and remove this (replace with assert).
+
-- TODO: Update all templates.
 
return ''
 
return ''
 
end
 
end
 
end
  +
  +
function p._main(args)
  +
assert(args[1], 'Нет ввода')
  +
return colors[args[1]:lower()] or args[1]
 
end
 
end
   

Версия от 17:30, 20 апреля 2018

Документация для Модуль:Color Перейти к коду ↴ [ править | очистить ]

Reality Rift icon
▶️ Planeshift.
Документацию для этого шаблона или модуля можно найти в Template:Color.
Вы можете быть перенаправлены на другой язык вики, если перевод недоступен.


Зависимости

local p = {}
local colors = mw.loadData('Модуль:Color/data')
local getArgs = require('Модуль:Arguments').getArgs


function p.main(frame)
  local args = getArgs(frame, {
    wrappers = {
      'Шаблон:Color'
    }
  })

  local success, result = pcall(p._main, args)
  if success then
    return mw.text.nowiki(result)
  else
    -- Returning an empty string to prevent old templates from breaking.
    -- TODO: Update all templates.
    return ''
  end
end

function p._main(args)
  assert(args[1], 'Нет ввода')
  return colors[args[1]:lower()] or args[1]
end


return p