Template:WeaponCard: Difference between revisions

From Deadlock Wiki
Jump to navigation Jump to search
Sur (talk | contribs)
m {{#var:hero_name}} instead of {{{1}}} (whoops)
Sur (talk | contribs)
m was accidentally using localized name instead of key to pass to subsequent functions, breaking it for langs that use different alphabets. now fixed
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
-->{{#if: {{{key|}}} |<!-- If key is provided, localize it
-->{{#if: {{{key|}}} |<!-- If key is provided
-->{{#vardefine:hero_name|{{#invoke:Lang|get_string|{{{key}}}}}}}<!--
-->{{#vardefine:hero_key_or_en|{{{key}}}}}<!-- key
-->|<!-- If key is not provided, use {{{1}}} and assume its in english where it will be re-localized to current language
-->{{#vardefine:hero_en|{{#invoke:Lang|get_string|{{{key}}}|lang_code_override=en}}}}<!-- en
-->{{#vardefine:hero_name|{{{1}}}}}<!--
-->|<!-- If key is not provided, use {{{1}}} and assume its in english where it will be re-localized to current language in called functions
-->{{#vardefine:hero_key_or_en|{{{1}}}}}<!-- en
-->{{#vardefine:hero_en|{{{1}}}}}<!-- en
-->}}<!--
-->}}<!--
--><div style="display:inline-block; margin: 15px 10px 15px 0px; width:650px; max-width:100%;">
--><div style="display:inline-block; margin: 15px 10px 15px 0px; width:650px; max-width:100%;">
{|- style="text-align:center; background-image: linear-gradient(#180E02, #30220C); border-collapse:collapse; font-size: 16px; font-family: 'PT Serif','Palatino','Georgia',serif;"
{|- style="text-align:center; background-image: linear-gradient(#180E02, #30220C); border-collapse:collapse; font-size: 16px; font-family: 'PT Serif','Palatino','Georgia',serif;"
| style="width:350px; color:#CDBFAB; font-family: 'Retail Demo';" | {{#invoke:Lang|get_string|CitadelHeroStats_Weapon}}
| style="width:350px; color:#CDBFAB; font-family: 'Retail Demo';" | {{#invoke:Lang|get_string|CitadelHeroStats_Weapon}}
| rowspan="3" style="bottom:50px;" | <div style="display:inline-block; position:relative;">{{#ifeq:{{{ph|}}}|true|[[File:Placeholder Weapon.png|320x200px|link=]]|[[File:{{#var:hero_name}} Weapon.png|320x200px|link=]]}} <div style="position:absolute; bottom:0px; right:0px;><div style="position:relative; color:#FFEFD7;">
| rowspan="3" style="bottom:50px;" | <div style="display:inline-block; position:relative;">{{#ifeq:{{{ph|}}}|true|[[File:Placeholder Weapon.png|320x200px|link=]]|[[File:{{#var:hero_en}} Weapon.png|320x200px|link=]]}} <div style="position:absolute; bottom:0px; right:0px;><div style="position:relative; color:#FFEFD7;">
{|- style="background-color:rgba(0, 0, 0, 0.4); width:120px"
{|- style="background-color:rgba(0, 0, 0, 0.4); width:120px"
|colspan="2" style="font-family:'Retail Demo'; |{{#invoke:Lang|get_string|CitadelHeroStats_Weapon_Falloff}}
|colspan="2" style="font-family:'Retail Demo'; |{{#invoke:Lang|get_string|CitadelHeroStats_Weapon_Falloff}}
|-
|-
|style="font-family:'Retail Demo'; font-weight:bold; font-size:14px;"|{{#invoke:HeroData|get_hero_var|{{#var:hero_name}}|FalloffStartRange|2}}{{#invoke:Lang|get_string|StatDesc_WeaponRangeFalloffMin_postfix}} - {{#invoke:HeroData|get_hero_var|{{#var:hero_name}}|FalloffEndRange|2}}{{#invoke:Lang|get_string|StatDesc_WeaponRangeFalloffMax_postfix}}
|style="font-family:'Retail Demo'; font-weight:bold; font-size:14px;"|{{#invoke:HeroData|get_hero_var|{{#var:hero_key_or_en}}|FalloffStartRange|2}}{{#invoke:Lang|get_string|StatDesc_WeaponRangeFalloffMin_postfix}} - {{#invoke:HeroData|get_hero_var|{{#var:hero_key_or_en}}|FalloffEndRange|2}}{{#invoke:Lang|get_string|StatDesc_WeaponRangeFalloffMax_postfix}}
|}
|}
</div>
</div>
</div>
</div>
<div style="position:absolute; top:0px; right:5px; ><div style="position:relative; color:#FFEFD7; font-family:'Retail Demo'; font-weight:bold; font-size:14px;">{{Icon/Brown|[[File:Damage.png|20px|link=Damage per second]]|{{#invoke:HeroData|get_hero_var|{{#var:hero_name}}|DPS|2}} {{#invoke:Lang|get_string|DPS_label}}}}</div> </div>
<div style="position:absolute; top:0px; right:5px; ><div style="position:relative; color:#FFEFD7; font-family:'Retail Demo'; font-weight:bold; font-size:14px;">{{Icon/Brown|[[File:Damage.png|20px|link=Damage per second]]|{{#invoke:HeroData|get_hero_var|{{#var:hero_key_or_en}}|DPS|2}} {{#invoke:Lang|get_string|DPS_label}}}}</div> </div>
</div>
</div>
|-
|-
| style="text-align:center; font-family: 'Retail Demo'; font-weight:bold; color:#FFEFD7; height:20px; font-size:25px; line-height:8px;" | {{#invoke:HeroData|get_hero_var|{{#var:hero_name}}|WeaponName|true}}
| style="text-align:center; font-family: 'Retail Demo'; font-weight:bold; color:#FFEFD7; height:20px; font-size:25px; line-height:8px;" | {{#invoke:HeroData|get_hero_var|{{#var:hero_key_or_en}}|WeaponName|true}}
|-
|-
|
|
{| style="text-align:center; color:#FFEFD7; font-family:'Retail Demo'; font-weight:bold; font-size:15px; background-color:#1B160C; border-radius:15px; margin:auto;"
{| style="text-align:center; color:#FFEFD7; font-family:'Retail Demo'; font-weight:bold; font-size:15px; background-color:#1B160C; border-radius:15px; margin:auto;"
| <span style="margin-left:5px">{{#invoke:HeroData|get_list_elem|{{#var:hero_name}}|WeaponTypes|1|true}}</span>
| <span style="margin-left:5px">{{#invoke:HeroData|get_list_elem|{{#var:hero_key_or_en}}|WeaponTypes|1|true}}</span>
| style="background-color:rgba(0, 0, 0, 0); width:20px;"|
| style="background-color:rgba(0, 0, 0, 0); width:20px;"|
| {{#invoke:HeroData|get_list_elem|{{#var:hero_name}}|WeaponTypes|2|true}}
| {{#invoke:HeroData|get_list_elem|{{#var:hero_key_or_en}}|WeaponTypes|2|true}}
{{#if:{{#invoke:HeroData|get_list_elem|{{#var:hero_name}}|WeaponTypes|3|true}}
{{#if:{{#invoke:HeroData|get_list_elem|{{#var:hero_key_or_en}}|WeaponTypes|3|true}}
|<td style="background-color:rgba(0, 0, 0, 0); width:20px;"></td>
|<td style="background-color:rgba(0, 0, 0, 0); width:20px;"></td>
<td> <span style="margin-right:5px">{{#invoke:HeroData|get_list_elem|{{#var:hero_name}}|WeaponTypes|3|true}}</span></td>
<td> <span style="margin-right:5px">{{#invoke:HeroData|get_list_elem|{{#var:hero_key_or_en}}|WeaponTypes|3|true}}</span></td>
|}}
|}}
|}
|}
|-
|-
| colspan="2" style="background-color:#4A3617; color:#FFEFD7; height:40px; font-family:'Retail Demo'; font-size:14px; text-align:left;"> |<span style="margin-left:10px;">{{#invoke:HeroData|get_hero_var|{{#var:hero_name}}|WeaponDescription|true}}</span>
| colspan="2" style="background-color:#4A3617; color:#FFEFD7; height:40px; font-family:'Retail Demo'; font-size:14px; text-align:left;"> |<span style="margin-left:10px;">{{#invoke:HeroData|get_hero_var|{{#var:hero_key_or_en}}|WeaponDescription|true}}</span>
|}
|}
</div></includeonly><noinclude>{{Documentation}}</noinclude>
</div></includeonly><noinclude>{{Documentation}}</noinclude>

Revision as of 01:54, 15 October 2024

Template documentation [view] [edit] [history] [purge]

Usage

This template displays weapon stats.

Recommended to use key parameter for hero key instead of an unnamed 1st parameter of the english hero name. This allows localizing it to the current language in O(1) time complexity, as opposed to O(N).

Examples

{{WeaponCard|Dynamo}}
{{WeaponCard|key=hero_forge}}
Weapon Stats
Falloff Range
22m - 58m
52 DPS
The Vonnegun
Medium Range Heavy Hitter Projectile
Weapon Stats
Falloff Range
22m - 58m
36 DPS
Services Rendered
Rapid Fire Medium Range
Increases fire rate as the guns spins up

No description.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
11

no description

Unknownoptional
keykey

no description

Unknownoptional
phph

no description

Unknownoptional