Template:GrowthTime: Difference between revisions

no edit summary
(add concise param 2 option. Note: template does not currently handle translating into days > 1)
No edit summary
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
<includeonly><span id="nametemplate" style="font-weight: bold;" class="no-wrap" data-sort-value="{{#ifeq:{{{sortkey}}}|||{{#ifeq:{{{sortkey|true}}}|true|{{#iferror:{{#expr:{{{1|0}}}>1}}|0|{{#expr:{{{1|}}}}}}}|{{{sortkey}}}}}}}">{{#iferror:{{#expr:{{{1|0}}}>1}}|{{{1|}}}|[[File:Ingredients.png|24px|link=]] {{#switch:{{#expr: floor({{{1|}}} / 60) }}
<includeonly><span id="nametemplate" style="font-weight: bold;" class="no-wrap" data-sort-value="{{#ifeq:{{{sortkey}}}|||{{#ifeq:{{{sortkey|true}}}|true|{{#iferror:{{#expr:{{{1|0}}}>1}}|0|{{#expr:{{{1|}}}}}}}|{{{sortkey}}}}}}}">{{#iferror:{{#expr:{{{1|0}}}>1}}|{{{1|}}}|[[File:Menu_Icon_Ingredients.png|24px|link=]] {{#switch:{{#expr: floor({{{1|}}} / 60) }}
   |0=
   |0=
   |1=1 {{#ifeq:{{{2|}}}|concise|h|hour}}
   |1=1 {{#ifeq:{{{2|}}}|concise|h|hour}}
Line 7: Line 7:
   |1=1 {{#ifeq:{{{2|}}}|concise|m|min}}
   |1=1 {{#ifeq:{{{2|}}}|concise|m|min}}
   |#default= {{#expr: {{{1|}}} mod 60 }} {{#ifeq:{{{2|}}}|concise|m|min}}}}}}</span></includeonly><noinclude>
   |#default= {{#expr: {{{1|}}} mod 60 }} {{#ifeq:{{{2|}}}|concise|m|min}}}}}}</span></includeonly><noinclude>
<!--{{{{FULLPAGENAME}}/doc}}-->
==Description==
This template is used to insert an ingredient icon inline with a growth time for crops and fruits.
This template allows the time to be rendered in a friendly, human-readable way, but maintains the value so that it can be sorted in tables. It also standardizes the formatting of displaying time across the wiki, which makes it easier to maintain.
The template does not currently properly handle use cases where growthTime is greater than 1440 minutes (1 day), as there are no in-game items that exceed this growth time.
==Usage==
In its most basic form, this template can be used by entering the following onto a relevant page:
<pre>{{growthTime|<<number of minutes>>}}</pre>
There is also the optional parameter <code>concise</code> that can be added:
<pre>{{growthTime|<<number of minutes>>|concise}}</pre>
'''concise''' is intended for use in cases where the information is used in a large, information-heavy table, whereas the default setting is appropriate for an '''''infoBox''''' template.
==Examples==
<pre>{{growthTime|20}}</pre>
results in...
{{growthTime|20}}
<pre>{{growthTime|135|concise}}</pre>
results in...
{{growthTime|135|concise}}


'''Sortable Table Example:'''
{| class='wikitable sortable' id='recipe-table'
{| class='wikitable sortable' id='recipe-table'
!Name
!Name
Line 14: Line 45:
|-
|-
|Crop 1
|Crop 1
|{{time|90}}
|{{growthTime|90}}
|{{time|{{#expr:90*.9}}}}
|{{growthTime|{{#expr:90*.9}}}}
|-
|-
|Crop 2
|Crop 2
|{{time|20}}
|{{growthTime|20}}
|{{time|{{#expr:20*.9}}|concise}}
|{{growthTime|{{#expr:20*.9}}|concise}}
|-
|-
|Crop 3
|Crop 3
|{{time|307|concise}}
|{{growthTime|307|concise}}
|{{time|{{#expr:307*.9}}}}
|{{growthTime|{{#expr:307*.9}}}}
|-
|-
|Crop 4
|Crop 4
|{{time|60}}
|{{growthTime|60}}
|{{time|{{#expr:60*.9}}}}
|{{growthTime|{{#expr:60*.9}}}}
|-
|-
|Crop 5
|Crop 5
|{{time|1441|concise}}
|{{growthTime|1441|concise}}
|{{time|{{#expr:1441*.9}}}}
|{{growthTime|{{#expr:1441*.9}}}}
|-
|-
|Crop 6
|Crop 6
|{{time|2881}}
|{{growthTime|2881}}
|{{time|{{#expr:2881*.9}}}}
|{{growthTime|{{#expr:2881*.9}}}}
|}
|}
<!--{{{{FULLPAGENAME}}/doc}}-->
 
 
[[Category:Formatting templates]]</noinclude>
[[Category:Formatting templates]]</noinclude>