Template:Infobox Recipe: Difference between revisions

m
Add parameters to support fourth raw material
mNo edit summary
m (Add parameters to support fourth raw material)
(24 intermediate revisions by 2 users not shown)
Line 1:
<includeonly>{{#set:<!--
Material1-->{{#if:{{{rawmat1|}}}|{{#set:RawMaterial1={{{rawmat1}}}}}}}<!--
-->{{#if:{{{rawmat2|}}}|{{#set:RawMaterial2={{{rawmat2}}}}}}}<!--
}}<!--
-->{{#if:{{{rawmat3|}}}|{{#set:RawMaterial3={{{rawmat3}}}}}}}<!--
-->{{#if:{{{rawmat4|}}}|{{#set:RawMaterial4={{{rawmat4}}}}}}}<!--
-->{{#vardefine:rawmat1cost|{{#if:{{{rawmat1|}}}|{{formatnum:{{#ask:[[Sold item::{{{rawmat1}}}]]|?Shop buy price=|mainlabel=-|searchlabel=|limit=1|sort=Shop buy price|order=asc}}|R}}|0}}}}<!--
-->{{#vardefine:rawmat2cost|{{#if:{{{rawmat2|}}}|{{formatnum:{{#ask:[[Sold item::{{{rawmat2}}}]]|?Shop buy price=|mainlabel=-|searchlabel=|limit=1|sort=Shop buy price|order=asc}}|R}}|0}}}}<!--
-->{{#vardefine:rawmat3cost|{{#if:{{{rawmat3|}}}|{{formatnum:{{#ask:[[Sold item::{{{rawmat3}}}]]|?Shop buy price=|mainlabel=-|searchlabel=|limit=1|sort=Shop buy price|order=asc}}|R}}|0}}}}<!--
-->{{#vardefine:rawmat4cost|{{#if:{{{rawmat4|}}}|{{formatnum:{{#ask:[[Sold item::{{{rawmat4}}}]]|?Shop buy price=|mainlabel=-|searchlabel=|limit=1|sort=Shop buy price|order=asc}}|R}}|0}}}}<!--
-->{{#vardefine:rawmat2total|0}}<!--
-->{{#vardefine:rawmat3total|0}}<!--
-->{{#vardefine:rawmat4total|0}}<!--
-->{{#vardefine:output1cost|{{#if:{{{output1|}}}|{{formatnum:{{#ask:[[{{{output1}}}]]|?Value=|mainlabel=-}}|R}}|0}}}}
{| class="wikitable"
Line 43 ⟶ 47:
{{!}} style="text-align: right;" {{!}} {{{rawmat3qty|1}}}
{{!}} style="text-align: right;" {{!}} {{Currency|{{#vardefineecho:rawmat3total|{{#expr:{{{rawmat3qty|1}}} * {{#if:{{#var:rawmat3cost}}|{{#var:rawmat3cost}}|0}}}}}}}}
{{!}}-
}}
{{#if:{{{rawmat4|}}}|
{{!}} [[File:{{{rawmat4}}}.png|30px]]
{{!}} [[{{{rawmat4}}}]]
{{!}} style="text-align: right;" {{!}} {{{rawmat4qty|1}}}
{{!}} style="text-align: right;" {{!}} {{Currency|{{#vardefineecho:rawmat4total|{{#expr:{{{rawmat4qty|1}}} * {{#if:{{#var:rawmat4cost}}|{{#var:rawmat4cost}}|0}}}}}}}}
{{!}}-
}}
! colspan="3" | Total Raw cost
| style="text-align: right;" {{!}} {{Currency|{{#vardefineecho:totalcost|{{#expr:{{#varexists:rawmat1total|{{#var:rawmat1total}}|0}} + {{#varexists:rawmat2total|{{#var:rawmat2total}}|0}} + {{#varexists:rawmat3total|{{#var:rawmat3total}}|0}} + {{#varexists:rawmat4total|{{#var:rawmat4total}}|0}}}}}}}}
|-
{{#if:{{{preparedmat1|}}}|
Line 88 ⟶ 99:
! colspan="3" | Profit
| style="text-align: right;" {{!}} {{Currency|{{#expr:{{#var:output1costtotal}} - {{#var:totalcost}}}}}}
}|}<!--
|}</includeonly><noinclude>{{/doc}}</noinclude>
-->{{#set:RawMaterialTotalCost={{formatnum:{{#var:totalcost}}}}}}<!--
|}--></includeonly><noinclude>{{/doc}}</noinclude>
303

edits