Ejemplo n.º 1
0
        public Crop(int seedIndex, int tileX, int tileY)
        {
            Dictionary <int, string> dictionary = Game1.content.Load <Dictionary <int, string> >("Data\\Crops");

            if (seedIndex == 770)
            {
                seedIndex = Crop.getRandomLowGradeCropForThisSeason(Game1.currentSeason);
                if (seedIndex == 473)
                {
                    seedIndex--;
                }
            }
            if (dictionary.ContainsKey(seedIndex))
            {
                string[] array = dictionary[seedIndex].Split(new char[]
                {
                    '/'
                });
                string[] array2 = array[0].Split(new char[]
                {
                    ' '
                });
                for (int i = 0; i < array2.Length; i++)
                {
                    this.phaseDays.Add(Convert.ToInt32(array2[i]));
                }
                this.phaseDays.Add(99999);
                string[] array3 = array[1].Split(new char[]
                {
                    ' '
                });
                for (int j = 0; j < array3.Length; j++)
                {
                    this.seasonsToGrowIn.Add(array3[j]);
                }
                this.rowInSpriteSheet   = Convert.ToInt32(array[2]);
                this.indexOfHarvest     = Convert.ToInt32(array[3]);
                this.regrowAfterHarvest = Convert.ToInt32(array[4]);
                this.harvestMethod      = Convert.ToInt32(array[5]);
                string[] array4 = array[6].Split(new char[]
                {
                    ' '
                });
                if (array4.Length != 0 && array4[0].Equals("true"))
                {
                    this.minHarvest = Convert.ToInt32(array4[1]);
                    this.maxHarvest = Convert.ToInt32(array4[2]);
                    this.maxHarvestIncreasePerFarmingLevel = Convert.ToInt32(array4[3]);
                    this.chanceForExtraCrops = Convert.ToDouble(array4[4]);
                }
                this.raisedSeeds = Convert.ToBoolean(array[7]);
                string[] array5 = array[8].Split(new char[]
                {
                    ' '
                });
                if (array5.Length != 0 && array5[0].Equals("true"))
                {
                    List <Color> list = new List <Color>();
                    for (int k = 1; k < array5.Length; k += 3)
                    {
                        list.Add(new Color((int)Convert.ToByte(array5[k]), (int)Convert.ToByte(array5[k + 1]), (int)Convert.ToByte(array5[k + 2])));
                    }
                    Random random = new Random(tileX * 1000 + tileY + Game1.dayOfMonth);
                    this.tintColor      = list[random.Next(list.Count)];
                    this.programColored = true;
                }
                this.flip = (Game1.random.NextDouble() < 0.5);
            }
            if (this.rowInSpriteSheet == 23)
            {
                this.whichForageCrop = seedIndex;
            }
        }
Ejemplo n.º 2
0
        public Crop(int seedIndex, int tileX, int tileY)
        {
            Dictionary <int, string> dictionary = Game1.content.Load <Dictionary <int, string> >("Data\\Crops");

            if (seedIndex == 770)
            {
                seedIndex = Crop.getRandomLowGradeCropForThisSeason(Game1.currentSeason);
                if (seedIndex == 473)
                {
                    --seedIndex;
                }
            }
            if (dictionary.ContainsKey(seedIndex))
            {
                string[] strArray1 = dictionary[seedIndex].Split('/');
                string   str1      = strArray1[0];
                char[]   chArray1  = new char[1] {
                    ' '
                };
                foreach (string str2 in str1.Split(chArray1))
                {
                    this.phaseDays.Add(Convert.ToInt32(str2));
                }
                this.phaseDays.Add(99999);
                string str3     = strArray1[1];
                char[] chArray2 = new char[1] {
                    ' '
                };
                foreach (string str2 in str3.Split(chArray2))
                {
                    this.seasonsToGrowIn.Add(str2);
                }
                this.rowInSpriteSheet   = Convert.ToInt32(strArray1[2]);
                this.indexOfHarvest     = Convert.ToInt32(strArray1[3]);
                this.regrowAfterHarvest = Convert.ToInt32(strArray1[4]);
                this.harvestMethod      = Convert.ToInt32(strArray1[5]);
                string[] strArray2 = strArray1[6].Split(' ');
                if (strArray2.Length != 0 && strArray2[0].Equals("true"))
                {
                    this.minHarvest = Convert.ToInt32(strArray2[1]);
                    this.maxHarvest = Convert.ToInt32(strArray2[2]);
                    this.maxHarvestIncreasePerFarmingLevel = Convert.ToInt32(strArray2[3]);
                    this.chanceForExtraCrops = Convert.ToDouble(strArray2[4]);
                }
                this.raisedSeeds = Convert.ToBoolean(strArray1[7]);
                string[] strArray3 = strArray1[8].Split(' ');
                if (strArray3.Length != 0 && strArray3[0].Equals("true"))
                {
                    List <Color> colorList = new List <Color>();
                    int          index     = 1;
                    while (index < strArray3.Length)
                    {
                        colorList.Add(new Color((int)Convert.ToByte(strArray3[index]), (int)Convert.ToByte(strArray3[index + 1]), (int)Convert.ToByte(strArray3[index + 2])));
                        index += 3;
                    }
                    Random random = new Random(tileX * 1000 + tileY + Game1.dayOfMonth);
                    this.tintColor      = colorList[random.Next(colorList.Count)];
                    this.programColored = true;
                }
                this.flip = Game1.random.NextDouble() < 0.5;
            }
            if (this.rowInSpriteSheet != 23)
            {
                return;
            }
            this.whichForageCrop = seedIndex;
        }
