Hello there! We are conducting a survey to better understand the user experience in making a first edit. If you have ever made an edit on Gamepedia, please fill out the survey. Thank you!

Vorlage:Recipes

Aus Terraria Wiki
Wechseln zu: Navigation, Suche
Diese Vorlage ist synchronisiert-lokalisiert, d. h. sie ist mit der Version des englischen Terraria Wikis identisch. Änderungen an dieser Vorlage sollten zunächst dort vorgenommen werden.
Lua logo.svg
Diese Vorlage verwendet Modul:Recipes, ein Skript, das in der Programmiersprache Lua verfasst wurde. Siehe Lua und die Scribunto-Erweiterung, um mehr über Lua zu erfahren.

Diese Vorlage definiert die Tabelle „Recipes“. Tabelle ansehen.

Template-info.svg Dokumentation Die folgende Dokumentation stammt von der Seite Vorlage:Recipes/Dokumentation. (bearbeiten | Versionsgeschichte)
Important.svg Diese Seite ist nicht oder unvollständig übersetzt.
Hilf mit, indem du den Text übersetzt und anschließend diesen Hinweis entfernst. Dies entfernt diese Seite auch aus der Liste von Seiten mit unzureichender Übersetzung.

Query crafting recipes from database and display them as crafts table. The original source for the data can be found on the subpages of Recipes.

Verwendung[Quelltext bearbeiten]

Note: Currently, all parameters that require in-game terms need to be in English. For example, use result=Iron Bar, not result=Eisenbarren!

Parameters for query constraints:

station = station1/station2/...

List only recipes that using these stations.

stationnot = station1/station2/...

Exclude recipes that using these stations.

result = result1/result2/...

List only recipes that will get this result item.It also possible to do pattern search using SQL LIKE syntax like this: result=LIKE %Phaseblade, multiple:result=Iron Bar/LIKE %Phaseblade, note that "LIKE" must be all uppercase.

resultnot = result1/result2/...

Exclude recipes that will get this result item.It also possible to do pattern search using SQL LIKE syntax like this: resultnot=LIKE %Phaseblade, multiple:resultnot=Iron Bar/LIKE %Phaseblade, note that "LIKE" must be all uppercase.

ingredient = ingredient1/ingredient2/...

List only recipes that contain this item in its ingredient list. You can use "Any xxx" as ingredient name for some alternative crafting ingredients group; and, if you query a item in one of substitutable item group, you will get "Any xxx" as well. Prefix name with "#" will turn this off on this item(and only on this item). For example, if you query by |ingredient=Shadewood, you will get recipes as if you query by ingredient=#Shadewood/#Any Wood; |ingredient=#Shadewood/Iron Bar equals to |ingredient=#Shadewood/#Iron Bar/#Any Iron Bar.It also possible to do pattern search using SQL LIKE syntax like this: ingredient=LIKE %Phaseblade, multiple:ingredient=Iron Bar/LIKE %Phaseblade, note that "LIKE" must be all uppercase.

version/versions = platform-platform-platform

List only recipes that are exclusive to specified platforms. Please note this paramater require full-match, for example, If a recipes is exclusive to desktop and console, you must use |version=desktop-console(can be in diffenent order) to match it, and |version=desktop won't match it.

NOTE: The relationship between above parameters is "and", and the relationship of multiple values inside single parameter is "or". For example, |station=Sawmill/Loom|resultnot=Silk means (in SQL style):(station = Sawmill OR station = Loom) AND result <> Silk

where = whereString

Raw input string for where parameter of cargo query. If specified, all of above parameters are ignored. Used to write complex queries when necessary, with caution.

Other parameters:

title

The content of table caption.

grouping = n/no

Turn off result & ext cols grouping.

nostation = y

If set, Crafting Station column will be hidden.

showresultid = y

If set, result item will show their internal item ID (if available).

cate = no/force

By default, this template will add transcluding page to crafting station category if crafting result is the page title itself. cate=no will disable this. cate=force will force categorization, no matter what the result and page title are.

link = n/no

Set to n/no will make result item have no link.

expectedrows = number

