ARK: Survival Evolved Wiki
登録
Advertisement

このモジュールについての説明文ページを モジュール:DLCLink/doc に作成できます

-- 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: Part 1'},
    {' %(Genesis: Part 2%)', 'Genesis Part 2 Icon.png', 'Genesis: Part 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'},
    {' %(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'},
  }

  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