2,875
edits
(Add function to return skill icon based on realm) |
No edit summary |
||
Line 1,147: | Line 1,147: | ||
function p._SkillReqNew(skill, level, showText, realmID) | function p._SkillReqNew(skill, level, showText, realmID) | ||
local realm = realmID or 'melvorD:Melvor' | local realm = realmID or 'melvorD:Melvor' | ||
local link = fixPagename(skill) | |||
local ext = typeExtOverrides['skill'][skill] or extOverrides.type['skill'] | |||
local altText = (showText and '') or skill | local altText = (showText and '') or skill | ||
if level == nil then | if level == nil then | ||
level = 'Unknown [[Category:Pages with script errors]]' | level = 'Unknown [[Category:Pages with script errors]]' | ||
end | end | ||
local html = mw.html.create('span') | -- Create skill image. | ||
local img = mw.html.create() | |||
if realm == 'melvorItA:Abyssal' then | |||
img:addClass('abyss-icon') | |||
end | |||
img :wikitext('[[File:'):wikitext(link):wikitext('_(skill).'):wikitext(ext) | |||
:wikitext('|25x25px|link='):wikitext(link) | |||
:wikitext('|alt='):wikitext(altText) | |||
:wikitext(']]') | |||
-- Create text and add image. | |||
local text = mw.html.create('span') | |||
:addClass('img-text') | :addClass('img-text') | ||
:node(img) | |||
if showText == true then | |||
text:wikitext(' [[' .. link .. ']]') | |||
end | |||
if realm == 'melvorItA:Abyssal' then | |||
text:wikitext(" Abyssal Level ") | |||
else | |||
text:wikitext(" Level ") | |||
end | |||
text:wikitext(level) | |||
return tostring(text) | |||
end | end | ||
edits