Anonymous

Module:CombatAreas: Difference between revisions

From Melvor Idle
getExpansionIcon: Implement
(Update for v1.1)
(getExpansionIcon: Implement)
(2 intermediate revisions by the same user not shown)
Line 57: Line 57:


     return resultArray
     return resultArray
end
--Returns the expansion icon for the area if it has one
function p.getExpansionIcon(frame)
local areaName = frame.args ~= nil and frame.args[1] or frame
local area = p.getArea(areaName)
if area == nil then
return "ERROR: No area named " .. areaName .. " exists in the data module[[Category:Pages with script errors]]"
end
return Icons.getExpansionIcon(area.id)
end
end


Line 96: Line 107:


if area.unlockRequirement ~= nil then
if area.unlockRequirement ~= nil then
        addReqsToArray(resultArray, area.unlockRequirement)
-- Avoid repeating the same requirements twice, can happen for some dungeons e.g. Impending Darkness
if area.entryRequirements == nil or mw.dumpObject(area.unlockRequirement) ~= mw.dumpObject(area.entryRequirements) then
        addReqsToArray(resultArray, area.unlockRequirement)
        end
end
end


Line 135: Line 149:


function p.getMonsterAreas(monsterID)
function p.getMonsterAreas(monsterID)
-- Special handling for Lair of the Spider Queen, which has a random list of enemies
local randomSpiderCheck = Shared.contains(GameData.rawData.spiderLairMonsters, monsterID)
return p.getAreas(
return p.getAreas(
        function(area)
function(area)
          return Shared.contains(area.monsterIDs, monsterID)  
return Shared.contains(area.monsterIDs, monsterID) or
        end)
(randomSpiderCheck and Shared.contains(area.monsterIDs, 'melvorTotH:RandomSpiderLair'))
end)
end
end