Template:NpcData: Difference between revisions

LVL (talk | contribs)
Add support for get_nester_var
LVL (talk | contribs)
No edit summary
Line 1: Line 1:
<includeonly>{{#if:{{{index|}}}
<includeonly>{{#if:{{{index|}}}
   |<!-- If index is provided, get an element from a list -->{{#invoke:NpcData|get_list_elem|{{{1}}}|{{{2}}}|{{{index}}}}}
   |<!-- If an index is provided, assume it's a list and use the specific list function -->{{#invoke:NpcData|get_list_elem|{{{1}}}|{{{2}}}|{{{index}}}}}
   |<!-- Otherwise, check for dots (nested path) or fall back to single stat -->{{#if:{{#pos:{{{2}}}|.}}
   |<!-- Otherwise, use the main function which can handle simple and nested values -->{{#invoke:NpcData|get_npc_var|{{{1}}}|{{{2}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}}}
      |{{#invoke:NpcData|get_nested_var|{{{1}}}|{{{2}}}|{{{3|}}}}}
      |{{#invoke:NpcData|get_npc_var|{{{1}}}|{{{2}}}|{{{3|}}}}}
  }}
}}</includeonly><noinclude>
}}</includeonly><noinclude>
{{Documentation}}
{{Documentation}}
</noinclude>
</noinclude>