Module:CombatAreas: Difference between revisions

_getAreaRequirements: Resolve cases where requirement text returned could contain empty lines
(added getAreaRequirementsForBox)
(_getAreaRequirements: Resolve cases where requirement text returned could contain empty lines)
Line 72: Line 72:
local resultArray = {}
local resultArray = {}
if area.entryRequirements ~= nil then
if area.entryRequirements ~= nil then
table.insert(resultArray, Common.getRequirementString(area.entryRequirements, ''))
local reqText = Common.getRequirementString(area.entryRequirements)
if reqText ~= nil then
table.insert(resultArray, reqText)
end
end
end


Line 78: Line 81:
-- Avoid repeating the same requirements twice, can happen for some dungeons e.g. Impending Darkness
-- 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
if area.entryRequirements == nil or mw.dumpObject(area.unlockRequirement) ~= mw.dumpObject(area.entryRequirements) then
table.insert(resultArray, Common.getRequirementString(area.unlockRequirement, ''))
local reqText = Common.getRequirementString(area.unlockRequirement)
if reqText ~= nil then
table.insert(resultArray, reqText)
end
end
end
end
end