Difference between revisions of "Template:BoM"

From ChatWars Wiki
Jump to: navigation, search
(added more info)
Line 1: Line 1:
 
{{#vardefine: recipeSource|{{{source|{{PAGENAME}} }}} }}<!--
 
{{#vardefine: recipeSource|{{{source|{{PAGENAME}} }}} }}<!--
-->{{#vardefine: resourceList|}}<includeonly>
+
-->{{#vardefine: resourceList|}}<includeonly><!--
{{#vardefine: resourceList | {{#ask:
+
-->{{#switch: {{{mode}}}
[[-Has subobject::{{#var: recipeSource}}]] [[Crafting ingredient.ItemType::+]]
+
  | tree | all = {{#ask:
|mainlabel=-
+
                  [[-Has subobject::{{#var: recipeSource}}]] [[Crafting ingredient.ItemType::+]]
|headers=hide
+
                  |mainlabel=-
|format=template
+
                  |headers=hide
|template=ResourceBreakdown
+
                  |format=template
|userparam=0;1
+
                  |template=ResourceBreakdown
|sort=Qty,Crafting ingredient
+
                  |userparam=0;1
|order=desc,asc
+
                  |sort=Qty,Crafting ingredient
|?Crafting ingredient
+
                  |order=desc,asc
|?Qty
+
                  |?Crafting ingredient
}} }}
+
                  |?Qty
{{#ask:
+
                }}
[[-Has subobject::{{#var: recipeSource}}]] [[Crafting ingredient.ItemType::+]]
+
}}<!--
|mainlabel=-
+
-->{{#switch: {{{mode}}}  
|headers=hide
+
  | list | all = {{#vardefine: resourceList
|format=template
+
                  | {{#ask:
|template=ResourceBreakdown
+
                      [[-Has subobject::{{#var: recipeSource}}]] [[Crafting ingredient.ItemType::+]]
|userparam=0;1
+
                      |mainlabel=-
|sort=Qty,Crafting ingredient
+
                      |headers=hide
|order=desc,asc
+
                      |format=template
|?Crafting ingredient
+
                      |template=ResourceBreakdown
|?Qty
+
                      |userparam=0;1
}}
+
                      |sort=Qty,Crafting ingredient
</includeonly><noinclude>
+
                      |order=desc,asc
 +
                      |?Crafting ingredient
 +
                      |?Qty
 +
                    }}
 +
                }}
 +
}}<!--
 +
--></includeonly><noinclude>
 
Generates a BoM (Bill of Materials) for an item. Has three modes:
 
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 [https://www.mediawiki.org/wiki/Extension:Arrays array] extension)
 
* Show the most basic resources with all amounts added up. (WIP, not possible without semantic wiki [https://www.mediawiki.org/wiki/Extension:Arrays array] extension)

Revision as of 13:44, 5 September 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