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}} }}<!--
--><table cellspacing="0" class="wikitable sortable jquery-tablesorter" style="width:55%; min-width:500px; background:transparent; text-align:center; vertical-align:middle;"><!--
-->{{#vardefine:rows|<!--
-->{{#if:{{{header|}}}<!--
-->{{#loop:i|0|{{#arraysize:craftables}}<!--
-->|<tr><th style="font-weight:bold; width:15%">Name</th><th style="font-weight:bold; width:25%">Ingredients</th><th style="font-weight:bold; width:10%">Trader</th></tr>}}<!--
-->|{{#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}}<!--
-->|rarity={{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|rarity}} }}</td>
-->|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>
Creates crafting table
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|ingredient=Gold}}</pre>
<pre>{{GenerateCraftingTable|Alchemist}}</pre>
{{GenerateCraftingTable|Alchemist|ingredient=Gold}}
{{GenerateCraftingTable|Alchemist}}
==Example==
<pre>{{GenerateCraftingTable|Weaponsmith|ingredient=Gold}}</pre>
{{GenerateCraftingTable|Weaponsmith|ingredient=Gold}}
==Example==
==Example==
<pre>{{GenerateCraftingTable|Armourer|ingredient=Gold}}</pre>
<pre>{{GenerateCraftingTable|Alchemist|ingredient=Silver Ore}}</pre>
{{GenerateCraftingTable|Armourer|ingredient=Gold}}
{{GenerateCraftingTable|Alchemist|ingredient=Silver Ore}}
</noinclude>
</noinclude>

Revision as of 00:36, 14 May 2024

Auto creates crafting row

Example

{{GenerateCraftingTable|Alchemist|header=yes}}
NameIngredientsTrader
Iron Ore2
Alchemist
Copper Ore2
Alchemist
Cobalt Ore2
Alchemist
Rubysilver Ore2
Alchemist
Silver Coin45
Alchemist
Gold Ore2
Alchemist
Froststone Ore2
Alchemist
Cockatrice's Lucky Feather1
Wolf Fang2
Wolf Claw3
Gold Coin300
Alchemist
Gold Ingot1
Golden Teeth5
Gold Coin300
Alchemist
Frozen Heart1
Cobalt Ingot2
Gold Coin300
Alchemist
Lifeleaf1
Alchemist
Lifeleaf1
Alchemist
Lifeleaf1
Alchemist
Lifeleaf5
Alchemist
Phantom Flower1
Alchemist
Phantom Flower1
Alchemist
Phantom Flower1
Alchemist
Phantom Flower5
Alchemist
Wardweed1
Alchemist
Wardweed1
Alchemist
Wardweed1
Alchemist
Wardweed5
Alchemist
Lifeleaf1
Wardweed1
Alchemist
Lifeleaf1
Wardweed1
Alchemist
Lifeleaf1
Wardweed1
Alchemist
Phantom Flower1
Blue Eyeballs1
Alchemist
Lifeleaf1
Rotten Fluids1
Alchemist
Frozen Heart1
Glowing Blue Ice Eyes1
Alchemist
Demon Blood1
Armor Scrap2
Alchemist
Volcanic Ash1
Intact Skull6
Bone6
Alchemist
Token of Honor1
Rusty Broken Sword6
Bone6
Alchemist

Example

{{GenerateCraftingTable|Alchemist}}
NameIngredientsTrader
Iron Ore2
Alchemist
Copper Ore2
Alchemist
Cobalt Ore2
Alchemist
Rubysilver Ore2
Alchemist
Silver Coin45
Alchemist
Gold Ore2
Alchemist
Froststone Ore2
Alchemist
Cockatrice's Lucky Feather1
Wolf Fang2
Wolf Claw3
Gold Coin300
Alchemist
Gold Ingot1
Golden Teeth5
Gold Coin300
Alchemist
Frozen Heart1
Cobalt Ingot2
Gold Coin300
Alchemist
Lifeleaf1
Alchemist
Lifeleaf1
Alchemist
Lifeleaf1
Alchemist
Lifeleaf5
Alchemist
Phantom Flower1
Alchemist
Phantom Flower1
Alchemist
Phantom Flower1
Alchemist
Phantom Flower5
Alchemist
Wardweed1
Alchemist
Wardweed1
Alchemist
Wardweed1
Alchemist
Wardweed5
Alchemist
Lifeleaf1
Wardweed1
Alchemist
Lifeleaf1
Wardweed1
Alchemist
Lifeleaf1
Wardweed1
Alchemist
Phantom Flower1
Blue Eyeballs1
Alchemist
Lifeleaf1
Rotten Fluids1
Alchemist
Frozen Heart1
Glowing Blue Ice Eyes1
Alchemist
Demon Blood1
Armor Scrap2
Alchemist
Volcanic Ash1
Intact Skull6
Bone6
Alchemist
Token of Honor1
Rusty Broken Sword6
Bone6
Alchemist

Example

{{GenerateCraftingTable|Alchemist|ingredient=Silver Ore}}