Difference between revisions of "Template:CommoditiesRatioTable/row"

From Stoneshard wiki
Jump to navigation Jump to search
(Add base Template. Ratios display needs fix. I believe it's something to do with the dots, in the ratios strings.)
 
m
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>'''{{c|-|NOT WORKING: [INCOMPLETE]}}'''<br>The {{c|+|&#8239}}; Represents a space " ", to not break the reference for the items. {{c|-|DO NOT DELETE}}.</noinclude>
<includeonly><!--
<includeonly><!--  {{NPCLootTable/row|Jurg|Sell|Weapons}} ---
    --- Define variables, goal is to only load each property from the Data page once. ---
     --- Loads the parameters from the NPC specified in the first parameter ---
     --- Loads the parameters from the NPC specified in the first parameter ---
     -->{{#vardefine:Location|{{{1}}}}} <!-- Defines Location = first parameter
     -->{{#vardefine:Location|{{{1}}}}} <!-- Defines Location = first parameter
     -->{{#vardefine:NPC|{{{2}}}}}<!-- Defines NPC = second parameter
     -->{{#vardefine:NPC|{{{2}}}}}<!-- Defines NPC = second parameter
     -->{{#vardefine:DataCategories|{{:CommoditiesRatio data|{{{1}}}}}}}<!-- Fetches data for the specified Location
     -->{{#vardefine:DataCategories|{{:CommoditiesRatio data|{{{1}}}}}}}<!-- Fetches data for the specified Location
     -->{{#vardefine:NPCData|{{#explode:{{#var:DataCategories}}|{{{2}}}}}}}<!-- Fetches the data for the specified NPC
     -->{{#vardefine:NPCData|{{#explode:{{#var:DataCategories}}|{{{2}}}}}}}<!-- Fetches the data (Ratios) for the specified NPC
     -->{{#vardefine:RatiosList|{{#explode:{{:CommoditiesRatio data|{{{1}}}|{{{2}}}}}}}}}<!--  
     -->{{#vardefine:RatiosList|{{#explode:{{:CommoditiesRatio data|{{{1}}}|{{{2}}}}}}}}}<!--
     --- NPCData gathers all Ratios for said NPC ---
     --- Store Ratio Values ---
     -->
    -->{{#vardefine:Ratio00|{{#explode:{{#var:RatiosList}}|;|0}}}}<!--
    -->{{#vardefine:Ratio01|{{#explode:{{#var:RatiosList}}|;|1}}}}<!--
    -->{{#vardefine:Ratio02|{{#explode:{{#var:RatiosList}}|;|2}}}}<!--
    -->{{#vardefine:Ratio03|{{#explode:{{#var:RatiosList}}|;|3}}}}<!--
    -->{{#vardefine:Ratio04|{{#explode:{{#var:RatiosList}}|;|4}}}}<!--
    -->{{#vardefine:Ratio05|{{#explode:{{#var:RatiosList}}|;|5}}}}<!--
     -->{{#vardefine:Ratio06|{{#explode:{{#var:RatiosList}}|;|6}}}}
     |-
     |-
     <!-- Display Location Block (Possible to gather Location in a single block?) -->
     <!-- Display NPC Icon -->
     | {{{1}}} <!-- Location -->
     | {{#if:{{#var:NPC}}|[[File:{{#var:NPC}}.png|64px]]|No image found for [[{{#var:NPC}}]].}}<br>'''[[{{#var:NPC}}]]'''
    | <!--
    <!--- Second to Last columns: Ratios List -->
    --- NPCData gathers all Ratios for said NPC: Display NPC Icon ---
     | '''{{#if:{{#var:Ratio00}}|<!-- Check if Ratio01 is defined and not empty ---
    -->{{#if:{{#var:NPC}}|[[File:{{#var:NPC}}.png|64px]]|No image found for [[{{#var:NPC}}]].}}<br>'''[[{{#var:NPC}}]]'''<!--
        -->{{#vardefine:Ratio00Diff|{{#ifexpr:{{#var:Ratio00}} < 1.15 | 2.0 - {{#var:Ratio00}} | {{#var:Ratio00}} - 1.0}}}}<!--
     --><br>Test RatiosList = {{#var:RatiosList}}<!--
        -->{{c|{{#ifexpr:{{#var:Ratio00}} > 1.25 | + |{{#ifexpr:{{#var:Ratio00}} < 1.1 | - | Orange}}}}<!--
    --{{#ifeq:{{#var:Action}}|Sells|
    -->|{{#var:Ratio00}}}}|-}}'''<!-- Display the value of Ratio00 with color template-->
        <-- Action is "Sells": Display Category Icons --
    | '''{{#if:{{#var:Ratio01}}|<!-- Check if Ratio01 is defined and not empty ---
        '''{{{3}}}'''<br>{{#if:{{#var:Category}}|[[File:{{#var:Category}}_icon.png|64px]]}}!--
        -->{{#vardefine:Ratio01Diff|{{#ifexpr:{{#var:Ratio01}} < 1.15 | 2.0 - {{#var:Ratio01}} | {{#var:Ratio01}} - 1.0}}}}<!--
     --}}
        -->{{c|{{#ifexpr:{{#var:Ratio01}} > 1.25 | + |{{#ifexpr:{{#var:Ratio01}} < 1.1 | - | Orange}}}}<!--
     !-- Second column: Ratios List -->
     -->|{{#var:Ratio01}}}}|-}}'''
     |'''{{#if:{{#explode:{{#var:RatiosList}}|;|0|No Commodities found.}}}}'''
     | '''{{#if:{{#var:Ratio02}}|<!--
     | {{#if:{{#explode:{{#var:RatiosList}}|;|1|No Commodities found.}}}}
        -->{{#vardefine:Ratio02Diff|{{#ifexpr:{{#var:Ratio02}} < 1.15 | 2.0 - {{#var:Ratio02}} | {{#var:Ratio02}} - 1.0}}}}<!--
    | {{#if:{{#explode:{{#var:RatiosList}}|;|2|No Commodities found.}}}}
        -->{{c|{{#ifexpr:{{#var:Ratio02}} > 1.25 | + |{{#ifexpr:{{#var:Ratio02}} < 1.1 | - | Orange}}}}<!--
     | {{#if:{{#explode:{{#var:RatiosList}}|;|3|No Commodities found.}}}}
    -->|{{#var:Ratio02}}}}|-}}'''
    | {{#if:{{#explode:{{#var:RatiosList}}|;|4|No Commodities found.}}}}
     | '''{{#if:{{#var:Ratio03}}|<!--
     | {{#if:{{#explode:{{#var:RatiosList}}|;|5|No Commodities found.}}}}
        -->{{#vardefine:Ratio03Diff|{{#ifexpr:{{#var:Ratio03}} < 1.15 | 2.0 - {{#var:Ratio03}} | {{#var:Ratio03}} - 1.0}}}}<!--
    | {{#if:{{#explode:{{#var:RatiosList}}|;|6|No Commodities found.}}}}<!--
        -->{{c|{{#ifexpr:{{#var:Ratio03}} > 1.25 | + |{{#ifexpr:{{#var:Ratio03}} < 1.1 | - | Orange}}}}<!--
--></includeonly><noinclude>{{doc|Template:NPCLootTable/row}}[[Category:Templates]]</noinclude>
    -->|{{#var:Ratio03}}}}|-}}'''
     | '''{{#if:{{#var:Ratio04}}|<!--
        -->{{#vardefine:Ratio04Diff|{{#ifexpr:{{#var:Ratio04}} < 1.15 | 2.0 - {{#var:Ratio04}} | {{#var:Ratio04}} - 1.0}}}}<!--
        -->{{c|{{#ifexpr:{{#var:Ratio04}} > 1.25 | + |{{#ifexpr:{{#var:Ratio04}} < 1.1 | - | Orange}}}}<!--
    -->|{{#var:Ratio04}}}}|-}}'''
     | '''{{#if:{{#var:Ratio05}}|<!--
        -->{{#vardefine:Ratio05Diff|{{#ifexpr:{{#var:Ratio05}} < 1.15 | 2.0 - {{#var:Ratio05}} | {{#var:Ratio05}} - 1.0}}}}<!--
        -->{{c|{{#ifexpr:{{#var:Ratio05}} > 1.25 | + |{{#ifexpr:{{#var:Ratio05}} < 1.1 | - | Orange}}}}<!--
    -->|{{#var:Ratio05}}}}|-}}'''
     | '''{{#if:{{#var:Ratio06}}|<!--
        -->{{#vardefine:Ratio06Diff|{{#ifexpr:{{#var:Ratio06}} < 1.15 | 2.0 - {{#var:Ratio06}} | {{#var:Ratio06}} - 1.0}}}}<!--
        -->{{c|{{#ifexpr:{{#var:Ratio06}} > 1.25 | + |{{#ifexpr:{{#var:Ratio06}} < 1.1 | - | Orange}}}}<!--
    -->|{{#var:Ratio06}}}}|-}}'''<!--
--></includeonly><noinclude>
{{doc|Template:NPCLootTable/row}}
[[Category:Templates]]
</noinclude>

Latest revision as of 05:48, 18 February 2025

Template-info.png Documentation

Usage

{{CommoditiesRatioTable/head}}*
{{CommoditiesRatioTable/row|Osbrook|Brukk}}

  • head can use -> |town=Osbrook

Examples

Previous usage

Osbrook NPCs Ratios
NPCs Sacks of Grain Crates of Charcoal Sacks of Salt Shipment of Timber Barrel of Beer Crates of Wine Pails of Cider
Brukk.png
Brukk
- - 1.32 - 1.21 1.26 1.21
Bert.png
Bert
- 1.16 1.32 1.16 - 1.21 1.21
Jurg.png
Jurg
- - - 1.26 - - -
Jebar.png
Jebar
- 1.26 - - - - -

New implementation

The new implementation used in Commodities, do not define 'town' and uses the <tabber> parser tag, in the page itself, instead of the template.
More information on the <tabber> parser tag, can be found in the Community Portal, under "Tabs".

NPCs Sacks of Grain Crates of Charcoal Sacks of Salt Shipment of Timber Barrel of Beer Crates of Wine Pails of Cider
Brukk.png
Brukk
- - 1.32 - 1.21 1.26 1.21
Bert.png
Bert
- 1.16 1.32 1.16 - 1.21 1.21