From Dark and Darker Wiki
(Added example) |
(Item property name was changed in script. Edited to account for this.) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
-->{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}} }}<!-- | If @arg:2 has text | ||
-->{{# | -->{{#if:{{{2|}}}<!-- | ||
Use @arg:2 | |||
-->|{{#arraydefine:craftables|{{{2}}}}}<!-- | |||
Else use all of the Merchant's crafts | |||
-->|{{#arraydefine:craftables|{{Merchant Data|{{{1}}}|Crafts|All}}}}}}<!-- | |||
If @arg:ingredient was provided | |||
-->{{#if:{{{ingredient|}}}<!-- | |||
AND @arg:ingredient is NOT used in a crafting recipe(s) | |||
-->|{{#if:{{{{{ingredientcategory|Misc}}} Data|{{{ingredient}}}|incraftingrecipefor}}<!-- | |||
Set the craftables array to empty | |||
-->||{{#arraydefine:craftables|}}}}}}<!-- | |||
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;}}"><!-- | |||
--><tr><th style="width:3%">Name</th><th style="width:5%">Ingredients</th><th style="width:2%">Merchant</th></tr><!-- | |||
-->{{#loop:i|0|{{#arraysize:craftables}}<!-- | -->{{#loop:i|0|{{#arraysize:craftables}}<!-- | ||
-->|{{#vardefine:craft|{{#arrayindex:craftables|{{#var:i}} }} }}<!-- | -->|<tr><!-- Generate a crafting row for each element in @array:craftables | ||
-->{{#vardefine:craft|{{#arrayindex:craftables|{{#var:i}}}}}}<!-- | |||
If @arg:ingredient is in the list of ingredients for @var:craft | |||
OR @arg:ingredient is empty | |||
-->{{#if: {{#pos:{{#vardefineecho:ingredients|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|ingredients}} }}|{{{ingredient|}}}}}<!-- | |||
-->{{#if:{{{ingredient|}}}||continue}}<!-- | |||
-->|{{#vardefine:rarity|{{Merchant Data|{{{1}}}|Crafts|{{#var:craft}}|rarity}}}}<!-- | |||
-->{{#arraydefine:ingredients|{{#var:ingredients}}}}<!-- | |||
--><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}}<!-- | ||
-->|caption=<span class="colorrarity{{#var:rarity}}">{{#var:craft}}</span><!-- | -->|caption =<span class="colorrarity{{#var:rarity}}">{{#var:craft}}</span><!-- | ||
-->|rarity={{#var:rarity}} }}</td> | -->|rarity ={{#var:rarity}} }}</td><!-- | ||
--><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}}<!-- | ||
-->|size=x100px<!-- | -->|size =x100px<!-- | ||
-->|caption=no<!-- | -->|caption =no<!-- | ||
-->|amount={{#explode:{{#var:ingredient}}|-|0}}<!-- | -->|amount ={{#explode:{{#var:ingredient}}|-|0}}<!-- | ||
-->|rarity=<!-- | -->|rarity=<!-- | ||
-->{{#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><!-- | |||
--></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== | |||
<pre>{{GenerateCraftingTable|Alchemist|ingredient=Gold Coin}}</pre> | |||
{{GenerateCraftingTable|Alchemist|ingredient=Gold Coin}} | |||
==Example== | |||
<pre>{{GenerateCraftingTable|Weaponsmith|ingredient=Longsword|ingredientcategory=Weapon}}</pre> | |||
{{GenerateCraftingTable|Weaponsmith|ingredient=Longsword|ingredientcategory=Weapon}} | |||
==Example== | ==Example== | ||
<pre>{{GenerateCraftingTable| | <pre>{{GenerateCraftingTable|Alchemist|ingredient=Golden Teeth}}</pre> | ||
{{GenerateCraftingTable| | {{GenerateCraftingTable|Alchemist|ingredient=Golden Teeth}} | ||
==Example== | ==Example== | ||
<pre>{{GenerateCraftingTable| | <pre>{{GenerateCraftingTable|Weaponsmith|Sterling Blade}}</pre> | ||
{{GenerateCraftingTable| | {{GenerateCraftingTable|Weaponsmith|Sterling Blade}} | ||
==Example== | ==Example== | ||
<pre>{{GenerateCraftingTable|Alchemist}}</pre> | <pre>{{GenerateCraftingTable|Alchemist}}</pre> |
Latest revision as of 06:53, 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
- item category of ingredient
Example
{{GenerateCraftingTable|Alchemist|ingredient=Gold Coin}}
Name | Ingredients | Merchant |
---|---|---|
Alchemist | ||
Alchemist | ||
Example
{{GenerateCraftingTable|Weaponsmith|ingredient=Longsword|ingredientcategory=Weapon}}
Name | Ingredients | Merchant |
---|---|---|
Weaponsmith | ||
Weaponsmith | ||
Weaponsmith | ||
Weaponsmith | ||
Example
{{GenerateCraftingTable|Alchemist|ingredient=Golden Teeth}}
Name | Ingredients | Merchant |
---|---|---|
Alchemist | ||
Example
{{GenerateCraftingTable|Weaponsmith|Sterling Blade}}
Name | Ingredients | Merchant |
---|---|---|
Weaponsmith |
Example
{{GenerateCraftingTable|Alchemist}}
Example
{{GenerateCraftingTable|Alchemist|ingredient=Silver Ore}}