Changes

Jump to navigation Jump to search
m
Fix History section to be H2 heading instead of H3
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/ObjectInformation</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>, 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/ObjectInformation</samp> consists of an integer→string dictionary with entries like this:
+
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>:
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
   "18": "Daffodil/30/0/Basic -81/Daffodil/A traditional spring flower that makes a nice gift."
+
"201": {
 +
  "Name": "Complete Breakfast",
 +
   "DisplayName": "[LocalizedText Strings\\Objects:CompleteBreakfast_Name]",
 +
  "Description": "[LocalizedText Strings\\Objects:CompleteBreakfast_Description]",
 +
  "Type": "Cooking",
 +
  "Category": -7,
 +
  "Price": 350,
 +
  "Texture": null,
 +
  "SpriteIndex": 201,
 +
  "Edibility": 80,
 +
  "IsDrink": false,
 +
  "Buffs": [
 +
    {
 +
      "Id": "Food",
 +
      "BuffId": null,
 +
      "IconTexture": null,
 +
      "IconSpriteIndex": 0,
 +
      "Duration": 600,
 +
      "IsDebuff": false,
 +
      "GlowColor": null,
 +
      "CustomAttributes": {
 +
        "FarmingLevel": 2.0,
 +
        "FishingLevel": 0.0,
 +
        "MiningLevel": 0.0,
 +
        "LuckLevel": 0.0,
 +
        "ForagingLevel": 0.0,
 +
        "MaxStamina": 50.0,
 +
        "MagneticRadius": 0.0,
 +
        "Speed": 0.0,
 +
        "Defense": 0.0,
 +
        "Attack": 0.0
 +
      },
 +
      "CustomFields": null
 +
    }
 +
  ],
 +
  "GeodeDropsDefaultItems": false,
 +
  "GeodeDrops": null,
 +
  "ArtifactSpotChances": null,
 +
  "ExcludeFromFishingCollection": false,
 +
  "ExcludeFromShippingCollection": false,
 +
  "ExcludeFromRandomSale": false,
 +
  "ContextTags": [
 +
    "color_yellow",
 +
    "food_breakfast"
 +
  ],
 +
  "CustomFields": null
 +
  }
 
</syntaxhighlight>
 
</syntaxhighlight>
    
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 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 a slash-delimited string with the fields listed below. Fields 0–5 are used by most object; fields 6–11 are only used for a select few items. 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:
    
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! index
+
! Field
! field
+
! Data Type
! effect
+
! Effect<ref>See <samp>StardewValley.GameData.Objects.ObjectData</samp></ref>
 
|-
 
|-
 
!style="text-align: left;" colspan="3"| all objects
 
!style="text-align: left;" colspan="3"| all objects
 
|-
 
|-
| 0
+
| Name
| name
+
| string
 
| The internal item name (and display name in English).
 
| The internal item name (and display name in English).
 
|-
 
|-
| 1
+
| DisplayName
| price
+
| string
| The gold price of the item when sold by the player. This is not the price when bought from a shop.
+
| A tokenizable string for the item's translated display name.
 
|-
 
|-
| 2
+
| Description
| edibility
+
| string
| A numeric value that determines how much energy (edibility × 2.5) and health (edibility × 1.125) is restored. An item with an edibility of -300 can't be eaten, values from -299 to -1 reduce health & energy, and zero can be eaten but doesn't change health/energy.
+
| A tokenizable string for the item's translated description.
 
  −
This is ignored for rings.
   
|-
 
