Module:Recipe

来自Don't Starve Wiki
跳转到导航 跳转到搜索

by: Sodiumaluminate(留言) 2022年5月19日 (四) 06:56 (UTC)

使用范例见 https://dontstarve.fandom.com/zh/wiki/User:Sodiumaluminate/recipe

谁爱写文档谁写吧咕咕咕!

更新数据的话,去:Module:RecipesData


local recipesData = require "Module:RecipesData"

local fromCode = require "Module:FromCode"

local builder_tag_meanings = {
	balloonomancer = "Wes",
	battlesinger = "Wigfrid",
	bookbuilder = "Wickerbottom",
	clockmaker = "Wanda",
	elixirbrewer = "Wendy",
	ghostlyfriend = "Wendy",
	handyperson = "Winona",
	masterchef = "Warly",
	merm_builder = "Wurt",
	pebblemaker = "Walter",
	pinetreepioneer = "Walter",
	plantkin = "Wormwood",
	professionalchef = "Warly",
	pyromaniac = "Willow",
	shadowmagic = "Maxwell",
	spiderwhisperer = "Webber",
	strongman = "Wolfgang",
	upgrademoduleowner = "WX-78",
	valkyrie = "Wigfrid",
	werehuman = "Woodie",
}

local alpt = {}

local function tableLength(t)
	local count = 0
	for k, v in pairs(t) do
		count = count + 1
	end
	return count
end

--[[
	获取所有满足 testfn 的配方
	单个配方格式示例:
  {
    ingredients={ livinglog=2, nightmarefuel=4, yellowgem=2 },
    product={ amount=1, prefab="yellowstaff" },
    tech={ ANCIENT=2 }
  }
]]
local function getRecipes(testfn)
	local recipes = {}

	for _, v in pairs(recipesData)
	do
		if (testfn(v)) then
			table.insert(recipes, v)
		end
	end

	return recipes
end



--[[
	将 prefab 转为英文,便于喂给上古 Recipe 模板。
]]
local function getString(msgctxt, language)
	local frame = { args = { msgctxt, language } }
	return fromCode.getData(frame)
end
local function translate(prefab)
	if prefab == "decrease_sanity" then
		return "Sanity Decrease"
	end
	if prefab == "decrease_health" then
		return "Health Decrease"
	end
	return getString(
			"STRINGS.NAMES." .. (prefab:upper()),
			"en"
	)
end

local testFunctions = {
	hermitshop_supertacklecontainer = function(recipe)
		return recipe and recipe.product and recipe.product.prefab and
				recipe.product.prefab == "supertacklecontainer" and
				(not recipe.is_deconstruction_recipe)
	end,
	figure = function(recipe)
		return recipe and
				recipe.ingredients and
				recipe.ingredients.rocks == 2 and
				recipe.ingredients.sculpting_material == 2 and
				recipe.tech and
				recipe.tech.ANCIENT == 10 and
				recipe.tech.MAGIC == 10 and
				recipe.tech.SCIENCE == 10
	end
}

local recipeTechListOverride = {
	[testFunctions.hermitshop_supertacklecontainer] = {
		tool = "Crabby Hermit",
		note = "需要好感不小于 8。"
		-- 别问,问就是科雷神仙代码。
	},
	[testFunctions.figure] = {
		tool = "Potter's Wheel",
		note = "可以使用石砖、大理石、月亮碎片作为雕塑材料,但需要提前向陶轮放入对应的雕塑草图。"
	}
}