Assert the expected number of rows in this crafts table. If expected and actual number of rows are not equal, this page will be added to Kategorie:Rezepte-Tabelle mit unerwarteter Gesamtzahl an Zeilen.

sortable = n/no

Make the table unsortable.

class =
id =
css/style =

HTML class/id/style attributes for outer wrapper div element.

Beispiele[Quelltext bearbeiten]

{{recipes|ingredient=Bone|station=Bone Welder|resultnot=Bone Block Wall|expectedrows=18}}

Query for all Bone furniture. Select all recipes that have BoneBone as one of its ingredient, and crafting station is Bone WelderBone WelderDesktopversionKonsolenversionOld-gen-KonsolenversionMobilversion, then exclude Bone Block WallBone Block Wall from list. There are 18 items in Bone furniture, so we assert expectedrows=18.

Register Recipes[Quelltext bearbeiten]

Recipes in database are registered by {{recipes/register}}, all recipes should be registered on the corresponding crafting station page ( Rezepte/[station] ), e.g. Rezepte/Sägewerk. For usage of {{recipes/register}}, see its document.

Advanced Usage[Quelltext bearbeiten]

Custom Result Cells[Quelltext bearbeiten]

resulttemplate = template name used for format result cell.

This template will receive following arguments:

  • link, showid, noversion: options for {{item}} template used by default display.
  • result, resultid, resultimage, resultname, resulttext, amount, versionse: infomation about crafting result.

"@@@@" in template output will be replaced with default result display.

See Stühle#Rezepte for example.

Custom Table Header[Quelltext bearbeiten]

header-result = content of result <th>, default is Result
header-ingredients = content of ingredients<th>, default is Ingredients
header-station = content of crafting station<th>, default is [[Crafting station]]

Adding extra columns/rows around crafting stations[Quelltext bearbeiten]

Only valid when nostation not be set.

Define cols:

station-col-before-1
station-col-before-2
station-col-before-3

...
Column headers before crafting station column

station-col-after-1
station-col-after-2
station-col-after-3

...
Column headers before crafting station column

Define index key for row content:

station-index-Furnace = _a

Define index key for "Furnace"(as station parameter), for example

Define actual contents:

_a-row-station-col-before-1 =
_a-row-station-col-before-2 =

...

_a-row-station-col-after-1 =

...
Define contents for <td> using index key.

Adding extra cols/rows around by crafting results[Quelltext bearbeiten]

Define columns:

col-A-1
col-A-2

...

col-B-1

...

col-C-1

...

col-D-1

...
The order in which all columns are displayed is:
col-As • Resultcol-Bs • Ingredientscol-Cs • station-col-befores • Crafting Stationstation-col-afters • Col-Ds

Define index key for row content:
Define index key for a row(Priority in this order):

result-index-#3 = _a

Define by row number

result-index-Crimtane Bar-desktop console = _a

Define by result name + version info

result-index-Copper Bar = _a

Define by result name

Define actual contents:

_a-row-col-A-1 =

...
Define contents for <td> using index key, corresponds to the definition of columns.

Adding extra rows[Quelltext bearbeiten]

NOTE: extra rows don't count into expectedrows.

Before recipe rows:

topextrow-1-col-result =
topextrow-1-col-ingredients =
topextrow-1-col-station =
topextrow-1-col-ingredients =
topextrow-1-col-C-2 =

...

topextrow-2-col-result =

...

After recipe rows:

extrow-1-col-result =
extrow-1-col-ingredients =
extrow-1-col-station =
extrow-1-col-B-1 =
extrow-1-col-C-1 =

...

extrow-2-col-result =

...

See Bars and Recovery potions for examples.

Extract component[Quelltext bearbeiten]

Some components of the recipe can be extracted and formatted separately, see {{recipes/extract}}.

Count for result rows[Quelltext bearbeiten]

You can use {{recipes/exist}} and {{recipes/count}} to check the existence and number of results of recipes that meet query constraints. Note: you should use {{#if:{{recipes/exist|<constraints>}}}} to check existence instead of {{#ifeq:{{recipes/count|<constraints>}}|0}}, because the former is much faster and cheaper.