This wiki is a read-only version of the Stardew Valley Wiki. The official editable wiki maintained by ConcernedApe can be found at stardewvalleywiki.com

Template:ParseInputQuality

From Stardew Valley Wiki
Jump to: navigation, search

Description

This is a utility function that processes quality-related arguments and combines them all into a single list of to-be-displayed quality values. It is intended for use only within other templates.

Notes

The arguments/options for this function are massively redundant, because it has been written to work with dozens of different existing templates, many of which have little quirks and/or different defaults. And also it tries to be as flexible as possible in recognizing different ways users might add information to wiki articles.

This is being adopted as the "standard" internal way of storing the requested qualities within templates -- this one string can be assigned to a single variable eliminating the need to check three arguments all the time.

Previously, functions such as Template:Qualityprice would print an error message if there was any conflict in requsted values for iridium (if it was being requested and hidden simultaneously). No such message is being printed by this function: any 'hide' requests simply silently override any information in quality or iridium.

See Template:ParseInputValues for additional information.

Usage

Syntax

Standard usage:

{{ParseInputQuality | quality=values}}

Complete argument list:

{{ParseInputQuality | quality=values | iridium=true | hide=values
                    | translate=true | case=lc;uc}}

Parameters

All of the following arguments are optional named arguments. In the absence of any arguments, it will return the default quality list (Normal,Silver,Gold). Default value for all arguments is empty, unless specified otherwise.

  • quality=values
    • Requested quality values. Default value is Normal, Silver, Gold
    • This can be a comma-separated list of individual values (Normal, Silver, Gold, Iridium).
    • More typically it is set to one of the following special values:
      • true = Normal, Silver, Gold
      • false = Normal
    • Also one special combination is recognized for potential convenience
      • true, iridium = Normal, Silver, Gold, Iridium
  • iridium = true
    • Set to any value to turn on iridium quality
    • Note that |iridium| will NOT work. It must be assigned a value using '=', e.g. |iridium=true| or |iridium=1|.
  • hide = values
    • Quality values to hide, as a comma-separated list of individual values.
    • In case of conflict, hide overrides any other input.
    • For backwards compatibility with Template:Edibility, hide=base is recognized as equivalent to hide=normal, but this is deprecated.
  • translate = true
    • Set to true if the return values should be translated, i.e., use text from $lang_quals instead of $engl_quals.
  • case = lc;uc
    • Set to one of lc or uc to convert the case of all return values.

Return Value

The return value will always be a comma-separated list of one or more of the following values, always in this order:

Normal, Silver, Gold, Iridium

Examples

{{ParseInputQuality}}

Default qualities
Returns: Normal,Silver,Gold

{{ParseInputQuality|iridium=true|hide=silver}}

Demonstrate iridium and hide parameters
Returns: Normal,Gold,Iridium

{{ParseInputQuality|quality=false}}

Demonstrate quality=false
Returns: Normal