Шаблон:Recipe — различия между версиями
Материал из Guild Wars 2 wiki
Blood (обсуждение | вклад) |
|||
Строка 1: | Строка 1: | ||
{{#if: | {{#if: | ||
{{#vardefineecho:recipecnt|{{#expr:{{#var:recipecnt|0}}+1}}}} | {{#vardefineecho:recipecnt|{{#expr:{{#var:recipecnt|0}}+1}}}} | ||
− | {{#vardefine:item_id|{{#explode:{{#show:{{ | + | {{#vardefine:item_id|{{#explode:{{{output item id|{{#show:{{BASEPAGENAME}}|?Has game id#|limit=1|searchlabel=}}}}}|,|0}}}} |
{{#if:{{#var:item_id}}|{{#switch:{{lc:{{{source}}}}}|mystic|mystic forge={{#vardefine:mystic_forge_id|{{#var:item_id}}{{padleft:{{#var:recipecnt}}|2}}}}}} | {{#vardefine:mystic_forge_id|}} }} | {{#if:{{#var:item_id}}|{{#switch:{{lc:{{{source}}}}}|mystic|mystic forge={{#vardefine:mystic_forge_id|{{#var:item_id}}{{padleft:{{#var:recipecnt}}|2}}}}}} | {{#vardefine:mystic_forge_id|}} }} | ||
}}<div class="recipe-box" style="padding-bottom:0.4em; margin: 10px 1em 10px 0;"> | }}<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 --> | | {{#if: {{#ifeq:{{{debug|n}}}|y||{{NAMESPACE}}}} | <!-- no subobject if outside mainspace --> | | ||
− | {{# | + | {{#switch: {{lc:{{{status|current}}}}} | discontinued | current = <!-- no subobject if historical --> |
{{#arraymap: {{{disciplines|}}} |,|@@@|[[Category:@@@ recipes]]|}}<!-- | {{#arraymap: {{{disciplines|}}} |,|@@@|[[Category:@@@ recipes]]|}}<!-- | ||
-->{{#switch: {{lc:{{{source|}}}}} | mystic | mystic forge = [[Category:Mystic Forge recipes]] }}<!-- | -->{{#switch: {{lc:{{{source|}}}}} | mystic | mystic forge = [[Category:Mystic Forge recipes]] }}<!-- | ||
-->{{#subobject:recipe{{#var:recipecnt}} | -->{{#subobject:recipe{{#var:recipecnt}} | ||
| Has context=Recipe | | Has context=Recipe | ||
− | | Has recipe id = {{{id|}}} | + | | Has recipe id = {{{id|}}}|+sep=, |
− | | Has canonical name ={{#titleparts:{{ | + | | Has canonical name = {{{name|{{#titleparts:{{BASEPAGENAME}}}}}}} |
| Has recipe source ={{#switch:{{lc:{{{source|}}}}} | | Has recipe source ={{#switch:{{lc:{{{source|}}}}} | ||
| sheet | recipe sheet = Recipe sheet | | sheet | recipe sheet = Recipe sheet | ||
Строка 24: | Строка 24: | ||
| Learned from guild upgrade = {{{guild upgrade|}}} | | Learned from guild upgrade = {{{guild upgrade|}}} | ||
| Requires rating = {{{rating|0}}} | | Requires rating = {{{rating|0}}} | ||
− | | Requires discipline = | + | | Requires discipline = {{{disciplines|}}} |+sep=, |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
| Discipline count = {{#len:{{#arraymap:{{{disciplines|}}}|,|@@@|.|}}}} | | Discipline count = {{#len:{{#arraymap:{{{disciplines|}}}|,|@@@|.|}}}} | ||
− | | Is time gated = {{#ifeq:{{lc:{{{timegate|n}}}}}|y|Y | + | | Is time gated = {{#ifeq:{{lc:{{{timegate|n}}}}}|y|Y}} |
− | | Has ingredient = {{#if:{{{ingredient1|}}}| | + | | Has ingredient = {{#if: {{{ingredient1|}}} | 1;{{#explode:{{{ingredient1}}}| |0}};{{#sub:{{{ingredient1}}}|{{#pos:{{{ingredient1}}}| }}}} }} |
− | | Has ingredient = {{#if:{{{ingredient2|}}}| | + | | Has ingredient = {{#if: {{{ingredient2|}}} | 2;{{#explode:{{{ingredient2}}}| |0}};{{#sub:{{{ingredient2}}}|{{#pos:{{{ingredient2}}}| }}}} }} |
− | | Has ingredient = {{#if:{{{ingredient3|}}}| | + | | Has ingredient = {{#if: {{{ingredient3|}}} | 3;{{#explode:{{{ingredient3}}}| |0}};{{#sub:{{{ingredient3}}}|{{#pos:{{{ingredient3}}}| }}}} }} |
− | | Has ingredient = {{#if:{{{ingredient4|}}}| | + | | Has ingredient = {{#if: {{{ingredient4|}}} | 4;{{#explode:{{{ingredient4}}}| |0}};{{#sub:{{{ingredient4}}}|{{#pos:{{{ingredient4}}}| }}}} }} |
| Can be queried for base ingredients = {{ucfirst:{{{base ingredients|{{#switch: {{lc:{{{type|}}}}} | demotion | promotion = n | #default = y }}}}}}} | | Can be queried for base ingredients = {{ucfirst:{{{base ingredients|{{#switch: {{lc:{{{type|}}}}} | demotion | promotion = n | #default = y }}}}}}} | ||
| Has item data object = {{PAGENAME}} | | Has item data object = {{PAGENAME}} | ||
+ | <!-- Properties exposed for usage via the wiki API --> | ||
+ | | Has ingredient with id = {{#if: {{{ingredient1|}}} | 1;{{#explode:{{{ingredient1}}}| |0}};{{#sub:{{{ingredient1}}}|{{#pos:{{{ingredient1}}}| }}}};{{#explode:{{#show: {{#sub:{{{ingredient1}}}|{{#pos:{{{ingredient1}}}| }}}} | ?Has game id# | limit = 1 | searchlabel= }}|,|0}} }} | ||
+ | | Has ingredient with id = {{#if: {{{ingredient2|}}} | 2;{{#explode:{{{ingredient2}}}| |0}};{{#sub:{{{ingredient2}}}|{{#pos:{{{ingredient2}}}| }}}};{{#explode:{{#show: {{#sub:{{{ingredient2}}}|{{#pos:{{{ingredient2}}}| }}}} | ?Has game id# | limit = 1 | searchlabel= }}|,|0}} }} | ||
+ | | Has ingredient with id = {{#if: {{{ingredient3|}}} | 3;{{#explode:{{{ingredient3}}}| |0}};{{#sub:{{{ingredient3}}}|{{#pos:{{{ingredient3}}}| }}}};{{#explode:{{#show: {{#sub:{{{ingredient3}}}|{{#pos:{{{ingredient3}}}| }}}} | ?Has game id# | limit = 1 | searchlabel= }}|,|0}} }} | ||
+ | | Has ingredient with id = {{#if: {{{ingredient4|}}} | 4;{{#explode:{{{ingredient4}}}| |0}};{{#sub:{{{ingredient4}}}|{{#pos:{{{ingredient4}}}| }}}};{{#explode:{{#show: {{#sub:{{{ingredient4}}}|{{#pos:{{{ingredient4}}}| }}}} | ?Has game id# | limit = 1 | searchlabel= }}|,|0}} }} | ||
+ | | Has output game id = {{#var:item_id}} | ||
}} | }} | ||
}} | }} | ||
}} | }} | ||
− | <div id="recipe{{#var:recipecnt}}" class="heading">{{{name|{{ | + | <div id="recipe{{#var:recipecnt}}" class="heading">{{{name|{{BASEPAGENAME}}}}}</div> |
<div class="wrapper"> | <div class="wrapper"> | ||
− | ; | + | ; Source |
: {{#switch:{{lc:{{{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">}} | + | | 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>}} |
| mystic | mystic forge = [[Mystic Forge]] | | mystic | mystic forge = [[Mystic Forge]] | ||
| guild | guild upgrade = [[{{{guild upgrade}}}]] | | guild | guild upgrade = [[{{{guild upgrade}}}]] | ||
| #default = {{ucfirst:{{{source|''Unspecified''}}}}} | | #default = {{ucfirst:{{{source|''Unspecified''}}}}} | ||
}}{{#if:{{{type|}}}| | }}{{#if:{{{type|}}}| | ||
− | ; | + | ; Type |
: {{ucfirst:{{{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: {{{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: {{{disciplines|}}} | ; | + | {{#if: {{{disciplines|}}} | ; Discipline |
: {{#arraymap:{{{disciplines|}}}|,|@@@|{{@@@}} [[{{ucfirst:@@@}}]]|<br>}} | : {{#arraymap:{{{disciplines|}}}|,|@@@|{{@@@}} [[{{ucfirst:@@@}}]]|<br>}} | ||
− | ; | + | ; Req. rating |
− | : {{{rating|0} | + | : {{{rating|0}}} {{#if:{{{timegate|}}}| |
− | + | ;[[Crafting#Time gated recipes|Time gate]] | |
− | + | :Daily | |
− | ;[[Crafting#Time gated recipes| | ||
− | : | ||
}}{{#if: {{{id|}}} | | }}{{#if: {{{id|}}} | | ||
− | ; | + | ; Chat link |
− | : {{ | + | : {{#arraymap:{{{id}}}|,|@@@|{{recipe link|@@@}}|<br>}} }} }} |
</div> | </div> | ||
{{clear}} | {{clear}} | ||
− | <div class="subheading"> | + | <div class="subheading">Ingredients</div> |
<div class="ingredients" style="padding-left:1em"> | <div class="ingredients" style="padding-left:1em"> | ||
{{#arraymap:{{{ingredient1|}}}; {{{ingredient2|}}}; {{{ingredient3|}}}; {{{ingredient4|}}}|;|@@@|{{#iferror:{{#expr:@@@*1}} | {{#arraymap:{{{ingredient1|}}}; {{{ingredient2|}}}; {{{ingredient3|}}}; {{{ingredient4|}}}|;|@@@|{{#iferror:{{#expr:@@@*1}} | ||
Строка 80: | Строка 77: | ||
}}|\n}} | }}|\n}} | ||
</div>{{#ifeq: {{{base ingredients|{{#switch: {{lc:{{{type|}}}}} | demotion | promotion = n | #default = y }}}}} | y | </div>{{#ifeq: {{{base ingredients|{{#switch: {{lc:{{{type|}}}}} | demotion | promotion = n | #default = y }}}}} | y | ||
− | | {{# | + | | {{#switch: {{lc:{{{status|current}}}}} | discontinued | current = <!-- don't display a link if historical -->{{#ifeq: {{{source|}}} | | <!-- don't display if source has not been given --> |<div class="plainlinks" style="float:right; clear:left; margin-right:1em;"><small><span class="plainlinks">[{{fullurl:Special:RunQuery/Base ingredients query|Base_ingredients%5Bitem%5D={{urlencode:{{#titleparts:{{PAGENAME}}}}|path}}&Base_ingredients%5Bid%5D={{#explode:{{{id|{{#var:mystic_forge_id}}}}}|,|0}}{{#if:{{#var:mystic_forge_id}}|&Base_ingredients%5Bdiscipline%5D={{urlencode:Mystic forge}}}}&Base_ingredients%5Bquantity%5D={{{quantity|1}}}&wpRunQuery=true}} Show base ingredients]</span></small></div> }} |
− | |||
− | |||
}} | }} | ||
}} | }} | ||
Строка 88: | Строка 83: | ||
== Parameters == | == Parameters == | ||
− | + | ; name : The recipe name (defaults to <code>BASEPAGENAME</code>) | |
− | ; name : The recipe name (defaults to <code> | ||
; source | ; source | ||
: How the recipe is learned: | : How the recipe is learned: | ||
Строка 105: | Строка 99: | ||
; rating : The rating required in a discipline to use the recipe. | ; rating : The rating required in a discipline to use the recipe. | ||
; ingredient1 | ; ingredient1 | ||
− | : Required. The ingredients of the recipe. Value should be | + | : 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 Jug of Water</code> | :* <code><quantity> <item name></code>, e.g. <code>1 Jug of Water</code> | ||
− | |||
; ingredient2 | ; ingredient2 | ||
; ingredient3 | ; ingredient3 | ||
; ingredient4 | ; ingredient4 | ||
: Optional. Same functionality as ingredient1. | : Optional. Same functionality as ingredient1. | ||
− | ; | + | ; output item id |
− | : Optional. Set equal to <code> | + | : Optional. Defaults to the first item id declared on the page. |
+ | ; id : The recipe ID | ||
+ | ; status | ||
+ | : Optional. Set equal to <code>historical</code> if the item is historical - this will prevent the recipe from storing semantic properties. | ||
; base ingredients | ; base ingredients | ||
: Optional. Only set equal to <code>n</code> if you want to hide the base ingredients query, e.g. because it links to a blank form in the case of Agony Infusion, or because its a random chance recipe. Setting this also prevents it appearing on other occurrences of {{tl|base ingredients}}. | : Optional. Only set equal to <code>n</code> if you want to hide the base ingredients query, e.g. because it links to a blank form in the case of Agony Infusion, or because its a random chance recipe. Setting this also prevents it appearing on other occurrences of {{tl|base ingredients}}. | ||
Строка 120: | Строка 116: | ||
<pre> | <pre> | ||
{{Recipe | {{Recipe | ||
− | |||
| name = Berserker's Orichalcum Sage-Stuffed Sapphire | | name = Berserker's Orichalcum Sage-Stuffed Sapphire | ||
| source = Discovery | | source = Discovery | ||
Строка 132: | Строка 127: | ||
| ingredient3 = 250 Bowl of Sage Stuffing | | ingredient3 = 250 Bowl of Sage Stuffing | ||
| ingredient4 = 100 Berserker's Orichalcum Imbued Inscription | | ingredient4 = 100 Berserker's Orichalcum Imbued Inscription | ||
+ | | id = 1234 | ||
}} | }} | ||
</pre> | </pre> | ||
{{Recipe | {{Recipe | ||
− | |||
| name = Berserker's Orichalcum Sage-Stuffed Sapphire | | name = Berserker's Orichalcum Sage-Stuffed Sapphire | ||
| source = Discovery | | source = Discovery | ||
Строка 147: | Строка 142: | ||
| ingredient3 = 250 Bowl of Sage Stuffing | | ingredient3 = 250 Bowl of Sage Stuffing | ||
| ingredient4 = 100 Berserker's Orichalcum Imbued Inscription | | ingredient4 = 100 Berserker's Orichalcum Imbued Inscription | ||
+ | | id = 1234 | ||
}} | }} | ||
[[Category:Infobox templates|Recipe]] | [[Category:Infobox templates|Recipe]] | ||
[[Category:Subobject templates]]</noinclude> | [[Category:Subobject templates]]</noinclude> |
Текущая версия на 15:16, 3 апреля 2018
Recipe
- Source
- Unspecified
- Output qty.
- 1
Ingredients
Parameters[править]
- name
- The recipe name (defaults to
BASEPAGENAME
) - source
- How the recipe is learned:
-
automatic
- Learned automatically by gaining ranks in a discipline. -
discovery
- Learned by discovering the recipe. -
recipe sheet
- Learned from a recipe sheet; requires parametersheet
below. -
mystic forge
- This is a Mystic Forge recipe. -
guild upgrade
- Learned from a guild upgrade; requires parameterguild upgrade
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 ";". - guild upgrade
- The name of the guild upgrade that teaches the recipe; only use for
source = guild upgrade
. - 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 (i.e. during transmutation recipes at the Mystic Forge).
- disciplines
- The disciplines that can use the recipe. Accepts a comma-separated list (e.g.
discipline = artificer, chef
). - rating
- The rating required in a discipline to use the recipe.
- ingredient1
- Required. The ingredients of the recipe. Value should be a quantity followed by an item name.
-
<quantity> <item name>
, e.g.1 Jug of Water
-
- ingredient2
- ingredient3
- ingredient4
- Optional. Same functionality as ingredient1.
- output item id
- Optional. Defaults to the first item id declared on the page.
- id
- The recipe ID
- status
- Optional. Set equal to
historical
if the item is historical - this will prevent the recipe from storing semantic properties. - base ingredients
- Optional. Only set equal to
n
if you want to hide the base ingredients query, e.g. because it links to a blank form in the case of Agony Infusion, or because its a random chance recipe. Setting this also prevents it appearing on other occurrences of {{base ingredients}}.
Example[править]
{{Recipe | name = Berserker's Orichalcum Sage-Stuffed Sapphire | source = Discovery | type = Dessert | disciplines = Chef, Weaponsmith | rating = 400 | quantity = 1 | upper quantity = 3 | ingredient1 = 1 Sapphire Orb | ingredient2 = 5 Orichalcum Setting | ingredient3 = 250 Bowl of Sage Stuffing | ingredient4 = 100 Berserker's Orichalcum Imbued Inscription | id = 1234 }}
Berserker's Orichalcum Sage-Stuffed Sapphire
- Source
- Discovery
- Type
- Dessert
- Output qty.
- 1 – 3
- Discipline
- Chef
Weaponsmith - Req. rating
- 400
- Chat link
Ingredients