Difference between revisions of "Template:Qualityprice/doc"

From Stardew Valley Wiki
Jump to navigation Jump to search
(Complete params, formatting)
(Document changes from last couple template edits)
Line 2: Line 2:
  
 
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 <tt>prof_mult</tt> parameter.
 
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 <tt>prof_mult</tt> parameter.
 +
 +
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.
  
 
Additionally, a sortkey is provided allowing correct sorting in tables where a column contains multiple instances of this template.
 
Additionally, a sortkey is provided allowing correct sorting in tables where a column contains multiple instances of this template.
Line 22: Line 24:
  
 
  <nowiki>{{</nowiki>[[Template:Qualityprice|Qualityprice]] |''item_name''| ''base_cost'' | prof_mult=''mult'' | quality=''values''
 
  <nowiki>{{</nowiki>[[Template:Qualityprice|Qualityprice]] |''item_name''| ''base_cost'' | prof_mult=''mult'' | quality=''values''
                 | iridium=true | hide=''values'' | size=''px'' | link=''link''| alt=''alt'' <nowiki>}}</nowiki>
+
                | srcprice=''price'' | auto=true
 +
                 | iridium=true | hide=''values'' | size=''px'' | link=''link'' | alt=''alt'' <nowiki>}}</nowiki>
  
 
===Parameters===
 
===Parameters===
Line 30: Line 33:
  
 
* '''''item_name'''''
 
* '''''item_name'''''
** First unnamed parameter, required
+
** First unnamed parameter, required.
 
** Name of item being displayed. There should be a corresponding image named <tt>File:item_name.png</tt>.
 
** Name of item being displayed. There should be a corresponding image named <tt>File:item_name.png</tt>.
** On non-english wikis this should normally be the '''english''' item_name, unless there's a language-specific image of the item, e.g., <tt>Large_Milk_FR</tt> should be used in French instead of <tt>Large_Milk</tt>. To provide the translated item name, see <tt>alt</tt>
+
** 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).
 +
** To provide the translated item name, see <tt>link</tt> and/or <tt>alt</tt>.
 
** 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)
 
** 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'''''
 
* '''''base_cost'''''
** Second unnamed parameter, rquired
+
** Second unnamed parameter.
** The base cost of the item
+
** Required unless <tt>srcprice</tt> and <tt>auto</tt> 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'''''
 
