Das offizielle Minecraft Wiki twittert hier: Wiki-Twitter  –  Chatte im Wiki-Discord  –  Noch keinen Server gefunden? Es gibt einen Wiki-Server

Hi Gamepedia users and contributors! Please complete this survey to help us learn how to better meet your needs in the future. We have one for editors and readers. This should only take about 7 minutes!

Modul:Rezept

Aus Minecraft Wiki
Wechseln zu: Navigation, Suche
[Lesen | Bearbeiten | Versionen | Aktualisieren]Buch und Feder.png DokumentationSpringe zum Quelltext ↴Lua logo.svg Zum Gebrauch von Lua-Modulen siehe die Modul-Hilfe.
Baustelle.svg
Diese Seite wird gerade von violine1101 neu erstellt oder grundlegend überarbeitet.
Fragen und Vorschläge bitte in die Diskussion. Fortschritt: Heart.svgEmpty Heart.svgEmpty Heart.svgEmpty Heart.svgEmpty Heart.svgEmpty Heart.svgEmpty Heart.svgEmpty Heart.svgEmpty Heart.svgEmpty Heart.svg


local p = {}
local title = mw.title.getCurrentTitle()
local aliases = {
	["Alle Pilze"] = "Pilz",
	["Alle Brennstoffe"] = "Brennstoff",
	["Alle Ofenzutaten"] = "Alle Ofenzutaten",
	["Alle Ofenprodukte"] = "Alle Ofenprodukte",
	["Alle Hölzer"] = "Holz",
	["Alle Holzbretter"] = "Holzbretter",
	["Alle Holztreppen"] = "Holztreppe",
	["Alle Holzstufen"] = "Holzstufe",
	["Alle Holztüren"] = "Holztür",
	["Alle Holzzäune"] = "Holzzaun",
	["Alle Holzzauntore"] = "Zauntor",
	["Alle Setzlinge"] = "Setzling",
	["Alle Wollen"] = "Wolle",
	["Alle gefärbten Wollen"] = "gefärbte Wolle",
	["Alle Teppiche"] = "Teppich",
	["Alle Farbstoffe"] = "Farbstoff",
	["Alle Sandsteine"] = "Sandstein",
	["Alle Quarzblöcke"] = "Quarzblock",
	["Alle Steinziegel"] = "Steinziegel",
	["Alle Schilde"] = "Schild (Kampf)",
	["Alle gefärbten Gläser"] = "Gefärbtes Glas",
	["Alle gefärbten Glasscheiben"] = "Gefärbte Glasscheibe",
	["Alle gefärbten Keramiken"] = "Gefärbte Keramik",
    ["Alle glasierten Keramiken"] = "Glasierte Keramik",
	["Alle Feuerwerkssterne"] = "Feuerwerksstern",
	["Alle Banner"] = "Banner",
	["Alle Lederkappen"] = "Lederkappe",
	["Alle Lederjacken"] = "Lederjacke",
	["Alle Lederhosen"] = "Lederhose",
	["Alle Lederstiefel"] = "Lederstiefel",
	["Alle Spawn-Eier"] = "Spawn-Ei",
	__index = "Unbekannt|<span style=color:red>[[Kategorie:Seiten mit Skriptfehlern]]Fehler</span>"
}
local titleAliases = {
	["Goldener Apfel (verzaubert)"] = "Goldener Apfel",
	["Schneeblock"] = "Schnee",
	["Netherziegelblock"] = "Netherziegel",
	["Elytren beschädigt"] = "Elytren"
}
local aliasLinks = {
	["Brennstoff"] = "Erhitzen",
	["Alle Ofenzutaten"] = "Erhitzen",
	["Alle Ofenprodukte"] = "Erhitzen",
	["Holztür"] = "Tür",
	["Holzzaun"] = "Zaun",
	["gefärbte Wolle"] = "Wolle",
	["gefärbter Farbstoff"] = "Farbstoff"
}

