Template:Edibility

From Stardew Valley Wiki
Jump to: navigation, search

Description

This template calculates and displays an item's Health and/or Energy values, based on the item's base edibility, for all relevant item qualities (Normal, Silver, Gold, and/or Iridium). The Health and Energy values should match both those displayed in-game on the item's tooltip and the effect on the player in-game when consumed. The base edibility of an item can be extracted from the game's ObjectInformation.xnb file.

The default output is a single vertical column, with one value per line. Each value is diaplayed as a health/energy icon with superimposed quality star (see Template:Quality), the number, and "Health"/"Energy" links. Optionally, a specified item image can be added to each line. Or a grid-format output can be selected, with all data for a given quality displayed on a single line.

Additionally, the output contains a hidden sortkey to allow a table column containing multiple instances of this template to be sorted correctly.

Notes

  • Edibility of -300 or less means the item is not edible.
  • Edibility between -300 and 0 means the item is "poisonous" and reduces the player's energy by edibility times 2.5 (rounded up) plus edibility times quality (normal = 0, silver = 1, gold = 2, iridium = 4) points
    • e.g. A edibility of -10 and normal quality results in -25 Energy (ceiling(-10*2.5) + -10*0).
    • e.g. A edibility of -10 and silver quality results in -35 Energy (ceiling(-10*2.5) + -10*1).
    • e.g. A edibility of -10 and gold quality results in -45 Energy (ceiling(-10*2.5) + -10*2).
  • Edibility of 0 means that the item is edible, but does not recover health or energy.
  • Edibility above 0 means that the item increases energy by edibility times 2.5 (rounded up) plus edibility times quality, and health by energy times 0.45 (truncated).
    • e.g. An edibility of 15 and normal quality results in +38 Energy (truncate(ceiling(15*2.5)+15*0)) and +17 Health (truncate(energy*0.45)).
    • e.g. An edibility of 15 and silver quality results in +53 Energy (truncate(ceiling(15*2.5)+15*1)) and +23 Health (truncate(energy*0.45)).
    • e.g. An edibility of 15 and gold quality results in +68 Energy (truncate(ceiling(15*2.5)+15*2)) and +30 Health (truncate(energy*0.45)).
  • Prior to version 1.4, there was a discrepancy in-game between the tool tip values and the actual effect when consumed. The values calculated by this template would match the actual effects when consumed.

Usage

Syntax

Basic usage:

{{Edibility | edibility }}

Complete argument list:

{{Edibility | edibility | quality=values | statistics=values | iridium=true | hide=values | size=px | grid=true | item=item_name | link=link| alt=alt}} 

Parameters

There is one unnamed, required parameter, edibility. 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.

  • edibility
    • First unnamed parameter, required
    • Numerical value providing base ediblity, as taken from the game data files. Values less than 0 imply poison.
    • Inedible items can be handled either by setting edibility to -300 or by setting it to Inedible
    • Other text values are possible, but will be simply displayed as is
  • quality=values
    • List of quality values to display. Default value is Normal, Silver, Gold. This is a change from previous versions of this function, where default value was 'normal' (and normal was always shown unless hide was used to force it to be hidden).
    • 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
    • Note that the template may opt to ignore any quality values in cases where the display information is identical for all qualities (e.g. edibility=0, edibility=inedible, etc.). In these cases, only one entry will be displayed, using quality=Normal
  • statistics=values
    • List of statistics to display. Default value is Energy, Health
    • Use for example statistics=Energy to display a column of only energy values.
    • Note that the template may opt to ignore any statistics values in cases where health data is irrelevant, e.g. edibility=inedible, poisons.
  • 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").
  • grid=true
    • Set grid to true to request a compressed grid-style layout, i.e., health and energy side by side on the same line. The Energy and Health text/links are removed (although the energy/health icons are still links to those pages).
  • item=item_name
    • Name of item being displayed. There should be a corresponding image named File:item_name.png.
    • This parameter adds an item icon, overlaid with the quality star, to the start of each line. The health/energy icons no longer have a superimposed quality star and are made slightly smaller.
    • 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
  • link=link
    • Name of page (without square brackets) that item icon should link to. By default empty, meaning clicking on the icon does nothing.
    • Meaningless unless item is specified.
  • 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.
    • Meaningless unless item is specified.

Examples

{{Edibility|-25}}

Note This result is different than in earlier versions of the template (previously only normal was shown)

Energy
−62 Energy
Energy
Silver
−87 Energy
Energy
Gold
−112 Energy
{{Edibility|-50|quality=normal}}

Energy
−125 Energy
{{Edibility|0|quality=true|size=48}}

Only one set of values is displayed, in spite of quality=true, because values are the same for all qualities.

Energy
0 Energy
Health
0 Health
{{Edibility|15|quality=true, iridium|grid=true}}

Energy
38
Health
17
Energy
Silver
53
Health
Silver
23
Energy
Gold
68
Health
Gold
30
Energy
Iridium
98
Health
Iridium
44
{{Edibility|80|quality=gold|iridium=true}}

Note This result is different than in earlier versions of the template (previously hide=normal would have to be specified to get this result).

Energy
Gold
360 Energy
Health
Gold
162 Health
Energy
Iridium
520 Energy
Health
Iridium
234 Health
{{Edibility|-25|quality=silver, gold, iridium|hide=iridium}}

hide=iridium takes precedence, so iridium is not displayed.

Energy
Silver
−87 Energy
Energy
Gold
−112 Energy
{{Edibility|10|grid=true|item=Parsnip}}

Energy 25 Health 11
Silver
Energy 35 Health 15
Gold
Energy 45 Health 20
{{Edibility|10|statistics=Health}}

Health
11 Health
Health
Silver
15 Health
Health
Gold
20 Health
{{Edibility|-300}}

Inedible