Module:Ability icon

local p = {} local cargo = mw.ext.cargo local getArgs = require('Module:Arguments').getArgs

function p.main(frame) local args = getArgs(frame) return p._main(args) end

function p._main(args, data) if not data then mw.log('Generating data.') data = mw.ext.cargo.query( 'abilities', 'image, type', { where='source="' .. args.source .. '" AND title="' .. args.name .. '"', groupBy='source, title' } )[1] -- Temoprary fix. if not data then data = { type = 'item' } end end if data.type == 'item' then return mw.ext.cargo.query( 'items', 'image,', { where='_pageName="' .. args.source .. '"', groupBy='_pageID' } )[1]['image'] elseif data.type == 'rune' then return string.format('File:Bottle (%s) icon.png', args.name) elseif data.image ~= '' then return data.image else return 'File:Unknown icon.png' end end

return p