Template:Qualityprice/doc

From Stardew Valley Wiki
< Template:Qualityprice
Revision as of 15:14, 5 September 2020 by Nebulous Maestress (talk | contribs) (Complete params, formatting)
Jump to navigation Jump to search

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.

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
               | 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, unless there's a language-specific image of the item, e.g., Large_Milk_FR should be used in French instead of Large_Milk. To provide the translated item name, see 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, rquired
    • The base cost of the item
  • prof_mult=mult
    • Any other multipliers (e.g., profession price bonuses) that should be included in the calculated price. Default value is 1
  • 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
  • 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 empty, meaning clicking on the icon does nothing.
  • alt=alt
    • Alt text for item icon. Default value is link (if non-empty) or item_name.
    • This is not normally directly displayed on the page, but may be used by screen readers or accessibility-aware browsers.

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}}

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}}

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