Module:CombatAreas/AreaTables: Difference between revisions

Added a function to allow me to quickly update CombatNav. Saving it in case it's useful later.
(Fix calls to GameData.sortByOrderTable)
(Added a function to allow me to quickly update CombatNav. Saving it in case it's useful later.)
Line 160: Line 160:
result = result..'\r\n|}'
result = result..'\r\n|}'
return result
return result
end
function p.buildCombatNavText(frame)
--This isn't actually called on any pages but instead exists to save me time on updating Template:CombatNav for the new expansion
local areas = GameData.sortByOrderTable(GameData.rawData.slayerAreas, GameData.rawData.slayerAreaDisplayOrder)
local outArray = {}
for i, area in ipairs(areas) do
local id = area.id
if Shared.startsWith(id, 'melvorTotH') then
table.insert(outArray, '|-')
table.insert(outArray, '| {{TotH}} {{ZoneIcon|'..area.name..'}}')
local monsterArray = {}
for j, monsterID in ipairs(area.monsterIDs) do
local monster = Monsters.getMonsterByID(monsterID)
table.insert(monsterArray, '{{MonsterIcon|'..monster.name..'}}')
end
table.insert(outArray, '| class="center" style="vertical-align:middle;" | '..table.concat(monsterArray, ' {{*}} '))
end
end
areas = GameData.sortByOrderTable(GameData.rawData.dungeons, GameData.rawData.dungeonDisplayOrder)
for i, area in ipairs(areas) do
local id = area.id
if Shared.startsWith(id, 'melvorTotH') then
table.insert(outArray, '|-')
table.insert(outArray, '| {{TotH}} {{ZoneIcon|'..area.name..'}}')
local monsterArray = {}
local mCheck = {}
for j, monsterID in ipairs(area.monsterIDs) do
local monster = Monsters.getMonsterByID(monsterID)
if mCheck[monster.name] == nil then
table.insert(monsterArray, '{{MonsterIcon|'..monster.name..'}}')
mCheck[monster.name] = 1
end
end
table.insert(outArray, '| class="center" style="vertical-align:middle;" | '..table.concat(monsterArray, ' {{*}} '))
end
end
return table.concat(outArray, '\r\n')
end
end


return p
return p