Template:ResourceHelper: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
   | {{resource|{{#lvar: type}}|count={{#lvar: count}}}}
   | {{resource|{{#lvar: type}}|count={{#lvar: count}}}}
   | {{resource|{{#lvar: type}}}}
   | {{resource|{{#lvar: type}}}}
}}{{#ifeq: {{#lvar: type}}|action|[[Category:Actions]]}}{{#ifeq: {{#lvar: type}}|bonus|[[Category:Bonus actions]]}}{{#ifeq: {{#lvar: type}}|reaction|[[Category:Reactions]]}}{{#ifeq: {{#lvar: type}}|movement|[[Category:Movement-expending actions]]}}</includeonly><noinclude>
}}{{#switch: {{{this is an example|}}}
| yes =
| #default = {{#switch: {{#lvar: type}}
  | bonus = [[Category:Bonus actions]]
  | movement = [[Category:Movement-expending actions]]
  | reaction = [[Category:Reactions]]
  | action = [[Category:Actions]]  
  | #default =
  }}}}</includeonly><noinclude>
=What is this?=
=What is this?=
This is a wrapper around [[Template:Resource]] to work better in conjunction with [[Module:ParseList]] specifically by [[Template:ResourceList]].
This is a wrapper around [[Template:Resource]] to work better in conjunction with [[Module:ParseList]] specifically by [[Template:ResourceList]].
Line 24: Line 32:
! Input
! Input
|-
|-
|{{ResourceHelper|ki}}||<pre>{{ResourceHelper|ki}}</pre>
|{{ResourceHelper|ki|this is an example=yes}}||<pre>{{ResourceHelper|ki}}</pre>
|-
|-
|{{ResourceHelper|ki:5}}||<pre>{{ResourceHelper|ki:5}}</pre>
|{{ResourceHelper|ki:5|this is an example=yes}}||<pre>{{ResourceHelper|ki:5}}</pre>
|-
|-
|{{ResourceHelper|movement:30}}||<pre>{{ResourceHelper|movement:30}}</pre>
|{{ResourceHelper|movement:30|this is an example=yes}}||<pre>{{ResourceHelper|movement:30}}</pre>
|-
|-
| {{#invoke: ParseList | main | action, ki:3 | useTemplate = ResourceHelper }}
| <pre>{{#invoke: ParseList | main | action, ki:3 | useTemplate = ResourceHelper }}</pre>
|-
| {{#invoke: ParseList | main
  | bonus, movement:10 | useTemplate = ResourceHelper
}}
| <pre>
{{#invoke: ParseList | main
  | bonus, movement:10 | useTemplate = ResourceHelper
}}
</pre>
|}
|}
</noinclude>
</noinclude>

Revision as of 08:53, 22 November 2023

What is this?

This is a wrapper around Template:Resource to work better in conjunction with Module:ParseList specifically by Template:ResourceList.

Optional parameters like cost=3 do not work when applying a template to a list with ParseList, so this template enables an alternative syntax that can be used with ParseList.

Usage

{{ResourceHelper | <type>:[count]}}


<> Denotes mandatory parameters, [] denotes optional parameters.

Refer to Template:Resource for a list of the handled resource types.

Examples

Output Input
Ki Point
{{ResourceHelper|ki}}
5Ki Points
{{ResourceHelper|ki:5}}
(ERROR: Use movement m or movement ft.)Movement
{{ResourceHelper|movement:30}}