Difference between revisions of "Template:BoM"

From ChatWars Wiki
Jump to: navigation, search
Line 4: Line 4:
  
 
<div class="mw-collapsible-content" style="width: intrinsic; width: -moz-max-content; width: -webkit-max-content; text-align: left; white-space: nowrap;">
 
<div class="mw-collapsible-content" style="width: intrinsic; width: -moz-max-content; width: -webkit-max-content; text-align: left; white-space: nowrap;">
{{#vardefineecho: listOutputBuffer
+
{{#vardefine: outputBuffer
 
   | {{#ask:
 
   | {{#ask:
 
     [[-Has subobject::{{#var: recipeSource}}]] [[Crafting ingredient.ItemType::+]] [[Crafting ingredient.ItemType::!Recipe (Item)]] [[Crafting ingredient.ItemType::!Piece of Equipment]]
 
     [[-Has subobject::{{#var: recipeSource}}]] [[Crafting ingredient.ItemType::+]] [[Crafting ingredient.ItemType::!Recipe (Item)]] [[Crafting ingredient.ItemType::!Piece of Equipment]]
Line 20: Line 20:
 
<!-- tree style list of resources + intermediate steps-->
 
<!-- tree style list of resources + intermediate steps-->
 
{{#switch: {{#var: outputMode}}
 
{{#switch: {{#var: outputMode}}
   | tree | all = {{#ask:
+
   | tree | all = {{#var: outputBuffer}}
                  [[-Has subobject::{{#var: recipeSource}}]] [[Crafting ingredient.ItemType::+]] [[Crafting ingredient.ItemType::!Recipe (Item)]] [[Crafting ingredient.ItemType::!Piece of Equipment]]
 
                  |mainlabel=-
 
                  |headers=hide
 
                  |format=template
 
                  |template=ResourceBreakdown
 
                  |userparam=0;1<!-- first number is depth, second is multiplier-->
 
                  |sort=Qty,Crafting ingredient
 
                  |order=desc,asc
 
                  |?Crafting ingredient
 
                  |?Qty
 
                }}
 
 
}}<!--
 
}}<!--
 
List of basic resources + mana usage
 
List of basic resources + mana usage

Revision as of 15:11, 31 December 2018

Generates a BoM (Bill of Materials) for an item. Has three modes:

  • Show the most basic resources with all amounts added up. (WIP, not possible without semantic wiki array extension)
  • Show a tree style list with all the needed resources as child of the intermediate ingredient with different levels of indentation (done)
  • Show both

Uses sub-template Template:ResourceBreakdown