Difference between revisions of "Template:NPCLootTable/row"
Jump to navigation
Jump to search
A) With a NPC
B) With
m (Fix base idea. Clear code.) |
(Add translation logic & test for template use.) |
||
Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- {{NPCLootTable/row|Trade|Type}} --- | ||
--- 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}}}}}}}<!-- | -->{{#vardefine:Datastring|{{:NPCLoot data|{{{1}}}}}}}<!-- | ||
-->{{#vardefine:Exists|{{#ifeq: {{:Friendly data|{{{1}}}|Occupation}}|NPC {{{1}}} does not exist in [[Friendly data]].||{{:Friendly data|{{{1}}}|Occupation}}}}}}<!-- | -->{{#vardefine:Exists|{{#ifeq: {{:Friendly data|{{{1}}}|Occupation}}|NPC {{{1}}} does not exist in [[Friendly data]].||{{:Friendly data|{{{1}}}|Occupation}}}}}}<!-- | ||
-->{{#vardefine: | --- Fetch Buys and Sells data -- | ||
-->{{#vardefine: | -->{{#vardefine:Buys|{{:Datastring|{{#var:{{PAGENAME}}}}|Buys}}}}<!-- | ||
-->{{#vardefine:Category|{{{2}}}}}<!-- | -->{{#vardefine:Sells|{{:Datastring|{{#var:{{PAGENAME}}}}|Sells}}}}<!-- | ||
-->{{#vardefine: | --- Define variables for the type and item from the NPC --- | ||
-->{{#vardefine:NPC|{{{1}}}}} <!-- NPC name --- | |||
-->{{#vardefine:Trade|{{{1|}}}}} <!-- Buys or Sells --- | |||
-->{{#vardefine:Category|{{{2|}}}}} <!-- Category of Items --- | |||
--- Load translations that are used multiple times into variables. --- | |||
-->{{#vardefine:TranslateCategory|{{Translate|{{{1}}}|Properties}}}}<!-- | |||
--- Load translated description or fallback to base description --- | |||
--> {{#vardefine:ItemDescription|{{#ifexist:Template:{{uc:{{SUBPAGENAME}}}}_Properties|{{:Template:{{uc:{{SUBPAGENAME}}}}_Properties|{{{1}}}}}|{{#var:ItemDescription}}}}}} <!-- | |||
--- Define "Link" var, with a subpage verification. If subpagename = pagename, we are not on a subpage, therefore URL becomes "item name". If we are on a subpage, URL becomes "item name/subgpagename". Used for other languages. --- | |||
-->{{#vardefine:Link|{{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}|{{{1}}}|{{{1}}}/{{SUBPAGENAME}}}}}}<!-- | |||
--> | --> | ||
|- | |- <!-- Second column [Name & Icon inside row] --> | ||
| '''[[{{#var:Link}}|{{#if:{{#var:TranslateName}}|{{#var:TranslateName}}|{{{1}}}}}]]'''<!-- | |||
| | --><br>[[File:Armor_icon.png|42px|link=|]] | ||
| {{#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}}}}]]<!-- | | {{#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. --- | --- Extra images for NPC entries like generic guards or peasants. Many face images with no link. --- |
Revision as of 06:42, 26 January 2025
![]() |
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![]() |
![]() BertBuys File:Icon.png | |||||||
{{{2}}}) |
- With "head" & "Buys"
Category | Types |
---|---|
Bert![]() |
![]() BertBuys File:Icon.png |
Sells
- With "head", "Sells" & "end"
Category | Types | |||||||
---|---|---|---|---|---|---|---|---|
Bert![]() |
![]() BertSells File:Icon.png | |||||||
{{{2}}}) |
- With "head|Bert|Sells" & "SellsX3"
Bert Sells | |
---|---|
Category | Types |
Bert![]() |
![]() BertSells File:Icon.png |
Bert![]() |
![]() BertSells File:Icon.png |
Bert![]() |
![]() BertSells File:Icon.png |
- With "head" & "SellsX2"
Category | Types |
---|---|
Bert![]() |
![]() BertSells File:Icon.png |
Bert![]() |
![]() BertSells File:Icon.png |