Module:FeaturedObtainable

-- local p = {}

function p._featuredUnit(iname) if not iname then return 'No unit specified' end local model = require('Module:Data').model local unit = model.query('Unit','_pageName,server,rare,img,iname',{where='iname="'..iname..'"'})[1] or {} if not unit.iname then return ('Invalid unit '..iname.. ' requested') end

local output = {} local render_unit = require('Module:Render/Unit')

table.insert(output, ' ') table.insert(output, ' ' .. render_unit._icon({unit.iname, data=unit, name='none', size='large'}) .. ' ') table.insert(output, ' ' .. render_unit._pageName({unit.iname, data=unit}) .. ' ')

local unitExtraData = mw.loadData("Module:Data/Extra/Unit")[unit.iname] or {}

if unitExtraData['source'] then table.insert(output, unitExtraData['source']) end

if unitExtraData['glDate'] then table.insert(output, unitExtraData['glDate']) end

table.insert(output, ' ') return table.concat(output, "\n\n") end

function p._featuredMemento(iname) if not iname then return 'No memento specified' end local cargo = require('Module:CargoUtil') local memento = cargo.query{ tables='ConceptCard=C,ConceptCardLoc=L,Pages=P', join='C.iname=L.iname,C.iname=P.iname', fields='P._pageName=_pageName,C._pageName=C_pageName,C.server=server,C.rare=rare,C.icon=icon,C.iname=iname,L.name=name', where='C.iname="'..iname..'" AND P.type="Memento" AND L.lang="english"', }[1] or {} if not memento.iname then return ('Invalid memento '..iname.. ' requested') end

local output = {} local render_memento = require('Module:Render/Memento')

table.insert(output, ' ') table.insert(output, ' ' .. render_memento._icon({memento.iname, data=memento, name='none', size='large'}) .. ' ') memento._pageName = memento.C_pageName table.insert(output, ' ' .. render_memento._pageName({memento.iname, data=memento}) .. ' ')

local mementoExtraData = mw.loadData("Module:Data/Extra/Memento")[memento.iname] or {}

if mementoExtraData['source'] then table.insert(output, mementoExtraData['source']) end

if mementoExtraData['glDate'] then table.insert(output, mementoExtraData['glDate']) end

table.insert(output, ' ') return table.concat(output, "\n\n") end

function p._featuredGear(iname) if not iname then return 'No gear specified' end local model = require('Module:Data').model local gear = model.query('Artifact','iname, _pageName, server, rini, icon',{where='iname="'..iname..'"'})[1] or {} if not gear.iname then return ('Invalid gear '..iname.. ' requested') end

local output = {} local render_gear = require('Module:Render/Gear')

table.insert(output, ' ') table.insert(output, ' ' .. render_gear._icon({gear.iname, data=gear, name='none', size='large'}) .. ' ') table.insert(output, ' ' .. render_gear._pageName({gear.iname, data=gear}) .. ' ')

local gearExtraData = mw.loadData("Module:Data/Extra/Gear")[gear.iname] or {}

if gearExtraData['source'] then table.insert(output, gearExtraData['source']) end

if gearExtraData['glDate'] then table.insert(output, gearExtraData['glDate']) end

table.insert(output, ' ') return table.concat(output, "\n\n") end

function p.featuredUnit(frame) local args = require('Module:Arguments').getArgs(frame, {       parentFirst = true,    }) return p._featuredUnit(args[1]) or 'No unit specified' end

function p.featuredMemento(frame) local args = require('Module:Arguments').getArgs(frame, {       parentFirst = true,    }) return p._featuredMemento(args[1]) or 'No memento specified' end

function p.featuredGear(frame) local args = require('Module:Arguments').getArgs(frame, {       parentFirst = true,    }) return p._featuredGear(args[1]) or 'No gear specified' end

return p --