本站文本内容除另有声明外,转载时均必须注明出处,并遵守CC BY-NC-SA 3.0协议。(转载须知
本站是中文Minecraft Wiki的镜像站,与Mojang Studios、Weird Gloop没有从属关系。(免责声明

全站通知:

模块:Banner crafting usage

来自我的世界地下城WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

本模块用于实现{{banner crafting usage}}

依赖项

local p = {}
p.crafting = function( f )
	local args = f:getParent().args
	local crafting = require( [[Module:Crafting]] ).table
    local Autolink = require( [[Module:Autolink]] )
	
	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 dyeColoursC = {
		['Rose Red'] = '红色',
		['Orange Dye'] = '橙色',
		['Dandelion Yellow'] = '黄色',
		['Cactus Green'] = '绿色',
		['Lapis Lazuli'] = '蓝色',
		['Light Blue Dye'] = '淡蓝色',
		['Magenta Dye'] = '品红色',
		['Pink Dye'] = '粉红色',
		['Bone Meal'] = '白色',
		['Light Gray Dye'] = '淡灰色',
		['Gray Dye'] = '灰色',
		['Lime Dye'] = '黄绿色',
		['Cyan Dye'] = '青色',
		['Purple Dye'] = '紫色',
		['Ink Sac'] = '黑色',
		['Cocoa Beans'] = '棕色',
		['Blue Dye'] = '蓝色',
		['White Dye'] = '白色',
		['Brown Dye'] = '棕色',
		['Black Dye'] = '黑色'
	}
	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