Modding:Crops data

From Stardew Valley Wiki
Jump to: navigation, search

Index

This page explains how the game stores and parses crops data. This is an advanced guide for mod developers.

Raw data

Crops data is stored in Content\Data\Crops.xnb, which can be unpacked using XNB Extract. Here's the raw data (as of v1.2) for reference:

299: "1 2 2 2/fall/39/300/-1/1/false/false/false" #!String
301: "1 1 2 3 3/fall/38/398/3/0/true 1 2 6 0/true/false" #!String
302: "1 1 2 3 4/summer/37/304/1/0/true 1 2 6 0/true/false" #!String
347: "2 4 6 6 6/fall/32/417/-1/0/false/false/false" #!String
425: "1 4 4 3/fall/31/595/-1/0/false/false/true 187 0 255 119 137 255 71 227 255 255 127 144 205 178 255 140 119 255" #!String
427: "1 1 2 2/spring/26/591/-1/0/false/false/true 255 186 255 223 191 255 255 246 0 255 80 0 255 158 193" #!String
429: "1 2 2 2/spring/27/597/-1/0/false/false/true 35 127 255 109 131 255 112 207 255 191 228 255 94 121 255 40 150 255" #!String
431: "1 2 3 2/summer fall/30/421/-1/0/false/false/false" #!String
433: "1 2 2 3 2/spring summer/40/433/2/0/true 4 6 10 .02/false/false" #!String
453: "1 2 2 2/summer/28/376/-1/0/false/false/true 255 0 0 254 254 254 255 170 0" #!String
455: "1 2 3 2/summer/29/593/-1/0/false/false/true 0 208 255 99 255 210 255 212 0 255 144 122 255 0 238 206 91 255" #!String
472: "1 1 1 1/spring/0/24/-1/0/false/false/false" #!String
473: "1 1 1 3 4/spring/1/188/3/0/true 1 2 6 0/true/false" #!String
474: "1 2 4 4 1/spring/2/190/-1/0/false/false/false" #!String
475: "1 1 1 2 1/spring/3/192/-1/0/true 1 2 8 .2/false/false" #!String
476: "1 1 1 1/spring/4/248/-1/0/false/false/false" #!String
477: "1 2 2 1/spring/5/250/-1/1/false/false/false" #!String
478: "2 2 2 3 4/spring/6/252/-1/0/false/false/false" #!String
479: "1 2 3 3 3/summer/7/254/-1/0/false/false/false" #!String
480: "2 2 2 2 3/summer/8/256/4/0/true 1 1 6 .05/false/false" #!String
481: "1 3 3 4 2/summer/9/258/4/0/true 3 5 5 .02/false/false" #!String
482: "1 1 1 1 1/summer/10/260/3/0/true 1 1 5 .03/false/false" #!String
483: "1 1 1 1/summer fall/11/262/-1/1/false/false/false" #!String
484: "2 1 2 1/summer/12/264/-1/0/false/false/false" #!String
485: "2 1 2 2 2/summer/13/266/-1/0/false/false/false" #!String
486: "2 3 2 3 3/summer/14/268/-1/0/false/false/false" #!String
487: "2 3 3 3 3/summer fall/15/270/4/0/true 1 2 5 0/false/false" #!String
488: "1 1 1 1 1/fall/16/272/5/0/true 1 2 10 .002/false/false" #!String
489: "2 2 1 2 1/fall/17/274/-1/0/false/false/false" #!String
490: "1 2 3 4 3/fall/18/276/-1/0/false/false/false" #!String
491: "1 1 1 1/fall/19/278/-1/0/false/false/false" #!String
492: "1 3 3 3/fall/20/280/-1/0/false/false/false" #!String
493: "1 2 1 1 2/fall/21/282/5/0/true 2 6 5 .1/false/false" #!String
494: "1 1 2 2/fall/22/284/-1/0/false/false/false" #!String
495: "3 4/spring/23/16/-1/0/false/false/false" #!String
496: "3 4/summer/23/396/-1/0/false/false/false" #!String
497: "3 4/fall/23/404/-1/0/false/false/false" #!String
498: "3 4/winter/23/412/-1/0/false/false/false" #!String
499: "2 7 7 7 5/spring summer fall/24/454/7/0/false/false/false" #!String
745: "1 1 2 2 2/spring/36/400/4/0/true 1 1 5 .02/false/false" #!String

