/// <summary> /// Pulled from the decompiled Stardew Valley code, *slightly* reworked for readability. /// Added quality adjustment, and regrowth chances. /// </summary> /// <param name="xTile"></param> /// <param name="yTile"></param> /// <param name="soil"></param> /// <param name="junimoHarvester"></param> /// <returns></returns> public bool HarvestReplacement(int xTile, int yTile, HoeDirt soil, JunimoHarvester junimoHarvester = null) { var seedIndex = 0; if (CropRegrowthFactor.RegrowthChance > 0) { seedIndex = GetSeedOfCrop(); } if (dead) { if (!CropRegrowthFactor.GetDeadCropRegrowthSuccess()) { return(junimoHarvester != null); } if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(new Object(seedIndex, 1)); } else { Game1.createObjectDebris(seedIndex, xTile, yTile); } return(junimoHarvester != null); } if (forageCrop) { Object forageCropObject = null; const int foragingExperience = 3; if (whichForageCrop == 1) { forageCropObject = new Object(399, 1); } if (Game1.player.professions.Contains(16)) { if (forageCropObject != null) { forageCropObject.quality = 4; } } else if (Game1.random.NextDouble() < Game1.player.ForagingLevel / 30.0) { if (forageCropObject != null) { forageCropObject.quality = 2; } } else if (Game1.random.NextDouble() < Game1.player.ForagingLevel / 15.0) { if (forageCropObject != null) { forageCropObject.quality = 1; } } if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(forageCropObject); return(true); } if (Game1.player.addItemToInventoryBool(forageCropObject)) { var vector2 = new Vector2(xTile, yTile); Game1.player.animateOnce(279 + Game1.player.facingDirection); Game1.player.canMove = false; Game1.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); if (regrowAfterHarvest == -1) { Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(17, new Vector2(vector2.X * Game1.tileSize, vector2.Y * Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f)); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(14, new Vector2(vector2.X * Game1.tileSize, vector2.Y * Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f)); } Game1.player.gainExperience(2, foragingExperience); return(true); } Game1.showRedMessage("Inventory Full"); } else if (currentPhase >= phaseDays.Count - 1 && (!fullyGrown || dayOfCurrentPhase <= 0)) { var numberOfCropsProduced = 1; var quality = 0; var fertilizerQualityBonus = 0; if (indexOfHarvest == 0) { return(true); } var random = new Random(xTile * 7 + yTile * 11 + (int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame); switch (soil.fertilizer) { case 368: fertilizerQualityBonus = 1; break; case 369: fertilizerQualityBonus = 2; break; } var qualityFactor = 0.2 * (Game1.player.FarmingLevel / 10f) + 0.2 * fertilizerQualityBonus * ((Game1.player.FarmingLevel + 2) / 12.0) + 0.01; var minumumQualityFactor = Math.Min(0.75, qualityFactor * 2.0); if (random.NextDouble() < qualityFactor) { quality = 2; } else if (random.NextDouble() < minumumQualityFactor) { quality = 1; } if (minHarvest > 1 || maxHarvest > 1) { numberOfCropsProduced = random.Next(minHarvest, Math.Min(minHarvest + 1, maxHarvest + 1 + Game1.player.FarmingLevel / maxHarvestIncreasePerFarmingLevel)); } if (chanceForExtraCrops > 0.0) { while (random.NextDouble() < Math.Min(0.9, chanceForExtraCrops)) { ++numberOfCropsProduced; } } quality += CropQualityFactor.GetCropQualityIncrease(); if (harvestMethod == 1) { if (junimoHarvester == null) { DelayedAction.playSoundAfterDelay("daggerswipe", 150); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); } for (var index = 0; index < numberOfCropsProduced; ++index) { if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(new Object(indexOfHarvest, 1, false, -1, quality)); } else { Game1.createObjectDebris(indexOfHarvest, xTile, yTile, -1, quality); } } if (CropRegrowthFactor.GetCropRegrowthSuccess()) { if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(new Object(seedIndex, 1)); } else { Game1.createObjectDebris(seedIndex, xTile, yTile); } } if (regrowAfterHarvest == -1) { return(true); } dayOfCurrentPhase = regrowAfterHarvest; fullyGrown = true; } else { if (junimoHarvester == null) { var player = Game1.player; var crop = !programColored ? new Object(indexOfHarvest, 1, false, -1, quality) : new ColoredObject(indexOfHarvest, 1, tintColor) { quality = quality }; if (!player.addItemToInventoryBool(crop)) { Game1.showRedMessage("Inventory Full"); return(false); } } var vector2 = new Vector2(xTile, yTile); if (junimoHarvester == null) { Game1.player.animateOnce(279 + Game1.player.facingDirection); Game1.player.canMove = false; } else { var junimoHarvester1 = junimoHarvester; var crop = !programColored ? new Object(indexOfHarvest, 1, false, -1, quality) : new ColoredObject(indexOfHarvest, 1, tintColor) { quality = quality }; junimoHarvester1.tryToAddItemToHut(crop); } if (random.NextDouble() < Game1.player.LuckLevel / 1500.0 + Game1.dailyLuck / 1200.0 + 10f) { numberOfCropsProduced *= 2; if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("dwoop"); } } else if (harvestMethod == 0) { if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); } if (regrowAfterHarvest == -1 && (junimoHarvester == null || junimoHarvester.currentLocation.Equals(Game1.currentLocation))) { Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(17, new Vector2(vector2.X * Game1.tileSize, vector2.Y * Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f)); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(14, new Vector2(vector2.X * Game1.tileSize, vector2.Y * Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f)); } } if (indexOfHarvest == 421) { indexOfHarvest = 431; numberOfCropsProduced = random.Next(1, 4); } for (var index = 0; index < numberOfCropsProduced - 1; ++index) { if (junimoHarvester == null) { Game1.createObjectDebris(indexOfHarvest, xTile, yTile); } else { junimoHarvester.tryToAddItemToHut(new Object(indexOfHarvest, 1)); } } var farmingExperienceGain = (float)(16.0 * Math.Log(0.018 * Convert.ToInt32(Game1.objectInformation[indexOfHarvest].Split('/')[1]) + 1.0, Math.E)); if (junimoHarvester == null) { Game1.player.gainExperience(0, (int)Math.Round(farmingExperienceGain)); } if (regrowAfterHarvest == -1) { return(true); } dayOfCurrentPhase = regrowAfterHarvest; fullyGrown = true; } } return(false); }
public bool harvest(int xTile, int yTile, HoeDirt soil, JunimoHarvester junimoHarvester = null) { if ((bool)dead) { if (junimoHarvester != null) { return(true); } return(false); } bool success = false; if ((bool)forageCrop) { Object o = null; int experience2 = 3; Random r2 = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 2 + xTile * 1000 + yTile * 2000); switch ((int)whichForageCrop) { case 1: o = new Object(399, 1); break; case 2: soil.shake((float)Math.PI / 48f, (float)Math.PI / 40f, (float)(xTile * 64) < Game1.player.Position.X); return(false); } if (Game1.player.professions.Contains(16)) { o.Quality = 4; } else if (r2.NextDouble() < (double)((float)Game1.player.ForagingLevel / 30f)) { o.Quality = 2; } else if (r2.NextDouble() < (double)((float)Game1.player.ForagingLevel / 15f)) { o.Quality = 1; } Game1.stats.ItemsForaged += (uint)o.Stack; if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(o); return(true); } if (Game1.player.addItemToInventoryBool(o)) { Vector2 initialTile2 = new Vector2(xTile, yTile); Game1.player.animateOnce(279 + Game1.player.FacingDirection); Game1.player.canMove = false; Game1.player.currentLocation.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); if ((int)regrowAfterHarvest == -1) { Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(17, new Vector2(initialTile2.X * 64f, initialTile2.Y * 64f), Color.White, 7, r2.NextDouble() < 0.5, 125f)); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(14, new Vector2(initialTile2.X * 64f, initialTile2.Y * 64f), Color.White, 7, r2.NextDouble() < 0.5, 50f)); } Game1.player.gainExperience(2, experience2); return(true); } Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Crop.cs.588")); } else if ((int)currentPhase >= phaseDays.Count - 1 && (!fullyGrown || (int)dayOfCurrentPhase <= 0)) { int numToHarvest = 1; int cropQuality = 0; int fertilizerQualityLevel = 0; if ((int)indexOfHarvest == 0) { return(true); } Random r = new Random(xTile * 7 + yTile * 11 + (int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame); switch ((int)soil.fertilizer) { case 368: fertilizerQualityLevel = 1; break; case 369: fertilizerQualityLevel = 2; break; case 919: fertilizerQualityLevel = 3; break; } double chanceForGoldQuality = 0.2 * ((double)Game1.player.FarmingLevel / 10.0) + 0.2 * (double)fertilizerQualityLevel * (((double)Game1.player.FarmingLevel + 2.0) / 12.0) + 0.01; double chanceForSilverQuality = Math.Min(0.75, chanceForGoldQuality * 2.0); if (fertilizerQualityLevel >= 3 && r.NextDouble() < chanceForGoldQuality / 2.0) { cropQuality = 4; } else if (r.NextDouble() < chanceForGoldQuality) { cropQuality = 2; } else if (r.NextDouble() < chanceForSilverQuality || fertilizerQualityLevel >= 3) { cropQuality = 1; } if ((int)minHarvest > 1 || (int)maxHarvest > 1) { int max_harvest_increase = 0; if (maxHarvestIncreasePerFarmingLevel.Value > 0) { max_harvest_increase = Game1.player.FarmingLevel / (int)maxHarvestIncreasePerFarmingLevel; } numToHarvest = r.Next(minHarvest, Math.Max((int)minHarvest + 1, (int)maxHarvest + 1 + max_harvest_increase)); } if ((double)chanceForExtraCrops > 0.0) { while (r.NextDouble() < Math.Min(0.9, chanceForExtraCrops)) { numToHarvest++; } } if ((int)indexOfHarvest == 771 || (int)indexOfHarvest == 889) { cropQuality = 0; } Object harvestedItem = (programColored ? new ColoredObject(indexOfHarvest, 1, tintColor) { Quality = cropQuality } : new Object(indexOfHarvest, 1, isRecipe: false, -1, cropQuality)); if ((int)harvestMethod == 1) { if (junimoHarvester != null) { DelayedAction.playSoundAfterDelay("daggerswipe", 150, junimoHarvester.currentLocation); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { junimoHarvester.currentLocation.playSound("harvest"); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260, junimoHarvester.currentLocation); } if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(harvestedItem.getOne()); } else { Game1.createItemDebris(harvestedItem.getOne(), new Vector2(xTile * 64 + 32, yTile * 64 + 32), -1); } success = true; } else if (junimoHarvester != null || Game1.player.addItemToInventoryBool(harvestedItem.getOne())) { Vector2 initialTile = new Vector2(xTile, yTile); if (junimoHarvester == null) { Game1.player.animateOnce(279 + Game1.player.FacingDirection); Game1.player.canMove = false; } else { junimoHarvester.tryToAddItemToHut(harvestedItem.getOne()); } if (r.NextDouble() < Game1.player.team.AverageLuckLevel() / 1500.0 + Game1.player.team.AverageDailyLuck() / 1200.0 + 9.9999997473787516E-05) { numToHarvest *= 2; if (junimoHarvester == null) { Game1.player.currentLocation.playSound("dwoop"); } else if (Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { junimoHarvester.currentLocation.playSound("dwoop"); } } else if ((int)harvestMethod == 0) { if (junimoHarvester == null) { Game1.player.currentLocation.playSound("harvest"); } else if (Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { junimoHarvester.currentLocation.playSound("harvest"); } if (junimoHarvester == null) { DelayedAction.playSoundAfterDelay("coin", 260, Game1.player.currentLocation); } else if (Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260, junimoHarvester.currentLocation); } if ((int)regrowAfterHarvest == -1 && (junimoHarvester == null || junimoHarvester.currentLocation.Equals(Game1.currentLocation))) { Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(17, new Vector2(initialTile.X * 64f, initialTile.Y * 64f), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f)); Game1.multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(14, new Vector2(initialTile.X * 64f, initialTile.Y * 64f), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f)); } } success = true; } else { Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Crop.cs.588")); } if (success) { if ((int)indexOfHarvest == 421) { indexOfHarvest.Value = 431; numToHarvest = r.Next(1, 4); } int price = Convert.ToInt32(Game1.objectInformation[indexOfHarvest].Split('/')[1]); harvestedItem = (programColored ? new ColoredObject(indexOfHarvest, 1, tintColor) : new Object(indexOfHarvest, 1)); float experience = (float)(16.0 * Math.Log(0.018 * (double)price + 1.0, Math.E)); if (junimoHarvester == null) { Game1.player.gainExperience(0, (int)Math.Round(experience)); } for (int i = 0; i < numToHarvest - 1; i++) { if (junimoHarvester == null) { Game1.createItemDebris(harvestedItem.getOne(), new Vector2(xTile * 64 + 32, yTile * 64 + 32), -1); } else { junimoHarvester.tryToAddItemToHut(harvestedItem.getOne()); } } if ((int)indexOfHarvest == 262 && r.NextDouble() < 0.4) { Object hay_item = new Object(178, 1); if (junimoHarvester == null) { Game1.createItemDebris(hay_item.getOne(), new Vector2(xTile * 64 + 32, yTile * 64 + 32), -1); } else { junimoHarvester.tryToAddItemToHut(hay_item.getOne()); } } else if ((int)indexOfHarvest == 771) { Game1.player.currentLocation.playSound("cut"); if (r.NextDouble() < 0.1) { Object mixedSeeds_item = new Object(770, 1); if (junimoHarvester == null) { Game1.createItemDebris(mixedSeeds_item.getOne(), new Vector2(xTile * 64 + 32, yTile * 64 + 32), -1); } else { junimoHarvester.tryToAddItemToHut(mixedSeeds_item.getOne()); } } } if ((int)regrowAfterHarvest == -1) { return(true); } fullyGrown.Value = true; if (dayOfCurrentPhase.Value == (int)regrowAfterHarvest) { updateDrawMath(tilePosition); } dayOfCurrentPhase.Value = regrowAfterHarvest; } } return(false); }
public bool harvest(int xTile, int yTile, HoeDirt soil, JunimoHarvester junimoHarvester = null) { if (this.dead) { return(junimoHarvester != null); } if (this.forageCrop) { ModularCropObject @object = (ModularCropObject)null; int howMuch = 3; if (this.whichForageCrop == 1) { //@object = new ModularCropObject(399, 1, false, -1, 0); if (Game1.player.professions.Contains(16)) { @object.Quality = 4; } else if (Game1.random.NextDouble() < (double)Game1.player.ForagingLevel / 30.0) { @object.Quality = 2; } else if (Game1.random.NextDouble() < (double)Game1.player.ForagingLevel / 15.0) { @object.Quality = 1; } } Game1.stats.ItemsForaged += (uint)@object.Stack; if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut((Item)@object); return(true); } if (Game1.player.addItemToInventoryBool((Item)@object, false)) { Vector2 vector2 = new Vector2((float)xTile, (float)yTile); // Game1.player.animateOnce(279 + Game1.player.facingDirection); Game1.player.canMove = false; Game1.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); if (this.regrowAfterHarvest == -1) { Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(17, new Vector2(vector2.X * (float)Game1.tileSize, vector2.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f, 0, -1, -1f, -1, 0)); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(14, new Vector2(vector2.X * (float)Game1.tileSize, vector2.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0)); } Game1.player.gainExperience(2, howMuch); return(true); } Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Crop.cs.588")); } else if (this.currentPhase >= this.phaseDays.Count - 1 && (!this.fullyGrown || this.dayOfCurrentPhase <= 0)) { int num1 = 1; int num2 = 0; int num3 = 0; if (this.indexOfHarvest == 0) { return(true); } Random random = new Random(xTile * 7 + yTile * 11 + (int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame); switch (soil.fertilizer.Value) { case 368: num3 = 1; break; case 369: num3 = 2; break; } double num4 = 0.2 * ((double)Game1.player.FarmingLevel / 10.0) + 0.2 * (double)num3 * (((double)Game1.player.FarmingLevel + 2.0) / 12.0) + 0.01; double num5 = Math.Min(0.75, num4 * 2.0); if (random.NextDouble() < num4) { num2 = 2; } else if (random.NextDouble() < num5) { num2 = 1; } if (this.minHarvest > 1 || this.maxHarvest > 1) { num1 = 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)) { ++num1; } } if (this.harvestMethod == 1) { if (junimoHarvester == null) { DelayedAction.playSoundAfterDelay("daggerswipe", 150); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("harvest"); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260); } for (int index = 0; index < num1; ++index) { if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut((Item) new ModularCropObject(this.spriteSheet.getHelper(), this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData)); } else { AdditionalCropsFramework.Utilities.createObjectDebris((Item) new ModularCropObject(this.spriteSheet.getHelper(), this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData), xTile, yTile, xTile, yTile, -1, this.getQualityOfCrop(), 1); } //Game1.createObjectDebris(this.indexOfHarvest, xTile, yTile, -1, num2, 1f, (GameLocation)null); } if (this.regrowAfterHarvest == -1) { return(true); } this.dayOfCurrentPhase = this.regrowAfterHarvest; this.fullyGrown = true; } else { if (junimoHarvester == null) { Farmer player = Game1.player; ModularCropObject @object = new ModularCropObject(this.spriteSheet.getHelper(), this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData); int num7 = 0; if (!player.addItemToInventoryBool((Item)@object, num7 != 0)) { Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Crop.cs.588")); goto label_86; } } Vector2 vector2 = new Vector2((float)xTile, (float)yTile); if (junimoHarvester == null) { // Game1.player.animateOnce(279 + Game1.player.facingDirection); Game1.player.canMove = false; } else { JunimoHarvester junimoHarvester1 = junimoHarvester; ModularCropObject @object = new ModularCropObject(this.spriteSheet.getHelper(), this.indexOfHarvest, 1, this.cropObjectTexture, this.cropObjectData); junimoHarvester1.tryToAddItemToHut((Item)@object); } if (random.NextDouble() < (double)Game1.player.LuckLevel / 1500.0 + Game1.dailyLuck / 1200.0 + 9.99999974737875E-05) { num1 *= 2; if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("dwoop"); } } else if (this.harvestMethod == 0) { if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("harvest"); } if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260); } if (this.regrowAfterHarvest == -1 && (junimoHarvester == null || junimoHarvester.currentLocation.Equals((object)Game1.currentLocation))) { Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(17, new Vector2(vector2.X * (float)Game1.tileSize, vector2.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f, 0, -1, -1f, -1, 0)); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(14, new Vector2(vector2.X * (float)Game1.tileSize, vector2.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0)); } } if (this.indexOfHarvest == 421) { this.indexOfHarvest = 431; num1 = random.Next(1, 4); } for (int index = 0; index < num1 - 1; ++index) { if (junimoHarvester == null) { AdditionalCropsFramework.Utilities.createObjectDebris((Item) new ModularCropObject(this.spriteSheet.getHelper(), this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData), xTile, yTile, xTile, yTile, -1, this.getQualityOfCrop(), 1); } else { junimoHarvester.tryToAddItemToHut((Item) new ModularCropObject(this.spriteSheet.getHelper(), this.indexOfHarvest, this.getAmountForHarvest(), this.cropObjectTexture, this.cropObjectData)); } } float num8 = (float)(16.0 * Math.Log(0.018 * (double)Convert.ToInt32(this.experienceGainWhenHarvesting + 1.0), Math.E)); if (junimoHarvester == null) { Game1.player.gainExperience(0, (int)Math.Round((double)num8)); } if (this.regrowAfterHarvest == -1) { return(true); } this.dayOfCurrentPhase = this.regrowAfterHarvest; this.fullyGrown = true; } } label_86: return(false); }
public bool harvest(int xTile, int yTile, HoeDirt soil, JunimoHarvester junimoHarvester = null) { if (this.dead) { return(junimoHarvester != null); } if (this.forageCrop) { Object @object = null; int howMuch = 3; int fertilizer = this.whichForageCrop; if (fertilizer == 1) { @object = new Object(399, 1, false, -1, 0); } if (Game1.player.professions.Contains(16)) { @object.quality = 4; } else if (Game1.random.NextDouble() < (double)((float)Game1.player.ForagingLevel / 30f)) { @object.quality = 2; } else if (Game1.random.NextDouble() < (double)((float)Game1.player.ForagingLevel / 15f)) { @object.quality = 1; } Game1.stats.ItemsForaged += (uint)@object.Stack; if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(@object); return(true); } if (Game1.player.addItemToInventoryBool(@object, false)) { Vector2 vector = new Vector2((float)xTile, (float)yTile); Game1.player.animateOnce(279 + Game1.player.facingDirection); Game1.player.canMove = false; Game1.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); if (this.regrowAfterHarvest == -1) { Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(17, new Vector2(vector.X * (float)Game1.tileSize, vector.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f, 0, -1, -1f, -1, 0)); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(14, new Vector2(vector.X * (float)Game1.tileSize, vector.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0)); } Game1.player.gainExperience(2, howMuch); return(true); } Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Crop.cs.588", new object[0])); } else if (this.currentPhase >= this.phaseDays.Count - 1 && (!this.fullyGrown || this.dayOfCurrentPhase <= 0)) { int num = 1; int num2 = 0; int num3 = 0; if (this.indexOfHarvest == 0) { return(true); } Random random = new Random(xTile * 7 + yTile * 11 + (int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame); int fertilizer = soil.fertilizer; if (fertilizer != 368) { if (fertilizer == 369) { num3 = 2; } } else { num3 = 1; } double num4 = 0.2 * ((double)Game1.player.FarmingLevel / 10.0) + 0.2 * (double)num3 * (((double)Game1.player.FarmingLevel + 2.0) / 12.0) + 0.01; double num5 = Math.Min(0.75, num4 * 2.0); if (random.NextDouble() < num4) { num2 = 2; } else if (random.NextDouble() < num5) { num2 = 1; } 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 (this.harvestMethod == 1) { if (junimoHarvester == null) { DelayedAction.playSoundAfterDelay("daggerswipe", 150); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("harvest"); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260); } for (int i = 0; i < num; i++) { if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(new Object(this.indexOfHarvest, 1, false, -1, num2)); } else { Game1.createObjectDebris(this.indexOfHarvest, xTile, yTile, -1, num2, 1f, null); } } if (this.regrowAfterHarvest == -1) { return(true); } this.dayOfCurrentPhase = this.regrowAfterHarvest; this.fullyGrown = true; } else { if (junimoHarvester == null) { Farmer arg_4C0_0 = Game1.player; Object arg_4C0_1; if (!this.programColored) { arg_4C0_1 = new Object(this.indexOfHarvest, 1, false, -1, num2); } else { (arg_4C0_1 = new ColoredObject(this.indexOfHarvest, 1, this.tintColor)).quality = num2; } if (!arg_4C0_0.addItemToInventoryBool(arg_4C0_1, false)) { Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Crop.cs.588", new object[0])); return(false); } } Vector2 vector2 = new Vector2((float)xTile, (float)yTile); if (junimoHarvester == null) { Game1.player.animateOnce(279 + Game1.player.facingDirection); Game1.player.canMove = false; } else { Object arg_536_1; if (!this.programColored) { arg_536_1 = new Object(this.indexOfHarvest, 1, false, -1, num2); } else { (arg_536_1 = new ColoredObject(this.indexOfHarvest, 1, this.tintColor)).quality = num2; } junimoHarvester.tryToAddItemToHut(arg_536_1); } if (random.NextDouble() < (double)((float)Game1.player.LuckLevel / 1500f) + Game1.dailyLuck / 1200.0 + 9.9999997473787516E-05) { num *= 2; if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("dwoop"); } } else if (this.harvestMethod == 0) { if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("harvest"); } if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260); } if (this.regrowAfterHarvest == -1 && (junimoHarvester == null || junimoHarvester.currentLocation.Equals(Game1.currentLocation))) { Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(17, new Vector2(vector2.X * (float)Game1.tileSize, vector2.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f, 0, -1, -1f, -1, 0)); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(14, new Vector2(vector2.X * (float)Game1.tileSize, vector2.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0)); } } if (this.indexOfHarvest == 421) { this.indexOfHarvest = 431; num = random.Next(1, 4); } for (int j = 0; j < num - 1; j++) { if (junimoHarvester == null) { Game1.createObjectDebris(this.indexOfHarvest, xTile, yTile, -1, 0, 1f, null); } else { junimoHarvester.tryToAddItemToHut(new Object(this.indexOfHarvest, 1, false, -1, 0)); } } int num6 = Convert.ToInt32(Game1.objectInformation[this.indexOfHarvest].Split(new char[] { '/' })[1]); float num7 = (float)(16.0 * Math.Log(0.018 * (double)num6 + 1.0, 2.7182818284590451)); if (junimoHarvester == null) { Game1.player.gainExperience(0, (int)Math.Round((double)num7)); } if (this.regrowAfterHarvest == -1) { return(true); } this.dayOfCurrentPhase = this.regrowAfterHarvest; this.fullyGrown = true; } } return(false); }
// Token: 0x06000308 RID: 776 RVA: 0x0003CDAC File Offset: 0x0003AFAC public bool harvest(int xTile, int yTile, HoeDirt soil, JunimoHarvester junimoHarvester = null) { if (this.dead) { return(junimoHarvester != null); } if (this.forageCrop) { Object o = null; int experience = 3; int fertilizer = this.whichForageCrop; if (fertilizer == 1) { o = new Object(399, 1, false, -1, 0); } if (Game1.player.professions.Contains(16)) { o.quality = 4; } else if (Game1.random.NextDouble() < (double)((float)Game1.player.ForagingLevel / 30f)) { o.quality = 2; } else if (Game1.random.NextDouble() < (double)((float)Game1.player.ForagingLevel / 15f)) { o.quality = 1; } if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(o); return(true); } if (Game1.player.addItemToInventoryBool(o, false)) { Vector2 initialTile = new Vector2((float)xTile, (float)yTile); Game1.player.animateOnce(279 + Game1.player.facingDirection); Game1.player.canMove = false; Game1.playSound("harvest"); DelayedAction.playSoundAfterDelay("coin", 260); if (this.regrowAfterHarvest == -1) { Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(17, new Vector2(initialTile.X * (float)Game1.tileSize, initialTile.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f, 0, -1, -1f, -1, 0)); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(14, new Vector2(initialTile.X * (float)Game1.tileSize, initialTile.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0)); } Game1.player.gainExperience(2, experience); return(true); } Game1.showRedMessage("Inventory Full"); } else if (this.currentPhase >= this.phaseDays.Count - 1 && (!this.fullyGrown || this.dayOfCurrentPhase <= 0)) { int numToHarvest = 1; int cropQuality = 0; int fertilizerQualityLevel = 0; if (this.indexOfHarvest == 0) { return(true); } Random r = new Random(xTile * 7 + yTile * 11 + (int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame); int fertilizer = soil.fertilizer; if (fertilizer != 368) { if (fertilizer == 369) { fertilizerQualityLevel = 2; } } else { fertilizerQualityLevel = 1; } double chanceForGoldQuality = 0.2 * (double)(Game1.player.FarmingLevel / 10) + 0.2 * (double)fertilizerQualityLevel * (double)((float)(Game1.player.FarmingLevel + 2) / 12f) + 0.01; double chanceForSilverQuality = Math.Min(0.75, chanceForGoldQuality * 2.0); if (r.NextDouble() < chanceForGoldQuality) { cropQuality = 2; } else if (r.NextDouble() < chanceForSilverQuality) { cropQuality = 1; } if (this.minHarvest > 1 || this.maxHarvest > 1) { numToHarvest = r.Next(this.minHarvest, Math.Min(this.minHarvest + 1, this.maxHarvest + 1 + Game1.player.FarmingLevel / this.maxHarvestIncreasePerFarmingLevel)); } if (this.chanceForExtraCrops > 0.0) { while (r.NextDouble() < Math.Min(0.9, this.chanceForExtraCrops)) { numToHarvest++; } } if (this.harvestMethod == 1) { if (junimoHarvester == null) { DelayedAction.playSoundAfterDelay("daggerswipe", 150); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("harvest"); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260); } for (int i = 0; i < numToHarvest; i++) { if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(new Object(this.indexOfHarvest, 1, false, -1, cropQuality)); } else { Game1.createObjectDebris(this.indexOfHarvest, xTile, yTile, -1, cropQuality, 1f, null); } } if (this.regrowAfterHarvest == -1) { return(true); } this.dayOfCurrentPhase = this.regrowAfterHarvest; this.fullyGrown = true; } else { if (junimoHarvester == null) { Farmer arg_487_0 = Game1.player; Object arg_487_1; if (!this.programColored) { arg_487_1 = new Object(this.indexOfHarvest, 1, false, -1, cropQuality); } else { (arg_487_1 = new ColoredObject(this.indexOfHarvest, 1, this.tintColor)).quality = cropQuality; } if (!arg_487_0.addItemToInventoryBool(arg_487_1, false)) { Game1.showRedMessage("Inventory Full"); return(false); } } Vector2 initialTile2 = new Vector2((float)xTile, (float)yTile); if (junimoHarvester == null) { Game1.player.animateOnce(279 + Game1.player.facingDirection); Game1.player.canMove = false; } else { Object arg_4FD_1; if (!this.programColored) { arg_4FD_1 = new Object(this.indexOfHarvest, 1, false, -1, cropQuality); } else { (arg_4FD_1 = new ColoredObject(this.indexOfHarvest, 1, this.tintColor)).quality = cropQuality; } junimoHarvester.tryToAddItemToHut(arg_4FD_1); } if (r.NextDouble() < (double)((float)Game1.player.LuckLevel / 1500f) + Game1.dailyLuck / 1200.0 + 9.9999997473787516E-05) { numToHarvest *= 2; if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("dwoop"); } } else if (this.harvestMethod == 0) { if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { Game1.playSound("harvest"); } if (junimoHarvester == null || Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), Game1.tileSize, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260); } if (this.regrowAfterHarvest == -1 && (junimoHarvester == null || junimoHarvester.currentLocation.Equals(Game1.currentLocation))) { Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(17, new Vector2(initialTile2.X * (float)Game1.tileSize, initialTile2.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f, 0, -1, -1f, -1, 0)); Game1.currentLocation.temporarySprites.Add(new TemporaryAnimatedSprite(14, new Vector2(initialTile2.X * (float)Game1.tileSize, initialTile2.Y * (float)Game1.tileSize), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f, 0, -1, -1f, -1, 0)); } } if (this.indexOfHarvest == 421) { this.indexOfHarvest = 431; numToHarvest = r.Next(1, 4); } for (int j = 0; j < numToHarvest - 1; j++) { if (junimoHarvester == null) { Game1.createObjectDebris(this.indexOfHarvest, xTile, yTile, -1, 0, 1f, null); } else { junimoHarvester.tryToAddItemToHut(new Object(this.indexOfHarvest, 1, false, -1, 0)); } } int price = Convert.ToInt32(Game1.objectInformation[this.indexOfHarvest].Split(new char[] { '/' })[1]); float experience2 = (float)(16.0 * Math.Log(0.018 * (double)price + 1.0, 2.7182818284590451)); if (junimoHarvester == null) { Game1.player.gainExperience(0, (int)Math.Round((double)experience2)); } if (this.regrowAfterHarvest == -1) { return(true); } this.dayOfCurrentPhase = this.regrowAfterHarvest; this.fullyGrown = true; } } return(false); }
public bool Harvest(int xTile, int yTile, HoeDirt soil, JunimoHarvester junimoHarvester = null) { var Game1_multiplayer = (Multiplayer)typeof(Game1).GetField("multiplayer", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).GetValue(null); var this_tilePosition = Mod.instance.Helper.Reflection.GetField <Vector2>(this, "tilePosition").GetValue(); var currPhase = this.GetCurrentPhase(); if ((bool)this.dead) { if (junimoHarvester != null) { return(true); } return(false); } bool success = false; Random r = new Random(xTile * 7 + yTile * 11 + (int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame); /*if ( ( bool ) this.forageCrop ) * { * StardewValley.Object o = null; * int experience2 = 3; * Random r2 = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 2 + xTile * 1000 + yTile * 2000); * switch ( ( int ) this.whichForageCrop ) * { * case 1: * o = new StardewValley.Object( 399, 1 ); * break; * case 2: * soil.shake( ( float ) Math.PI / 48f, ( float ) Math.PI / 40f, ( float ) ( xTile * 64 ) < Game1.player.Position.X ); * return false; * } * if ( Game1.player.professions.Contains( 16 ) ) * { * o.Quality = 4; * } * else if ( r2.NextDouble() < ( double ) ( ( float ) Game1.player.ForagingLevel / 30f ) ) * { * o.Quality = 2; * } * else if ( r2.NextDouble() < ( double ) ( ( float ) Game1.player.ForagingLevel / 15f ) ) * { * o.Quality = 1; * } * Game1.stats.ItemsForaged += ( uint ) o.Stack; * if ( junimoHarvester != null ) * { * junimoHarvester.tryToAddItemToHut( o ); * return true; * } * if ( Game1.player.addItemToInventoryBool( o ) ) * { * Vector2 initialTile2 = new Vector2(xTile, yTile); * Game1.player.animateOnce( 279 + Game1.player.FacingDirection ); * Game1.player.canMove = false; * Game1.player.currentLocation.playSound( "harvest" ); * DelayedAction.playSoundAfterDelay( "coin", 260 ); * if ( ( int ) this.regrowAfterHarvest == -1 ) * { * Game1_multiplayer.broadcastSprites( Game1.currentLocation, new TemporaryAnimatedSprite( 17, new Vector2( initialTile2.X * 64f, initialTile2.Y * 64f ), Color.White, 7, r2.NextDouble() < 0.5, 125f ) ); * Game1_multiplayer.broadcastSprites( Game1.currentLocation, new TemporaryAnimatedSprite( 14, new Vector2( initialTile2.X * 64f, initialTile2.Y * 64f ), Color.White, 7, r2.NextDouble() < 0.5, 50f ) ); * } * Game1.player.gainExperience( 2, experience2 ); * return true; * } * Game1.showRedMessage( Game1.content.LoadString( "Strings\\StringsFromCSFiles:Crop.cs.588" ) ); * } * else*/ if (currPhase.HarvestedDrops.Count > 0) { foreach (var drop in currPhase.HarvestedDrops) { int numToHarvest = 1; int cropQuality = 0; /*if ( ( int ) this.indexOfHarvest == 0 ) * { * return true; * }*/ int fertilizerQualityLevel = (int)soil.fertilizer switch { 368 => 1, 369 => 2, 919 => 3, _ => 0 }; double chanceForGoldQuality = 0.2 * ((double)Game1.player.FarmingLevel / 10.0) + 0.2 * (double)fertilizerQualityLevel * (((double)Game1.player.FarmingLevel + 2.0) / 12.0) + 0.01; double chanceForSilverQuality = Math.Min(0.75, chanceForGoldQuality * 2.0); if (fertilizerQualityLevel >= 3 && r.NextDouble() < chanceForGoldQuality / 2.0) { cropQuality = 4; } else if (r.NextDouble() < chanceForGoldQuality) { cropQuality = 2; } else if (r.NextDouble() < chanceForSilverQuality || fertilizerQualityLevel >= 3) { cropQuality = 1; } if ((int)drop.MininumHarvestedQuantity > 1 || (int)drop.MaximumHarvestedQuantity > 1) { int max_harvest_increase = 0; if (this.maxHarvestIncreasePerFarmingLevel.Value > 0) { max_harvest_increase = Game1.player.FarmingLevel / (int)this.maxHarvestIncreasePerFarmingLevel; } numToHarvest = r.Next(drop.MininumHarvestedQuantity, Math.Max((int)drop.MininumHarvestedQuantity + 1, (int)drop.MaximumHarvestedQuantity + 1 + max_harvest_increase)); } if ((double)drop.ExtraQuantityChance > 0.0) { while (r.NextDouble() < Math.Min(0.9, drop.ExtraQuantityChance)) { numToHarvest++; } } /*if ( ( int ) this.indexOfHarvest == 771 || ( int ) this.indexOfHarvest == 889 ) * { * cropQuality = 0; * }*/ Item harvestedItem = drop.Item.Choose(r)?.Create(); if (harvestedItem != null) { if (harvestedItem is StardewValley.Object obj) { obj.Quality = cropQuality; } if (this.Data.Colors != null) { if (harvestedItem is StardewValley.Objects.ColoredObject colObj) { colObj.color.Value = this.tintColor.Value; } else if (harvestedItem is CustomObject cobj) { cobj.ObjectColor = this.tintColor.Value; } } } if ((int)this.harvestMethod == 1) { if (junimoHarvester != null) { DelayedAction.playSoundAfterDelay("daggerswipe", 150, junimoHarvester.currentLocation); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { junimoHarvester.currentLocation.playSound("harvest"); } if (junimoHarvester != null && Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260, junimoHarvester.currentLocation); } if (harvestedItem != null) { if (junimoHarvester != null) { junimoHarvester.tryToAddItemToHut(harvestedItem.getOne()); } else { for (int i = 0; i < numToHarvest; ++i) { Game1.createItemDebris(harvestedItem.getOne(), new Vector2(xTile * 64 + 32, yTile * 64 + 32), -1); } } } success = true; } else { if (harvestedItem != null) { if (junimoHarvester == null) { for (; numToHarvest > 0 && Game1.player.addItemToInventoryBool(harvestedItem.getOne()); --numToHarvest) { ; } } } if (junimoHarvester != null || numToHarvest == 0) { Vector2 initialTile = new Vector2(xTile, yTile); if (junimoHarvester == null) { Game1.player.animateOnce(279 + Game1.player.FacingDirection); Game1.player.canMove = false; } else { if (harvestedItem != null) { for (int i = 0; i < numToHarvest; ++i) { junimoHarvester.tryToAddItemToHut(harvestedItem.getOne()); } } } if (r.NextDouble() < Game1.player.team.AverageLuckLevel() / 1500.0 + Game1.player.team.AverageDailyLuck() / 1200.0 + 9.9999997473787516E-05) { numToHarvest *= 2; if (junimoHarvester == null) { Game1.player.currentLocation.playSound("dwoop"); } else if (Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { junimoHarvester.currentLocation.playSound("dwoop"); } } else if ((int)this.harvestMethod == 0) { if (junimoHarvester == null) { Game1.player.currentLocation.playSound("harvest"); } else if (Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { junimoHarvester.currentLocation.playSound("harvest"); } if (junimoHarvester == null) { DelayedAction.playSoundAfterDelay("coin", 260, Game1.player.currentLocation); } else if (Utility.isOnScreen(junimoHarvester.getTileLocationPoint(), 64, junimoHarvester.currentLocation)) { DelayedAction.playSoundAfterDelay("coin", 260, junimoHarvester.currentLocation); } if ((int)this.regrowAfterHarvest == -1 && (junimoHarvester == null || junimoHarvester.currentLocation.Equals(Game1.currentLocation))) { Game1_multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(17, new Vector2(initialTile.X * 64f, initialTile.Y * 64f), Color.White, 7, Game1.random.NextDouble() < 0.5, 125f)); Game1_multiplayer.broadcastSprites(Game1.currentLocation, new TemporaryAnimatedSprite(14, new Vector2(initialTile.X * 64f, initialTile.Y * 64f), Color.White, 7, Game1.random.NextDouble() < 0.5, 50f)); } } success = true; } else if (numToHarvest > 0) { Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Crop.cs.588")); } } } if (success) { /*int numToHarvest = 0; * if ( ( int ) this.indexOfHarvest == 421 ) * { * this.indexOfHarvest.Value = 431; * numToHarvest = r.Next( 1, 4 ); * }*/ //int price = Convert.ToInt32(Game1.objectInformation[this.indexOfHarvest].Split('/')[1]); //harvestedItem = ( this.programColored ? new ColoredObject( this.indexOfHarvest, 1, this.tintColor ) : new StardewValley.Object( this.indexOfHarvest, 1 ) ); float experience = currPhase.HarvestedExperience; // (float)(16.0 * Math.Log(0.018 * (double)price + 1.0, Math.E)); if (junimoHarvester == null) { Game1.player.gainExperience(0, (int)Math.Round(experience)); } /*for ( int i = 0; i < numToHarvest - 1; i++ ) * { * if ( junimoHarvester == null ) * { * Game1.createItemDebris( harvestedItem.getOne(), new Vector2( xTile * 64 + 32, yTile * 64 + 32 ), -1 ); * } * else * { * junimoHarvester.tryToAddItemToHut( harvestedItem.getOne() ); * } * }*/ /* * if ( ( int ) this.indexOfHarvest == 262 && r.NextDouble() < 0.4 ) * { * StardewValley.Object hay_item = new StardewValley.Object(178, 1); * if ( junimoHarvester == null ) * { * Game1.createItemDebris( hay_item.getOne(), new Vector2( xTile * 64 + 32, yTile * 64 + 32 ), -1 ); * } * else * { * junimoHarvester.tryToAddItemToHut( hay_item.getOne() ); * } * } * else if ( ( int ) this.indexOfHarvest == 771 ) * { * Game1.player.currentLocation.playSound( "cut" ); * if ( r.NextDouble() < 0.1 ) * { * StardewValley.Object mixedSeeds_item = new StardewValley.Object(770, 1); * if ( junimoHarvester == null ) * { * Game1.createItemDebris( mixedSeeds_item.getOne(), new Vector2( xTile * 64 + 32, yTile * 64 + 32 ), -1 ); * } * else * { * junimoHarvester.tryToAddItemToHut( mixedSeeds_item.getOne() ); * } * } * } */ if (currPhase.HarvestedNewPhase == -1) { return(true); } //this.fullyGrown.Value = true; this.currentPhase.Value = currPhase.HarvestedNewPhase; this.dayOfCurrentPhase.Value = 0; //if ( this.dayOfCurrentPhase.Value == ( int ) this.regrowAfterHarvest ) { this.updateDrawMath(this_tilePosition); } //this.dayOfCurrentPhase.Value = this.regrowAfterHarvest; } } return(false); }