<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://tibiacraft.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ACrafting</id>
	<title>Module:Crafting - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://tibiacraft.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ACrafting"/>
	<link rel="alternate" type="text/html" href="http://tibiacraft.com/index.php?title=Module:Crafting&amp;action=history"/>
	<updated>2026-07-17T03:01:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>http://tibiacraft.com/index.php?title=Module:Crafting&amp;diff=53&amp;oldid=prev</id>
		<title>Root: Created page with &quot;local p = {}  -- Internationalization data local i18n = { 	moduleArgs = Module:ProcessArgs, 	moduleRecipe = Module:Recipe table, 	moduleSlot = Module:Inventory slot, 	type = &#039;Crafting&#039; } p.i18n = i18n  -- Global dependencies and constants local slot = require( i18n.moduleSlot ) local recipeTable = require( i18n.moduleRecipe ).table local cArgVals = { &#039;A1&#039;, &#039;B1&#039;, &#039;C1&#039;, &#039;A2&#039;, &#039;B2&#039;, &#039;C2&#039;, &#039;A3&#039;, &#039;B3&#039;, &#039;C3&#039; } p.cArgVals = cArgVals  -- Service function: Automatical...&quot;</title>
		<link rel="alternate" type="text/html" href="http://tibiacraft.com/index.php?title=Module:Crafting&amp;diff=53&amp;oldid=prev"/>
		<updated>2025-10-04T16:48:02Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local p = {}  -- Internationalization data local i18n = { 	moduleArgs = &lt;a href=&quot;/wiki/Module:ProcessArgs&quot; title=&quot;Module:ProcessArgs&quot;&gt;Module:ProcessArgs&lt;/a&gt;, 	moduleRecipe = &lt;a href=&quot;/wiki/Module:Recipe_table&quot; title=&quot;Module:Recipe table&quot;&gt;Module:Recipe table&lt;/a&gt;, 	moduleSlot = &lt;a href=&quot;/wiki/Module:Inventory_slot&quot; title=&quot;Module:Inventory slot&quot;&gt;Module:Inventory slot&lt;/a&gt;, 	type = &amp;#039;Crafting&amp;#039; } p.i18n = i18n  -- Global dependencies and constants local slot = require( i18n.moduleSlot ) local recipeTable = require( i18n.moduleRecipe ).table local cArgVals = { &amp;#039;A1&amp;#039;, &amp;#039;B1&amp;#039;, &amp;#039;C1&amp;#039;, &amp;#039;A2&amp;#039;, &amp;#039;B2&amp;#039;, &amp;#039;C2&amp;#039;, &amp;#039;A3&amp;#039;, &amp;#039;B3&amp;#039;, &amp;#039;C3&amp;#039; } p.cArgVals = cArgVals  -- Service function: Automatical...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Internationalization data&lt;br /&gt;
local i18n = {&lt;br /&gt;
	moduleArgs = [[Module:ProcessArgs]],&lt;br /&gt;
	moduleRecipe = [[Module:Recipe table]],&lt;br /&gt;
	moduleSlot = [[Module:Inventory slot]],&lt;br /&gt;
	type = &amp;#039;Crafting&amp;#039;&lt;br /&gt;
}&lt;br /&gt;
p.i18n = i18n&lt;br /&gt;
&lt;br /&gt;
-- Global dependencies and constants&lt;br /&gt;
local slot = require( i18n.moduleSlot )&lt;br /&gt;
local recipeTable = require( i18n.moduleRecipe ).table&lt;br /&gt;
local cArgVals = { &amp;#039;A1&amp;#039;, &amp;#039;B1&amp;#039;, &amp;#039;C1&amp;#039;, &amp;#039;A2&amp;#039;, &amp;#039;B2&amp;#039;, &amp;#039;C2&amp;#039;, &amp;#039;A3&amp;#039;, &amp;#039;B3&amp;#039;, &amp;#039;C3&amp;#039; }&lt;br /&gt;
p.cArgVals = cArgVals&lt;br /&gt;
&lt;br /&gt;
-- Service function: Automatically arrange the shapeless recipe set by numbered&lt;br /&gt;
-- parameters&lt;br /&gt;
local function arrangeShapelessRecipe(args)&lt;br /&gt;
	if args[1] then&lt;br /&gt;
		args.shapeless = 1&lt;br /&gt;
		if args[7] then&lt;br /&gt;
			args.A1 = args[1]&lt;br /&gt;
			args.B1 = args[2]&lt;br /&gt;
			args.C1 = args[3]&lt;br /&gt;
			args.A2 = args[4]&lt;br /&gt;
			args.B2 = args[5]&lt;br /&gt;
			args.C2 = args[6]&lt;br /&gt;
			if args[8] then&lt;br /&gt;
				-- ◼◼◼      ◼◼◼&lt;br /&gt;
				-- ◼◼◼  OR  ◼◼◼&lt;br /&gt;
				-- ◼◼◼      ◼◼◻&lt;br /&gt;
				-- (where ◼ is filled slot, ◻ is empty slot)&lt;br /&gt;
				args.A3 = args[7]&lt;br /&gt;
				args.B3 = args[8]&lt;br /&gt;
				args.C3 = args[9]&lt;br /&gt;
				if args[9] then&lt;br /&gt;
					-- If all slots are the same, the recipe is not shapeless&lt;br /&gt;
					local identical = true&lt;br /&gt;
					for i = 1, 8 do&lt;br /&gt;
						if args[i] ~= args[i + 1] then&lt;br /&gt;
							identical = false&lt;br /&gt;
							break&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
					if identical then&lt;br /&gt;
						args.shapeless = nil&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				-- ◼◼◼&lt;br /&gt;
				-- ◼◼◼&lt;br /&gt;
				-- ◻◼◻&lt;br /&gt;
				args.B3 = args[7]&lt;br /&gt;
			end&lt;br /&gt;
		elseif args[2] then&lt;br /&gt;
			args.A2 = args[1]&lt;br /&gt;
			args.B2 = args[2]&lt;br /&gt;
			if args[5] then&lt;br /&gt;
				-- ◻◻◻      ◻◻◻&lt;br /&gt;
				-- ◼◼◼  OR  ◼◼◼&lt;br /&gt;
				-- ◼◼◼      ◼◼◻&lt;br /&gt;
				args.C2 = args[3]&lt;br /&gt;
				args.A3 = args[4]&lt;br /&gt;
				args.B3 = args[5]&lt;br /&gt;
				args.C3 = args[6]&lt;br /&gt;
			elseif args[4] then&lt;br /&gt;
				-- ◻◻◻&lt;br /&gt;
				-- ◼◼◻&lt;br /&gt;
				-- ◼◼◻&lt;br /&gt;
				args.A3 = args[3]&lt;br /&gt;
				args.B3 = args[4]&lt;br /&gt;
			else&lt;br /&gt;
				-- ◻◻◻      ◻◻◻&lt;br /&gt;
				-- ◼◼◻  OR  ◼◼◻&lt;br /&gt;
				-- ◻◼◻      ◻◻◻&lt;br /&gt;
				args.B3 = args[3]&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- ◻◻◻&lt;br /&gt;
			-- ◻◼◻&lt;br /&gt;
			-- ◻◻◻&lt;br /&gt;
			-- Recipe with only one ingredient is not shapeless&lt;br /&gt;
			args.B2 = args[1]&lt;br /&gt;
			args.shapeless = nil&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- Clear the original numbered parameters;&lt;br /&gt;
		-- [[Module:UI]].craftingTable() doesn’t need them&lt;br /&gt;
		for i = 1, 9 do&lt;br /&gt;
			args[i] = nil&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Main entry point&lt;br /&gt;
function p.table( f )&lt;br /&gt;
	-- Process the arguments&lt;br /&gt;
	local args = f&lt;br /&gt;
	if f == mw.getCurrentFrame() then&lt;br /&gt;
		args = require( i18n.moduleArgs ).merge( true )&lt;br /&gt;
	else&lt;br /&gt;
		f = mw.getCurrentFrame()&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Arrange the shapeless recipe&lt;br /&gt;
	arrangeShapelessRecipe(args)&lt;br /&gt;
	&lt;br /&gt;
	-- Create the recipe table and save the data&lt;br /&gt;
	local out = recipeTable( args, {&lt;br /&gt;
		uiFunc = &amp;#039;craftingTable&amp;#039;,&lt;br /&gt;
		type = i18n.type,&lt;br /&gt;
		ingredientArgs = cArgVals,&lt;br /&gt;
		outputArgs = { &amp;#039;Output&amp;#039; },&lt;br /&gt;
		saveToDatabase = true,&lt;br /&gt;
		otherArgsToSave = {&amp;quot;type&amp;quot;, &amp;quot;shapeless&amp;quot;, &amp;quot;fixed&amp;quot;, &amp;quot;notfixed&amp;quot;, &amp;quot;group&amp;quot;},&lt;br /&gt;
		extraProperties = { [&amp;quot;type&amp;quot;] = args.type }&lt;br /&gt;
	} )&lt;br /&gt;
	&lt;br /&gt;
	return out&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Root</name></author>
	</entry>
</feed>