Difference between revisions of "Template:NPCLootTable/row"

From Stoneshard wiki
Jump to navigation Jump to search
(Fix & clean base logic. The category icons are how planned. Needs images fix for the items in each category.)
(New logic working. Still needs tweaks.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<includeonly><!--  {{NPCLootTable/row|Bert|Sells|Weapons}} ---
<noinclude>'''WORKING: [INCOMPLETE]'''<br>The {{c|+|&#8239}}; Represents a space " ", to not break the reference for the items. {{c|-|DO NOT DELETE}}.</noinclude>
<includeonly><!--  {{NPCLootTable/row|Jurg|Sell|Weapons}} ---
     --- Define variables, goal is to only load each property from the Data page once. ---
     --- Define variables, goal is to only load each property from the Data page once. ---
     -->{{#vardefine:Datastring|{{:NPCLoot data|{{{1}}}}}}}<!--
     --- Loads the parameters from the NPC specified in the first parameter ---
    --- Maybe implement later with Friendly data --
     -->{{#vardefine:Name|{{{1}}}}} <!-- Define NPC name
     -->{{#vardefine:Name|{{{1}}}}} <!-- define npcname for tests
     -->{{#vardefine:Action|{{{2}}}}}<!-- Defines Action = second parameter
     -->{{#vardefine:Action|{{{2}}}}}<!-- Defines Action = second parameter
     -->{{#vardefine:Category|{{{3}}}}}<!-- Defines Category = third parameter
     -->{{#vardefine:Category|{{{3}}}}}<!-- Defines Category = third parameter
     -->{{#vardefine:CategoryData|{{#var:Datastring|{{{3}}}}}}}<!-- "| Weapons"
    -->{{#vardefine:DataCategories|{{:NPCLoot data|{{{1}}}}}}}<!-- Fetches data for the specified NPC
     -->{{#vardefine:Items|{{#explode:{{#var:CategoryData}}|;}}}}<!--"Training Crossbow"
     -->{{#vardefine:CategoryData|{{#explode:{{#var:DataCategories}}|{{{3}}}}}}}<!-- Fetches the data for the specified category
     --- First column: Category -->
    -->{{#vardefine:ItemList|{{#explode:{{:NPCLoot data|{{{1}}}|{{{3}}}}}}}}}<!-- This access the {{{3}}} param directly.
     -->{{#vardefine:BuysItemList|{{#explode:{{:NPCLoot data|{{{1}}}|Buys}}}}}}<!-- This access the "Buys" param directly.
     -->
     |-
     |-
     | <!--{{#ifexist:{{#var:Action}}|[[File:Purse.png|42px]]|No Action provided for image}}
     | 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}}]]'''<!--
     | <!--{{#if:{{#var:Items}}|{{:CategoryData|{{#var:Items}}}}|No Items Found}}
    -->}}<!--
     -->{{#ifeq:{{#var:Action}}|Sells|
        <!-- Action is "Sells": Display Category Icons -->
        '''{{{3}}}'''<br>{{#if:{{#var:Category}}|[[File:{{#var:Category}}_icon.png|42px]]}}<!--
     -->}}
    <!-- Second column: Conditional Content -->
     | {{#ifeq:{{#var:Action}}|Buys|<!-- '''[[{{#if:{{#var:BuysItemList}}|;|0|No category found.}}]]'''
        --- Action is 'Buys': Display categories ---
     --><span class="stoneshard sortable" style="display: flex; text-align: center; justify-content: center;"><!-- Flex container ---
     --><span class="stoneshard sortable" style="display: flex; text-align: center; justify-content: center;"><!-- Flex container ---
         -->{{#if:{{#explode:{{#var:Items}}|;|1}}|{{#explode:{{#var:Items}}|;|1}} [[File:{{#explode:{{#var:Items}}|;|1}}_icon.png|37px|link=]]|No image found }}<!--
         --><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><!--
         -->{{#if:{{#explode:{{#var:Items}}|;|2}}|{{#explode:{{#var:Category}}|;|2}} [[File:{{#explode:{{#var:Category}}|;|2}}.png|45px|link=]]|B }}<!--
        --><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><!--
         -->{{#if:{{#explode:{{#var:Items}}|;|3}}|{{#explode:{{#var:Category}}|;|3}} [[File:{{#explode:{{#var:Category}}|;|3}}.png|45px|link=]]|C }}<!--
        --><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><!--
         -->{{#if:{{#explode:{{#var:Items}}|;|4}}|{{#explode:{{#var:Category}}|;|4}} [[File:{{#explode:{{#var:Category}}|;|4}}.png|45px|link=]]|D }}<!--
        --><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><!--
         -->{{#if:{{#explode:{{#var:Items}}|;|5}}|{{#explode:{{#var:Category}}|;|5}} [[File:{{#explode:{{#var:Category}}|;|5}}.png|45px|link=]]|E }}<!--
        --><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><!--
        --><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><!--
--></includeonly><noinclude>{{doc|Template:NPCLootTable/row}}[[Category:Templates]]</noinclude>
        --><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