Changes

Jump to navigation Jump to search
Line 440: Line 440:  
Objects are the default type for items in inventories or placed in the world.
 
Objects are the default type for items in inventories or placed in the world.
   −
They have their data in <samp>Data/Objects</samp>, their icon sprites in <samp>Maps/springobjects</samp>, and their code in <samp>StardewValley.Object</samp>. See [[Modding:Items/Object sprites|a table of sprites and their corresponding indexes]].
+
They have their data in <samp>Data/Objects</samp> (<samp>Data/ObjectInformation</samp> prior to 1.6), their icon sprites in <samp>Maps/springobjects</samp>, and their code in <samp>StardewValley.Object</samp>. See [[Modding:Items/Object sprites|a table of sprites and their corresponding indexes]].
    
===Data format===
 
===Data format===
The object data in <samp>Data/Objects</samp> consists of a string→ObjectData dictionary (where ObjectData is defined in the game code in <samp>StardewValley.GameData.Objects.ObjectData</samp>). It has entries like this<ref>See <samp>Data/Objects.xnb</ref>:
+
The object data in <samp>Data/Objects</samp> consists of a string→ObjectData dictionary (where ObjectData is defined in the game code in <samp>GameData.Objects.ObjectData</samp>). It has entries like this<ref>See <samp>Data/Objects.xnb</ref>:
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
"201": {
 
"201": {
Line 495: Line 495:     
For each entry in the data asset:
 
For each entry in the data asset:
* The key (before the colon) is the item ID and its sprite index within the [[Modding:Items/Object sprites|object spritesheet]] (saved as <samp>ParentSheetIndex</samp> in-code).
+
* The key (before the colon) is the unqualified item ID and its sprite index within the [[Modding:Items/Object sprites|object spritesheet]] (saved as <samp>ParentSheetIndex</samp> in-code).
 
* The value (after the colon) is the data pertaining to that object, with the fields listed below. The objects with keys 516–534 (<samp>Ring.ringLowerIndexRange</samp> through <samp>Ring.ringUpperIndexRange</samp>) and 801 (wedding ring) are hardcoded as rings.
 
* The value (after the colon) is the data pertaining to that object, with the fields listed below. The objects with keys 516–534 (<samp>Ring.ringLowerIndexRange</samp> through <samp>Ring.ringUpperIndexRange</samp>) and 801 (wedding ring) are hardcoded as rings.
   −
Field values are described below:
+
Field values are described below (Copied from [[Modding:Migrate to Stardew Valley 1.6]]):
    +
====Basic info====
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Field
+
! field
! Data Type
+
! purpose
! Effect<ref>See <samp>StardewValley.GameData.Objects.ObjectData</samp></ref>
+
|-
 +
| <samp>Name</samp>
 +
| The internal item name.
 +
|-
 +
| <samp>DisplayName</samp><br /><samp>Description</samp>
 +
| A [[Modding:Tokenizable strings|tokenizable string]] for the item's in-game display name and description.
 +
|-
 +
| <samp>Type</samp>
 +
| The item's general type, like <c>Arch</c> (artifact) or <c>Minerals</c>.
 +
|-
 +
| <samp>Category</samp>
 +
| The [[Modding:Items#Categories|item category]].
 +
|-
 +
| <samp>Price</samp>
 +
| ''(Optional)'' The price when sold by the player. This is not the price when bought from a shop. Default 0.
 +
|}
 +
 
 +
====Appearance====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 
|-
 
|-
!style="text-align: left;" colspan="3"| all objects
+
| <samp>Texture</samp>
 +
| The asset name for the texture containing the item's sprite. Defaults to <samp>Maps/springobjects</samp>.
 
|-
 
|-
| Name
+
| <samp>SpriteIndex</samp>
| string
+
| The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
| The internal item name (and display name in English).
+
|}
 +
 
 +
====Edibility====
 +
{| class="wikitable"
 
|-
 
|-
| DisplayName
+
! field
| string
+
! purpose
| A tokenizable string for the item's translated display name.
   
|-
 
|-
| Description
+
| <samp>Edibility</samp>
| string
+
| ''(Optional)'' A numeric value that determines how much energy (edibility × 2.5) and health (edibility × 1.125) is restored when this item is eaten. An item with an edibility of -300 can't be eaten, values from -299 to -1 reduce health and energy, and zero can be eaten but doesn't change health/energy. Default -300.
| A tokenizable string for the item's translated description.
   
|-
 
|-
| Type
+
| <samp>IsDrink</samp>
| string
+
| ''(Optional)'' Whether to drink the item instead of eating it. Default false.
| The item's general type, like Arch (artifact) or Minerals.
  −
Types appear to be apocryphal data from early in the game's development. As such, some of them are not very well understood. The types used in <samp>Data/Objects</samp> and their purposes (as is currently understood) are as follows:
  −
*<samp>Ring</samp>, used for all rings, even the [[Wedding Ring]]. Category is 0 (signifying an omitted category), though every <samp>Ring</samp> type is automatically given the category <samp>-96</samp>.
  −
*<samp>Fish</samp>, used not only for fish but all items gained through fishing. Always paired with <samp>-4</samp> for true fish or <samp>-20</samp> for junk items such as [[Joja Cola]].
  −
*<samp>Arch</samp>, used for artifacts, presumably standing for "archaeology." Category is ommitted, though every <samp>Arch</samp> type is automatically given the category <samp>0</samp>. Is ''not'' used for Gems or Minerals. '''Adding custom items of the <samp>Arch</samp> type is not recommended, as it can break all Artifact Spots in the game.'''
  −
*<samp>asdf</samp>, used for a handful of items the player isn't intended to ever have in their inventory, such as an Artifact Spot or Secret Note. Category is ommitted.
  −
*<samp>Seeds</samp>, used for seeds, starters, shoots, etc. Always paired with the category <samp>-74</samp>.
  −
*<samp>Crafting</samp>, used for a variety of crafted items. Notably, however, there are some non-craftable items with this type: all tree seeds, various "Weeds", the [[Dwarvish Translation Guide]], [[Coffee]], [[Stardrop]], [[Galaxy Soul]], [[Horse Flute]], and supply crates. Category is either 0 (omitted) or <samp>-8</samp>, <samp>-24</samp>, or <samp>-74</samp>.
  −
*<samp>Quest</samp>, used for quest items as well as [[Golden Coconut|Golden Coconuts]]. Category is ommitted.
  −
*<samp>Basic</samp>, a general type for a myriad of items.
  −
*<samp>Cooking</samp>, used for cooked items. Not used for cooking ingredients. Always paired with category <samp>-7</samp>.
  −
*<samp>Minerals</samp>, used for Gems and Minerals. Paired with categories <samp>-2</samp> or <samp>-12</samp>, respectively.
   
|-
 
|-
| Category
+
| <samp>Buffs</samp>
| integer
+
| ''(Optional)'' The buffs to apply to the player when this item is eaten, if any. Default none.
| The item category, usually matching a constant like <samp>Object.flowersCategory</samp>. [[#Categories|Categories]] are either 0 (omitted category) or a negative integer. They are frequently referenced in other parts of the game.
+
 
 +
This consists of a list of models with these fields:
 +
{| class="wikitable"
 
|-
 
|-
| Price
+
! field
| integer
+
! purpose
| The gold price of the item when sold by the player. This is not the price when bought from a shop.
   
|-
 
|-
| Texture
+
| <samp>Id</samp>
| string
+
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for this entry within the list.
| The asset name for the texture containing the item's sprite, or null for Maps/springobjects.
   
|-
 
|-
| SpriteIndex
+
| <samp>Duration</samp>
| integer
+
| ''(Optional if <samp>BuffId</samp> is set)'' The buff duration measured in in-game minutes. This can be set to <samp>-2</samp> for a buff that should last for the rest of the day.
| The sprite's index in the spritesheet.
   
|-
 
|-
| Edibility
+
| <samp>BuffId</samp>
| integer
+
| ''(Optional)'' The unique ID of a buff from [[#Custom buffs|<samp>Data/Buffs</samp>]] to apply, or <samp>null</samp> to ignore <samp>Data/Buffs</samp> and set the ID to <samp>food</samp> or <samp>drink</samp> depending on the item's <samp>IsDrink</samp> field.
| A numeric value that determines how much energy (edibility × 2.5) and health
  −
edibility × 1.125) is restored when this item is eaten. An item with an edibility
  −
of -300 can't be eaten, values from -299 to -1 reduce health and energy, and
  −
zero can be eaten but doesn't change health/energy.
     −
This is ignored for Rings.
+
If a buff from <samp>Data/Buffs</samp> is applied and you also specify other fields, here's how the buff data is combined:
 +
{| class="wikitable"
 
|-
 
|-
| IsDrink
+
! field
| boolean
+
! result
| Whether to drink the item instead of eating it. Ignored if the item isn't edible per its Edibility.
   
|-
 
|-
| Buffs
+
| <samp>Duration</samp><br /><samp>IconTexture</samp><br /><samp>SpriteIndex</samp><br /><samp>GlowColor</samp>
| <samp>List</samp> of <samp>ObjectBuffData</samp>, stored in the game code in <samp>StardewValley.GameData.Objects.ObjectBuffData</samp>.
+
| If specified, the value in <samp>Data/Objects</samp> is used instead of the one in <samp>Data/Buffs</samp>. If omitted, defaults to the value from <samp>Data/Buffs</samp>.
| The buffs to apply to the player when this item is eaten, if any. Ignored if the item isn't edible per its Edibility.
+
|-
 +
| <samp>CustomAttributes</samp>
 +
| The values from both entries are combined (e.g. +1 speed in <samp>Data/Objects</samp> and +1 speed in <samp>Data/Buffs</samp> results in +2 speed).
 +
|-
 +
| <samp>IsDebuff</samp>
 +
| The value in <samp>Data/Objects</samp> is used.
 +
|}
 
|-
 
|-
| GeodeDropsDefaultItems
+
| <samp>IsDebuff</samp>
| boolean
+
| ''(Optional)'' Whether this buff counts as a debuff, so its duration should be halved when wearing a Sturdy Ring. Default false.
| If true, the item will drop a default item when broken as a geode. If GeodeDrops is also set, there's a 50% chance of choosing a value from that list instead.
   
|-
 
|-
| GeodeDrops
+
| <samp>IconTexture</samp>
| <samp>List</samp> of <samp>ObjectGeodeDropData</samp>, stored in the game code in <samp>StardewValley.GameData.Objects.ObjectGeodeDropData</samp>.
+
| ''(Optional)'' The asset name for the icon texture to load. This must contain one or more 16x16 icons in a grid of any size. If omitted, the game will draw a default icon based on the <samp>BuffId</samp> and <samp>CustomAttributes</samp> fields.
| The items that can be dropped when this item is broken open as a geode, or null.
   
|-
 
|-
| ArtifactSpotChances
+
| <samp>SpriteIndex</samp>
| <samp>Dictionary</samp> of string keys and float values.
+
| ''(Optional)'' The buff's icon index within the <samp>IconTexture</samp>, where 0 is the top-left icon. Default 0.
| If this is an artifact (i.e. Type is Arch), the chance that it can be found by digging artifact spots in each location.
   
|-
 
|-
| ExcludeFromFishingCollection
+
| <samp>GlowColor</samp>
| boolean
+
| ''(Optional)'' The glow color to apply to the player. See [[#Color fields|color format]]. Default none.
| Whether to exclude this item from the fishing collection and perfection score.
   
|-
 
|-
| ExcludeFromShippingCollection
+
| <samp>CustomAttributes</samp>
| boolean
+
| The custom buff attributes to apply, if any.
| Whether to exclude this item from the shipping collection and perfection score.
+
 
 +
This consists of a model with any combination of these fields:
 +
{| class="wikitable"
 
|-
 
|-
| ExcludeFromRandomSale
+
! field
| boolean
+
! purpose
| Whether to exclude this item from shops when selecting random items to sell.
   
|-
 
|-
| ContextTags
+
| <samp>FarmingLevel</samp><br /><samp>FishingLevel</samp><br /><samp>ForagingLevel</samp><br /><samp>LuckLevel</samp><br /><samp>MiningLevel</samp>
| <samp>List</samp> of strings.
+
| ''(Optional)'' An amount applied to the matching [[Skills|skill level]] while the buff is active. This can be negative for a debuff. Default 0.
| The custom [[#Context_tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data).
   
|-
 
|-
| CustomFields
+
| <samp>Attack</samp><br /><samp>Defense</samp><br /><samp>MagneticRadius</samp><br /><samp>MaxStamina</samp><br /><samp>Speed</samp>
| <samp>Dictionary</samp> of string keys and string values.
+
| ''(Optional)'' An amount applied to the player's [[attack]], [[defense]], [[Magnetism|magnetic radius]], maximum [[Energy|stamina]], or [[speed]] while the buff is active. This can be negative for a debuff. Default 0.
| Custom fields ignored by the base game, for use by mods.
+
|}
 
|-
 
|-
 +
| <samp>CustomFields</samp>
 +
| ''(Optional)'' The [[#Custom data fields|custom fields]] for this entry.
 +
|}
 
|}
 
|}
 +
    
===Notes===
 
===Notes===
* In 1.5, items that have a number in index 6 (the "Crafting" field) showed buggy information in-game (''e.g.,'' Bean Hotpot prior to version 1.4). Items that had a number in the "Attack" field displayed the Attack icon and a number, but no description. It's unclear how these buffs work (if at all).
+
* Prior to 1.6, items that have a number in index 6 (the "Crafting" field) showed buggy information in-game (''e.g.,'' Bean Hotpot prior to version 1.4). Items that had a number in the "Attack" field displayed the Attack icon and a number, but no description. It's unclear how these buffs work (if at all).
 
* '''Adding custom items with the <samp>Arch</samp> type is inadvisable as it often leads to Artifact Spots becoming broken and not giving any items.'''
 
* '''Adding custom items with the <samp>Arch</samp> type is inadvisable as it often leads to Artifact Spots becoming broken and not giving any items.'''
 
* Named [[buffs]] (like [[Oil of Garlic]], [[Life Elixir]], or [[Buffs#Tipsy|Tipsy]]) are implemented in code and can't be set in the food buff fields.
 
* Named [[buffs]] (like [[Oil of Garlic]], [[Life Elixir]], or [[Buffs#Tipsy|Tipsy]]) are implemented in code and can't be set in the food buff fields.
Line 611: Line 624:  
Big craftables are objects which can be placed in the world and are two tiles tall (instead of one like objects).
 
Big craftables are objects which can be placed in the world and are two tiles tall (instead of one like objects).
   −
They have their data in <samp>Data/BigCraftableInformation</samp>, their in-game sprites in <samp>TileSheets/Craftables</samp>, and their code in <samp>StardewValley.Object</samp> (with the <code>bigCraftable.Value = true</code> flag).
+
They have their data in <samp>Data/BigCraftables</samp> (<samp>Data/BigCraftablesInformation</samp> prior to 1.6), their in-game sprites in <samp>TileSheets/Craftables</samp>, and their code in <samp>StardewValley.Object</samp> (with the <code>bigCraftable.Value = true</code> flag).
    
===Data format===
 
===Data format===
The big craftables data in <samp>Data/BigCraftableInformation</samp> consists of an integer→string dictionary with entries like this:
+
The big craftables data in <samp>Data/BigCraftables</samp> consists of a string → model lookup, where...
 +
* The key is the unqualified [[#Custom items|item ID]].
 +
* The value is a model with the fields listed below.
    
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
   "19": "Oil Maker/50/-300/Crafting -9/Makes gourmet truffle oil./true/true/0/Oil Maker"
+
   "19": {
 +
    "Name": "Oil Maker",
 +
    "DisplayName": "[LocalizedText Strings\\BigCraftables:OilMaker_Name]",
 +
    "Description": "[LocalizedText Strings\\BigCraftables:OilMaker_Description]",
 +
    "Price": 50,
 +
    "Fragility": 0,
 +
    "CanBePlacedOutdoors": true,
 +
    "CanBePlacedIndoors": true,
 +
    "IsLamp": false,
 +
    "Texture": null,
 +
    "SpriteIndex": 19,
 +
    "ContextTags": null,
 +
    "CustomFields": null
 +
  }
 
</syntaxhighlight>
 
</syntaxhighlight>
   −
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
+
Field values are described below (Copied from [[Modding:Migrate to Stardew Valley 1.6]]):
    +
====Basic info====
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! index
   
! field
 
! field
! effect
+
! purpose
 
|-
 
|-
| 0
+
| <samp>Name</samp>
| name
+
| The internal item name.
| The internal item name (and display name in English).
  −
|-
  −
| 1
  −
| price
  −
| The gold price when sold by the player.
   
|-
 
|-
| 2
+
| <samp>DisplayName</samp><br /><samp>Description</samp>
| edibility
+
| A [[Modding:Tokenizable strings|tokenizable string]] for the item's in-game display name and description.
| See edibility for [[#Objects|object data]]. Always set to <samp>-300</samp> (inedible) for vanilla items.
   
|-
 
|-
| 3
+
| <samp>Price</samp>
| type and category
+
| ''(Optional)'' The price when sold by the player. This is not the price when bought from a shop. Default 0.
| See type and category for [[#Objects|object data]]. Always set to <samp>Crafting -9</samp> for vanilla items.
+
|}
 +
 
 +
====Behavior====
 +
{| class="wikitable"
 
|-
 
|-
| 4
+
! field
| description
+
! purpose
| The translated item description shown in-game.
   
|-
 
|-
| 5
+
| <samp>Fragility</samp>
| outdoors
+
| ''(Optional)'' How the item can be picked up. The possible values are 0 (pick up with any tool), 1 (destroyed if hit with an axe/hoe/pickaxe, or picked up with any other tool), or 2 (can't be removed once placed). Default 0.
| Whether the item can be placed outdoors (<samp>true</samp> or <samp>false</samp>).
   
|-
 
|-
| 6
+
| <samp>CanBePlacedIndoors</samp><br /><samp>CanBePlacedOutdoors</samp>
| indoors
+
| ''(Optional)'' Whether the item can be placed indoors or outdoors. Default true.
| Whether the item can be placed indoors (<samp>true</samp> or <samp>false</samp>).
   
|-
 
|-
| 7
+
| <samp>IsLamp</samp>
| fragility
+
| ''(Optional)'' Whether this is a lamp and should produce light when dark. Default false.
| How the item is removed by tools. Possible values:
+
|}
 +
 
 +
====Appearance====
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! fragility
+
! field
! effect
+
! purpose
 +
|-
 +
| <samp>Texture</samp>
 +
| ''(Optional)'' The asset name for the texture containing the item's sprite. Defaults to <samp>TileSheets/Craftables</samp>.
 
|-
 
|-
| <samp>0</samp>
+
| <samp>SpriteIndex</samp>
| Pick up with any tool.
+
| ''(Optional)'' The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
 +
|}
 +
 
 +
====Context tags====
 +
{| class="wikitable"
 
|-
 
|-
| <samp>1</samp>
+
! field
| Destroyed if hit with an [[Axes|axe]], [[Hoes|hoe]], or [[Pickaxes|pickaxe]]. Any other tool will pick it up.
+
! purpose
 
|-
 
|-
| <samp>2</samp>
+
| <samp>ContextTags</samp>
| Indestructible. The item can't be removed once placed.
+
| ''(Optional)'' The custom [[Modding:Items#Context tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data). This is formatted as a list; for example:
 +
<syntaxhighlight lang="json">
 +
"ContextTags": [ "light_source", "torch_item" ]
 +
</syntaxhighlight>
 
|}
 
|}
 +
 +
====Advanced====
 +
{| class="wikitable"
 
|-
 
|-
| 8
+
! field
| is lamp
+
! purpose
| Whether the item is a lamp and produces light when it's dark. This can be <samp>true</samp> (mark as lamp) or any other value (ignored).
   
|-
 
|-
| 9
+
| <samp>CustomFields</samp>
| display name
+
| ''(Optional)'' The [[Modding:Migrate_to_Stardew_Valley_1.6#Custom_data_fields|custom fields]] for this entry.  
| The translated display name (in non-English assets only).
   
|}
 
|}
   Line 937: Line 972:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
+
Hats from the base game use the hat's <samp>ParentSheetIndex</samp> as its item ID.
 +
For each entry in the data asset, the key is the hat's item ID, and the value is a slash-delimited string with these fields:
    
{| class="wikitable"
 
{| class="wikitable"
Line 947: Line 983:  
| 0
 
| 0
 
| name
 
| name
| The internal item name (and display name in English).
+
| The internal item name.
 
|-
 
|-
 
| 1
 
| 1
Line 962: Line 998:  
|-
 
|-
 
| 4
 
| 4
 +
| tags
 +
| A space-separated list of "tags". These are separate from context tags, and used to contain miscellaneous information. Currently, the only tag used by the game is <samp>Prismatic</samp>, which marks a hat as prismatic and causes it to cycle through colors.
 +
|-
 +
| 5
 
| display name
 
| display name
| The translated item name shown in-game (for non-English assets only).
+
| The translated item name shown in-game.
 +
|-
 +
| 6
 +
| sprite index
 +
| The index in the hat spritesheet used to display this hat.
 +
|-
 +
| 7
 +
| texture name
 +
| The name of the game texture to use for the hat. If empty, the game will use the default hat sheet <samp>Characters/Farmer/hats</samp>
 
|}
 
|}
   −
Hats have a hard-coded category of -95 (<samp>Hats.cs::Load</samp>)
+
Hats have a hard-coded category of -95 (<samp>HatDataDefinition.cs::GetData</samp>)
    
==Tools==
 
==Tools==
Line 1,134: Line 1,182:  
==History==
 
==History==
 
{{History|1.6|Objects are now stored in <samp>Data/Objects</samp> rather than <samp>Data/ObjectInformation</samp> and have a new format.}}
 
{{History|1.6|Objects are now stored in <samp>Data/Objects</samp> rather than <samp>Data/ObjectInformation</samp> and have a new format.}}
 +
{{History|1.6|Field 4 of hats is now used for tags, rather than displayName.}}
 +
{{History|1.6|Display name field is now used for all languages.}}
 +
{{History|1.6|Added Texture & texture index fields to all object data.}}
 +
{{History|1.6|All types of items now use string IDs.}}

Navigation menu