Difference between revisions of "Template:ValuableTable/row"

From Stoneshard wiki
Jump to navigation Jump to search
(Add description translation test. Apparently, translation is ccurrently not working for the template as it should.)
(Update to match Valuables data.)
 
(10 intermediate revisions by the same user not shown)
Line 3: Line 3:
     -->{{#vardefine:Datastring|{{:Valuable_data|{{{1}}}}}}}<!--
     -->{{#vardefine:Datastring|{{:Valuable_data|{{{1}}}}}}}<!--
     -- Separate/Allocate values from datastring into individual variables. --
     -- Separate/Allocate values from datastring into individual variables. --
     -->{{#vardefine:ItemID|{{#explode: {{#var:Datastring}}|;|0}}}}<!-- valuable00;
     -->{{#vardefine:ImageBase|{{#explode: {{#var:Datastring}}|;|0}}}}<!-- (valuable name);
    -->{{#vardefine:ImageBase|{{#explode: {{#var:Datastring}}|;|1}}}}<!-- (valuable name);
     -->{{#vardefine:Variants|{{#explode: {{#var:Datastring}}|;|1}}}}<!--
     -->{{#vardefine:Variants|{{#explode: {{#var:Datastring}}|;|2}}}}<!--
     -->{{#vardefine:InvSlots|{{#explode: {{#var:Datastring}}|;|2}}}}<!-- 1x1;
     -->{{#vardefine:InvSlots|{{#explode: {{#var:Datastring}}|;|3}}}}<!-- 1x1;
     -->{{#vardefine:Price|{{#explode: {{#var:Datastring}}|;|3}}}}<!-- 100;
     -->{{#vardefine:Price|{{#explode: {{#var:Datastring}}|;|4}}}}<!-- 100;
     -->{{#vardefine:ItemDescription|{{#explode: {{#var:Datastring}}|;|4}}}}<!-- (valuable description)
     -->{{#vardefine:ItemDescription|{{#explode: {{#var:Datastring}}|;|5}}}}<!-- (valuable description)
     --- Load translations that are used multiple times into variables. ---
     --- Load translations that are used multiple times into variables. ---
     -->{{#vardefine:TranslateName|{{Translate|{{{1}}}|ValuableNames}}}}<!--
     -->{{#vardefine:TranslateName|{{Translate|{{{1}}}|ValuableNames}}}}<!--
    --- Load translated description or fallback to base description ---
    --> {{#vardefine:ItemDescription|{{#ifexist:Template:{{uc:{{SUBPAGENAME}}}}_ValuableDescriptions|{{:Template:{{uc:{{SUBPAGENAME}}}}_ValuableDescriptions|{{{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. ---
     --- 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}}}}}}<!--
     -->{{#vardefine:Link|{{#ifeq:{{SUBPAGENAME}}|{{PAGENAME}}|{{{1}}}|{{{1}}}/{{SUBPAGENAME}}}}}}
    --- Ensure Valuables Descriptions translations ---
    -->{{#vardefine:TranslateDescription|{{Translate|{{#var:ItemDescription}}|ValuableDescriptions}}}}
     |- <!-- Starts a new table row. [Image(s) & Name inside row]-->
     |- <!-- Starts a new table row. [Image(s) & Name inside row]-->
     <!-- Display image variants -->
     <!-- Display image variants -->
     | '''[[{{#var:Link}}|{{#if:{{#var:TranslateName}}|{{#var:TranslateName}}|{{{1}}}}}]]'''<!--
     | '''[[{{#var:Link}}|{{#if:{{#var:TranslateName}}|{{#var:TranslateName}}|{{{1}}}}}]]'''<!--
     --><!-- Show image Variants if they exist -->
     --><span class="stoneshard sortable" style="display: flex; text-align: center; justify-content: center;"><!-- Flex container ---
    --- Show image Variants if they exist -->
     {{#if:{{#explode:{{#var:Variants}}|,|0}}|[[File:{{#explode:{{#var:Variants}}|,|0}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]
     {{#if:{{#explode:{{#var:Variants}}|,|0}}|[[File:{{#explode:{{#var:Variants}}|,|0}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]
     {{#if:{{#explode:{{#var:Variants}}|,|1}}|[[File:{{#explode:{{#var:Variants}}|,|1}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}
     {{#if:{{#explode:{{#var:Variants}}|,|1}}|[[File:{{#explode:{{#var:Variants}}|,|1}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}
     {{#if:{{#explode:{{#var:Variants}}|,|2}}|[[File:{{#explode:{{#var:Variants}}|,|2}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}
     {{#if:{{#explode:{{#var:Variants}}|,|2}}|[[File:{{#explode:{{#var:Variants}}|,|2}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}
     {{#if:{{#explode:{{#var:Variants}}|,|3}}|[[File:{{#explode:{{#var:Variants}}|,|3}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}}}<!--
     {{#if:{{#explode:{{#var:Variants}}|,|3}}|[[File:{{#explode:{{#var:Variants}}|,|3}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}}}</span><!--
     --- If no Variant is found, show base image ---
     --- If no Variant is found, show base image ---
     -->{{#if:{{#explode:{{#var:Variants}}|,|0}}| |
     -->{{#if:{{#explode:{{#var:Variants}}|,|0}}| |
Line 30: Line 30:
     | {{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:TranslateDescription}}|{{#var:TranslateDescription}}|{{{1}}}}}
     | {{#if:{{#var:ItemDescription}}|{{#var:ItemDescription}}|{{1}}}}<!--
</includeonly><noinclude>{{doc}}[[Category:Templates]]</noinclude>
--></includeonly><noinclude>{{doc}}[[Category:Templates]]</noinclude>

Latest revision as of 21:44, 29 April 2025

Template-info.png Documentation

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.

Debug

For future modifications or debugging, you can add this, after the "ItemDescription" variable (Open Source to verify code):

   [...]
   |{{{1}}}
   Base Image: 
   Variants: 
   Datastring: 

Examples

Single Image

Item Inv. Slots Price Gold Icon Description
Agate
Agate
1×1 50 Gold.png Common folk believe agate to bring good luck. It's often used to make cheap jewelry.

Multiple Images

Item Inv. Slots Price Gold Icon Description
Horse Pelt
Horse Pelt
Horse Pelt
Horse Pelt
Horse Pelt
2×3 60 Gold.png Peasants only kill horses that are hopelessly sick or already half-dead from old age.
Rabbit Pelt
Rabbit Pelt
Rabbit Pelt
1×2 40-50 Gold.png Despite how cautious and skittish rabbits can be, hunting one down isn't that hard. Their pelts are usually used to make clothes.