local recipeTechList = {
	ANCIENT = {
		[2] = "Broken Pseudoscience Station",
		[4] = "Ancient Pseudoscience Station",
		note = {
			[2] = "也可以使用完整的远古伪科学站。"
		}
	},

	BEEFOFFERING = {
		[3] = "Beefalo Shrine"
	},

	CARNIVAL_HOSTSHOP = {
		[1] = "Corvus Goodfeather",
		[3] = "Corvus Goodfeather",
		note = {
			[3] = "需要先种树。"
		}
	},

	CARNIVAL_PRIZESHOP = {
		[1] = "Prize Booth Build"
	},

	CARRATOFFERING = {
		[3] = "Carrat Shrine"
	},

	CARTOGRAPHY = {
		[2] = "Cartographer's Desk"
	},

	CATCOONOFFERING = {
		[3] = "Catcoon Shrine",
		note = {
			[3] = "需要放置任意羽毛。"
		}
	},
	CELESTIAL = {
		[1] = "Celestial Orb",
		[3] = "Celestial Altar", -- 其实是三个都可以,但是上游模块它不靠谱啊(
		note = {
			[1] = "也可以使用天体祭坛。",
			[3] = "天体祭坛、天体圣殿、天体贡品当作合成站时没有实际的区别。"
		}
	},
	FISHING = {
		[1] = "Tackle Receptacle"
	},
	FOODPROCESSING = {
		[1] = "Portable Grinding Mill"
	},
	HERMITCRABSHOP = {
		[1] = "Crabby Hermit",
		[3] = "Crabby Hermit",
		[5] = "Crabby Hermit",
		[7] = "Crabby Hermit",
		note = {
			[1] = "需要好感不小于 1。",
			[3] = "需要好感不小于 3。",
			[5] = "需要好感不小于 6。",
			[7] = "需要好感不小于 8。"
		}
	},
	MADSCIENCE = {
		[1] = "Mad Scientist Lab"
	},

	MAGIC = {
		[2] = "Prestihatitator",
		[3] = "Shadow Manipulator",
		note = {
			[2] = "也可以使用暗影操控器。"
		}
	},
	MASHTURFCRAFTING = {
		[2] = "Terra Firma Tamper"
	},
	ORPHANAGE = {
		[1] = "Rock Den"
	},
	PERDOFFERING = {
		[1] = "Gobbler Shrine",
		[3] = "Gobbler Shrine",
		note = {
			[1] = "其他神龛也可以制作。"
		}
	},
	PIGOFFERING = {
		[3] = "Pig Shrine"
	},
	ROBOTMODULECRAFT = {
		[1] = nil,
		note = {
			[1] = "需要扫描对应生物。"
		}
	},
	SCIENCE = {
		[1] = "Science Machine",
		[2] = "Alchemy Engine",
		[10] = "",
		note = {
			[1] = "也可以使用炼金引擎。",
			[10] = "需要在对应的活动下制作。"
		}
	},
	SCULPTING = {
		[1] = "Potter's Wheel",
		note = {
			[1] = "可以使用石砖、大理石、月亮碎片作为雕塑材料。"
		}
	},
	SEAFARING = {
		[1] = "Think Tank"
	},
	SHADOW = {
		[3] = "Codex Umbra"
	},
	SPIDERCRAFT = {
		[1] = nil,
		note = {
			[1] = "需要招募对应蜘蛛才能解锁。"
		}
	},
	TURFCRAFTING = {
		[2] = "Terra Firma Tamper"
	},
	WARGOFFERING = {
		[3] = "Varg Shrine"
	},
	WINTERSFEASTCOOKING = {
		[1] = "Masonry Oven"
	},
	BOOKCRAFT = {
		[1] = "Bookcase"
	}
}

local WILSON_BUILDER_TAGS = {
	skill_wilson_allegiance_lunar = "STRINGS.SKILLTREE.WILSON.WILSON_ALLEGIANCE_LUNAR_TITLE",
	skill_wilson_allegiance_shadow = "STRINGS.SKILLTREE.WILSON.WILSON_ALLEGIANCE_SHADOW_TITLE",

	alchemist = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_1_TITLE",

	gem_alchemistI = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_2_TITLE",
	ore_alchemistI = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_3_TITLE",
	ick_alchemistI = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_4_TITLE",

	gem_alchemistII = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_5_TITLE",
	gem_alchemistIII = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_6_TITLE",
	ore_alchemistII = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_7_TITLE",
	ore_alchemistIII = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_8_TITLE",
	ick_alchemistII = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_9_TITLE",
	ick_alchemistIII = "STRINGS.SKILLTREE.WILSON.WILSON_ALCHEMY_10_TITLE",

	--[[
		1
	3	2	4
	7	5	9
	8	6	10
	科雷给技能排序的方式怕不是脑子有大病
	]]
}

local function showRecipe(recipe, frame)
	local q = {}

	local i = 1
	for k, v in pairs(recipe.ingredients) do
		q["item" .. i] = translate(k)
		q["count" .. i] = v
		i = i + 1
	end

	if (tableLength(recipe.product) > 1) then
		error("more than 1 product in recipe")
	end
	for productPrefab, productCount in pairs(recipe.product) do
		q.result = translate(productPrefab)
		if productCount > 1 then
			q.resultcount = productCount -- 为了防止模板抽风加的 if。
		end
	end

	if recipe.builder_tag then
		q.character = builder_tag_meanings[recipe.builder_tag]
		-- 老奶奶自带科学加一,因此老奶奶专属配方要翻译。
		if (q.character == "Wickerbottom" and recipe and recipe.tech and recipe.tech.SCIENCE and recipe.tech.SCIENCE < 4) then
			recipe.tech.SCIENCE = recipe.tech.SCIENCE - 1
		end
		if (WILSON_BUILDER_TAGS[recipe.builder_tag]) then
			q.note = '需要解锁威尔逊技能树"' .. getString(WILSON_BUILDER_TAGS[recipe.builder_tag], "zh") .. '"。'
		end
	end

	local isBluePrint = false
	if recipe.tech and recipe.tech.MAGIC == 10 and recipe.tech.ANCIENT == 10 and recipe.tech.SCIENCE == 10 then
		-- 蓝图解锁(十本可还行)
		-- Tony:不确定,我只知道那部分 klei 的代码是很最捞的一段时间
		q.tool = "Blueprint (rare)"
		isBluePrint = true
	end

	if (not isBluePrint) then
		local recipeTech = nil
		local recipeTechNote = nil
		if (recipe.tech and tableLength(recipe.tech) > 1) then
			error("需要多于一个科技站的非蓝图配方:" .. recipe.product.prefab)
		end

		if (recipe.tech) then
			for type, level in pairs(recipe.tech) do
				recipeTechList[type] = recipeTechList[type] or {}
				q.tool = recipeTechList[type][level] or ""
				if (recipeTechList[type].note and recipeTechList[type].note[level]) then
					q.note = recipeTechList[type].note[level]
				end
			end
		end
	end

	for testFunction, override in pairs(recipeTechListOverride) do
		if (testFunction(recipe)) then
			for k, v in pairs(override) do
				q[k] = v
			end
		end
	end

	return frame:expandTemplate { title = "Recipe", args = q }
end

local function showRecipes(recipes, frame)
	if (#recipes == 0) then
		error("no recipes found.")
	end
	local buffer = ""
	for _, recipe in pairs(recipes) do
		if (not recipe.is_deconstruction_recipe) then
			buffer = buffer .. showRecipe(recipe, frame) .. "\n"
		end
	end
	return buffer
end


--[[
  getRecipes(testFn)


  {
    ingredients={ livinglog=2, nightmarefuel=4, yellowgem=2 },
    product={ amount=1, prefab="yellowstaff" },
    tech={ ANCIENT=2 }
  }
]]
alpt.printRecipesByNeed = function(frame)
	local prefab = frame.args.prefab or frame.args[1]
	if (not prefab) then
		error("prefab not found")
	end

	local testFn = function(recipe)
		return recipe and recipe.ingredients and recipe.ingredients[prefab]
	end
	local recipes = getRecipes(testFn)

	return showRecipes(recipes, frame)
end

alpt.printRecipesByResult = function(frame)
	local prefab = frame.args.prefab or frame.args[1]
	if (not prefab) then
		error("prefab not found")
	end

	local testFn = function(recipe)
		return recipe and recipe.product and recipe.product[prefab]
	end
	local recipes = getRecipes(testFn)

	return showRecipes(recipes, frame)
end

alpt.printRecipesByRequires = function(frame)

	-- requires 可以是角色,制作站,制作tab名字
	local requires = frame.args[1]

	-- 输入报错
	if (not requires) then
		error("需要一个检索关键词。")
	end

	local errors = {
		["女武神"] = '需要消歧义: 使用"虚假的女武神"来列出薇格弗德的配方, 使用"真正的女武神"来列出温蒂的配方, 使用"真正的暗影之王"来列出旺达的配方',
		["暗影之王"] = '需要消歧义: 使用"虚假的暗影之王"来列出麦斯威尔的配方, 使用"真正的麦斯威尔"来列出旺达的配方'
	}
	if (errors[requires]) then
		error(errors[requires])
	end

	-- 忽略大小写
	requires = requires:lower()

	-- 角色别名处理
	local charaAlias = {
		["沃特"] = "wurt", ["鱼人"] = "wurt", ["鱼娘"] = "wurt",
		["薇格弗德"] = "wigfrid", ["虚假的女武神"] = "wigfrid", ["wathgrithr"] = "wigfrid", ["舞台艺术"] = "wigfrid",
		["沃利"] = "warly", ["大厨"] = "warly", ["厨师"] = "warly", ["炼金术士"] = "warly",
		["韦斯"] = "wes", ["小丑"] = "wes", ["气球"] = "wes",
		["wx78"] = "wx-78", ["机器人"] = "wx-78",
		["温蒂"] = "wendy", ["真正的女武神"] = "wendy",
		["沃尔夫冈"] = "wolfgang", ["大力士"] = "wolfgang",
		["韦伯"] = "webber", ["蜘蛛人"] = "webber", ["蜘蛛男孩"] = "webber", ["蜘蛛护理"] = "webber",
		["麦斯威尔"] = "maxwell", ["老麦"] = "maxwell", ["血量单位"] = "maxwell", ["威廉"] = "maxwell", ["虚假的暗影之王"] = "maxwell", ["waxwell"] = "maxwell", ["william"] = "maxwell",
		["旺达"] = "wanda", ["钟表匠"] = "wanda", ["真正的暗影之王"] = "wanda", ["制表"] = "wanda",
		["薇洛"] = "willow", ["火女"] = "willow", ["纵火犯"] = "willow", ["纵火者"] = "willow",
		["沃姆伍德"] = "wormwood", ["植物人"] = "wormwood", ["虫木"] = "wormwood",
		["薇克巴顿"] = "wickerbottom", ["图书管理员"] = "wickerbottom", ["书本"] = "wickerbottom",
		["沃尔特"] = "walter", ["小男孩"] = "walter", ["松树先锋队"] = "walter", ["先锋队"] = "walter", ["松树先锋队员"] = "walter", ["先锋队员"] = "walter", ["少先队员"] = "walter", ["少先队"] = "walter",
		["伍迪"] = "woodie", ["伐木工"] = "woodie",
		["薇诺娜"] = "winona", ["女工"] = "winona", ["女工人"] = "winona", ["投石机类"] = "winona", ["工程"] = "winona",
		["威尔逊"] = "wilson", ["威吊"] = "wilson"
	}
	if (charaAlias[requires]) then
		requires = charaAlias[requires]
	end

	-- 角色配方
	local charaTestFn = {
		wanda = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "clockmaker"
		end,
		walter = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "pebblemaker" or recipe.builder_tag == "pinetreepioneer"
		end,
		wolfgang = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "strongman"
		end,
		wes = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "balloonomancer"
		end,
		maxwell = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "shadowmagic"
		end,
		wendy = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "elixirbrewer" or recipe.builder_tag == "ghostlyfriend"
		end,
		wurt = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "merm_builder"
		end,
		webber = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "spiderwhisperer"
		end,
		warly = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "masterchef" or recipe.builder_tag == "professionalchef"
		end,
		wormwood = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "plantkin"
		end,
		willow = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "pyromaniac"
		end,
		["wx-78"] = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "upgrademoduleowner"
		end,
		wickerbottom = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "bookbuilder"
		end,
		wigfrid = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "battlesinger" or recipe.builder_tag == "valkyrie"
		end,
		woodie = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "werehuman"
		end,
		winona = function(recipe)
			return recipe.builder_tag and recipe.builder_tag == "handyperson"
		end,
		wilson = function(recipe)
			if (not recipe.builder_tag) then
				return false
			end
			return not not WILSON_BUILDER_TAGS[recipe.builder_tag]
		end
	}

	if (charaTestFn[requires]) then
		return showRecipes(getRecipes(charaTestFn[requires]), frame)
	end

	if (charaTestFn[requires .. "类"]) then
		return showRecipes(getRecipes(charaTestFn[requires .. "类"]), frame)
	end

	-- 角色专属分类别名处理和配方

	local tagAlias = {
		["弹弓弹药"] = "pebblemaker",
		["调味料"] = "professionalchef", ["大厨调味料"] = "professionalchef", ["便携研磨器"] = "professionalchef", ["portable grinding mill"] = "professionalchef",
		["厨具"] = "masterchef", ["大厨厨具"] = "masterchef",
		["战歌"] = "battlesinger",
		["灵体草药"] = "elixirbrewer",
	}
	if (tagAlias[requires]) then
		requires = tagAlias[requires]
		return showRecipes(getRecipes(function(recipe)
			return recipe.builder_tag == requires
		end), frame)
	end

	for k, _ in pairs(WILSON_BUILDER_TAGS) do
		if(k:lower()==requires)then
			return showRecipes(getRecipes(function(recipe)
				return recipe.builder_tag == k
			end), frame)
		end
	end

	-- 科技别名处理
	stationAlias = {
		["寄居蟹"] = "crabby hermit", ["寄居蟹隐士"] = "crabby hermit", ["老妖婆"] = "crabby hermit", ["老太婆"] = "crabby hermit", ["珍珠"] = "crabby hermit",
		["魔法"] = "magic",
		["天体一本"] = "celestial orb", ["天体宝珠"] = "celestial orb",
		["浣猫神龛"] = "catcoon shrine", ["浣猫年"] = "catcoon shrine", ["猫年"] = "catcoon shrine", ["虎年"] = "catcoon shrine",
		["完整的远古伪科学站"] = "ancient pseudoscience station", ["远古二本"] = "ancient pseudoscience station",
		["良羽鸦"] = "corvus goodfeather",
		["疯狂科学家实验室"] = "mad scientist lab", ["疯狂实验"] = "mad scientist lab", ["万圣节"] = "mad scientist lab", ["万圣之夜"] = "mad scientist lab", ["万圣夜"] = "mad scientist lab",
		["暗影秘典"] = "codex umbra", ["暗影工具人"] = "codex umbra",
		["座狼神龛"] = "varg shrine", ["座狼之年"] = "varg shrine", ["座狼年"] = "varg shrine", ["狗年"] = "varg shrine",
		["智囊团"] = "think tank", ["航海"] = "think tank",
		["陶轮"] = "potter's wheel", ["雕像"] = "potter's wheel",
		["二本"] = "alchemy engine", ["炼金引擎"] = "alchemy engine",
		["土地夯实器"] = "terra firma tamper", ["地皮"] = "terra firma tamper",
		["砖砌烤炉"] = "masonry oven",
		["火鸡神龛"] = "gobbler shrine", ["火鸡之年"] = "gobbler shrine", ["火鸡年"] = "gobbler shrine", ["鸡年"] = "gobbler shrine",
		["奖品摊位"] = "prize booth build",
		["生肖"] = "shrine",
		["胡萝卜鼠神龛"] = "carrat shrine", ["胡萝卜鼠年"] = "carrat shrine", ["鼠年"] = "carrat shrine",
		["岩石巢穴"] = "rock den", ["小动物"] = "rock den",
		["一本"] = "science machine", ["科学机器"] = "science machine",
		["魔法二本"] = "shadow manipulator", ["四本"] = "shadow manipulator", ["暗影操控器"] = "shadow manipulator",
		["天体二本"] = "celestial altar", ["天体祭坛"] = "celestial altar", ["天体圣殿"] = "celestial altar", ["celestial sanctum"] = "celestial altar", ["天体贡品"] = "celestial altar", ["celestial tribute"] = "celestial altar",
		["钓具容器"] = "tackle receptacle",
		["猪神龛"] = "pig shrine", ["猪年"] = "pig shrine",
		["魔法一本"] = "prestihatitator", ["三本"] = "prestihatitator", ["灵子分解器"] = "prestihatitator",
		["天体"] = "celestial",
		["神龛"] = "activity", ["活动"] = "activity",
		["远古"] = "ancient", ["远古伪科学站"] = "ancient",
		["损坏的远古伪科学站"] = "broken pseudoscience station", ["破损的远古伪科学站"] = "broken pseudoscience station", ["远古一本"] = "broken pseudoscience station",
		["鸦年华"] = "carnival",
		["皮弗娄牛神龛"] = "beefalo shrine", ["皮弗娄牛年"] = "beefalo shrine", ["牛年"] = "beefalo shrine",
		["制图桌"] = "cartographer's desk", ["制图"] = "cartographer's desk",
	}

	if (stationAlias[requires]) then
		requires = stationAlias[requires]
	end
	if (stationAlias[requires .. "类"]) then
		requires = stationAlias[requires .. "类"]
	end


	-- 按科技搜索

	stationTestFn = {
		["broken pseudoscience station"] = function(recipe)
			return recipe.tech and recipe.tech.ANCIENT == 2
		end,
		["ancient pseudoscience station"] = function(recipe)
			return recipe.tech and recipe.tech.ANCIENT == 4
		end,
		["ancient"] = function(recipe)
			return recipe.tech and recipe.tech.ANCIENT
		end,
		["beefalo shrine"] = function(recipe)
			return recipe.tech and recipe.tech.BEEFOFFERING
		end,
		["prize booth build"] = function(recipe)
			return recipe.tech and recipe.tech.CARNIVAL_PRIZESHOP
		end,
		["corvus goodfeather"] = function(recipe)
			return recipe.tech and recipe.tech.CARNIVAL_HOSTSHOP
		end,
		["carnival"] = function(recipe)
			return recipe.tech and (recipe.tech.CARNIVAL_PRIZESHOP or recipe.tech.CARNIVAL_HOSTSHOP)
		end,
		["carrat shrine"] = function(recipe)
			return recipe.tech and recipe.tech.CARRATOFFERING
		end,
		["cartographer's desk"] = function(recipe)
			return recipe.tech and recipe.tech.CARTOGRAPHY
		end,
		["catcoon shrine"] = function(recipe)
			return recipe.tech and recipe.tech.CATCOONOFFERING
		end,
		["celestial altar"] = function(recipe)
			return recipe.tech and recipe.tech.CELESTIAL == 3
		end,
		["celestial orb"] = function(recipe)
			return recipe.tech and recipe.tech.CELESTIAL == 1
		end,
		["celestial"] = function(recipe)
			return recipe.tech and recipe.tech.CELESTIAL
		end,
		["tackle receptacle"] = function(recipe)
			return recipe.tech and recipe.tech.FISHING
		end,
		["crabby hermit"] = function(recipe)
			return (recipe.tech and recipe.tech.HERMITCRABSHOP) or (recipe.product and recipe.product.prefab and recipe.product.prefab == "supertacklecontainer" and (not recipe.is_deconstruction_recipe))
		end,
		["mad scientist lab"] = function(recipe)
			return recipe.tech and recipe.tech.MADSCIENCE
		end,
		["shadow manipulator"] = function(recipe)
			return recipe.tech and recipe.tech.MAGIC == 3
		end,
		["prestihatitator"] = function(recipe)
			return recipe.tech and recipe.tech.MAGIC == 2
		end,
		["magic"] = function(recipe)
			return recipe.tech and recipe.tech.MAGIC
		end,
		["terra firma tamper"] = function(recipe)
			return recipe.tech and (recipe.tech.MASHTURFCRAFTING or recipe.tech.TURFCRAFTING)
		end,
		["rock den"] = function(recipe)
			return recipe.tech and recipe.tech.ORPHANAGE
		end,
		["activity"] = function(recipe)
			return recipe.tech and (recipe.tech.PERDOFFERING == 1 or recipe.tech.SCIENCE == 10)
		end,
		["shrine"] = function(recipe)
			return recipe.tech and recipe.tech.PERDOFFERING == 1
		end,
		["gobbler shrine"] = function(recipe)
			return recipe.tech and recipe.tech.PERDOFFERING == 3
		end,
		["pig shrine"] = function(recipe)
			return recipe.tech and recipe.tech.PIGOFFERING
		end,
		["alchemy engine"] = function(recipe)
			return recipe.tech and recipe.tech.SCIENCE == 2
		end,
		["science machine"] = function(recipe)
			return recipe.tech and recipe.tech.SCIENCE == 1
		end,
		["science"] = function(recipe)
			return recipe.tech and recipe.tech.SCIENCE
		end,
		["potter's wheel"] = function(recipe)
			return recipe.tech and (recipe.tech.SCULPTING or (recipe.ingredients and recipe.ingredients.rocks == 2 and recipe.ingredients.sculpting_material == 2 and recipe.tech.ANCIENT == 10 and recipe.tech.MAGIC == 10 and recipe.tech.SCIENCE == 10))
		end,
		["think tank"] = function(recipe)
			return recipe.tech and recipe.tech.SEAFARING
		end,
		["codex umbra"] = function(recipe)
			return recipe.tech and recipe.tech.SHADOW
		end,
		["varg shrine"] = function(recipe)
			return recipe.tech and recipe.tech.WARGOFFERING
		end,
		["masonry oven"] = function(recipe)
			return recipe.tech and recipe.tech.WINTERSFEASTCOOKING
		end,
		["涂鸦"] = function(recipe)
			return recipe.tech and recipe.tech.SPIDERCRAFT
		end,
	}

	if (stationTestFn[requires]) then
		return showRecipes(getRecipes(stationTestFn[requires]), frame)
	end

	error("找不到检索关键词: " .. requires .. ", 请联系 User:SodiumAluminate 修改模板。")

end

return alpt