Actions

Template

Difference between revisions of "MapPrice"

From P6 Spheres

Line 2: Line 2:
  
 
Returns String where float has been converted to a price:
 
Returns String where float has been converted to a price:
 +
 +
Example: <nowiki>{{MapPrice|free}}</nowiki>: {{MapPrice|free}}
  
 
Example: <nowiki>{{MapPrice|0.0}}</nowiki>: {{MapPrice|0.0}}
 
Example: <nowiki>{{MapPrice|0.0}}</nowiki>: {{MapPrice|0.0}}
Line 12: Line 14:
  
 
Example: <nowiki>{{MapPrice|2500.0}}</nowiki>: {{MapPrice|2500.0}}
 
Example: <nowiki>{{MapPrice|2500.0}}</nowiki>: {{MapPrice|2500.0}}
 +
 +
Example: <nowiki>{{MapPrice|3.33}}</nowiki>: {{MapPrice|5.0}}
 
</noinclude><includeonly><!--
 
</noinclude><includeonly><!--
  
0  -->{{#ifexpr:{{#expr:{{{1|}}} = 0.0}}|—<!--
+
-->{{#if:{{#phptag: if(is_numeric($argv[1])) echo true;}}<!--
  GP -->|{{#ifexpr:{{#expr:{{{1|}}} >= 1.0}}|{{#number_format:{{{1|}}}|0|.|,}} gp<!--
+
 
  SP  -->|{{#ifexpr:{{#expr:{{{1|}}} >= 0.1}}|{{#expr: {{{1|}}} * 10}} sp<!--
+
--><!--{{#expr: floor({{{1|}}})}}
  CP    -->|{{#expr: {{{1|}}} * 100}} cp<!--
+
  0  -->|{{#ifexpr:{{#expr:{{{1|}}} = 0.0}}|—<!--
 +
    GP -->|{{#ifexpr:{{#expr:{{{1|}}} >= 1.0}}|{{#number_format:{{{1|}}}|0|.|,}} gp<!--
 +
    SP  -->|{{#ifexpr:{{#expr:{{{1|}}} >= 0.1}}|{{#expr: {{{1|}}} * 10}} sp<!--
 +
    CP    -->|{{#expr: {{{1|}}} * 100}} cp<!--
 +
        -->}}<!--
 
       -->}}<!--
 
       -->}}<!--
 
     -->}}<!--
 
     -->}}<!--
  -->}}<!--
+
    -->|{{{1|}}}<!--
 
+
  -->}}<!--
 
--></includeonly>
 
--></includeonly>

Revision as of 23:03, 22 March 2020

Accepts Float.

Returns String where float has been converted to a price:

Example: {{MapPrice|free}}: free

Example: {{MapPrice|0.0}}: —

Example: {{MapPrice|0.03}}: 3 cp

Example: {{MapPrice|0.2}}: 2 sp

Example: {{MapPrice|5.0}}: 5 gp

Example: {{MapPrice|2500.0}}: 2,500 gp

Example: {{MapPrice|3.33}}: 5 gp