Difference between revisions of "Template:Recipe"
Jump to navigation
Jump to search
m (smw-fied) |
|||
Line 1: | Line 1: | ||
< | {{#vardefine:recipecnt|{{#expr:{{#var:recipecnt|0}}+1}}}}<div class="recipe-box" style="padding-bottom:0.4em; margin: 10px 1em 10px 0;"> | ||
{{#if: {{#ifeq:{{{debug|n}}}|y||{{NAMESPACE}}}} | <!-- no subobject if outside mainspace --> | | |||
< | {{#arraymap: {{{class|}}} |,|@@@|[[Category:@@@ recipes]]|}}<!-- | ||
-->{{#subobject:recipe{{#var:recipecnt}} | |||
< | | Has context=Recipe | ||
| Has canonical name ={{#titleparts:{{BASEPAGENAME}}}} | |||
| Has recipe source ={{#switch:{{lc:{{{source|}}}}} | |||
| sheet | recipe sheet = Recipe sheet | |||
| #default = {{ucfirst:{{{source|}}}}} <!-- source = class --> | |||
}} | |||
| Has recipe type ={{ucfirst:{{{type|}}}}} <!-- meal, miscellany, etc --> | |||
{{#if:{{{ | | Has output quantity = {{{quantity|1}}} | ||
| Has crafting difficulty = {{{difficulty|1}}} | |||
| Has crafting durability = {{{durability|}}} | |||
| Has maximum quality = {{{max-quality|}}} | |||
| Allows quick synthesis = {{#if:{{{quick|}}}|false|yes}} | |||
</ | | Learned from recipe sheet = {{{sheet|}}}|+sep=; | ||
|}} | | Requires crafting level = {{{level|1}}} | ||
{{#if:{{{ | | Requires class = {{{class|}}} |+sep=, | ||
< | | Class count = {{#vardefineecho:class-count|{{#len:{{#arraymap:{{{class|}}}|,|@@@|.|}}}}}} | ||
<!-- | Is time gated = {{#ifeq:{{lc:{{{timegate|n}}}}}|y|Y}} --> | |||
| Has ingredient = {{#if: {{{ingredient1|}}} | 1;{{#explode:{{{ingredient1}}}| |0}};{{#sub:{{{ingredient1}}}|{{#pos:{{{ingredient1}}}| }}}} }} | |||
| Has ingredient = {{#if: {{{ingredient2|}}} | 2;{{#explode:{{{ingredient2}}}| |0}};{{#sub:{{{ingredient2}}}|{{#pos:{{{ingredient2}}}| }}}} }} | |||
</ | | Has ingredient = {{#if: {{{ingredient3|}}} | 3;{{#explode:{{{ingredient3}}}| |0}};{{#sub:{{{ingredient3}}}|{{#pos:{{{ingredient3}}}| }}}} }} | ||
| Has ingredient = {{#if: {{{ingredient4|}}} | 4;{{#explode:{{{ingredient4}}}| |0}};{{#sub:{{{ingredient4}}}|{{#pos:{{{ingredient4}}}| }}}} }} | |||
</ | | Has crystal ingredient = {{#if: {{{crystal1|}}} | 1;{{#explode:{{{crystal1}}}| |0}};{{#sub:{{{crystal1}}}|{{#pos:{{{crystal1}}}| }}}} }} | ||
</ | | Has crystal ingredient = {{#if: {{{crystal2|}}} | 2;{{#explode:{{{crystal2}}}| |0}};{{#sub:{{{crystal2}}}|{{#pos:{{{crystal2}}}| }}}} }} | ||
< | | Can be queried for base ingredients = {{ucfirst:{{{base ingredients|y}}}}} | ||
| Has item data object = {{PAGENAME}} | |||
}} | |||
}} | |||
<div id="recipe{{#var:recipecnt}}" class="heading">{{{name|{{BASEPAGENAME}}}}}</div> | |||
<div class="wrapper"> | |||
; Source | |||
: {{#switch:{{lc:{{{source|}}}}} | |||
| sheet | recipe sheet = {{#vardefine:sheet_count|0}}{{#arraymap:{{{sheet}}}|;|@@@|{{#ifexpr:{{#var:sheet_count}}=3|<div class="mw-collapsible mw-collapsed"><small>more...</small><div class="mw-collapsible-content">}}{{cname|@@@}}{{#vardefine:sheet_count|{{#expr:{{#var:sheet_count|0}}+1}}}}|<br>}}{{#ifexpr:{{#var:sheet_count}}>3|</div></div>}} | |||
| #default = {{ucfirst:{{{source|''Unspecified''}}}}} | |||
}}{{#if:{{{type|}}}| | |||
; Type | |||
: {{ucfirst:{{{type}}}}} }} | |||
; Output qty. | |||
: {{#if: {{{upper quantity|}}} | <span style="border-bottom:1px dotted silver" title="The output quantity varies between these two values for this recipe.">{{{quantity|1}}} – {{{upper quantity|}}}</span> | {{{quantity|1}}} }} | |||
{{#if: {{{class|}}} | ; Class{{#ifexpr:{{#var:class-count}} > 1|es}} | |||
: {{#arraymap:{{{class|}}}|,|@@@|{{@@@|name=y}}|<br>}} | |||
; Durability | |||
: {{{durability|}}} | |||
; Difficulty | |||
: {{{difficulty|}}} | |||
; Max. quality | |||
: {{{max-quality|}}} | |||
; Req. level | |||
: {{{level|1}}} | |||
; Quick synthesis | |||
: {{#if:{{{quick|}}}|Unavailable|Available}} | |||
}}</div> | |||
{{clear}} | |||
<div class="subheading">Ingredients</div> | |||
<div class="ingredients" style="padding-left:1em"> | |||
{{#arraymap:{{{crystal1|}}}; {{{crystal2|}}}; {{{ingredient1|}}}; {{{ingredient2|}}}; {{{ingredient3|}}}; {{{ingredient4|}}}|;|@@@|{{#iferror:{{#expr:@@@*1}} | |||
|<!-- if expr returns error, @@@ contains alpha --> | |||
; {{#explode:@@@| |0}} | |||
: {{item icon|{{#sub:@@@|{{#pos:@@@| }}}}}} | |||
|<!-- if expr doesn't error, @@@ is numeric --> | |||
; 1 | |||
: {{item icon|@@@}} | |||
}}|\n}} | |||
</div> | |||
{{clear}}</div><noinclude> | |||
== Parameters == | |||
; id : The recipe ID | |||
; name : The recipe name (defaults to <code>BASEPAGENAME</code>) | |||
; source | |||
: How the recipe is learned: | |||
:* <code>class</code> - Learned automatically by levelling a class. | |||
:* <code>recipe sheet</code> - Learned from a [[recipe sheet]]; requires parameter <code>sheet</code> below. | |||
; sheet : The name of the recipe sheet item that teaches the recipe; only use for <code>source = recipe sheet</code>. If learnt by multiple sources, separate sources with a semicolon ";". | |||
; type : The recipe type, i.e. the header it appears under in the recipe list. | |||
; quantity : The number of items produced from the recipe. Defaults to 1. | |||
; upper quantity : Optional. Use when the number of output items varies. | |||
; class : The classes that can use the recipe. Accepts a comma-separated list (e.g. <code>class = culinarian, alchemist</code>). | |||
; level : The level required in a class to use the recipe. | |||
; crystal1 | |||
; crystal2 | |||
: Optional. The crystals the recipe requires. Value should be a quantity followed by an item name. | |||
:* <code><quantity> <item name></code>, e.g. <code>1 Water Shard</code> | |||
; ingredient1 | |||
: Required. The ingredients of the recipe. Value should be a quantity followed by an item name. | |||
:* <code><quantity> <item name></code>, e.g. <code>1 Lowland Grapes</code> | |||
; ingredient2 | |||
; ingredient3 | |||
; ingredient4 | |||
: Optional. Same functionality as ingredient1. | |||
== Example == | |||
<pre> | <pre> | ||
{{Recipe | {{Recipe | ||
| | | name = Raisins | ||
| | | source = Class | ||
| | | type = Meal | ||
| | | class = Culinarian | ||
| | | level = 3 | ||
| quantity = 3 | |||
| | | difficulty = 10 | ||
| durability = 40 | |||
| | | max-quality = 339 | ||
| | | crystal1 = 1 Fire Shard | ||
| | | ingredient1 = 1 Lowland Grapes | ||
| | |||
| | |||
}} | }} | ||
</pre> | </pre> | ||
</noinclude> | {{Recipe | ||
| name = Raisins | |||
| source = Class | |||
| type = Meal | |||
| class = Culinarian | |||
| level = 3 | |||
| quantity = 3 | |||
| difficulty = 10 | |||
| durability = 40 | |||
| max-quality = 339 | |||
| crystal1 = 1 Fire Shard | |||
| ingredient1 = 1 Lowland Grapes | |||
}} | |||
[[Category:Infobox templates|Recipe]] | |||
[[Category:Subobject templates]]</noinclude> |
Revision as of 17:40, 14 July 2017
Recipe
- Source
- Unspecified
- Output qty.
- 1
Ingredients
Parameters
- id
- The recipe ID
- name
- The recipe name (defaults to
BASEPAGENAME
) - source
- How the recipe is learned:
class
- Learned automatically by levelling a class.recipe sheet
- Learned from a recipe sheet; requires parametersheet
below.
- sheet
- The name of the recipe sheet item that teaches the recipe; only use for
source = recipe sheet
. If learnt by multiple sources, separate sources with a semicolon ";". - type
- The recipe type, i.e. the header it appears under in the recipe list.
- quantity
- The number of items produced from the recipe. Defaults to 1.
- upper quantity
- Optional. Use when the number of output items varies.
- class
- The classes that can use the recipe. Accepts a comma-separated list (e.g.
class = culinarian, alchemist
). - level
- The level required in a class to use the recipe.
- crystal1
- crystal2
- Optional. The crystals the recipe requires. Value should be a quantity followed by an item name.
<quantity> <item name>
, e.g.1 Water Shard
- ingredient1
- Required. The ingredients of the recipe. Value should be a quantity followed by an item name.
<quantity> <item name>
, e.g.1 Lowland Grapes
- ingredient2
- ingredient3
- ingredient4
- Optional. Same functionality as ingredient1.
Example
{{Recipe | name = Raisins | source = Class | type = Meal | class = Culinarian | level = 3 | quantity = 3 | difficulty = 10 | durability = 40 | max-quality = 339 | crystal1 = 1 Fire Shard | ingredient1 = 1 Lowland Grapes }}
Raisins
- Source
- Class
- Type
- Meal
- Output qty.
- 3
- ClassExpression error: Unexpected > operator.
- CUL
- Durability
- 40
- Difficulty
- 10
- Max. quality
- 339
- Req. level
- 3
- Quick synthesis
- Available
Ingredients