From Dark and Darker Wiki

(Added merchant parameter to GenCraftingRow call.)
(Combined crafting templates into GenerateCraftingTable)
Line 1: Line 1:
<includeonly>{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}} }}
<includeonly><!--
{{
-->{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}} }}<!--
#loop: i
--><table cellspacing="0" class="wikitable sortable jquery-tablesorter" style="width:55%; min-width:500px; background:transparent; text-align:center; vertical-align:middle;">
|0
<tr>
|{{#arraysize:craftables}}
<th style="font-weight:bold; width:15%">Name</th>
|<nowiki/>{{#vardefine:craft|{{#arrayindex:craftables|{{#var:i}} }} }}<!--
<th style="font-weight:bold; width:25%">Ingredients</th>
If the ingredient is in the list of ingredients for the craft
<th style="font-weight:bold; width:10%">Trader</th></tr><!--
OR the ingredient is empty, generate the crafting row.
-->{{#loop:i|0|{{#arraysize:craftables}}
-->{{#if:{{#pos:{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|ingredients}}|{{{ingredient|}}}}}{{#if:{{{ingredient|}}}||continue}}<!--
|{{#vardefine:craft|{{#arrayindex:craftables|{{#var:i}} }} }}<!--
-->|{{GenerateCraftingRow|{{{1}}}|{{#var:craft}} }} }}
If the ingredient is in the list of ingredients for the craft
}}
OR the ingredient is empty, generate the crafting row.
</includeonly><noinclude>
-->{{#if: {{#pos:{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|ingredients}}|{{{ingredient|}}}}}<!--
-->{{#if:{{{ingredient|}}}||continue}}<!--
-->|{{#arraydefine:ingredients|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|ingredients}} }}<!--
--><tr>
<td>{{Iconbox|<!--
-->{{#if:{{#pos:{{#var:craft}}|Potion}}<!--
-->|{{#explode:{{#var:craft}}| |1|2}}<!--
-->|{{#var:craft}} }}<!--
-->|size=x100px<!--
-->|amount={{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|quantity}}<!--
-->|rarity={{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|rarity}} }}</td>
<td>{{#loop:i|0|{{#arraysize:ingredients}}<!--
-->|{{#vardefine:ingredient|{{#arrayindex:ingredients|{{#var:i}} }} }}<!--
-->{{Iconbox|<!--
-->{{#explode:{{#var:ingredient}}|-|1}}<!--
-->|size=x100px<!--
-->|caption=no<!--
-->|amount={{#explode:{{#var:ingredient}}|-|0}}<!--
-->|rarity=<!--
-->{{#if:{{#explode:{{#var:ingredient}}|-|2}}<!--
-->|{{#explode:{{#var:ingredient}}|-|2}}<!--
-->|{{Misc Data|{{#explode:{{#var:ingredient}}|-|1}}|Rarities}} }} }} }}</td>
<td>[[{{{1}}}]]</td></tr>}} }}</table><!--
 
--></includeonly><noinclude>
Auto creates crafting row
Auto creates crafting row
==Example==
==Example==
<pre>
<pre>{{GenerateCraftingTable|Alchemist}}</pre>
{{CraftingTable|
{{GenerateCraftingTable|Alchemist}}
{{GenerateCraftingRows|Alchemist}}
}}
</pre>
{{CraftingTable|
{{GenerateCraftingRows|Alchemist}}
}}
==Example==
==Example==
<pre>
<pre>{{GenerateCraftingTable|Alchemist|ingredient=Gold}}</pre>
{{CraftingTable|
{{GenerateCraftingTable|Alchemist|ingredient=Gold}}
{{GenerateCraftingRows|Alchemist|ingredient=Gold}}
}}
</pre>
{{CraftingTable|
{{GenerateCraftingRows|Alchemist|ingredient=Gold}}
}}
==Example==
==Example==
<pre>
<pre>{{GenerateCraftingTable|Weaponsmith|ingredient=Gold}}</pre>
{{CraftingTable|
{{GenerateCraftingTable|Weaponsmith|ingredient=Gold}}
{{GenerateCraftingRows|Weaponsmith|ingredient=Gold}}
}}
</pre>
{{CraftingTable|
{{GenerateCraftingRows|Weaponsmith|ingredient=Gold}}
}}
==Example==
==Example==
<pre>
<pre>{{GenerateCraftingTable|Armourer|ingredient=Gold}}</pre>
{{CraftingTable|
{{GenerateCraftingTable|Armourer|ingredient=Gold}}
{{GenerateCraftingRows|Armourer|ingredient=Gold}}
}}
</pre>
{{CraftingTable|
{{GenerateCraftingRows|Armourer|ingredient=Gold}}
}}
</noinclude>
</noinclude>

Revision as of 00:08, 14 May 2024

Auto creates crafting row

Example

{{GenerateCraftingTable|Alchemist}}
Name Ingredients Trader
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=Gold}}
Name Ingredients Trader
Gold 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

Example

{{GenerateCraftingTable|Weaponsmith|ingredient=Gold}}
Name Ingredients Trader
Gold Ore3
Weaponsmith
Longsword1
Dark Matter1
Gold Ingot3
Gold Coin50
Weaponsmith
Troll's Club1
Wolf Claw5
Bone2
Gold Coin50
Weaponsmith
Spear1
Rotten Fluids2
Moldy Bread5
Gold Ingot3
Gold Coin50
Weaponsmith
Rapier1
Demon Blood1
Bone2
Gold Ingot3
Gold Coin50
Weaponsmith
Crystal Ball1
Captured Mana Flakes1
Intact Skull2
Gold Coin50
Weaponsmith
Falchion1
Token of Honor1
Rusty Broken Sword2
Gold Ingot3
Gold Coin50
Weaponsmith
Flanged Mace1
Firefly's Abdomen1
Broken Skull3
Gold Ingot3
Gold Coin50
Weaponsmith
Recurve Bow1
Centaur Horn1
Bowstring5
Gold Coin50
Weaponsmith
Crystal Ball1
Cyclops Eye1
Grave Essence3
Gold Coin50
Weaponsmith
Club1
Cyclops's Club1
Grave Essence1
Bone3
Gold Coin50
Weaponsmith
Felling Axe1
Gold Ingot2
Weaponsmith
Viking Sword1
Gold Ingot2
Weaponsmith
Castillon Dagger1
Frost Wyvern's Claws1
Froststone Ingot2
Gold Coin50
Weaponsmith
Crystal Sword1
Ghostly Essence1
Rubysilver Ingot3
Grave Essence3
Gold Coin50
Weaponsmith
Zweihander1
Warlord's Broken Sword Blade1
Rubysilver Ingot2
Silver Ingot2
Gold Coin50
Weaponsmith
Wendigo's Antler Fragment1
Mimic Tongue1
Maggots3
Gold Coin50
Weaponsmith
Spellbook1
Volcanic Ash1
Demon Blood1
Gold Coin50
Weaponsmith

Example

{{GenerateCraftingTable|Armourer|ingredient=Gold}}
Name Ingredients Trader
Hounskull1
Gold Ingot2
Armourer
Armet1
Gold Ingot3
Armourer
Gjermundbu1
Gold Ingot3
Armourer
Fine Cuirass1
Gold Ingot4
Armourer
Plate Pants1
Gold Ingot4
Armourer
Heavy Gauntlets1
Gold Ingot2
Armourer
Plate Boots1
Gold Ingot3
Armourer
Gold Ore3
Armourer