FANDOM


[edit] Template-info Template documentation
Ambox content This template is used on 2,600+ pages.
To avoid any disruptions and to save server load, any changes should first be tested in this template's /sandbox or /testcases subpage, or in your own user space. The tested changes can then be added in one single edit to this template. As a courtesy to other users, please discuss any changes at the talk page before implementing them.

This is the {{Currency}} template. It is a metatemplate that provides the functionality for every other in-game currency template of this Wiki in order to provide a consistent apppearance on all pages.

While {{Currency}} is usually called by other templates, it can also be used directly to display currencies on a page, but users may prefer the shorter "first-level" templates listed in the See also section below.

The template can also display real-world currencies if the type is set to ISO 4217 currency codes.

The order of currency symbol and number is preset and follows the in-game or real-world convention, usually symbol → number. Some in-game currencies as well as many real-world currencies use number → symbol, like Asphalt Overdrive Bills (Bills small ao), Asphalt Streetstorm Diamonds (Diamonds small as), Euro (€) or Polish Złoty (zł). The order can be reversed with the order parameter if needed.

Syntax

The syntax is as follows:

{{Currency | type = | <text> | order = }}

Parameters

type

  • Optional. If type is omitted, <text> is displayed with neither symbol nor specific color.
  • Text. Any of the currency names listed in the See also section below or a real-world ISO 4217 currency code.
  • Not case sensitive, i. e. a8credits instead of A8Credits is also valid.
  • Dollar ($) symbols are always displayed with a preceding "AUD", "CAD", "HKD" or "USD" to avoid confusion.
  • Template calls with an unknown currency type will be displayed with a ? question mark.

<text>

  • Optional. If no text is provided, a stand-alone currency icon is displayed.
  • Text. Usually the number that follows the currency symbol.
  • Numbers without thousands separators are automatically formatted (10001,000). Other texts are also accepted.

order

  • Optional. If set to reverse, text and currency symbol are swapped, depending on the preset original order.

Examples

Regular
{{Currency|type=a8credits|1,000}} A8 credits small 1,000
{{Currency|type=ANCreDiTS|1,000}} Credits small an 1,000
{{Currency|type=ancredits|1000|order=reverse}} 1,000 Credits small an
{{Currency|type=aobills|1000}} 1,000 Bills small ao
{{Currency|type=aobills|1000|order=reverse}} Bills small ao 1,000
{{Currency|type=a8tokens|Tokens}} A8 tokens full Tokens
{{Currency|type=a8licenses}} Licenses full a8
{{Currency|1000|type=EUR}} 1,000 
{{Currency|1000|type=TRY}}  1,000
{{Currency|1000|type=TRY|order=reverse}} 1,000 
{{Currency|1000|type=USD}} USD $ 1,000
Other
{{Currency|type=nonsense|1,000}} ? 1,000
{{Currency|1,000 points}} 1,000 points
{{Currency|1,000}} 1,000
{{Currency}}

Handling interpreted characters

Templates have problems to handle parameter data that contains equal signs "=" or vertical bars "|".

For text that includes an equal sign "=", precede the text with 1=. For example:

{{Currency|type=A8Credits|1=2 + 2 = 4}}

Which renders this:

A8 credits small 2 + 2 = 4

For text that includes a vertical bar "|", escape the bar(s) with &#124; or {{!}}. For instance like this:

