From Dark and Darker Wiki

m (Sur moved page Quest items to Quest Items: proper casing)
(Script extracts variables from merchant table and adds up same items.)
Line 1: Line 1:
{| class="wikitable sortable"
<includeonly>
|+ Item List
{{#arraydefine:array_item_names}}
|-
<!--{{#arraydefine:extracted_quantity_array}}-->
! Name !! Rarity !! Quantity !! Type !! Loot state
 
|-
<!-- Loop order -> Trader -> Chapter -> Quests -> Task: Checking params -->
| {{Iconbox|Phantom Flower|image=Phantom Flower.png|size=50px|rarity=3}} || Uncommon || 1 || Treasure || Looted
{{#arraydefine:traders_arr|{{Merchant Data|All}}}}
|-
<!--Loop Over Traders-->
| {{Iconbox|Wardweed|image=Wardweed.png|size=50px|rarity=3}} || Uncommon || 1 || Treasure || Looted
{{#loop: loopTr|0|{{#arraysize:traders_arr}}|<!--
|-
-->
| {{Iconbox|Lifeleaf|image=Lifeleaf.png|size=50px|rarity=3}} || Uncommon || 4 || Treasure || Looted
{{#arraydefine:chapters_array|
|-
{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|All}}
| {{Iconbox|Broken Skull|image=Broken Skull.png|size=50px|rarity=3}} || Uncommon || 4 || Treasure || Looted
}}
|-
<!--Loop Over Chapters-->
| {{Iconbox|Mimic Tooth|image=Mimic Tooth.png|size=50px|rarity=3}} || Uncommon || 2 || Treasure || Looted
{{#loop: loopC|0|{{#arraysize:chapters_array}}|
|-
{{#arraydefine:quest_array|
| {{Iconbox|Grave Essence|image=Grave Essence.png|size=50px|rarity=3}} || Uncommon || 8 || Treasure || Looted
{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|All}}
|-
}}
| {{Iconbox|Maggots|image=Maggots.png|size=50px|rarity=3}} || Uncommon || 3 || Treasure || Looted
<!--Loop Over Quests-->
|-
{{#loop: loopQ|0|{{#arraysize:quest_array}}|
| {{Iconbox|Cobalt Ore|image=Cobalt Ore.png|size=50px|rarity=4}} || Rare || 6 || Ore || Looted
{{#arraydefine:tasks_array|
|-
{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|all}}
| {{Iconbox|Rubysilver Ore|image=Rubysilver Ore.png|size=50px|rarity=4}} || Rare || 6 || Ore || Looted
}}
|-
 
| {{Iconbox|Epic Armor|image=Epic Armor.png|size=50px|rarity=5}} || Epic || 5 || Armor || Looted
<!--Loop Over Tasks-->
|-
<!-- TOO MANY LOOOOOPS, COPY PASTE CODE FOR TASKS -->
| {{Iconbox|Crystal Ball|image=Crystal Ball.png|size=50px|rarity=4}} || Rare || 3 || Weapon || Looted
<!-- Check if Its fetch 1-->
|-
{{#vardefine:cond1|{{#arraysearch:tasks_array|1}}}}
| {{Iconbox|Demon Dog Thorn|image=Demon Dog Thorn.png|size=50px|rarity=3}} || Uncommon || 1 || Treasure || Looted
{{#if:cond1
|-
|<!-- True: Task array has task: 1 -->
| {{Iconbox|Bat Claw|image=Bat Claw.png|size=50px|rarity=3}} || Uncommon || 2 || Treasure || Looted
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|1|type}}
|-
|Fetch|
| {{Iconbox|Torn Bat Wing|image=Torn Bat Wing.png|size=50px|rarity=3}} || Uncommon || 1 || Treasure || Looted
 
|-
<!-- FETCH TASK Checking -->
| {{Iconbox|Bug Shell|image=Bug Shell.png|size=50px|rarity=4}} || Rare || 1 || Treasure || Looted
{{#vardefine:current_item|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|1|fetch}}
|-
}}
| {{Iconbox|Bettle Wings|image=Bettle Wings.png|size=50px|rarity=3}} || Uncommon || 1 || Treasure || Looted
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|1|quantity}}
|-
}}
| {{Iconbox|Armor Scrap|image=Armor Scrap.png|size=50px|rarity=3}} || Uncommon || 5 || Treasure || Looted
{{#vardefine:isItemInArray|{{#arraysearch:array_item_names|{{#var:current_item}}}}}}
|-
{{#if:{{#var:isItemInArray}}
| {{Iconbox|Leather Cap|image=Leather Cap.png|size=50px|rarity=3}} || Uncommon || 3 || Armor || Looted
|<!--True-->
|-
{{#vardefine:{{#var:current_item}}|{{#expr:{{#var:current_quantity}}+{{#var:{{#var:current_item}}}}}}}}
| {{Iconbox|Rotten Fluids|image=Rotten Fluids.png|size=50px|rarity=4}} || Rare || 1 || Consumable || Looted
|<!--False-->
|-
{{#arraydefine:array_item_names|{{#arrayprint:array_item_names|,}},{{#var:current_item}}}}
| {{Iconbox|Enchanted Dark Fabric|image=Enchanted Dark Fabric.png|size=50px|rarity=4}} || Rare || 1 || Treasure || Looted
{{#vardefine:{{#var:current_item}}|{{#var:current_quantity}}}}
|-
}}
| {{Iconbox|Old Cloth|image=Old Cloth.png|size=50px|rarity=3}} || Uncommon || 7 || Treasure || Looted
 
|-
}}<!--end is eq: fetch type -->
| {{Iconbox|Old Bloody Bandage|image=Old Bloody Bandage.png|size=50px|rarity=3}} || Uncommon || 1 || Treasure || Looted
|}}<!-- end if: is Task N -->
|-
 
| {{Iconbox|Wendigo's Sharp Claws|image=Wendigo's Sharp Claws.png|size=50px|rarity=4}} || Rare || 3 || Treasure || Looted
<!-- Check if Its fetch 2-->
|-
{{#vardefine:cond2|{{#arraysearch:tasks_array|2}}}}
| {{Iconbox|Glowing Blue Ice Eyes|image=Glowing Blue Ice Eyes.png|size=50px|rarity=4}} || Rare || 3 || Treasure || Looted
{{#if:cond2
|-
|<!-- True: Task array has task: 2 -->
| {{Iconbox|Ale|image=Ale.png|size=50px|rarity=3}} || Uncommon || 6 || Consumable || Looted
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|2|type}}
|-
|Fetch|
| {{Iconbox|Explosive Bottle|image=Explosive Bottle.png|size=50px|rarity=3}} || Uncommon || 4 || Consumable || Looted
 
|-
<!-- FETCH TASK Checking -->
| {{Iconbox|Bowstring|image=Bowstring.png|size=50px|rarity=3}} || Uncommon || 4 || Treasure || Looted
{{#vardefine:current_item|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|2|fetch}}
|-
}}
| {{Iconbox|Golden Teeth|image=Golden Teeth.png|size=50px|rarity=4}} || Rare || 3 || Treasure || Looted
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|2|quantity}}
|-
}}
| {{Iconbox|Rusty Broken Sword|image=Rusty Broken Sword.png|size=50px|rarity=3}} || Uncommon || 1 || Treasure || Looted
{{#vardefine:isItemInArray|{{#arraysearch:array_item_names|{{#var:current_item}}}}}}
|-
{{#if:{{#var:isItemInArray}}
| {{Iconbox|Primitive Bracelet|image=Primitive Bracelet.png|size=50px|rarity=3}} || Uncommon || 12 || Treasure || Looted
|<!--True-->
|-
{{#vardefine:{{#var:current_item}}|{{#expr:{{#var:current_quantity}}+{{#var:{{#var:current_item}}}}}}}}
| {{Iconbox|Wolf Fang|image=Wolf Fang.png|size=50px|rarity=2}} || Common || 4 || Treasure || Looted
|<!--False-->
|-
{{#arraydefine:array_item_names|{{#arrayprint:array_item_names|,}},{{#var:current_item}}}}
| {{Iconbox|Oil Lantern|image=Oil Lantern.png|size=50px|rarity=2}} || Common || 7 || Consumable || Looted
{{#vardefine:{{#var:current_item}}|{{#var:current_quantity}}}}
|-
}}
| {{Iconbox|Moldy Bread|image=Moldy Bread.png|size=50px|rarity=2}} || Common || 4 || Consumable || Looted
 
|-
}}<!--end is eq: fetch type -->
| {{Iconbox|Wolf Pelt|image=Wolf Pelt.png|size=50px|rarity=2}} || Common || 6 || Treasure || Looted
|}}<!-- end if: is Task N -->
|-
 
| {{Iconbox|Wendigo Hoof|image=Wendigo Hoof.png|size=50px|rarity=3}} || Uncommon || 1 || Treasure || Looted
<!-- Check if Its fetch 3-->
|-
{{#vardefine:cond3|{{#arraysearch:tasks_array|3}}}}
| {{Iconbox|Gold Waterpot|image=Gold Waterpot.png|size=50px|rarity=5}} || Epic || 2 || Treasure || Looted
{{#if:cond3
|-
|<!-- True: Task array has task: 3 -->
| {{Iconbox|Gold Candle Holder|image=Gold Candle Holder.png|size=50px|rarity=5}} || Epic || 2 || Treasure || Looted
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|3|type}}
|-
|Fetch|
| {{Iconbox|Gold Candelabra|image=Gold Candelabra.png|size=50px|rarity=5}} || Epic || 2 || Treasure || Looted
 
|-
<!-- FETCH TASK Checking -->
| {{Iconbox|Gold Bowl|image=Gold Bowl.png|size=50px|rarity=5}} || Epic || 1 || Treasure || Looted
{{#vardefine:current_item|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|3|fetch}}
|-
}}
| {{Iconbox|Yeti's Teeth|image=Yeti's Teeth.png|size=50px|rarity=4}} || Rare || 1 || Treasure || Looted
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|3|quantity}}
|-
}}
| {{Iconbox|Extra Thick Pelt|image=Extra Thick Pelt.png|size=50px|rarity=4}} || Rare || 2 || Treasure || Looted
{{#vardefine:isItemInArray|{{#arraysearch:array_item_names|{{#var:current_item}}}}}}
|-
{{#if:{{#var:isItemInArray}}
| {{Iconbox|Frosted Feather|image=Frosted Feather.png|size=50px|rarity=4}} || ? || 1 || Treasure || Looted
|<!--True-->
|-
{{#vardefine:{{#var:current_item}}|{{#expr:{{#var:current_quantity}}+{{#var:{{#var:current_item}}}}}}}}
| {{Iconbox|Silver Coin|image=Silver Coin.png|size=50px|rarity=3}} || Uncommon || 100 || Treasure || Looted
|<!--False-->
|-
{{#arraydefine:array_item_names|{{#arrayprint:array_item_names|,}},{{#var:current_item}}}}
| {{Iconbox|Gold Coin|image=Gold Coin.png|size=50px|rarity=3}} || Uncommon || 50 || Treasure || Looted
{{#vardefine:{{#var:current_item}}|{{#var:current_quantity}}}}
|-
}}
| {{Iconbox|Silver Chalice|image=Silver Chalice.png|size=50px|rarity=4}} || Rare || 1 || Treasure || Looted
 
|-
}}<!--end is eq: fetch type -->
| {{Iconbox|Gold Goblet|image=Gold Goblet.png|size=50px|rarity=4}} || Rare || 1 || Treasure || Looted
|}}<!-- end if: is Task N -->
|-
 
| {{Iconbox|Gold Crown|image=Gold Crown.png|size=50px|rarity=4}} || Rare || 2 || Treasure || Looted
<!-- Check if Its fetch 4-->
|-
{{#vardefine:cond4|{{#arraysearch:tasks_array|4}}}}
| {{Iconbox|Ancient Scroll|image=Ancient Scroll.png|size=50px|rarity=4}} || Rare || 2 || Treasure || Looted
{{#if:cond4
|-
|<!-- True: Task array has task: 4 -->
| {{Iconbox|Royal Ceremonial Dagger|image=Royal Ceremonial Dagger.png|size=50px|rarity=5}} || Legendary || 1 || Treasure || Looted
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|4|type}}
|-
|Fetch|
| {{Iconbox|Rare Weapon|image=Weapon.png|size=50px|rarity=4}} || Rare || 5 || Weapon || Looted
 
|-
<!-- FETCH TASK Checking -->
| {{Iconbox|Gold Ingot|image=Gold Ingot.png|size=50px|rarity=4}} || Rare || 3 || Ore || Any
{{#vardefine:current_item|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|4|fetch}}
|-
}}
| {{Iconbox|Bandage|image=Bandage.png|size=50px|rarity=0}} || Poor || 5 || Consumable || Looted
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|4|quantity}}
|}
}}
{{#vardefine:isItemInArray|{{#arraysearch:array_item_names|{{#var:current_item}}}}}}
{{#if:{{#var:isItemInArray}}
|<!--True-->
{{#vardefine:{{#var:current_item}}|{{#expr:{{#var:current_quantity}}+{{#var:{{#var:current_item}}}}}}}}
|<!--False-->
{{#arraydefine:array_item_names|{{#arrayprint:array_item_names|,}},{{#var:current_item}}}}
{{#vardefine:{{#var:current_item}}|{{#var:current_quantity}}}}
}}
 
}}<!--end is eq: fetch type -->
|}}<!-- end if: is Task N -->
 
<!-- Check if Its fetch 5-->
{{#vardefine:cond5|{{#arraysearch:tasks_array|5}}}}
{{#if:cond5
|<!-- True: Task array has task: 5 -->
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|5|type}}
|Fetch|
 
<!-- FETCH TASK Checking -->
{{#vardefine:current_item|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|5|fetch}}
}}
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|5|quantity}}
}}
{{#vardefine:isItemInArray|{{#arraysearch:array_item_names|{{#var:current_item}}}}}}
{{#if:{{#var:isItemInArray}}
|<!--True-->
{{#vardefine:{{#var:current_item}}|{{#expr:{{#var:current_quantity}}+{{#var:{{#var:current_item}}}}}}}}
|<!--False-->
{{#arraydefine:array_item_names|{{#arrayprint:array_item_names|,}},{{#var:current_item}}}}
{{#vardefine:{{#var:current_item}}|{{#var:current_quantity}}}}
}}
 
}}<!--end is eq: fetch type -->
|}}<!-- end if: is Task N -->
 
<!-- Check if Its fetch 6-->
{{#vardefine:cond6|{{#arraysearch:tasks_array|6}}}}
{{#if:cond6
|<!-- True: Task array has task: 6 -->
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|6|type}}
|Fetch|
 
<!-- FETCH TASK Checking -->
{{#vardefine:current_item|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|6|fetch}}
}}
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|6|quantity}}
}}
{{#vardefine:isItemInArray|{{#arraysearch:array_item_names|{{#var:current_item}}}}}}
{{#if:{{#var:isItemInArray}}
|<!--True-->
{{#vardefine:{{#var:current_item}}|{{#expr:{{#var:current_quantity}}+{{#var:{{#var:current_item}}}}}}}}
|<!--False-->
{{#arraydefine:array_item_names|{{#arrayprint:array_item_names|,}},{{#var:current_item}}}}
{{#vardefine:{{#var:current_item}}|{{#var:current_quantity}}}}
}}
 
}}<!--end is eq: fetch type -->
|}}<!-- end if: is Task N -->
 
<!--}}-->
<!--End loop over tasks-->
}}
}}
}}
<!-- Remove first empty element -->
{{#arrayslice:array_item_names|array_item_names|1|9999}}
 
<!-- Result Table -->
<table cellspacing="0" class="wikitable sortable jquery-tablesorter" style="width:50%; color:#eee; background:transparent; text-align:center; vertical-align:middle;"><!--
--><tr><!--
--><th style="width:50%" class="headerSort" tabindex="0" role="columnheader button" title="Sort ascending">Item name</th><!--
--><th style="width:20%" class="headerSort" tabindex="0" role="columnheader button" title="Sort ascending">Quantity</th></tr><!--
        -->{{#loop:LoopTest|0|{{#arraysize:array_item_names}}
|<!-- Loop -->
{{#vardefine:name|{{#arrayindex:array_item_names|{{#var:LoopTest}}}}}}
<tr><td>{{#var:name}}</td><td>{{#var:{{#var:name}}}}</td></tr>
}}<!--
--></table><!--
 
</includeonly>
<noinclude>
{{Example}}

Revision as of 17:41, 14 September 2024


my cool template code here