Module:HeroData/doc: Difference between revisions
m documentation expanded greatly |
testing styling |
||
(16 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Documentation|contents= | |||
== Overview == | == Overview == | ||
This module provides functions to create hero infoboxes or | This module provides functions to create hero infoboxes, statboxes, or retrieve hero information using the data uploaded to [[Data:HeroData.json]]. | ||
Both will automatically be translated depending on the language selected. If called on | Both will automatically be translated depending on the language selected. If called on | ||
Line 10: | Line 11: | ||
== Functions == | == Functions == | ||
=== get_hero_var === | |||
Retrieve a hero variable's value, such as Abram's MaxHealth | |||
====Parameters==== | |||
* '''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]] | |||
* '''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) time complexity instead of hero name (Abrams) which is O(N). | |||
====Examples==== | |||
From wikitext:<br> | |||
Using hero name in english | |||
<pre>{{#invoke:HeroData|get_hero_var|Abrams|MaxHealth}}</pre> | |||
{{#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}} | |||
<pre>{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange}}</pre> | |||
{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange}} | |||
Round to 2 sig figs | |||
<pre>{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange|2}}</pre> | |||
{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange|2}} | |||
<pre>{{#invoke:HeroData|get_hero_var|Abrams|WeaponName}}</pre> | |||
{{#invoke:HeroData|get_hero_var|Abrams|WeaponName}} | |||
Localize | |||
<pre>{{#invoke:HeroData|get_hero_var|Abrams|WeaponName|true}}</pre> | |||
{{#invoke:HeroData|get_hero_var|Abrams|WeaponName|true}} | |||
====Notes==== | |||
Only usable on variables that are integers, strings, or floats (meaning not dictionaries/hashes or arrays/lists). | |||
If using sig_figs parameter, ensure the value is a float. | |||
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_list_elem === | |||
Retrieve a specified element from a list | |||
==== Parameters ==== | |||
* '''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]] | |||
* '''number''' - Index to retrieve from the list. 1 for 1st element, 2 for 2nd element, etc. | |||
* '''localize''' - OPTIONAL - "true" if its a string that should be localized. See Localizable values section. | |||
==== Example ==== | |||
From wikitext:<br> | |||
Using hero name in english | |||
<pre>{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}}</pre> | |||
{{#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}} | |||
<pre>{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2|true}}</pre> | |||
{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2|true}} | |||
=== write_infobox === | === write_infobox === | ||
Line 22: | Line 97: | ||
Which outputs | Which outputs | ||
{{#invoke:HeroData|write_infobox|Abrams}} | {{#invoke:HeroData|write_infobox|Abrams}} | ||
=== | === write_stat_infoboxes === | ||
Writes all 3 [[Template: | Writes all 3 [[Template:Infobox_stat]] template calls (Weapon, Vitality, Spirit) for a given hero | ||
====Parameters==== | ====Parameters==== | ||
Line 33: | Line 107: | ||
====Example==== | ====Example==== | ||
From wikitext:<br> | From wikitext:<br> | ||
<pre>{{#invoke:HeroData| | <pre>{{#invoke:HeroData|write_stat_infoboxes|HERO_NAME}}</pre> | ||
Which outputs | Which outputs | ||
{{#invoke:HeroData|write_stat_infoboxes|Abrams}} | |||
=== write_hero_comparison_table === | |||
Writes the [[Hero Comparison]] table for a specific Level and Spirit Power | |||
=== | ====Parameters==== | ||
* '''level''' - Number of [[Level]]s / Power Increases | |||
* '''spirit_power''' - Amount of Spirit power | |||
Both parameters are optional, as if both are 0 or not provided, the outputted table will be at base and will also include the level/SS scaling in each cell along with the base value, rather than the scaled value. | |||
==== | ====Example==== | ||
From wikitext:<br> | From wikitext:<br> | ||
<pre>{{#invoke:HeroData| | <pre>{{#invoke:HeroData|write_hero_comparison_table|LEVEL|SPIRITPOWER}}</pre> | ||
Which outputs | |||
{{#invoke:HeroData| | {{#invoke:HeroData|write_hero_comparison_table|11|200}} | ||
== Localizable values == | |||
Localizable values as of writing this: | |||
* Lore | * Lore | ||
* Playstyle | * Playstyle | ||
Line 63: | Line 135: | ||
* WeaponDescription | * WeaponDescription | ||
* WeaponName | * WeaponName | ||
* | * elements in WeaponTypes | ||
* elements in RecommendedItems | |||
}} | |||
* | |||
Latest revision as of 17:46, 1 November 2024
Overview
This module provides functions to create hero infoboxes, statboxes, or retrieve hero information using the data uploaded to Data:HeroData.json.
Both will automatically be translated depending on the language selected. If called on
See Template:Lang for more
Functions
get_hero_var
Retrieve a hero variable's value, such as Abram's MaxHealth
Parameters
- 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
- 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) time complexity instead of hero name (Abrams) which is O(N).
Examples
From wikitext:
Using hero name in english
{{#invoke:HeroData|get_hero_var|Abrams|MaxHealth}}
570
Using hero key
{{#invoke:HeroData|get_hero_var|hero_atlas|MaxHealth}}
570
{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange}}
20.0000108
Round to 2 sig figs
{{#invoke:HeroData|get_hero_var|Abrams|FalloffStartRange|2}}
20
{{#invoke:HeroData|get_hero_var|Abrams|WeaponName}}
citadel_weapon_hero_atlas_set
Localize
{{#invoke:HeroData|get_hero_var|Abrams|WeaponName|true}}
Case Closed
Notes
Only usable on variables that are integers, strings, or floats (meaning not dictionaries/hashes or arrays/lists).
If using sig_figs parameter, ensure the value is a float.
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_list_elem
Retrieve a specified element from a list
Parameters
- 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
- number - Index to retrieve from the list. 1 for 1st element, 2 for 2nd element, etc.
- localize - OPTIONAL - "true" if its a string that should be localized. See Localizable values section.
Example
From wikitext:
Using hero name in english
{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2}}
Attribute_EWeaponAttribute_CloseRange
Using hero key
{{#invoke:HeroData|get_list_elem|hero_atlas|WeaponTypes|2}}
Attribute_EWeaponAttribute_CloseRange
{{#invoke:HeroData|get_list_elem|Abrams|WeaponTypes|2|true}}
Close Range
write_infobox
Writes a Template:Infobox_hero template call for a given hero
Parameters
- hero_name – Name of the hero, in english
Example
From wikitext:
{{#invoke:HeroData|write_infobox|HERO_NAME}}
Which outputs Hero Abrams Not Found
write_stat_infoboxes
Writes all 3 Template:Infobox_stat template calls (Weapon, Vitality, Spirit) for a given hero
Parameters
- hero_name – Name of the hero, in english
Example
From wikitext:
{{#invoke:HeroData|write_stat_infoboxes|HERO_NAME}}
Which outputs Hero Not Found
write_hero_comparison_table
Writes the Hero Comparison table for a specific Level and Spirit Power
Parameters
- level - Number of Levels / Power Increases
- spirit_power - Amount of Spirit power
Both parameters are optional, as if both are 0 or not provided, the outputted table will be at base and will also include the level/SS scaling in each cell along with the base value, rather than the scaled value.
Example
From wikitext:
{{#invoke:HeroData|write_hero_comparison_table|LEVEL|SPIRITPOWER}}
Which outputs
Hero | DPS | Sustained DPS | Bullet Damage | Bullets per sec | Fire Rate (%) | Ammo | Reload Time (s) | Reload Delay (s) | Bullets Per Shot | Bullets Per Burst | Time Between Bursted Bullets (s) | Light Melee | Heavy Melee | Reload Single | Bullet Velocity (m/s) | Bullet Gravity Scale | Falloff Start Range | Falloff End Range | Bonus Attack Range (m) | Max Health | Health Regen | Bullet Resist (%) | Spirit Resist (%) | Crit Reduction (%) | Move Speed (m/s) | Sprint Speed (m/s) | Stamina Cooldown (s) | Stamina |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Grey Talon | 120 | 95.6 | 65.8 | 1.82 | 0 | 17 | 2.35 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 495 | 0.8 | 18 | 54 | 0 | 847 | 2.5 | 0 | 0 | 0 | 11.3 | 0 | 5 | 4 |
Bebop | 112 | 77.2 | 8.93 | 12.5 | 0 | 66 | 2.35 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 508 | 0.8 | 22 | 50.8 | 851 | 1100 | 3 | 10 | 10.5 | 0 | 6.55 | 3 | 5 | 3 |
Haze | 80.6 | 96.9 | 8.06 | 10 | 0 | 125 | 2.35 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 762 | 1.5 | 22 | 46 | 0 | 797 | 2 | 0 | 0 | 0 | 8.3 | 0 | 5 | 3 |
Abrams | 112 | 65 | 7.44 | 1.67 | 0 | 9 | 0.353 | 0.705 | 9 | 1 | 0 | 92.4 | 170 | true | 610 | 0.8 | 20 | 45.7 | 0 | 944 | 1 | 0 | 0 | 0 | 6.8 | 0 | 5 | 3 |
Seven | 111 | 73.9 | 18.1 | 4 | 0 | 29 | 2.35 | 0 | 1 | 3 | 0.08 | 92.4 | 170 | false | 635 | 0.8 | 22 | 57.5 | 0 | 891 | 3 | 0 | 0 | -35 | 11.7 | 0 | 5 | 3 |
Wraith | 107 | 66.9 | 9.65 | 11.1 | 0 | 52 | 2.82 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 572 | 0 | 22 | 57.5 | 0 | 891 | 2 | 0 | 0 | 0 | 7.3 | 12 | 5 | 3 |
Warden | 168 | 88.3 | 30.2 | 6.4 | 60 | 17 | 2.91 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 290 | 0.25 | 22 | 57.5 | 0 | 1050 | 2 | 0 | 0 | 0 | 6.3 | 1 | 5 | 3 |
Dynamo | 83.1 | 54.6 | 20.8 | 4 | 0 | 18 | 2.35 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 320 | 0.8 | 22 | 57.5 | 0 | 1130 | 2 | 10.5 | 0 | 0 | 6.8 | 0 | 5 | 3 |
Lady Geist | 95.9 | 66.5 | 43.2 | 2.22 | 0 | 13 | 2.59 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 828 | 0.8 | 22 | 57.5 | 0 | 1100 | 1 | 0 | 0 | 0 | 6.3 | 1.5 | 5 | 3 |
Mirage | 82.9 | 56.6 | 29 | 2.86 | 0 | 16 | 2.6 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 828 | 0.8 | 22 | 57.5 | 0 | 957 | 2 | 0 | 0 | 0 | 7.3 | 0 | 5 | 3 |
Yamato | 119 | 118 | 9.53 | 2.5 | 0 | 42 | 2.44 | 0 | 5 | 1 | 0 | 98.4 | 183 | false | 254 | 0 | 22 | 45.7 | 0 | 841 | 2 | 0 | 0 | 0 | 8.3 | 0 | 5 | 3 |
Vindicta | 116 | 68.3 | 21.8 | 5.82 | 28 | 22 | 2.91 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 889 | 0.8 | 22 | 64 | 0 | 770 | 2 | 0 | 0 | 0 | 9 | 0 | 5 | 2 |
Ivy | 128 | 62.2 | 8.96 | 14.3 | 0 | 33 | 2.44 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 572 | 0.8 | 22 | 57.5 | 0 | 935 | 2 | 0 | 0 | 0 | 7.3 | 0 | 5 | 4 |
Lash | 103 | 68.7 | 16.8 | 4 | 0 | 29 | 2.35 | 0 | 1 | 3 | 0.08 | 92.4 | 170 | false | 635 | 0.8 | 22 | 57.5 | 0 | 1010 | 2 | 0 | 15 | 0 | 7.3 | 1 | 5 | 3 |
Mo & Krill | 128 | 71.8 | 5.76 | 5.56 | 0 | 20 | 2.82 | 0 | 4 | 1 | 0 | 92.4 | 170 | false | 320 | 0.8 | 22 | 57.5 | 0 | 1180 | 3 | 0 | 0 | -20 | 8.1 | 0 | 5 | 3 |
Shiv | 105 | 68.3 | 9.16 | 1.9 | 0 | 10 | 2.8 | 0 | 6 | 1 | 0 | 92.4 | 170 | false | 610 | 0.8 | 19.8 | 41.1 | 0 | 985 | 2 | 0 | 0 | 0 | 7 | 0 | 5 | 3 |
118 | 78.3 | 8.46 | 2 | 0 | 11 | 2.82 | 0 | 7 | 1 | 0 | 104 | 161 | false | 559 | 0.8 | 16 | 45.7 | 0 | 891 | 2 | 0 | -15 | 0 | 7.3 | 0 | 5 | 3 | |
Kelvin | 115 | 68 | 28.7 | 4 | 0 | 15 | 2.59 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 254 | 0.3 | 22 | 57.5 | 0 | 1150 | 2 | 0 | 10 | 0 | 6.8 | 0 | 5 | 3 |
Infernus | 97.1 | 50.5 | 9.71 | 10 | 0 | 27 | 2.49 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 660 | 0.8 | 22 | 57.5 | 0 | 963 | 2 | 0 | 0 | 0 | 6.8 | 0 | 5 | 3 |
Viscous | 105 | 64.3 | 20.9 | 5 | 0 | 20 | 2.5 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 254 | 0 | 22 | 57.5 | 0 | 968 | 2 | 0 | 0 | 0 | 7.3 | 0 | 5 | 3 |
Paradox | 96.4 | 63.7 | 12.2 | 3.57 | 0 | 40 | 2.59 | 0 | 1 | 5 | 0.07 | 92.4 | 170 | false | 525 | 0.1 | 22 | 57.5 | 0 | 990 | 2 | 0 | 0 | 0 | 6.8 | 0 | 5 | 3 |
McGinnis | 54.8 | 43.8 | 11 | 5 | 0 | 66 | 3.29 | 0 | 1 | 1 | 0 | 92.4 | 170 | false | 533 | 0.8 | 22 | 57.5 | 0 | 1000 | 2 | 15 | 0 | 0 | 6.8 | 0 | 5 | 2 |
Localizable values
Localizable values as of writing this:
- Lore
- Playstyle
- Role
- WeaponDescription
- WeaponName
- elements in WeaponTypes
- elements in RecommendedItems