Module:Skillname

-- local loadLib = require('Module:LoadLib') loadLib(_G, {	onmain={ 'Module:Mainonly', field='on_main' }, }) local p = {}

-- Converts Aliases into ID's local aliases = require('Module:Skillname/aliases')

local txtshdw = "; text-shadow: 1px 1px 1px black" local skills = { ['farming']={ name="Farming", nameShort="Frm", icon="Golden Hoe.png", color="gold" },	['mining']={ name="Mining", nameShort="Mng", icon="Stone Pickaxe.png", color="#808080" },	['combat']={ name="Combat", nameShort="Cb", icon="Stone Sword.png", color="gray" },	['foraging']={ name="Foraging", nameShort="Frg", icon="Jungle Sapling.png", color="green" },	['fishing']={ name="Fishing", nameShort="Fng", icon="Fishing Rod.png", color="#FCFFBD" },	['enchanting']={ name="Enchanting", nameShort="Ench", icon="Enchantment Table.png", color="#8A2BE2" },	['alchemy']={ name="Alchemy", nameShort="Alc", icon="Brewing Stand.png", color="yellow" },	['carpentry']={ name="Carpentry", nameShort="Cpt", icon="Crafting Table.png", color="#8B4513" },	['runecrafting']={ name="Runecrafting", nameShort="Rct", icon="Magma_Cream.png", color="pink" },	['taming']={ name="Taming", nameShort="Tmg", icon="Super_Enchanted_Egg.png", color="#eee"..txtshdw },	['dungeoneering']={ name="Dungeoneering", nameShort="Dgnr", icon="Dead Bush.png", color="#F39C12" },	['the catacombs']={ name="Catacombs", nameShort="Cata", icon="The Catacombs.png", color="red" } }

function p.getSkillName(frame) local args = getArgs(frame) local skillid = args[1] local valBefore = args[2] local isShort = yesno(args["short"]) return p._getSkillName(skillid, valBefore, isShort) end

function p.getSkillNameShort(frame) local args = getArgs(frame) local skillid = args[1] local valBefore = args[2] return p._getSkillName(skillid, valBefore, true) end

function p._getSkillName(skillid, valBefore, isShort) checkType(1, skillid, 'string') checkType(2, valBefore, { 'string', 'number'}, true) checkType(3, isShort, 'boolean', true) local skillid, tier = skillid:lower:match('^(.+) ([ivx%d]+)$') tier = string._toRoman(string._toArabic(tier)) skillid = skillid:lower:gsub('_', ' ') skillid = aliases[skillid] or skillid local skill = skills[skillid] if not skill then return string.error("Invalid Skill name %q", skillid) end return string.wrapHtml{ {			string.makeImage(				skill.icon,				{					size=skill.size or "24x24px",					link=skill.name,				}			), string.wrapHtml{' ', " ", {style='font-family:initial;';}}, string.makeLink(skill.name, string.wrapHtml{				{					skill[isShort and 'nameShort' or 'name'], tier and " "..tier or ''				}, ' ', {					style={						color=skill.color					}				}			}), " ", valBefore and string.wrapHtml(valBefore, 'font', {style={color=skill.color}}).."" or " ", },		' ', {			style="whitespace: no-wrap;"; }	} end

-- Template: Skill XP

function p.skillXP (frame) local args = getArgs(frame) local str = args[1] return p._skillXP(str) end function p._skillXP(str) if not str then return string.error('No input found') end str = str:gsub('[%[%],]', '') local num, skill if str:match('%+?(%d[%d%.]*)%s(.*)') then num, skill = str:match('%+?(%d[%d%.]*)%s(.*)') else return string.error('Invalid syntax "'..str..'"') end skill = skill:gsub('%sXP$', '') return table.concat{ '+',		string._formatNum(num), ' ',		'', skill, ' XP' } end

return p