73
edits
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
local Items = require('Module:Items') | local Items = require('Module:Items') | ||
local CombatAreas = require('Module:CombatAreas') | local CombatAreas = require('Module:CombatAreas') | ||
local GameData = require('Module:GameData') | |||
local | local SKILL_CHECK_MAP = { | ||
'Slayer'} | ['Attack'] = {}, | ||
['Strength'] = {}, | |||
['Defence'] = {}, | |||
['Hitpoints'] = {}, | |||
['Ranged'] = {}, | |||
['Magic'] = {'spells'}, | |||
['Prayer'] = {}, | |||
['Slayer'] = {'areas'}, | |||
['Farming'] = {}, | |||
['Township'] = {}, | |||
['Woodcutting'] = {}, | |||
['Fishing'] = {}, | |||
['Firemaking'] = {}, | |||
['Cooking'] = {}, | |||
['Mining'] = {}, | |||
['Smithing'] = {}, | |||
['Thieving'] = {}, | |||
['Fletching'] = {}, | |||
['Crafting'] = {}, | |||
['Runecrafting'] = {}, | |||
['Herblore'] = {}, | |||
['Agility'] = {}, | |||
['Summoning'] = {}, | |||
['Astrology'] = {}, | |||
['Alt. Magic'] = {}, | |||
} | |||
local TYPE_SORT_ORDER = { | local TYPE_SORT_ORDER = { | ||
['item'] = | ['spell'] = 1, | ||
['combatArea'] = | ['item'] = 2, | ||
['slayerArea'] = | ['combatArea'] = 3, | ||
['dungeon'] = | ['slayerArea'] = 4, | ||
['dungeon'] = 5 | |||
} | } | ||
local VERBS_PER_SUBTYPE = { | local VERBS_PER_SUBTYPE = { | ||
Line 38: | Line 64: | ||
['combatArea'] = 'Access', | ['combatArea'] = 'Access', | ||
['slayerArea'] = 'Access', | ['slayerArea'] = 'Access', | ||
['dungeon'] = 'Access' | ['dungeon'] = 'Access', | ||
['standard'] = 'Cast', | |||
['aurora'] = 'Cast', | |||
['curse'] = 'Cast', | |||
['ancient'] = 'Cast', | |||
['archaic'] = 'Cast' | |||
} | } | ||
local SUBTYPE_OVERRIDES = { | local SUBTYPE_OVERRIDES = { | ||
Line 800: | Line 831: | ||
end | end | ||
table.insert(entityList, processed) | table.insert(entityList, processed) | ||
end | |||
return entityList | |||
end | |||
function p._addSpellsWithSkillRequirement(entityList, skillName) | |||
local SPELL_TYPES = {'standardSpells', 'auroraSpells', 'curseSpells', 'ancientSpells', 'archaicSpells'} | |||
-- Iterate through each spell type and each spell within that type | |||
for i, spellType in ipairs(SPELL_TYPES) do | |||
for j, spell in ipairs(GameData.rawData[spellType]) do | |||
local processed = {} | |||
processed.entity = spell | |||
processed.entityName = spell.name | |||
processed.entityType = 'spell' | |||
processed.subType = spell.spellBook | |||
processed.skillLevel = spell.level | |||
table.insert(entityList, processed) | |||
end | |||
end | end | ||
Line 816: | Line 866: | ||
if entity.entityType == 'slayerArea' then | if entity.entityType == 'slayerArea' then | ||
iconType = 'combatArea' | iconType = 'combatArea' | ||
end | |||
if entity.entityType == 'spell' and (entity.subType == 'aurora' or entity.subType == 'curse') then | |||
iconType = entity.subType | |||
end | end | ||
Line 832: | Line 885: | ||
return gearSet.verb .. ' ' .. icons .. ' ' .. gearSet.name | return gearSet.verb .. ' ' .. icons .. ' ' .. gearSet.name | ||
end | end | ||
local SOURCE_FUNCS = { | |||
['areas'] = p._addAreasWithSkillRequirement, | |||
['spells'] = p._addSpellsWithSkillRequirement | |||
} | |||
function p._getSkillUnlockTable(skillName) | function p._getSkillUnlockTable(skillName) | ||
-- What do we need to check for this skill? Avoid checking everything for | |||
-- every skill to save time...except for items, because every skill at least | |||
-- What do we need to check for this skill? | -- has skillcapes with a level requirement | ||
-- every skill to save time | |||
local entityList = {} | local entityList = {} | ||
entityList = p._addItemsWithSkillRequirement(entityList, skillName) | |||
for i, dataSource in ipairs(SKILL_CHECK_MAP[skillName]) do | |||
entityList = SOURCE_FUNCS[dataSource](entityList, skillName) | |||
entityList = | |||
end | end | ||
Line 880: | Line 935: | ||
-- Skip this one if it's in a gear set we've already listed | -- Skip this one if it's in a gear set we've already listed | ||
local entityGearSet = nil | local entityGearSet = nil | ||
for i, gearSet in ipairs(GEAR_SETS) do | if entity.entityType == 'item' then | ||
for i, gearSet in ipairs(GEAR_SETS) do | |||
if Shared.contains(gearSet.entities, entity.entityName) then | |||
entityGearSet = gearSet | |||
break | |||
end | |||
end | end | ||
end | end | ||
Line 927: | Line 984: | ||
function p.test() | function p.test() | ||
local ret = {} | local ret = {} | ||
for i, | for i, spell in ipairs(GameData.rawData.standardSpells) do | ||
mw.logObject( | mw.logObject(spell) | ||
end | end | ||
edits