* '''prof_mult=''mult'''''
** Any other multipliers (e.g., profession price bonuses) that should be included in the calculated price.  Default value is 1
+
** 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 (<tt>prof_mult</tt> 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'''''
 
* '''quality=''values'''''
Line 48: Line 55:
 
** Set quality to one or more specific quality values
 
** 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 <tt>iridium=true</tt>
 
** iridium is disabled by default. Enable by explicitly adding iridium to the listed quality values or by setting <tt>iridium=true</tt>
 +
** If <tt>auto</tt> 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 <tt>auto</tt> 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 <tt>srcrprice</tt>.
 +
** For example, to display the price of Salmonberry Wine, set <tt>srcrprice=5</tt>.
 +
 +
* '''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'''
 
* '''iridium=true'''
Line 63: Line 79:
  
 
* '''link=''link'''''
 
* '''link=''link'''''
** Name of page (without square brackets) that item icon should link to. By default empty, meaning clicking on the icon does nothing.
+
** Name of page (without square brackets) that item icon should link to.
 +
** By default, link is automatically set to ''item_name''.
 +
** Setting link to an empty value (<tt>|link=|</tt>) disables the image link (clicking on the item does nothing).
  
 
* '''alt=''alt'''''
 
* '''alt=''alt'''''
** Alt text for item icon. Default value is ''link'' (if non-empty) or ''item_name''.
+
** Alt text for item icon. Default value is ''link'' or ''item_name''.
 
** This is not normally directly displayed on the page, but may be used by screen readers or accessibility-aware browsers.
 
** This is not normally directly displayed on the page, but may be used by screen readers or accessibility-aware browsers.
 +
** Setting alt to an empty value (<tt>|alt=|</tt>) disables the alt text.
  
 
===Examples===
 
===Examples===
Line 76: Line 95:
  
 
<pre>
 
<pre>
{{Qualityprice|Pumpkin|100|prof_mult=1.1}}
+
{{Qualityprice|Pumpkin|100|prof_mult=1.1|link=Vegetables}}
 
</pre>
 
</pre>
{{Qualityprice|Pumpkin|100|prof_mult=1.1}}
+
{{Qualityprice|Pumpkin|100|prof_mult=1.1|link=Vegetables}}
  
 
<pre>
 
<pre>
{{Qualityprice|Leek|60|iridium}}
+
{{Qualityprice|Leek|60|iridium|link=}}
 
</pre>
 
</pre>
{{Qualityprice|Leek|60|iridium}}
+
{{Qualityprice|Leek|60|iridium|link=}}
  
 
<pre>
 
<pre>
Line 94: Line 113:
 
</pre>
 
</pre>
 
{{Qualityprice|Apple|42|iridium|hide=silver,iridium}}
 
{{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>[[Category:Formatting templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>
 
<includeonly>[[Category:Formatting templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>

Revision as of 17:46, 24 September 2020

This template displays a table of the sell prices of an item for each requested item. 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 as to not clutter the page with multiple icons.

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 prof_mult parameter.

For variable price items (Wine, Juice, Pickles, Jelly, Roe, Aged Roe, Honey, etc.)[1], this template also allows the item base price to be automatically calculated from the source item price.

Additionally, a sortkey is provided allowing correct sorting in tables where a column contains multiple instances of this template.

Notes

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)
  • Applying the quality adjustment to the price: multiplying by 1.25 for Silver, 1.5 for Gold, or 2 for Iridium
  • Rounding down the quality-adjusted price
  • Applying any profession-related bonuses (from the prof_mult parameter)
  • Rounding down to yield the final displayed sell price.

This sequence of operations (and the specific order in which they are done) replicates the calculations done by the game code in Object::sellToStorePrice. 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.

Usage

Syntax

Basic usage:

{{Qualityprice |item_name| base_cost }}

Complete argument list:

{{Qualityprice |item_name| base_cost | prof_mult=mult | quality=values
               | srcprice=price | auto=true
               | iridium=true | hide=values | size=px | link=link | alt=alt }}

Parameters

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.

See Template:ParseInputQuality for more information on quality-related parameters.

  • item_name
    • First unnamed parameter, required.
    • Name of item being displayed. There should be a corresponding image named File:item_name.png.
    • 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).
    • To provide the translated item name, see link and/or alt.
    • 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 srcprice and auto are specified AND the item is one whose price can be auto-calculated.[1]
    • 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 (prof_mult 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 Normal, Silver, Gold
    • Set quality to true to get Normal, Silver, Gold, or
    • Set quality to false or Normal to get Normal, 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 iridium=true
    • If auto 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 auto is set, and the displayed item is one whose price depends upon the source item (Wine, Juice, Pickles, Jelly, Roe, Aged Roe, Honey, etc.)[1]. In which case, the item base price will be automatically derived from srcrprice.
    • For example, to display the price of Salmonberry Wine, set srcrprice=5.
  • auto=true
    • Set auto to true in order to allow quality and base_cost to be automatically set for recognized items.[1]
  • iridium=true
    • Set iridium to true to display iridium values.
    • Also recognizes iridium=false as equivalent to hide=iridium (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 hide=base is recognized as equivalent to hide=normal, 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").
  • link=link
    • Name of page (without square brackets) that item icon should link to.
    • By default, link is automatically set to item_name.
    • Setting link to an empty value (|link=|) disables the image link (clicking on the item does nothing).
  • alt=alt
    • Alt text for item icon. Default value is link or item_name.
    • This is not normally directly displayed on the page, but may be used by screen readers or accessibility-aware browsers.
    • Setting alt to an empty value (|alt=|) disables the alt text.

Examples

{{Qualityprice|Pumpkin|100}}

data-sort-value="100"

Pumpkin.png
100g
Pumpkin.png
Silver Quality Icon.png
125g
Pumpkin.png
Gold Quality Icon.png
150g
Pumpkin.png
Iridium Quality Icon.png
200g
{{Qualityprice|Pumpkin|100|prof_mult=1.1|link=Vegetables}}

data-sort-value="100"

Pumpkin.png
100g
Pumpkin.png
Silver Quality Icon.png
125g
Pumpkin.png
Gold Quality Icon.png
150g
Pumpkin.png
Iridium Quality Icon.png
200g
{{Qualityprice|Leek|60|iridium|link=}}

data-sort-value="60"

Leek.png
60g
Leek.png
Silver Quality Icon.png
75g
Leek.png
Gold Quality Icon.png
90g
Leek.png
Iridium Quality Icon.png
120g
{{Qualityprice|Apple|42|iridium|hide=gold,silver|size=48}}

data-sort-value="42"

Apple.png
42g
Apple.png
Iridium Quality Icon.png
84g
{{Qualityprice|Apple|42|iridium|hide=silver,iridium}}

data-sort-value="42"

Apple.png
42g
Apple.png
Gold Quality Icon.png
63g
{{Qualityprice|Wine|auto=true|srcprice=42|prof_mult=1.4}}

data-sort-value="0"

Wine.png
0
Wine.png
Silver Quality Icon.png
0
Wine.png
Gold Quality Icon.png
0
Wine.png
Iridium Quality Icon.png
0

References

<references> [1]

  1. 1.0 1.1 1.2 1.3 1.4 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.