Template:NpcData/doc: Difference between revisions

Jump to navigation Jump to search
LVL (talk | contribs)
Updated to reflect new template code
LVL (talk | contribs)
No edit summary
Line 1: Line 1:
This template is a shortcut for [[Module:NpcData]] to make it easier to display NPC stats on a page.
This template is a shortcut for [[Module:NpcData]] to make it easier to display NPC stats on a page.


It can be used to get a single stat (including nested ones like <code>Shield.BaseAbsorptionPerSecond</code>) or an item from a list of stats (like the 4th value in a list of resistances).
It can be used to get a single stat (including nested ones) or an item from a list of stats.


== How to Use ==
== How to Use ==


=== Getting a Single Stat ===
=== Getting a Single or Nested Stat ===
This is the most common use. Provide the information in the following order.
This is the most common use. Provide the information in the following order. For nested stats, simply add more parameters for each level of nesting.


'''Syntax'''
'''Syntax'''
<code><nowiki>{{NpcData|NPC Name|Stat Name|Rounding}}</nowiki></code>
<code><nowiki>{{NpcData|NPC Name|Key 1|Key 2|...|Rounding}}</nowiki></code>


'''Parameters'''
'''Parameters'''
* '''First parameter (NPC Name):''' The internal key for the NPC (e.g., <code>npc_boss_tier2</code>).
* '''First parameter (NPC Name):''' The internal key for the NPC (e.g., <code>npc_boss_tier2</code>).
* '''Second parameter (Stat Name):''' The name of the stat you want to look up (e.g., <code>MaxHealth</code>). Supports dot notation for nested stats (e.g., <code>Shield.BaseAbsorptionPerSecond</code>).
* '''Second, Third, etc. parameters (Keys):''' The path to the stat you want. For a simple stat, this is just one key. For a nested stat, provide each key as a separate parameter.
* '''Third parameter (Rounding):''' (Optional) A number to round the result to that many significant figures.
* '''Final parameter (Rounding):''' (Optional) If the final parameter is a number, it will be used to round the result to that many significant figures.


'''Examples'''
'''Examples'''
Line 25: Line 25:
** '''Result:''' {{NpcData|trooper_medic|MaxHeath}}
** '''Result:''' {{NpcData|trooper_medic|MaxHeath}}


* To get a nested shield stat:
* To get a nested shield stat (using multiple parameters):
** '''Code:''' <code><nowiki>{{NpcData|npc_super_neutral|Shield.BaseAbsorptionPerSecond}}</nowiki></code>
** '''Code:''' <code><nowiki>{{NpcData|npc_super_neutral|Shield|BaseAbsorptionPerSecond}}</nowiki></code>
** '''Result:''' {{NpcData|npc_super_neutral|Shield.BaseAbsorptionPerSecond}}
** '''Result:''' {{NpcData|npc_super_neutral|Shield|BaseAbsorptionPerSecond}}
 
* To get a deeply nested ability name:
** '''Code:''' <code><nowiki>{{NpcData|npc_boss_tier2|BoundAbilities|1|Name}}</nowiki></code>
** '''Result:''' {{NpcData|npc_boss_tier2|BoundAbilities|1|Name}}


----
----
Line 48: Line 52:
<templatedata>
<templatedata>
{
{
"description": "A shortcut for Module:NpcData to display stats for NPCs, either a single value or an item from a list.",
"description": "A shortcut for Module:NpcData to display stats for NPCs. Can retrieve simple stats, nested stats, or an item from a list.",
"params": {
"params": {
"1": {
"1": {
Line 59: Line 63:
},
},
"2": {
"2": {
"label": "Stat or List Name",
"label": "Key 1 / List Name",
"description": "The name of the stat (e.g., MaxHealth) or the list (e.g., NearbyEnemyResistanceValues). Supports dot notation for nested stats (e.g., Shield.BaseAbsorptionPerSecond).",
"description": "The name of the stat (e.g., MaxHealth), the first key in a nested path (e.g., Shield), or the name of a list.",
"type": "string",
"type": "string",
"required": true,
"required": true,
Line 67: Line 71:
},
},
"3": {
"3": {
"label": "Key 2 / Rounding",
"description": "The second key in a nested path (e.g., BaseAbsorptionPerSecond) OR an optional number to round the result to that many significant figures.",
"type": "string",
"required": false
},
"4": {
"label": "Key 3 / Rounding",
"description": "The third key in a nested path OR an optional rounding number.",
"type": "string",
"required": false
},
"5": {
"label": "Rounding",
"label": "Rounding",
"description": "(Optional) A number to round a stat to that many significant figures. Does not apply when getting an item from a list.",
"description": "An optional number to round the result to that many significant figures.",
"type": "number",
"type": "number",
"required": false,
"required": false
"aliases": [ "round" ]
},
},
"index": {
"index": {