Modèle:ItemIdFromName : Différence entre versions

De Terraria Wiki
Aller à : navigation, rechercher
(sync :: en revid:959690::)
m
 
Ligne 1 : Ligne 1 :
 
<includeonly><!--
 
<includeonly><!--
//loading db for that lang
 
-->{{#vardefine:dblang|{{#switch:{{{lang|}}}|de=de|zh=zh|it=it|es=es|fr=fr|ru=ru|pl=pl|pt=pt|#default=en}}}}<!--
 
-->{{#if:{{#dplvar:iteminfo:id_{{#var:dblang}}}}||{{ItemIdFromName/db-{{#var:dblang}}}}}}<!--
 
   
  +
-->{{#vardefine:_lang|{{{lang|{{lang}}}}}}}<!--
//get id
 
  +
-->{{#dplvar:iteminfo:id:{{#var:dblang}}:{{#vardefineecho:_|{{{1|}}}}}}}<!-- #vardefineecho:_ for trim.
 
  +
//load default en db
  +
-->{{#if:{{#dplvar:iteminfo:id_en}}||{{ItemIdFromName/db-en}}}}<!--
 
//load db for that lang
  +
-->{{#dplvar:set<!--
  +
-->|db-de|y<!--
  +
-->|db-zh|y<!--
  +
-->|db-it|y<!--
  +
-->|db-es|y<!--
  +
-->|db-fr|y<!--
  +
-->|db-ru|y<!--
  +
-->|db-pl|y<!--
  +
-->|db-pt|y<!--
  +
-->}}<!--
  +
-->{{#if:{{#dplvar:db-{{#var:_lang}}}}|<!--
 
-->{{#if:{{#dplvar:iteminfo:id_{{#var:_lang}}}}||{{ItemIdFromName/db-{{#var:_lang}}}}}}<!--
  +
-->}}<!--
  +
//get id. vardefinecho for trim, en for fallback.
  +
-->{{#vardefine:_key|{{{1|}}}}}<!--
  +
-->{{#vardefineecho:_id|{{#dplvar:iteminfo:id:{{#var:_lang}}:{{#var:_key}}}}}}<!--
  +
-->{{#if:{{#var:_id}}||{{#dplvar:iteminfo:id:en:{{#var:_key}}}}}}<!-- en fallback if needed.
   
 
--></includeonly><noinclude>{{doc}}</noinclude>
 
--></includeonly><noinclude>{{doc}}</noinclude>

Version actuelle datée du 22 mai 2020 à 01:44

Template-info.svg Documentation La documentation ci-dessous est transcluse de Modèle:ItemIdFromName/doc. (modifier | historique)

This template returns the Item ID of an item based on its name. It requires the exact name of the item.

Usage

{{ItemIdFromName | <Item name> (optional) | lang= <lang> (optional) }}

First unnamed parameter

Name of the item. If empty or invalid, will return empty string.

lang

Language code. Default is en. Currently we have 9 languages (as in game): en/es/it/de/fr/zh/pl/pt/ru. All other lang codes will use en database.

Examples

Code result
{{ItemIdFromName|Iron Pickaxe}} 1
{{ItemIdFromName|S.D.M.G.}} 1553
{{ItemIdFromName| S.D.M.G. }} 1553
{{ItemIdFromName|}}
{{ItemIdFromName|someNameNotExists}}
{{ItemIdFromName|Zyan Farbstoff|lang=de}} 1013

See also