Module:Monsters: Difference between revisions

added a function for generating the text for Template:MonsterLootTables because I am unfathomably lazy
(Fix RandomSpiderLair handling)
(added a function for generating the text for Template:MonsterLootTables because I am unfathomably lazy)
Line 1,488: Line 1,488:


return table.concat(resultPart)
return table.concat(resultPart)
end
--NOTE: This is not a function that should be called directly
--It exists because I'm too lazy to manually type up all the new monsters - User:Falterfire
function p.getMonsterLootTableText()
local getAreaText = function(area)
local outArray = {}
table.insert(outArray, "==={{ZoneIcon|"..area.name.."|size=50}}===")
table.insert(outArray, "")
for i, monsterID in ipairs(area.monsterIDs) do
local monster = p.getMonsterByID(monsterID)
table.insert(outArray, "===={{MonsterIcon|"..monster.name.."|size=40}}====")
table.insert(outArray, "{{MonsterDrops|"..monster.name.."|size=40}}")
end
return table.concat(outArray, "\r\n")
end
local fullArray = {}
local areaArray = Areas.getAreas(function(a) return a.type == 'combatArea' end)
for i, area in ipairs(areaArray) do
table.insert(fullArray, getAreaText(area))
end
areaArray = Areas.getAreas(function(a) return a.type == 'slayerArea' end)
for i, area in ipairs(areaArray) do
table.insert(fullArray, getAreaText(area))
end
return table.concat(fullArray, "\r\n\r\n----\r\n")
end
end


return p
return p