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)
  if string.find(name," %(The Island%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(The Island%)','')..']]'.. ((not noDlcIcon) and ' [[File:The Island Icon.png|link=The Island]]' or '')
  elseif string.find(name," %(Primitive Plus%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(Primitive Plus%)','')..']]'.. ((not noDlcIcon) and ' [[File:Primitive Plus Icon.png|link=Primitive Plus]]' or '')
  elseif string.find(name," %(Scorched Earth%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(Scorched Earth%)','')..']]'.. ((not noDlcIcon) and ' [[File:Scorched Earth Icon.png|link=Scorched Earth]]' or '')
  elseif string.find(name," %(The Center%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(The Center%)','')..']]'.. ((not noDlcIcon) and ' [[File:The Center Icon.png|link=The Center]]' or '')
  elseif string.find(name," %(Ragnarok%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(Ragnarok%)','')..']]'.. ((not noDlcIcon) and ' [[File:Ragnarok Icon.png|link=Ragnarok]]' or '')
  elseif string.find(name," %(Valguero%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(Valguero%)','')..']]'.. ((not noDlcIcon) and ' [[File:Valguero Icon.png|link=Valguero]]' or '')
  elseif string.find(name," %(Aberration%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(Aberration%)','')..']]'.. ((not noDlcIcon) and ' [[File:Aberration Icon.png|link=Aberration]]' or '')
  elseif string.find(name," %(Extinction%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(Extinction%)','')..']]'.. ((not noDlcIcon) and ' [[File:Extinction Icon.png|link=Extinction]]' or '')
  elseif string.find(name," %(Genesis%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(Genesis%)','')..']]'.. ((not noDlcIcon) and ' [[File:Genesis Icon.png|link=Genesis]]' or '')
  elseif string.find(name," %(Mobile%)") ~= nil then
    return '[['..name..'|'..string.gsub(name,' %(Mobile%)','')..']]'.. ((not noDlcIcon) and ' [[File:Logo Mobile.svg|link=ARK: Survival Evolved Mobile|16px]]' or '')
  elseif string.find(name,"Mod:Primal Fear ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Primal Fear ','')..']]'.. ((not noDlcIcon) and ' [[File:PrimalFearIcon.png|link=Mod:Primal Fear]]' or '')
  elseif string.find(name,"Mod:Ebenus Astrum/") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Ebenus Astrum/','')..']]'.. ((not noDlcIcon) and ' [[File:Ebenus Astrum Icon.png|link=Mod:Ebenus Astrum]]' or '')
  elseif string.find(name,"Mod:ARK Additions ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:ARK Additions ','')..']]'.. ((not noDlcIcon) and ' [[File:ARK Additions Icon.png|link=Mod:ARK Additions]]' or '')
  elseif string.find(name,"Mod:Better MEKs! ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Better MEKs! ','')..']]'.. ((not noDlcIcon) and ' [[File:Mod Better MEKs! Icon.png|link=Mod:Better MEKs!]]' or '')
  elseif string.find(name,"Mod:Crystal Isles ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Crystal Isles ','')..']]'.. ((not noDlcIcon) and ' [[File:Mod Crystal Isles Icon.png|link=Mod:Crystal Isles]]' or '')
  elseif string.find(name,"Mod:Steampunk ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Steampunk ','')..']]'.. ((not noDlcIcon) and ' [[File:Mod Steampunk Icon.png|link=Mod:Steampunk]]' or '')
  elseif string.find(name,"Mod:S+") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:','')..']]'.. ((not noDlcIcon) and ' [[File:Structures Plus Icon.png|link=Mod:Structures Plus]]' or '')
  elseif string.find(name,"Mod:Platforms Plus ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Platforms Plus ','')..']]'.. ((not noDlcIcon) and ' [[File:Platforms Plus Icon.png|link=Mod:Platforms Plus]]' or '')
  elseif string.find(name,"Mod:Ark Eternal ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Ark Eternal ','')..']]'.. ((not noDlcIcon) and ' [[File:Mod Ark Eternal Icon.png|link=Mod:Ark Eternal]]' or '')
  elseif string.find(name,"Mod:Archaic Ascension ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Archaic Ascension ','')..']]'.. ((not noDlcIcon) and ' [[File:Mod Archaic Ascension Icon.png|link=Mod:Archaic Ascension]]' or '')
  elseif string.find(name,"Mod:The Chasm ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:The Chasm ','')..']]'.. ((not noDlcIcon) and ' [[File:ChasmLogoSmall.jpg|link=Mod:The Chasm]]' or '')
  elseif string.find(name,"Mod:Primal NPCs ") ~= nil then
    return '[['..name..'|'..string.gsub(name,'Mod:Primal NPCs ','')..']]'.. ((not noDlcIcon) and ' [[File:File:Mod Primal NPCs.png|link=Mod:Primal NPCs]]' or '')
  else
    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
end
return p
Advertisement