private static bool Impl(IndoorPot this_, CustomObject dropInItem, bool probe, Farmer who) { if (who != null && dropInItem != null && this_.bush.Value == null && dropInItem.CanPlantThisSeedHere(this_.hoeDirt.Value, (int)this_.tileLocation.X, (int)this_.tileLocation.Y, dropInItem.Category == -19)) { //if ((int)dropInItem.parentSheetIndex == 805) //{ // if (!probe) // { // Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.13053")); // } // return false; //} //if ((int)dropInItem.parentSheetIndex == 499) //{ // if (!probe) // { // Game1.playSound("cancel"); // Game1.showGlobalMessage(Game1.content.LoadString("Strings\\Objects:AncientFruitPot")); // } // return false; //} if (!probe) { if (!dropInItem.Plant(this_.hoeDirt.Value, (int)this_.tileLocation.X, (int)this_.tileLocation.Y, who, dropInItem.Category == -19, who.currentLocation)) { return(false); } } else { this_.heldObject.Value = new StardewValley.Object(); } return(true); } //if (who != null && dropInItem != null && this_.hoeDirt.Value.crop == null && this_.bush.Value == null && dropInItem is StardewValley.Object && !(dropInItem as StardewValley.Object).bigCraftable && (int)dropInItem.parentSheetIndex == 251) //{ // if (probe) // { // this_.heldObject.Value = new StardewValley.Object(); // } // else // { // this_.bush.Value = new Bush(this_.tileLocation, 3, who.currentLocation); // if (!who.currentLocation.IsOutdoors) // { // this_.bush.Value.greenhouseBush.Value = true; // this_.bush.Value.loadSprite(); // Game1.playSound("coin"); // } // } // return true; //} return(false); }
private static bool Impl(GameLocation this_, Vector2 tileLocation, CustomObject toPlace) { foreach (ResourceClump resourceClump in this_.resourceClumps) { if (resourceClump.occupiesTile((int)tileLocation.X, (int)tileLocation.Y)) { return(true); } } this_.objects.TryGetValue(tileLocation, out StardewValley.Object o); Microsoft.Xna.Framework.Rectangle tileLocationRect = new Microsoft.Xna.Framework.Rectangle((int)tileLocation.X * 64, (int)tileLocation.Y * 64, 64, 64); for (int i = 0; i < this_.characters.Count; i++) { if (this_.characters[i] != null && this_.characters[i].GetBoundingBox().Intersects(tileLocationRect)) { return(true); } } if (this_.isTileOccupiedByFarmer(tileLocation) != null && (toPlace == null || !toPlace.isPassable())) { return(true); } if (this_.largeTerrainFeatures != null) { foreach (LargeTerrainFeature largeTerrainFeature in this_.largeTerrainFeatures) { if (largeTerrainFeature.getBoundingBox().Intersects(tileLocationRect)) { return(true); } } } if (toPlace?.Category == -19) { if (toPlace.Category == -19 && this_.terrainFeatures.ContainsKey(tileLocation) && this_.terrainFeatures[tileLocation] is HoeDirt) { HoeDirt hoe_dirt = this_.terrainFeatures[tileLocation] as HoeDirt; if ((int)(this_.terrainFeatures[tileLocation] as HoeDirt).fertilizer != 0) { return(true); } if (((int)toPlace.parentSheetIndex == 368 || (int)toPlace.parentSheetIndex == 368) && hoe_dirt.crop != null && (int)hoe_dirt.crop.currentPhase != 0) { return(true); } } } else if (this_.terrainFeatures.ContainsKey(tileLocation) && tileLocationRect.Intersects(this_.terrainFeatures[tileLocation].getBoundingBox(tileLocation)) && (!this_.terrainFeatures[tileLocation].isPassable() || (this_.terrainFeatures[tileLocation] is HoeDirt && ((HoeDirt)this_.terrainFeatures[tileLocation]).crop != null) || (toPlace != null && toPlace.isSapling()))) { return(true); } if ((toPlace == null || !(toPlace is BedFurniture) || this_.isTilePassable(new Location((int)tileLocation.X, (int)tileLocation.Y), Game1.viewport) || !this_.isTilePassable(new Location((int)tileLocation.X, (int)tileLocation.Y + 1), Game1.viewport)) && !this_.isTilePassable(new Location((int)tileLocation.X, (int)tileLocation.Y), Game1.viewport) && (toPlace == null || !(toPlace is Wallpaper))) { return(true); } if (toPlace?.Category is - 74 or - 19 && o is IndoorPot) { if ((int)toPlace.parentSheetIndex == 251) { if ((o as IndoorPot).bush.Value == null && (o as IndoorPot).hoeDirt.Value.crop == null) { return(false); } } else if (toPlace.CanPlantThisSeedHere((o as IndoorPot).hoeDirt.Value, (int)tileLocation.X, (int)tileLocation.Y, toPlace.Category == -19) && (o as IndoorPot).bush.Value == null) { return(false); } } return(o != null); }
private static bool Impl(GameLocation location, Vector2 tileLocation, CustomObject item) { if ((!location.terrainFeatures.ContainsKey(tileLocation) || location.terrainFeatures[tileLocation] is not HoeDirt || !item.CanPlantThisSeedHere(((HoeDirt)location.terrainFeatures[tileLocation]), (int)tileLocation.X, (int)tileLocation.Y)) && (!location.objects.ContainsKey(tileLocation) || location.objects[tileLocation] is not IndoorPot || !item.CanPlantThisSeedHere((location.objects[tileLocation] as IndoorPot).hoeDirt.Value, (int)tileLocation.X, (int)tileLocation.Y) || (item as StardewValley.Object).ParentSheetIndex == 499)) { if (location.isTileHoeDirt(tileLocation) || !location.terrainFeatures.ContainsKey(tileLocation)) { return(false); // StardewValley.Object.isWildTreeSeed( item.parentSheetIndex ); } return(false); } return(true); }