Format

Index Field Example Value
Key Seed Index (from ObjectInformation.xnb) 473 (Bean Starter) 455 (Spangle Seeds)
0 Days in each stage of growth 1 1 1 3 4 1 2 3 2
1 Growth Season(s) spring summer
2 Row in Sprite Sheet (Content\TileSheets\Crops.xnb) 1 29
3 Index of Harvest (from ObjectInformation.xnb) 188 (Green Bean) 593 (Summer Spangle)
4 Regrow after Harvest 3 -1
5 Harvest Method 0 0
6 Chance for Extra Harvest true 1 2 6 0 false
7 Raised Seeds true false
8 Tint Color false true 0 208 255 99 255 210 255 212 0 255 144 122 255 0 238 206 91 255

Regrow after Harvest

Either -1 for no regrowth, or number of days until regrowth.

Harvest Method

1 for Scythe, 0 for all others

Chance for Extra Harvest

If this value is true, then the numbers that follow are parsed as:

  1. minHarvest
  2. maxHarvest
  3. maxHarvestIncreasePerFarmingLevel
  4. chanceForExtraCrops

The game determines the number of crops gained at a single harvest using the following code from Crops.cs::harvest(), where num is the number of crops gained:

if (this.minHarvest > 1 || this.maxHarvest > 1)
    num = random.Next(this.minHarvest, Math.Min(this.minHarvest + 1, this.maxHarvest + 1 + Game1.player.FarmingLevel / this.maxHarvestIncreasePerFarmingLevel));

if (this.chanceForExtraCrops > 0.0)
    while (random.NextDouble() < Math.Min(0.9, this.chanceForExtraCrops))
        num++;

if (random.NextDouble() < (double)Game1.dailyLuck / 1200.0 + 9.9999997473787516E-05)
    num *= 2;

The result (i.e., num) of random.Next(this.minHarvest, Math.Min(this.minHarvest + 1, this.maxHarvest + 1 + Game1.player.FarmingLevel / this.maxHarvestIncreasePerFarmingLevel)) is always the minHarvest, for 2 reasons.

  1. Taking the Math.Min of (minHarvest + 1) and (this.maxHarvest + 1 + Game1.player.FarmingLevel / this.maxHarvestIncreasePerFarmingLevel) always results in (minHarvest + 1)
  2. random.Next uses an inclusive lower bound and an exclusive upper bound, so it is effectively calculating a random number between minHarvest and minHarvest

Therefore, as of v1.2, only 3 seeds always give more than one crop per harvest, and that number is equal to the minHarvest:

  • Coffee Bean (433) -- 4 Beans
  • Blueberry Seeds (481) -- 3 Blueberries
  • Cranberry Seeds (493) -- 2 Cranberries

The value in chanceForExtraCrops may add additional crops to a harvest, calculated independently of the other 3 variables. For example, each harvest of a Potato Seed (475) has ≈20% chance of yielding an extra potato, in addition to the one Potato given as standard harvest. Each harvest of a Blueberry Seed (481) has ≈2% chance of yielding an extra Blueberry, in addition to the 3 Blueberries given as standard harvest.

Raised Seeds

True for trellis crops (Grapes, Hops, Green Beans), false for all others.

Tint Color

If Tint Color is true, a string of rgb() values follows. In the example above, Summer Spangle can be one of 6 different colors:

  • rgb(0, 208, 255)
  • rgb(99, 255, 210)
  • rgb(255, 212, 0)
  • rgb(255, 144, 122)
  • rgb(255, 0, 238)
  • rgb(206, 91, 255)