Difference between revisions of "Template:Qualityprice/doc"

From Stardew Valley Wiki
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Template:Qualityprice|Qualityprice]] displays a table of the sell prices for a requested item for all item qualities.  Each sell price is shown with the image icon and a superimposed quality star (see [[Template:Quality]]).  It intentionally does not show the money icon so as to not clutter the page with multiple icons.
+
==Description==
 +
This template displays prices for items of specified qualities, formatted appropriately for the language where they appear. The image of the item is included (with any quality stars) instead of the gold icon. The size of the image is always 24px.
  
In order for the values to be calculated correctly, the input value should always be the item base cost. If other factors should be included (''e.g.,'' professions that increase the price), those factors should be specified using the <samp>prof_mult</samp> parameter.
+
==Parameters==
 +
{|class="wikitable sortable"
 +
|-
 +
!Parameter
 +
!Notes
 +
|-
 +
|First (unnamed) parameter
 +
|Name of image (minus ".png")
 +
|-
 +
|Second (unnamed) parameter
 +
|Normal/base sell price of item (can be found in <samp>ObjectInformation.xnb</samp>)<br />''or''<br />Normal/base sell price of item used to make [[Artisan Goods|Artisan Good]] (see examples below)<br />Note: also accepts non-numbers such as "3x base fruit price" without throwing an error
 +
|-
 +
|quality
 +
|Single quality to display.<br />Defaults to all qualities (normal, silver, gold, iridium) if omitted.<br />Items that exist in normal quality only do not have to specify <samp>quality=normal</samp> (''i.e.,'' [[Cave Carrot]], [[Ginger]], [[Green Tea]], [[Honey]], [[Jellies and Pickles|Jelly]], [[Juice]], [[Oil]], [[Jellies and Pickles|Pickles]], [[Qi Fruit]], and [[Tea Leaves]])<div style="font-size: smaller;">''Note: Other items may be added in the future. In the meantime, specifying <samp>quality=normal</samp> will work.''</div>
 +
|-
 +
|hide
 +
|Qualities to hide<br />(''e.g.,'' <samp>hide=silver,gold</samp>)
 +
|-
 +
|pm
 +
|Profession modifier<br />[[Skills#Farming|Tiller]] gives a 10% bonus, so specify <samp>pm=1.1</samp><br />[[Skills#Fishing|Angler]] gives a 50% bonus, so specify <samp>pm=1.5</samp><br />etc.
 +
|-
 +
|dsv
 +
|data-sort-value<br />Set to <samp>false</samp> if the quality price(s) are displayed in a non-sortable structure (like an infobox)<br />Default value is <samp>true</samp> (the entire parameter can be omitted if a data-sort-value is desired).
 +
|-
 +
|}
  
For variable price items (Wine, Juice, Pickles, Jelly, Roe, Aged Roe, Honey, etc.)<ref name="items"/>, this template also allows the item base price to be automatically calculated from the source item price.
+
==Examples==
 
+
{|class="wikitable sortable"
Additionally, a sortkey is provided allowing correct sorting in tables where a column contains multiple instances of this template.
+
|-
 
+
!Template Call
==Notes==
+
!Result
The sell price is calculated by:
+
|-
* Rounding down (truncating any fraction) on the input base cost (for the sake of derived base costs such as fruit-specific wine)
+
|<code><nowiki>{{Qualityprice|Melon|250}}</nowiki></code>
* Applying the quality adjustment to the price: multiplying by 1.25 for Silver, 1.5 for Gold, or 2 for Iridium
+
|{{Qualityprice|Melon|250}}
* Rounding down the quality-adjusted price
+
|-
* Applying any profession-related bonuses (from the <samp>prof_mult</samp> parameter)
+
|<code><nowiki>{{Qualityprice|Parsnip|35|pm=1.1}}</nowiki></code>
* Rounding down to yield the final displayed sell price.
+
|{{Qualityprice|Parsnip|35|pm=1.1}}
This sequence of operations (and the specific order in which they are done) replicates the calculations done by the game code in <samp>Object::sellToStorePrice</samp>. Changing the order of operations and/or omitting any of the rounding-down steps will cause changes in the calculated values for some items and result in discrepancies between the wiki's displayed values and the actual in-game values.
+
|-
 
+
|<code><nowiki>{{Qualityprice|Ginger|60}}</nowiki></code>
==Use==
+
|{{Qualityprice|Ginger|60}}
===Syntax===
+
|-
Basic usage:
+
|<code><nowiki>{{Qualityprice|Goat Cheese|400|hide=normal,silver}}</nowiki></code>
<nowiki>{{</nowiki>[[Template:Qualityprice|Qualityprice]] |''item_name''| ''base_cost'' <nowiki>}}</nowiki>
+
|{{Qualityprice|Goat Cheese|400|hide=normal,silver}}
 
+
|-
Complete argument list:
+
|<code><nowiki>{{Qualityprice|Large Goat Milk FR|345}}</nowiki></code>
 
+
|{{Qualityprice|Large Goat Milk FR|345}}
<nowiki>{{</nowiki>[[Template:Qualityprice|Qualityprice]] |''item_name''| ''base_cost'' | prof_mult=''mult'' | quality=''values''
+
|-
                | srcprice=''price'' | auto=true
+
|<code><nowiki>{{Qualityprice|Juice|260}}</nowiki></code><br />(The base sell price of [[Red Cabbage]] is 260,<br />and the base sell price of Red Cabbage Juice is 585)
                | iridium=true | hide=''values'' | size=''px'' | sortkey=''value'' <nowiki>}}</nowiki>
+
|{{Qualityprice|Juice|260}}
 
+
|-
===Parameters===
+
|<code><nowiki>{{Qualityprice|Wine|750|pm=1.4}}</nowiki></code><br />(The base sell price of [[Starfruit]] is 750,<br />and the Artisan base sell price of Starfruit Wine is 3,150)
There are two unnamed, required parameters, ''item_name'' and ''base_cost''.  All other parameters are named and optional.  Default value for all arguments is empty, unless specified otherwise.
+
|{{Qualityprice|Wine|750|pm=1.4}}
 
+
|-
See [[Template:ParseInputQuality]] for more information on quality-related parameters.
+
|<code><nowiki>{{Qualityprice|Honey|30}}</nowiki></code><br />(The base sell price of a [[Tulip]] is 30,<br />and the base sell price of Tulip Honey is 160)
 
+
|{{Qualityprice|Honey|30}}
* '''''item_name'''''
+
|-
** First unnamed parameter, required.
+
|}<includeonly>[[Category:Templates]]{{Addlanglinks}}</includeonly><noinclude>[[Category:Template documentation]]</noinclude>
** Name of item being displayed. There should be a corresponding image named <samp>File:item_name.png</samp>.
 
** On non-english wikis this should normally be the '''english''' item_name.  Even if there is a language-specific item image (''e.g.,'' [[:File:Large Milk FR.png]] in French), it should not be necessary to alter the image name ([[Template:Quality]] automatically handles all variants of milk image names).
 
** Note that there must be no spaces following the item_name -- the "|" symbol must come immediately afterwards, or the template will fail (due to quirks of how mediawiki templates process arguments)
 
 
 
* '''''base_cost'''''
 
** Second unnamed parameter.
 
** Required unless <samp>srcprice</samp> and <samp>auto</samp> are specified AND the item is one whose price can be auto-calculated.<ref name="items"/>
 
** The base cost of the displayed item.
 
** Normally the base cost should be a numeric value (or valid numeric expression).  If a non-numeric cost is provided, it will be printed as-is for all requested qualities (and the sortkey is set to "0" to hide the non-numeric data from any table-sorting).
 
 
 
* '''prof_mult=''mult'''''
 
** Any other multipliers (''e.g.,'' profession price bonuses) that should be included in the calculated price.  Default value is 1.
 
** This value is always ignored (<samp>prof_mult</samp> is forced to be 1) for Oil and Coffee, to ensure that the Artisan Profession bonus is not accidentally displayed for these items. This allows oil to be shown in multi-item infobox displays alongside other artisan goods without any special handling elsewhere.
 
 
 
* '''quality=''values'''''
 
** List of quality values to display. Default value is <samp>Normal, Silver, Gold</samp>
 
** Set quality to true to get <samp>Normal, Silver, Gold</samp>, or
 
** Set quality to false or Normal to get <samp>Normal</samp>, or
 
** Set quality to one or more specific quality values
 
** iridium is disabled by default. Enable by explicitly adding iridium to the listed quality values or by setting <samp>iridium=true</samp>
 
** If <samp>auto</samp> is set and the displayed item is recognized, any input quality value will be ignored and instead the quality will be automatically set based on the item's default allowed qualities.
 
 
 
* '''srcprice=''price'''''
 
** The base price of the source item (''e.g.,'' vegetable, fruit, flower, or fish) used to create the displayed item.
 
** Only relevant if <samp>auto</samp> is set, and the displayed item is one whose price depends upon the source item (Wine, Juice, Pickles, Jelly, Roe, Aged Roe, Honey, etc.)<ref name="items"/>.  In which case, the item base price will be automatically derived from <samp>srcrprice</samp>.
 
** For example, to display the price of Salmonberry Wine, set <samp>srcrprice=5</samp>.
 
 
 
* '''auto=true'''
 
** Set auto to true in order to allow quality and base_cost to be automatically set for recognized items.<ref name="items"/>
 
 
 
* '''iridium=true'''
 
** Set iridium to true to display iridium values.
 
** Also recognizes <samp>iridium=false</samp> as equivalent to <samp>hide=iridium</samp> (although it's easier to just omit the entire iridium parameter)
 
 
 
* '''hide=''values'''''
 
** List of quality values to hide, as a comma-separated list of individual values.
 
** In case of conflict, hide overrides any other input.
 
** For backwards compatibility <samp>hide=base</samp> is recognized as equivalent to <nowiki>hide=normal</nowiki>, but this is deprecated.
 
 
 
* '''size=''px'''''
 
** Size of icons in pixels.  Default value is 24
 
** Only the number should be provided (do not append "px").
 
 
 
* '''sortkey=''value'''''
 
** Override the value used for the sortkey.  Default value is <samp>true</samp>, in which case the sortkey is set to the normal quality value (or to 0 for non-numeric data)
 
** This parameter should not normally be necessary.  One known use case, however, is when one table cell makes multiple calls to Qualityprice, in which case only one of the calls should be allowed to set a sortkey. Therefore, the sortkey should be set to an empty value on all but the first template call in a single cell.
 
 
 
===Examples===
 
<pre>
 
{{Qualityprice|Pumpkin|100}}
 
</pre>
 
{{Qualityprice|Pumpkin|100}}
 
 
 
<pre>
 
{{Qualityprice|Pumpkin|100|prof_mult=1.1}}
 
</pre>
 
{{Qualityprice|Pumpkin|100|prof_mult=1.1}}
 
 
 
<pre>
 
{{Qualityprice|Leek|60|iridium}}
 
</pre>
 
{{Qualityprice|Leek|60|iridium}}
 
 
 
<pre>
 
{{Qualityprice|Apple|42|iridium|hide=gold,silver|size=48}}
 
</pre>
 
{{Qualityprice|Apple|42|iridium|hide=gold,silver|size=48}}
 
 
 
<pre>
 
{{Qualityprice|Apple|42|iridium|hide=silver,iridium}}
 
</pre>
 
{{Qualityprice|Apple|42|iridium|hide=silver,iridium}}
 
 
 
<pre>
 
{{Qualityprice|Wine|auto=true|srcprice=42|prof_mult=1.4}}
 
</pre>
 
{{Qualityprice|Wine|auto=true|srcprice=42|prof_mult=1.4}}
 
 
 
==References==
 
<references>
 
<ref name="items">The full list of items for which the quality and base price can be automatically set is: Wine, Juice, Jelly, Pickles, Honey, Roe, Caviar, Aged Roe, Pale Ale, Beer, and Mead. A few fixed-price items are included in this list so multiple-item infobox displays can be handled more easily.</ref>
 
</references>
 
 
 
<includeonly>{{Addlanglinks}}[[Category:Templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>
 

Latest revision as of 23:38, 15 March 2023

Description

This template displays prices for items of specified qualities, formatted appropriately for the language where they appear. The image of the item is included (with any quality stars) instead of the gold icon. The size of the image is always 24px.

Parameters

Parameter Notes
First (unnamed) parameter Name of image (minus ".png")
Second (unnamed) parameter Normal/base sell price of item (can be found in ObjectInformation.xnb)
or
Normal/base sell price of item used to make Artisan Good (see examples below)
Note: also accepts non-numbers such as "3x base fruit price" without throwing an error
quality Single quality to display.
Defaults to all qualities (normal, silver, gold, iridium) if omitted.
Items that exist in normal quality only do not have to specify quality=normal (i.e., Cave Carrot, Ginger, Green Tea, Honey, Jelly, Juice, Oil, Pickles, Qi Fruit, and Tea Leaves)
Note: Other items may be added in the future. In the meantime, specifying quality=normal will work.
hide Qualities to hide
(e.g., hide=silver,gold)
pm Profession modifier
Tiller gives a 10% bonus, so specify pm=1.1
Angler gives a 50% bonus, so specify pm=1.5
etc.
dsv data-sort-value
Set to false if the quality price(s) are displayed in a non-sortable structure (like an infobox)
Default value is true (the entire parameter can be omitted if a data-sort-value is desired).

Examples

Template Call Result
{{Qualityprice|Melon|250}} data-sort-value="250"
Melon.png
250g
Melon.png
Silver Quality Icon.png
312g
Melon.png
Gold Quality Icon.png
375g
Melon.png
Iridium Quality Icon.png
500g
{{Qualityprice|Parsnip|35|pm=1.1}} data-sort-value="38"
Parsnip.png
38g
Parsnip.png
Silver Quality Icon.png
47g
Parsnip.png
Gold Quality Icon.png
57g
Parsnip.png
Iridium Quality Icon.png
77g
{{Qualityprice|Ginger|60}} data-sort-value="60"
Ginger.png
60g
{{Qualityprice|Goat Cheese|400|hide=normal,silver}} data-sort-value="400"
Goat Cheese.png
Gold Quality Icon.png
600g
Goat Cheese.png
Iridium Quality Icon.png
800g
{{Qualityprice|Large Goat Milk FR|345}} data-sort-value="345"
Large Goat Milk FR.png
345g
Large Goat Milk FR.png
Silver Quality Icon.png
431g
Large Goat Milk FR.png
Gold Quality Icon.png
517g
Large Goat Milk FR.png
Iridium Quality Icon.png
690g
{{Qualityprice|Juice|260}}
(The base sell price of Red Cabbage is 260,
and the base sell price of Red Cabbage Juice is 585)
data-sort-value="585"
Juice.png
585g
{{Qualityprice|Wine|750|pm=1.4}}
(The base sell price of Starfruit is 750,
and the Artisan base sell price of Starfruit Wine is 3,150)
data-sort-value="3150"
Wine.png
3,150g
Wine.png
Silver Quality Icon.png
3,936g
Wine.png
Gold Quality Icon.png
4,725g
Wine.png
Iridium Quality Icon.png
6,300g
{{Qualityprice|Honey|30}}
(The base sell price of a Tulip is 30,
and the base sell price of Tulip Honey is 160)
data-sort-value="160"
Honey.png
160g