Difference between revisions of "Template:ValuableTable/row"
Jump to navigation
Jump to search
(Fix ItemDescriptions displaying wrong description, because of subdomain. Line breaks in description collumn still needs to be fixed (can't find the template affecting this).) |
(Add image variants handling. Still needs image display & collapse fix.) |
||
Line 2: | Line 2: | ||
--- Load complete datastring into a variable - to only load from the Valuable data page once. --- | --- Load complete datastring into a variable - to only load from the Valuable data page once. --- | ||
-->{{#vardefine:Datastring|{{:Valuable_data|{{{1}}}}}}}<!-- | -->{{#vardefine:Datastring|{{:Valuable_data|{{{1}}}}}}}<!-- | ||
-- Separate/ | -- Separate/Allocate values from datastring into individual variables. -- | ||
-->{{#vardefine:ItemID|{{#explode: {{#var:Datastring}}|;|0}}}}<!-- valuable00; | -->{{#vardefine:ItemID|{{#explode: {{#var:Datastring}}|;|0}}}}<!-- valuable00; | ||
-->{{#vardefine: | -->{{#vardefine:ImageBase|{{#explode: {{#var:Datastring}}|;|1}}}}<!-- (valuable name); | ||
-->{{#vardefine:InvSlots|{{#explode: {{#var:Datastring}}|;|2}}}}<!-- 1x1; | -->{{#vardefine:InvSlots|{{#explode: {{#var:Datastring}}|;|2}}}}<!-- 1x1; | ||
-->{{#vardefine:Price|{{#explode: {{#var:Datastring}}|;|3}}}}<!-- 100; | -->{{#vardefine:Price|{{#explode: {{#var:Datastring}}|;|3}}}}<!-- 100; | ||
Line 15: | Line 15: | ||
--- Check if item name has a translation. If yes, load translation of item name. If not, return empty string. Used for other languages. --- | --- Check if item name has a translation. If yes, load translation of item name. If not, return empty string. Used for other languages. --- | ||
-->{{#if:{{#var:TranslateName}}|{{#var:TranslateName}}}}]]'''<!-- | -->{{#if:{{#var:TranslateName}}|{{#var:TranslateName}}}}]]'''<!-- | ||
-->[[File:{{{1}}}.png|center|<!-- | --> | ||
<!-- Display the image(s) --> | |||
{{#ifexist:File:{{#var:ImageBase}} A.png|<!-- If variant images exist --> | |||
<!-- Display each variant --> | |||
[[File:{{#var:ImageBase}} A.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}|{{{1}}}|{{{1}}}/{{SUBPAGENAME}}}}]] | |||
{{#ifexist:File:{{#var:ImageBase}} B.png|[[File:{{#var:ImageBase}} B.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}|{{{1}}}|{{{1}}}/{{SUBPAGENAME}}}}]]}} | |||
{{#ifexist:File:{{#var:ImageBase}} C.png|[[File:{{#var:ImageBase}} C.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}|{{{1}}}|{{{1}}}/{{SUBPAGENAME}}}}]]}} | |||
{{#ifexist:File:{{#var:ImageBase}} D.png|[[File:{{#var:ImageBase}} D.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}|{{{1}}}|{{{1}}}/{{SUBPAGENAME}}}}]]}} | |||
|<!-- Otherwise, display the base image --> | |||
{{#ifexist:File:{{#var:ImageBase}}.png|[[File:{{#var:ImageBase}}.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}|{{{1}}}|{{{1}}}/{{SUBPAGENAME}}}}]]}} | |||
}} | |||
<!-- Display the rest of the data in the row --> | |||
| {{slots|{{#explode: {{#var:InvSlots}}|x|0}}|{{#explode: {{#var:InvSlots}}|x|1}}}} | | {{slots|{{#explode: {{#var:InvSlots}}|x|0}}|{{#explode: {{#var:InvSlots}}|x|1}}}} | ||
| {{#var:Price}} [[File:Gold.png|27x27px]] | | {{#var:Price}} [[File:Gold.png|27x27px]] | ||
| {{#if:{{#var:ItemDescription}}|{{#var:ItemDescription}}|{{1}}}} | | {{#if:{{#var:ItemDescription}}|{{#var:ItemDescription}}|{{{1}}}}} | ||
</includeonly> | </includeonly> | ||
<noinclude>{{doc}}[[Category:Templates]]</noinclude> | <noinclude>{{doc}}[[Category:Templates]]</noinclude> |
Latest revision as of 23:37, 15 January 2025
Documentation
[purge]
This article is a stub. You can help Stoneshard wiki by expanding it. |
This Template replicates the logic used for the Template:WeaponTable/row.
Syntax
{{ValuableTable/row|Agate}}
Usage
It should be used with a 'header', right before it.
{{ValuableTable/head}}
{{ValuableTable/row|Agate}}
.
Any Valuables added in Valuable Data, can be used with the '/row' template.
Examples
Single Image
Item | Inv. Slots | Price | Description
|
---|---|---|---|
Agate | 1×1 | 50 | Common folk believe agate to bring good luck. It's often used to make cheap jewelry.
|
Multiple Images
Item | Inv. Slots | Price | Description
|
---|---|---|---|
Horse Pelt | 2×3 | 60 | Peasants only kill horses that are hopelessly sick or already half-dead from old age.
|
Rabbit Pelt | 1×2 | 40-50 | Despite how cautious and skittish rabbits can be, hunting one down isn't that hard. Their pelts are usually used to make clothes.
|