Nie podano opisu zmian |
mNie podano opisu zmian |
||
(Nie pokazano 3 wersji utworzonych przez 2 użytkowników) | |||
Linia 2: | Linia 2: | ||
local p = {} |
local p = {} |
||
− | function p.link(name) |
+ | 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 % |
||
− | elseif string.find(name," %(Prymitywność Plus%)") ~= nil then |
||
+ | -- 2: icon file name |
||
⚫ | |||
+ | -- 3: link name for the icon |
||
− | elseif string.find(name," %(Spalona Ziemia%)") ~= nil then |
||
+ | {' %(The Island%)', 'The Island Icon.png', 'Wyspa'}, |
||
⚫ | |||
+ | {' %(Wyspa%)', 'The Island Icon.png', 'Wyspa'}, |
||
− | elseif string.find(name," %(The Center%)") ~= nil then |
||
+ | {' %(Scorched Earth%)', 'Scorched Earth Icon.png', 'Spalona Ziemia'}, |
||
− | return '[['..name..'|'..string.gsub(name,' %(The Center%)','')..']] [[File:The Center Icon.png|link=The Center]]' |
||
⚫ | |||
− | elseif string.find(name," %(Ragnarok%)") ~= nil then |
||
+ | {' %(Aberration%)', 'Aberration Icon.png', 'Aberracja'}, |
||
⚫ | |||
− | + | {' %(Aberracja%)', 'Aberration Icon.png', 'Aberracja'}, |
|
+ | {' %(Extinction%)', 'Extinction Icon.png', 'Wymarcie'}, |
||
− | return '[['..name..'|'..string.gsub(name,' %(Aberracja%)','')..']] [[File:Aberration Icon.png|link=Aberracja]]' |
||
+ | {' %(Wymarcie%)', 'Extinction Icon.png', 'Wymarcie'}, |
||
− | elseif string.find(name," %(Zagłada%)") ~= nil then |
||
+ | {' %(Genesis: Part 1%)', 'Genesis Part 1 Icon.png', 'Genesis: Część 1'}, |
||
− | return '[['..name..'|'..string.gsub(name,' %(Wyginięcie%)','')..']] [[File:Extinction Icon.png|link=Zagłada]]' |
||
+ | {' %(Genesis: Część 1%)', 'Genesis Part 1 Icon.png', 'Genesis: Część 1'}, |
||
− | elseif string.find(name," %(Mobile%)") ~= nil then |
||
+ | {' %(Genesis: Part 2%)', 'Genesis Part 2 Icon.png', 'Genesis: Część 2'}, |
||
⚫ | |||
+ | {' %(Genesis: Część 2%)', 'Genesis Part 2 Icon.png', 'Genesis: Część 2'}, |
||
− | elseif string.find(name,"Mod:Primal Fear ") ~= nil then |
||
+ | {' %(Primitive Plus%)', 'Primitive Plus Icon.png', 'Prymitywność Plus'}, |
||
− | return '[['..name..'|'..string.gsub(name,'Mod:Primal Fear ','')..']] [[File:PrimalFearIcon.png|link=Mod:Primal Fear]]' |
||
⚫ | |||
− | else |
||
+ | {' %(The Center%)', 'The Center Icon.png', 'Centrum'}, |
||
⚫ | |||
+ | {' %(Centrum%)', 'The Center Icon.png', 'Centrum'}, |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | {' %(Valguero%)', 'Valguero Icon.png', 'Valguero'}, |
||
+ | {' %(Crystal Isles%)', 'Crystal Isles Icon.png', 'Crystal Isles'}, |
||
⚫ | |||
+ | {'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 |
||
⚫ | |||
⚫ | |||
end |
end |
||
⚫ | |||
⚫ | |||
end |
end |
||
+ | |||
+ | -- if no dlc was found, use generic approach |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | end |
||
⚫ | |||
⚫ | |||
end |
end |
||
return p |
return p |
Aktualna wersja na dzień 15:22, 4 maj 2021
Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:DLCLink/opis
-- 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', 'Wyspa'},
{' %(Wyspa%)', 'The Island Icon.png', 'Wyspa'},
{' %(Scorched Earth%)', 'Scorched Earth Icon.png', 'Spalona Ziemia'},
{' %(Spalona Ziemia%)', 'Scorched Earth Icon.png', 'Spalona Ziemia'},
{' %(Aberration%)', 'Aberration Icon.png', 'Aberracja'},
{' %(Aberracja%)', 'Aberration Icon.png', 'Aberracja'},
{' %(Extinction%)', 'Extinction Icon.png', 'Wymarcie'},
{' %(Wymarcie%)', 'Extinction Icon.png', 'Wymarcie'},
{' %(Genesis: Part 1%)', 'Genesis Part 1 Icon.png', 'Genesis: Część 1'},
{' %(Genesis: Część 1%)', 'Genesis Part 1 Icon.png', 'Genesis: Część 1'},
{' %(Genesis: Part 2%)', 'Genesis Part 2 Icon.png', 'Genesis: Część 2'},
{' %(Genesis: Część 2%)', 'Genesis Part 2 Icon.png', 'Genesis: Część 2'},
{' %(Primitive Plus%)', 'Primitive Plus Icon.png', 'Prymitywność Plus'},
{' %(Prymitywność Plus%)', 'Primitive Plus Icon.png', 'Prymitywność Plus'},
{' %(The Center%)', 'The Center Icon.png', 'Centrum'},
{' %(Centrum%)', 'The Center Icon.png', 'Centrum'},
{' %(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