local p = {}
p.crafting = function( f )
local args = f:getParent().args
local crafting = require( [[モジュール:Crafting]] ).table
local Autolink = require( [[モジュール:Autolink]] )
local Reverselink = require( [[モジュール:Reverselink]] )
local dye = args[1] or Reverselink.xlink(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 dyeColoursC = {
['Red Dye'] = '赤色',
['Orange Dye'] = '橙色',
['Yellow Dye'] = '黄色',
['Green Dye'] = '緑色',
['Blue Dye'] = '青色',
['Light Blue Dye'] = '空色',
['Magenta Dye'] = '赤紫色',
['Pink Dye'] = '桃色',
['White Dye'] = '白色',
['Light Gray Dye'] = '薄灰色',
['Gray Dye'] = '灰色',
['Lime Dye'] = '黄緑色',
['Cyan Dye'] = '青緑色',
['Purple Dye'] = '紫色',
['Black Dye'] = '黒色',
['Brown Dye'] = '茶色',
['Rose Red'] = '赤色',
['Dandelion Yellow'] = '黄色',
['Cactus Green'] = '緑色',
['Lapis Lazuli'] = '青色',
['Bone Meal'] = '白色',
['Ink Sac'] = '黒色',
['Cocoa Beans'] = '茶色'
}
local colour = dyeColours[dye] or dye:match( '^(.+) Dye$' )
local colourC = dyeColoursC[dye]
local banner = 'Banner'
if dye == 'Bone Meal' then
banner = '[Banner]Light Gray Banner'
end
local dyeOrder = {
'Base', 'Chief', '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', 'Thing' }
-- 0 = empty, 1 = banner, 2 = dye
local dyeRecipes = {
['Base'] = {
0, 0, 0,
0, 1, 0,
2, 2, 2,
},
['Chief'] = {
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',
['Thing'] = 'Enchanted Golden Apple',
}
local shapedArgs = {
'A1', 'B1', 'C1',
'A2', 'B2', 'C2',
'A3', 'B3', 'C3',
}
local dyeArgs = {
head = '1',
ignoreusage ='1',
showdescription = args.description,
name = colourC .. 'の[[旗]]の模様',
ingredients = '[[' .. Autolink.invlink(dye) .. ']] +<br>[[旗]]',
}
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.Olink = '旗'
dyeArgs.fixed = '1'
dyeArgs.notfixed = '旗'
local otherArgs = {}
otherArgs.ignoreusage = '1'
otherArgs.name = colourC .. 'の[[旗]]の画像'
otherArgs.ingredients = '[[' .. Autolink.invlink(dye) .. ']] +<br>[[旗]] +<br>[[ツタ]] または<br>[[レンガ (ブロック)]] または<br>[[クリーパーの頭]] または<br>[[ウィザースケルトンの頭蓋骨]] または<br>[[フランスギク]] または<br>[[エンチャントされた金のリンゴ]]'
local otherItemArg = {}
local otherOutputArg = {}
for _, pattern in ipairs( otherOrder ) do
table.insert( otherItemArg, items[pattern] )
table.insert( otherOutputArg, colour .. ' ' .. pattern .. ' Banner' )
end
otherArgs[1] = table.concat( otherItemArg, ';' )
otherArgs[2] = dye
otherArgs[3] = banner
otherArgs.Output = table.concat( otherOutputArg, ';' )
otherArgs.Olink = '旗'
if not args.continue then
otherArgs.foot = '1'
end
return crafting( dyeArgs ) .. crafting( otherArgs )
end
return p
Advertisement
モジュール:Banner crafting usage
Advertisement