Módulo:Banner crafting
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 = { ['Saco de tinta'] = 'Negro', ['Tinte rojo'] = 'Rojo', ['Tinte verde'] = 'Verde', ['Semillas de coco'] = 'marrón', ['Lapislázuli'] = 'Azul', ['Tinte amarillo'] = 'Amarillo', ['Polvo de hueso'] = 'Blanco' } local colour = dyeColours[dye] or dye:match( '^(.+) Dye$' ) local banner = 'Banner' if dye == 'Polvo de hueso' then banner = '[Banner]Light Gray Banner' end
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'] = 'Enredadera', ['Field Masoned'] = 'Ladrillos', ['Creeper Charge'] = 'Cabeza de Creeper', ['Skull Charge'] = 'Wither Skeleton Skull', ['Flower Charge'] = 'Margarita', ['Mojang Charge'] = 'Manzana dorada encantada', }
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.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
local type = colour .. ' ' .. pattern
table.insert( dyeOutputArg, '[Banner]' .. type .. ' Banner' .. '[&7' .. type .. ']' )
end
dyeArgs.Output = table.concat( dyeOutputArg, ';' )
dyeArgs.Olink = 'Banner'
dyeArgs.fixed = '1'
dyeArgs.notfixed = 'the banner'
local otherArgs = {}
otherArgs.ignoreusage = '1'
otherArgs.name = colour .. ' Banner image'
otherArgs.ingredients = '' .. dye .. ' +
Banner +
Vines or
Bricks or
Creeper Head or
Wither Skeleton Skull or
Oxeye Daisy or
Enchanted Golden Apple'
local otherItemArg = {}
local otherOutputArg = {}
for _, pattern in ipairs( otherOrder ) do
table.insert( otherItemArg, items[pattern] )
local type = colour .. ' ' .. pattern
table.insert( otherOutputArg, '[Banner]' .. type .. ' Banner' .. '[&7' .. type .. ']' )
end
table.insert( otherArgs, table.concat( otherItemArg, ';' ) )
table.insert( otherArgs, dye )
table.insert( otherArgs, banner )
otherArgs.Output = table.concat( otherOutputArg, ';' )
otherArgs.Olink = 'Banner'
if not args.continue then
otherArgs.foot = '1'
end
return crafting( dyeArgs ) .. crafting( otherArgs ) end return p