17,101
edits
(_getAreaRequirements: Resolve cases where requirement text returned could contain empty lines) |
(Update for v1.3) |
||
Line 11: | Line 11: | ||
["combat"] = 'combatAreas', | ["combat"] = 'combatAreas', | ||
["dungeon"] = 'dungeons', | ["dungeon"] = 'dungeons', | ||
["slayer"] = 'slayerAreas' | ["slayer"] = 'slayerAreas', | ||
["depth"] = 'abyssDepths' | |||
} | } | ||
Line 24: | Line 25: | ||
end | end | ||
function p.getAreaByID(id, | function p.getAreaByID(id, areaType) | ||
for aType, areaKey in pairs(areaMap) do | |||
if areaType == nil or areaType == aType then | |||
local area = GameData.getEntityByID(areaKey, id) | |||
if area ~= nil then | |||
return area | |||
end | |||
end | |||
end | end | ||
end | end | ||
Line 138: | Line 143: | ||
end | end | ||
function p. | function p._isMonsterInArea(monster, area) | ||
return ( | |||
Shared.contains(area.monsterIDs, monster.id) | |||
-- Check for Lair of the Spider Queen random spiders | |||
or ( | |||
Shared.contains(area.monsterIDs, 'melvorTotH:RandomSpiderLair') | |||
and Shared.contains(GameData.rawData.spiderLairMonsters, monster.id) | |||
) | |||
) | |||
end | |||
function p._getMonsterAreas(monster) | |||
-- Special handling for Lair of the Spider Queen, which has a random list of enemies | -- Special handling for Lair of the Spider Queen, which has a random list of enemies | ||
local randomSpiderCheck = Shared.contains(GameData.rawData.spiderLairMonsters, | local randomSpiderCheck = Shared.contains(GameData.rawData.spiderLairMonsters, monster.id) | ||
return p.getAreas( | return p.getAreas( | ||
function(area) | function(area) | ||
return | return p._isMonsterInArea(monster, area) | ||
end) | end) | ||
end | end |