From Dark and Darker Wiki

(Updated to us item property incraftingrecipe)
(Changed the pre-table logic to more efficiently handle the creation of craftbales array. Added parameter documentation.)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--


If @arg:2 has text
If @arg:2 has text
Line 5: Line 6:
Use @arg:2  
Use @arg:2  
-->|{{#arraydefine:craftables|{{{2}}}}}<!--
-->|{{#arraydefine:craftables|{{{2}}}}}<!--
Else if an @arg:ingredient was provided
Else use all of the Merchant's crafts
-->|{{#if:{{{ingredient|}}}<!--
-->|{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}} }} }}<!--
AND the @arg:ingredient is NOT used in a crafting recipe(s)
If @arg:ingredient was provided
-->|{{#if:{{{{{ingredientcategory|Misc}}} Data|{{{ingredient|}}}|incraftingrecipe}}<!--
-->{{#if:{{{ingredient|}}}<!--
-->|{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}}}}<!--
AND @arg:ingredient is NOT used in a crafting recipe(s)
Set the craftables array to empty
-->|{{#if:{{{{{ingredientcategory|Misc}}} Data|{{{ingredient}}}|incraftingrecipe}}<!--
-->|{{#arraydefine:craftables|}}}}<!--
Set the craftables array to empty
Otherwise use the entire crafts list for the given merchant
-->||{{#arraydefine:craftables|}} }} }}<!--
-->|{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}}}}}}}}<!--
        Otherwise do nothing


--><table cellspacing="0" class="wikitable sortable jquery-tablesorter" style="width:70%; min-width:500px; text-align:center; vertical-align:middle; {{#ifeq:{{#arraysize:craftables}}|0|display:none;}}"><!--
--><table cellspacing="0" class="wikitable sortable jquery-tablesorter" style="width:70%; min-width:500px; text-align:center; vertical-align:middle; {{#ifeq:{{#arraysize:craftables}}|0|display:none;}}"><!--
Line 19: Line 20:
-->{{#loop:i|0|{{#arraysize:craftables}}<!--
-->{{#loop:i|0|{{#arraysize:craftables}}<!--
-->|<tr><!-- Generate a crafting row for each element in @array:craftables
-->|<tr><!-- Generate a crafting row for each element in @array:craftables
-->{{#vardefine:craft|{{#arrayindex:craftables|{{#var:i}}}}}}<!--
-->{{#vardefine:craft|{{#arrayindex:craftables|{{#var:i}} }} }}<!--
If @arg:ingredient is in the list of ingredients for @var:craft
If @arg:ingredient is in the list of ingredients for @var:craft
OR @arg:ingredient is empty
OR @arg:ingredient is empty
Line 48: Line 49:


--></includeonly><noinclude>
--></includeonly><noinclude>
=Parameters=
*1:
**Merchant Name
**default: empty string
*2:
**Item or List of Items separated by commas
**default: empty string
*ingredient:
**ingredient to search for
**default: empty string
*ingredientcategory:
**item category of ingredient <code>{Weapon, Armor, Accessory, Utility, Misc}</code>
**default: <code>Misc</code>
==Example==
==Example==
<pre>{{GenerateCraftingTable|Weaponsmith|ingredient=Longsword|ingredientcategory=Weapon}}</pre>
<pre>{{GenerateCraftingTable|Weaponsmith|ingredient=Longsword|ingredientcategory=Weapon}}</pre>
{{GenerateCraftingTable|Weaponsmith|ingredient=Longsword|ingredientcategory=Weapon}}
{{GenerateCraftingTable|Weaponsmith|ingredient=Longsword|ingredientcategory=Weapon}}
==Example==
==Example==
<pre>{{GenerateCraftingTable|Weaponsmith|ingredient=Cyclops's Club}}</pre>
<pre>{{GenerateCraftingTable|Alchemist|ingredient=Golden Teeth}}</pre>
{{GenerateCraftingTable|Weaponsmith|ingredient=Cyclops's Club}}
{{GenerateCraftingTable|Alchemist|ingredient=Golden Teeth}}
==Example==
==Example==
<pre>{{GenerateCraftingTable|Weaponsmith|Sterling Blade}}</pre>
<pre>{{GenerateCraftingTable|Weaponsmith|Sterling Blade}}</pre>

Revision as of 04:18, 23 June 2024

Parameters

  • 1:
    • Merchant Name
    • default: empty string
  • 2:
    • Item or List of Items separated by commas
    • default: empty string
  • ingredient:
    • ingredient to search for
    • default: empty string
  • ingredientcategory:
    • item category of ingredient {Weapon, Armor, Accessory, Utility, Misc}
    • default: Misc

Example

{{GenerateCraftingTable|Weaponsmith|ingredient=Longsword|ingredientcategory=Weapon}}

Example

{{GenerateCraftingTable|Alchemist|ingredient=Golden Teeth}}

Example

{{GenerateCraftingTable|Weaponsmith|Sterling Blade}}
NameIngredientsMerchant
Longsword1
Silver Powder2
Weaponsmith

Example

{{GenerateCraftingTable|Alchemist}}
NameIngredientsMerchant
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=Silver Ore}}