Terraria Wiki
Terraria Wiki
m (Annulation des modifications 169366 de Dinoxel (discussion))
Balise : Annulation
Aucun résumé des modifications
 
(26 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 
<includeonly><!--
 
<includeonly><!--
  +
Note: The "tabs" functionality of this template requires JavaScript in MediaWiki:Common.js and/or MediaWiki:Mobile.js
   
NOTE: This template needs javascript in mediawiki:common.js and/or mediawiki:mobile.js
 
   
  +
==========================================================================================================================
  +
=========================================== INITIALIZATION ===========================================
  +
==========================================================================================================================
   
//localization info in [[template:npc_infobox/l10n]].(autoload)
 
   
  +
+++++++++++++ 1. Localization +++++++++++++
//ext l10n info: how to get english npc name from {{BASEPAGENAME}}?
 
  +
  +
// localization info is autoloaded from Template:Npc infobox/l10n
  +
  +
// additional l10n: how to get the English NPC name from {{BASEPAGENAME}}?
 
-->{{#vardefine:npcnamefrompagename|{{pagename2en|{{#titleparts:{{ROOTPAGENAME}}}}}}}}<!--
 
-->{{#vardefine:npcnamefrompagename|{{pagename2en|{{#titleparts:{{ROOTPAGENAME}}}}}}}}<!--
   
//don't forget template:npc_infobox/cate
 
   
  +
+++++++++++++ 2. View-related options +++++++++++++
=== l10n end ==========================================================================================================
 
   
  +
-->{{#vardefine:ni:viewmodename|{{lc:{{{mode|{{{output|{{{view|{{options/get|npc infobox|view}}}}}}}}}}}}}}}<!--
//view name:
 
-->{{#vardefine:ni:viewmodename|{{lc:{{{mode|{{{output|{{{view|{{#var:_npc_infobox_flag_view|infobox}}}}}}}}}}}}}}}<!--
 
 
-->{{#switch:{{#var:ni:viewmodename}}<!--
 
-->{{#switch:{{#var:ni:viewmodename}}<!--
-->|infobox=<!-- @todo
+
-->|infobox=<!--
-->{{#arraydefine:extargs|float/css/style/boxwidth/shownpcid/{{{extargs|{{npc infobox/options|get|extargs}}}}}|/}}<!--
+
-->{{#arraydefine:extargs|float/css/style/boxwidth/shownpcid/{{{extargs|{{options/get|npc infobox|extargs}}}}}|/}}<!--
-->{{#arrayprint:extargs||@@@@|{{#if:@@@@|{{#vardefine:ni:ext:@@@@|{{{@@@@|}}}}}}}}}<!-- ext parameters for view
 
-->{{#vardefine:imagemode|{{{imagemode|full}}}}}<!--
 
 
-->|table=<!--
 
-->|table=<!--
-->{{#arraydefine:extargs|cols/{{{extargs|{{npc infobox/options|get|extargs}}}}}|/}}<!--
+
-->{{#arraydefine:extargs|cols/{{{extargs|{{options/get|npc infobox|extargs}}}}}|/}}<!--
  +
-->{{#arraydefine:ni:table:cols|{{{cols|{{options/get|npc infobox|cols}}}}}|{{{colsep|{{#or:{{options/get|npc infobox|colsep}}|/}}}}}}}<!-- default cols value from options
-->{{#arrayprint:extargs||@@@@|{{#if:@@@@|{{#vardefine:ni:ext:@@@@|{{{@@@@|}}}}}}}}}<!-- ext parameters for view
 
  +
// and pass all custom col values
-->{{#vardefine:colsep|{{npc infobox/options|get|colsep}}}}<!--
 
-->{{#vardefine:cells|{{{cells|{{npc infobox/options|get|cells}}}}}}}<!--
+
-->{{#arrayprint:ni:table:cols||@@@@|{{#if:{{#rmatch:@@@@|/^col:/|y}}|{{#vardefine:ni:@@@@|{{{@@@@|}}} }}}}}}<!--
  +
-->|custom=<!--
-->{{#arraydefine:ni:table:cols|{{#var:ni:ext:cols|{{#var:_npc_infobox_flag_cols}}}}|{{{colsep|{{#var:colsep|/}}}}}}}<!-- default cols value from options
 
  +
-->{{#arraydefine:extargs|template/{{{extargs|{{options/get|npc infobox|extargs}}}}}|/}}<!--
// and pass all custom col values.
 
-->{{#arrayprint:ni:table:cols||@@@@|{{#if:{{regex|@@@@|/^col:/}}|{{#vardefine:ni:@@@@|{{{@@@@|}}} }}}}}}<!--
 
-->{{#vardefine:imagemode|{{{imagemode|{{npc infobox/options|get|imagemode}}}}}}}<!--
 
 
-->|#default=<!--
 
-->|#default=<!--
-->{{#arraydefine:extargs|{{{extargs|{{npc infobox/options|get|extargs}}}}}|/}}<!-- ext parameters for view
+
-->{{#arraydefine:extargs|{{{extargs|{{options/get|npc infobox|extargs}}}}}|/}}<!--
-->{{#arrayprint:extargs||@@@@|{{#if:@@@@|{{#vardefine:ni:ext:@@@@|{{{@@@@|}}}}}}}}}<!--
 
-->{{#vardefine:imagemode|{{{imagemode|{{npc infobox/options|get|imagemode}}}}}}}<!--
 
 
-->}}<!--
 
-->}}<!--
  +
-->{{#arrayprint:extargs||@@@@|{{#if:@@@@|{{#vardefine:ni:ext:@@@@|{{{@@@@|}}}}}}}}}<!-- ext parameters for view
  +
-->{{#vardefine:imagemode|{{{imagemode|{{#ifeq:{{#var:ni:viewmodename}}|infobox|full|{{options/get|npc infobox|imagemode}}}}}}}}}<!-- image mode
   
======== DATA MODEL ========
 
//reset all npcinfo fields
 
-->{{#invoke:npcinfo|clear|prefix=_npc_infobox:info:}}<!--
 
   
  +
//fetch data from npcinfo database if needed.
 
  +
==========================================================================================================================
-->{{#vardefine:_npc_auto_id|}}<!--
 
  +
============================================= DATA MODEL =============================================
-->{{#if:{{{auto|}}}|<!--
 
  +
==========================================================================================================================
-->{{#vardefine:_npc_auto_id|{{#if:{{#dplreplace:{{trim|{{{auto|}}}}}|/^-?[0-9]+$/|}}|{{{id|}}}|{{trim|{{{auto|}}}}}}}}}<!--
 
  +
-->{{#invoke:npcinfo|getInfo|id={{#var:_npc_auto_id}}|prefix=_npc_infobox:info:}}<!--
 
  +
Note: All "#lst*" parser functions ([[gphelp:Extension:ParserPower/List handling functions]]) will trim whitespace and discard empty elements.
  +
  +
+++++++++++++ 1. Set cargo flags +++++++++++++
  +
  +
// (defining this up here because we already need it in the drop section)
  +
-->{{#vardefine:cargo|}}<!--
  +
-->{{#ifeq:{{NAMESPACE}}|{{ns:0}}|{{#ifeq:{{PAGENAME}}|{{ROOTPAGENAME}}|{{#vardefine:cargo|y}}}}}}<!-- default: only main ns, only root pages (e.g. no translation subpages)
  +
-->{{#if:{{{cargo|}}}|<!--
  +
-->{{#switch:{{{cargo|}}}<!--
  +
-->|1|y|yes|true|force|on={{#vardefine:cargo|y}}<!-- on
  +
-->|0|n|no|false|off={{#vardefine:cargo|}}<!-- off
  +
-->|#default=<!-- invalid parameter value, so keep the variable unchanged
  +
-->}}<!--
 
-->}}<!--
 
-->}}<!--
  +
-->{{#if:{{langList|isOnWiki|{{lang}}}}|{{#vardefine:cargo|}}}}<!-- never store for non-english languages on mainwiki
//npc id (only for display)
 
-->{{#vardefine:ni:npcid|{{{id|{{#var:_npc_auto_id}}}}}}}<!--
 
   
  +
-->{{#vardefine:nidrop:cargo|{{#var:cargo}}}}<!-- store drops to cargo? by default, only do that if other data is also stored to cargo
//all data:
 
  +
-->{{#if:{{{cargodrops|}}}|<!--
  +
-->{{#switch:{{{cargodrops|}}}<!--
  +
-->|1|y|yes|true|force|on={{#vardefine:nidrop:cargo|y}}<!-- on
  +
-->|0|n|no|false|off={{#vardefine:nidrop:cargo|}}<!-- off
  +
-->|auto={{#ifeq:{{NAMESPACE}}|{{ns:0}}|{{#ifeq:{{PAGENAME}}|{{ROOTPAGENAME}}|{{#vardefine:nidrop:cargo|y}}}}}}<!-- only main ns, only root pages(useful when set |cargo=y/n)
  +
-->|#default=<!-- invalid parameter value, so keep the variable unchanged
  +
-->}}<!--
  +
-->}}<!--
  +
-->{{#if:{{langList|isOnWiki|{{lang}}}}|{{#vardefine:nidrop:cargo|}}}}<!-- never store for non-english languages on mainwiki
   
type
 
-->{{#vardefine:ni:type|{{{type|Enemy}}}}}<!--
 
-->{{#vardefine:ni:type2|{{{type2|}}}}}<!--
 
-->{{#vardefine:ni:type3|{{{type3|}}}}}<!--
 
   
  +
+++++++++++++ 2. Set types, listcats, environments, mode exclusivity, variant flag, and notabs flag from parameter input +++++++++++++
//tabs?
 
-->{{#vardefine:ni:notab|{{{notabs|{{{notab|{{{variant|{{#switch:{{{tabs|{{{tab|}}}}}}|n|no=y}}}}}}}}}}}}}<!--
 
-->{{#switch:{{tr|{{lc:{{#var:ni:type}}}}}}|npc|critter|gold critter|furniture={{#vardefine:ni:notab|{{#if:{{{tabs|{{{tab|}}}}}}||y}}}}}}<!-- tabs=y force it appear.
 
   
  +
// types: separated with "/".
environment
 
-->{{#vardefine:ni:environment|{{{environment|}}}/{{{environment2|}}}/{{{environment3|}}}}}<!--
+
-->{{#vardefine:ni:types|{{lcfirst:{{{type|Enemy}}}}}/{{lcfirst:{{{type2|}}}}}/{{lcfirst:{{{type3|}}}}}}}<!--
-->{{#vardefine:ni:environment|{{#dplreplace:{{#var:ni:environment}}|/\/\/+/|/}}}}<!--
 
-->{{#vardefine:ni:environment|{{#dplreplace:{{#var:ni:environment}}|/^\//|}}}}<!--
 
-->{{#vardefine:ni:environment|{{#dplreplace:{{#var:ni:environment}}|/\/$/|}}}}<!--
 
   
  +
// listcats: separated with "/".
name/namesub/namenote, and default image file name
 
  +
-->{{#vardefine:ni:listcats|{{#lstsep:{{{listcat|}}}/{{{listcat2|}}}/{{{listcat3|}}}|/|/}}}}<!-- #lstsep to remove empty elements
-->{{#if:{{#dplvar:_npc_infobox:info:netID}}|<!--
 
  +
-->{{#vardefine:ni:name|{{{name|<!--
 
  +
// environment
-->{{npc infobox/namedb}}<!-- loading npc name database (it's English)
 
  +
-->{{#vardefine:ni:environment|{{#lstsep:{{{environment|}}}/{{{environment2|}}}/{{{environment3|}}}|/|/}}}}<!-- #lstsep to remove empty elements
-->{{#dplvar:_npc_infobox:info:name}}<!--
 
  +
-->}}}}}<!--
 
  +
// mode exclusivity
-->{{#vardefine:_|{{npc infobox/namedb-{{lang}}}}}}<!-- loading db for local lang
 
-->{{#vardefine:ni:namesub|{{{namesub|{{#dplvar:_npc_infobox:{{lang}}:npcnamesub:{{#dplvar:_npc_infobox:info:netID}}}}}}}}}<!--
+
-->{{#vardefine:ni:hardmodeonly|{{bool|{{{hardmode|}}}}}}}<!--
-->{{#vardefine:ni:namenote|{{{namenote|{{#dplvar:_npc_infobox:{{lang}}:npcnamenote:{{#dplvar:_npc_infobox:info:netID}}}}}}}}}<!--
+
-->{{#vardefine:ni:expertonly|{{bool|{{{expertonly|}}}}}}}<!--
-->{{#vardefine:ni:imagename|{{{name|<!--
+
-->{{#vardefine:ni:masteronly|{{bool|{{{masteronly|}}}}}}}<!--
  +
-->{{npc infobox/namedb-en}}<!-- loading db for en
 
  +
// variant flag
-->{{#if:{{#dplvar:_npc_infobox:en:npcnamesub:{{#dplvar:_npc_infobox:info:netID}}}}|<!--
 
  +
-->{{#vardefine:ni:variant|{{bool|{{{variant|}}}}}}}<!--
-->{{#dplvar:_npc_infobox:en:npcnamesub:{{#dplvar:_npc_infobox:info:netID}}}}<!--
 
  +
-->|<!--
 
  +
// notabs flag
-->{{#var:ni:name}}<!--
 
  +
* reset
-->}}<!--
 
-->}}}<!--
+
-->{{#vardefine:ni:notab|}}<!--
  +
* default: set flag if the types contain certain strings
  +
-->{{#if:{{#lstfltr:npc/critter/gold critter/furniture|/|{{lc:{{#var:ni:types}}}}|/}}|{{#vardefine:ni:notab|y}}}}<!--
  +
* $tabs=y: force flag to false
  +
-->{{#if:{{bool|{{{tabs|{{{tab|}}}}}}}}|{{#vardefine:ni:notab|}}}}<!--
  +
* $variant / $notabs=y / $tabs=n: force flag to true ($variant because Expert Mode is post-1.3)
  +
-->{{#if:{{bool|{{{notabs|{{{notab|}}}}}}}}{{#var:ni:variant}}{{#switch:{{{tabs|{{{tab|}}}}}}|n|no|0|false=y}}|{{#vardefine:ni:notab|y}}}}<!--
  +
  +
  +
+++++++++++++ 3. Fetch automatic data +++++++++++++
  +
  +
-->{{#vardefine:ni:auto_id|{{#if:{{{auto|}}}|<!--
  +
-->{{#if:{{isNumber|{{{auto|}}}}}|<!--
  +
-->{{{auto|}}}<!-- $auto is number, use it as-is
  +
-->|<!--
  +
-->{{{id|{{NpcIdFromName|{{{name|{{#var:npcnamefrompagename}}}}}}}}}}<!-- $id -> idFromName
 
-->}}<!--
 
-->}}<!--
  +
-->}}}}<!--
  +
-->{{#if:{{#var:ni:auto_id}}|<!--
  +
-->{{#invoke:Npcinfo|getInfo|id={{#var:ni:auto_id}}|prefix=ni:info:}}<!-- fetch data
  +
-->|<!--
  +
-->{{#invoke:Npcinfo|clear|prefix=ni:info:}}<!-- reset the data-filled vars
  +
-->}}<!--
  +
  +
  +
+++++++++++++ 4. Process auto data, overriding with manual input if necessary +++++++++++++
  +
  +
---- id, name, and default imagename ----
  +
-->{{#vardefine:ni:npcid|{{{id|{{#var:ni:auto_id}}}}}}}<!-- npc id (only for display)
  +
-->{{#vardefine:ni:namesub|{{tr|{{{namesub|}}}}}}}<!--
  +
-->{{#vardefine:ni:namenote|{{tr|{{{namenote|}}}}}}}<!--
  +
-->{{#if:{{#dplvar:ni:info:netID}}|<!--
  +
-->{{#vardefine:ni:name|{{{name|{{#dplvar:ni:info:name}}}}}}}<!--
  +
-->{{#vardefine:_|{{npc infobox/namedb-{{lang|}}}}}}<!-- load db for local lang (in a dummy #vardefine to prevent redlink if db doesn't exist)
  +
-->{{#vardefine:ni:namesub|{{tr|{{#var:ni:namesub|{{{namesub|{{#dplvar:_npc_infobox:{{lang|}}:npcnamesub:{{#dplvar:ni:info:netID}}}}}}}}}}}}}<!-- by doing this we can use |namesub=<blank> to suppress auto value.
  +
-->{{#vardefine:ni:namenote|{{#var:ni:namenote|{{{namenote|{{#dplvar:_npc_infobox:{{lang|}}:npcnamenote:{{#dplvar:ni:info:netID}}}}}}}}}}}<!--
  +
-->{{#vardefine:ni:imagename|{{{name|<!--
  +
-->{{npc infobox/namedb-en}}<!-- load db for en
  +
-->{{#if:{{#dplvar:_npc_infobox:en:npcnamesub:{{#dplvar:ni:info:netID}}}}|<!--
  +
-->{{#dplvar:_npc_infobox:en:npcnamesub:{{#dplvar:ni:info:netID}}}}<!--
  +
-->|<!--
  +
-->{{#var:ni:name}}<!--
  +
-->}}<!--
  +
-->}}}}}<!--
 
-->|<!--
 
-->|<!--
 
-->{{#vardefine:ni:name|{{{name|{{#var:npcnamefrompagename}}}}}{{{name2|}}}}}<!--
 
-->{{#vardefine:ni:name|{{{name|{{#var:npcnamefrompagename}}}}}{{{name2|}}}}}<!--
-->{{#vardefine:ni:namesub|{{{namesub|}}}}}<!--
 
-->{{#vardefine:ni:namenote|{{{namenote|}}}}}<!--
 
 
-->{{#vardefine:ni:imagename|{{{name|{{#var:npcnamefrompagename}}}}}}}<!--
 
-->{{#vardefine:ni:imagename|{{{name|{{#var:npcnamefrompagename}}}}}}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->{{#vardefine:ni:name2|{{{name2|}}}}}<!--
 
-->{{#vardefine:ni:name2|{{{name2|}}}}}<!--
 
-->{{#vardefine:ni:namesub2|{{{namesub2|}}}}}<!--
 
-->{{#vardefine:ni:namesub2|{{{namesub2|}}}}}<!--
  +
--------
-->{{#vardefine:ni:hardmodeonly|{{{hardmode|}}}}}<!--
 
-->{{#vardefine:ni:expertonly|{{{expertonly|}}}}}<!--
 
-->{{#vardefine:ni:masteronly|{{{masteronly|}}}}}<!--
 
   
  +
---- ai ----
//version info
 
  +
-->{{#vardefine:ni:ai|{{#if:{{{ai|{{#dplvar:ni:info:aiStyle}}}}}|{{{ai|{{npc infobox/AI|{{#dplvar:ni:info:aiStyle}}}}}}}}}}}<!--
-->{{#vardefine:ni:variant|}}<!-- reset
 
  +
--------
-->{{#if:{{{version|{{{variant|}}}}}}|<!--
 
-->{{#if:{{#pos:{{lc:{{{version|}}}}}|desktop}}||<!--
 
-->{{#if:{{{version|}}}|<!--
 
-->{{#vardefine:ni:variant|<!--
 
-->{{#if:{{#pos:{{lc:{{{version}}}}}|desktop}}|desktop/}}<!--
 
-->{{#if:{{#pos:{{lc:{{{version}}}}}|console}}|console/}}<!--
 
-->{{#if:{{#pos:{{lc:{{{version}}}}}|oldgen}}|old-gen/}}<!--
 
-->{{#if:{{#pos:{{lc:{{{version}}}}}|mobile}}|mobile/}}<!--
 
-->{{#if:{{#pos:{{lc:{{{version}}}}}|3ds}}|3ds}}<!--
 
-->}}<!--
 
-->|<!--else
 
-->{{#vardefine:ni:variant|old-gen/3ds}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->}}<!--
 
   
  +
---- damage ----
//all images: (default auto main image filename is in {{#var:ni:imagename}} )
 
  +
-->{{#vardefine:ni:damage|{{{damage|{{#if:{{#dplvar:ni:info:damage}}|<!--
image 1
 
-->{{#vardefine:ni:image1|{{{imagealt|{{image|{{{image|{{#var:ni:imagename}}.png}}}|link=|size={{{imagesize|}}}}}}}}}}<!--
+
-->{{#invoke:Npcstat|format|lang={{lang|}}|hardmodeonly={{#var:ni:hardmodeonly}}|expertonly={{#var:ni:expertonly}}<!--
  +
-->|{{#dplvar:ni:info:damage}}<!--
-->{{#if:{{#var:ni:image1}}||{{#vardefine:ni:image1|[[File:{{{image|{{#var:ni:imagename}}.png}}}|link=]]}}}}<!-- fallback if {{image}} failed.
 
  +
-->|{{#dplvar:ni:info:damage_e}}|{{#dplvar:ni:info:damage_e_hm}}|{{#dplvar:ni:info:damage_e_pp}}<!--
-->{{#vardefine:ni:image1text|}}<!--
 
  +
-->|{{#dplvar:ni:info:damage_m}}|{{#dplvar:ni:info:damage_m_hm}}|{{#dplvar:ni:info:damage_m_pp}}<!--
image expert
 
-->{{#vardefine:imageexpert|{{{imageexpert|}}}}}<!--
 
init image 2/3
 
-->{{#vardefine:ni:image2|{{{image2|}}}}}<!--
 
-->{{#vardefine:ni:image2text|}}<!--
 
-->{{#vardefine:ni:image3|{{{image3|}}}}}<!--
 
-->{{#vardefine:ni:image3text|}}<!--
 
parse image 2/3
 
init all vars
 
-->{{#dplvar:set<!--
 
-->|d|t1|c|t1|o|t1|m|t1|3|t1<!--
 
-->|t1||t2||t3|<!--
 
-->}}<!--
 
try to auto discover: _(old).png, _(old).gif if needed. only for full mode
 
-->{{#ifeq:{{#var:imagemode}}|full|<!--
 
if($image2 === null)
 
-->{{#if:{{{image2|}}}||{{#if:{{{image2|null}}}|<!--
 
-->{{#vardefine:old|{{#if:{{{image|}}}|{{#explode:{{{image}}}|.|0}}|{{#var:ni:imagename}}}}_(old)}}<!--
 
-->{{#vardefine:ni:image2|<!--
 
-->{{#ifexist:Media:{{#var:old}}.png|<!--
 
-->{{#var:old}}.png<!--
 
-->|<!--
 
-->{{#ifexist:Media:{{#var:old}}.gif|{{#var:old}}.gif}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->}}}}<!--
 
-->}}<!--
 
versions for images2
 
-->{{#if:{{#var:ni:image2}}|<!--
 
imageversion2 examples: old,Console,Console-Mobile, any platform-platform-platform
 
-->{{#if:{{{imageversion2|}}}|<!--
 
-->{{#dplvar:set|imageversion|{{lc:{{{imageversion2}}}}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|desktop}}|{{#dplvar:set|d|t2}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|console}}|{{#dplvar:set|c|t2}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|old-gen}}|{{#dplvar:set|o|t2}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|mobile}}|{{#dplvar:set|m|t2}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|3ds}}|{{#dplvar:set|3|t2}}}}<!--
 
-->|<!--
 
-->{{#dplvar:set|o|t2|3|t2}}<!-- default old versions
 
 
-->}}<!--
 
-->}}<!--
-->}}<!--
 
versions for images3
 
-->{{#if:{{#var:ni:image3}}|<!--
 
imageversion3 examples: Console,Console-Mobile, any platform-platform-platform
 
-->{{#if:{{{imageversion3|}}}|<!-- platforms specified
 
-->{{#dplvar:set|imageversion|{{lc:{{{imageversion3|}}}}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|desktop}}|{{#dplvar:set|d|t3}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|console}}|{{#dplvar:set|c|t3}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|old-gen}}|{{#dplvar:set|o|t3}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|mobile}}|{{#dplvar:set|m|t3}}}}<!--
 
-->{{#if:{{#pos:{{#dplvar:imageversion}}|3ds}}|{{#dplvar:set|3|t3}}}}<!--
 
-->}}<!--
 
-->}}<!--
 
tooltips, if needed
 
-->{{#if:{{#var:ni:image2}}{{#var:ni:image3}}|<!--
 
// now dplvars d/c/o/m/3 will be t1/t2/t3.
 
//append versions to t1/t2/t3:
 
-->{{#dplvar:set|{{#dplvar:d}}|{{#dplvar:{{#dplvar:d}}}}/desktop}}<!--
 
-->{{#dplvar:set|{{#dplvar:c}}|{{#dplvar:{{#dplvar:c}}}}/console}}<!--
 
-->{{#dplvar:set|{{#dplvar:o}}|{{#dplvar:{{#dplvar:o}}}}/old-gen}}<!--
 
-->{{#dplvar:set|{{#dplvar:m}}|{{#dplvar:{{#dplvar:m}}}}/mobile}}<!--
 
-->{{#dplvar:set|{{#dplvar:3}}|{{#dplvar:{{#dplvar:3}}}}/3ds}}<!--
 
//alt text for t1/t2/t3
 
-->{{#if:{{#dplvar:t1}}|{{#vardefine:ni:image1text|{{versions|{{#dplvar:t1}}|mode=text|nl=yes}}}}}}<!--
 
-->{{#if:{{#dplvar:t2}}|{{#vardefine:ni:image2text|{{versions|{{#dplvar:t2}}|mode=text|nl=yes}}}}}}<!--
 
-->{{#if:{{#dplvar:t3}}|{{#vardefine:ni:image3text|{{versions|{{#dplvar:t3}}|mode=text|nl=yes}}}}}}<!--
 
-->}}<!--
 
 
AI
 
-->{{#vardefine:ni:ai|{{#if:{{{ai|{{#dplvar:_npc_infobox:info:aiStyle}}}}}|{{{ai|{{npc infobox/AI|{{#dplvar:_npc_infobox:info:aiStyle}}}}}}}}}}}<!--
 
damage
 
-->{{#vardefine:ni:damage|{{{damage|{{#if:{{#dplvar:_npc_infobox:info:damage}}|<!--
 
-->{{#invoke:npcstat|format|lang={{lang}}|hardmodeonly={{{hardmode|}}}|expertonly={{{expertonly|}}}<!--
 
-->|{{#dplvar:_npc_infobox:info:damage}}<!--
 
-->|{{#dplvar:_npc_infobox:info:damage_e}}|{{#dplvar:_npc_infobox:info:damage_e_hm}}|{{#dplvar:_npc_infobox:info:damage_e_pp}}<!--
 
-->|{{#dplvar:_npc_infobox:info:damage_m}}|{{#dplvar:_npc_infobox:info:damage_m_hm}}|{{#dplvar:_npc_infobox:info:damage_m_pp}}<!--
 
-->}}<!--
 
 
-->}}}}}{{{damage2|}}}}}<!--
 
-->}}}}}{{{damage2|}}}}}<!--
 
-->{{#vardefine:ni:damage1|{{{damage|}}}}}<!--
 
-->{{#vardefine:ni:damage1|{{{damage|}}}}}<!--
 
-->{{#vardefine:ni:damage2|{{{damage2|}}}}}<!--
 
-->{{#vardefine:ni:damage2|{{{damage2|}}}}}<!--
-->{{#vardefine:ni:auto_damage|{{#dplvar:_npc_infobox:info:damage}}}}<!--
+
-->{{#vardefine:ni:auto_damage|{{#dplvar:ni:info:damage}}}}<!--
-->{{#vardefine:ni:auto_damage_e|{{#dplvar:_npc_infobox:info:damage_e}}}}<!--
+
-->{{#vardefine:ni:auto_damage_e|{{#dplvar:ni:info:damage_e}}}}<!--
-->{{#vardefine:ni:auto_damage_e_hm|{{#dplvar:_npc_infobox:info:damage_e_hm}}}}<!--
+
-->{{#vardefine:ni:auto_damage_e_hm|{{#dplvar:ni:info:damage_e_hm}}}}<!--
-->{{#vardefine:ni:auto_damage_e_pp|{{#dplvar:_npc_infobox:info:damage_e_pp}}}}<!--
+
-->{{#vardefine:ni:auto_damage_e_pp|{{#dplvar:ni:info:damage_e_pp}}}}<!--
-->{{#vardefine:ni:auto_damage_m|{{#dplvar:_npc_infobox:info:damage_m}}}}<!--
+
-->{{#vardefine:ni:auto_damage_m|{{#dplvar:ni:info:damage_m}}}}<!--
-->{{#vardefine:ni:auto_damage_m_hm|{{#dplvar:_npc_infobox:info:damage_m_hm}}}}<!--
+
-->{{#vardefine:ni:auto_damage_m_hm|{{#dplvar:ni:info:damage_m_hm}}}}<!--
-->{{#vardefine:ni:auto_damage_m_pp|{{#dplvar:_npc_infobox:info:damage_m_pp}}}}<!--
+
-->{{#vardefine:ni:auto_damage_m_pp|{{#dplvar:ni:info:damage_m_pp}}}}<!--
  +
--------
max life
 
  +
-->{{#vardefine:ni:lifemax|{{{life|{{#if:{{#dplvar:_npc_infobox:info:lifeMax}}|<!--
 
  +
---- max life ----
-->{{#invoke:npcstat|format|lang={{lang}}|hardmodeonly={{{hardmode|}}}|expertonly={{{expertonly|}}}<!--
 
-->|{{#dplvar:_npc_infobox:info:lifeMax}}<!--
+
-->{{#vardefine:ni:lifemax|{{{life|{{#if:{{#dplvar:ni:info:lifeMax}}|<!--
  +
-->{{#invoke:Npcstat|format|lang={{lang|}}|hardmodeonly={{#var:ni:hardmodeonly}}|expertonly={{#var:ni:expertonly}}<!--
-->|{{#dplvar:_npc_infobox:info:lifeMax_e}}|{{#dplvar:_npc_infobox:info:lifeMax_e_hm}}|{{#dplvar:_npc_infobox:info:lifeMax_e_pp}}<!--
 
-->|{{#dplvar:_npc_infobox:info:lifeMax_m}}|{{#dplvar:_npc_infobox:info:lifeMax_m_hm}}|{{#dplvar:_npc_infobox:info:lifeMax_m_pp}}<!--
+
-->|{{#dplvar:ni:info:lifeMax}}<!--
  +
-->|{{#dplvar:ni:info:lifeMax_e}}|{{#dplvar:ni:info:lifeMax_e_hm}}|{{#dplvar:ni:info:lifeMax_e_pp}}<!--
-->}}<!--
 
  +
-->|{{#dplvar:ni:info:lifeMax_m}}|{{#dplvar:ni:info:lifeMax_m_hm}}|{{#dplvar:ni:info:lifeMax_m_pp}}<!--
  +
-->}}<!--
 
-->}}}}}{{{life2|}}}}}<!--
 
-->}}}}}{{{life2|}}}}}<!--
 
-->{{#vardefine:ni:lifemax1|{{{life|}}}}}<!--
 
-->{{#vardefine:ni:lifemax1|{{{life|}}}}}<!--
 
-->{{#vardefine:ni:lifemax2|{{{life2|}}}}}<!--
 
-->{{#vardefine:ni:lifemax2|{{{life2|}}}}}<!--
-->{{#vardefine:ni:auto_lifemax|{{#dplvar:_npc_infobox:info:lifeMax}}}}<!--
+
-->{{#vardefine:ni:auto_lifemax|{{#dplvar:ni:info:lifeMax}}}}<!--
-->{{#vardefine:ni:auto_lifemax_e|{{#dplvar:_npc_infobox:info:lifeMax_e}}}}<!--
+
-->{{#vardefine:ni:auto_lifemax_e|{{#dplvar:ni:info:lifeMax_e}}}}<!--
-->{{#vardefine:ni:auto_lifemax_e_hm|{{#dplvar:_npc_infobox:info:lifeMax_e_hm}}}}<!--
+
-->{{#vardefine:ni:auto_lifemax_e_hm|{{#dplvar:ni:info:lifeMax_e_hm}}}}<!--
-->{{#vardefine:ni:auto_lifemax_e_pp|{{#dplvar:_npc_infobox:info:lifeMax_e_pp}}}}<!--
+
-->{{#vardefine:ni:auto_lifemax_e_pp|{{#dplvar:ni:info:lifeMax_e_pp}}}}<!--
-->{{#vardefine:ni:auto_lifemax_m|{{#dplvar:_npc_infobox:info:lifeMax_m}}}}<!--
+
-->{{#vardefine:ni:auto_lifemax_m|{{#dplvar:ni:info:lifeMax_m}}}}<!--
-->{{#vardefine:ni:auto_lifemax_m_hm|{{#dplvar:_npc_infobox:info:lifeMax_m_hm}}}}<!--
+
-->{{#vardefine:ni:auto_lifemax_m_hm|{{#dplvar:ni:info:lifeMax_m_hm}}}}<!--
-->{{#vardefine:ni:auto_lifemax_m_pp|{{#dplvar:_npc_infobox:info:lifeMax_m_pp}}}}<!--
+
-->{{#vardefine:ni:auto_lifemax_m_pp|{{#dplvar:ni:info:lifeMax_m_pp}}}}<!--
  +
--------
defense
 
  +
-->{{#vardefine:ni:defense|{{{defense|{{#if:{{#dplvar:_npc_infobox:info:defense}}|<!--
 
  +
---- defense ----
-->{{#invoke:npcstat|format|lang={{lang}}|hardmodeonly={{{hardmode|}}}|expertonly={{{expertonly|}}}<!--
 
-->|{{#dplvar:_npc_infobox:info:defense}}<!--
+
-->{{#vardefine:ni:defense|{{{defense|{{#if:{{#dplvar:ni:info:defense}}|<!--
  +
-->{{#invoke:Npcstat|format|lang={{lang|}}|hardmodeonly={{#var:ni:hardmodeonly}}|expertonly={{#var:ni:expertonly}}<!--
-->|{{#dplvar:_npc_infobox:info:defense_e}}|{{#dplvar:_npc_infobox:info:defense_e_hm}}|{{#dplvar:_npc_infobox:info:defense_e_pp}}<!--
 
-->|{{#dplvar:_npc_infobox:info:defense_m}}|{{#dplvar:_npc_infobox:info:defense_m_hm}}|{{#dplvar:_npc_infobox:info:defense_m_pp}}<!--
+
-->|{{#dplvar:ni:info:defense}}<!--
  +
-->|{{#dplvar:ni:info:defense_e}}|{{#dplvar:ni:info:defense_e_hm}}|{{#dplvar:ni:info:defense_e_pp}}<!--
-->}}<!--
 
  +
-->|{{#dplvar:ni:info:defense_m}}|{{#dplvar:ni:info:defense_m_hm}}|{{#dplvar:ni:info:defense_m_pp}}<!--
  +
-->}}<!--
 
-->}}}}}{{{defense2|}}}}}<!--
 
-->}}}}}{{{defense2|}}}}}<!--
 
-->{{#vardefine:ni:defense1|{{{defense|}}}}}<!--
 
-->{{#vardefine:ni:defense1|{{{defense|}}}}}<!--
 
-->{{#vardefine:ni:defense2|{{{defense2|}}}}}<!--
 
-->{{#vardefine:ni:defense2|{{{defense2|}}}}}<!--
-->{{#vardefine:ni:auto_defense|{{#dplvar:_npc_infobox:info:defense}}}}<!--
+
-->{{#vardefine:ni:auto_defense|{{#dplvar:ni:info:defense}}}}<!--
-->{{#vardefine:ni:auto_defense_e|{{#dplvar:_npc_infobox:info:defense_e}}}}<!--
+
-->{{#vardefine:ni:auto_defense_e|{{#dplvar:ni:info:defense_e}}}}<!--
-->{{#vardefine:ni:auto_defense_e_hm|{{#dplvar:_npc_infobox:info:defense_e_hm}}}}<!--
+
-->{{#vardefine:ni:auto_defense_e_hm|{{#dplvar:ni:info:defense_e_hm}}}}<!--
-->{{#vardefine:ni:auto_defense_e_pp|{{#dplvar:_npc_infobox:info:defense_e_pp}}}}<!--
+
-->{{#vardefine:ni:auto_defense_e_pp|{{#dplvar:ni:info:defense_e_pp}}}}<!--
-->{{#vardefine:ni:auto_defense_m|{{#dplvar:_npc_infobox:info:defense_m}}}}<!--
+
-->{{#vardefine:ni:auto_defense_m|{{#dplvar:ni:info:defense_m}}}}<!--
-->{{#vardefine:ni:auto_defense_m_hm|{{#dplvar:_npc_infobox:info:defense_m_hm}}}}<!--
+
-->{{#vardefine:ni:auto_defense_m_hm|{{#dplvar:ni:info:defense_m_hm}}}}<!--
-->{{#vardefine:ni:auto_defense_m_pp|{{#dplvar:_npc_infobox:info:defense_m_pp}}}}<!--
+
-->{{#vardefine:ni:auto_defense_m_pp|{{#dplvar:ni:info:defense_m_pp}}}}<!--
  +
--------
   
knockback
+
---- knockback ----
 
-->{{#vardefine:ni:knockback1|{{{knockback|}}}}}<!--
 
-->{{#vardefine:ni:knockback1|{{{knockback|}}}}}<!--
 
-->{{#vardefine:ni:knockback2|{{{knockback2|}}}}}<!--
 
-->{{#vardefine:ni:knockback2|{{{knockback2|}}}}}<!--
-->{{#vardefine:ni:auto_knockback|{{npc infobox/knockback|{{#dplvar:_npc_infobox:info:knockBackResist}}}}}}<!--
+
-->{{#vardefine:ni:auto_knockback|{{npc infobox/knockback|{{#dplvar:ni:info:knockBackResist}}}}}}<!--
-->{{#vardefine:ni:auto_knockback_e|{{npc infobox/knockback|{{#dplvar:_npc_infobox:info:knockBackResist_e}}}}}}<!--
+
-->{{#vardefine:ni:auto_knockback_e|{{npc infobox/knockback|{{#dplvar:ni:info:knockBackResist_e}}}}}}<!--
-->{{#vardefine:ni:auto_knockback_e_hm|{{npc infobox/knockback|{{#dplvar:_npc_infobox:info:knockBackResist_e_hm}}}}}}<!--
+
-->{{#vardefine:ni:auto_knockback_e_hm|{{npc infobox/knockback|{{#dplvar:ni:info:knockBackResist_e_hm}}}}}}<!--
-->{{#vardefine:ni:auto_knockback_e_pp|{{npc infobox/knockback|{{#dplvar:_npc_infobox:info:knockBackResist_e_pp}}}}}}<!--
+
-->{{#vardefine:ni:auto_knockback_e_pp|{{npc infobox/knockback|{{#dplvar:ni:info:knockBackResist_e_pp}}}}}}<!--
-->{{#vardefine:ni:auto_knockback_m|{{npc infobox/knockback|{{#dplvar:_npc_infobox:info:knockBackResist_m}}}}}}<!--
+
-->{{#vardefine:ni:auto_knockback_m|{{npc infobox/knockback|{{#dplvar:ni:info:knockBackResist_m}}}}}}<!--
-->{{#vardefine:ni:auto_knockback_m_hm|{{npc infobox/knockback|{{#dplvar:_npc_infobox:info:knockBackResist_m_hm}}}}}}<!--
+
-->{{#vardefine:ni:auto_knockback_m_hm|{{npc infobox/knockback|{{#dplvar:ni:info:knockBackResist_m_hm}}}}}}<!--
-->{{#vardefine:ni:auto_knockback_m_pp|{{npc infobox/knockback|{{#dplvar:_npc_infobox:info:knockBackResist_m_pp}}}}}}<!--
+
-->{{#vardefine:ni:auto_knockback_m_pp|{{npc infobox/knockback|{{#dplvar:ni:info:knockBackResist_m_pp}}}}}}<!--
-->{{#vardefine:ni:knockback|{{{knockback|{{#if:{{#dplvar:_npc_infobox:info:knockBackResist}}|<!--
+
-->{{#vardefine:ni:knockback|{{{knockback|{{#if:{{#dplvar:ni:info:knockBackResist}}|<!--
-->{{#invoke:npcstat|format|lang={{lang}}|hardmodeonly={{{hardmode|}}}|expertonly={{{expertonly|}}}<!--
+
-->{{#invoke:Npcstat|format|lang={{lang|}}|hardmodeonly={{#var:ni:hardmodeonly}}|expertonly={{#var:ni:expertonly}}<!--
 
-->|{{#var:ni:auto_knockback}}<!--
 
-->|{{#var:ni:auto_knockback}}<!--
-->|{{#var:ni:auto_knockback_e}}<!--
+
-->|{{#var:ni:auto_knockback_e}}|{{#var:ni:auto_knockback_e_hm}}|{{#var:ni:auto_knockback_e_pp}}<!--
-->|{{#var:ni:auto_knockback_e_hm}}<!--
+
-->|{{#var:ni:auto_knockback_m}}|{{#var:ni:auto_knockback_m_hm}}|{{#var:ni:auto_knockback_m_pp}}<!--
-->|{{#var:ni:auto_knockback_e_pp}}<!--
 
-->|{{#var:ni:auto_knockback_m}}<!--
 
-->|{{#var:ni:auto_knockback_m_hm}}<!--
 
-->|{{#var:ni:auto_knockback_m_pp}}<!--
 
 
-->}}<!--
 
-->}}<!--
 
-->}}}}}{{{knockback2|}}}}}<!--
 
-->}}}}}{{{knockback2|}}}}}<!--
  +
--------
buff info
 
-->{{#vardefine:ni:buffid|{{#if:{{{buffid|{{{buff|}}}}}}|<!--
 
-->{{{buffid|<!--
 
-->{{#if:{{#dplreplace:{{trim|{{{buff|}}}}}|/^[0-9]+$/|}}|<!--
 
-->{{buffIdFromName|{{{buff|}}}}}<!--
 
-->|<!--
 
-->{{{buff|}}}<!--
 
-->}}<!--
 
-->}}}<!--
 
-->}}}}<!--
 
-->{{#if:{{#var:ni:buffid}}|<!--
 
-->{{#vardefine:ni:buffduration|{{{buffduration|}}}}}<!--
 
-->{{#vardefine:ni:bufftip|{{{bufftip|{{tr|{{getBuffInfo|{{#var:ni:buffid}}|tooltip}}}}}}}}}<!--
 
-->}}<!--
 
   
  +
---- immunities ----
debuff info:
 
-->{{#vardefine:ni:debuffid|{{#if:{{{debuff|}}}|<!--
 
-->{{#if:{{#dplreplace:{{trim|{{{debuff|}}}}}|/^[0-9]+$/|}}|<!--
 
-->{{buffIdFromName|{{{debuff|}}}}}<!--
 
-->|<!--
 
-->{{{debuff|}}}<!--
 
-->}}<!--
 
-->}}}}<!--
 
-->{{#if:{{#var:ni:debuffid}}|<!--
 
-->{{#vardefine:ni:debuffchance|{{#if:{{{debuffchance|}}}|<!--
 
// this part is a relict of the old npc infobox, it is only kept for backwards compatibility
 
-->{{#ifeq:{{#sub:{{{debuffchance|}}}|-2}}|##|<!--
 
-->{{#sub:{{{debuffchance|}}}|0|-2}}<!-- if end with ## then use it as-is
 
-->|<!--
 
-->{{{debuffchance|}}}<!-- else use it as-is
 
-->}}<!--
 
-->}}}}<!--
 
-->{{#vardefine:ni:debuffchancenote|{{{debuffchancenote|}}}}}<!--
 
-->{{#vardefine:ni:debuffduration|{{{duration|{{{debuffduration|}}}}}}}}<!--
 
-->{{#vardefine:ni:debufftip|{{{debufftip|{{tr|{{getBuffInfo|{{#var:ni:debuffid}}|tooltip}}}}}}}}}<!--
 
-->{{#vardefine:ni:debuffmode|{{{debuffmode|}}}}}<!--
 
-->}}<!-- END debuff
 
-->{{#vardefine:ni:debuffid2|{{#if:{{{debuff2|}}}|<!--
 
-->{{#if:{{#dplreplace:{{trim|{{{debuff2|}}}}}|/^[0-9]+$/|}}|<!--
 
-->{{buffIdFromName|{{{debuff2|}}}}}<!--
 
-->|<!--
 
-->{{{debuff2|}}}<!--
 
-->}}<!--
 
-->}}}}<!--
 
-->{{#if:{{#var:ni:debuffid2}}|<!--
 
-->{{#vardefine:ni:debuffchance2|{{#if:{{{debuffchance2|}}}|<!--
 
// this part is a relict of the old npc infobox, it is only kept for backwards compatibility
 
-->{{#ifeq:{{#sub:{{{debuffchance2|}}}|-2}}|##|<!--
 
-->{{#sub:{{{debuffchance2|}}}|0|-2}}<!-- if end with ## then use it as-is
 
-->|<!--
 
-->{{{debuffchance2|}}}<!-- else use it as-is
 
-->}}<!--
 
-->}}}}<!--
 
-->{{#vardefine:ni:debuffchancenote2|{{{debuffchancenote2|}}}}}<!--
 
-->{{#vardefine:ni:debuffduration2|{{{duration2|{{{debuffduration2|}}}}}}}}<!--
 
-->{{#vardefine:ni:debufftip2|{{{debufftip2|{{tr|{{getBuffInfo|{{#var:ni:debuffid2}}|tooltip}}}}}}}}}<!--
 
-->{{#vardefine:ni:debuffmode2|{{{debuffmode2|}}}}}<!--
 
-->}}<!-- END debuff2
 
 
Immune
 
 
-->{{#vardefine:ni:immunities|}}<!--
 
-->{{#vardefine:ni:immunities|}}<!--
-->{{#vardefine:ni:immuneallnote|{{{immuneallnote|}}}}}<!--
+
-->{{#vardefine:ni:immunenote|{{{immuneallnote|{{{immunenote|}}}}}}}}<!--
 
-->{{#vardefine:ni:cargo:immunities|}}<!--
 
-->{{#vardefine:ni:cargo:immunities|}}<!--
-->{{#if:{{#dplvar:_npc_infobox:info:friendly}}||<!--
+
-->{{#vardefine:_ignore_immunities|{{#dplvar:ni:info:friendly}}{{#lstfltr:projectile/invincible/critter/gold Critter|/|{{lc:{{#var:ni:types}}}}|/}}}}<!--
  +
-->{{#if:{{#var:_ignore_immunities}}||<!--
-->{{#arraydefine:skip_types|Projectile/Invincible/Critter|/}}<!-- skip types: Projectile|Invincible|Critter
 
-->{{#if:{{#arraysearch:skip_types|{{{type|}}}|0|y|}}||<!-- if not skip type
+
-->{{#if:{{bool|{{{immuneall|{{#dplvar:ni:info:buffImmuneAll}}}}}}}|<!-- immune to all debuffs
-->{{#if:{{{immuneall|{{#dplvar:_npc_infobox:info:buffImmuneAll}}}}}|<!--
+
-->{{#vardefine:ni:immunities|ALL}}<!--
-->{{#vardefine:ni:immunities|ALL}}<!--
+
-->{{#vardefine:ni:cargo:immunities|ALL}}<!--
  +
-->|{{#if:{{bool|{{{immuneallnotwhips|{{#dplvar:ni:info:buffImmuneAllNotWhips}}}}}}}|<!-- immune to all debuffs but not whip debuffs
-->{{#vardefine:ni:cargo:immunities|ALL}}<!--
 
-->|<!--
+
-->{{#vardefine:ni:immunities|NOTWHIPS}}<!--
  +
-->{{#vardefine:ni:cargo:immunities|NOTWHIPS}}<!--
-->{{#if:{{#dplvar:_npc_infobox:info:buffImmune}}{{{immune1|}}}{{{immune2|}}}{{{immune3|}}}{{{immune4|}}}{{{immune5|}}}{{{immune6|}}}{{{immune7|}}}{{{immune8|}}}{{{immune9|}}}{{{immune10|}}}|<!--
 
  +
-->|<!-- only immune to certain debuffs, or none at all
-->{{#arraydefine:__buffs|{{#dplvar:_npc_infobox:info:buffImmune}},{{buffIdFromName|{{{immune1|}}}}},{{buffIdFromName|{{{immune2|}}}}},{{buffIdFromName|{{{immune3|}}}}},{{buffIdFromName|{{{immune4|}}}}},{{buffIdFromName|{{{immune5|}}}}},{{buffIdFromName|{{{immune6|}}}}},{{buffIdFromName|{{{immune7|}}}}},{{buffIdFromName|{{{immune8|}}}}},{{buffIdFromName|{{{immune9|}}}}},{{buffIdFromName|{{{immune10|}}}}}|,|unique}}<!-- //"unique" will also drop empty values.
 
-->{{#vardefine:ni:immunities|{{#arrayprint:__buffs|,}}}}<!-- concat with ","
+
-->{{#vardefine:ni:immunities_input|{{#forargs:immune|paramkey|paramvalue|/<!-- iterate over all parameters starting with "immune"
  +
-->{{#if:{{#var:paramkey}}|<!--
-->{{#vardefine:ni:cargo:immunities|{{#arrayprint:__buffs|^|@@@@|{{getBuffInfo|@@@@|name}}}}}}<!--
 
  +
-->{{#if:{{isNumber|{{#var:paramkey}}}}|{{#var:paramvalue}}}}<!-- if the paramkey is a number, then we take its value (e.g. $immune2)
-->}}<!--
 
-->}}<!--
+
-->|<!--
  +
-->{{#var:paramvalue}}<!-- if the paramkey doesn't exist, then the parameter is $immune, so we take its value
-->}}<!--
 
  +
-->}}<!--
  +
-->}}}}<!--
  +
-->{{#if:{{#dplvar:ni:info:buffImmune}}{{#var:ni:immunities_input}}|<!-- if there are auto or manual immunities
  +
// convert manual immunities to buff IDs (auto immunities are already IDs)
  +
-->{{#vardefine:ni:immunities_input|{{#lstmap:{{#var:ni:immunities_input}}|/|@@@@|<esc>{{buffIdFromName|@@@@}}</esc>|,}}}}<!--
  +
// list of buff IDs for the views, separator ","
  +
-->{{#vardefine:ni:immunities|{{#lstuniq:{{#dplvar:ni:info:buffImmune}},{{#var:ni:immunities_input}}|,|,}}}}<!--
  +
// list of buff names for cargo, separator "^"
  +
-->{{#vardefine:ni:cargo:immunities|{{#lstmap:{{#var:ni:immunities}}|,|@@@@|<esc>{{getBuffInfo|@@@@|name}}</esc>|^}}}}<!--
  +
-->}}<!--
  +
-->}}}}<!--
 
-->}}<!--
 
-->}}<!--
  +
--------
   
banner
+
---- banner ----
-->{{#vardefine:ni:banner|}}<!-- banner name.
+
-->{{#vardefine:ni:banner|}}<!-- banner item name
-->{{#vardefine:__banner_id|}}<!-- banner id for cargo.
+
-->{{#vardefine:__banner_id|}}<!-- banner item id for cargo
  +
-->{{#if:{{{banner|}}}|<!--
 
  +
// $banner can either be "y"/"yes"/... or the name of the banner
-->{{#if: {{{banner|}}}|<!--
 
-->{{#vardefine:__banner_name|{{#ifeq:{{{banner|}}}|yes|{{{bannername|}}}|{{{banner|}}}}}}}<!--
+
-->{{#vardefine:__banner_name|<!--
  +
-->{{#if:{{bool|{{{banner|}}}}}|{{{bannername|}}}|{{{banner|}}}}}<!--
  +
-->}}<!--
 
-->{{#vardefine:ni:banner|{{#var:__banner_name|{{#var:ni:name}} Banner}}}}<!--
 
-->{{#vardefine:ni:banner|{{#var:__banner_name|{{#var:ni:name}} Banner}}}}<!--
 
-->|<!--
 
-->|<!--
 
-->{{#if:{{{auto|}}}|<!--
 
-->{{#if:{{{auto|}}}|<!--
-->{{#if:{{#vardefineecho:__banner_id|{{#dplvar:_npc_infobox:info:banner}}}}|<!--
+
-->{{#if:{{#vardefineecho:__banner_id|{{#dplvar:ni:info:banner}}}}|<!--
 
-->{{#vardefine:ni:banner|{{ItemNameFromId|lang=en|{{#var:__banner_id}}}}}}<!--
 
-->{{#vardefine:ni:banner|{{ItemNameFromId|lang=en|{{#var:__banner_id}}}}}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->}}<!--
  +
--------
   
money
+
---- money ----
-->{{#ifeq:{{#dplvar:_npc_infobox:info:value}}|0|<!--
+
-->{{#ifeq:{{#dplvar:ni:info:value}}|0|<!--
 
-->{{#vardefine:ni:auto_money_value|}}<!--
 
-->{{#vardefine:ni:auto_money_value|}}<!--
 
-->{{#vardefine:ni:auto_money_value_e|}}<!--
 
-->{{#vardefine:ni:auto_money_value_e|}}<!--
Ligne 365 : Ligne 282 :
 
-->{{#vardefine:ni:auto_money_value_m_pp|}}<!--
 
-->{{#vardefine:ni:auto_money_value_m_pp|}}<!--
 
-->|<!--
 
-->|<!--
-->{{#vardefine:ni:auto_money_value|{{#dplvar:_npc_infobox:info:value}}}}<!--
+
-->{{#vardefine:ni:auto_money_value|{{#dplvar:ni:info:value}}}}<!--
-->{{#vardefine:ni:auto_money_value_e|{{#dplvar:_npc_infobox:info:value_e}}}}<!--
+
-->{{#vardefine:ni:auto_money_value_e|{{#dplvar:ni:info:value_e}}}}<!--
-->{{#vardefine:ni:auto_money_value_e_hm|{{#dplvar:_npc_infobox:info:value_e_hm}}}}<!--
+
-->{{#vardefine:ni:auto_money_value_e_hm|{{#dplvar:ni:info:value_e_hm}}}}<!--
-->{{#vardefine:ni:auto_money_value_e_pp|{{#dplvar:_npc_infobox:info:value_e_pp}}}}<!--
+
-->{{#vardefine:ni:auto_money_value_e_pp|{{#dplvar:ni:info:value_e_pp}}}}<!--
-->{{#vardefine:ni:auto_money_value_m|{{#dplvar:_npc_infobox:info:value_m}}}}<!--
+
-->{{#vardefine:ni:auto_money_value_m|{{#dplvar:ni:info:value_m}}}}<!--
-->{{#vardefine:ni:auto_money_value_m_hm|{{#dplvar:_npc_infobox:info:value_m_hm}}}}<!--
+
-->{{#vardefine:ni:auto_money_value_m_hm|{{#dplvar:ni:info:value_m_hm}}}}<!--
-->{{#vardefine:ni:auto_money_value_m_pp|{{#dplvar:_npc_infobox:info:value_m_pp}}}}<!--
+
-->{{#vardefine:ni:auto_money_value_m_pp|{{#dplvar:ni:info:value_m_pp}}}}<!--
 
-->}}<!--
 
-->}}<!--
-->{{#vardefine:ni:money|{{{money|{{#if:{{#var:ni:auto_money_value|}}|<span class="money">{{#uesc:{{#invoke:npcstat|format|lang={{lang}}|hardmodeonly={{{hardmode|}}}|expertonly={{{expertonly|}}}|prefix=y<!--
+
-->{{#vardefine:ni:money|{{{money|{{#if:{{#var:ni:auto_money_value|}}|<span class="money">{{#uesc:<!--
  +
-->{{#invoke:Npcstat|format|prefix=y|lang={{lang|}}|hardmodeonly={{#var:ni:hardmodeonly}}|expertonly={{#var:ni:expertonly}}<!--
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value|}}<esc>}}</esc><!--
 
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_e|}}<esc>}}</esc><!--
+
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value|}}<esc>}}</esc><!--
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_e_hm|}}<esc>}}</esc><!--
+
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_e|}}<esc>}}</esc><!--
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_e_pp|}}<esc>}}</esc><!--
+
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_e_hm|}}<esc>}}</esc><!--
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_m|}}<esc>}}</esc><!--
+
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_e_pp|}}<esc>}}</esc><!--
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_m_hm|}}<esc>}}</esc><!--
+
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_m|}}<esc>}}</esc><!--
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_m_pp|}}<esc>}}</esc><!--
+
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_m_hm|}}<esc>}}</esc><!--
  +
-->|<esc>{{coin|</esc>{{#var:ni:auto_money_value_m_pp|}}<esc>}}</esc><!--
-->}}}}</span>}}}}}}}<!--
 
  +
-->}}<!--
  +
-->}}</span>}}}}}}}<!--
 
-->{{#vardefine:ni:money1|{{{money1|}}}}}<!--
 
-->{{#vardefine:ni:money1|{{{money1|}}}}}<!--
 
-->{{#vardefine:ni:money2|{{{money2|}}}}}<!--
 
-->{{#vardefine:ni:money2|{{{money2|}}}}}<!--
 
-->{{#vardefine:ni:cargo:money|{{#var:ni:money|}}{{#var:ni:money2}}}}<!--
 
-->{{#vardefine:ni:cargo:money|{{#var:ni:money|}}{{#var:ni:money2}}}}<!--
  +
--------
   
  +
---- sounds ----
drops:
 
-->{{#vardefine:ni:drops|<!--
 
-->{{item/options|smallicons=y}}{{eicons/options|small=y}}{{#vardefine:dropclass|}}<!--
 
-->{{#dplvar:set<!--
 
-->|_npc_infobox:group|0<!--
 
//every 3 unnamed arguments form a group.
 
-->|_npc_infobox:group_arg_1|<!--
 
-->|_npc_infobox:group_arg_2|<!--
 
-->}}<!--
 
-->{{#fornumargs:i|v|<!--
 
-->{{#ifexpr:{{#vardefineecho:_mod|{{#expr:{{#var:i}} mod 3}}}}|<!--
 
-->{{#dplvar:set|_npc_infobox:group_arg_{{#var:_mod}}|{{#var:v}}}}<!--
 
-->|<!--
 
-->{{npc infobox/drop|{{#dplvar:_npc_infobox:group_arg_1}}|{{#dplvar:_npc_infobox:group_arg_2}}|{{#var:v}}}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->{{item/options|reset}}{{eicons/options|reset}}<!--
 
-->}}<!--
 
 
imageother:
 
-->{{#vardefine:ni:imageother|{{{imageother|}}}}}<!--
 
-->{{#vardefine:ni:imageothercaption|{{#ifeq:{{{imageothercaption|}}}|Map Icon|{{l10n|npc_infobox|map_icon}}|{{tr|{{{imageothercaption|}}}}}}}}}<!--
 
 
sounds:
 
 
-->{{#arraydefine:ni:sounds|<!--
 
-->{{#arraydefine:ni:sounds|<!--
-->{{#if:{{{soundhurt|{{#dplvar:_npc_infobox:info:HitSound}}}}}|<!--
+
-->{{#if:{{{soundhurt|{{#dplvar:ni:info:HitSound}}}}}|<!--
-->{{l10n|npc_infobox|th_hurt}}@@{{{soundhurt|<!--
+
-->normal@@{{l10n|npc_infobox|th_hurt}}@@{{{soundhurt|<!--
-->{{#lstmap:{{#dplvar:_npc_infobox:info:HitSound}}|,|$$$|$$$.wav|,}}<!--
+
-->{{#lstmap:{{#dplvar:ni:info:HitSound}}|,|$$$|$$$.wav|,}}<!--
 
-->}}}<!--
 
-->}}}<!--
 
-->}}<!--
 
-->}}<!--
-->{{#if:{{{soundkilled|{{#dplvar:_npc_infobox:info:DeathSound}}}}}|<!--
+
-->{{#if:{{{soundkilled|{{#dplvar:ni:info:DeathSound}}}}}|<!--
-->@@@@{{l10n|npc_infobox|th_killed}}@@{{{soundkilled|<!--
+
-->@@@@normal@@{{l10n|npc_infobox|th_killed}}@@{{{soundkilled|<!--
-->{{#lstmap:{{#dplvar:_npc_infobox:info:DeathSound}}|,|$$$|$$$.wav|,}}<!--
+
-->{{#lstmap:{{#dplvar:ni:info:DeathSound}}|,|$$$|$$$.wav|,}}<!--
 
-->}}}<!--
 
-->}}}<!--
 
-->}}<!--
 
-->}}<!--
  +
// l10n for very common and standard soundcaptions:
  +
-->{{#vardefine:_soundcaption_Idle|{{l10n|npc_infobox|th_idle}}}}<!--
  +
-->{{#vardefine:_soundcaption_Attack|{{l10n|npc_infobox|th_attack}}}}<!--
  +
-->{{#vardefine:_soundcaption_Teleport|{{l10n|npc_infobox|th_teleport}}}}<!--
 
-->{{#forargs:sound|k|v|<!--
 
-->{{#forargs:sound|k|v|<!--
  +
"@@" is the delimiter between mode, caption, and sound(s); "@@@@" the delimiter between array elements
 
-->{{#if:{{{soundcaption{{#var:k}}|}}}|<!--
 
-->{{#if:{{{soundcaption{{#var:k}}|}}}|<!--
-->@@@@{{{soundcaption{{#var:k}}|}}}@@{{#var:v}}<!-- "@@" is the delimiter between caption and sound; "@@@@" the delimiter between array elements
+
-->@@@@{{{soundmode{{#var:k}}|normal}}}<!--
  +
-->@@{{#var:_soundcaption_{{{soundcaption{{#var:k}}|}}}|{{{soundcaption{{#var:k}}|}}}}}<!--
  +
-->@@{{#var:v}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->}}<!--
 
-->}}<!--
Ligne 429 : Ligne 333 :
 
-->}}<!--
 
-->}}<!--
 
-->{{#arrayunique:ni:sounds}}<!-- removing empty and duplicate elements
 
-->{{#arrayunique:ni:sounds}}<!-- removing empty and duplicate elements
  +
--------
===== DATA END ======
 
   
===== CATE & CARGO ======
 
   
  +
+++++++++++++ 5. Process additional parameter input, unrelated to auto data +++++++++++++
-->{{#vardefine:cate|{{#switch:{{{cate|}}}<!--
 
  +
-->|yes|force=y<!--
 
  +
---- images ----
-->|no=<!--nothing
 
  +
// all images: default auto main image filename is in {{#var:ni:imagename}}
-->|#default={{#ifeq:{{NAMESPACE}}|{{ns:0}}|<!-- only in main ns
 
  +
// image 1
-->{{#switch:{{#var:ni:viewmodename}}|infobox|table=y}}<!-- only cate for infobox/table view, no cate for void/item view
 
  +
-->{{#vardefine:ni:image1|{{{imagealt|<!--
  +
-->{{image|{{{image|{{#var:ni:imagename}}.png}}}|link=|size={{{imagesize|}}}}}<!--
  +
-->}}}}}<!--
  +
-->{{#if:{{#var:ni:image1}}||<!--
  +
// if there is no #var:ni:image1, then {{image}} failed, so use [[File:]] syntax as fallback
  +
-->{{#vardefine:ni:image1|[[File:{{{image|{{#var:ni:imagename}}.png}}}|link=]]}}<!--
  +
-->}}<!--
  +
-->{{#vardefine:ni:image1text|}}<!--
  +
// image expert
  +
-->{{#vardefine:imageexpert|{{{imageexpert|}}}}}<!--
  +
// init images 2 and 3
  +
-->{{#vardefine:ni:image2|{{{image2|}}}}}<!--
  +
-->{{#vardefine:ni:image2text|}}<!--
  +
-->{{#vardefine:ni:image3|{{{image3|}}}}}<!--
  +
-->{{#vardefine:ni:image3text|}}<!--
  +
// try to auto discover: _(old).png, _(old).gif if needed, but only in full mode
  +
-->{{#ifeq:{{#var:imagemode}}|full|{{#ifeq:{{{image2|-unset}}}|{{{image2|unset-}}}||<!-- if $image2 is not set (excluding "|image2=<blank>")
  +
-->{{#vardefine:_ni:imagenameold|<!-- set the name of the old image
  +
-->{{#if:{{{image|}}}|<!--
  +
// remove the file extension, i.e. everything after the last period
  +
// #rpos returns -1 if no period is found, so the length parameter for #sub should be 0 in that case
  +
// (which causes the string to remain unchanged)
  +
-->{{#sub:{{{image|}}}||{{max|{{#rpos:{{{image|}}}|.}}|0}}}}<!--
  +
-->|<!--
  +
-->{{#var:ni:imagename}}<!--
  +
-->}}<!--
  +
-->_(old)<!--
  +
-->}}<!--
  +
-->{{#vardefine:ni:image2|<!--
  +
// check .png
  +
-->{{#ifexist:Media:{{#var:_ni:imagenameold}}.png|<!--
  +
-->{{#var:_ni:imagenameold}}.png<!--
  +
-->|<!--
  +
// if .png not found, check .gif
  +
-->{{#ifexist:Media:{{#var:_ni:imagenameold}}.gif|{{#var:_ni:imagenameold}}.gif}}<!--
 
-->}}<!--
 
-->}}<!--
-->}}}}<!--
+
-->}}<!--
-->{{#if:{{#var:cate}}|<!--
+
-->}}}}<!--
  +
// init all variables
-->{{#if:{{{allversions|}}}|{{#if:{{#var:ni:cateset:allversion}}||<!--
 
  +
-->{{#dplvar:set<!--
-->{{#vardefine:ni:cateset:allversion|y}}{{all versions}}<!--
 
  +
-->|d|t1|c|t1|o|t1|m|t1|3|t1<!-- set all versions to "t1"
  +
-->|t1||t2||t3|<!-- set all tooltips to empty string
  +
-->}}<!--
  +
// versions for image2
  +
-->{{#if:{{#var:ni:image2}}|<!--
  +
// $imageversion2 examples: "old,Console,Console-Mobile", any "platform-platform-platform"
  +
-->{{#if:{{{imageversion2|}}}|<!--
  +
-->{{#dplvar:set|imageversion|{{lc:{{{imageversion2}}}}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|desktop}}|{{#dplvar:set|d|t2}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|console}}|{{#dplvar:set|c|t2}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|old-gen}}|{{#dplvar:set|o|t2}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|mobile}}|{{#dplvar:set|m|t2}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|3ds}}|{{#dplvar:set|3|t2}}}}<!--
  +
-->|<!--
  +
-->{{#dplvar:set|o|t2|3|t2}}<!-- no $imageversion2 specified, default to old versions
  +
-->}}<!--
  +
-->}}<!--
  +
// versions for image3
  +
-->{{#if:{{#var:ni:image3}}|<!--
  +
// $imageversion3 examples: "old,Console,Console-Mobile", any "platform-platform-platform"
  +
-->{{#if:{{{imageversion3|}}}|<!--
  +
-->{{#dplvar:set|imageversion|{{lc:{{{imageversion3|}}}}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|desktop}}|{{#dplvar:set|d|t3}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|console}}|{{#dplvar:set|c|t3}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|old-gen}}|{{#dplvar:set|o|t3}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|mobile}}|{{#dplvar:set|m|t3}}}}<!--
  +
-->{{#if:{{#pos:{{#dplvar:imageversion}}|3ds}}|{{#dplvar:set|3|t3}}}}<!--
  +
-->}}<!--
  +
-->}}<!--
  +
// image hovertexts (tooltips)
  +
-->{{#if:{{#var:ni:image2}}{{#var:ni:image3}}|<!--
  +
// each version's dplvar now has an associated tooltip, so we now need to gather the versions of each tooltip
  +
// example situation to demonstrate the following part: #dplvar:d="t1", #dplvar:c="t2", #dplvar:o="t2", #dplvar:m="t1", #dplvar:3="t2"
  +
-->{{#dplvar:set|{{#dplvar:d}}|{{#dplvar:{{#dplvar:d}}}}/desktop}}<!-- e.g.: #dplvar:t1 := #dplvar:t1 + "/desktop" -> "/desktop"
  +
-->{{#dplvar:set|{{#dplvar:c}}|{{#dplvar:{{#dplvar:c}}}}/console}}<!-- e.g.: #dplvar:t2 := #dplvar:t2 + "/console" -> "/console"
  +
-->{{#dplvar:set|{{#dplvar:o}}|{{#dplvar:{{#dplvar:o}}}}/old-gen}}<!-- e.g.: #dplvar:t2 := #dplvar:t2 + "/old-gen" -> "/console/old-gen"
  +
-->{{#dplvar:set|{{#dplvar:m}}|{{#dplvar:{{#dplvar:m}}}}/mobile}}<!-- e.g.: #dplvar:t1 := #dplvar:t1 + "/mobile" -> "/desktop/mobile"
  +
-->{{#dplvar:set|{{#dplvar:3}}|{{#dplvar:{{#dplvar:3}}}}/3ds}}<!-- e.g.: #dplvar:t2 := #dplvar:t2 + "/3ds" -> "/console/old-gen/3ds"
  +
// now each tooltip's dplvar has a defined set of versions which can easily be fed into {{versions}}
  +
-->{{#if:{{#dplvar:t1}}|{{#vardefine:ni:image1text|{{versions|{{#dplvar:t1}}|mode=text|nl=yes}}}}}}<!--
  +
-->{{#if:{{#dplvar:t2}}|{{#vardefine:ni:image2text|{{versions|{{#dplvar:t2}}|mode=text|nl=yes}}}}}}<!--
  +
-->{{#if:{{#dplvar:t3}}|{{#vardefine:ni:image3text|{{versions|{{#dplvar:t3}}|mode=text|nl=yes}}}}}}<!--
  +
-->}}<!--
  +
// image other
  +
-->{{#vardefine:ni:imageother|{{{imageother|}}}}}<!--
  +
// l10n for very common and standard imageothercaptions:
  +
-->{{#vardefine:_imageothercaption_map icon|{{l10n|npc_infobox|map_icon}}}}<!--
  +
-->{{#vardefine:ni:imageothercaption|{{#var:_imageothercaption_{{lc:{{{imageothercaption|}}}}}|{{{imageothercaption|}}}}}}}<!--
  +
--------
  +
  +
---- buffs and debuffs ----
  +
-->{{#vardefine:ni:buffs|}}<!--
  +
-->{{#vardefine:ni:debuffs|}}<!--
  +
  +
// loop: {{#var:bufftype}} is "buff" during first iteration and "debuff" during second iteration
  +
// (buff and debuff handling is identical, only the names are different)
  +
-->{{#loop:_i|0|2|{{#vardefine:bufftype|{{#ifexpr:{{#var:_i}}|de}}buff}}<!--
  +
// we have an ni:buffs and an ni:debuffs array ("ni:{{#var:bufftype}}s"), which hold the indices of all $de-/buff parameters
  +
// the unindexed "|buff=" / "|debuff=" parameters are represented by "-1", which is always the first element of these arrays, if those parameters are set
  +
-->{{#if:{{{ {{#var:bufftype}}|}}}|{{#vardefine:ni:{{#var:bufftype}}s|-1}}}}<!-- set first array element to -1
  +
-->{{#forargs:{{#var:bufftype}}|k|_|{{#if:{{isNumber|onlypositive=y|{{#var:k}}}}|<!-- for all parameters: if parameter name is "{de-/buff}<integer>"
  +
-->{{#vardefine:ni:{{#var:bufftype}}s|{{#lstapp:{{#var:ni:{{#var:bufftype}}s}}|₪|{{#var:k}}}}}}<!-- then add buff index to de-/buffs array
 
-->}}}}<!--
 
-->}}}}<!--
-->{{#if:{{#var:ni:environment}}|<!--
+
-->{{#vardefine:ni:{{#var:bufftype}}s|{{#lstsrt:{{#var:ni:{{#var:bufftype}}s}}|₪|₪|numeric}}}}<!-- sort parameter indices
  +
-->{{#loop:i|1|{{#lstcnt:{{#var:ni:{{#var:bufftype}}s}}|₪}}|<!-- iterate over parameter indices
-->{{#uesc:<!--
 
-->{{#lstmap:{{#var:ni:environment}}|/|$$$|<esc><!--
+
-->{{#vardefine:j|{{#lstelem:{{#var:ni:{{#var:bufftype}}s}}||{{#var:i}}}}}}<!-- j is the parameter index
  +
-->{{#vardefine:k|{{#ifeq:{{#var:j}}|-1||{{#var:j}}}}}}<!-- k=j, unless j==-1, in which case k=(empty), since we use "${de-/buff}" instead of "${de-/buff}-1"
-->{{#lstmap:$$$|+|@@@@|{\{#if:{\{#var:ni:cateset:env:@@@@}\}\!\!{\{#vardefine:ni:cateset:env:@@@@\!y}\}{\{l10n\!npc_infobox\!cate_environment\!$env$=@@@@}\}\}\}|<!--no sep-->}}<!--
 
  +
// we store the information that the view needs in variables with a "ni:<bufftype><parameter index>:<stat>" format
--></esc>|<!--no sep-->}}<!--
 
  +
-->{{#vardefine:data_for_buffinfo_array|{{{ {{#var:bufftype}}{{#var:k}}|}}}}}<!--
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:mode|{{lc:{{#sub:{{#var:data_for_buffinfo_array}}|-7}}}}}}<!--
  +
-->{{#switch:{{#var:ni:{{#var:bufftype}}{{#var:j}}:mode}}<!--
  +
-->|#normal|#expert|#master|@normal|@expert|@master=<!--
  +
// if the last 7 characters of the ${de-/buff} parameter are one of the valid mode identifiers,
  +
// then strip them from the data that will be used for the buffinfo array
  +
-->{{#vardefine:data_for_buffinfo_array|{{#sub:{{#var:data_for_buffinfo_array}}|0|-7}}}}<!--
  +
-->|#default=<!--
  +
// if they aren't, then they do not hold valid mode information, so the variable must be reset
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:mode|}}<!--
  +
// (and also don't strip them, but use the whole parameter value for the buffinfo array)
 
-->}}<!--
 
-->}}<!--
  +
-->{{#arraydefine:buffinfo|{{#var:data_for_buffinfo_array}}|/}}<!--
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:mobile|}}<!--
  +
// buff id
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:id|{{{id{{#var:bufftype}}{{#var:k}}|<!--
  +
-->{{buffIdFromName|{{#arrayindex:buffinfo|0}}}}<!-- buffinfo[0] will always contain the de-/buff name, regardless of whether compact mode was used or not
  +
-->}}}}}<!--
  +
-->{{#if:{{#var:ni:{{#var:bufftype}}{{#var:j}}:id}}|{{#ifeq:{{#sub:{{#var:ni:{{#var:bufftype}}{{#var:j}}:id}}|0|1}}|m|<!-- if is mobile id
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:id|{{#sub:{{#var:ni:{{#var:bufftype}}{{#var:j}}:id}}|1}}}}<!--
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:mobile|m}}<!--
  +
-->}}}}<!--
  +
// de-/buff name
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:name|<!--
  +
-->{{#if:{{#var:ni:{{#var:bufftype}}{{#var:j}}:id}}|<!--
  +
-->{{getBuffInfo|{{#var:ni:{{#var:bufftype}}{{#var:j}}:mobile}}{{#var:ni:{{#var:bufftype}}{{#var:j}}:id}}|ename}}<!--
  +
-->|<!--
  +
-->{{#arrayindex:buffinfo|0}}<!--
  +
-->}}<!--
  +
-->}}<!--
  +
// de-/buff duration and chance
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:duration|{{{ {{#var:bufftype}}duration{{#var:k}}|{{#arrayindex:buffinfo|1}}}}}}}<!--
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:chance|{{{ {{#var:bufftype}}chance{{#var:k}}|{{#arrayindex:buffinfo|2}}}}}}}<!--
  +
// de-/buff tooltip
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:tooltip|{{{ {{#var:bufftype}}tip{{#var:k}}|<!--
  +
-->{{getBuffInfo|{{#var:ni:{{#var:bufftype}}{{#var:j}}:mobile}}{{#var:ni:{{#var:bufftype}}{{#var:j}}:id}}|tooltip}}<!--
  +
-->}}}}}<!--
  +
// de-/buff link
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:link|{{{ {{#var:bufftype}}link{{#var:k}}|<!--
  +
-->{{getBuffInfo|{{#var:ni:{{#var:bufftype}}{{#var:j}}:mobile}}{{#var:ni:{{#var:bufftype}}{{#var:j}}:id}}|page}}<!--
  +
-->}}}}}<!--
  +
// de-/buff vanity id
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:idshow|{{{id{{#var:bufftype}}show{{#var:k}}|}}}}}<!--
  +
// de-/buff mode
  +
// normalization: the mode var contains the "#expert"/"@master"/... syntax from the ${de-/buff} parameter,
  +
// but the ${de-/buff}mode parameter contains the "expert"/"master"/"expertonly" syntax,
  +
// so we transform the latter to the former
  +
-->{{#vardefine:ni:{{#var:bufftype}}{{#var:j}}:mode|{{#switch:{{{ {{#var:bufftype}}mode{{#var:k}}|}}}<!--
  +
-->|expert=#expert|master=#master|expertonly=@expert<!--
  +
-->|#default={{{ {{#var:bufftype}}mode{{#var:k}}|{{#var:ni:{{#var:bufftype}}{{#var:j}}:mode}}}}}<!--
  +
-->}}}}<!--
  +
-->}}<!--
  +
-->}}<!--
  +
--------
  +
  +
---- drops ----
  +
-->{{#vardefine:ni:drops|<!--
  +
-->{{#vardefine:_item_small_snap|{{options|item|small}}}}{{options/set|item|small=y}}<!--
  +
-->{{#vardefine:_eicons_small_snap|{{options|eicons|small}}}}{{options/set|eicons|small=y}}<!--
  +
  +
-->{{#vardefine:dropclass|}}<!--
  +
-->{{#dplvar:set<!--
  +
-->|_npc_infobox:trsbg|<!--
  +
-->|_npc_infobox:group|0<!--
  +
-->|_npc_infobox:in_group|<!--
  +
// every 3 unnamed arguments form a group
  +
-->|_npc_infobox:group_arg_1|<!--
  +
-->|_npc_infobox:group_arg_2|<!--
  +
used in npc_infobox/drop, init
  +
-->|_npc_infobox:in_loot|<!--
  +
-->|_npc_infobox:loot_source|<!--
  +
-->}}<!--
  +
// used in npc_infobox/drop, defined here for better performance
  +
-->{{#vardefine:nidrop:nameraw|{{#var:ni:name}}}}<!--
  +
-->{{#vardefine:nidrop:name|<!--
  +
-->{{eil|{{ROOTPAGENAME}}|{{tr|{{#var:ni:name}}}}|epage={{#var:npcnamefrompagename}}}}<!--
  +
-->{{#if:{{#var:ni:namesub}}|{{note|block=y|paren=y|{{#var:ni:namesub}}}}}}<!--
  +
-->{{#if:{{#var:ni:namenote}}|{{note|block=y|paren=y|small=y|{{#var:ni:namenote}}}}}}<!--
 
-->}}<!--
 
-->}}<!--
  +
// iterate over all unnamed parameters
-->{{#if:{{#var:ni:type}}|{{#if:{{#var:ni:cateset:type:{{#var:ni:type}}}}||<!--
 
  +
-->{{#fornumargs:i|v|<!--
-->{{#vardefine:ni:cateset:type:{{#var:ni:type}}|y}}{{l10n|npc_infobox|cate_type|$type$={{#var:ni:type}}}}<!--
 
  +
-->{{#ifexpr:{{#vardefineecho:_mod|{{#expr:{{#var:i}} mod 3}}}}|<!--
-->}}}}<!--
 
-->{{#if:{{#var:ni:type2}}|{{#if:{{#var:ni:cateset:type:{{#var:ni:type2}}}}||<!--
+
-->{{#dplvar:set|_npc_infobox:group_arg_{{#var:_mod}}|{{#var:v}}}}<!--
  +
-->|<!-- every three unnamed parameters, go into {{npc infobox/drop}}
-->{{#vardefine:ni:cateset:type:{{#var:ni:type2}}|y}}{{l10n|npc_infobox|cate_type|$type$={{#var:ni:type2}}}}<!--
 
  +
-->{{npc infobox/drop<!-- the values of named parameters ($A instead of $1) will be auto trimmed, which is more convenient
-->}}}}<!--
 
  +
-->|A={{#dplvar:_npc_infobox:group_arg_1}}<!--
-->{{#if:{{#var:ni:type3}}|{{#if:{{#var:ni:cateset:type:{{#var:ni:type3}}}}||<!--
 
  +
-->|B={{#dplvar:_npc_infobox:group_arg_2}}<!--
-->{{#vardefine:ni:cateset:type:{{#var:ni:type3}}|y}}{{l10n|npc_infobox|cate_type|$type$={{#var:ni:type3}}}}<!--
 
  +
-->|C={{#var:v}}<!--
  +
-->}}<!--
  +
-->}}<!--
  +
-->}}<!--
  +
-->{{options/set|item|small={{#var:_item_small_snap}}}}<!--
  +
-->{{options/set|eicons|small={{#var:_eicons_small_snap}}}}<!--
  +
-->}}<!--
  +
--------
  +
  +
  +
+++++++++++++ 5. Categorize and store to cargo +++++++++++++
  +
  +
---- determine validity of categorization ----
  +
-->{{#vardefine:cate|}}<!--
  +
-->{{#switch:{{{cate|}}}<!--
  +
-->|1|y|yes|true|force={{#vardefine:cate|y}}<!--
  +
-->|0|n|no|false={{#vardefine:cate|}}<!--
  +
-->|#default=<!--
  +
-->{{#ifeq:{{NAMESPACE}}|{{ns:0}}|<!-- only in main ns
  +
-->{{#switch:{{#var:ni:viewmodename}}|infobox|table={{#vardefine:cate|y}}}}<!-- only cate for infobox/table view, no cate for void/item view
  +
-->}}<!--
  +
-->}}<!--
  +
--------
  +
  +
---- categorize ----
  +
// note: printing the same category more than once is unnecessarily expensive, so we cache a category in its "cateset" variable
  +
-->{{#if:{{#var:cate}}|<!--
  +
// allversions
  +
-->{{#if:{{#switch:{{lc:{{{allversions|}}}}}|y|yes|1|true=y|n|no|0|false=|#default=<!--
  +
-->{{#if:{{#var:ni:npcid}}|{{#if:{{eversions|{{#var:ni:name}}|raw=y}}|<!--not all versions-->|y}}}}<!-- auto detect: id exists and eversions is null
  +
-->}}|<!--
  +
-->{{#if:{{#var:ni:cateset:allversions}}||<!--
  +
-->{{#vardefine:ni:cateset:allversions|y}}<!--
  +
-->{{all versions}}<!--
  +
-->}}<!--
  +
-->}}<!--
  +
// environments
  +
-->{{#if:{{#var:ni:environment}}|{{#uesc:<!--
  +
-->{{#lstmap:{{#var:ni:environment}}|/|$$$|<esc><!--
  +
-->{{#lstmap:$$$|+|@@@@|<!--
  +
-->{\{#if:{\{#var:ni:cateset:env:@@@@}\}\!\!<!--
  +
-->{\{#vardefine:ni:cateset:env:@@@@\!y}\}<!--
  +
-->{\{l10n\!npc_infobox\!cate_environment\!$env$=@@@@}\}<!--
  +
-->\}\}<!--
  +
-->|<!--no sep-->}}<!--
  +
--></esc>|<!--no sep-->}}<!--
 
-->}}}}<!--
 
-->}}}}<!--
  +
// types
  +
-->{{#if:{{#var:ni:types}}|<!--
  +
-->{{#lstmap:{{#var:ni:types}}|/|@@@@|<esc><!--
  +
-->{{#if:{{#var:ni:cateset:type:@@@@}}||<!--
  +
-->{{#vardefine:ni:cateset:type:@@@@|y}}<!--
  +
-->{{l10n|npc_infobox|cate_type|$type$=@@@@}}<!--
  +
-->}}<!--
  +
--></esc>|}}<!--
  +
-->}}<!--
  +
// ai
 
-->{{#if:{{#var:ni:ai}}|{{#if:{{#var:ni:cateset:ai:{{#var:ni:ai}}}}||<!--
 
-->{{#if:{{#var:ni:ai}}|{{#if:{{#var:ni:cateset:ai:{{#var:ni:ai}}}}||<!--
-->{{#vardefine:ni:cateset:ai:{{#var:ni:ai}}|y}}{{l10n|npc_infobox|cate_ai|$ai$={{#var:ni:ai}}}}<!--
+
-->{{#vardefine:ni:cateset:ai:{{#var:ni:ai}}|y}}<!--
  +
-->{{l10n|npc_infobox|cate_ai|$ai$={{#var:ni:ai}}}}<!--
 
-->}}}}<!--
 
-->}}}}<!--
  +
// listcats
-->{{#if:{{#var:ni:listcat}}|{{#if:{{#var:ni:cateset:listcat:{{#var:ni:listcat}}}}||<!--
 
  +
-->{{#if:{{#var:ni:listcats}}|<!--
-->{{#vardefine:ni:cateset:listcat:{{#var:ni:listcat}}|y}}{{l10n|npc_infobox|cate_listcat|$listcat$={{#var:ni:listcat}}}}<!--
 
  +
-->{{#lstmap:{{#var:ni:listcats}}|/|@@@@|<esc><!--
-->}}}}<!--
 
-->{{#if:{{#var:ni:listcat2}}|{{#if:{{#var:ni:cateset:listcat:{{#var:ni:listcat2}}}}||<!--
+
-->{{#if:{{#var:ni:cateset:listcat:@@@@}}||<!--
-->{{#vardefine:ni:cateset:listcat:{{#var:ni:listcat2}}|y}}{{l10n|npc_infobox|cate_listcat|$listcat$={{#var:ni:listcat2}}}}<!--
+
-->{{#vardefine:ni:cateset:listcat:@@@@|y}}<!--
  +
-->{{l10n|npc_infobox|cate_listcat|$listcat$=@@@@}}<!--
-->}}}}<!--
 
  +
-->}}<!--
-->{{#if:{{#var:ni:listcat3}}|{{#if:{{#var:ni:cateset:listcat:{{#var:ni:listcat3}}}}||<!--
 
  +
--></esc>|}}<!--
-->{{#vardefine:ni:cateset:listcat:{{#var:ni:listcat3}}|y}}{{l10n|npc_infobox|cate_listcat|$listcat$={{#var:ni:listcat3}}}}<!--
 
-->}}}}<!--
+
-->}}<!--
  +
// hardmode and expert mode
-->{{#if:{{{hardmode|}}}|{{#if:{{#var:ni:cateset:hardmode}}||<!--
 
-->{{#vardefine:ni:cateset:hardmode|y}}{{l10n|npc_infobox|cate_hardmode|$type$={{#var:ni:type}}}}<!--
+
-->{{#if:{{#var:ni:hardmodeonly}}|{{#if:{{#var:ni:cateset:hardmode}}||<!--
  +
-->{{#vardefine:ni:cateset:hardmode|y}}<!--
  +
-->{{l10n|npc_infobox|cate_hardmode|$type$={{#lstelem:{{#var:ni:types}}|/|1}}}}<!--
 
-->}}}}<!--
 
-->}}}}<!--
-->{{#if:{{{expertonly|}}}|{{#if:{{#var:ni:cateset:expertonly}}||<!--
+
-->{{#if:{{#var:ni:expertonly}}|{{#if:{{#var:ni:cateset:expertonly}}||<!--
-->{{#vardefine:ni:cateset:expertonly|y}}{{l10n|npc_infobox|cate_expertonly|$type$={{#var:ni:type}}}}<!--
+
-->{{#vardefine:ni:cateset:expertonly|y}}<!--
  +
-->{{l10n|npc_infobox|cate_expertonly|$type$={{#lstelem:{{#var:ni:types}}|/|1}}}}<!--
 
-->}}}}<!--
 
-->}}}}<!--
 
-->}}<!--
 
-->}}<!--
  +
--------
   
// cargo
+
---- store to cargo ----
-->{{#vardefine:cargo|}}<!--
 
-->{{#ifeq:{{NAMESPACE}}|{{ns:0}}|{{#ifeq:{{PAGENAME}}|{{ROOTPAGENAME}}|{{#vardefine:cargo|y}}}}}}<!--
 
-->{{#switch:{{{cargo|}}}<!--
 
-->|force|yes|y={{#vardefine:cargo|y}}<!--
 
-->|no|n={{#vardefine:cargo|}}<!--
 
-->}}<!--
 
-->{{#if:{{langList|isOnWiki|{{lang}}}}|{{#vardefine:cargo|}}}}<!-- don't store for non-english languages on mainwiki
 
 
-->{{#if:{{#var:cargo}}|<!--
 
-->{{#if:{{#var:cargo}}|<!--
-->{{#lstmap:{{{idcargo|{{#var:_npc_auto_id|{{{id|}}}}}}}}|,|@@@@|<!--
+
-->{{#lstmap:{{{idcargo|{{#var:ni:auto_id|{{{id|}}}}}}}}|,|@@@@|<!--
--><esc>{{#cargo_store:_table=NPCs<!--
+
-->\{\{#cargo_store:_table=NPCs<!--
-->|name=</esc>{{eil|{{ROOTPAGENAME}}|{{#var:ni:name}}}}<!--
+
-->\!name=<!--
-->{{#if:{{#var:ni:namesub}}|{{note|block=y|paren=y|{{tr|{{#var:ni:namesub}}}}}}}}<!--
+
-->{{eil|{{ROOTPAGENAME}}|{{tr|{{#var:ni:name}}}}|epage={{#var:npcnamefrompagename}}}}<!--
-->{{#if:{{#var:ni:namenote}}|{{note|block=y|paren=y|small=y|{{#var:ni:namenote}}}}}}<esc><!--
+
-->{{#if:{{#var:ni:namesub}}|{{note|block=y|paren=y|{{#var:ni:namesub}}}}}}<!--
-->|nameraw=</esc>{{#var:ni:name}}<esc><!--
+
-->{{#if:{{#var:ni:namenote}}|{{note|block=y|paren=y|small=y|{{#var:ni:namenote}}}}}}<!--
  +
-->\!nameraw={{#var:ni:name}}<!--
-->|image=</esc><span class="npcimg">{{{imagecargo|{{{imagealt|[[File:{{{image|{{#var:ni:imagename}}.png}}}|link=]]}}}}}}</span><esc><!--
 
-->|environment=</esc>{{#var:ni:environment}}<esc><!--
+
-->\!image=<span class="npcimg">{{{imagecargo|{{{imagealt|[[File:{{{image|{{#var:ni:imagename}}.png}}}|link=]]}}}}}}</span><!--
-->|ai=</esc>{{#var:ni:ai}}<esc><!--
+
-->\!environment={{#var:ni:environment}}<!--
-->|damage=</esc>{{#var:ni:damage}}<esc><!--
+
-->\!ai={{#var:ni:ai}}<!--
-->|life=</esc>{{#var:ni:lifemax}}<esc><!--
+
-->\!damage={{npc infobox/strip|{{#var:ni:damage}}}}<!--
-->|defense=</esc>{{#var:ni:defense}}<esc><!--
+
-->\!life={{npc infobox/strip|{{#var:ni:lifemax}}}}<!--
-->|knockback=</esc>{{#var:ni:knockback}}<esc><!--
+
-->\!defense={{npc infobox/strip|{{#var:ni:defense}}}}<!--
-->|bannername=</esc>{{#var:ni:banner}}<esc><!--
+
-->\!knockback={{npc infobox/strip|{{#var:ni:knockback}}}}<!--
-->|banner=</esc>{{#if:{{#var:ni:banner}}|{{item|{{#var:ni:banner}}|wrap=y}}}}<esc><!--
+
-->\!bannername={{#var:ni:banner}}<!--
-->|money=</esc>{{#var:ni:cargo:money}}<esc><!--
+
-->\!banner={{#if:{{#var:ni:banner}}|{{item|{{#var:ni:banner}}|wrap=y}}}}<!--
-->|npcid=@@@@<!--
+
-->\!money={{#var:ni:cargo:money}}<!--
  +
-->\!npcid=@@@@<!--
-->|immunities=</esc>{{#var:ni:cargo:immunities}}<esc><!--
 
-->}}</esc><!--
+
-->\!immunities={{#var:ni:cargo:immunities}}<!--
  +
-->\}\}<!--
 
-->}}<!--
 
-->}}<!--
//since enemy banners is too many, we can't store them in enemy banners page, store them here.
+
// since the enemy banners are too many, we can't store them all in the "Banners (enemy)" page, so we store them here
-->{{#if:{{#var:ni:_banner_id_is_stored:{{#var:__banner_id}}}}||<!--
+
-->{{#if:{{#var:__banner_id}}|{{#if:{{#var:ni:_banner_id_is_stored:{{#var:__banner_id}}}}||<!--
-->{{#vardefine:ni:_banner_id_is_stored:{{#var:__banner_id}}|y}}<!--
+
-->{{#vardefine:ni:_banner_id_is_stored:{{#var:__banner_id}}|y}}<!-- store the same banner only once per page
 
-->{{item infobox| view=void | auto = {{#var:__banner_id}}<!--
 
-->{{item infobox| view=void | auto = {{#var:__banner_id}}<!--
-->| buffid = {{#ifexpr:(({{#var:__banner_id}} > 3836) AND ({{#var:__banner_id}} <3847))||147}}<!--
+
-->| buffid = {{#ifexpr:(({{#var:__banner_id}} > 3836) AND ({{#var:__banner_id}} < 3847))||147}}<!--
-->| type = Furniture | width = 1 | height = 3 | tags = drop / enemy banner | hardmode = {{{hardmode|}}}<!--
+
-->| type = Furniture | width = 1 | height = 3 | tags = drop / enemy banner | hardmode = {{#var:ni:hardmodeonly}}<!--
 
-->}}<!--
 
-->}}<!--
-->}}<!--
+
-->}}}}<!--
 
 
-->}}<!--
 
-->}}<!--
   
  +
===== OUTPUT VIEW ======
 
  +
select view base on viewmodename. e.g. mode=table means {{npc infobox/tableView}}, default is {{ infobox/infoboxView}}
 
  +
==========================================================================================================================
  +
============================================= DATA VIEW ==============================================
  +
==========================================================================================================================
  +
  +
  +
// select view based on viewname, e.g. "|mode=table" means {{npc infobox/tableView}}, default is {{npc infobox/infoboxView}}
 
-->{{npc infobox/{{#var:ni:viewmodename}}View}}<!--
 
-->{{npc infobox/{{#var:ni:viewmodename}}View}}<!--
   
 
--></includeonly><!--
 
--></includeonly><!--
   
--><noinclude>
+
--><noinclude><!--
  +
  +
-->
 
* {{#cargo_declare:_table=NPCs
 
* {{#cargo_declare:_table=NPCs
|name=Wikitext (size=1000)
+
| name = Wikitext (size=1000)
|nameraw=String
+
| nameraw = String
|image=Wikitext
+
| image = Wikitext
|environment=String
+
| environment = String
|ai=String
+
| ai = String
|damage=Wikitext (size=2500)
+
| damage = Wikitext (size=2500)
|life=Wikitext (size=2000)
+
| life = Wikitext (size=2000)
|defense=Wikitext (size=1000)
+
| defense = Wikitext (size=1000)
|knockback=Wikitext (size=1000)
+
| knockback = Wikitext (size=1000)
|banner=Wikitext (size=1000)
+
| banner = Wikitext (size=1000)
|bannername=String
+
| bannername = String
|money=Wikitext (size=1000)
+
| money = Wikitext (size=1000)
|npcid=Integer
+
| npcid = Integer
|immunities=List (^) of String
+
| immunities = List (^) of String
  +
}}
  +
* {{#cargo_attach:_table=Items}}<!-- for enemy banners -->
  +
{{i18n-ready}}{{lua|Npcinfo}}{{doc}}
  +
{{category|Npc infobox| }}
  +
{{interwiki links
  +
|en=Template:Npc infobox
  +
|de=Vorlage:Npc infobox
  +
|fr=Modèle:Npc infobox
  +
|ko=틀:Npc 정보상자
  +
|pl=Szablon:Npc infobox
  +
|pt=Predefinição:Npc infobox
  +
|ru=Шаблон:Карточка существа
  +
|zh=模板:Npc infobox
 
}}
 
}}
  +
</noinclude>
* {{#cargo_attach:_table=Items}}<!-- for enemy banners.-->
 
{{i18n-ready}}{{doc}}</noinclude>
 

Dernière version du 28 octobre 2021 à 15:04

Ce modèle est considéré comme prêt pour i18n, signifiant qu'il est facile à régionaliser pour les différentes langues. Veuillez regarder i18n & l10n pour les modèles (en) pour en apprendre plus.
Voir Modèle:Npc infobox/l10n pour la localisation de ce modèle.
Ce modèle utilise Lua.
Ce modèle utilise Module:Npcinfo, un script écrit dans le language de programmation Lua. Pour en apprendre plus à propos Lua, visiter Terraria Wiki:Lua (en).
Template-info Documentation La documentation ci-dessous est transcluse de Modèle:Npc infobox/doc. (modifier | historique)

This template is used for displaying the infobox for an NPC (including enemies, bosses, critters, etc.). Together with {{item infobox}}, it is one of the most important and most powerful infobox templates.

Usage

The template's main functionality is to display the standard infobox.

The data which is to be displayed can be manually entered when calling the template, but thanks to {{npcinfo}}, the vast majority of data is generated automatically. To enable automatic data, use the parameter auto and set it to the ID of the NPC (alternatively: auto=yes and either id=<NPC ID>, name=<NPC name>, or nothing else – the latter two methods will cause the template to automatically generate the ID using {{npcNameFromId}}, with the last method using the page title for name reference). This way, all relevant NPC parameters are set automatically. See the table below for affected parameters. However, they can still be overridden, and manually entered parameters always take precedence over the automatic ones.

Basic parameters

Notes:
  • The dollar sign ($) is used to signify that the word after it is the name of a template parameter.
  • All parameters which have a default value listed can usually be omitted. Note that this does not mean that parameters which do not have a default value listed should always be filled in.
Parameter Description Auto Example Default value
(if omitted)
Note
{{npc infobox
Box-related parameters
| boxwidth Width of the infobox 27em Number with unit. The box is adjusting to the width of the images by default.
| float Position of the infobox left right
| css
 or
| style
CSS style affecting the entire infobox Any width or float properties defined here will override the template's $boxwidth and $float parameters, respectively.
| auto Enables automatic data 201 Can also be yes (see text above).
| id ID of the NPC ✔️ 201 Cosmetic ID to be displayed, overrides the display of $auto and $idcargo.
| name Name of the NPC ✔️ Skeleton <page name> Will be displayed as the heading of the infobox.
| name2 Cosmetic addition to the name &#32; / {{expert|Lunatic Cultist}} Will be directly appended to $name.
| namesub Name sub-heading ✔️ Additional information directly underneath the title of the infobox. Mainly internal NPC variant names, like Astronaut Skeleton.
| namesub2 Name sub-heading First Form Additional information directly underneath the title of the infobox or underneath $namesub. Intended to be used as a manual $namesub, because manually setting $namesub to something would prevent its automatic display.
| namenote Name sub-sub-heading ✔️ Will be displayed underneath $namesub / $namesub2. Mainly NPC variant descriptions, like Halloween Variant 2.
| expertonly Expert-exclusivity of the NPC yes Causes the {{expert}} formatting to be applied to most of the displayed stats and the following line to be displayed underneath title / $namesub / $namesub2 / $namenote: (Exclusif au mode Expert)
Image-related parameters
| imagealt Complete custom control over the display of the first image [[File:Skeleton.png]] Overrides the $image and $imagesize parameters. Multiple images can be provided and/or text and other formatting.
| image Main image of the NPC Skeleton.png $namesub.png or $name.png This is the image that is stored to cargo by default.
| imagesize Size of the main image 40x20px*0.75 *1 Corresponds to the size parameter of {{image}}: <width>x<height>*<scale>
| imageexpert Image of the Expert variant Skeleton.png
| image2 Additional image Skeleton.png Default value: <$image without ".png">_(old).png / .gif. Leave it empty to disable this automatic old image discovering.
| imagemode Controls image display full Setting it to anything other than full prevents the automatic display of $image2.
| image3 Additional image Skeleton.png
| imageversion2 Exclusive versions of $image2 desktop-console old-gen-3ds Versions that will be displayed when hovering over $image2 (by default the _(old) one, so the "old" versions are the default). Valid values are desktop, console, mobile, old-gen, and 3ds.
| imageversion3 Exclusive versions of $image3 desktop-console Versions that will be displayed when hovering over $image3. Valid values are the same as for $imageversion2.
| imageother Additional image at the bottom Map Icon Skeletron.png Will be displayed at the bottom of the infobox. Usually used for map icons or sprites of NPCs' temporary states (e.g. the "rolling" state of the Sroller).
| imageothercaption Caption of $imageother Rolling state Will be displayed underneath $imageother. Has no effect if $imageother is not set.
Statistics-related parameters
| type
| type2
| type3
Classification Boss Enemy $type2 will be separated with a dot (•) from $type; type3 will always be on a new line. All types will be linked, if the respective page exists.
| environment
| environment2 (deprecated)
| environment3 (deprecated)
Native environment of the NPC Desert
Forest+Rain
Desert / Forest
Desert / Forest+Rain
Biome in which or event during which the NPC naturally spawns. "+" means AND and "/" means OR; all environments will be linked if the respective page exists. |environment=A|environment2=B|environment3=C is same as |environment=A/B/C
| ai AI style of the NPC ✔️ Fighter AI
| damage Damage ✔️
| damage2 Addition to the damage Will be directly appended to $damage. Can be used, for instance, for differentiation between different attacks of the NPC or different platforms.
| life Maximum health of the NPC ✔️
| life2 Addition to the maximum health Will be directly appended to $life.
| defense Defense of the NPC ✔️
| defense2 Addition to the defense Will be directly appended to $defense.
| knockback Resistance to knockback of the NPC ✔️
| knockback2 Addition to the knockback resistance Will be directly appended to $knockback.
| banner Banner of the NPC ✔️ yes Setting it to yes will cause it to take $name Banner as the banner name, but it can also simply be set to the name of the banner.

Note that, if using $auto and the NPC having a valid banner associated to it, the banner item will be stored to cargo in a hidden {{item infobox}}.

| immune1
 through
| immune10
Debuffs to which the NPC is immune ✔️ Will only be displayed if $type is not one of the following:
| immuneall Immunity to all debuffs ✔️ yes
| immuneallnote Addition to $immuneall Will be directly appended to the text "Tous les débuffs" that is displayed if $immuneall is set. Example: <br/><span style="color:#666;">(except {{item|Stunned|scale=0.5}})</span>
Buff- & Debuff-related parameters
| buff Name or ID of the buff the NPC causes Dryad's Blessing
| bufftip Buff tooltip ✔️ No effect if $buff is not set.
| buffduration Buff duration 5–10 seconds
| debuff Name or ID of the debuff that the NPC inflicts
| debufftip Debuff tooltip ✔️
| debuffchance Debuff chance
| debuffchancenote Addition to $debuffchance Will be displayed underneath $debuffchance. Has no effect if $debuffchance is not set.
| debuffduration
| duration (deprecated)
Debuff duration
| debuff2 Second debuff that the NPC inflicts See above. These parameters behave in the exact same manner.
| debufftip2 Debuff tooltip ✔️
| debuffchance2 Debuff chance
| debuffchancenote2 Addition to $debuffchance2
| debuffduration2
| duration2 (deprecated)
Debuff duration
Drop-related parameters
| money Base amount of money that the NPC drops ✔️ {{coin|3gc 80sc}} Use the {{coin}} template.
| money2 Addition to dropped money Will be directly appended to $money.
| <item name 1>
| <item quantity 1>
| <item rate 1>


| <item name 2>
| <item quantity 2>
| <item rate 2>

...

| <item name n>
| <item quantity n>
| <item rate n>

Dropped item |Gel|2–5|75% / {{expert|100%}} Note that these are unnamed parameters, i.e., they are not used with an equals sign (=) like the other parameters.


Repeat this triple of parameters as many times as necessary.

Leave $<item quantity> free to set it to 1.

| group
| <group heading>
| <group size>
Group of dropped items |group|Only one of the following 4 will drop|4 Note that these are unnamed parameters, i.e., they are not used with an equals sign (=) like the other parameters.


Visually groups dropped items. See most bosses' pages, e.g. Queen Bee, for examples.

| custom
| <custom item display>
| <item rate>
Custom dropped item Note that these are unnamed parameters, i.e., they are not used with an equals sign (=) like the other parameters.


Grants custom control over $<item name> and $<item quantity>. See Guide for an example.

Sound-related parameters
| soundhurt Hurt sound effect ✔️ NPC_Hit_1.wav Can be a comma-separated list for multiple sounds. Caption is "Blessé". Set to an empty value (|soundhurt=) to hide the automatically generated sounds.
| soundkilled Killed sound effect ✔️ NPC_Killed_1.wav Can be a comma-separated list for multiple sounds. Caption is "Tué". Set to an empty value (|soundkilled=) to hide the automatically generated sounds.
| sound1 Custom additional sound effect Can be a comma-separated list for multiple sounds.
| soundcaption1 Caption for the sound effect
| sound2 Custom additional sound effect Can be a comma-separated list for multiple sounds.
| soundcaption2 Caption for the sound effect
| sound<n> Custom additional sound effect Can be continued nearly infinitely. Sounds will only be displayed if there is a sound<n> parameter with a corresponding soundcaption<n> parameter.
| soundcaption<n> Caption for the sound effect
Back-end-related parameters
| cate Toggles all categorization no Set to yes to force categorization when it is disabled by default (on non-mainspace pages). Set to no to disable categorization.
| listcat
| listcat2
Categorization Supplemental category names (Category:$listcat NPCs).

Note: The template mainly categorizes the page based on the other parameters (using {{npc infobox/cate}}). It takes the values of the following parameters:

  • $type
  • $type2
  • $type3
  • $environment
  • $environment2
  • $ai

and adds the category Category:<parameter value> NPCs.

| allversions Platform version availability yes Set to yes to assert that the NPC is available on all platforms of Terraria. Categorizes the page in all five version content categories (with the exception of Japanese console content).
| hardmode Hardmode-exclusivity yes Set to yes to assert that the NPC is not available in pre-Hardmode, but only becomes available in Hardmode. Categorizes the page in Hardmode-only NPCs.
| cargo Toggles cargo data storage no Set to yes to force cargo data storage when it is disabled by default (on non-mainspace root pages[1]). Set to no to disable cargo data storage.
| idcargo NPC ID to store to cargo 201 Can be a comma-separated list. Can also be left empty to prevent cargo storage as well.
| imagecargo NPC image to store to cargo [[File:Skeleton.png]] Define an image to store to cargo, completely overriding the image parameters.

Subpages

There are numerous supplemental subpages which are mainly used for formatting certain data:

See also

Footnotes

  1. A root page is a page that is not a subpage. This prevents language subpages from storing duplicates by default.