Editing
Module:HeroData/doc
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Documentation|contents= == 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:<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 === Writes a [[Template:Infobox_hero]] template call for a given hero ====Parameters==== * '''hero_name''' β Name of the hero, in english ====Example==== From wikitext:<br> <pre>{{#invoke:HeroData|write_infobox|HERO_NAME}}</pre> Which outputs {{#invoke:HeroData|write_infobox|Abrams}} === 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 {{#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> <pre>{{#invoke:HeroData|write_hero_comparison_table|LEVEL|SPIRITPOWER}}</pre> Which outputs {{#invoke:HeroData|write_hero_comparison_table|11|200}} == Localizable values == Localizable values as of writing this: * Lore * Playstyle * Role * WeaponDescription * WeaponName * elements in WeaponTypes * elements in RecommendedItems }}
Summary:
Please note that all contributions to Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Deadlock:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Templates used on this page:
Data:AttributeData.json
(
edit
)
Data:Dictionary
(
edit
)
Data:HeroData.json
(
edit
)
Data:LangCodes.json
(
edit
)
Data:Lang en.json
(
edit
)
Data:StatInfoboxOrder.json
(
edit
)
Template:Documentation
(
edit
)
Template:HeroIcon
(
edit
)
Template:Ls
(
edit
)
Template:MissingValveTranslationTooltip
(
edit
)
Template:Ss
(
edit
)
Template:Tooltip
(
edit
)
Module:AttributeData
(
edit
)
Module:Dictionary
(
edit
)
Module:HeroData
(
edit
)
Module:Lang
(
edit
)
Module:Utilities
(
edit
)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Discord community
Recent changes
Random page
Tools
What links here
Related changes
Special pages
Page information
Languages