Module:HeroData/doc: Difference between revisionsGive feedback
m →Localizable values: RecommendedItems |
m get_hero_var: recommend hero_key over hero_name, and describe each example |
||
| Line 15: | Line 15: | ||
====Parameters==== | ====Parameters==== | ||
* '''hero_name''' - Name of the hero | * '''hero_name''' - Name of the hero in english, or key of the hero | ||
* '''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). | |||
====Examples==== | ====Examples==== | ||
From wikitext:<br> | From wikitext:<br> | ||
Using hero name in english | |||
<pre>{{#invoke:HeroData|get_hero_var|Abrams|MaxHealth}}</pre> | <pre>{{#invoke:HeroData|get_hero_var|Abrams|MaxHealth}}</pre> | ||
{{#invoke:HeroData|get_hero_var|Abrams|MaxHealth}} | {{#invoke:HeroData|get_hero_var|Abrams|MaxHealth}} | ||
Using hero key | |||
<pre>{{#invoke:HeroData|get_hero_var|hero_atlas|MaxHealth}}</pre> | |||
{{#invoke:HeroData|get_hero_var|hero_atlas|MaxHealth}} | |||
| Line 28: | Line 38: | ||
{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange}} | {{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange}} | ||
Round to 2 sig figs | |||
<pre>{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange|2}}</pre> | <pre>{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange|2}}</pre> | ||
| Line 36: | Line 48: | ||
{{#invoke:HeroData|get_hero_var|Abrams|WeaponName}} | {{#invoke:HeroData|get_hero_var|Abrams|WeaponName}} | ||
Localize | |||
<pre>{{#invoke:HeroData|get_hero_var|Abrams|WeaponName|true}}</pre> | <pre>{{#invoke:HeroData|get_hero_var|Abrams|WeaponName|true}}</pre> | ||