Changes

Jump to navigation Jump to search
m
Line 295: Line 295:  
With the {{nexus mod|3101|Console Code}} mod installed, you can run this command in the SMAPI console to see a list of objects by category:
 
With the {{nexus mod|3101|Console Code}} mod installed, you can run this command in the SMAPI console to see a list of objects by category:
   −
<pre>cs return string.Join(`\n`, Game1.objectInformation.Keys.Select(key => new StardewValley.Object(key, 1)).GroupBy(item => item.Category, item => item.Name).OrderByDescending(p => p.Key).Select(p => $`{p.Key}: {string.Join(`, `, p.OrderBy(name => name))}`));</pre>
+
<pre>cs return string.Join(`\n`, Game1.objectData.Keys.Select(key => new StardewValley.Object(key, 1)).GroupBy(item => item.Category, item => item.Name).OrderByDescending(p => p.Key).Select(p => $`{p.Key}: {string.Join(`, `, p.OrderBy(name => name))}`));</pre>
 
}}
 
}}
   Line 498: Line 498:  
* 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====
 
====Basic info====
Line 513: Line 513:  
|-
 
|-
 
| <samp>Type</samp>
 
| <samp>Type</samp>
| The item's general type, like <c>Arch</c> (artifact) or <c>Minerals</c>.
+
| The item's general type, like <samp>Arch</samp> (artifact) or <samp>Minerals</samp>. The vanilla types are: Litter, Basic, Minerals, Quest, asdf, Crafting, Arch, fish, Cooking, Seeds, Ring, interactive
 
|-
 
|-
 
| <samp>Category</samp>
 
| <samp>Category</samp>
Line 522: Line 522:  
|}
 
|}
    +
====Appearance====
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Field
+
! field
! Data Type
+
! purpose
! Effect<ref>See <samp>GameData.Objects.ObjectData</samp></ref>
   
|-
 
|-
| Type
+
| <samp>Texture</samp>
| string
+
| The asset name for the texture containing the item's sprite. Defaults to <samp>Maps/springobjects</samp>.
| 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>SpriteIndex</samp>
| integer
+
| The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
| 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.
+
|}
 +
 
 +
