From Dark and Darker Wiki

(Fixed bug. Table and header row were missing closing tags.)
(Un-nested the template calls.)
Line 1: Line 1:
<includeonly><!--
<includeonly><!--
Manual filter list
-->{{#arraydefine:Filter|Silver Ore}}<!--
-->{{#arraydefine:Filter|Silver Ore}}<!--
Get the list of items for which to generate rows
-->{{#arraydefine:Miscs|{{Misc Data|Alllists|Types|Misc|{{#if:{{{craftable|}}}|Craftable|Uncraftable}}|{{{1}}}}} }}{{#arraydiff:Miscs|Miscs|Filter}}<!--
-->{{#arraydefine:Miscs|{{Misc Data|Alllists|Types|Misc|{{#if:{{{craftable|}}}|Craftable|Uncraftable}}|{{{1}}}}} }}{{#arraydiff:Miscs|Miscs|Filter}}<!--
--><table class="wikitable sortable jquery-tablesorter stripedtable" cellspacing="0" style="color:#eee; background:transparent; text-align:center; vertical-align:middle;">
 
Create table header row -->
<table class="wikitable sortable jquery-tablesorter stripedtable" cellspacing="0" style="color:#eee; background:transparent; text-align:center; vertical-align:middle;">
<tr>
<tr>
{{#switch:{{{1|}}}
{{#switch:{{{1|}}}
<!-- Must manually set colspan and col titles according to drop existence of Gems -->
<!-- Must manually set colspan and col titles according to drop existence of Gems -->
|Gem=<th style="font-weight:bold; width:200px;" rowspan="2">Name</th>
|Gem=
<th style="font-weight:bold; width:200px;" rowspan="2">Name</th>
<th style="font-weight:bold;" colspan="6">Price</th>
<th style="font-weight:bold;" colspan="6">Price</th>
<th style="font-weight:bold;" colspan="6">Price / Slot Size</th>
<th style="font-weight:bold;" colspan="6">Price / Slot Size</th>
Line 24: Line 30:
<th style="font-weight:bold; background-color:rgb(var(--rarity-6),0.7); width:5.5%;">VII</th>
<th style="font-weight:bold; background-color:rgb(var(--rarity-6),0.7); width:5.5%;">VII</th>


<!-- Must manually set colspan and col titles according to drop existence of Herbs -->
<!-- Must manually set colspan and col titles according to drop existence of Herbs -->
|Herb=<th style="font-weight:bold; width:200px;" rowspan="2">Name</th>
|Herb=
<th style="font-weight:bold; width:200px;" rowspan="2">Name</th>
<th style="font-weight:bold;" colspan="4">Price</th>
<th style="font-weight:bold;" colspan="4">Price</th>
<th style="font-weight:bold;" colspan="4">Price / Slot Size</th>
<th style="font-weight:bold;" colspan="4">Price / Slot Size</th>
Line 38: Line 45:
<th style="font-weight:bold; background-color:rgb(var(--rarity-4),0.7); width:5.5%;">V</th>
<th style="font-weight:bold; background-color:rgb(var(--rarity-4),0.7); width:5.5%;">V</th>
<th style="font-weight:bold; background-color:rgb(var(--rarity-5),0.7); width:5.5%;">VI</th>
<th style="font-weight:bold; background-color:rgb(var(--rarity-5),0.7); width:5.5%;">VI</th>
 
|HuntingLoot
|#default=
|Ore
<th style="font-weight:bold; background-color:rgb(220,220,220,0.2); width:200px;">Name</th>
|Container
|Currency=<th style="font-weight:bold; background-color:rgb(220,220,220,0.2); width:200px;">Name</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Price</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Price</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Price / Slot Size</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Price / Slot Size</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Item Achieve</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Item Achieve</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Inventory Size</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Max Stack Size</th>
|#default=<th style="font-weight:bold; background-color:rgb(220,220,220,0.2); width:200px;">Name</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Price</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Price / Slot Size</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Inventory Size</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Inventory Size</th>
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Max Stack Size</th>}}</tr><!--
<th style="font-weight:bold; background-color: rgb(220,220,220,0.2); width:200px;">Max Stack Size</th>}}</tr><!--
Loop over each item
-->{{#loop:i|0|{{#arraysize:Miscs}}<!--
-->{{#loop:i|0|{{#arraysize:Miscs}}<!--
-->|{{#vardefine:current|{{#arrayindex:Miscs|{{#var:i}} }} }}<!--
-->|{{#vardefine:current|{{#arrayindex:Miscs|{{#var:i}} }} }}<!--
If the current item is Silver Ore, do not generate a row for it
 
-->{{GenerateMiscRow|{{#var:current}}}} }}</table><!--
Format a table row for the current item
Preprocessing: Collect booleans, slot information, and rarity information.
-->{{#vardefine:types|{{Misc Data|{{#var:current}}|Types|All}} }}<!--
-->{{#vardefine:is_gem|{{#pos:{{#var:types}}|Gem}} }}<!--
-->{{#vardefine:is_herb|{{#pos:{{#var:types}}|Herb}} }}<!--
-->{{#vardefine:is_ammo|{{#pos:{{#var:types}}|Ammo}} }}<!--
{{#vardefine:is_hunting_loot|{{#pos:{{#var:types}}|HuntingLoot}} }}
{{#vardefine:is_ore|{{#pos:{{#var:types}}|Ore}} }}
{{#vardefine:is_container|{{#pos:{{#var:types}}|Container}} }}
{{#vardefine:is_currency|{{#pos:{{#var:types}}|Currency}} }}
{{#vardefine:is_powder|{{#pos:{{#var:types}}|Currency}} }}
{{#vardefine:is_ingot|{{#pos:{{#var:types}}|Currency}} }}
 
Define the width and height of the item's inventory slot.
-->{{#vardefine:slot_width|{{Misc Data|{{#var:current}}|invwidth}} }}<!--
-->{{#vardefine:slot_height|{{Misc Data|{{#var:current}}|invheight}} }}<!--
-->{{#vardefine:slot_size|{{#expr:{{#var:slot_width}}*{{#var:slot_height}} }} }}<!--
 
Determine rarities for the item
-->{{#vardefine:is_first|1}}<!--
-->{{#switch:1|<!--
For Gem, Herb, and Ammo items determine rarities by whether they drop or not
-->|{{#if:{{#var:is_gem}}|1}}=<!--
-->{{#vardefine:rarities|<!--
-->{{#loop:i|0|8<!--
-->|{{#ifexist:DropTable:Diamond {{#var:i}}<!--
-->|{{#if:{{#var:is_first}}|{{#vardefine:is_first|}}|,}}<!--
-->{{#var:i}} }} }} }}<!--
-->|{{#if:{{#var:is_herb}}|1}}=<!--
-->{{#vardefine:rarities|<!--
-->{{#loop:i|0|8<!--
-->|{{#ifexist:DropTable:Lifeleaf {{#var:i}}<!--
-->|{{#if:{{#var:is_first}}|{{#vardefine:is_first|}}|,}}<!--
-->{{#var:i}} }} }} }}<!--
-->|{{#if:{{#var:is_ammo}}|1}}=<!--
-->{{#vardefine:rarities|<!--
-->{{#loop:i|0|3<!--
-->|{{#ifexist:DropTable:Arrow {{#var:i}}<!--
-->|{{#if:{{#var:is_first}}|{{#vardefine:is_first|}}|,}}<!--
-->{{#var:i}} }} }} }}<!--
-->|#default={{#vardefine:rarities|{{Misc Data|{{#var:current}}|Rarities}} }} }}<!--
 
Define boolean flag for multiple rarities
-->{{#vardefine:multiple_rarities|{{#pos:{{#var:rarities}}|,}} }}<!--
 
Define rarities array for loops
-->{{#arraydefine:rarities|{{#var:rarities}} }}<!--
 
Generate Table Row
--><tr style="height:150px;"><!--
Item Iconbox
--><td>{{Iconbox<!--
-->|{{#var:current}}<!--
-->|rarity=<!--
-->{{#if:{{#var:multiple_rarities}}<!--
-->|2<!--
-->|{{#var:rarities}} }}<!--
-->|size={{IconboxInventorySize|Misc Data|{{#var:current}}}}<!--
-->|caption=<!--
-->{{#if:{{#var:multiple_rarities}}<!--
-->||<span class="colorrarity{{#var:rarities}}">{{#var:current}}</span>}} }}</td><!--
 
Sell Price Value of One Item
-->{{#loop:i|{{#arrayindex:rarities|0}}|{{#arraysize:rarities}}<!--
-->|<td>{{Misc Data|{{#var:current}}|SellPrices|{{#var:i}} }}</td>}}<!--
 
Sell Price Value per Slot of One Item
-->{{#loop:i|{{#arrayindex:rarities|0}}|{{#arraysize:rarities}}<!--
-->|<td>{{#iferror:{{#expr:{{Misc Data|{{#var:current}}|SellPrices|{{#var:i}} }}/{{#var:slot_size}} round 2}}|}}</td>}}<!--
 
Item Achieve Value
-->{{#if:{{#var:is_gem}}{{#var:is_herb}}<!--
-->||<td>{{Misc Data|{{#var:current}}|AP|{{#var:rarities}} }}</td>}}<!--
 
Inventory Size
--><td>{{#var:slot_width}}x{{#var:slot_height}}</td><!--
 
Stack Size
--><td>{{Misc Data|{{#var:current}}|MaxCount}}</td></tr>}}</table><!--


--></includeonly><noinclude>
--></includeonly><noinclude>
Line 64: Line 143:
<pre>{{GenerateMiscRows|Gem}}</pre>
<pre>{{GenerateMiscRows|Gem}}</pre>
{{GenerateMiscRows|Gem}}
{{GenerateMiscRows|Gem}}
==Example 2==
<pre>{{GenerateMiscRows|Herb}}</pre>
{{GenerateMiscRows|Herb}}
==Example 3==
<pre>{{GenerateMiscRows|Ammo}}</pre>
{{GenerateMiscRows|Ammo}}
</noinclude>
</noinclude>

Revision as of 09:26, 10 May 2024

List Miscs and generate rows with them

Example 1

{{GenerateMiscRows|Gem}}

Template:GenerateMiscRows