Template:Cost: Difference between revisions

From Heroes of Might and Magic: Olden Era Official Wiki
No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
-->{{#if:{{{gold|}}}|&nbsp;{{{gold}}}{{Gold|{{{lang|en}}}}}|}}<!--
-->{{#ifexpr: 0{{{gold|}}}=0    || <span style="white-space:nowrap;"> {{{gold}}}{{Gold|{{{lang|en}}}}}</span>}}<!--
-->{{#if:{{{wood|}}}|&nbsp;{{{wood}}}{{Wood|{{{lang|en}}}}}|}}<!--
-->{{#ifexpr: 0{{{wood|}}}=0    || <span style="white-space:nowrap;"> {{{wood}}}{{Wood|{{{lang|en}}}}}</span>}}<!--
-->{{#if:{{{ore|}}}|&nbsp;{{{ore}}}{{Ore|{{{lang|en}}}}}|}}<!--
-->{{#ifexpr: 0{{{ore|}}}=0      || <span style="white-space:nowrap;"> {{{ore}}}{{Ore|{{{lang|en}}}}}</span>}}<!--
-->{{#if:{{{gems|}}}|&nbsp;{{{gems}}}{{Gems|{{{lang|en}}}}}|}}<!--
-->{{#ifexpr: 0{{{gems|}}}=0    || <span style="white-space:nowrap;"> {{{gems}}}{{Gems|{{{lang|en}}}}}</span>}}<!--
-->{{#if:{{{crystals|}}}|&nbsp;{{{crystals}}}{{Crystals|{{{lang|en}}}}}|}}<!--
-->{{#ifexpr: 0{{{crystals|}}}=0 || <span style="white-space:nowrap;"> {{{crystals}}}{{Crystals|{{{lang|en}}}}}</span>}}<!--
-->{{#if:{{{mercury|}}}|&nbsp;{{{mercury}}}{{Mercury|{{{lang|en}}}}}|}}<!--
-->{{#ifexpr: 0{{{mercury|}}}=0  || <span style="white-space:nowrap;"> {{{mercury}}}{{Mercury|{{{lang|en}}}}}</span>}}<!--
-->{{#if:{{{dust|}}}|&nbsp;{{{dust}}}{{Dust|{{{lang|en}}}}}|}}<!--
-->{{#ifexpr: 0{{{dust|}}}=0    || <span style="white-space:nowrap;"> {{{dust}}}{{Dust|{{{lang|en}}}}}</span>}}<!--
-->{{#if:{{{graal|}}}|&nbsp;{{{graal}}}{{Graal|{{{lang|en}}}}}|}}<!--
-->{{#ifexpr: 0{{{graal|}}}=0    || <span style="white-space:nowrap;"> {{{graal}}}{{Graal|{{{lang|en}}}}}</span>}}<!--
-->{{#if:{{{gold|}}}{{{wood|}}}{{{ore|}}}{{{gems|}}}{{{crystals|}}}{{{mercury|}}}{{{dust|}}}{{{graal|}}}||—}}<!--
-->{{#ifexpr: 0{{{gold|}}}{{{wood|}}}{{{ore|}}}{{{gems|}}}{{{crystals|}}}{{{mercury|}}}{{{dust|}}}{{{graal|}}}=0|—|}}<!--
################################################################################
################################################################################
--></includeonly><noinclude>
--></includeonly><noinclude>
Line 37: Line 37:


----
----
4. No cost
4. No cost:


{{Color|yellow|Input:}} <code><nowiki>{{Cost}}</nowiki></code>
{{Color|yellow|Input:}} <code><nowiki>{{Cost}}</nowiki></code>


{{Color|lime|Output:}} {{Cost}}
{{Color|lime|Output:}} {{Cost}}
----
5. Cost {{b|zero}} or cost {{b|empty string}} should omit that resource entirely:
{{Color|yellow|Input:}} <code><nowiki>{{Cost|gold=100|wood=|ore=0}}</nowiki></code>
{{Color|lime|Output:}} {{Cost|gold=100|wood=|ore=0}}


</noinclude>
</noinclude>

Latest revision as of 06:23, 15 July 2026


Renders the value and currency icon of a cost in resources, supporting various combinations.

Usage

1. One:

Input: {{Cost|gold=100|lang=en}}

Output: 100Gold


2. All:

Input: {{Cost|gold=100|wood=10|ore=10|gems=10|crystals=10|mercury=10|dust=10|graal=10|lang=en}}

Output: 100Gold 10Wood 10Ore 10Gems 10Crystals 10Mercury 10Alchemical Dust 10Grail


3. Japanese:

Input: {{Cost|gold=100|wood=10|ore=10|gems=10|crystals=10|mercury=10|dust=10|graal=10|lang=ja}}

Output: 100ゴールド 10木材 10鉱石 10宝石 10クリスタル 10水銀 10錬金術の塵 10聖杯


4. No cost:

Input: {{Cost}}

Output: —


5. Cost zero or cost empty string should omit that resource entirely:

Input: {{Cost|gold=100|wood=|ore=0}}

Output: 100Gold