// Token: 0x06000152 RID: 338 RVA: 0x0000E63C File Offset: 0x0000C83C public static void receiveBuildingChange(byte whatChange, short tileX, short tileY, string name, long who, long id) { if (Game1.IsClient) { MultiplayerUtility.recentMultiplayerEntityID = id; } else { MultiplayerUtility.recentMultiplayerEntityID = MultiplayerUtility.getNewID(); } if (Game1.currentLocation is Farm || Game1.IsServer) { Farm farm = (Farm)Game1.currentLocation; if (!(Game1.currentLocation is Farm)) { farm = (Farm)Game1.otherFarmers[id].currentLocation; } Farmer f = Game1.getFarmer(who); switch (whatChange) { case 0: { BluePrint b = new BluePrint(name); if (b.blueprintType.Equals("Animals") && farm.placeAnimal(b, new Vector2((float)tileX, (float)tileY), true, who) && f.IsMainPlayer) { b.consumeResources(); } else if (!b.blueprintType.Equals("Animals") && farm.buildStructure(b, new Vector2((float)tileX, (float)tileY), true, f, false) && f.IsMainPlayer) { b.consumeResources(); } else if (f.IsMainPlayer) { Game1.addHUDMessage(new HUDMessage("Can't Build There", Color.Red, 3500f)); return; } if (!b.blueprintType.Equals("Animals")) { Game1.playSound("axe"); return; } break; } case 1: { Building destroyed = farm.getBuildingAt(new Vector2((float)tileX, (float)tileY)); if (farm.destroyStructure(new Vector2((float)tileX, (float)tileY))) { int groundYTile = destroyed.tileY + destroyed.tilesHigh; for (int i = 0; i < destroyed.texture.Bounds.Height / Game1.tileSize; i++) { Game1.createRadialDebris(farm, destroyed.texture, new Microsoft.Xna.Framework.Rectangle(destroyed.texture.Bounds.Center.X, destroyed.texture.Bounds.Center.Y, Game1.tileSize / 16, Game1.tileSize / 16), destroyed.tileX + Game1.random.Next(destroyed.tilesWide), destroyed.tileY + destroyed.tilesHigh - i, Game1.random.Next(20, 45), groundYTile); } Game1.playSound("explosion"); Utility.spreadAnimalsAround(destroyed, farm); return; } break; } case 2: { BluePrint b = new BluePrint(name); Building toUpgrade = farm.getBuildingAt(new Vector2((float)tileX, (float)tileY)); farm.tryToUpgrade(toUpgrade, b); break; } default: return; } } }
public static void receiveBuildingChange(byte whatChange, short tileX, short tileY, string name, long who, long id) { if (Game1.IsClient) { MultiplayerUtility.recentMultiplayerEntityID = id; } else { MultiplayerUtility.recentMultiplayerEntityID = MultiplayerUtility.getNewID(); } if (Game1.currentLocation is Farm || Game1.IsServer) { Farm farm = (Farm)Game1.currentLocation; if (!(Game1.currentLocation is Farm)) { farm = (Farm)Game1.otherFarmers[id].currentLocation; } Farmer farmer = Game1.getFarmer(who); switch (whatChange) { case 0: { BluePrint bluePrint = new BluePrint(name); if (bluePrint.blueprintType.Equals("Animals") && farm.placeAnimal(bluePrint, new Vector2((float)tileX, (float)tileY), true, who) && farmer.IsMainPlayer) { bluePrint.consumeResources(); } else if (!bluePrint.blueprintType.Equals("Animals") && farm.buildStructure(bluePrint, new Vector2((float)tileX, (float)tileY), true, farmer, false) && farmer.IsMainPlayer) { bluePrint.consumeResources(); } else if (farmer.IsMainPlayer) { Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:BlueprintsMenu.cs.10016", new object[0]), Color.Red, 3500f)); return; } if (!bluePrint.blueprintType.Equals("Animals")) { Game1.playSound("axe"); return; } break; } case 1: { Building buildingAt = farm.getBuildingAt(new Vector2((float)tileX, (float)tileY)); if (farm.destroyStructure(new Vector2((float)tileX, (float)tileY))) { int groundLevelTile = buildingAt.tileY + buildingAt.tilesHigh; for (int i = 0; i < buildingAt.texture.Bounds.Height / Game1.tileSize; i++) { Game1.createRadialDebris(farm, buildingAt.texture, new Microsoft.Xna.Framework.Rectangle(buildingAt.texture.Bounds.Center.X, buildingAt.texture.Bounds.Center.Y, Game1.tileSize / 16, Game1.tileSize / 16), buildingAt.tileX + Game1.random.Next(buildingAt.tilesWide), buildingAt.tileY + buildingAt.tilesHigh - i, Game1.random.Next(20, 45), groundLevelTile); } Game1.playSound("explosion"); Utility.spreadAnimalsAround(buildingAt, farm); return; } break; } case 2: { BluePrint bluePrint = new BluePrint(name); Building buildingAt2 = farm.getBuildingAt(new Vector2((float)tileX, (float)tileY)); farm.tryToUpgrade(buildingAt2, bluePrint); break; } default: return; } } }
public static void receiveBuildingChange(byte whatChange, short tileX, short tileY, string name, long who, long id) { MultiplayerUtility.recentMultiplayerEntityID = !Game1.IsClient ? MultiplayerUtility.getNewID() : id; if (!(Game1.currentLocation is Farm) && !Game1.IsServer) { return; } Farm currentLocation = (Farm)Game1.currentLocation; if (!(Game1.currentLocation is Farm)) { currentLocation = (Farm)Game1.otherFarmers[id].currentLocation; } Farmer farmer = Game1.getFarmer(who); switch (whatChange) { case 0: BluePrint bluePrint = new BluePrint(name); if (bluePrint.blueprintType.Equals("Animals") && currentLocation.placeAnimal(bluePrint, new Vector2((float)tileX, (float)tileY), true, who) && farmer.IsMainPlayer) { bluePrint.consumeResources(); } else if (!bluePrint.blueprintType.Equals("Animals") && currentLocation.buildStructure(bluePrint, new Vector2((float)tileX, (float)tileY), true, farmer, false) && farmer.IsMainPlayer) { bluePrint.consumeResources(); } else if (farmer.IsMainPlayer) { Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:BlueprintsMenu.cs.10016"), Color.Red, 3500f)); break; } if (bluePrint.blueprintType.Equals("Animals")) { break; } Game1.playSound("axe"); break; case 1: Building buildingAt1 = currentLocation.getBuildingAt(new Vector2((float)tileX, (float)tileY)); if (!currentLocation.destroyStructure(new Vector2((float)tileX, (float)tileY))) { break; } int num = buildingAt1.tileY + buildingAt1.tilesHigh; for (int index = 0; index < buildingAt1.texture.Bounds.Height / Game1.tileSize; ++index) { Farm farm = currentLocation; Texture2D texture = buildingAt1.texture; Microsoft.Xna.Framework.Rectangle bounds = buildingAt1.texture.Bounds; int x = bounds.Center.X; bounds = buildingAt1.texture.Bounds; int y = bounds.Center.Y; int width = Game1.tileSize / 16; int height = Game1.tileSize / 16; Microsoft.Xna.Framework.Rectangle sourcerectangle = new Microsoft.Xna.Framework.Rectangle(x, y, width, height); int xTile = buildingAt1.tileX + Game1.random.Next(buildingAt1.tilesWide); int yTile = buildingAt1.tileY + buildingAt1.tilesHigh - index; int numberOfChunks = Game1.random.Next(20, 45); int groundLevelTile = num; Game1.createRadialDebris((GameLocation)farm, texture, sourcerectangle, xTile, yTile, numberOfChunks, groundLevelTile); } Game1.playSound("explosion"); Utility.spreadAnimalsAround(buildingAt1, currentLocation); break; case 2: BluePrint blueprint = new BluePrint(name); Building buildingAt2 = currentLocation.getBuildingAt(new Vector2((float)tileX, (float)tileY)); currentLocation.tryToUpgrade(buildingAt2, blueprint); break; } }