Difference between revisions of "Template:BoM"

From ChatWars Wiki
Jump to: navigation, search
(formatting fix)
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#vardefine: recipeSource | {{{source|{{ReplaceNumericCharEncoding|string={{PAGENAME}} }} }}} }}{{#vardefine: outputMode | {{{mode|all}}} }}<!--
+
{{#vardefine: recipeSource | {{{source|{{ReplaceNumericCharEncoding|string={{PAGENAME}} }} }}} }}{{#vardefine: outputMode | {{{mode|all}}} }}{{#vardefine: incomplete | {{#show: {{#var: recipeSource}} | ?BoolRecipeIncomplete }} }}<!--
 
-->{{#vardefine: resourceList|}}<includeonly><!--
 
-->{{#vardefine: resourceList|}}<includeonly><!--
 
--><div class="mw-collapsible mw-collapsed" style="width: 15%; overflow: visible;" data-expandtext="Show BoM" data-collapsetext="Hide BoM">
 
--><div class="mw-collapsible mw-collapsed" style="width: 15%; overflow: visible;" data-expandtext="Show BoM" data-collapsetext="Hide BoM">
Line 19: Line 19:
 
}}<!--
 
}}<!--
  
Tree style list of resources + intermediate steps-->
+
Tree style list of resources + intermediate steps-->{{#ifeq: {{#var: incomplete}} | true | <br>''ATTENTION: Recipe and thus Bill of Materials is incomplete!''<br> }}
 
{{#switch: {{#var: outputMode}}
 
{{#switch: {{#var: outputMode}}
 
   | tree | all = {{#var: outputBuffer}}
 
   | tree | all = {{#var: outputBuffer}}
Line 67: Line 67:
  
  
<!--          -->Basic resources sum:<!--
+
<!--          -->Basic resources sum:<br><!--
               -->{{#vardefine: n | 0 }}
+
               -->{{#vardefine: n | 0 }}<!--
                {{#while:
+
              -->{{#while:
 
                   | {{#ifexpr: {{#var: n}} < {{#arraysize: neededBasicResources}} | true }}
 
                   | {{#ifexpr: {{#var: n}} < {{#arraysize: neededBasicResources}} | true }}
 
                   | {{#arrayindex: neededQuantities | {{#var: n}} }}x [[{{#arrayindex: neededBasicResources | {{#var: n}} }}]]<br>
 
                   | {{#arrayindex: neededQuantities | {{#var: n}} }}x [[{{#arrayindex: neededBasicResources | {{#var: n}} }}]]<br>
Line 75: Line 75:
 
                 }}<!--
 
                 }}<!--
 
               -->[[Mana]] Cost: {{#expr: {{#var: totalMana}} + {{#show: {{#var: recipeSource}} |?ManaCrafting}} }}{{Emoticon|emoticon=Mana}} (Ingredients: {{#var: totalMana}}{{Emoticon|emoticon=Mana}} / Item: {{#show: {{#var: recipeSource}} |?ManaCrafting}}{{Emoticon|emoticon=Mana}})<br>
 
               -->[[Mana]] Cost: {{#expr: {{#var: totalMana}} + {{#show: {{#var: recipeSource}} |?ManaCrafting}} }}{{Emoticon|emoticon=Mana}} (Ingredients: {{#var: totalMana}}{{Emoticon|emoticon=Mana}} / Item: {{#show: {{#var: recipeSource}} |?ManaCrafting}}{{Emoticon|emoticon=Mana}})<br>
<!--          -->Total [[stock]] weight of basic resources: {{#var: totalStock}}{{Emoticon|emoticon=Stock}}
+
<!--          -->Total [[stock]] weight of basic resources: {{#var: totalStock}}{{Emoticon|emoticon=Stock}}, stock weight of finished item: {{#if: {{#show: {{#var: recipeSource}} |?Weight }} | {{#show: {{#var: recipeSource}} |?Weight }} | [[??]] }}{{Emoticon|emoticon=Stock}}
 
}}</div></div><!--
 
}}</div></div><!--
 
--></includeonly><noinclude>
 
--></includeonly><noinclude>

Revision as of 03:54, 18 March 2019

Generates a BoM (Bill of Materials) for an item. Has three modes you can choose with the template parameter outputMode:

  • outputMode = list - Show the most basic resources with all amounts added up.
  • outputMode = tree - Show a tree style list with all the needed resources as child of the intermediate ingredient with different levels of indentation (done)
  • outputMode = all - Show both (Default mode in case parameter is left out)

Uses sub-template Template:ResourceBreakdown