17,101
edits
No edit summary |
(Lazy patch of Magic & attempt to remove entities with abyssal level requirements. Stopgap solution until alternative developed) |
||
Line 14: | Line 14: | ||
local CombatAreas = require('Module:CombatAreas') | local CombatAreas = require('Module:CombatAreas') | ||
local Shop = require('Module:Shop') | local Shop = require('Module:Shop') | ||
local Magic = require('Module:Magic') | |||
local Township = require('Module:Township') | local Township = require('Module:Township') | ||
local GameData = require('Module:GameData') | local GameData = require('Module:GameData') | ||
Line 922: | Line 923: | ||
local subTypeParam = args.subTypeParam | local subTypeParam = args.subTypeParam | ||
local otherReqsFunc = args.otherReqsFunc | local otherReqsFunc = args.otherReqsFunc | ||
local imgType = args.imgType | |||
for i, entity in ipairs(data) do | for i, entity in ipairs(data) do | ||
Line 930: | Line 932: | ||
processed.skillLevel = entity.level | processed.skillLevel = entity.level | ||
processed.otherReqs = otherReqsFunc ~= nil and otherReqsFunc(entity) or {} | processed.otherReqs = otherReqsFunc ~= nil and otherReqsFunc(entity) or {} | ||
processed.imgType = imgType | |||
table.insert(entityList, processed) | table.insert(entityList, processed) | ||
end | end | ||
Line 942: | Line 945: | ||
if item.golbinRaidExclusive ~= nil and item.golbinRaidExclusive then | if item.golbinRaidExclusive ~= nil and item.golbinRaidExclusive then | ||
return false | return false | ||
end | |||
if item.equipRequirements ~= nil then | |||
for i, req in ipairs(item.equipRequirements) do | |||
if req.type == 'AbyssalLevel' then | |||
return false | |||
end | |||
end | |||
end | end | ||
Line 1,054: | Line 1,065: | ||
function p._addAgilityObstaclesWithSkillRequirements(entityList, skillName) | function p._addAgilityObstaclesWithSkillRequirements(entityList, skillName) | ||
for i, obstacle in ipairs( | local obstacles = GameData.getEntities(SkillData.Agility.obstacles, | ||
function(obst) | |||
return obst.abyssalLevel == nil | |||
end | |||
) | |||
for i, obstacle in ipairs(obstacles) do | |||
for j, req in ipairs(obstacle.skillRequirements) do | for j, req in ipairs(obstacle.skillRequirements) do | ||
-- Does this obstacle require the current skill? | -- Does this obstacle require the current skill? | ||
Line 1,083: | Line 1,099: | ||
function p._addSpells(entityList, skillName) | function p._addSpells(entityList, skillName) | ||
-- Iterate through each spell type and each spell within that type | -- Iterate through each spell type and each spell within that type | ||
for i, | for i, spellBookDef in ipairs(Magic.spellBooks) do | ||
entityList = p._addEntities({entityList, | local bookID = spellBookDef.id | ||
-- Alt. Magic is in a separate function | |||
if bookID ~= 'altMagic' then | |||
local entList = GameData.getEntities(Magic.getSpellsBySpellBook(bookID), | |||
function(spell) | |||
return spell.abyssalLevel == nil | |||
end | |||
) | |||
entityList = p._addEntities({entityList, entList, type='spell', subTypeParam='spellBook', imgType = spellBookDef.imgType, otherReqsFunc=p._getSpellReqs}) | |||
end | |||
end | end | ||
Line 1,095: | Line 1,117: | ||
function p._addAltMagic(entityList, skillName) | function p._addAltMagic(entityList, skillName) | ||
entityList = p._addEntities({entityList, | local entList = GameData.getEntities(Magic.getSpellsBySpellBook('altMagic'), | ||
function(spell) | |||
return spell.abyssalLevel == nil | |||
end | |||
) | |||
entityList = p._addEntities({entityList, entList, type='spell', subType='altMagic', imgType = 'spell', otherReqsFunc=p._getSpellReqs}) | |||
return entityList | return entityList | ||
end | end | ||
function p._addPrayers(entityList, skillName) | function p._addPrayers(entityList, skillName) | ||
entityList = p._addEntities({entityList, | local entList = GameData.getEntities('prayers', | ||
function(prayer) | |||
return prayer.abyssalLevel == nil | |||
end | |||
) | |||
entityList = p._addEntities({entityList, entList, type='prayer', subType='prayer'}) | |||
return entityList | return entityList | ||
end | end | ||
function p._addFiremakingActions(entityList, skillName) | function p._addFiremakingActions(entityList, skillName) | ||
for i, fireLog in ipairs( | local fireLogs = GameData.getEntities(SkillData.Firemaking.logs, | ||
function(log) | |||
return log.abyssalLevel == nil | |||
end | |||
) | |||
for i, fireLog in ipairs(fireLogs) do | |||
local processed = {} | local processed = {} | ||
local logItem = Items.getItemByID(fireLog.logID) | local logItem = Items.getItemByID(fireLog.logID) | ||
Line 1,120: | Line 1,157: | ||
function p._addThievingTargets(entityList, skillName) | function p._addThievingTargets(entityList, skillName) | ||
entityList = p._addEntities({entityList, | local entList = GameData.getEntities(SkillData.Thieving.npcs, | ||
function(npc) | |||
return npc.abyssalLevel == nil | |||
end | |||
) | |||
entityList = p._addEntities({entityList, entList, type='thieving', subType='npc'}) | |||
return entityList | return entityList | ||
end | end | ||
function p._addConstellations(entityList, skillName) | function p._addConstellations(entityList, skillName) | ||
entityList = p._addEntities({entityList, | local entList = GameData.getEntities(SkillData.Astrology.recipes, | ||
function(const) | |||
return const.abyssalLevel == nil | |||
end | |||
) | |||
entityList = p._addEntities({entityList, entList, type='constellation', subType='constellation'}) | |||
return entityList | return entityList | ||
end | end | ||
Line 1,224: | Line 1,271: | ||
sourceData = SkillData.Farming.recipes | sourceData = SkillData.Farming.recipes | ||
end | end | ||
sourceData = GameData.getEntities(sourceData, | |||
function(obj) | |||
return obj.abyssalLevel == nil | |||
end | |||
) | |||
for i, node in ipairs(sourceData) do | for i, node in ipairs(sourceData) do | ||
Line 1,256: | Line 1,309: | ||
function p._addRecipes(entityList, skillName) | 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 = GameData.getEntities(SkillData[skillName].recipes, | ||
function(rec) | |||
return rec.abyssalLevel == nil | |||
end | |||
) | |||
local sameRecipeAndProduct = false | local sameRecipeAndProduct = false | ||
if skillName == 'Herblore' then | if skillName == 'Herblore' then | ||
Line 1,378: | Line 1,435: | ||
-- Icon overrides | -- Icon overrides | ||
local iconType = entity.entityType | local iconType = entity.imgType or entity.entityType | ||
local iconLink = entity.entityName | local iconLink = entity.entityName | ||
local iconText = entity.entityName | local iconText = entity.entityName | ||
Line 1,385: | Line 1,442: | ||
if entity.entityType == 'slayerArea' then | if entity.entityType == 'slayerArea' then | ||
iconType = 'combatArea' | iconType = 'combatArea' | ||
end | end | ||
if entity.entityType == 'gathering' then | if entity.entityType == 'gathering' then | ||
Line 1,503: | Line 1,557: | ||
-- Then by subtype | -- Then by subtype | ||
elseif aSubTypeSort ~= bSubTypeSort then | elseif aSubTypeSort ~= bSubTypeSort then | ||
return aSubTypeSort < bSubTypeSort | return (aSubTypeSort or '') < (bSubTypeSort or '') | ||
-- And finally by name | -- And finally by name | ||
else | else |