local p = {}
function p.aptitude(frame)
local data = mw.loadData('Module:Table of aptitudes')
local sp = frame.args[1]
local sk = frame.args[2]
if not sp or not sk then
return ""
end
if sp == "Draconian" then
sp = "Base Draconian"
end
return data[sp][sk]
end
function p.skill_table(frame)
local data = mw.loadData('Module:Table of aptitudes')
local skill = frame.args[1]
local species = {'Human', 'Centaur', 'Demigod', 'Demonspawn',
'Base Draconian', 'Deep Dwarf', 'Deep Elf', 'High Elf',
'Sludge Elf', 'Felid', 'Ghoul', 'Halfling', 'Kobold', 'Merfolk',
'Minotaur', 'Mummy', 'Naga', 'Octopode', 'Ogre', 'Hill Orc',
'Spriggan', 'Tengu', 'Troll', 'Vampire'}
local result = [=[
]=]
for _, sp in ipairs(species) do
result = result .. "| " .. data[sp][skill] .. "\n"
end
result = result .. "|}"
return result
end
function p.aptitude_chart_general(frame)
local data = mw.loadData('Module:Table of aptitudes')
local skill = frame.args[1]
local species = {'Human', 'Centaur', 'Demigod', 'Demonspawn',
'Base Draconian', 'Deep Dwarf', 'Deep Elf', 'High Elf',
'Sludge Elf', 'Felid', 'Ghoul', 'Halfling', 'Kobold', 'Merfolk',
'Minotaur', 'Mummy', 'Naga', 'Octopode', 'Ogre', 'Hill Orc',
'Spriggan', 'Tengu', 'Troll', 'Vampire'}
local skills = {'Armour', 'Dodging', 'Stealth', 'Stabbing',
'Shields', 'Traps', 'Invocations', 'Evocations', 'Hit Points', 'Magic Points', 'Experience'}
local result = [=[
]=]
-- constants used by sort_key
local a_ord = string.byte('a')
local z_ord = string.byte('z')
local aa_ord = string.byte('A')
-- generates the table keys
function sort_key(i)
local result
if i > z_ord - a_ord then
i = i - (z_ord - a_ord) - 1
result = '!' .. string.char(aa_ord + i)
else
result = '"' .. string.char(a_ord + i)
end
return result
end
local i = 0
for _, sp in ipairs(species) do
result = result .. '|
' .. sort_key(i) .. '' .. sp .. "\n"
for _,sk in ipairs(skills) do
result = result .. "||" .. data[sp][sk] .. "\n"
end
result = result .. "|-\n"
i = i + 1
end
result = result .. "|}"
return result
end
function p.aptitude_chart_combat(frame)
local data = mw.loadData('Module:Table of aptitudes')
local skill = frame.args[1]
local species = {'Human', 'Centaur', 'Demigod', 'Demonspawn',
'Base Draconian', 'Deep Dwarf', 'Deep Elf', 'High Elf',
'Sludge Elf', 'Felid', 'Ghoul', 'Halfling', 'Kobold', 'Merfolk',
'Minotaur', 'Mummy', 'Naga', 'Octopode', 'Ogre', 'Hill Orc',
'Spriggan', 'Tengu', 'Troll', 'Vampire'}
local skills = {'Fighting', 'Short Blades', 'Long Blades', 'Maces Flails',
'Axes', 'Polearms', 'Staves', 'Unarmed Combat', 'Throwing', 'Slings', 'Bows', 'Crossbows'}
local result = [=[
]=]
-- constants used by sort_key
local a_ord = string.byte('a')
local z_ord = string.byte('z')
local aa_ord = string.byte('A')
-- generates the table keys
function sort_key(i)
local result
if i > z_ord - a_ord then
i = i - (z_ord - a_ord) - 1
result = '!' .. string.char(aa_ord + i)
else
result = '"' .. string.char(a_ord + i)
end
return result
end
local i = 0
for _, sp in ipairs(species) do
result = result .. '|
' .. sort_key(i) .. '' .. sp .. "\n"
for _,sk in ipairs(skills) do
result = result .. "||" .. data[sp][sk] .. "\n"
end
result = result .. "|-\n"
i = i + 1
end
result = result .. "|}"
return result
end
function p.aptitude_chart_magic(frame)
local data = mw.loadData('Module:Table of aptitudes')
local skill = frame.args[1]
local species = {'Human', 'Centaur', 'Demigod', 'Demonspawn',
'Base Draconian', 'Deep Dwarf', 'Deep Elf', 'High Elf',
'Sludge Elf', 'Felid', 'Ghoul', 'Halfling', 'Kobold', 'Merfolk',
'Minotaur', 'Mummy', 'Naga', 'Octopode', 'Ogre', 'Hill Orc',
'Spriggan', 'Tengu', 'Troll', 'Vampire'}
local skills = {'Spellcasting', 'Conjurations', 'Hexes', 'Charms',
'Summonings', 'Necromancy', 'Translocations', 'Transmutations',
'Fire Magic', 'Ice Magic', 'Air Magic', 'Earth Magic', 'Poison Magic'}
local result = [=[
]=]
-- constants used by sort_key
local a_ord = string.byte('a')
local z_ord = string.byte('z')
local aa_ord = string.byte('A')
-- generates the table keys
function sort_key(i)
local result
if i > z_ord - a_ord then
i = i - (z_ord - a_ord) - 1
result = '!' .. string.char(aa_ord + i)
else
result = '"' .. string.char(a_ord + i)
end
return result
end
local i = 0
for _, sp in ipairs(species) do
result = result .. '|
' .. sort_key(i) .. '' .. sp .. "\n"
for _,sk in ipairs(skills) do
result = result .. "||" .. data[sp][sk] .. "\n"
end
result = result .. "|-\n"
i = i + 1
end
result = result .. "|}"
return result
end
return p