Template:Coin

From Terraria Wiki
Jump to navigation Jump to search
This template is i18n-ready, which means it is easy to localize for different languages. Please see I18n & l10n for templates to learn more.
See Template:Coin/l10n for the localization of this template.
Template-info.svg Documentation The documentation below is transcluded from Template:Coin/doc. (edit | history)

This template is used as a standardized way to display formatted coin values.

Usage

There are 2 API styles:

Style A

{{ coin | <Platinum Coins> (optional) | <Gold Coins> (optional) | <Silver Coins> (optional) | <Copper Coins> }}

Example: {{ coin | 1 | 0 | 30 }} means 1 Gold 30 Copper Coins.

Style B

{{ coin | <Platinum Coins>pc (optional) <Gold Coins>gc (optional) <Silver Coins>sc (optional) <Copper Coins>cc (optional) }}

Examples: {{ coin | 1gc30cc }} means 1 Gold 30 Silver Coins; {{ coin | 1.25gc }} means 1 Gold 25 Silver Coins.

Spacing and capitalization is ignored.

Other parameters

round

Digit to round the combined value to; default is 2. Can also be negative, and can be used with all API styles.

Examples

Code Result
{{coin|30}} 30 CC
{{coin|1|30}} 1 SC30 CC
{{coin|1|1}} 1 SC1 CC
{{coin|1sc}} 1 SC
{{coin|10gc}} 10 GC
{{coin|10000cc}} 1 GC
{{coin|1000000}} 1 PC
{{coin|0}} 0 CC
{{coin|3|1|30}} 3 GC1 SC30 CC
{{coin|3|0|1|30}} 3 PC1 SC30 CC
{{coin|0|1|0|30}} 1 GC30 CC
{{coin|1.30gc}} 1 GC30 SC
{{coin|12 gc 80cc}} 12 GC80 CC
{{coin|12cc 80gc}} 80 GC12 CC
{{coin|130 SC}} 1 GC30 SC
{{coin|1.5gc130sc}} 2 GC80 SC
{{coin|1.0130gC}} 1 GC1 SC30 CC
{{coin|10130pc88gc66cc}} 10,130 PC88 GC66 CC
{{coin|32sc 57.8741cc}} 32 SC57.87 CC
{{coin|32sc 57.8741cc|round=3}} 32 SC57.874 CC
{{coin|32sc 57.8741cc|round=1}} 32 SC57.9 CC
{{coin|32sc 57.8741cc|round=0}} 32 SC58 CC
{{coin|32sc 57.8741cc|round=-1}} 32 SC60 CC
{{coin|32sc 54.9781cc|round=-1}} 32 SC50 CC
{{coin|32sc 57.8741cc|round=-2}} 33 SC
{{coin|14pc 56gc 32sc 57.8741cc|round=-6}} 15 PC
{{coin|14pc 56gc 32sc 57.8741cc|round=-7}} 10 PC
{{coin|14pc 56gc 32sc 57.8741cc|round=-8}} 0 CC
{{coin|54pc 56gc 32sc 57.8741cc|round=-8}} 100 PC

Note

  • This template is table-sorting-friendly (needs data-sort-type="number" in header). See the example table above or here.
  • It is only designed for positive numbers – negative values as input may lead to unexpected results.

See Also

Other templates for displaying formatted currency values: