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 (Ratios display fixed, adding #trim.)
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>
<noinclude>'''{{c|+|WORKING: [INCOMPLETE]}}'''<br>The '''#trim''' prevents the '''#if''' , from detecting empty data as "false". '''{{c|-|DO NOT DELETE}}'''.</noinclude>
<includeonly><!--  {{NPCLootTable/row|Jurg|Sell|Weapons}} ---
<includeonly><!--  {{NPCLootTable/row|Jurg|Sell|Weapons}} ---
     --- 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. ---
Line 13: Line 13:
     <!-- Display Location Block (Possible to gather Location in a single block?) -->
     <!-- Display Location Block (Possible to gather Location in a single block?) -->
     | {{{1}}} <!-- Location -->
     | {{{1}}} <!-- Location -->
     | <!--
     | {{#if:{{#var:NPC}}|[[File:{{#var:NPC}}.png|64px]]|No image found for [[{{#var:NPC}}]].}}<br>'''[[{{#var:NPC}}]]'''<!-- Display NPC Icon ---
    --- NPCData gathers all Ratios for said NPC: Display NPC Icon ---
     --- Second column: Ratios List -->
    -->{{#if:{{#var:NPC}}|[[File:{{#var:NPC}}.png|64px]]|No image found for [[{{#var:NPC}}]].}}<br>'''[[{{#var:NPC}}]]'''<!--
    | '''{{#if:{{#trim:{{#explode:{{#var:RatiosList}}|;|0}}}}|{{#explode:{{#var:RatiosList}}|;|0}}|No data}}'''
     --><br>Test RatiosList = {{#var:RatiosList}}<!--
    | '''{{#if:{{#trim:{{#explode:{{#var:RatiosList}}|;|1}}}}|{{#explode:{{#var:RatiosList}}|;|1}}|No data}}'''
    --{{#ifeq:{{#var:Action}}|Sells|
     | '''{{#if:{{#trim:{{#explode:{{#var:RatiosList}}|;|2}}}}|{{#explode:{{#var:RatiosList}}|;|2}}|No data}}'''
        <-- Action is "Sells": Display Category Icons --
     | '''{{#if:{{#trim:{{#explode:{{#var:RatiosList}}|;|3}}}}|{{#explode:{{#var:RatiosList}}|;|3}}|No data}}'''
        '''{{{3}}}'''<br>{{#if:{{#var:Category}}|[[File:{{#var:Category}}_icon.png|64px]]}}!--
     | '''{{#if:{{#trim:{{#explode:{{#var:RatiosList}}|;|4}}}}|{{#explode:{{#var:RatiosList}}|;|4}}|No data}}'''
    --}}
     | '''{{#if:{{#trim:{{#explode:{{#var:RatiosList}}|;|5}}}}|{{#explode:{{#var:RatiosList}}|;|5}}|No data}}'''
    !-- Second column: Ratios List -->
     | '''{{#if:{{#trim:{{#explode:{{#var:RatiosList}}|;|6}}}}|{{#explode:{{#var:RatiosList}}|;|6}}|No data}}'''</includeonly><!--
     |'''{{#if:{{#explode:{{#var:RatiosList}}|;|0|No Commodities found.}}}}'''
--><noinclude>{{doc|Template:NPCLootTable/row}}[[Category:Templates]]</noinclude>
     | {{#if:{{#explode:{{#var:RatiosList}}|;|1|No Commodities found.}}}}
    | {{#if:{{#explode:{{#var:RatiosList}}|;|2|No Commodities found.}}}}
     | {{#if:{{#explode:{{#var:RatiosList}}|;|3|No Commodities found.}}}}
    | {{#if:{{#explode:{{#var:RatiosList}}|;|4|No Commodities found.}}}}
     | {{#if:{{#explode:{{#var:RatiosList}}|;|5|No Commodities found.}}}}
     | {{#if:{{#explode:{{#var:RatiosList}}|;|6|No Commodities found.}}}}<!--
--></includeonly><noinclude>{{doc|Template:NPCLootTable/row}}[[Category:Templates]]</noinclude>

Revision as of 07:58, 30 January 2025

WORKING: [INCOMPLETE]
The #trim prevents the #if , from detecting empty data as "false". DO NOT DELETE.

Template-info.png Documentation

This article is a stub. You can help Stoneshard wiki by expanding it.

THIS TEMPLATE HAS BEEN UPDATED TO WORK WITH FRIENDLY DATA.
ALONG WITH THE COMMODITIESRATIO DATA, UPDATED TO THE FRIENDLY DATA PAGE!

This is the template for the Commodities Ratio Table. It is used to generate the table on the Commodities page.

Updates

Firstly, the data found in the old temporary CommoditiesRatio data page, was added to the Friendly data page.
Therefore, NPCs that had the "Trade=1" parameter, and trade commodities received a new parameter: "Ratios".
They were also adjusted from the older order to the new one.

Data Format

The new datastring order has 7 data columns separated by semicolons. Each column represents the Ratio of said commodity for a specific NPC.

Sacks of Grain;Barrel of Beer;Crates of Wine;Pails of Cider;Shipment of Timber;Crates of Charcoal;Sacks of Salt

The columns are in the following order:

   OLD ORDER: Grain;Charcoal;Salt;Timber;Beer;Wine;Cider
   OLD Base : 280  ;300     ;400 ;240   ;240 ;360 ;300
   NEW ORDER: Grain;Beer;Wine;Cider;Timber;Charcoal;Salt
   NEW Base : 280  ;240 ;360 ;300  ;240   ;300     ;400

Usage

Before, there was the possibility to have different "head|{x}" usages. But, after the "Tabber" implementation, there was really no need for multiple parameters.
The idea was to simplify the template to simply {{CommoditiesRatioTable}}, and "control" it with "Tabber", to show specific towns NPCs. But tabber would end up requiring repeated code blocks, therefore killing the purpouse of it.
So the {{CommoditiesRatioTable/head}} & {{CommoditiesRatioTable/row}} templates, where kept.


Examples

Header & row

NPCs Sacks of Grain Barrel of Beer Crates of Wine Pails of Cider Shipment of Timber Crates of Charcoal Sacks of Salt


Bert [[File:{{{2}}}.png|64px]]
[[{{{2}}}]]
No ' ' ' ' ' '

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 Barrel of Beer Crates of Wine Pails of Cider Shipment of Timber Crates of Charcoal Sacks of Salt


Bert [[File:{{{2}}}.png|64px]]
[[{{{2}}}]]
No ' ' ' ' ' '

With Tabber implementation

NPCs Sacks of Grain Barrel of Beer Crates of Wine Pails of Cider Shipment of Timber Crates of Charcoal Sacks of Salt


Bert [[File:{{{2}}}.png|64px]]
[[{{{2}}}]]
No ' ' ' ' ' '


Arenn [[File:{{{2}}}.png|64px]]
[[{{{2}}}]]
No ' ' ' ' ' '
NPCs Sacks of Grain Barrel of Beer Crates of Wine Pails of Cider Shipment of Timber Crates of Charcoal Sacks of Salt


Bert [[File:{{{2}}}.png|64px]]
[[{{{2}}}]]
No ' ' ' ' ' '
NPCs Sacks of Grain Barrel of Beer Crates of Wine Pails of Cider Shipment of Timber Crates of Charcoal Sacks of Salt


Arenn [[File:{{{2}}}.png|64px]]
[[{{{2}}}]]
No ' ' ' ' ' '