Difference between revisions of "Template:NPCLootTable/row"
Jump to navigation
Jump to search
A) With a NPC
B) With
(Add NPCTable/row copy.) |
(New logic working. Still needs tweaks.) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
< | <noinclude>'''WORKING: [INCOMPLETE]'''<br>The {{c|+| }}; 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. --- | |||
-->{{#vardefine: | --- Loads the parameters from the NPC specified in the first parameter --- | ||
-->{{#vardefine: | -->{{#vardefine:Name|{{{1}}}}} <!-- Define NPC name | ||
-->{{#vardefine: | -->{{#vardefine:Action|{{{2}}}}}<!-- Defines Action = second parameter | ||
-->{{#vardefine: | -->{{#vardefine:Category|{{{3}}}}}<!-- Defines Category = third parameter | ||
-->{{#vardefine: | -->{{#vardefine:DataCategories|{{:NPCLoot data|{{{1}}}}}}}<!-- Fetches data for the specified NPC | ||
-->{{#vardefine: | -->{{#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:BuysItemList|{{#explode:{{:NPCLoot data|{{{1}}}|Buys}}}}}}<!-- This access the "Buys" param directly. | ||
--> | |||
|- | |||
--- | | width="5%" | {{#ifeq:{{#var:Action}}|Buys|<!-- | ||
--- Action is 'Buys': Display NPC Icon --- | |||
--> | -->{{#if:{{#var:Name}}|[[File:{{#var:Name}}.png|64px]]|No image found for [[{{#var:Name}}]].}}<br>'''[[{{#var:Name}}]]'''<!-- | ||
-->{{#if:{{# | -->}}<!-- | ||
-->{{#ifeq:{{#var:Action}}|Sells| | |||
-->{{#if:{{#var: | <!-- 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>'''[[{{#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}}|_| }}]]'''<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}}|_| }}]]'''<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}}|_| }}]]'''<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}}|_| }}]]'''<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}}|_| }}]]'''<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}}|_| }}]]'''<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}}|_| }}]]'''<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   Represents a space " ", to not break the reference for the items. DO NOT DELETE.
![]() |
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 |
[[]]![]() ![]() ![]() ![]() ![]() ![]() ![]() | |||||||
{{{2}}}) |
- With "head" & "Buys"
Category | Types
|
---|---|
![]() Bert |
[[]]![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Sells
- With "head", "Sells" & "end"
Category | Types
| |||||||
---|---|---|---|---|---|---|---|---|
Weapons![]() |
Training Crossbow![]()
| |||||||
{{{2}}}) |
- With "head|Bert|Sells" & "SellsX3"
Bert Sells | |
---|---|
Category | Types
|
Weapons![]() |
Training Crossbow![]()
|
Armor![]() |
Travelling Shoes![]()
|
Tools![]() |
Hammer File:Hammer.pngPickaxe ![]() ![]()
|
- With "head" & "SellsX2"
Category | Types
|
---|---|
Weapons![]() |
Training Crossbow![]()
|
Tools![]() |
Hammer File:Hammer.pngPickaxe ![]() ![]()
|