{{Currency|type=A8Credits|&#124;2&#124; < 3}}

Or like this:

{{Currency|type=A8Credits|{{!}}2{{!}} < 3}}

Which renders this:

A8 credits small |2| < 3

Sorting in tables

Note: This feature is currently disabled because the Fandom mobile view ignores display:none which results in double values displayed on mobile devices.

{{Currency}} adds an invisible leading span with the unformatted value of <text>. Setting the data-sort-type property of a table column to "number" enables sorting by currency values despite any formatting and leading currency icons. Example:

{| class="table-default sortable"
! data-sort-type="number" | Correct sorting by numbers
! Alphabetical sorting
|-
| {{a8credits|300}}
| {{a8credits|300}}
|-
| {{a8credits|30}}
| {{a8credits|30}}
|-
| {{a8credits|200}}
| {{a8credits|200}}
|-
| {{a8credits|2200}}
| {{a8credits|2200}}
|-
| {{a8credits|4000}}
| {{a8credits|4000}}
|}

gives:

Correct sorting by numbers Alphabetical sorting
A8 credits small 300 A8 credits small 300
A8 credits small 30 A8 credits small 30
A8 credits small 200 A8 credits small 200
A8 credits small 2,200 A8 credits small 2,200
A8 credits small 4,000 A8 credits small 4,000

Adding future currencies

{{Currency}} can be expanded for currencies of other Asphalt versions or future events. Please note that currencies on Asphalt Wiki use unique identifiers that are also used for color definitions. For example, the identifier a8tokens for Asphalt 8 Tokens can be used in several ways:

  • {{currency|type=a8tokens|Text}}A8 tokens full Text (displays currency icon with text in currency color)
  • {{a8tokens|Text}}A8 tokens full Text (first-level template, same as above)
  • {{color|a8tokens|Text}}Text (renders text in currency color)
  • {{color code|a8tokens}} → #31f3fa (returns hex code of currency color)

Hence, if a currency is added to the system, a new identifier is needed that will be used for the currency and the color definition. For example, if an Asphalt 8 event introduces the currency "Newcoins", you can add it as follows:

Create a new identifier

Currency and color identifiers start with the two-letter game code, followed by the name.

Create a new color definition

Go to the {{Color code}} template and add a new color definition with the identifier a8newcoins by following the instructions in the "Adding new colors" section.

Upload a new currency icon

Edits in this template

Copy and insert the following line below the INSERT NEW CURRENCIES BELOW THIS LINE comment in the template:

         | a8newcoins =[[File:Newcoins a8.png|{{{size|x13px}}}|text-bottom|link=page|caption]]

a8newcoins

  • The identifier in lower case. Any upper case combinations will be detected automatically.

Newcoins a8.png

  • Filename of the currency icon you have uploaded.

{{{size|x13px}}}

  • Height of the currency icon. Can be left unchanged in most cases.
  • Make sure to edit only the digits between x and px.

text-bottom

  • Vertical alignment. Can be left unchanged in most cases.
  • text-bottom aligns the image with the lowest line of a font defined by the tails, for example the g in image.
  • baseline can be used for very small icons (~ x11px) and aligns the image with the lowest line without tails, for example the m in image.
  • Sometimes, middle fits better.

link=page

  • Pagename the icon links to when clicked.
  • If the currency does not have its own page, the parameter can link to overview pages like Currencies in Asphalt [...]. These pages can be found in Category:Currencies.

caption

  • Caption of the icon that is displayed when the mouse pointer moves over it.

New first-level template

To make it easier for others to use the new currency, a new first-level template named "A8newcoins" can be created by copying the following line into a new template:

<includeonly>{{Currency|type=a8newcoins|{{{1|}}}|order={{lc:{{{2|}}}}}}}</includeonly><noinclude>{{documentation|Template:New currency/doc}}</noinclude>

Users can now type {{A8newcoins|1000}} which behaves exactly like {{A8credits|1000}} or other currency templates.

Parameters:

a8newcoins

  • The identifier in lower case. Everything else has to be left unchanged.

Documentation

  • When you add a new currency, remember to add it to the {{Currency templates see also}} overview.
  • If you haven't already done it while creating the new color definition, also remember to add the color to the {{Asphalt colors}} overview.

See also

Asphalt 7:

Asphalt 8:

Asphalt 9:

Asphalt Nitro:

Asphalt Overdrive:

Asphalt Streetstorm:

Asphalt Xtreme:

General:

  • {{Currency}}, the metatemplate called by all currency templates

</div>

Community content is available under CC-BY-SA unless otherwise noted.