Module:Passives/Builds

local p = {} local cargo = mw.ext.cargo

function p.List( frame ) local args = frame.args local fieldstable = { "Icon", "Name", "Description", "Class", "MaxPoints", "NodeUnlock", "LevelUnlock", "Mods", "_pageName", }   local tables = 'Passives' local fields = table.concat(fieldstable,",") -- optional parameters are grouped in one table -- you can omit any or all of them, except joinOn if you use more than one table local cargoquery = { where = args.where, groupBy = "_pageName" , orderBy = args.orderby} local result = mw.ext.cargo.query( tables, fields, cargoquery ) local prepointstable = mw.text.split( args.passivepointslist, ";" ) local pointstable = { } for i,v in ipairs(prepointstable) do     table.insert( pointstable, mw.text.split( v, ",")) end

if result[1] == nil then return args.default

elseif result[1] ~= nil then --Start the table local tbl = mw.html.create('table') tbl:addClass('wikitable sortable mw-datatable') if args.BPoints == "show" then tbl:tag("th"):wikitext("Points"):done end if args.Icon ~= "hide" then tbl:tag("th"):wikitext("Icon"):done end if args.Name ~= "hide" then tbl:tag("th"):wikitext("Passive Name"):done end if args.Description ~= "hide" then tbl:tag("th"):wikitext("Passive Description"):done end if args.Class ~= "hide" then tbl:tag("th"):wikitext("Class"):done end if args.MaxPoints ~= "hide" then tbl:tag("th"):wikitext("Max Points"):done end if args.LevelUnlock ~= "hide" then tbl:tag("th"):wikitext("Unlocked Lvl."):done end if args.NodeUnlock ~= "hide" then tbl:tag("th"):wikitext("Required Passive"):done end if args.Mods == "show" then tbl:tag("th"):wikitext("Mods"):done end tbl:done --Construct the rows in the table for i,v in ipairs(pointstable) do               tr = tbl:tag("tr") if args.BPoints == "show" then tr:tag("td"):wikitext(v[2]):done end for _,row in ipairs(result) do                     if (row._pageName == v[1] and args.Icon ~= "hide") then tr:tag("td"):wikitext(row.Icon):done end if (row._pageName == v[1] and args.Name ~= "hide") then tr:tag("td"):wikitext("" .. row.Name .. ""):done end if (row._pageName == v[1] and args.Description ~= "hide") then tr:tag("td"):wikitext(row.Description):done end if (row._pageName == v[1] and args.Class ~= "hide") then tr:tag("td"):wikitext(row.Class):done end if (row._pageName == v[1] and args.MaxPoints ~= "hide") then tr:tag("td"):wikitext(row.MaxPoints):done end if (row._pageName == v[1] and args.LevelUnlock ~= "hide") then tr:tag("td"):wikitext(row.LevelUnlock):done end if (row._pageName == v[1] and args.NodeUnlock ~= "hide") then tr:tag("td"):wikitext(row.NodeUnlock):done end if (row._pageName == v[1] and args.Mods == "show") then tr:tag("td"):wikitext(mw.text.listToText( mw.text.split( row.Mods, ',' ) )):done end end end return tbl end -- . . . end return p