Owl.png Wiki reading hard on the eyes? Try out our Dark Theme! Visit the preferences page while logged in and select Hydra Dark. Owl.png

Template:Coin/doc

From Terraria Wiki
Jump to: navigation, search

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

Usage[edit source]

There are 2 API styles:

Style A[edit source]

{{ 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[edit source]

{{ 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[edit source]

round

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

Examples[edit source]

Code Result
{{coin|30}} 30*30
{{coin|1|30}} 130*130
{{coin|1|1}} 101*11
{{coin|1sc}} 100*1
{{coin|10gc}} 100000*10
{{coin|10000cc}} 10000*1
{{coin|1000000}} 1000000*1
{{coin|0}} 0*0
{{coin|3|1|30}} 30130*3130
{{coin|3|0|1|30}} 3000130*3130
{{coin|0|1|0|30}} 10030*130
{{coin|1.30gc}} 13000*130
{{coin|12 gc 80cc}} 120080*1280
{{coin|12cc 80gc}} 800012*8012
{{coin|130 SC}} 13000*130
{{coin|1.5gc130sc}} 28000*280
{{coin|1.0130gC}} 10130*1130
{{coin|10130pc88gc66cc}} 10130880066*10,1308866
{{coin|32sc 57.8741cc}} 3257.87*3257.87
{{coin|32sc 57.8741cc|round=3}} 3257.874*3257.874
{{coin|32sc 57.8741cc|round=1}} 3257.9*3257.9
{{coin|32sc 57.8741cc|round=0}} 3258*3258
{{coin|32sc 57.8741cc|round=-1}} 3260*3260
{{coin|32sc 54.9781cc|round=-1}} 3250*3250
{{coin|32sc 57.8741cc|round=-2}} 3300*33
{{coin|14pc 56gc 32sc 57.8741cc|round=-6}} 15000000*15
{{coin|14pc 56gc 32sc 57.8741cc|round=-7}} 10000000*10
{{coin|14pc 56gc 32sc 57.8741cc|round=-8}} 0*0
{{coin|54pc 56gc 32sc 57.8741cc|round=-8}} 100000000*100

Note[edit source]

  • 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.