Шаблон:Recipe — различия между версиями

Материал из Guild Wars 2 wiki
Перейти к: навигация, поиск
 
 
Строка 1: Строка 1:
 
{{#if:
 
{{#if:
 
{{#vardefineecho:recipecnt|{{#expr:{{#var:recipecnt|0}}+1}}}}
 
{{#vardefineecho:recipecnt|{{#expr:{{#var:recipecnt|0}}+1}}}}
{{#vardefine:item_id|{{#explode:{{#show:{{PAGENAME}}|?Has game id#|limit=1|searchlabel=}}|,}}}}
+
{{#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 --> |
   {{#ifeq: {{{historical|n}}} | y | <!-- no subobject if historical --> |
+
   {{#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:{{PAGENAME}}}}
+
       | 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 = {{#explode:{{{disciplines|}}}|,|0}}
+
       | Requires discipline = {{{disciplines|}}} |+sep=,
      | Requires discipline = {{#explode:{{{disciplines|}}}|,|1}}
 
      | Requires discipline = {{#explode:{{{disciplines|}}}|,|2}}
 
      | Requires discipline = {{#explode:{{{disciplines|}}}|,|3}}
 
      | Requires discipline = {{#explode:{{{disciplines|}}}|,|4}}
 
      | Requires discipline = {{#explode:{{{disciplines|}}}|,|5}}
 
      | Requires discipline = {{#explode:{{{disciplines|}}}|,|6}}
 
      | Requires discipline = {{#explode:{{{disciplines|}}}|,|7}}
 
 
       | Discipline count = {{#len:{{#arraymap:{{{disciplines|}}}|,|@@@|.|}}}}
 
       | Discipline count = {{#len:{{#arraymap:{{{disciplines|}}}|,|@@@|.|}}}}
       | Is time gated = {{#ifeq:{{lc:{{{timegate|n}}}}}|y|Y|N}}
+
       | Is time gated = {{#ifeq:{{lc:{{{timegate|n}}}}}|y|Y}}
       | Has ingredient = {{#if:{{{ingredient1|}}}|{{#iferror:{{#expr:{{{ingredient1|x}}}*1}}|<!--alpha-->1;{{#explode:{{{ingredient1}}}| |0}};{{#sub:{{{ingredient1}}}|{{#pos:{{{ingredient1}}}| }}}}|<!--numeric-->1;1;{{#ask:[[Has context::Item]][[Has game id::{{{ingredient1}}}]]|link=none}} }} }}
+
       | Has ingredient = {{#if: {{{ingredient1|}}} | 1;{{#explode:{{{ingredient1}}}| |0}};{{#sub:{{{ingredient1}}}|{{#pos:{{{ingredient1}}}| }}}} }}
       | Has ingredient = {{#if:{{{ingredient2|}}}|{{#iferror:{{#expr:{{{ingredient2|x}}}*1}}|<!--alpha-->2;{{#explode:{{{ingredient2}}}| |0}};{{#sub:{{{ingredient2}}}|{{#pos:{{{ingredient2}}}| }}}}|<!--numeric-->2;1;{{#ask:[[Has context::Item]][[Has game id::{{{ingredient2}}}]]|link=none}} }} }}
+
       | Has ingredient = {{#if: {{{ingredient2|}}} | 2;{{#explode:{{{ingredient2}}}| |0}};{{#sub:{{{ingredient2}}}|{{#pos:{{{ingredient2}}}| }}}} }}
       | Has ingredient = {{#if:{{{ingredient3|}}}|{{#iferror:{{#expr:{{{ingredient3|x}}}*1}}|<!--alpha-->3;{{#explode:{{{ingredient3}}}| |0}};{{#sub:{{{ingredient3}}}|{{#pos:{{{ingredient3}}}| }}}}|<!--numeric-->3;1;{{#ask:[[Has context::Item]][[Has game id::{{{ingredient3}}}]]|link=none}} }} }}
+
       | Has ingredient = {{#if: {{{ingredient3|}}} | 3;{{#explode:{{{ingredient3}}}| |0}};{{#sub:{{{ingredient3}}}|{{#pos:{{{ingredient3}}}| }}}} }}
       | Has ingredient = {{#if:{{{ingredient4|}}}|{{#iferror:{{#expr:{{{ingredient4|x}}}*1}}|<!--alpha-->4;{{#explode:{{{ingredient4}}}| |0}};{{#sub:{{{ingredient4}}}|{{#pos:{{{ingredient4}}}| }}}}|<!--numeric-->4;1;{{#ask:[[Has context::Item]][[Has game id::{{{ingredient4}}}]]|link=none}} }} }}
+
       | 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|{{PAGENAME}}}}}</div>
+
<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">}}[[@@@]]{{#vardefine:sheet_count|{{#expr:{{#var:sheet_count|0}}+1}}}}|<br>}}{{#ifexpr:{{#var:sheet_count}}>3|</div></div>}}
+
| 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>}}
; Треб.&nbsp;уровень
+
; Req. rating
: {{{rating|0}}} {{#if:{{{id|}}}|
+
: {{{rating|0}}} {{#if:{{{timegate|}}}|
<dt class="api hide">Unlocked&nbsp;on</dt><!--
+
;[[Crafting#Time gated recipes|Time gate]]
--><dd class="api hide api-unlockedon" data-recipeid="{{{id}}}">…</dd> }} {{#if:{{{timegate|}}}|
+
:Daily
;[[Crafting#Time gated recipes|Огр. по времени]]
 
:Ежедневно
 
 
}}{{#if: {{{id|}}} |  
 
}}{{#if: {{{id|}}} |  
; Ссылка в чат
+
; Chat link
: {{recipe link|{{{id|}}}}} }} }}
+
: {{#arraymap:{{{id}}}|,|@@@|{{recipe link|@@@}}|<br>}} }} }}
 
</div>
 
</div>
 
{{clear}}
 
{{clear}}
<div class="subheading">Ингредиенты</div>
+
<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
  | {{#ifeq: {{{historical|n}}} | 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> }}
  | <!-- 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={{{id|{{#var:mystic_forge_id}}}}}{{#if:{{#var:mystic_forge_id}}|&Base_ingredients%5Bdiscipline%5D={{urlencode:Mystic forge}}}}&wpRunQuery=true}} Show base ingredients]</span></small></div> }}
 
 
   }}
 
   }}
 
}}
 
}}
Строка 88: Строка 83:
  
 
== Parameters ==
 
== Parameters ==
; id : The recipe ID
+
; name : The recipe name (defaults to <code>BASEPAGENAME</code>)
; name : The recipe name (defaults to <code>PAGENAME</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 either a quantity followed by an item name, or simply an item ID. In the latter case, the quantity is assumed to be 1.
+
: Required. The ingredients of the recipe. Value should be a quantity followed by an item name.
 
:* <code>&lt;quantity> &lt;item name></code>, e.g. <code>1 Jug of Water</code>
 
:* <code>&lt;quantity> &lt;item name></code>, e.g. <code>1 Jug of Water</code>
:* <code>&lt;item id></code>, e.g. 25079
 
 
; ingredient2
 
; ingredient2
 
; ingredient3
 
; ingredient3
 
; ingredient4
 
; ingredient4
 
: Optional. Same functionality as ingredient1.
 
: Optional. Same functionality as ingredient1.
; historical
+
; output item id
: Optional. Set equal to <code>y</code> if the item is historical - this will prevent the recipe from storing semantic properties.
+
: 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
| id = 1234
 
 
| 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
| id = 1234
 
 
| 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 parameter sheet below.
  • mystic forge - This is a Mystic Forge recipe.
  • guild upgrade - Learned from a guild upgrade; requires parameter guild 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 tango icon 20px.png Chef
Weaponsmith tango icon 20px.png Weaponsmith
Req. rating
400
Chat link
Ingredients