Template:Money: Difference between revisions

From FHX Wiki
(Created page with "<noinclude> This is the "Money" template. It should be transcluded in the following format: <pre> {{Money |value= }} </pre> The input value is separated into the 3 different currencies as follow: <pre> pp = Math.floor(value / 10000); gp = Math.floor((value - pp * 10000) / 100); cp = value - pp * 10000 - gp * 100; </pre> </noinclude> <templatestyles src="Money/styles.css" /> <div class="root"> {{#expr: 1/3 round 5 }} https://cdn.fhxrestoration.com/common/interface/icons/...")
 
No edit summary
 
(19 intermediate revisions by 2 users not shown)
Line 5: Line 5:
{{Money
{{Money
|value=
|value=
|showZeros=
|showSum=
}}
}}
</pre>
</pre>
Line 13: Line 15:
cp = value - pp * 10000 - gp * 100;
cp = value - pp * 10000 - gp * 100;
</pre>
</pre>
 
</noinclude><templatestyles src="Money/styles.css" /><span class="template_money">{{#ifexpr: {{{showZeros|1}}} or floor({{{value|0}}} / 10000) > 0|{{#expr: floor({{{value|0}}} / 10000)}} [[File:coins_pp.gif|link=]]}} {{#ifexpr: {{{showZeros|1}}} or floor(({{{value|0}}} - floor({{{value|0}}} / 10000) * 10000) / 100) > 0|{{#expr: floor(({{{value|0}}} - floor({{{value|0}}} / 10000) * 10000) / 100)}} [[File:coins_gp.gif|link=]]}} {{#ifexpr: {{{showZeros|1}}} or floor({{{value|0}}} - floor({{{value|0}}} / 10000) * 10000 - floor(({{{value|0}}} - floor({{{value|0}}} / 10000) * 10000) / 100) * 100) > 0|{{#expr: floor({{{value|0}}} - floor({{{value|0}}} / 10000) * 10000 - floor(({{{value|0}}} - floor({{{value|0}}} / 10000) * 10000) / 100) * 100)}} [[File:coins_cp.gif|link=]] }}{{#ifexpr: {{{showSum|1}}}|&nbsp;({{{value|0}}})}}</span>
</noinclude>
<templatestyles src="Money/styles.css" />
<div class="root">
{{#expr: 1/3 round 5 }} https://cdn.fhxrestoration.com/common/interface/icons/coins_pp.gif
{{#expr: 1/3 round 5 }} https://cdn.fhxrestoration.com/common/interface/icons/coins_gp.gif
{{#expr: 1/3 round 5 }} https://cdn.fhxrestoration.com/common/interface/icons/coins_cp.gif
</div>

Latest revision as of 03:18, 10 July 2024

This is the "Money" template. It should be transcluded in the following format:

{{Money
|value=
|showZeros=
|showSum=
}}

The input value is separated into the 3 different currencies as follow:

pp = Math.floor(value / 10000);
gp = Math.floor((value - pp * 10000) / 100);
cp = value - pp * 10000 - gp * 100;

0 0 0  (0)