Changes

Jump to navigation Jump to search
452 bytes removed ,  00:54, 28 January 2022
rework layout and expand info in preparation for custom items page
Line 3: Line 3:  
This page explains how the game stores and parses object data. This is an advanced guide for mod developers.
 
This page explains how the game stores and parses object data. This is an advanced guide for mod developers.
   −
==Raw data==
+
==Objects==
Object data is stored in <samp>Content\Data\ObjectInformation.xnb</samp>, which can be [[Modding:Editing XNB files#unpacking|unpacked for editing]]. Here's the raw data as of {{version|1.5.1}} for reference:
+
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 is <samp>StardewValley.Object</samp>. See [[Modding:Object data/Sprites|a table of sprites and their corresponding indexes]].
 +
 
 +
===Raw data===
 +
Here's the raw data as of {{version|1.5.1}} for reference:
    
{{collapse|Data|content=<syntaxhighlight lang="json">
 
{{collapse|Data|content=<syntaxhighlight lang="json">
Line 713: Line 718:  
</syntaxhighlight>}}
 
</syntaxhighlight>}}
   −
==Format==
+
===Data format===
===Rings===
+
The data in <samp>Data/ObjectInformation</samp> (see raw data above) consists of an integer→string dictionary, where the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with the fields listed below.
Objects with parent sheet indexes 516–534 (<samp>Ring.ringLowerIndexRange</samp> through <samp>Ring.ringUpperIndexRange</samp>) or 801 (wedding ring) are parsed by the <samp>Ring</samp> constructor and contain six fields:
+
 
 +
Fields 0–5 are used by rings and most other objects; fields 6–11 are only used for food buffs. The objects with keys 516–534 (<samp>Ring.ringLowerIndexRange</samp> through <samp>Ring.ringUpperIndexRange</samp>) and 801 (wedding ring) are hardcoded as rings.
    
{| class="wikitable"
 
{| class="wikitable"
Line 721: Line 727:  
! index
 
! index
 
! field
 
! field
! example value
+
! effect
 +
|-
 +
!style="text-align: left;" colspan="3"| all objects
 
|-
 
|-
 
| 0
 
| 0
 
| name
 
| name
| ''Burglar's Ring''
+
| The internal item name (and display name in English).
 
|-
 
|-
 
| 1
 
| 1
| price<br /><small>(if sold by player)</small>
+
| price
| ''1500''
+
| The gold price of the item when sold by the player.
 
|-
 
|-
 
| 2
 
| 2
| edibility<br /><small>(always "-300")</small>
+
| edibility
| ''-300''
+
| A numeric value that determines how much health (edibility × 2.5) and energy (edibility × 1.125) is restored. An item with an edibility of -300 can't be eaten.
 +
 
 +
This is ignored for rings.
 
|-
 
|-
 
| 3
 
| 3
| type<br /><small>(always "Ring")</small>
+
| type and category
| ''Ring''
+
| &#32;
 +
* For a ring: the value <samp>Ring</samp>. Rings have a hardcoded category of -96 (<samp>Object.ringCategory</samp>).
 +
* For other objects: the item's type (string) and category (negative integer), separated by a space like <samp>Fish -4</samp>.
 
|-
 
|-
 
| 4
 
| 4
| display name<br /><small>(specific to language file)</small>
+
| display name
| ''Burglar's Ring''
+
| The translated item name.
 
|-
 
|-
 
| 5
 
| 5
 
| description
 
| description
| ''Monsters have a greater chance of dropping loot.''
+
| The translated item description.
|}
+
|-
 
+
!style="text-align: left;" colspan="3"| food & drink only
Rings have a hardcoded category -96 (<samp>Object.ringCategory</samp>), but this has no effect on how they're parsed.
+
|-
 
+
| 6
===Other objects===
+
| miscellaneous
All other objects contain at least six fields:
+
| &#32;
 
+
* 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.
{| class="wikitable"
+
* For a geode item ([[Geode|535]], [[Frozen Geode|536]], [[Magma Geode|537]], or [[Omni Geode|749]]) is broken, 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).
 +
|-
 +
| 7
 +
| buffs
 +
| 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
 
! index
! field
+
! buff
! example value
   
|-
 
|-
 
| 0
 
| 0
| name
+
| [[Skills#Farming|farming]]
| ''Glacierfish''
   
|-
 
|-
 
| 1
 
| 1
| price<br /><small>(if sold by player)</small>
+
| [[Skills#Fishing|fishing]]
| ''1000''
   
|-
 
|-
 
| 2
 
| 2
| edibility
+
| [[Skills#Mining|mining]]
| ''10''
   
|-
 
|-
 
| 3
 
| 3
| type and category
+
| ''unused''
| ''Fish -4''
   
|-
 
|-
 
| 4
 
| 4
| display name<br /><small>(specific to language file)</small>
+
| [[Luck|luck]]
| ''Glacierfish''
   
|-
 
|-
 
| 5
 
| 5
| description
+
| [[Skills#Foraging|foraging]]
| ''Builds a nest on the underside of glaciers.''
  −
|}
  −
 
  −
Some entries have more fields, but most of the extra fields seem to be ignored.
  −
 
  −
====Food &amp; Drink====
  −
If the value in index 6 is "food" or "drink" then the numbers in index 7 represent the buffs given when the food/drink is consumed.  The value in index 8 is the duration of the buff(s).
  −
 
  −
'''Buff Duration Number Calculation:'''
  −
Where X is equal to how many minutes you want the buff to last, and Y is the value in index 8. (See <samp>Buff::Buff()</samp>.)
  −
 
  −
(X minutes * 60) / 0.7 = Y
  −
 
  −
''Note that the buff duration shown on-screen in the game will always be 1 second less than the above calculation.''
  −
 
  −
'''Health/Energy/Edibility:'''
  −
The 'Edibility' number determines how much health and energy is restored.
  −
 
  −
For X being the value in index 2 (Edibility):
  −
 
  −
Energy Restored = X * 2.5
  −
<br />Health Restored = X * 2.5 * 0.45
  −
 
  −
From the constructor in <samp>Buff.cs</samp>, the numbers in index 7 (separated by spaces) are:
  −
{|class="wikitable"
   
|-
 
|-
!Index
+
| 6
!Buff Given
+
| ''unused''
 
|-
 
|-
|0
+
| 7
|Farming
+
| max [[energy]]
 
|-
 
|-
|1
+
| 8
|Fishing
+
| [[magnetism]]
 
|-
 
|-
|2
+
| 9
|Mining
+
| [[speed]]
 
|-
 
|-
|3
+
| 10
|Digging (unimplemented)
+
| [[defense]]
 
|-
 
|-
|4
+
| 11
|Luck
+
| [[attack]]
|-
+
|}
|5
  −
|Foraging
  −
|-
  −
|6
  −
|Crafting (unimplemented)
  −
|-
  −
|7
  −
|Max Energy
  −
|-
  −
|8
  −
|Magnetism
   
|-
 
|-
|9
+
| 8
|Speed
+
| buff duration
|-
+
| How long the buffs provided by the previous field last. This is converted into in-game minutes using the formula <samp>(''duration'' × 0.7) / 60</samp>. The buff duration number shown in-game will always be one second less than the calculated value.
|10
  −
|Defense
  −
|-
  −
|11
  −
|Attack
   
|}
 
|}
   −
Items that have a number in the "Crafting" field display 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).
+
===Notes===
 
+
* Items that have a number in 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).
Note:  The "Tipsy" Buff (from Beer, Wine, Mead, and Pale Ale) and the "Oil of Garlic" buff (from Oil of Garlic) are handled in the game code (<samp>BuffsDisplay::tryToAddDrinkBuff()</samp>), rather than through <samp>ObjectInformation.xnb</samp>.  The complete [[Health]] regen given by consuming a [[Life Elixir]] is also handled in <samp>tryToAddDrinkBuff</samp>.
+
* Named [[buffs]] (like [[Oil of Garlic]], [[Life Elixir]], or [[Tipsy]]) are implemented in code and can't be set in the food buff fields.
 
+
* The spritesheet and data have items that can't normally be found in the player inventory (like twigs and lumber), and some sprites have no corresponding item data. There are also multiple entries for ''weeds'' and ''stone'' corresponding to different sprites, but the player can only normally obtain one ''stone'' item (index 390) and no ''weeds'' items.
====Geodes====
  −
For the 4 types of geodes (item #535, 536, 537, and 749) there is approximately a 50% chance that the game will use the information in index 6 to determine what item you receive when breaking the geode open at the Blacksmith.  (See <samp>Utility::getTreasureFromGeode()</samp>.)
  −
 
  −
The numbers in index 6 represent other object numbers from <samp>ObjectInformation.xnb</samp>.
  −
 
  −
==Sprites==
  −
The item IDs in <samp>Content\Data\ObjectInformation.xnb</samp> correspond to the sprites in the <samp>Content\Maps\springobjects.xnb</samp> spritesheet. The sprites are numbered from the top left starting with zero. see [[Modding:Object data/Sprites]] for a table of sprites and their corresponding item IDs.
  −
 
  −
The spritesheet and data both have items that can't normally be found in the player inventory (like twigs and lumber), and some sprites have no corresponding item data. There are also multiple entries for ''weeds'' and ''stone'' corresponding to different sprites, but the player can only normally obtain one ''stone'' item (index 390) and no ''weeds'' items.
      
==Categories==
 
==Categories==
translators
8,445

edits

Navigation menu