Difference between revisions of "Template:Weapon Stats Table"

From RimWorld Wiki
Jump to navigation Jump to search
(Recoding is partially done)
(made first header optional. Made all header levels variable. Hopefully made clearer what's going on)
Line 1: Line 1:
<includeonly>== Attack table ==
+
<includeonly>{{#if: {{{no header|}}} || <h{{{header level|2}}}> Attack table </h{{{header|2}}}> }}
{{#ifeq: {{Q|{{#vardefineecho:name| {{{ 1 | {{PAGENAME}} }}} }}|Mode}} | Melee | {{Weapon Quality Table/Melee|{{#var:name}}}}|{{#if: {{Q|{{#var:name}}|Attack 1 Damage}}|=== Ranged ===
+
{{#ifeq: {{Q|{{#vardefineecho:name|{{{1| {{PAGENAME}} }}} }} |Mode}} | Melee
{{Weapon Quality Table/Ranged|{{#var:name}}}}
+
| {{Weapon Quality Table/Melee|{{#var:name}} }}
=== Melee ===
+
| {{#if: {{Q|{{#var:name}}|Attack 1 Damage}}
{{Weapon Quality Table/Melee|{{#var:name}}}}|{{Weapon Quality Table/Ranged|{{#var:name}}}}}}}}</includeonly><noinclude>{{Recode|reason = Remove automatic headers or at least make them optional}}
+
    | <h{{#expr:{{{header level|2}}}+1}}> Ranged </h{{#expr:{{{header level|2}}}+1}}>
 +
      {{Weapon Quality Table/Ranged|{{#var:name}} }}
 +
      <h{{#expr:{{{header level|2}}}+1}}> Melee </h{{#expr:{{{header level|2}}}+1}}>
 +
      {{Weapon Quality Table/Melee|{{#var:name}} }}
 +
    | {{Weapon Quality Table/Ranged|{{#var:name}} }}
 +
  }}
 +
}}</includeonly><noinclude>
 
{{Move|destination=Template:Weapon Attacks Table|reason=This template handles all weapons. Whether they have quality and/or materials or not}}
 
{{Move|destination=Template:Weapon Attacks Table|reason=This template handles all weapons. Whether they have quality and/or materials or not}}
 
 
{{Documentation}}
 
{{Documentation}}
 
</noinclude>
 
</noinclude>

Revision as of 08:59, 19 April 2023

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

Description

This template generates a table summarizing stats for an given weapon, including average damage per second, armor piercing and Market Value, for each quality tier (if applicable) and every stuff option (if applicable).

Note that at the time of writing, weapons with no quality are hardcoded into the template, rather than pulled from the page properties. New no-quality weapons must be manually excepted from the template.

Property:Mode must be set to properly display melee weapons, otherwise it will default to the ranged format.

This template is part of the following system generating tables for all weapons:

Parameters

The first parameter (if present) will specify which weapon to generate the template for. If absent, {{PAGENAME}} will be used.

The no header parameter will disable the top heading, but not the subheadings for ranged and melee attacks, when set to true.

The header level parameter takes numbers and sets the size of the headings - note that top heading is sized by the number directly, with subheading one size smaller. Default value is 2. It can be used with or without no header.

Example usage

{{Weapon Stats Table | Persona monosword}}

Produces:

Attack table

Template:Weapon Quality Table/Melee

{{Weapon Stats Table | Assault rifle|}}

Produces:

Attack table

Ranged

     Template:Weapon Quality Table/Ranged

Melee

     Template:Weapon Quality Table/Melee
{{Weapon Stats Table | Incendiary launcher|}}

Produces:

Attack table

Ranged

     Template:Weapon Quality Table/Ranged

Melee

     Template:Weapon Quality Table/Melee