Module:TabbedPOI

local p = {}

function p.main(frame) local args = require("Dev:Arguments").getArgs(frame) local NPCList = {} -- this table stores the NPC list local EnemyList = {} -- this table stores the enemy list local BossList = {} -- this table stores the bosses list local LootList = {} -- this table stores the Loot list local index = 0 local NPC, NPCcp, NPCnote, Enemy, Enemycp, Enemynote, Boss, Bosscp, Bossnote, Loot_Filename, Lootcp, Lootname, Lootamount, Lootdesc local endNPC = 0 local endEnemy = 0 local endBoss = 0 local endLoot = 0 -- each value is 0 if there are still parameters to read, 1 if there aren't	while true do		index = index + 1 if endNPC == 0 then NPC = args['NPC' .. index] -- parameter if (not NPC) or (string.len(NPC) == 0) then endNPC = 1 else NPCcp = args['NPC' .. index .. 'cp'] or '' -- parameter NPCnote = args['NPC' .. index .. 'Note'] or '' -- parameter table.insert(NPCList, '* ' .. NPCcp .. ' ' .. '' .. NPC .. ' ' .. NPCnote) end end if endEnemy == 0 then Enemy = args['Enemy' .. index] -- parameter if (not Enemy) or (string.len(Enemy) == 0) then endEnemy = 1 else Enemycp = args['Enemy' .. index .. 'cp'] or '' -- parameter Enemynote = args['Enemy' .. index .. 'Note'] or '' -- parameter table.insert(EnemyList, '* ' .. Enemycp .. ' ' .. '' .. Enemy .. ' ' .. Enemynote) end end if endBoss == 0 then Boss = args['Boss' .. index] -- parameter if (not Boss) or (string.len(Boss) == 0) then endBoss = 1 else Bosscp = args['Boss' .. index .. 'cp'] or '' -- parameter Bossnote = args['Boss' .. index .. 'Note'] or '' -- parameter table.insert(BossList, '* ' .. Bosscp .. ' ' .. Boss .. ' ' .. Bossnote) end end if endLoot == 0 then Loot_Filename = args['Loot' .. index .. '_FileName'] -- parameter if (not Loot_Filename) or (string.len(Loot_Filename) == 0) then endLoot = 1 else Lootcp = args['Loot' .. index .. 'cp'] or '' -- parameter Lootname = args['Loot' .. index .. '_Name'] or Loot_Filename -- parameter Lootamount = args['Loot' .. index .. '_Amount'] or ''-- parameter Lootdesc = args['Loot' .. index .. '_Description'] or ''-- parameter table.insert(LootList, '|style="width:16%;"| \n |style="width:84%;" | ' .. Lootcp .. ' ' .. Lootname .. ' ' .. ((Lootamount ~= ) and ('x ' .. Lootamount) or ) .. ((Lootdesc ~= ) and (' \n' .. Lootdesc) or ) .. ' ') end end if ((endNPC + endEnemy + endBoss + endLoot) == 4) then break end end local result = {} table.insert(result, ' ') if (#NPCList > 0) or (#EnemyList > 0) then table.insert(result, '|-|' .. (args['Title1'] or 'Inhabitants') .. '=') table.insert(result, ' ' .. (args['Title1'] or 'Inhabitants') .. ' ') -- header for mobile view table.insert(result, '{| class="article-table" style="width:100%;"') table.insert(result, '| style="width:50%; vertical-align:text-top;"|  Characters  ') table.insert(result, ' 10) and '2' or '1') ..';">') if #NPCList > 0 then table.insert(result, table.concat(NPCList, '\n')) else table.insert(result, '* None') end table.insert(result, ' ') table.insert(result, '| style="width:50%; vertical-align:text-top;"|  Enemies  ') table.insert(result, ' 10) and '2' or '1') ..';">') if #EnemyList > 0 then table.insert(result, table.concat(EnemyList, '\n')) elseif args['Unnamed'] and (string.len(args['Unnamed']) > 0) then table.insert(result, '* See the gallery below for the list of enemies') else table.insert(result, '* None') end if #BossList > 0 then table.insert(result, ' Bosses') table.insert(result, table.concat(BossList, '\n')) end table.insert(result, ' ') end if #LootList > 0 then table.insert(result, '|-|' .. (args['Title2'] or 'Points of Interest') .. '=') table.insert(result, ' ' .. (args['Title2'] or 'Points of Interest') .. ' ') -- header for mobile view table.insert(result, '{| class="article-table poiloot-table" style="width:100%;"') table.insert(result, table.concat(LootList, '\n|-\n')) table.insert(result, '|}') end table.insert(result, ' ') return frame:preprocess(table.concat(result, '\n')) end

return p