From Dark and Darker Wiki
(Added optional parameter to determine whether to generate the header or not.) |
(Default: no header. Optional parameter to display headers. Added logic to no display the table when there are no rows.) |
||
Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
Create the crafting rows and store them in the var:rows | |||
-->{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}} }}<!-- | -->{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}} }}<!-- | ||
-->{{#vardefine:rows|<!-- | |||
-->{{#loop:i|0|{{#arraysize:craftables}}<!-- | |||
-->|{{#vardefine:craft|{{#arrayindex:craftables|{{#var:i}} }} }}<!-- | |||
-->{{#loop:i|0|{{#arraysize:craftables}} | |||
|{{#vardefine:craft|{{#arrayindex:craftables|{{#var:i}} }} }}<!-- | |||
If the ingredient is in the list of ingredients for the craft | If the ingredient is in the list of ingredients for the craft | ||
OR the ingredient is empty, generate the crafting row. | OR the ingredient is empty, generate the crafting row. | ||
Line 11: | Line 11: | ||
-->{{#if:{{{ingredient|}}}||continue}}<!-- | -->{{#if:{{{ingredient|}}}||continue}}<!-- | ||
-->|{{#arraydefine:ingredients|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|ingredients}} }}<!-- | -->|{{#arraydefine:ingredients|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|ingredients}} }}<!-- | ||
-->{{#vardefine:rarity|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|rarity}} }}<!-- | |||
--><tr> | --><tr> | ||
<td>{{Iconbox|<!-- | <td>{{Iconbox|<!-- | ||
Line 18: | Line 19: | ||
-->|size=x100px<!-- | -->|size=x100px<!-- | ||
-->|amount={{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|quantity}}<!-- | -->|amount={{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|quantity}}<!-- | ||
-->| | -->|caption=<span class="colorrarity{{#var:rarity}}">{{#var:craft}}</span><!-- | ||
-->|rarity={{#var:rarity}} }}</td> | |||
<td>{{#loop:i|0|{{#arraysize:ingredients}}<!-- | <td>{{#loop:i|0|{{#arraysize:ingredients}}<!-- | ||
-->|{{#vardefine:ingredient|{{#arrayindex:ingredients|{{#var:i}} }} }}<!-- | -->|{{#vardefine:ingredient|{{#arrayindex:ingredients|{{#var:i}} }} }}<!-- | ||
Line 30: | Line 32: | ||
-->|{{#explode:{{#var:ingredient}}|-|2}}<!-- | -->|{{#explode:{{#var:ingredient}}|-|2}}<!-- | ||
-->|{{Misc Data|{{#explode:{{#var:ingredient}}|-|1}}|Rarities}} }} }} }}</td> | -->|{{Misc Data|{{#explode:{{#var:ingredient}}|-|1}}|Rarities}} }} }} }}</td> | ||
<td>[[{{{1}}}]]</td></tr>}} }}</table><!-- | <td>[[{{{1}}}]]</td></tr>}} }} }}<!-- | ||
Use the var:rows to check if we want to display the table. | |||
--><table cellspacing="0" class="wikitable sortable jquery-tablesorter" style="width:55%; min-width:500px; background:transparent; text-align:center; vertical-align:middle; {{#if:{{#var:rows}}||display:none;}}"><!-- | |||
--><tr style="font-weight:bold; {{#if:{{{header|}}}||display:none;}}"><th style="width:15%">Name</th><th style="width:25%">Ingredients</th><th style="width:10%">Trader</th></tr><!-- | |||
-->{{#var:rows}}</table><!-- | |||
--></includeonly><noinclude> | --></includeonly><noinclude> | ||
Auto creates crafting row | |||
==Example== | ==Example== | ||
<pre>{{GenerateCraftingTable|Alchemist|header=yes}}</pre> | <pre>{{GenerateCraftingTable|Alchemist|header=yes}}</pre> | ||
{{GenerateCraftingTable|Alchemist|header=yes}} | {{GenerateCraftingTable|Alchemist|header=yes}} | ||
==Example== | ==Example== | ||
<pre>{{GenerateCraftingTable|Alchemist | <pre>{{GenerateCraftingTable|Alchemist}}</pre> | ||
{{GenerateCraftingTable|Alchemist | {{GenerateCraftingTable|Alchemist}} | ||
==Example== | ==Example== | ||
<pre>{{GenerateCraftingTable| | <pre>{{GenerateCraftingTable|Alchemist|ingredient=Silver Ore}}</pre> | ||
{{GenerateCraftingTable| | {{GenerateCraftingTable|Alchemist|ingredient=Silver Ore}} | ||
</noinclude> | </noinclude> |
Revision as of 00:36, 14 May 2024
Auto creates crafting row
Example
{{GenerateCraftingTable|Alchemist|header=yes}}
Example
{{GenerateCraftingTable|Alchemist}}
Example
{{GenerateCraftingTable|Alchemist|ingredient=Silver Ore}}