Module:SkillUnlocks: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 23: Line 23:
local VERBS_PER_SUBTYPE = {
local VERBS_PER_SUBTYPE = {
['Weapon'] = 'Wield',
['Weapon'] = 'Wield',
['Magic Wand'] = 'Wield',
['Magic Staff'] = 'Wield',
['Magic Book'] = 'Wield',
['Armour'] = 'Wear',
['Armour'] = 'Wear',
['Magic Armour'] = 'Wear',
['Ranged Armour'] = 'Wear',
['Ranged Armour'] = 'Wear',
['Slayer Armour'] = 'Wear',
['Slayer Armour'] = 'Wear',
Line 31: Line 35:
['slayerArea'] = 'Access',
['slayerArea'] = 'Access',
['dungeon'] = 'Access'
['dungeon'] = 'Access'
}
local SUBTYPE_OVERRIDES = {
['FrostSpark 1H Sword'] = 'Weapon',
['Lightning Strike 1H Sword'] = 'Weapon',
['Royal Toxins Spear'] = 'Weapon',
['Spectral Ice Sword'] = 'Weapon',
['Ethereal Greataxe'] = 'Weapon',
['Agile Wings Rapier'] = 'Weapon'
}
}


Line 48: Line 60:
local processed = {}
local processed = {}
processed.entity = item
processed.entity = item
processed.entityName = item.name
processed.entityType = 'item'
processed.entityType = 'item'
processed.subType = item.type
processed.subType = item.type
processed.entityName = item.name
processed.skillLevel = Items._getItemStat(item, skillReqLabel)
processed.skillLevel = Items._getItemStat(item, skillReqLabel)
table.insert(entityList, processed)
table.insert(entityList, processed)
Line 73: Line 85:
local processed = {}
local processed = {}
processed.entity = area
processed.entity = area
processed.entityName = area.name
processed.entityType = area.type
processed.entityType = area.type
processed.subType = area.type
processed.subType = area.type
processed.entityName = area.name
for a, req in ipairs(area.entryRequirements) do
for a, req in ipairs(area.entryRequirements) do
if req.type == 'SkillLevel' and req.skillID == Constants.getSkillID(skillName) then
if req.type == 'SkillLevel' and req.skillID == Constants.getSkillID(skillName) then
Line 141: Line 153:
end
end
-- What are you doing with the thing you unlock?
-- What are you doing with the thing you unlock? ("verbs")
-- Override some entities whose types are misleading/wrong
if SUBTYPE_OVERRIDES[entity.entityName] then
entity.subType = SUBTYPE_OVERRIDES[entity.entityName]
end
local verb = ''
local verb = ''
if VERBS_PER_SUBTYPE[entity.subType] then
if VERBS_PER_SUBTYPE[entity.subType] then
73

edits