private void on_post(object sender, EventArgs e) { if (terrain != null) { StardewValley.Crop crop = terrain.crop; if (crop != null) { String cropName = Game1.objectInformation[crop.indexOfHarvest].Split('/')[0]; drawHoverTextBox(Game1.smallFont, $"These {cropName}(s) will be ready in {crop.dayOfCurrentPhase} day(s)"); } } }
public static StardewValley.Object changeObjectQuality(StardewValley.Crop crop, StardewValley.Object obj) { if (Game1.player.basicShipped.ContainsKey(obj.ParentSheetIndex)) { float total = Game1.player.basicShipped[obj.parentSheetIndex]; if (config.increaseShipmentsByAverageYield && (crop.minHarvest > 1 || crop.maxHarvest > 1)) { total = total / ((crop.maxHarvest + crop.minHarvest) / 2f); } if (config.silverStarShipments >= 0) { if (total >= config.silverStarShipments && obj.Quality < 1) { obj.Quality = 1; } } if (config.goldStarShipments >= 0) { if (total >= config.goldStarShipments && obj.Quality < 2) { obj.Quality = 2; } } if (config.iridiumStarShipments >= 0) { if (total >= config.iridiumStarShipments && obj.Quality < 3) { obj.Quality = 4; } } if (config.shouldApplyPriceIncreases && total > config.priceIncreaseShipments && config.priceIncreasePerLog > 0) { obj.Price = (int)Math.Round(obj.Price * (1f + (Math.Log((total * 1f - config.priceIncreaseShipments) / config.priceIncreaseShipments) * config.priceIncreasePerLog))); } } return(obj); }
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; } }
// 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; } }
private void on_post_render_event(object sender, EventArgsMouseStateChanged e) { if (Game1.activeClickableMenu != null) { terrain = null; return; } if (terrain != null && ButtonState.Pressed.Equals(e.PriorState.RightButton) && ButtonState.Released.Equals(e.NewState.RightButton)) { this.Monitor.Log("removed terrain"); terrain = null; } Vector2 vector2 = (double)Game1.mouseCursorTransparency == 0.0 ? Game1.player.GetToolLocation(false) : new Vector2((float)(Game1.getOldMouseX() + Game1.viewport.X), (float)(Game1.getOldMouseY() + Game1.viewport.Y)); if (Game1.currentLocation != null) { Vector2 index = new Vector2((float)((Game1.getOldMouseX() + Game1.viewport.X) / Game1.tileSize), (float)((Game1.getOldMouseY() + Game1.viewport.Y) / Game1.tileSize)); SerializableDictionary <Vector2, StardewValley.TerrainFeatures.TerrainFeature> terrainMap = Game1.currentLocation.terrainFeatures; if (terrainMap != null && terrainMap.ContainsKey(index)) { if (terrainMap[index] is StardewValley.TerrainFeatures.HoeDirt && (terrain == null || terrain != terrainMap[index])) { terrain = (terrainMap[index] as StardewValley.TerrainFeatures.HoeDirt); StardewValley.Crop crop = terrain.crop; if (crop != null) { String cropName = Game1.objectInformation[crop.indexOfHarvest].Split('/')[0]; bool isCropHarvestable = crop.currentPhase >= crop.phaseDays.Count - 1 && (!crop.fullyGrown || crop.dayOfCurrentPhase <= 0); String cropInformation = $"\nCrop Information: \n\tname: {cropName}\n\tisHarvestable: {isCropHarvestable}"; foreach (System.Reflection.FieldInfo field in crop.GetType().GetFields()) { cropInformation += $"\n\t{field.Name}: "; if (field.GetValue(crop) is System.Collections.Generic.List <String> ) { System.Collections.Generic.List <String> asd = field.GetValue(crop) as System.Collections.Generic.List <String>; cropInformation += String.Join(", ", asd.ToArray()); } else if (field.GetValue(crop) is System.Collections.Generic.List <Int32> ) { System.Collections.Generic.List <Int32> asd = field.GetValue(crop) as System.Collections.Generic.List <Int32>; cropInformation += String.Join(", ", asd.ToArray()); } else { cropInformation += $"{field.GetValue(crop).ToString()}"; } } this.Monitor.Log(cropInformation); } } else if (!(terrainMap[index] is StardewValley.TerrainFeatures.HoeDirt)) { terrain = null; } } } }