|-
| 3
+
| Type
| type and category
+
| string
| &#32;
+
| The item's general type, like Arch (artifact) or Minerals.
This is the item's type (string) and, in most cases, a category (negative integer), separated by a space like <samp>Fish -4</samp>. For some types the category is omitted.
+
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>.
While [[#Categories|categories]] are frequently referenced in other parts of the game, 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/ObjectInformation</samp> and their purposes (as is currently understood) are as follows:
  −
*<samp>Ring</samp>, used for all rings, even the [[Wedding Ring]]. Category is ommitted, 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>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>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>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>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 ommitted or <samp>-8</samp>, <samp>-24</samp>, or <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>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>Basic</samp>, a general type for a myriad of items.
Line 491: Line 535:  
*<samp>Minerals</samp>, used for Gems and Minerals. Paired with categories <samp>-2</samp> or <samp>-12</samp>, respectively.
 
*<samp>Minerals</samp>, used for Gems and Minerals. Paired with categories <samp>-2</samp> or <samp>-12</samp>, respectively.
 
|-
 
|-
| 4
+
| Category
| display name
+
| integer
| The translated item name (not used when playing in English).
+
| 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.
 
|-
 
|-
| 5
+
| Price
| description
+
| integer
| The translated item description.
+
| The gold price of the item when sold by the player. This is not the price when bought from a shop.
 
|-
 
|-
!style="text-align: left;" colspan="3"| miscellaneous
+
| Texture
 +
| string
 +
| The asset name for the texture containing the item's sprite, or null for Maps/springobjects.
 
|-
 
|-
| 6
+
| SpriteIndex
| miscellaneous
+
| integer
| &#32;
+
| The sprite's index in the spritesheet.
* For a food or drink item, set this to <samp>food</samp> or <samp>drink</samp> respectively. This enables the remaining fields, and changes which animation/sound is played when the player consumes the item. Any other value is ignored.
  −
* For a geode or geode-esque item ([[Artifact Trove|275]], [[Geode|535]], [[Frozen Geode|536]], [[Magma Geode|537]], or [[Omni Geode|749]]), this is a space-delimited list of object IDs. There's a roughly 50% chance that the geode item will drop one of these items (the other drops are hardcoded).
  −
* For artifacts, this is a list of locations followed by a number less than 1. The game checks this field first when digging up an Artifact Spot. If nothing is randomly chosen from this list, the game checks the data in <samp>Data/Locations.xnb</samp>.
  −
* For fish and other fished items, this a string in the format of <samp>{{t|times}}^{{t|seasons}}</samp>, where {{t|times}} is a space-deliminated list of <samp>Day</samp> or <samp>Night</samp>, and {{t|seasons}} is the same with seasons instead. Appears to be unused or redundant, as the data for what times and seasons fish appear in is stored in <samp>Data/Fish.xnb</samp>.
   
|-
 
|-
| 7
+
| Edibility
| miscellaneous 2
+
| integer
|
+
| A numeric value that determines how much energy (edibility × 2.5) and health
* For <samp>Arch</samp> or <samp>asdf</samp> type items, this can be one of the following types, the purpose of which is currently not understood:
+
edibility × 1.125) is restored when this item is eaten. An item with an edibility
** <samp>Item {{t|number}} {{t|number}}</samp>
+
of -300 can't be eaten, values from -299 to -1 reduce health and energy, and
** <samp>Debris {{t|number}} {{t|number}} {{t|number}}</samp>
+
zero can be eaten but doesn't change health/energy.
** <samp>Money {{t|number}} {{t|number}}</samp>
+
 
** <samp>Decor {{t|number}} {{t|number}}</samp>
+
This is ignored for Rings.
** <samp>Seeds {{t|number}}</samp>
  −
** <samp>Recipe {{t|number}} {{t|recipe}} {{t|number}}</samp>
  −
** <samp>Note</samp>
  −
** For Dwarf Scrolls, this is always <samp>Set Dwarf 96 97 98 99</samp>.
  −
* For food and drinks, this is the bonuses to apply to the player's attribute when the item is consumed. This consists of a space-delimited list of these numbers:
  −
{|class="wikitable"
   
|-
 
|-
! index
+
| IsDrink
! buff
+
| boolean
 +
| Whether to drink the item instead of eating it. Ignored if the item isn't edible per its Edibility.
 
|-
 
|-
| 0
+
| Buffs
| [[Skills#Farming|farming]]
+
| <samp>List</samp> of <samp>ObjectBuffData</samp>, stored in the game code in <samp>StardewValley.GameData.Objects.ObjectBuffData</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.
 
|-
 
|-
| 1
+
| GeodeDropsDefaultItems
| [[Skills#Fishing|fishing]]
+
| boolean
 +
| 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.
 
|-
 
|-
| 2
+
| GeodeDrops
| [[Skills#Mining|mining]]
+
| <samp>List</samp> of <samp>ObjectGeodeDropData</samp>, stored in the game code in <samp>StardewValley.GameData.Objects.ObjectGeodeDropData</samp>.
 +
| The items that can be dropped when this item is broken open as a geode, or null.
 
|-
 
|-
| 3
+
| ArtifactSpotChances
| ''unused''
+
| <samp>Dictionary</samp> of string keys and float values.
 +
| If this is an artifact (i.e. Type is Arch), the chance that it can be found by digging artifact spots in each location.
 
|-
 
|-
| 4
+
| ExcludeFromFishingCollection
| [[Luck|luck]]
+
| boolean
 +
| Whether to exclude this item from the fishing collection and perfection score.
 
|-
 
|-
| 5
+
| ExcludeFromShippingCollection
| [[Skills#Foraging|foraging]]
+
| boolean
 +
| Whether to exclude this item from the shipping collection and perfection score.
 
|-
 
|-
| 6
+
| ExcludeFromRandomSale
| ''unused''
+
| boolean
 +
| Whether to exclude this item from shops when selecting random items to sell.
 
|-
 
|-
| 7
+
| ContextTags
| max [[energy]]
+
| <samp>List</samp> of strings.
|-
+
| The custom [[#Context_tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data).
| 8
  −
| [[magnetism]]
   
|-
 
|-
| 9
+
| CustomFields
| [[speed]]
+
| <samp>Dictionary</samp> of string keys and string values.
 +
| Custom fields ignored by the base game, for use by mods.
 
|-
 
|-
| 10
  −
| [[defense]]
  −
|-
  −
| 11
  −
| [[attack]]
  −
|}
  −
|-
  −
| 8
  −
| buff duration
  −
| How long the buffs provided by the previous field last, measured in real seconds (assuming [[Day Cycle#Time speed|the default time speed]]). The buff duration number shown in-game will always be one second less than the calculated value.
   
|}
 
|}
    
===Notes===
 
===Notes===
* Items that have a number in index 6 (the "Crafting" field) show buggy information in-game (''e.g.,'' Bean Hotpot prior to version 1.4). Items that have a number in the "Attack" field display the Attack icon and a number, but no description. It's unclear how these buffs work (if at all).
+
* 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).
 
* '''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 1,098: Line 1,131:     
[[ru:Модификации:Объекты]]
 
[[ru:Модификации:Объекты]]
 +
 +
==History==
 +
{{History|1.6|Objects are now stored in <samp>Data/Objects</samp> rather than <samp>Data/ObjectInformation</samp> and have a new format.}}
46

edits

Navigation menu