Difference between revisions of "Template:NPCLootTable/row"

From Stoneshard wiki
Jump to navigation Jump to search
(Finally Working. Item images working. Needs logic for "Buys" Action.)
(New logic working. Still needs tweaks.)
 
Line 9: Line 9:
     -->{{#vardefine:CategoryData|{{#explode:{{#var:DataCategories}}|{{{3}}}}}}}<!-- Fetches the data for the specified category
     -->{{#vardefine:CategoryData|{{#explode:{{#var:DataCategories}}|{{{3}}}}}}}<!-- Fetches the data for the specified category
     -->{{#vardefine:ItemList|{{#explode:{{:NPCLoot data|{{{1}}}|{{{3}}}}}}}}}<!-- This access the {{{3}}} param directly.
     -->{{#vardefine:ItemList|{{#explode:{{:NPCLoot data|{{{1}}}|{{{3}}}}}}}}}<!-- This access the {{{3}}} param directly.
     -->{{#vardefine:TestWeaponImage|{{#explode:{{#var:TestDirectAcccess|;|0}}}}}}<!-- test fetches the data for the specified Param.
     -->{{#vardefine:BuysItemList|{{#explode:{{:NPCLoot data|{{{1}}}|Buys}}}}}}<!-- This access the "Buys" param directly.
     -->
     -->
     |-
     |-
     <!-- First column: Category -->
     | width="5%" | {{#ifeq:{{#var:Action}}|Buys|<!--
     | '''{{{3}}}'''<br>{{#if:{{#var:Category}}|[[File:{{#var:Category}}_icon.png|42px]]}}<!--
    --- Action is 'Buys': Display NPC Icon ---
    --- Second column: Items -->
     -->{{#if:{{#var:Name}}|[[File:{{#var:Name}}.png|64px]]|No image found for [[{{#var:Name}}]].}}<br>'''[[{{#var:Name}}]]'''<!--
     | <span class="stoneshard sortable" style="display: flex; text-align: center; justify-content: center;"><!-- Flex container ---
    -->}}<!--
         --><span>'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|0}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|0}}|[[File:{{#explode:{{#var:ItemList}}|;|0}}.png|64px|link=]]|No image found.}}</span><!--  
     -->{{#ifeq:{{#var:Action}}|Sells|
        --><span>'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|1}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|1}}|[[File:{{#explode:{{#var:ItemList}}|;|1}}.png|64px|link=]]|No image found }}</span><!--
        <!-- Action is "Sells": Display Category Icons -->
         --><span>'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|2}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|2}}|[[File:{{#explode:{{#var:ItemList}}|;|2}}.png|64px|link=]]|No image found }}</span><!--
         '''{{{3}}}'''<br>{{#if:{{#var:Category}}|[[File:{{#var:Category}}_icon.png|42px]]}}<!--
         --><span>'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|3}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|3}}|[[File:{{#explode:{{#var:ItemList}}|;|3}}.png|64px|link=]]|No image found }}</span><!--
    -->}}
         --><span>'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|4}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|4}}|[[File:{{#explode:{{#var:ItemList}}|;|4}}.png|64px|link=]]|No image found }}</span><!--
    <!-- Second column: Conditional Content -->
         --><span>'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|5}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|5}}|[[File:{{#explode:{{#var:ItemList}}|;|5}}.png|64px|link=]]|No image found }}</span><!--
    | {{#ifeq:{{#var:Action}}|Buys|<!-- '''[[{{#if:{{#var:BuysItemList}}|;|0|No category found.}}]]'''
         --><span>'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|6}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|6}}|[[File:{{#explode:{{#var:ItemList}}|;|6}}.png|64px|link=]]|No image found }}</span>
        --- Action is 'Buys': Display categories ---  
    </span><!--
    --><span class="stoneshard sortable" style="display: flex; text-align: center; justify-content: center;"><!-- Flex container ---
--></includeonly><noinclude>{{doc|Template:NPCLootTable/row}}[[Category:Templates]]</noinclude>
        --><span>'''[[{{#if:{{#explode:{{#var:BuysItemList}}|;|0|No category found.}}}}]]'''<br>{{#if:{{#explode:{{#var:BuysItemList}}|;|0}}|[[File:{{#explode:{{#var:BuysItemList}}|;|0}}_icon.png|64px|link=]]|No icon found.}}</span><!--
         --><span>'''[[{{#if:{{#explode:{{#var:BuysItemList}}|;|1|No category found.}}}}]]'''<br>{{#if:{{#explode:{{#var:BuysItemList}}|;|1}}|[[File:{{#explode:{{#var:BuysItemList}}|;|1}}_icon.png|64px|link=]]|No icon found }}</span><!--
         --><span>'''[[{{#if:{{#explode:{{#var:BuysItemList}}|;|2|No category found.}}}}]]'''<br>{{#if:{{#explode:{{#var:BuysItemList}}|;|2}}|[[File:{{#explode:{{#var:BuysItemList}}|;|2}}_icon.png|64px|link=]]|No icon found }}</span><!--
         --><span>'''[[{{#if:{{#explode:{{#var:BuysItemList}}|;|3|No category found.}}}}]]'''<br>{{#if:{{#explode:{{#var:BuysItemList}}|;|3}}|[[File:{{#explode:{{#var:BuysItemList}}|;|3}}_icon.png|64px|link=]]|No icon found }}</span><!--
         --><span>'''[[{{#if:{{#explode:{{#var:BuysItemList}}|;|4|No category found.}}}}]]'''<br>{{#if:{{#explode:{{#var:BuysItemList}}|;|4}}|[[File:{{#explode:{{#var:BuysItemList}}|;|4}}_icon.png|64px|link=]]|No icon found }}</span><!--
         --><span>'''[[{{#if:{{#explode:{{#var:BuysItemList}}|;|5|No category found.}}}}]]'''<br>{{#if:{{#explode:{{#var:BuysItemList}}|;|5}}|[[File:{{#explode:{{#var:BuysItemList}}|;|5}}_icon.png|64px|link=]]|No icon found }}</span><!--
        --><span>'''[[{{#if:{{#explode:{{#var:BuysItemList}}|;|6|No category found.}}}}]]'''<br>{{#if:{{#explode:{{#var:BuysItemList}}|;|6}}|[[File:{{#explode:{{#var:BuysItemList}}|;|6}}_icon.png|64px|link=]]|No icon found }}</span><!--
    --></span>}}<!--
    -->{{#ifeq:{{#var:Action}}|Sells|
        <!-- Default Action: Display items -->
        <span class="stoneshard sortable" style="display: flex; text-align: center; justify-content: center;"><!-- Flex container ---
        --><span>{{#if:{{#explode:{{#var:ItemList}}|;|0}}|'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|0}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|0}}|[[File:{{#explode:{{#var:ItemList}}|;|0}}.png|64px|link=]]|No image found.}}}}</span><!--
        --><span>{{#if:{{#explode:{{#var:ItemList}}|;|1}}|'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|1}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|1}}|[[File:{{#explode:{{#var:ItemList}}|;|1}}.png|64px|link=]]|}}}}</span><!--
        --><span>{{#if:{{#explode:{{#var:ItemList}}|;|2}}|'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|2}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|2}}|[[File:{{#explode:{{#var:ItemList}}|;|2}}.png|64px|link=]]|No image found }}}}</span><!--
        --><span>{{#if:{{#explode:{{#var:ItemList}}|;|3}}|'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|3}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|3}}|[[File:{{#explode:{{#var:ItemList}}|;|3}}.png|64px|link=]]|No image found }}}}</span><!--
        --><span>{{#if:{{#explode:{{#var:ItemList}}|;|4}}|'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|4}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|4}}|[[File:{{#explode:{{#var:ItemList}}|;|4}}.png|64px|link=]]|No image found }}}}</span><!--
        --><span>{{#if:{{#explode:{{#var:ItemList}}|;|5}}|'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|5}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|5}}|[[File:{{#explode:{{#var:ItemList}}|;|5}}.png|64px|link=]]|No image found }}}}</span><!--
        --><span>{{#if:{{#explode:{{#var:ItemList}}|;|6}}|'''[[{{#replace:{{#explode:{{#var:ItemList}}|;|6}}|_|&#8239;}}]]'''<br>{{#if:{{#explode:{{#var:ItemList}}|;|6}}|[[File:{{#explode:{{#var:ItemList}}|;|6}}.png|64px|link=]]|No image found }}}}</span>
</span><!--
-->}}</includeonly><noinclude>{{doc|Template:NPCLootTable/row}}[[Category:Templates]]</noinclude>

Latest revision as of 19:05, 27 January 2025

WORKING: [INCOMPLETE]
The &#8239; Represents a space " ", to not break the reference for the items. DO NOT DELETE.

Template-info.png Documentation

This article is a stub. You can help Stoneshard wiki by expanding it.

This Template is used to display every category & type of items a NPC trades.

Syntax

{{NPCTable/head}}

Usage

The header is always followed by the {{NPCLootTable/row}}, according to the necessary amount of NPCs to be display.

{{NPCLootTable/head|Bert}}
{{NPCLootTable/row}}
|}

Any NPC Loot information added in NPCLoot data, can be used with the '/row' template.

Examples

A) With a NPC {{NPCLootTable/head|Bert}}:

Category Types

B) With {{NPCLootTable/head|Bert}} & {{NPCLootTable/row|NPC*}}:

Trades

Bert as example

Buys

  • With "head|Bert|Buys", "Buys" & "end"
Bert Buys
Category Types


Bert.png
Bert
[[]]
Armor icon.png
[[]]
Scrolls icon.png
[[]]
Consumables icon.png
[[]]
Jewelry icon.png
[[]]
Loot icon.png
[[]]
Medicine icon.png
[[]]
Other icon.png
{{{2}}})
  • With "head" & "Buys"
Category Types


Bert.png
Bert
[[]]
Armor icon.png
[[]]
Scrolls icon.png
[[]]
Consumables icon.png
[[]]
Jewelry icon.png
[[]]
Loot icon.png
[[]]
Medicine icon.png
[[]]
Other icon.png

Sells

  • With "head", "Sells" & "end"
Category Types


Weapons
Weapons icon.png
Training Crossbow
Training Crossbow.png

{{{2}}})
  • With "head|Bert|Sells" & "SellsX3"
Bert Sells
Category Types


Weapons
Weapons icon.png
Training Crossbow
Training Crossbow.png


Armor
Armor icon.png
Travelling Shoes
Travelling Shoes.png


Tools
Tools icon.png
Hammer
File:Hammer.png
Pickaxe
Pickaxe.png
Bedroll
Bedroll.png

  • With "head" & "SellsX2"
Category Types


Weapons
Weapons icon.png
Training Crossbow
Training Crossbow.png


Tools
Tools icon.png
Hammer
File:Hammer.png
Pickaxe
Pickaxe.png
Bedroll
Bedroll.png