From Dark and Darker Wiki

m (template moved to SumQuestItems)
(Update to newer table)
Tag: Replaced
Line 1: Line 1:
<includeonly>
{{Template:Quest Items}}
{{#arraydefine:array_item_names}}
<!--{{#arraydefine:extracted_quantity_array}}-->
 
<!-- Loop order -> Trader -> Chapter -> Quests -> Task: Checking params -->
{{#arraydefine:traders_arr|{{Merchant Data|All}}}}
<!--Loop Over Traders-->
{{#loop: loopTr|0|{{#arraysize:traders_arr}}|<!--
-->
{{#arraydefine:chapters_array|
{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|All}}
}}
<!--Loop Over Chapters-->
{{#loop: loopC|0|{{#arraysize:chapters_array}}|
{{#arraydefine:quest_array|
{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|All}}
}}
<!--Loop Over Quests-->
{{#loop: loopQ|0|{{#arraysize:quest_array}}|
{{#arraydefine:tasks_array|
{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|all}}
}}
 
<!--Loop Over Tasks-->
<!-- TOO MANY LOOOOOPS, COPY PASTE CODE FOR TASKS -->
<!-- Check if Its fetch 1-->
{{#vardefine:cond1|{{#arraysearch:tasks_array|1}}}}
{{#if:cond1
|<!-- True: Task array has task: 1 -->
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|1|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|1|fetch}}
}}
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|1|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 2-->
{{#vardefine:cond2|{{#arraysearch:tasks_array|2}}}}
{{#if:cond2
|<!-- True: Task array has task: 2 -->
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|2|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|2|fetch}}
}}
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|2|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 3-->
{{#vardefine:cond3|{{#arraysearch:tasks_array|3}}}}
{{#if:cond3
|<!-- True: Task array has task: 3 -->
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|3|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|3|fetch}}
}}
{{#vardefine:current_quantity|{{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|3|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 4-->
{{#vardefine:cond4|{{#arraysearch:tasks_array|4}}}}
{{#if:cond4
|<!-- True: Task array has task: 4 -->
{{#ifeq: {{Merchant Data|{{#arrayindex:traders_arr|{{#var:loopTr}}}}|QuestChapters|{{#arrayindex:chapters_array|{{#var:loopC}}}}|{{#arrayindex:quest_array|{{#var:loopQ}}}}|objectives|4|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|4|fetch}}
}}
{{#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>
{{SumQuestItems}}

Revision as of 15:36, 15 September 2024