local cargo = mw.ext.cargo
local util_cargo = require('Module:Cargo Utility')
local infobox = require('Module:Infobox')
local p = {}
local h = {}
function p.Declare(frame)
-- [ Declare ItemsTable ]
local tablename = 'ItemsTable'
local args = {
['BasePV']='Integer',
['MaxPV']='Integer',
['Vibro']='Boolean',
['PoweredPV']='Boolean',
['Damage']='String',
['UnpoweredDamage']='String',
['PrimaryDamageElement']='String',
['HP']='Integer',
['AV']='Integer',
['DV']='Integer',
['MA']='Integer',
['ToHit']='Integer',
['Skill']='String',
['ObjectID']='String',
['AgilityBonus']='Integer',
['StrengthBonus']='Integer',
['WillpowerBonus']='Integer',
['ToughnessBonus']='Integer',
['IntelligenceBonus']='Integer',
['EgoBonus']='Integer',
['Description']='Wikitext',
['WornOn']='String',
['UsesSlots']='List (,) of String',
['Healing']='String',
['HarvestedInto']='String',
['PreservedInto']='Page',
['PreservedQuantity']='Integer',
['ElementalDamage']='String',
['ElementalType']='String',
['JoinKey']='String'
}
local results = cargo.declare(table, args)
end
function p.main(frame)
-- [Process arguments. Header and image work ok, but
-- additional logic is needed to separate the other args into rows]
local args = require( 'Module:ProcessArgs' ).merge( true )
local infoboxargs = {
['class'] = 'qud-item-infobox',
['rows'] = args['rows']
}
return infobox.infobox(args)
end
function h.addrow(row)
-- [ Add html row with given table. I basically just rewrote
-- Template:Infobox row in lua. likely needs to be refactored]
local output = {}
local label = row[1]
local class = row['class']
local field = row[2]
if label then
output.append('! <div style="text-align:left" class="Searchaux"> '.. label .. '</div>\n')
end
output.append('|')
if class then
output.append('class="'.. class .. '"')
end
if not label then
output.append('colspan="2"')
end
output.append('\n|' .. field .. '\n|-')
end
return p