Open Beta is out on IOS/Android, PC & Mac! Play Now for Free! |
Module:ItemInfobox: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
(16 intermediate revisions by 4 users not shown) | |||
Line 16: | Line 16: | ||
} ) | } ) | ||
:addImage( args.image, args.caption ) | :addImage( args.image, args.caption ) | ||
: | :addHeader ( 'Properties' ) | ||
:addRow ( 'Display Name', args.displayName ) | :addRow ( 'Display Name', args.displayName ) | ||
:addRow ( 'Stackable?', args.stackable ) | :addRow ( 'Stackable?', args.stackable ) | ||
retval:addRow (' | if not args.consumable then | ||
args.consumable = 'N/A' | |||
end | |||
retval:addRow ( 'Consumable?', args.consumable ) | |||
if args.recipeInput and args.recipeInput ~= '' then | |||
retval:addHeader( 'Crafting Recipe' ) | |||
retval:addRow( 'Ingredients', args.recipeInput ) | |||
retval:addRow( 'Output Quantity', args.recipeOutput ) | |||
end | |||
if args.tool and args.tool ~= '' then | if args.tool and args.tool ~= '' then | ||
retval:addHeader( 'Tool Properties' ) | |||
retval:addRow ( 'Tool Type', args.tool) | retval:addRow ( 'Tool Type', args.tool) | ||
Line 37: | Line 42: | ||
retval:addRow( 'Durability', args.durability ) | retval:addRow( 'Durability', args.durability ) | ||
retval:addRow( 'Tool Multiplier', args.toolMultiplier ) | retval:addRow( 'Tool Multiplier', args.toolMultiplier ) | ||
end | |||
if args.weapon and args.weapon ~= '' then -- will be useful when weapons are useful | |||
retval:addHeader( 'Weapon Properties' ) | |||
retval:addRow ( 'Weapon Type', args.weapon) | |||
retval:addRow( 'Durability', args.durability ) | |||
retval:addRow( 'Damage', args.damage ) | |||
end | |||
if args.poolType and args.poolType ~= '' then | |||
retval:addHeader( 'Fishing Properties' ) | |||
retval:addRow ( 'Pool Type', args.poolType ) | |||
retval:addRow ( 'Catch Chance', args.catchChance ) | |||
end | |||
if args.food and args.food ~= '' then | |||
retval:addHeader( 'Food Properties' ) | |||
retval:addRow ( 'Food Type', args.food) | |||
retval:addRow ( 'Hunger Restored', args.hungerRestored) | |||
end | end | ||
Latest revision as of 09:02, 21 November 2022
Documentation for this module may be created at Module:ItemInfobox/doc
local capiunto = require 'capiunto' local p = {} function p.main(frame) local args = frame:getParent().args local headerStyle if args.headerstyle and args.headerstyle ~= '' then headerStyle = string.format('background-color:%s;', args.headerstyle) else headerStyle = 'background-color:grey;' end local retval = capiunto.create( { title = tostring(mw.title.getCurrentTitle()), headerStyle = headerStyle } ) :addImage( args.image, args.caption ) :addHeader ( 'Properties' ) :addRow ( 'Display Name', args.displayName ) :addRow ( 'Stackable?', args.stackable ) if not args.consumable then args.consumable = 'N/A' end retval:addRow ( 'Consumable?', args.consumable ) if args.recipeInput and args.recipeInput ~= '' then retval:addHeader( 'Crafting Recipe' ) retval:addRow( 'Ingredients', args.recipeInput ) retval:addRow( 'Output Quantity', args.recipeOutput ) end if args.tool and args.tool ~= '' then retval:addHeader( 'Tool Properties' ) retval:addRow ( 'Tool Type', args.tool) if args.toolEffectiveOn and args.toolEffectiveOn ~= '' then retval:addRow ( 'Effective On', args.toolEffectiveOn ) end retval:addRow( 'Durability', args.durability ) retval:addRow( 'Tool Multiplier', args.toolMultiplier ) end if args.weapon and args.weapon ~= '' then -- will be useful when weapons are useful retval:addHeader( 'Weapon Properties' ) retval:addRow ( 'Weapon Type', args.weapon) retval:addRow( 'Durability', args.durability ) retval:addRow( 'Damage', args.damage ) end if args.poolType and args.poolType ~= '' then retval:addHeader( 'Fishing Properties' ) retval:addRow ( 'Pool Type', args.poolType ) retval:addRow ( 'Catch Chance', args.catchChance ) end if args.food and args.food ~= '' then retval:addHeader( 'Food Properties' ) retval:addRow ( 'Food Type', args.food) retval:addRow ( 'Hunger Restored', args.hungerRestored) end return retval end return p