More actions
m get_hero_var: recommend hero_key over hero_name, and describe each example |
m reference HeroData/nav and HeroData/release |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Documentation|contents= | |||
Also see: | |||
* [[Module:HeroData/nav]] - For nav box purposes | |||
* [[Module:HeroData/release]] - For determining the release status of a hero | |||
== Overview == | == Overview == | ||
Line 15: | Line 20: | ||
====Parameters==== | ====Parameters==== | ||
* '''hero_name''' - Name of the hero in english, or key of the hero | * '''hero_name''' - Name of the hero in english, or key of the hero. Preferred and recommended to use hero key, as its much more efficient. Search for the key in [[Data:HeroData.json]] | ||
* '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]] | * '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]] | ||
* '''sig_figs_or_localize''' - OPTIONAL, # of sig figs to round to if retrieving a float, or "true" if its a string that should be localized. See Localizable values section. | * '''sig_figs_or_localize''' - OPTIONAL, # of sig figs to round to if retrieving a float, or "true" if its a string that should be localized. See Localizable values section. | ||
Note: Recommended to use hero key where possible, i.e. hero_atlas as its O(1) instead of hero name (Abrams) which is O(N). | Note: Recommended to use hero key where possible, i.e. hero_atlas as its O(1) time complexity instead of hero name (Abrams) which is O(N). | ||
====Examples==== | ====Examples==== | ||
Line 65: | Line 70: | ||
==== Parameters ==== | ==== Parameters ==== | ||
* '''hero_name''' - Name of the hero, in | * '''hero_name''' - Name of the hero in english, or hero key. Preferred and recommended to use hero key, as its much more efficient. Search for the key in [[Data:HeroData.json]] | ||
* '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]] | * '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]] | ||
* '''number''' - Index to retrieve from the list. 1 for 1st element, 2 for 2nd element, etc. | * '''number''' - Index to retrieve from the list. 1 for 1st element, 2 for 2nd element, etc. | ||
Line 72: | Line 77: | ||
==== Example ==== | ==== Example ==== | ||
From wikitext:<br> | From wikitext:<br> | ||
Using hero name in english | |||
<pre>{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}}</pre> | <pre>{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}}</pre> | ||
{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}} | {{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}} | ||
Using hero key | |||
<pre>{{#invoke:HeroData|get_list_elem|hero_atlas|WeaponTypes|2}}</pre> | |||
{{#invoke:HeroData|get_list_elem|hero_atlas|WeaponTypes|2}} | |||
Line 130: | Line 141: | ||
* elements in WeaponTypes | * elements in WeaponTypes | ||
* elements in RecommendedItems | * elements in RecommendedItems | ||
}} |