Difference between revisions of "Template:ValuableTable/row"

From Stoneshard wiki
Jump to navigation Jump to search
(Fix overuse of "#ifexist", limiting image variants to show.)
Line 16: Line 16:
     <!-- Display image variants -->
     <!-- Display image variants -->
     | '''[[{{#var:Link}}|{{#if:{{#var:TranslateName}}|{{#var:TranslateName}}|{{{1}}}}}]]'''<!--
     | '''[[{{#var:Link}}|{{#if:{{#var:TranslateName}}|{{#var:TranslateName}}|{{{1}}}}}]]'''<!--
     -->{{#vardefine:Images|}}
     --><!-- Exibir as imagens concatenadas caso existam -->
     {{#ifexist:File:{{#var:ImageBase}} A.png|
    {{#if:{{#explode:{{#var:Variants}}|,|0}}|[[File:{{#explode:{{#var:Variants}}|,|0}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]
         {{#vardefine:Images|{{#var:Images}} [[File:{{#var:ImageBase}} A.png|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}}|,|3}}|[[File:{{#explode:{{#var:Variants}}|,|3}}|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}}}<!--
    --- Caso nenhuma imagem seja encontrada, exibe a imagem base (opcional) ---
    -->{{#if:{{#explode:{{#var:Variants}}|,|0}}| |
         {{#ifexist:File:{{#var:ImageBase}}.png|[[File:{{#var:ImageBase}}.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}
     }}
     }}
    {{#ifexist:File:{{#var:ImageBase}} B.png|
        {{#vardefine:Images|{{#var:Images}} [[File:{{#var:ImageBase}} B.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}
    }}
    {{#ifexist:File:{{#var:ImageBase}} C.png|
        {{#vardefine:Images|{{#var:Images}} [[File:{{#var:ImageBase}} C.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}
    }}
    {{#ifexist:File:{{#var:ImageBase}} D.png|
        {{#vardefine:Images|{{#var:Images}} [[File:{{#var:ImageBase}} D.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]}}
    }}
    {{#if:{{#var:Images}}|{{#var:Images}}|<!-- Otherwise, display base image -->
        {{#ifexist:File:{{#var:ImageBase}}.png|
            [[File:{{#var:ImageBase}}.png|center|alt={{#var:TranslateName}}|class=image2x|link={{#var:Link}}]]
        }}
    }}
    Variants: {{#var:ImageBase}}
     <!-- Display the rest of the data in the row -->
     <!-- 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}}}}

Revision as of 03:46, 22 January 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 50× Common folk believe agate to bring good luck. It's often used to make cheap jewelry. Gold.png Agate


Multiple Images

Item Inv. Slots Price Gold Icon Description


Horse Pelt 60× Peasants only kill horses that are hopelessly sick or already half-dead from old age. Gold.png Horse Pelt



Rabbit Pelt 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. Gold.png Rabbit Pelt