Changes

→‎Data format: add info from Modding:Migrate to Stardew Valley 1.6 (main author Pathoschild, with formatting fixes by Margotbean)
Line 792: Line 792:     
===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>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 → model lookup, where...
<syntaxhighlight lang="json">
+
* The key is the unqualified [[#Custom items|item ID]].
"201": {
+
* The value is a model with the fields listed below.
  "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>
  −
 
  −
For each entry in the data asset:
  −
* 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.
  −
 
  −
Field values are described below (Copied from [[Modding:Migrate to Stardew Valley 1.6]]):
      
====Basic info====
 
====Basic info====
Line 862: Line 809:  
|-
 
|-
 
| <samp>Type</samp>
 
| <samp>Type</samp>
| 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
+
| The item's general type, like <samp>Arch</samp> (artifact) or <samp>Minerals</samp>. See details at [[Modding:Items#Objects]].
 
|-
 
|-
 
| <samp>Category</samp>
 
| <samp>Category</samp>
Line 963: Line 910:  
|}
 
|}
    +
====Geodes & artifact spots====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>GeodeDrops</samp><br /><samp><samp>GeodeDropsDefaultItems</samp>
 +
| ''(Optional)'' The items that can be dropped when breaking open this item as a [[Minerals#Geodes|geode]]. Specifying either or both fields automatically enables geode behavior for this item.
 +
 +
You can specify one or both fields:
 +
<ul>
 +
<li><samp>GeodeDrops</samp> can be set to the specific items to drop. Default none. This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
|-
 +
| ''common fields''
 +
| See [[Modding:Item queries#Item spawn fields|item spawn fields]] for the generic item fields supported by geode drops.
 +
 +
If set to an [[Modding:Item queries|item query]] which returns multiple items, one of them will be selected at random.
 +
|-
 +
| <samp>Chance</samp>
 +
| ''(Optional)'' The probability that the item will be dropped if the other fields match, as a decimal value between 0 (never) and 1 (always). Default 1.
 +
|-
 +
| <samp>SetFlagOnPickup</samp>
 +
| ''(Optional)'' The mail flag to set for the current player when this drop is picked up.
 +
|-
 +
| <samp>Precedence</samp>
 +
| ''(Optional)'' The order in which this entry should be checked, where lower values are checked first. This can be a negative value. Geode drops with the same precedence are checked in the order listed. Default 0.
 +
 +
For consistency, vanilla drops mostly use these values:
 +
* <samp>-1000</samp>: special overrides like the [[Golden Helmet]];
 +
* <samp>0</samp>: normal items.
 +
|}</li>
 +
<li><samp>GeodeDropsDefaultItems</samp> chooses a predefined list of possible geode drops like [[clay]], [[coal]], [[Copper Ore|copper]], [[Iridium Ore|iridium]], etc. Default false.</li>
 +
</ul>
 +
 +
If both fields are specified, each geode will choose between them with an equal 50% chance. If <samp>GeodeDrops</samp> is specified but no entries match, the geode will use the <samp>GeodeDropsDefaultItems</samp> regardless of whether it's true.
 +
|-
 +
| <samp>ArtifactSpotChances</samp>
 +
| ''(Optional)'' If this is an artifact (i.e. the <samp>Type</samp> field is <samp>Arch</samp>), the chance that it can be found by digging [[Artifact Spot|artifact spots]] in each location.
 +
 +
This consists of a string → model lookup, where:
 +
* the key is the internal location name;
 +
* the value is the probability the item will spawn if checked, as a decimal value between 0 (never) and 1 (always).
 +
|}
 +
 +
====Context tags & exclusions====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>ContextTags</samp>
 +
| ''(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": [ "color_yellow", "fish_ocean", "fish_upright", "season_summer" ]
 +
</syntaxhighlight>
 +
|-
 +
| <samp>ExcludeFromRandomSale</samp>
 +
| ''(Optional)'' Whether to exclude this item from shops when selecting random items to sell. Default false.
 +
|-
 +
| <samp>ExcludeFromFishingCollection</samp><br /><samp>ExcludeFromShippingCollection</samp>
 +
| ''(Optional)'' Whether to exclude this item from the fishing/shipping collection and their respective effect on the [[perfection|perfection score]]. Default false, in which case the normal requirements apply (e.g. artifacts are always excluded from the shipping collection).
 +
|}
 +
 +
====Advanced====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>CustomFields</samp>
 +
| ''(Optional)'' The [[#Custom data fields|custom fields]] for this entry.
 +
|}
    
===Notes===
 
===Notes===
138

edits