73
edits
No edit summary |
No edit summary |
||
Line 24: | Line 24: | ||
['Prayer'] = {'prayers'}, | ['Prayer'] = {'prayers'}, | ||
['Slayer'] = {'areas'}, | ['Slayer'] = {'areas'}, | ||
['Farming'] = {' | ['Farming'] = {'gatheringitems'}, | ||
['Township'] = {}, | ['Township'] = {}, | ||
['Woodcutting'] = {' | ['Woodcutting'] = {'gatheringitems'}, | ||
['Fishing'] = {' | ['Fishing'] = {'gatheringitems'}, | ||
['Firemaking'] = {'firemaking'}, | ['Firemaking'] = {'firemaking'}, | ||
['Cooking'] = {' | ['Cooking'] = {'artisanitems'}, | ||
['Mining'] = {' | ['Mining'] = {'gatheringitems'}, | ||
['Smithing'] = {' | ['Smithing'] = {'artisanitems'}, | ||
['Thieving'] = {' | ['Thieving'] = {'thieving'}, | ||
['Fletching'] = {' | ['Fletching'] = {'artisanitems'}, | ||
['Crafting'] = {' | ['Crafting'] = {'artisanitems'}, | ||
['Runecrafting'] = {' | ['Runecrafting'] = {'artisanitems'}, | ||
['Herblore'] = {' | ['Herblore'] = {'artisanitems'}, | ||
['Agility'] = {}, | ['Agility'] = {}, | ||
['Summoning'] = {' | ['Summoning'] = {'artisanitems'}, | ||
['Astrology'] = {}, | ['Astrology'] = {'constellations'}, | ||
['Alt. Magic'] = {'altmagic'}, | ['Alt. Magic'] = {'altmagic'}, | ||
} | } | ||
local TYPE_SORT_ORDER = { | local TYPE_SORT_ORDER = { | ||
['spell'] = | ['shop'] = 1, | ||
['prayer'] = | ['spell'] = 2, | ||
['gathering'] = | ['prayer'] = 3, | ||
['artisan'] = | ['gathering'] = 4, | ||
['item'] = | ['artisan'] = 5, | ||
['combatArea'] = | ['item'] = 6, | ||
['slayerArea'] = | ['combatArea'] = 7, | ||
['dungeon'] = | ['slayerArea'] = 8, | ||
['dungeon'] = 9 | |||
} | } | ||
local VERBS_PER_SUBTYPE = { | local VERBS_PER_SUBTYPE = { | ||
Line 89: | Line 90: | ||
['melvorF:SkillPotions'] = 'Brew', | ['melvorF:SkillPotions'] = 'Brew', | ||
['melvorF:CombatPotions'] = 'Brew', | ['melvorF:CombatPotions'] = 'Brew', | ||
['log'] = 'Burn' | ['log'] = 'Burn', | ||
['npc'] = 'Pickpocket', | |||
['constellation'] = 'Study', | |||
['shop'] = 'Purchase' | |||
} | } | ||
local SUBTYPE_OVERRIDES = { | local SUBTYPE_OVERRIDES = { | ||
Line 108: | Line 112: | ||
} | } | ||
local SUBTYPE_SORT_OVERRIDES = { | local SUBTYPE_SORT_OVERRIDES = { | ||
['melvorD:Bars'] = '1', | |||
['melvorF:StandardRunes'] = '1', | ['melvorF:StandardRunes'] = '1', | ||
['log'] = '1' | ['log'] = '1' | ||
Line 865: | Line 870: | ||
return reqs | return reqs | ||
end | |||
function p._addEntities(frame) | |||
local args = frame.args ~= nil and frame.args or frame | |||
local entityList = args[1] | |||
local data = args[2] | |||
local entityType = args.type | |||
local typeParam = args.typeParam | |||
--local passedType = typeParam ~= nil and entity[typeParam] or entityType | |||
local subType = args.subType | |||
local subTypeParam = args.subTypeParam | |||
local otherReqsFunc = args.otherReqsFunc | |||
for i, entity in ipairs(data) do | |||
local processed = {} | |||
processed.entityName = entity.name | |||
processed.entityType = p._getEntityTrueSubtype(typeParam ~= nil and entity[typeParam] or entityType) | |||
processed.subType = subTypeParam ~= nil and entity[subTypeParam] or subType | |||
processed.skillLevel = entity.level | |||
processed.otherReqs = otherReqsFunc ~= nil and otherReqsFunc(entity) or {} | |||
table.insert(entityList, processed) | |||
end | |||
return entityList | |||
end | end | ||
Line 878: | Line 907: | ||
end) | end) | ||
-- TODO: | -- TODO: Squeeze this into _addEntities | ||
for i, item in ipairs(itemList) do | for i, item in ipairs(itemList) do | ||
local processed = {} | local processed = {} | ||
Line 905: | Line 934: | ||
end) | end) | ||
-- TODO: Squeeze this into _addEntities | |||
for i, area in ipairs(areaList) do | for i, area in ipairs(areaList) do | ||
local processed = {} | local processed = {} | ||
processed.entityName = area.name | processed.entityName = area.name | ||
processed.entityType = area.type | processed.entityType = area.type | ||
Line 923: | Line 952: | ||
end | end | ||
function p. | function p._addShopPurchasesWithSkillRequirements(entityList, skillName) | ||
local purchaseList = Shop.getPurchases(function(purchase) | |||
local hasSkillReq = false | |||
for i, req in ipairs(purchase.purchaseRequirements) do | |||
if req.type == 'SkillLevel' and req.skillID == Constants.getSkillID(skillName) then | |||
hasSkillReq = true | |||
end | |||
end | |||
return hasSkillReq | |||
end) | |||
for i, purchase in ipairs(purchaseList) do | |||
for i, | -- Skip skillcapes here, as we handle them with items | ||
if purchase.category ~= 'melvorD:Skillcapes' and purchase.category ~= 'melvorTotH:SuperiorSkillcapes' then | |||
local processed = {} | local processed = {} | ||
processed.entityName = Shop._getPurchaseName(purchase) | |||
processed.entityName = | processed.entityType = 'shop' | ||
processed.entityType = ' | processed.subType = purchase.category | ||
processed.subType = | for a, req in ipairs(purchase.purchaseRequirements) do | ||
processed.skillLevel = | if req.type == 'SkillLevel' and req.skillID == Constants.getSkillID(skillName) then | ||
processed.otherReqs = p. | processed.skillLevel = req.level | ||
end | |||
end | |||
processed.otherReqs = p._getOtherSkillReqs(purchase.purchaseRequirements, skillName) | |||
table.insert(entityList, processed) | table.insert(entityList, processed) | ||
end | end | ||
Line 944: | Line 983: | ||
end | end | ||
function p. | function p._addSpells(entityList, skillName) | ||
-- Alt. Magic is in a separate function | |||
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 | |||
entityList = p._addEntities({entityList, GameData.rawData[spellType], type='spell', subTypeParam='spellBook', otherReqsFunc=p._getSpellReqs}) | |||
end | end | ||
Line 959: | Line 995: | ||
end | end | ||
function p. | function p._addAltMagic(entityList, skillName) | ||
entityList = p._addEntities({entityList, GameData.getSkillData('melvorD:Magic')['altSpells'], type='spell', subType='altMagic', otherReqsFunc=p._getSpellReqs}) | |||
return entityList | |||
end | |||
function p._addPrayers(entityList, skillName) | |||
entityList = p._addEntities({entityList, GameData.rawData.prayers, type='prayer', subType='prayer'}) | |||
return entityList | return entityList | ||
end | end | ||
function p. | function p._addFiremakingActions(entityList, skillName) | ||
for i, fireLog in ipairs(SkillData.Firemaking.logs) do | for i, fireLog in ipairs(SkillData.Firemaking.logs) do | ||
local processed = {} | local processed = {} | ||
Line 989: | Line 1,020: | ||
end | end | ||
function p. | function p._addThievingTargets(entityList, skillName) | ||
entityList = p._addEntities({entityList, SkillData.Thieving.npcs, type='thieving', subType='npc'}) | |||
return entityList | |||
end | |||
function p._addConstellations(entityList, skillName) | |||
entityList = p._addEntities({entityList, SkillData.Astrology.recipes, type='constellation', subType='constellation'}) | |||
return entityList | |||
end | |||
function p._addGatherables(entityList, skillName) | |||
-- Figure out what to look up based on the skill | -- Figure out what to look up based on the skill | ||
local sourceData = {} | local sourceData = {} | ||
Line 1,034: | Line 1,075: | ||
end | end | ||
function p. | function p._addRecipes(entityList, skillName) | ||
-- Figure out what to look up based on the skill | -- Figure out what to look up based on the skill | ||
local sourceData = SkillData[skillName].recipes | local sourceData = SkillData[skillName].recipes | ||
Line 1,062: | Line 1,103: | ||
local SOURCE_FUNCS = { | local SOURCE_FUNCS = { | ||
['areas'] = p._addAreasWithSkillRequirement, | ['areas'] = p._addAreasWithSkillRequirement, | ||
['spells'] = p. | ['spells'] = p._addSpells, | ||
['altmagic'] = p. | ['altmagic'] = p._addAltMagic, | ||
['prayers'] = p. | ['prayers'] = p._addPrayers, | ||
[' | ['gatheringitems'] = p._addGatherables, | ||
[' | ['artisanitems'] = p._addRecipes, | ||
['firemaking'] = p. | ['firemaking'] = p._addFiremakingActions, | ||
['thieving'] = p._addThievingTargets, | |||
['constellations'] = p._addConstellations, | |||
['shop'] = p._addShopPurchasesWithSkillRequirements | |||
} | } | ||
Line 1,180: | Line 1,224: | ||
function p._getSkillUnlockTable(skillName) | function p._getSkillUnlockTable(skillName) | ||
-- What do we need to check for this skill? Avoid checking everything for | -- What do we need to check for this skill? Avoid checking everything for | ||
-- every skill to save time | -- every skill to save time, except for a few broad things | ||
local entityList = {} | local entityList = {} | ||
entityList = p._addItemsWithSkillRequirement(entityList, skillName) | entityList = p._addItemsWithSkillRequirement(entityList, skillName) | ||
entityList = p._addShopPurchasesWithSkillRequirements(entityList, skillName) | |||
for i, dataSource in ipairs(SKILL_CHECK_MAP[skillName]) do | for i, dataSource in ipairs(SKILL_CHECK_MAP[skillName]) do | ||
entityList = SOURCE_FUNCS[dataSource](entityList, skillName) | entityList = SOURCE_FUNCS[dataSource](entityList, skillName) |
edits