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" },	['social']={ name="Social", nameShort="Soc", icon="Emerald.png", color="#55FF55" },	['taming']={ name="Taming", nameShort="Tmg", icon="Taming.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 skill = args[1] local valBefore = args[2] local isShort = yesno(args["short"]) return p._getSkillName(skill, valBefore, isShort) end

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

function p._getSkillName(skill, valBefore, isShort) checkType(1, skill, 'string') checkType(2, valBefore, { 'string', 'number'}, true) checkType(3, isShort, 'boolean', true) local oldSkill = skill local skill, tier = skill:match('^(.+) ([%divxIVX]+)$') skill = (skill or oldSkill):lower tier = string._toRoman(string._toArabic(tier)) skill = skill:lower:gsub('_', ' ') skill = aliases[skill] or skill local skill = skills[skill] if not skill then return string.error("Invalid Skill name %q", skill) 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 ~= 0 and " "..tier or ''				}, ' ', {					style={						color=skill.color					}				}			}), valBefore and ' ' or '', 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) checkType(1, str, 'string') 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 %q', str) end skill = skill:gsub('%sXP$', '') return table.concat{ colorText('Green', '+'..string._formatNum(num)), ' ',		p._getSkillName(skill, 'XP'), } end

return p