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
Gold Ingot1
Wolf Fang2
Wolf Claw3
Gold Coin300
Alchemist
Gold Ingot1
Golden Teeth1
Gold Coin300
Alchemist
Potion of Healing1
Lifeleaf1
Alchemist
Potion of Healing1
Lifeleaf2
Alchemist
Potion of Healing1
Lifeleaf3
Alchemist
Potion of Healing1
Lifeleaf5
Alchemist
Potion of Protection1
Phantom Flower1
Alchemist
Potion of Protection1
Phantom Flower2
Alchemist
Potion of Protection1
Phantom Flower3
Alchemist
Potion of Protection1
Phantom Flower5
Alchemist
Magic Protection Potion1
Wardweed1
Alchemist
Magic Protection Potion1
Wardweed2
Alchemist
Magic Protection Potion1
Wardweed3
Alchemist
Magic Protection Potion1
Wardweed5
Alchemist
Lifeleaf2
Phantom Flower2
Wardweed2
Alchemist
Lifeleaf4
Phantom Flower4
Wardweed4
Alchemist
Lifeleaf6
Phantom Flower6
Wardweed6
Alchemist
Lifeleaf8
Phantom Flower8
Wardweed8
Alchemist

Example

{{GenerateCraftingTable|Alchemist|ingredient=Gold}}
Name Ingredients Trader
Gold Ore2
Alchemist
Gold Ingot1
Wolf Fang2
Wolf Claw3
Gold Coin300
Alchemist
Gold Ingot1
Golden Teeth1
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
Weaponsmith
Rapier1
Demon Blood1
Bone2
Gold Ingot3
Weaponsmith
Crystal Ball1
Captured Mana Flakes1
Intact Skull2
Gold Coin50
Weaponsmith
Falchion1
Token of Honor1
Rusty Broken Sword2
Gold Ingot3
Weaponsmith
Flanged Mace1
Firefly's Abdomen1
Broken Skull3
Gold Ingot3
Weaponsmith
Recurve Bow1
Centaur Horn1
Bowstring5
Gold Coin50
Weaponsmith
Crystal Ball1
Cyclops Eye1
Grave Essence3
Gold Coin50
Weaponsmith
Felling Axe1
Gold Ingot2
Weaponsmith
Viking Sword1
Gold Ingot2
Weaponsmith
Castillon Dagger1
Frost Wyvern's Claws1
Froststone Ingot2
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
Heavy Boots1
Gold Ingot3
Armourer
Gold Ore3
Armourer