ARK: Survival Evolved Wiki
Advertisement
Версия для печати больше не поддерживается и может содержать ошибки обработки. Обновите закладки браузера и используйте вместо этого функцию печати браузера по умолчанию.

Проверяет, содержит ли имя суффикс DLC , и меняет его на соответствующий значок. Затем возвращает ссылку на имя. Используется различными шаблонами, обрабатывающими суффиксы DLC, такими как Шаблон:ItemLink в приведенном выше примере.

Пример

{{ItemLink|Водянистый Гриб (Aberration)}}

Дает:

Водянистый Гриб (Aberration) Водянистый Гриб Aberration Icon


-- checks if the name contains a DLC-suffix and changes it to the according DLC-icon. then returns a link to name.

local p = {}
function p.link(name, noDlcIcon)
  local icons = {
    -- add name parts that should be replaced with an icon here. Three parts are needed
    -- 1: pattern that needs to be there and that will be replace. Parenthesis need to be escaped with %
    -- 2: icon file name
    -- 3: link name for the icon
    {' %(The Island%)', 'The Island Icon.png', 'The Island'},
    {' %(Scorched Earth%)', 'Scorched Earth Icon.png', 'Scorched Earth'},
    {' %(Aberration%)', 'Aberration Icon.png', 'Aberration'},
    {' %(Extinction%)', 'Extinction Icon.png', 'Extinction'},
    {' %(Genesis: Part 1%)', 'Genesis Part 1 Icon.png', 'Genesis: Часть 1'},
    {' %(Genesis: Часть 1%)', 'Genesis Part 1 Icon.png', 'Genesis: Часть 1'},
    {' %(Genesis: Part 2%)', 'Genesis Part 2 Icon.png', 'Genesis: Часть 2'},
    {' %(Genesis: Часть 2%)', 'Genesis Part 2 Icon.png', 'Genesis: Часть 2'},
    {' %(Primitive Plus%)', 'Primitive Plus Icon.png', 'Primitive Plus'},
    {' %(The Center%)', 'The Center Icon.png', 'The Center'},
    {' %(Ragnarok%)', 'Ragnarok Icon.png', 'Ragnarok'},
    {' %(Valguero%)', 'Valguero Icon.png', 'Valguero'},
    {' %(Crystal Isles%)', 'Crystal Isles Icon.png', 'Crystal Isles'},
    {' %(Lost Island%)', 'Lost Island Icon.png', 'Lost Island'},
    {' %(Mobile%)', 'Logo Mobile.svg', 'ARK: Survival Evolved Mobile|16px'},
    {'Mod:Ebenus Astrum/', 'Ebenus Astrum Icon.png', 'Mod:Ebenus Astrum'},
    {'Mod:Primal Fear/', 'PrimalFearIcon.png', 'Mod:Primal Fear'},
    {'Mod:Ebenus Astrum/', 'Ebenus Astrum Icon.png', 'Mod:Ebenus Astrum'},
    {'Mod:ARK Additions/', 'ARK Additions Icon.png', 'Mod:ARK Additions'},
    {'Mod:Better MEKs!/', 'Mod Better MEKs! Icon.png', 'Mod:Better MEKs!'},
    {'Mod:Steampunk/', 'Mod Steampunk Icon.png', 'Mod:Steampunk'},
    {'Mod:Structures Plus/', 'Structures Plus Icon.png', 'Mod:Structures Plus'},
    {'Mod:Ark Eternal/', 'Mod Ark Eternal Icon.png', 'Mod:Ark Eternal'},
    {'Mod:Archaic Ascension/', 'Mod Archaic Ascension Icon.png', 'Mod:Archaic Ascension'},
    {'Mod:The Chasm/', 'ChasmLogoSmall.jpg', 'Mod:The Chasm'},
    {'Mod:Primal NPCs/', 'Mod Primal NPCs Icon.png', 'Mod:Primal NPCs'},
    {'Mod:Caballus/', 'Mod Caballus Icon.png', 'Mod:Caballus'},
    {'Mod:Prehistoric Beasts/', 'Mod Prehistoric Beasts Icon.png', 'Mod:Prehistoric Beasts'},
    {'Mod:Castles, Keeps, and Forts Remastered/', 'Mod Castles Keeps Forts Architecture Remastered Icon.png', 'Mod:Castles, Keeps, and Forts Remastered'},
    {'Mod:Crystal Isles Dino Collection/', 'Crystal Isles Dino Collection Icon.png', 'Mod:Crystal Isles Dino Collection'},
    {'Mod:Additional Creatures: Grand Hunt/', 'Additional Creatures Grand Hunt Icon.png', 'Mod:Additional Creatures: Grand Hunt'},
    {'Mod:Super Structures/', 'Mod Super Structures icon.png', 'Mod:Super Structures'},
    {'Mod:ARK: The Sunken World/', 'Mod logo.png', 'Mod:ARK: The Sunken World'},
    {'Mod:Fjordur/', 'Mod Fjordur Icon.png', 'Mod:Fjordur'},
	{'Mod:Glacius/', 'Mod Glacius Icon.png', 'Mod:Glacius'},
	{'Mod:Dino Storage/', 'Blank.png', 'Mod:Dino Storage'},
	{'Mod:The Eärrion/', 'Blank.png', 'Mod:The Eärrion'},
  }

  for _,i in ipairs(icons) do
    if string.find(name,i[1]) ~= nil then
      return '[['..name..'|'..string.gsub(name,i[1],'')..']]'.. ((not noDlcIcon) and ' [[File:'..i[2]..'|link='..i[3]..']]' or '')
    end
  end

  -- if no dlc was found, use generic approach
  local title = mw.title.new(name)
  if title == nil then
    return 'page not found: ' .. name
  end
  local link = (#title.nsText > 0) and (title.fullText .. '|' .. title.text) or title.text
  return '[['..link..']]'
end
return p
Advertisement