Module:Banner crafting usage

local p = {} p.crafting = function( f ) local args = f:getParent.args local crafting = require( Module:Crafting ).table local dye = args[1] or mw.title.getCurrentTitle.text local dyeColours = { ['Ink Sac'] = 'Black', ['Rose Red'] = 'Red', ['Cactus Green'] = 'Green', ['Cocoa Beans'] = 'Brown', ['Lapis Lazuli'] = 'Blue', ['Dandelion Yellow'] = 'Yellow', ['Bone Meal'] = 'White' }	local colour = dyeColours[dye] or dye:match( '^(.+) Dye$' ) local dyeOrder = { 'Base Fess', 'Chief Fess', 'Pale Dexter', 'Pale Sinister', 'Pale', 'Fess', 'Bend', 'Bend Sinister', 'Paly', 'Saltire', 'Cross', 'Per Bend Sinister', 'Per Bend', 'Per Bend Inverted', 'Per Bend Sinister Inverted', 'Per Pale', 'Per Pale Inverted', 'Per Fess', 'Per Fess Inverted', 'Base Dexter Canton', 'Base Sinister Canton', 'Chief Dexter Canton', 'Chief Sinister Canton', 'Chevron', 'Inverted Chevron', 'Base Indented', 'Chief Indented', 'Roundel', 'Lozenge', 'Bordure', 'Gradient', 'Base Gradient' }	local otherOrder = { 'Bordure Indented', 'Field Masoned', 'Creeper Charge', 'Skull Charge', 'Flower Charge', 'Mojang Charge' } -- 0 = empty, 1 = banner, 2 = dye local dyeRecipes = { ['Base Fess'] = { 0, 0, 0,			0, 1, 0,			2, 2, 2,		},		['Chief Fess'] = { 2, 2, 2,			0, 0, 0,			0, 1, 0,		},		['Pale Dexter'] = { 2, 0, 0,			2, 0, 0,			2, 1, 0,		},		['Pale Sinister'] = { 0, 0, 2,			0, 0, 2,			0, 1, 2,		},		['Pale'] = { 0, 2, 0,			0, 2, 1,			0, 2, 0,		},		['Fess'] = { 0, 0, 0,			2, 2, 2,			0, 1, 0,		},		['Bend'] = { 2, 0, 0,			0, 2, 0,			0, 1, 2,		},		['Bend Sinister'] = { 0, 0, 2,			0, 2, 0,			2, 1, 0,		},		['Paly'] = { 2, 0, 2,			2, 0, 2,			0, 1, 0,		},		['Saltire'] = { 2, 0, 2,			0, 2, 0,			2, 1, 2,		},		['Cross'] = { 0, 2, 0,			2, 2, 2,			1, 2, 0,		},		['Per Bend Sinister'] = { 2, 2, 0,			2, 0, 0,			0, 1, 0,		},		['Per Bend'] = { 0, 2, 2,			0, 0, 2,			0, 1, 0,		},		['Per Bend Inverted'] = { 0, 1, 0,			2, 0, 0,			2, 2, 0,		},		['Per Bend Sinister Inverted'] = { 0, 1, 0,			0, 0, 2,			0, 2, 2,		},		['Per Pale'] = { 2, 2, 0,			2, 2, 1,			2, 2, 0,		},		['Per Pale Inverted'] = { 0, 2, 2,			1, 2, 2,			0, 2, 2,		},		['Per Fess'] = { 2, 2, 2,			2, 2, 2,			0, 1, 0,		},		['Per Fess Inverted'] = { 0, 1, 0,			2, 2, 2,			2, 2, 2,		},		['Base Dexter Canton'] = { 0, 0, 0,			0, 0, 0,			2, 1, 0,		},		['Base Sinister Canton'] = { 0, 0, 0,			0, 0, 0,			0, 1, 2,		},		['Chief Dexter Canton'] = { 2, 0, 0,			0, 0, 0,			0, 1, 0,		},		['Chief Sinister Canton'] = { 0, 0, 2,			0, 0, 0,			0, 1, 0,		},		['Chevron'] = { 0, 0, 0,			0, 2, 0,			2, 1, 2,		},		['Inverted Chevron'] = { 2, 0, 2,			0, 2, 0,			0, 1, 0,		},		['Base Indented'] = { 0, 0, 0,			2, 1, 2,			0, 2, 0,		},		['Chief Indented'] = { 0, 2, 0,			2, 0, 2,			0, 1, 0,		},		['Roundel'] = { 0, 0, 0,			0, 2, 0,			0, 1, 0,		},		['Lozenge'] = { 0, 2, 0,			2, 1, 2,			0, 2, 0,		},		['Bordure'] = { 2, 2, 2,			2, 1, 2,			2, 2, 2,		},		['Gradient'] = { 2, 1, 2,			0, 2, 0,			0, 2, 0,		},		['Base Gradient'] = { 0, 2, 0,			0, 2, 0,			2, 1, 2,		},	}	local items = { ['Bordure Indented'] = 'Vines', ['Field Masoned'] = 'Bricks', ['Creeper Charge'] = 'Creeper Head', ['Skull Charge'] = 'Wither Skeleton Skull', ['Flower Charge'] = 'Oxeye Daisy', ['Mojang Charge'] = 'Enchanted Golden Apple', }	local shapedArgs = { 'A1', 'B1', 'C1', 'A2', 'B2', 'C2', 'A3', 'B3', 'C3', }	local dyeArgs = {} if f:callParserFunction( '#dplvar', 'multirow' ) ~= '1' then dyeArgs.head = '1' end dyeArgs.upcoming = '1.8' dyeArgs.ignoreusage = '1' dyeArgs.showdescription = args.description dyeArgs.name = colour .. ' Banner pattern' dyeArgs.ingredients = '' .. dye .. ' + Banner' for i = 1, 9 do		local dyeArg = {} for _, pattern in ipairs( dyeOrder ) do			local iType = dyeRecipes[pattern][i] local ingredient = '' if iType == 1 then ingredient = 'Banner' elseif iType == 2 then ingredient = dye end table.insert( dyeArg, ingredient ) end dyeArgs[shapedArgs[i]] = table.concat( dyeArg, ';' ) end local dyeOutputArg = {} for _, pattern in ipairs( dyeOrder ) do table.insert( dyeOutputArg, colour .. ' ' .. pattern .. ' Banner' ) end dyeArgs.Output = table.concat( dyeOutputArg, ';' ) dyeArgs.fixed = '1' dyeArgs.notfixed = 'the banner' local otherArgs = {} otherArgs.upcoming = '1.8' otherArgs.ignoreusage = '1' otherArgs.name = colour .. ' Banner image' local otherItemArg = {} local otherOutputArg = {} for _, pattern in ipairs( otherOrder ) do		table.insert( otherItemArg, items[pattern] ) table.insert( otherOutputArg, colour .. ' ' .. pattern .. ' Banner' ) end table.insert( otherArgs, table.concat( otherItemArg, ';' ) ) table.insert( otherArgs, dye ) table.insert( otherArgs, 'Banner' ) otherArgs.Output = table.concat( otherOutputArg, ';' ) if not args.continue then otherArgs.foot = '1' end return crafting( dyeArgs ) .. crafting( otherArgs ) end return p