Module:Icons: Difference between revisions

Replace _SkillReq with function that handles both realms
No edit summary
(Replace _SkillReq with function that handles both realms)
Line 1,092: Line 1,092:
end
end


function p._SkillReq(skill, level, showText)
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 level = 'Unknown [[Category:Pages with script errors]]' end
result = result.." Level "..level
result = '<span class="img-text">'..result..'</span>'
return result
end
function p.SkillReq(frame)
local args = frame.args ~= nil and frame.args or frame
local skill = args[1]
local level = tonumber(args[2])
local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
return p._SkillReq(skill, level, showText)
end


function p._AbyssalSkillReq(skill, level, showText)
function p._AbyssalSkillReq(skill, level, showText)
Line 1,145: Line 1,128:
end
end


function p._SkillReqNew(skill, level, showText, realmID)
function p._SkillReq(skill, level, showText, realmID)
local realm = realmID or 'melvorD:Melvor'
local realm = realmID or 'melvorD:Melvor'
local link = fixPagename(skill)
local link = fixPagename(skill)
Line 1,183: Line 1,166:
text:wikitext(level)
text:wikitext(level)
return tostring(text)
return tostring(text)
end
function p.SkillReq(frame)
local args = frame.args ~= nil and frame.args or frame
local skill = args[1]
local level = tonumber(args[2])
local realmID = args[3]
local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
return p._SkillReq(skill, level, showText, realmID)
end
end


2,647

edits