Module:HeroData/doc: Difference between revisions

Sur (talk | contribs)
m sig_figs example; spacing
Sur (talk | contribs)
m get_localized_var now a parameter in get_var
Line 43: Line 43:
* '''hero_name''' - Name of the hero, in english
* '''hero_name''' - Name of the hero, in english
* '''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''' - OPTIONAL, # of sig figs to round to if retrieving a float
* '''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


====Examples====
====Examples====
From wikitext<br>:
From wikitext:<br>
<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}}
Line 58: Line 58:
{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange|2}}
{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange|2}}


<pre>{{#invoke:HeroData|get_hero_var|Abrams|Role|true}}</pre>
{{#invoke:HeroData|get_hero_var|Abrams|Role|true}}
<pre>{{#invoke:HeroData|get_hero_var|Abrams|WeaponName|true}}</pre>
{{#invoke:HeroData|get_hero_var|Abrams|WeaponName|true}}


====Notes====
====Notes====
Line 64: Line 71:
If using sig_figs parameter, ensure the value is a float.
If using sig_figs parameter, ensure the value is a float.


=== get_localized_var ===
If using localize parameter, ensure the value is a string. See [[Data:HeroData.json]], you will notice that hero_astro's "Lore" variable has the value "hero_astro_lore". This key is then sent to [[Module:Lang]] which checks for it in [[Data:Lang_en.json]] (or a different language).
Get a hero's stat, then localize it
 
====Parameters====
* '''hero_name''' - Name of the hero, in english
* '''hero_var''' - Key of the hero's variable, see [[Data:HeroData.json]]
 
====Examples====
From wikitext:<br>
<pre>{{#invoke:HeroData|get_localized_var|Abrams|WeaponName}}</pre>
{{#invoke:HeroData|get_localized_var|Abrams|WeaponName}}
 
 
<pre>{{#invoke:HeroData|get_localized_var|Abrams|Role}}</pre>
{{#invoke:HeroData|get_localized_var|Abrams|Role}}
 
 
====Notes====
Only usable on variables that can be localized. See [[Data:HeroData.json]], you will notice that hero_astro's "Lore" variable has the value "hero_astro_lore". This key is then sent to [[Module:Lang]] which checks for it in [[Data:Lang_en.json]] (or a different language).


As of writing this (not exhaustive), localizable variables include:
Localizable values as of writing this:
* Lore
* Lore
* Playstyle
* Playstyle
Line 90: Line 79:
* WeaponDescription
* WeaponDescription
* WeaponName
* WeaponName
* TODO each value in WeaponTypes