Module:Augmented perks

local p = {}

-- use regex/txt tools to lc and remove - and .*ed local alias = { ['2h'] = '2h', ['twohand'] = '2h', mh = 'mh', ['1h'] = 'mh', ['onehand'] = 'mh', ['mainhand'] = 'mh', oh = '2h', ['offhand'] = 'oh', legs = 'armour', body = 'armour', armour = 'armour', defender = 'defender', shieldbow = 'shieldbow', hatchet = 'tool', pickaxe = 'tool', tool = 'tool' }

-- gizmo type, gizmo quantity, item type, short item type, txt override for second sentence of first paragraph local data = { ['2h'] = { gizmo = 'Weapon', qty = 2, itype = 'a two-handed weapon', sitype = 'weapon', },	mh = { gizmo = 'Weapon', qty = 1, itype = 'a main-hand weapon', sitype = 'weapon', },	oh = { gizmo = 'Weapon', qty = 1, itype = 'an off-hand weapon', sitype = 'weapon', },	armour = { gizmo = 'Armour', qty = 2, itype = 'armour', sitype = 'armour', },	tool = { gizmo = 'Tool', qty = 2, itype = 'a skilling tool', sitype = 'tool', },	defender = { gizmo = 'Weapon gizmo|Weapon]] and [[Armour', qty = 1, txt = 'As a defender, the %s can hold one gizmo of either type, allowing up to 2 perks.', itype = 'a defender', sitype = 'defender', },	shieldbow = { gizmo = 'Weapon gizmo|Weapon]] and [[Armour', qty = 2, txt = 'As a shieldbow, the %s can hold one gizmo of each type, allowing up to 4 perks (2 perks each).', itype = 'a shieldbow', sitype = 'weapon', }, }

p.main = function(frame) local args = frame:getParent.args local lang = mw.getContentLanguage return p._main(args.type or args[1] or '2h', args.name or args[2] or lang:lcfirst(mw.title.getCurrentTitle.text)) end

p._main = function(t, name) local d	t = t:lower:gsub('-',):gsub('ed$', ) d = data[t] if d == nil then d = data['2h'] end local s = {} table.insert(s, string.format("%s gizmos charged with perks can be used to enhance the %s's abilities.", d.gizmo, d.sitype)) if d.text then table.insert(s, string.format(d.text, name)) else local s1,s2 = ,  if d.qty > 1 then s1 = 's'			s2 = ' (2 perks each)' end table.insert(s, string.format("As %s, the %s can hold %s gizmo%s, allowing up to %s perks%s.", d.itype, name, d.qty, s1, d.qty*2, s2)) end table.insert(s, '\n\n') table.insert(s, string.format("Using this %s in combat can gain experience to increase its level. Levelling the %s will have no effect on its ability in combat, but it will improve the experience and materials gained for disassembling it.", d.sitype, d.sitype))

return table.concat(s, '') end

-- Weapon gizmos charged with perks can be used to enhance the weapon's abilities. As a two-handed item, the Augmented noxious staff can hold 2 gizmos, allowing up to 4 perks (2 perks each).

-- Using this weapon in combat can gain experience to increase its level. Levelling the weapon will have no effect on its ability in combat, but it will improve the experience and materials gained for disassembling it.

return p