====Edibility====
 +
{| 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>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.
| The asset name for the texture containing the item's sprite, or null for Maps/springobjects.
   
|-
 
|-
| SpriteIndex
+
| <samp>IsDrink</samp>
| integer
+
| ''(Optional)'' Whether to drink the item instead of eating it. Default false.
| The sprite's index in the spritesheet.
   
|-
 
|-
| Edibility
+
| <samp>Buffs</samp>
| integer
+
| ''(Optional)'' The buffs to apply to the player when this item is eaten, if any. Default none.
| 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.
+
This consists of a list of models with these fields:
 +
{| class="wikitable"
 
|-
 
|-
| IsDrink
+
! field
| boolean
+
! purpose
| Whether to drink the item instead of eating it. Ignored if the item isn't edible per its Edibility.
   
|-
 
|-
| Buffs
+
| <samp>Id</samp>
| <samp>List</samp> of <samp>ObjectBuffData</samp>, stored in the game code in <samp>GameData.Objects.ObjectBuffData</samp>.
+
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for this entry within the list.
| The buffs to apply to the player when this item is eaten, if any. Ignored if the item isn't edible per its Edibility.
   
|-
 
|-
| GeodeDropsDefaultItems
+
| <samp>Duration</samp>
| boolean
+
| ''(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.
| 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>BuffId</samp>
| <samp>List</samp> of <samp>ObjectGeodeDropData</samp>, stored in the game code in <samp>GameData.Objects.ObjectGeodeDropData</samp>.
+
| ''(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.
| The items that can be dropped when this item is broken open as a geode, or null.
+
 
 +
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"
 
|-
 
|-
| ArtifactSpotChances
+
! field
| <samp>Dictionary</samp> of string keys and float values.
+
! result
| 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>Duration</samp><br /><samp>IconTexture</samp><br /><samp>SpriteIndex</samp><br /><samp>GlowColor</samp>
| boolean
+
| 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>.
| Whether to exclude this item from the fishing collection and perfection score.
   
|-
 
|-
| ExcludeFromShippingCollection
+
| <samp>CustomAttributes</samp>
| boolean
+
| 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).
| Whether to exclude this item from the shipping collection and perfection score.
   
|-
 
|-
| ExcludeFromRandomSale
+
| <samp>IsDebuff</samp>
| boolean
+
| The value in <samp>Data/Objects</samp> is used.
| Whether to exclude this item from shops when selecting random items to sell.
+
|}
 
|-
 
|-
| ContextTags
+
| <samp>IsDebuff</samp>
| <samp>List</samp> of strings.
+
| ''(Optional)'' Whether this buff counts as a debuff, so its duration should be halved when wearing a Sturdy Ring. Default false.
| 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>IconTexture</samp>
| <samp>Dictionary</samp> of string keys and string values.
+
| ''(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.
| Custom fields ignored by the base game, for use by mods.
   
|-
 
|-
 +
| <samp>SpriteIndex</samp>
 +
| ''(Optional)'' The buff's icon index within the <samp>IconTexture</samp>, where 0 is the top-left icon. Default 0.
 +
|-
 +
| <samp>GlowColor</samp>
 +
| ''(Optional)'' The glow color to apply to the player. See [[#Color fields|color format]]. Default none.
 +
|-
 +
| <samp>CustomAttributes</samp>
 +
| The custom buff attributes to apply, if any.
 +
 +
This consists of a model with any combination of these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>FarmingLevel</samp><br /><samp>FishingLevel</samp><br /><samp>ForagingLevel</samp><br /><samp>LuckLevel</samp><br /><samp>MiningLevel</samp>
 +
| ''(Optional)'' An amount applied to the matching [[Skills|skill level]] while the buff is active. This can be negative for a debuff. Default 0.
 +
|-
 +
| <samp>Attack</samp><br /><samp>Defense</samp><br /><samp>MagneticRadius</samp><br /><samp>MaxStamina</samp><br /><samp>Speed</samp>
 +
| ''(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.
 
|}
 
|}
 +
|-
 +
| <samp>CustomFields</samp>
 +
| ''(Optional)'' The [[#Custom data fields|custom fields]] for this entry.
 +
|}
 +
|}
 +
    
===Notes===
 
===Notes===
Line 619: 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/BigCraftables</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/BigCraftables</samp> consists of an integer→string dictionary with entries like this<ref>See <samp>Data/BigCraftables.xnb</samp></ref>:
+
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">
Line 641: Line 648:  
</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"
 
|-
 
|-
! Field
+
! field
! Data Type
+
! purpose
! Effect<ref>See <samp>GameData.BigCraftables.BigCraftableData</samp></ref>
   
|-
 
|-
| Name
+
| <samp>Name</samp>
| string
+
| The internal item name.
| The internal item name (and display name in English).
   
|-
 
|-
| DisplayName
+
| <samp>DisplayName</samp><br /><samp>Description</samp>
| string
+
| A [[Modding:Tokenizable strings|tokenizable string]] for the item's in-game display name and description.
| A tokenizable string for the item's translated display name.
   
|-
 
|-
| Description
+
| <samp>Price</samp>
| string
+
| ''(Optional)'' The price when sold by the player. This is not the price when bought from a shop. Default 0.
| A tokenizable string for the item's translated description.
+
|}
|-
+
 
| Price
+
====Behavior====
| integer
  −
| The gold price when sold by the player. This is not the price when bought from a shop.
  −
|-
  −
| Fragility
  −
| integer
  −
| How the item is removed by tools. Possible values:
   
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! fragility
+
! field
! effect
+
! purpose
 
|-
 
|-
| <samp>0</samp>
+
| <samp>Fragility</samp>
| Pick up with any tool.
+
| ''(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.
 
|-
 
|-
| <samp>1</samp>
+
| <samp>CanBePlacedIndoors</samp><br /><samp>CanBePlacedOutdoors</samp>
| Destroyed if hit with an [[Axes|axe]], [[Hoes|hoe]], or [[Pickaxes|pickaxe]]. Any other tool will pick it up.
+
| ''(Optional)'' Whether the item can be placed indoors or outdoors. Default true.
 
|-
 
|-
| <samp>2</samp>
+
| <samp>IsLamp</samp>
| Indestructible. The item can't be removed once placed.
+
| ''(Optional)'' Whether this is a lamp and should produce light when dark. Default false.
 
|}
 
|}
 +
 +
====Appearance====
 +
{| class="wikitable"
 
|-
 
|-
| CanBePlacedOutdoors
+
! field
| boolean
+
! purpose
| Whether the item can be placed outdoors.
   
|-
 
|-
| CanBePlacedIndoors
+
| <samp>Texture</samp>
| boolean
+
| ''(Optional)'' The asset name for the texture containing the item's sprite. Defaults to <samp>TileSheets/Craftables</samp>.
| Whether the item can be placed indoors.
   
|-
 
|-
| IsLamp
+
| <samp>SpriteIndex</samp>
| boolean
+
| ''(Optional)'' The sprite's index within the <samp>Texture</samp>, where 0 is the top-left sprite.
| Whether the item is a lamp and produces light when it's dark.  
+
|}
 +
 
 +
====Context tags====
 +
{| class="wikitable"
 
|-
 
|-
| Texture
+
! field
| string
+
! purpose
| The asset name for the texture containing the item's sprite, or null for <samp>TileSheets/Craftables</samp>.
   
|-
 
|-
| SpriteIndex
+
| <samp>ContextTags</samp>
| integer
+
| ''(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:
| The sprite's index in the spritesheet.
+
<syntaxhighlight lang="json">
 +
"ContextTags": [ "light_source", "torch_item" ]
 +
</syntaxhighlight>
 +
|}
 +
 
 +
====Advanced====
 +
{| class="wikitable"
 
|-
 
|-
| ContextTags
+
! field
| <samp>List</samp> of strings
+
! purpose
| Thee 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>Dictionary</samp> of string keys to string values
  −
| Custom fields ignored by the base game, for use by mods.
   
|-
 
|-
 +
| <samp>CustomFields</samp>
 +
| ''(Optional)'' The [[Modding:Migrate_to_Stardew_Valley_1.6#Custom_data_fields|custom fields]] for this entry.
 
|}
 
|}
   Line 967: 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 977: Line 983:  
| 0
 
| 0
 
| name
 
| name
| The internal item name (and display name in English).
+
| The internal item name.
 
|-
 
|-
 
| 1
 
| 1
Line 992: 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,164: 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.}}
translators
8,404

edits

Navigation menu