Jump to content

Module:HeroData/doc: Difference between revisions

From Deadlock Wiki
Sur (talk | contribs)
initial
 
Sur (talk | contribs)
m reference HeroData/nav and HeroData/release
 
(18 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 ==


This module provides functions to create hero infoboxes or statboxes (and more miscellaneous items).
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 9: Line 14:
See [[Template:Lang]] for more
See [[Template:Lang]] for more


=== 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}}


* '''write_infobox''' – Writes a [[Template:Infobox_hero]] template call for a given hero
* '''write_stat_boxes''' – Writes all 3 [[Template:StatBox]] template calls (Weapon, Vitality, Spirit) for a given hero


=== Parameters ===
Using hero key
Both functions use one parameter.
<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 ===
Writes a [[Template:Infobox_hero]] template call for a given hero
 
====Parameters====
* '''hero_name''' – Name of the hero, in english
* '''hero_name''' – Name of the hero, in english


=== Examples ===
====Example====
From wikitext:<br>
<pre>{{#invoke:HeroData|write_infobox|HERO_NAME}}</pre>


To use this module from wikitext, use
Which outputs
{{#invoke:HeroData|write_infobox|Abrams}}


<pre>{{#invoke:HeroData|write_stat_boxes|HERO_NAME}}</pre>
=== 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:<br>
<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


{{#invoke:HeroData|write_infobox|Abrams}}
====Parameters====
* '''level''' - Number of [[Level]]s / Power Increases
* '''spirit_power''' - Amount of Spirit power


<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
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.
or


<pre>{{#invoke:HeroData|write_infobox|HERO_NAME}}</pre>
====Example====
From wikitext:<br>
<pre>{{#invoke:HeroData|write_hero_comparison_table|LEVEL|SPIRITPOWER}}</pre>


Which outputs
Which outputs
{{#invoke:HeroData|write_hero_comparison_table|11|200}}


{{#invoke:HeroData|write_stat_boxes|Abrams}}
== Localizable values ==
Localizable values as of writing this:
* Lore
* Playstyle
* Role
* WeaponDescription
* WeaponName
* elements in WeaponTypes
* elements in RecommendedItems
}}

Latest revision as of 23:39, 23 November 2024

Module documentation [edit] [purge]

Also see:

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

  • Page - translates to english
  • Page/en - translates to english
  • Page/es - translates to spanish

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

HeroDPSSustained DPSBullet DamageBullets per secFire Rate (%)AmmoReload Time (s)Reload Delay (s)Bullets Per ShotBullets Per BurstTime Between Bursted Bullets (s)Light MeleeHeavy MeleeReload SingleBullet Velocity (m/s)Bullet Gravity ScaleFalloff Start RangeFalloff End RangeBonus Attack Range (m)Rounds Per Second At Max SpinSpin Acceleration (%)Spin Deceleration (%)Max HealthHealth RegenBullet Resist (%)Spirit Resist (%)Crit Reduction (%)Move Speed (m/s)Sprint Speed (m/s)Stamina Cooldown (s)Stamina
Grey Talon11490.962.51.820172.35011092.4170false4950.8185400008692.500011.30.554
Lash92.561.815.140292.350130.0892.4170false6350.82057.500001010201507.31.553
Paradox86.857.410.93.570402.590150.0792.4170false5250.12057.5000099020006.80.553
Haze72.687.27.261001252.35011092.4170false7621.52046000079720008.30.553
Abrams98.157.16.541.67090.3530.70591092.4170true6100.82045.700009441.50006.80.553
Vyper1718110.316.70241.6011092.4170false411012.7330000880200011.60.554
Seven99.666.516.340292.350130.0892.4170false6350.82057.50000891300-3511.70.553
Wraith97.961.18.8111.10522.82011092.4170false57202057.5000089120007.312.553
Calico129633.2250122.5081092.4170false3180.82057.50000100020007.30.553
Warden13773.626.55.7644172.91011092.4170false2900.252057.50000105020006.31.553
Dynamo74.849.118.740182.35011092.4170false3200.82057.500001130210.5006.80.553
Lady Geist86.359.938.82.220132.59011092.4170false8280.82057.50000110010006.3253
Mo & Krill11564.65.185.560202.82041092.4170false3200.82057.500001180300-208.10.553
Mirage74.650.926.12.860162.6011092.4170false8280.82057.5000095720007.30.553
Yamato93.3977.462.50422.44051098.4183false25402045.7000084120008.30.553
Wrecker1257231.240152.75011092.4170false6350.82057.50000100020007.30.553
Shiv87.657.17.671.90102.8061092.4170false6100.819.841.10000985200070.553
THE MAGNIFICENT SINCLAIR947132.920222.50120.192.4170false86.4025.4610000891300011.90.553
Trapper1641037.561.67082.820131092.4170false38101645.70000105020-1507.30.553
Infernus87.445.58.74100272.49011092.4170false6600.82057.5000096320006.80.553
Bebop10069.58.0412.50662.35011092.4170false5080.82050.8851000110031010.506.553.553
Raven72.547.639.91.82092.59011092.4170false8280.82057.5000091320007.30.553
Ivy11555.98.0514.30332.44011079145false5720.82057.5000091020007.30.554
Pocket10770.47.6120112.820710104161false5590.81645.7000084720-1507.30.553
Kelvin10461.425.940152.59011092.4170false2540.32057.500001200201506.80.553
Fathom11061.57.072.220130.30.70571092.4170true5590.81645.7000094620007.30.553
Holliday10263.245.82.220102.75011092.4170false6350.82057.5000091320008.30.552
Viscous94.157.918.850202.5011092.4170false25402057.5000096820007.30.553
Vindicta10260.519.35.8228222.91011092.4170false7400.820640000745200080.552
McGinnis12375.99.8650663.29011092.4170false5900.82057.5012.50.50.251000215006.80.552

Localizable values

Localizable values as of writing this:

  • Lore
  • Playstyle
  • Role
  • WeaponDescription
  • WeaponName
  • elements in WeaponTypes
  • elements in RecommendedItems