Ejemplo n.º 3
0
        // Token: 0x06000305 RID: 773 RVA: 0x0003CA08 File Offset: 0x0003AC08
        public Crop(int seedIndex, int tileX, int tileY)
        {
            Dictionary <int, string> cropData = Game1.content.Load <Dictionary <int, string> >("Data\\Crops");

            if (seedIndex == 770)
            {
                seedIndex = Crop.getRandomLowGradeCropForThisSeason(Game1.currentSeason);
                if (seedIndex == 473)
                {
                    seedIndex--;
                }
            }
            if (cropData.ContainsKey(seedIndex))
            {
                string[] split = cropData[seedIndex].Split(new char[]
                {
                    '/'
                });
                string[] phaseSplit = split[0].Split(new char[]
                {
                    ' '
                });
                for (int i = 0; i < phaseSplit.Length; i++)
                {
                    this.phaseDays.Add(Convert.ToInt32(phaseSplit[i]));
                }
                this.phaseDays.Add(99999);
                string[] seasonSplit = split[1].Split(new char[]
                {
                    ' '
                });
                for (int j = 0; j < seasonSplit.Length; j++)
                {
                    this.seasonsToGrowIn.Add(seasonSplit[j]);
                }
                this.rowInSpriteSheet   = Convert.ToInt32(split[2]);
                this.indexOfHarvest     = Convert.ToInt32(split[3]);
                this.regrowAfterHarvest = Convert.ToInt32(split[4]);
                this.harvestMethod      = Convert.ToInt32(split[5]);
                string[] cropYieldSplit = split[6].Split(new char[]
                {
                    ' '
                });
                if (cropYieldSplit.Length != 0 && cropYieldSplit[0].Equals("true"))
                {
                    this.minHarvest = Convert.ToInt32(cropYieldSplit[1]);
                    this.maxHarvest = Convert.ToInt32(cropYieldSplit[2]);
                    this.maxHarvestIncreasePerFarmingLevel = Convert.ToInt32(cropYieldSplit[3]);
                    this.chanceForExtraCrops = Convert.ToDouble(cropYieldSplit[4]);
                }
                this.raisedSeeds = Convert.ToBoolean(split[7]);
                string[] programColors = split[8].Split(new char[]
                {
                    ' '
                });
                if (programColors.Length != 0 && programColors[0].Equals("true"))
                {
                    List <Color> colors = new List <Color>();
                    for (int k = 1; k < programColors.Length; k += 3)
                    {
                        colors.Add(new Color((int)Convert.ToByte(programColors[k]), (int)Convert.ToByte(programColors[k + 1]), (int)Convert.ToByte(programColors[k + 2])));
                    }
                    Random r = new Random(tileX * 1000 + tileY + Game1.dayOfMonth);
                    this.tintColor      = colors[r.Next(colors.Count)];
                    this.programColored = true;
                }
                this.flip = (Game1.random.NextDouble() < 0.5);
            }
            if (this.rowInSpriteSheet == 23)
            {
                this.whichForageCrop = seedIndex;
            }
        }