Module:Icons: Difference between revisions

no edit summary
(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'
--melvorItA:Abyssal
local link = fixPagename(skill)
--melvorD:Melvor
local ext = typeExtOverrides['skill'][skill] or extOverrides.type['skill']
 
local altText = (showText and '') or skill
local altText = (showText and '') or skill
local result = p.Icon({skill, type='skill', notext=(showText and '' or true), nospan=true, alt=altText})
if level == nil then  
if level == nil then  
level = 'Unknown [[Category:Pages with script errors]]'  
level = 'Unknown [[Category:Pages with script errors]]'  
end
end
result = result.." Level "..level


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)
result = '<span class="img-text">'..result..'</span>'
return result
if showText == true then
end
text:wikitext(' [[' .. link .. ']]')
 
end
function p.SkillReqNew(frame)
if realm == 'melvorItA:Abyssal' then
text:wikitext(" Abyssal Level ")
else
text:wikitext(" Level ")
end
text:wikitext(level)
return tostring(text)
end
end


2,875

edits