function p.table( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = require( 'Modul:ParameterUmwandeln' ).merge()
	else
		f = mw.getCurrentFrame()
	end
	local grid = require( 'Modul:Grid' )
	
	-- Start table when appropriate
	local multirow = f:callParserFunction( '#dplvar', 'multirow' )
	if multirow ~= '1' then
		multirow = nil
	end
	local head = args.head or ''
	if multirow then
		head = ''
	elseif head ~= '' then
		multirow = 1
		f:callParserFunction( '#dplvar:set', 'multirow', '1' )
	else
		head = 1
	end
	
	-- End table when appropriate
	local foot = args.foot or ''
	if multirow then
		if foot ~= '' then
			multirow = nil
			f:callParserFunction( '#dplvar:set', 'multirow', '0' )
		end
	else
		foot = 1
	end
	
	local header = ''
	if head ~= '' then
		local name = ''
		local description = ''
		if args.showname == '1' or multirow and args.showname ~= '0' then
			name = 'Name !! '
			f:callParserFunction( '#dplvar:set', 'craftingname', '1' )
		end
		if args.showdescription == '1' then
			description = ' !! class="unsortable" | Beschreibung'
			f:callParserFunction( '#dplvar:set', 'craftingdescription', '1' )
		end
		local class = args.class or ''
		local recipeClass = ''
		if multirow then
			class = 'sortable collapsible ' .. class
			recipeClass = 'class="unsortable collapse-button" |'
		end
		header = table.concat( {
			' {| class="wikitable ' .. class .. '"',
			'! ' .. name .. 'Zutaten !! ' .. recipeClass .. ' [[Crafting]]-Rezept' .. description,
			'|-'
		}, '\n' )
	end

	-- Name cell
	local nameCell
	if f:callParserFunction( '#dplvar', 'craftingname' ) == '1' then
		if args.name or '' ~= '' then
			nameCell = args.name
		else
			local names = {}
			local links = {}
			for v in mw.text.gsplit( args.Output or '', '%s*;%s*' ) do
				parts = grid.getParts( v, args.Mod )
				parts.mod = parts.mod or ''
				if not names[parts.mod .. ':' .. parts.name] then
					local link = parts.name .. '|'
					if parts.mod ~= '' then
						link = 'Mod/' .. parts.mod .. '/' .. parts.name .. '|'
					end
					
					if parts.name:find( '^Alle ' ) then
						local alias = aliases[parts.name]
						if aliasLinks[alias] ~= nil then
							alias = aliasLinks[alias] .. '|' .. alias
						end
						
						if aliases[parts.name] == title.text then
							table.insert( links, aliases[parts.name] )
						else
							table.insert( links, '[[' .. alias .. ']]' )
						end
					elseif parts.name == title.text then
						table.insert( links, parts.name )
					elseif parts.title == title.text then
						table.insert( links, parts.title )
					elseif parts.title ~= nil then
						table.insert( links, '[[' .. link .. parts.title .. ']]' )
					else
						table.insert( links, '[[' .. link .. parts.name .. ']]' )
					end
					names[parts.mod .. ':' .. parts.name] = 1
				end
			end
			
			nameCell = table.concat( links, '&nbsp;oder<br />' )
		end
	end
	
	-- Create ingredient list
	local ingredients = {}
	local ingredientKeys = {}
	local animatedIngredients = {}
	local animatedKeys = {}
	for k, v in pairs( args ) do
		v = mw.text.trim( v )
		if v ~= '' and tostring( k ):find( '^%u?%d%d?$' ) then
			if v:find( ';' ) then
				table.insert( animatedKeys, v )
			else
				local parts = grid.getParts( v, args.Mod )
				parts.mod = parts.mod or ''
				local fullName = parts.mod .. ':' .. parts.name
				if not ingredients[fullName] then
					table.insert( ingredientKeys, fullName )
					ingredients[fullName] = { mod = parts.mod, name = parts.name }
				end
			end
		end
	end
	for k, v in ipairs( animatedKeys ) do
		local frames = mw.text.split( v, '%s*;%s*' )
		local length = #frames
		for k2, v2 in ipairs( frames ) do
			local parts = grid.getParts( v2, args.Mod )
			parts.mod = parts.mod or ''
			local fullName = parts.mod .. ':' .. parts.name
			if v2 ~= '' and not ingredients[fullName] and not animatedIngredients[fullName] then
				table.insert( ingredientKeys, fullName )
				animatedIngredients[fullName] = { mod = parts.mod, name = parts.name, final = k2 == length }
			end
		end
	end
	
	-- Ingredients cell
	local ingredientsCell
	if args.ingredients or '' ~= '' then
		ingredientsCell = args.ingredients
	else
		ingredientsCell = {}
		for k, v in ipairs( ingredientKeys ) do
			local link = ''
			local separator = ', '
			if k == #ingredientKeys - 1 then
				separator = '&nbsp;und'
			elseif k == #ingredientKeys then
				separator = ''
			elseif animatedIngredients[v] and not animatedIngredients[v].final then
				separator = '&nbsp;oder'
			end
			local mod = ( ingredients[v] or animatedIngredients[v] ).mod
			local name = ( ingredients[v] or animatedIngredients[v] ).name
			if mod ~= '' then
				link = 'Mod/'.. mod .. '/' .. name .. '|'
			else
				link = name .. '|'
			end
			
			if name:find( '^Alle ' ) then
				local alias = aliases[name]
				if aliasLinks[alias] ~= nil then
					alias = aliasLinks[alias] .. '|' .. alias
				end
				
				if aliases[name] == title.text then
					table.insert( ingredientsCell, aliases[name] .. separator )
				else
					table.insert( ingredientsCell, '[[' .. alias .. ']]' .. separator )
				end
			elseif name == title.text then
				table.insert( ingredientsCell, name .. separator )
			else
				table.insert( ingredientsCell, '[[' .. link .. name .. ']]' .. separator )
			end
		end
		
		ingredientsCell = table.concat( ingredientsCell, '<br>\n' )
	end
	
	-- Automatic shapeless positioning
	local newArgs = {}
	if args[1] then
		newArgs.shapeless = 1
		if args[7] then
			newArgs.A1 = args[1]
			newArgs.B1 = args[2]
			newArgs.C1 = args[3]
			newArgs.A2 = args[4]
			newArgs.B2 = args[5]
			newArgs.C2 = args[6]
			if args[8] then
				-- ◼◼◼      ◼◼◼
				-- ◼◼◼  OR  ◼◼◼
				-- ◼◼◼      ◼◼◻
				newArgs.A3 = args[7]
				newArgs.B3 = args[8]
				newArgs.C3 = args[9]
				if args[9] then
					local identical = true
					for i = 1, 8 do
						if args[i] ~= args[i + 1] then
							identical = false
						end
					end
					if identical then
						newArgs.shapeless = nil
					end
				end
			else
				-- ◼◼◼
				-- ◼◼◼
				-- ◻◼◻
				newArgs.B3 = args[7]
			end
		elseif args[2] then
			newArgs.A2 = args[1]
			newArgs.B2 = args[2]
			if args[5] then
				-- ◻◻◻      ◻◻◻
				-- ◼◼◼  OR  ◼◼◼
				-- ◼◼◼      ◼◼◻
				newArgs.C2 = args[3]
				newArgs.A3 = args[4]
				newArgs.B3 = args[5]
				newArgs.C3 = args[6]
			elseif args[4] then
				-- ◻◻◻
				-- ◼◼◻
				-- ◼◼◻
				newArgs.A3 = args[3]
				newArgs.B3 = args[4]
			else
				-- ◻◻◻      ◻◻◻
				-- ◼◼◻  OR  ◼◼◻
				-- ◻◼◻      ◻◻◻
				newArgs.B3 = args[3]
			end
		else
			-- ◻◻◻
			-- ◻◼◻
			-- ◻◻◻
			newArgs.B2 = args[1]
			newArgs.shapeless = nil
		end
	else
		newArgs.A1 = args.A1
		newArgs.B1 = args.B1
		newArgs.C1 = args.C1
		newArgs.A2 = args.A2
		newArgs.B2 = args.B2
		newArgs.C2 = args.C2
		newArgs.A3 = args.A3
		newArgs.B3 = args.B3
		newArgs.C3 = args.C3
		newArgs.mirror = args.mirror
	end
	
	-- Any other args we want to pass along
	newArgs.Mod = args.Mod
	newArgs.Output = args.Output
	newArgs.Otitle = args.Otitle
	newArgs.Olink = args.Olink
	
	-- Recipe cell
	local recipeCell = grid.craftingTable( newArgs )
	
	local row = { ingredientsCell, recipeCell }
	if nameCell then
		table.insert( row, 1, nameCell )
	end
	if f:callParserFunction( '#dplvar', 'craftingdescription' ) == '1' then
		table.insert( row, args.description or '' )
	end
	row = table.concat( row, '\n|\n' )
	
	if nameCell then
		row = '!\n' .. row
	else
		row = '|\n' .. row
	end
	
	local footer = ''
	if foot ~= '' then
		footer = '|}'
		f:callParserFunction( '#dplvar:set', 'craftingname', '0', 'craftingdescription', '0' )
	end
	
	if args.debug == '1' then
		return '<pre>' .. header .. '\n' .. row .. '\n|-\n' .. footer .. '</pre>'
	else
		return header .. '\n' .. row .. '\n|-\n' .. footer
	end
end

function p.furnace( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	local grid = require( 'Modul:Grid' )
	
	-- Start table when appropriate
	local multirow = f:callParserFunction( '#dplvar', 'multirow' )
	if multirow ~= '1' then
		multirow = nil
	end
	local head = args.head or ''
	if multirow then
		head = ''
	elseif head ~= '' then
		multirow = 1
		f:callParserFunction( '#dplvar:set', 'multirow', '1' )
	else
		head = 1
	end
	
	-- End table when appropriate
	local foot = args.foot or ''
	if multirow then
		if foot ~= '' then
			multirow = nil
			f:callParserFunction( '#dplvar:set', 'multirow', '0' )
		end
	else
		foot = 1
	end
	
	local header = ''
	if head ~= '' then
		local name = ''
		local description = ''
		if args.showname == '1' or multirow and args.showname ~= '0' then
			name = 'Name !! '
			f:callParserFunction( '#dplvar:set', 'smeltingname', '1' )
		end
		if args.showdescription == '1' then
			description = ' !! class="unsortable" | Beschreibung'
			f:callParserFunction( '#dplvar:set', 'smeltingdescription', '1' )
		end
		local class = args.class or ''
		local recipeClass = ''
		if multirow then
			class = 'sortable collapsible ' .. class
			recipeClass = 'class="unsortable collapse-button" |'
		end
		header = table.concat( {
			' {| class="wikitable ' .. class .. '"',
			'! ' .. name .. 'Zutaten !! ' .. recipeClass .. ' [[Erhitzen|Ofenrezept]]' .. description,
			'|-'
		}, '\n' )
	end
	
	local input = mw.text.trim( args[1] or '' )
	local output = mw.text.trim( args[2] or '' )
	local fuel = args.fuel or ''
	if fuel == '' then
		fuel = 'Alle Brennstoffe'
	end
	
	-- Name cell
	local nameCell
	if args.name or '' ~= '' then
		nameCell = args.name
	elseif multirow or f:callParserFunction( '#dplvar', 'smeltingname' ) == '1' then
		local names = {}
		local links = {}
		for v in mw.text.gsplit( args[2] or '', '%s*;%s*' ) do
			parts = grid.getParts( v )
			if not names[( parts.mod or '' ) .. parts.name] then
				local link = parts.name .. '|'
				if parts.mod then
					link = 'Mod/' .. parts.mod .. '/' .. parts.name .. '|'
				else
					link = parts.name .. '|'
				end
				
					if parts.name:find( '^Alle ' ) then
						local alias = aliases[parts.name]
						if aliasLinks[alias] ~= nil then
							alias = aliasLinks[alias] .. '|' .. alias
						end
						
						if aliases[parts.name] == title.text then
							table.insert( links, aliases[parts.name] )
						else
							table.insert( links, '[[' .. alias .. ']]' )
						end
					elseif parts.name == title.text then
						table.insert( links, parts.name )
					else
						table.insert( links, '[[' .. link .. parts.name .. ']]' )
					end
					names[(parts.mod  or '') .. ':' .. parts.name] = 1
			end
		end
		
		nameCell = table.concat( links, '&nbsp;oder<br>' )
	end
		
	-- Ingredients cell
	local ingredientsCell
	if args.ingredients or '' ~= '' then
		ingredientsCell = args.ingredients
	else
		ingredientsCell = {}
		local ingredients = {}
		for k, v in ipairs{ input, fuel } do
			local separator = ''
			if k == 2 and next( ingredients ) then
				separator = '&nbsp;und<br>\n'
			end
			local itemCount = 0;
			for item in mw.text.gsplit( v, '%s*;%s*' ) do
				local parts = grid.getParts( item )
				if parts.name ~= '' and not ingredients[parts.name] and ( k == 2 or k == 1 and v ~= fuel ) then
					itemCount = itemCount + 1
					local link = ''
					if separator == '' and next( ingredients ) then
						if itemCount == #mw.text.split( v, '%s*;%s*' ) - 2 then
							separator = '&nbsp;oder<br />\n'
						else
							separator = ',<br />\n'
						end
					end
					
					if parts.mod then
						link = 'Mod/'.. parts.mod .. '/' .. parts.name .. '|'
					else
						link = parts.name .. '|'
					end
					
					if parts.name:find( '^Alle ' ) then
						local alias = aliases[parts.name]
						if aliasLinks[alias] ~= nil then
							alias = aliasLinks[alias] .. '|' .. alias
						end
						
						if aliases[parts.name] == title.text then
							table.insert( ingredientsCell, separator .. aliases[parts.name] )
						else
							table.insert( ingredientsCell, separator .. '[[' .. alias .. ']]' )
						end
					elseif parts.name == title.text then
						table.insert( ingredientsCell, separator .. parts.name  )
					else
						table.insert( ingredientsCell, separator .. '[[' .. link .. parts.name .. ']]' )
					end
					
					separator = ''
					ingredients[parts.name] = 1
				end
			end
		end
		
		ingredientsCell = table.concat( ingredientsCell )
	end
	
	-- Any args we want to pass along
	local newArgs = {
		Input = args[1],
		Output = args[2],
		Fuel = fuel,
		Ititle = args.Ititle,
		Otitle = args.Otitle,
		Ftitle = args.Ftitle
	}
	
	-- Recipe cell
	local recipeCell = grid.furnace( newArgs )
	
	local row = { ingredientsCell, recipeCell }
	if nameCell then
		table.insert( row, 1, nameCell )
	end
	if f:callParserFunction( '#dplvar', 'smeltingdescription' ) == '1' then
		table.insert( row, args.description or '' )
	end
	row = table.concat( row, '\n|\n' )
	
	if nameCell then
		row = '!\n' .. row
	else
		row = '|\n' .. row
	end
	
	local footer = ''
	if foot ~= '' then
		footer = '|}'
		f:callParserFunction( '#dplvar:set', 'smeltingname', '0', 'smeltingdescription', '0' )
	end
	
	return header .. '\n' .. row .. '\n|-\n' .. footer
end

function p.brewing( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	local grid = require( 'Modul:Grid' )
	
	-- Start table when appropriate
	local multirow = f:callParserFunction( '#dplvar', 'multirow' )
	if multirow ~= '1' then
		multirow = nil
	end
	local head = args.head or ''
	if multirow then
		head = ''
	elseif head ~= '' then
		multirow = 1
		f:callParserFunction( '#dplvar:set', 'multirow', '1' )
	else
		head = 1
	end
	
	-- End table when appropriate
	local foot = args.foot or ''
	if multirow then
		if foot ~= '' then
			multirow = nil
			f:callParserFunction( '#dplvar:set', 'multirow', '0' )
		end
	else
		foot = 1
	end
	
	local header = ''
	if head ~= '' then
		local name = ''
		local description = ''
		local effect = ''
		if args.showname == '1' or multirow and args.showname ~= '0' then
			name = 'Name !! '
			f:callParserFunction( '#dplvar:set', 'brewingname', '1' )
		end
		if args.showdescription == '1' then
			description = ' !! class="unsortable" | Beschreibung'
			f:callParserFunction( '#dplvar:set', 'brewingdescription', '1' )
		end
		if args.showeffect == '1' then
			effect = ' !! class="unsortable" | Effekt !! class="unsortable" | Dauer'
			f:callParserFunction( '#dplvar:set', 'brewingeffect', '1' )
		end
		local class = args.class or ''
		local recipeClass = ''
		if multirow then
			class = 'sortable collapsible ' .. class
			recipeClass = 'class="unsortable collapse-button" |'
		end
		header = table.concat( {
			' {| class="wikitable ' .. class .. '"',
			'! ' .. name .. 'Zutaten !! ' .. recipeClass .. ' [[Brauen|Brau]]rezept' .. effect .. description,
			'|-'
		}, '\n' )
	end
	
	local input = mw.text.trim( args[1] or '' )
	local output2 = mw.text.trim( args[2] or '' )
    local base = args.base or ''
	if base == '' then
		base = 'Seltsamer Trank'
	end
	
	-- Name cell
	local nameCell
	if args.name or '' ~= '' then
		nameCell = args.name
	elseif multirow or f:callParserFunction( '#dplvar', 'brewingname' ) == '1' then
		local names = {}
		local links = {}
		for v in mw.text.gsplit( args[2] or '', '%s*;%s*' ) do
			parts = grid.getParts( v )
			if not names[( parts.mod or '' ) .. parts.name] then
				local link = ''
				if parts.mod then
					link = 'Mod/' .. parts.mod .. '/' .. parts.name .. '|'
				else
					link = parts.name .. '|'
				end
				
				if parts.name:find( '^Alle ' ) then
					local alias = aliases[parts.name]
					if aliasLinks[alias] ~= nil then
						alias = aliasLinks[alias] .. '|' .. alias
					end
					
					if aliases[parts.name] == title.text then
						table.insert( links, aliases[parts.name] )
					else
						table.insert( links, '[[' .. alias .. ']]' )
					end
				elseif parts.name == title.text then
					table.insert( links, parts.name )
				else
					table.insert( links, '[[' .. link .. parts.name .. ']]' )
				end
				names[(parts.mod  or '') .. ':' .. parts.name] = 1
			end
		end
		
		nameCell = table.concat( links, '&nbsp;oder<br>' )
	end

	-- Ingredients cell
	local ingredientsCell
	if args.ingredients or '' ~= '' then
		ingredientsCell = args.ingredients
	else
		ingredientsCell = {}
		local ingredients = {}
		for k, v in ipairs{ input, base } do
			local separator = ''
			if k == 2 and next( ingredients ) then
				separator = ',<br>\n'
			end
			for item in mw.text.gsplit( v, '%s*;%s*' ) do
				local parts = grid.getParts( item )
				if parts.name ~= '' and name ~= nil and not ingredients[parts.name] and ( k == 2 or k == 1 and v ~= base ) then
					local link = ''
					if separator == '' and next( ingredients ) then
						separator = '&nbsp;oder<br>\n'
					end
					
					if parts.mod then
						link = 'Mod/'.. parts.mod .. '/' .. parts.name .. '|'
					else
						link = parts.name .. '|'
					end
					
					if name:find( '^Alle ' ) then
						local alias = aliases[name]
						if aliasLinks[alias] ~= nil then
							alias = aliasLinks[alias] .. '|' .. alias
						end
						
						if aliases[name] == title.text then
							table.insert( ingredientsCell, aliases[name] .. separator )
						else
							table.insert( ingredientsCell, '[[' .. alias .. ']]' .. separator )
						end
					elseif name == title.text then
						table.insert( ingredientsCell, name .. separator )
					else
						table.insert( ingredientsCell, '[[' .. link .. name .. ']]' .. separator )
					end
					separator = ''
					
					ingredients[parts.name] = 1
				end
			end
		end
		
		ingredientsCell = table.concat( ingredientsCell )
	end
	
	-- Whether to show base or output
	local newArgs = {}
		if args.showbase == '1' then
       		newArgs.Output2 = base
			newArgs.Output1 = args.base2
			newArgs.Output3 = args.base3
		else
       		newArgs.Output2 = args[2]
			newArgs.Output1 = args[3]
			newArgs.Output3 = args[4]
		end

    -- Any other args we want to pass along
	newArgs.Input = args[1]
	newArgs.Ititle = args.Ititle
	newArgs.O2title = args.Otitle
	newArgs.O1title = args.O2title
	newArgs.O3title = args.O3title
	
	-- Recipe cell
	local recipeCell = grid.brewingStand( newArgs )
	
	local row = { ingredientsCell, recipeCell }
	if nameCell then
		table.insert( row, 1, nameCell )
	end
	local effectCell = args.effect or ''
	if f:callParserFunction( '#dplvar', 'brewingeffect' ) == '1' then
		table.insert( row, effectCell )
	end
	local durationCell = args.duration or ''
	if f:callParserFunction( '#dplvar', 'brewingeffect' ) == '1' then
		table.insert( row, durationCell )
	end
	local descriptionCell = args.description or ''
	if f:callParserFunction( '#dplvar', 'brewingdescription' ) == '1' then
		table.insert( row, descriptionCell )
	end
	row = table.concat( row, '\n|\n' )
	
	if nameCell then
		row = '!\n' .. row
	else
		row = '|\n' .. row
	end
	
	local footer = ''
	if foot ~= '' then
		footer = '|}'
		f:callParserFunction( '#dplvar:set', 'brewingname', '0', 'brewingdescription', '0' )
	end
	
	return header .. '\n' .. row .. '\n|-\n' .. footer
end

function p.anvil( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	local grid = require( 'Modul:Grid' )
	
	-- Start table when appropriate
	local multirow = f:callParserFunction( '#dplvar', 'multirow' )
	if multirow ~= '1' then
		multirow = nil
	end
	local head = args.head or ''
	if multirow then
		head = ''
	elseif head ~= '' then
		multirow = 1
		f:callParserFunction( '#dplvar:set', 'multirow', '1' )
	else
		head = 1
	end
	
	-- End table when appropriate
	local foot = args.foot or ''
	if multirow then
		if foot ~= '' then
			multirow = nil
			f:callParserFunction( '#dplvar:set', 'multirow', '0' )
		end
	else
		foot = 1
	end
	
	local header = ''
	if head ~= '' then
		local name = ''
		local description = ''
		if args.showname == '1' or multirow and args.showname ~= '0' then
			name = 'Name !! '
			f:callParserFunction( '#dplvar:set', 'ambossname', '1' )
		end
		if args.showdescription == '1' then
			description = ' !! class="unsortable" | Beschreibung'
			f:callParserFunction( '#dplvar:set', 'ambossdescription', '1' )
		end
		local class = args.class or ''
		local recipeClass = ''
		if multirow then
			class = 'sortable collapsible ' .. class
			recipeClass = 'class="unsortable collapse-button" |'
		end
		header = table.concat( {
			' {| class="wikitable ' .. class .. '"',
			'! ' .. name .. 'Zutaten !! ' .. recipeClass .. ' [[Schmieden|Ambossrezept]]' .. description,
			'|-'
		}, '\n' )
	end
	
	local input = mw.text.trim( args[1] or '' )
	local output = args.output or args[1] or ''
	local fuel = mw.text.trim( args[2] or '' )
	
	-- Name cell
	local nameCell
	if args.name or '' ~= '' then
		nameCell = args.name
	elseif multirow or f:callParserFunction( '#dplvar', 'ambossname' ) == '1' then
		local names = {}
		local links = {}
		for v in mw.text.gsplit( args.output or args[1] or '', '%s*;%s*' ) do
			parts = grid.getParts( v )
			if not names[( parts.mod or '' ) .. parts.name] then
				local link = parts.name .. '|'
				if parts.mod then
					link = 'Mod/' .. parts.mod .. '/' .. parts.name .. '|'
				else
					link = parts.name .. '|'
				end
				
					if parts.name:find( '^Alle ' ) then
						local alias = aliases[parts.name]
						if aliasLinks[alias] ~= nil then
							alias = aliasLinks[alias] .. '|' .. alias
						end
						
						if aliases[parts.name] == title.text then
							table.insert( links, aliases[parts.name] )
						else
							table.insert( links, '[[' .. alias .. ']]' )
						end
					elseif ( titleAlias ~= nil and titleAlias == title.text ) then
						table.insert( ingredientsCell, separator .. titleAlias )
					elseif titleAlias ~= nil then
						table.insert( ingredientsCell, separator .. '[[' .. link .. titleAlias .. ']]' )
					elseif parts.name == title.text then
						table.insert( links, parts.name )
					else
						table.insert( links, '[[' .. link .. parts.name .. ']]' )
					end
					names[(parts.mod  or '') .. ':' .. parts.name] = 1
			end
		end
		
		nameCell = table.concat( links, '&nbsp;oder<br>' )
	end
		
	-- Ingredients cell
	local ingredientsCell
	if args.ingredients or '' ~= '' then
		ingredientsCell = args.ingredients
	else
		ingredientsCell = {}
		local ingredients = {}
		for k, v in ipairs{ input, fuel } do
			local separator = ''
			if k == 2 and next( ingredients ) then
				separator = '&nbsp;und<br>\n'
			end
			local itemCount = 0;
			for item in mw.text.gsplit( v, '%s*;%s*' ) do
				local parts = grid.getParts( item )
				if parts.name ~= '' and not ingredients[parts.name] and ( k == 2 or k == 1 and v ~= fuel ) then
					itemCount = itemCount + 1
					local link = ''
					if separator == '' and next( ingredients ) then
						if itemCount == #mw.text.split( v, '%s*;%s*' ) - 2 then
							separator = '&nbsp;oder<br />\n'
						else
							separator = ',<br />\n'
						end
					end
					
					if parts.mod then
						link = 'Mod/'.. parts.mod .. '/' .. parts.name .. '|'
					else
						link = parts.name .. '|'
					end
					
					local titleAlias = titleAliases[parts.name]
					
					if parts.name:find( '^Alle ' ) then
						local alias = aliases[parts.name]
						if aliasLinks[alias] ~= nil then
							alias = aliasLinks[alias] .. '|' .. alias
						end
						
						if aliases[parts.name] == title.text then
							table.insert( ingredientsCell, separator .. aliases[parts.name] )
						else
							table.insert( ingredientsCell, separator .. '[[' .. alias .. ']]' )
						end
					elseif ( titleAlias ~= nil and titleAlias == title.text ) then
						table.insert( ingredientsCell, separator .. titleAlias )
					elseif titleAlias ~= nil then
						table.insert( ingredientsCell, separator .. '[[' .. link .. titleAlias .. ']]' )
					elseif parts.name == title.text then
						table.insert( ingredientsCell, separator .. parts.name )
					else
						table.insert( ingredientsCell, separator .. '[[' .. link .. parts.name .. ']]' )
					end
					
					separator = ''
					ingredients[parts.name] = 1
				end
			end
		end
		
		ingredientsCell = table.concat( ingredientsCell )
	end
	
	-- Any args we want to pass along
	local newArgs = {
		input = args[1],
		victim = args[2],
		output = args.output,
		title = args.title,
		level = args.level,
		red = args.red,
		locked = args.locked
	}
	
	-- Recipe cell
	local recipeCell = grid.anvil( newArgs )
	
	local row = { ingredientsCell, recipeCell }
	if nameCell then
		table.insert( row, 1, nameCell )
	end
	if f:callParserFunction( '#dplvar', 'ambossdescription' ) == '1' then
		table.insert( row, args.description or '' )
	end
	row = table.concat( row, '\n|\n' )
	
	if nameCell then
		row = '!\n' .. row
	else
		row = '|\n' .. row
	end
	
	local footer = ''
	if foot ~= '' then
		footer = '|}'
		f:callParserFunction( '#dplvar:set', 'ambossname', '0', 'ambossdescription', '0' )
	end
	
	return header .. '\n' .. row .. '\n|-\n' .. footer
end

return p