Plantilla:Recipes

De Wiki Calamity Mod Oficial
Ir a la navegación Ir a la búsqueda

Esta plantilla define la tabla "Recipes". Ver tabla.

Esta plantilla está preparada para i18n, lo que significa que es fácil de localizar para diferentes idiomas. Consulta I18n & l10n para Plantillas para obtener más información.
Lua.svg
Esta plantilla utiliza Módulo:Recipes, un script escrito en el lenguaje de programación Lua. Por favor, consulta wikipedia:Lua y mw:Extension:Scribunto para obtener más información sobre Lua.
Info-bold.svg Documentación La documentación a continuación se transcluye desde Plantilla:Recipes/doc. (editar | historial)

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

Usage[editar código]

Parameters for query constraints:

station = station1/station2/...

List only recipes that use these stations.

stationnot = station1/station2/...

Exclude recipes that use these stations.

result = result1/result2/...

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

resultnot = result1/result2/...

Exclude recipes that create this item. It is also possible to do pattern search using SQL LIKE syntax. Example: resultnot=LIKE %Phaseblade, multiple:resultnot=Iron Bar/LIKE %Phaseblade. Note that "LIKE" must be all uppercase.

ingredient = ingredient1/ingredient2/...

List only recipes that use these items as ingredients. You can use "Any xxx" as ingredient name for some alternative crafting ingredients groups; and, if you query an item in a substitutable item group, you will get "Any xxx" as well. Adding "#" as a prefix (#xxx) will turn this off for that specific 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 is also possible to do pattern search using SQL LIKE syntax. Example: ingredient=LIKE %Phaseblade, multiple:ingredient=Iron Bar/LIKE %Phaseblade. Note that "LIKE" must be all uppercase.

NOTE: The relationship between the above parameters is "and", and the relationship of multiple values inside a 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 the parameter of cargo query is located. If specified, all of above parameters are ignored. Used to write complex queries when necessary, with caution.

Other parameters:

view = infobox

Produces an infobox-like crafting table (or a series of tables wrapped in a flexbox) similar to {{crafting recipe}}. Note: Several features, like extra rows, extra columns, custom result cells, custom headers, custom title, $nostation, station grouping, sorting and custom css do not work with this format.

title

Adds a title bar to the recipes table, with specified text.

grouping = n/no

Turn off result & ext cols grouping.

nostation = y

If set, the Crafting Station column will be hidden.

stationgrouping = n/no

Turn off Crafting Station column grouping. Only valid when nostation is not set.

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 to stop the result items from linking to their pages.

expectedrows = number (Unused)

Assert the expected number of rows in this crafts table. If the expected and actual number of rows are not equal, this page will be added to Category:Recipe tables with unexpected total number of rows.

sortable = n/no

Makes the table unsortable.

class =
id =
css/style =

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

Example[editar código]

{{recipes|ingredient=Aerialite Bar|station=Sky Mill|resultnot=Heron Rod}}

Explanation: Select all recipes that have Lingote de aerialitaLingote de aerialita as an ingredient, and Molino celestialMolino celestial as a crafting station, then exclude the result Vara de garzaVara de garza.

Register Recipes[editar código]

Recipes in database are registered by {{recipes/register}}. All recipes should be registered on the corresponding crafting station page ( Recipes/[station]/register ), e.g. Recipes/Draedon's Forge/register. For usage of {{recipes/register}}, see its documentation.

Advanced Usage[editar código]

Custom Result Cells[editar código]

resulttemplate = template name used for format result cell.

This template will receive the following arguments:

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

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

See tgc:Chairs#Recipes for an example.

Custom Table Header[editar código]

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[editar código]

Only valid when nostation is not 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[editar código]

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, corresponding to the definition of columns.

Adding extra rows[editar código]

NOTE: extra rows don't count as part of 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 tgc:Bars and tgc:Recovery potions for examples.

Extract component[editar código]

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

Count for result rows[editar código]

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.