Difference between revisions of "Template:NPCLootTable/row"

From Stoneshard wiki
Jump to navigation Jump to search
(Add NPCTable/row copy.)
 
(New logic working. Still needs tweaks.)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><!--
<noinclude>'''WORKING: [INCOMPLETE]'''<br>The {{c|+|&#8239}}; Represents a space " ", to not break the reference for the items. {{c|-|DO NOT DELETE}}.</noinclude>
--- Define variables, goal is to only load each property from the Data page once. ---
<includeonly><!--  {{NPCLootTable/row|Jurg|Sell|Weapons}} ---
-->{{#vardefine:Exists|{{#ifeq: {{:Friendly data|{{{1}}}|Occupation}}|NPC {{{1}}} does not exist in [[Friendly data]].||{{:Friendly data|{{{1}}}|Occupation}}}}}}<!--
    --- Define variables, goal is to only load each property from the Data page once. ---
-->{{#vardefine:Name|{{:Friendly data|{{{1}}}|Name}}}}<!--
    --- Loads the parameters from the NPC specified in the first parameter ---
-->{{#vardefine:Image|{{:Friendly data|{{{1}}}|Image}}}}<!--
    -->{{#vardefine:Name|{{{1}}}}} <!-- Define NPC name
-->{{#vardefine:Image2|{{:Friendly data|{{{1}}}|Image2}}}}<!--
    -->{{#vardefine:Action|{{{2}}}}}<!-- Defines Action = second parameter
-->{{#vardefine:Image3|{{:Friendly data|{{{1}}}|Image3}}}}<!--
    -->{{#vardefine:Category|{{{3}}}}}<!-- Defines Category = third parameter
-->{{#vardefine:Image4|{{:Friendly data|{{{1}}}|Image4}}}}<!--
    -->{{#vardefine:DataCategories|{{:NPCLoot data|{{{1}}}}}}}<!-- Fetches data for the specified NPC
-->{{#vardefine:Image5|{{:Friendly data|{{{1}}}|Image5}}}}<!--
    -->{{#vardefine:CategoryData|{{#explode:{{#var:DataCategories}}|{{{3}}}}}}}<!-- Fetches the data for the specified category
-->{{#vardefine:Image6|{{:Friendly data|{{{1}}}|Image6}}}}
    -->{{#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.
| {{:Friendly data|{{{1}}}|Occupation}}
    -->
| {{#if:{{#var:Exists}}|[[File:{{#if:{{#var:Image}}|{{#var:Image}}|{{{1}}}.png}}|37px|link={{#if:{{#var:Name}}|{{#if:{{#pos:{{lc:{{#var:Name}}}}|random}}||{{Translate|{{#var:Name}}|NPCNames}}}}|{{Translate|{{{1}}}|NPCNames}}}}]]<!--
    |-
--- Extra images for NPC entries like generic guards or peasants. Many face images with no link. ---
    | width="5%" | {{#ifeq:{{#var:Action}}|Buys|<!--
-->{{#if:{{#var:Image2}}|[[File:{{#var:Image2}}|37px|link=]]}}<!--
    --- Action is 'Buys': Display NPC Icon ---
-->{{#if:{{#var:Image3}}|[[File:{{#var:Image3}}|37px|link=]]}}<!--
    -->{{#if:{{#var:Name}}|[[File:{{#var:Name}}.png|64px]]|No image found for [[{{#var:Name}}]].}}<br>'''[[{{#var:Name}}]]'''<!--
-->{{#if:{{#var:Image4}}|[[File:{{#var:Image4}}|37px|link=]]}}<!--
    -->}}<!--
-->{{#if:{{#var:Image5}}|[[File:{{#var:Image5}}|37px|link=]]}}<!--
    -->{{#ifeq:{{#var:Action}}|Sells|
-->{{#if:{{#var:Image6}}|[[File:{{#var:Image6}}|37px|link=]]}}<!--
        <!-- Action is "Sells": Display Category Icons -->
--><br>{{#if:{{#var:Name}}|{{#if:{{#pos:{{lc:{{#var:Name}}}}|random}}|{{Translate|{{#var:Name}}|NPCNames}}|[[{{Translate|{{#var:Name}}|NPCNames}}]]}}|[[{{Translate|{{{1}}}|NPCNames}}]]}}}}
        '''{{{3}}}'''<br>{{#if:{{#var:Category}}|[[File:{{#var:Category}}_icon.png|42px]]}}<!--
| {{#if:{{#var:Exists}}|{{#if:{{:Friendly data|{{{1}}}|Contract}}|'''✓'''}}}}
    -->}}
| {{#if:{{#var:Exists}}|{{#if:{{:Friendly data|{{{1}}}|Quest}}|'''✓'''}}}}{{#if:{{{2|}}}|<sup>{{{2|}}}</sup>}}
    <!-- Second column: Conditional Content -->
| {{#if:{{#var:Exists}}|{{#if:{{:Friendly data|{{{1}}}|Trader}}|'''✓'''}}}}
    | {{#ifeq:{{#var:Action}}|Buys|<!-- '''[[{{#if:{{#var:BuysItemList}}|;|0|No category found.}}]]'''
| {{#if:{{#var:Exists}}|{{#if:{{:Friendly data|{{{1}}}|Repair}}|'''✓'''}}}}
        --- Action is 'Buys': Display categories ---  
| {{#if:{{#var:Exists}}|{{#if:{{:Friendly data|{{{1}}}|Rumors}}|''''''}}}}
    --><span class="stoneshard sortable" style="display: flex; text-align: center; justify-content: center;"><!-- Flex container ---
| {{#if:{{#var:Exists}}|{{#if:{{:Friendly data|{{{1}}}|Lore}}|'''✓'''}}}}
        --><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:{{#var:Exists}}|{{#if:{{:Friendly data|{{{1}}}|UniqueDialogue}}|'''✓'''}}}}<!--
        --><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><!--
--></includeonly><noinclude>{{doc|Template:NPCTable/row}}[[Category:Templates]]</noinclude>
        --><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