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
Line 14: Line 14:
</pre>
</pre>


'''Example with 998877:'''
</noinclude>
</noinclude>
<templatestyles src="Money/styles.css" />
<templatestyles src="Money/styles.css" />
<div class="root">
<span class="root">
{{#expr: 1/3 round 5 }} https://cdn.fhxrestoration.com/common/interface/icons/coins_pp.gif
{{#expr: floor({{{value | 998877}}} / 10000)}} 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: floor(({{{value | 998877}}} - floor({{{value | 998877}}} / 10000) * 10000) / 100)}} 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
{{#expr: {{{value | 998877}}} - floor({{{value | 998877}}} / 10000) * 10000 - floor(({{{value | 998877}}} - floor({{{value | 998877}}} / 10000) * 10000) / 100) * 100}} https://cdn.fhxrestoration.com/common/interface/icons/coins_cp.gif
</div>
</span>

Revision as of 10:15, 9 June 2024

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

{{Money
|value=
}}

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;

Example with 998877:

99 coins_pp.gif 88 coins_gp.gif 77 coins_cp.gif