Module:Skills
Data pulled from Module:GameData
Some skills have their own modules:
- Module:Magic for Magic
- Module:Prayer for Prayer
- Module:Skills/Agility for Agility
- Module:Skills/Summoning for Summoning
- Module:Skills/Gathering for Mining, Fishing, Woodcutting
- Module:Skills/Artisan for Smithing, Cooking, Herblore, etc.
Also be aware of:
- Module:Navboxes for navigation boxes appearing near the bottom of pages
local p = {}
local SkillData = mw.loadData('Module:Skills/data')
local Constants = mw.loadData('Module:Constants/data')
local Shared = require('Module:Shared')
local Items = require('Module:Items')
local Icons = require('Module:Icons')
local MasteryCheckpoints = {.1, .25, .5, .95}
function p.getSkillID(skillName)
for skName, ID in Shared.skpairs(Constants.skill) do
if skName == skillName then
return ID
end
end
return nil
end
function p.getMasteryUnlockTable(frame)
local skillName = frame.args ~= nil and frame.args[1] or frame
local skillID = p.getSkillID(skillName)
if skillID == nil then
return "ERROR: Failed to find a skill ID for "..skillName
end
local unlockTable = SkillData.MasteryUnlocks[skillID]
if unlockTable == nil then
return 'ERROR: Failed to find Mastery Unlock data for '..skillName
end
local result = '{|class="wikitable"\r\n!Level!!Unlock'
for i, unlock in pairs(unlockTable) do
result = result..'\r\n|-'
result = result..'\r\n|'..unlock.level..'||'..unlock.unlock
end
result = result..'\r\n|}'
return result
end
function p.getMasteryCheckpointTable(frame)
local skillName = frame.args ~= nil and frame.args[1] or frame
local skillID = p.getSkillID(skillName)
if skillID == nil then
return "ERROR: Failed to find a skill ID for "..skillName
end
if SkillData.MasteryCheckpoints[skillID] == nil then
return 'ERROR: Failed to find Mastery Unlock data for '..skillName
end
local bonuses = SkillData.MasteryCheckpoints[skillID].bonuses
local totalPoolXP = SkillData.MasteryPoolXP[skillID + 1]
local result = '{|class="wikitable"\r\n!Pool %!!style="width:100px"|Pool XP!!Bonus'
for i, bonus in Shared.skpairs(bonuses) do
result = result..'\r\n|-'
result = result..'\r\n|'..(MasteryCheckpoints[i] * 100)..'%||'
result = result..Shared.formatnum(totalPoolXP * MasteryCheckpoints[i])..' xp||'..bonus
end
result = result..'\r\n|-\r\n!colspan="2"|Total Mastery Pool XP'
result = result..'\r\n|'..Shared.formatnum(totalPoolXP)
result = result..'\r\n|}'
return result
end
return p