From Dark and Darker Wiki

(Changed the pre-table logic to more efficiently handle the creation of craftbales array. Added parameter documentation.)
(Whitespace)
Line 7: Line 7:
-->|{{#arraydefine:craftables|{{{2}}}}}<!--
-->|{{#arraydefine:craftables|{{{2}}}}}<!--
Else use all of the Merchant's crafts
Else use all of the Merchant's crafts
-->|{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}} }} }}<!--
-->|{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}}}}}}<!--
If @arg:ingredient was provided
If @arg:ingredient was provided
-->{{#if:{{{ingredient|}}}<!--
-->{{#if:{{{ingredient|}}}<!--
Line 13: Line 13:
-->|{{#if:{{{{{ingredientcategory|Misc}}} Data|{{{ingredient}}}|incraftingrecipe}}<!--
-->|{{#if:{{{{{ingredientcategory|Misc}}} Data|{{{ingredient}}}|incraftingrecipe}}<!--
Set the craftables array to empty
Set the craftables array to empty
-->||{{#arraydefine:craftables|}} }} }}<!--
-->||{{#arraydefine:craftables|}}}}}}<!--
         Otherwise do nothing
         Otherwise do nothing


Line 20: 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
-->{{#if:  {{#pos:{{#vardefineecho:ingredients|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|ingredients}} }}|{{{ingredient| }}}}}<!--
-->{{#if:  {{#pos:{{#vardefineecho:ingredients|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|ingredients}} }}|{{{ingredient|}}}}}<!--
-->{{#if:{{{ingredient| }}}||continue}}<!--
-->{{#if:{{{ingredient|}}}||continue}}<!--
-->|{{#vardefine:rarity|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|rarity}} }}<!--
-->|{{#vardefine:rarity|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|rarity}}}}<!--
-->{{#arraydefine:ingredients|{{#var:ingredients}} }}<!--
-->{{#arraydefine:ingredients|{{#var:ingredients}}}}<!--
--><td>{{Iconbox<!--
--><td>{{Iconbox<!--
-->|{{#if:{{#pos:{{#var:craft}}|Potion}}<!--
-->|{{#if:{{#pos:{{#var:craft}}|Potion}}<!--
-->|{{#explode:{{#var:craft}}| |1|2}}<!--
-->|{{#explode:{{#var:craft}}| |1|2}}<!--
-->|{{#var:craft}} }}<!--
-->|{{#var:craft}}}}<!--
-->|size =x100px<!--
-->|size =x100px<!--
-->|amount ={{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|quantity}}<!--
-->|amount ={{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|quantity}}<!--
Line 36: Line 36:
-->|rarity ={{#var:rarity}} }}</td><!--
-->|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}}}}}}<!--
-->{{Iconbox|<!--
-->{{Iconbox|<!--
-->{{#explode:{{#var:ingredient}}|-|1}}<!--
-->{{#explode:{{#var:ingredient}}|-|1}}<!--
Line 45: Line 45:
-->{{#if:{{#explode:{{#var:ingredient}}|-|2}}<!--
-->{{#if:{{#explode:{{#var:ingredient}}|-|2}}<!--
-->|{{#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>}}</table><!--



Revision as of 05:05, 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 Powder1
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
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}}