public static void warpCharacter(short x, short y, string name, byte isStructure, long id) { if (Game1.otherFarmers.ContainsKey(id)) { if (Game1.otherFarmers[id].currentLocation == null) { Game1.otherFarmers[id]._tmpLocationName = name; return; } Game1.otherFarmers[id].currentLocation.farmers.Remove(Game1.otherFarmers[id]); Game1.otherFarmers[id].currentLocation = Game1.getLocationFromName(name, isStructure == 1); Game1.otherFarmers[id].position.X = (float)((int)x * Game1.tileSize); Game1.otherFarmers[id].position.Y = (float)((int)y * Game1.tileSize - Game1.tileSize / 2); GameLocation locationFromName = Game1.getLocationFromName(name, isStructure == 1); locationFromName.farmers.Add(Game1.otherFarmers[id]); if (locationFromName.farmers.Count.Equals(Game1.numberOfPlayers() - 1)) { locationFromName.checkForEvents(); } } if (Game1.IsServer) { MultiplayerUtility.broadcastFarmerWarp(x, y, name, isStructure == 1, id); } }
public static void serverTryToPerformObjectAlteration(short x, short y, byte command, byte terrainFeatureIndex, int extraInfo, Farmer actionPerformer) { switch (command) { case 0: extraInfo = MultiplayerUtility.translateObjectIndex(extraInfo); Object object1 = (int)terrainFeatureIndex != 0 ? new Object(Vector2.Zero, extraInfo, false) : new Object(Vector2.Zero, extraInfo, (string)null, true, false, false, false); if (!Utility.playerCanPlaceItemHere(actionPerformer.currentLocation, (Item)object1, (int)x, (int)y, actionPerformer)) { break; } object1.placementAction(Game1.currentLocation, (int)x, (int)y, (Farmer)null); break; case 1: Object object2 = Game1.currentLocation.objects[new Vector2((float)x, (float)y)]; Game1.currentLocation.objects.Remove(new Vector2((float)x, (float)y)); if (object2 == null) { break; } object2.performRemoveAction(new Vector2((float)x, (float)y), Game1.currentLocation); break; case 2: Game1.currentLocation.terrainFeatures.Add(new Vector2((float)x, (float)y), TerrainFeatureFactory.getNewTerrainFeatureFromIndex(terrainFeatureIndex, extraInfo)); break; case 3: Game1.currentLocation.terrainFeatures.Remove(new Vector2((float)x, (float)y)); break; } }
public static void performToolAction(byte toolIndex, byte toolUpgradeLevel, short xTile, short yTile, string locationName, byte facingDirection, short seed, long who) { Tool toolFromDescription = ToolFactory.getToolFromDescription(toolIndex, (int)toolUpgradeLevel); GameLocation locationFromName = Game1.getLocationFromName(locationName); Game1.otherFarmers[who].CurrentTool = toolFromDescription; Game1.recentMultiplayerRandom = new Random((int)seed); if (locationFromName == null) { if (toolFromDescription is MeleeWeapon) { Game1.otherFarmers[who].faceDirection((int)facingDirection); (toolFromDescription as MeleeWeapon).DoDamage(Game1.currentLocation, (int)xTile, (int)yTile, Game1.otherFarmers[who].facingDirection, 1, Game1.otherFarmers[who]); } else { toolFromDescription.DoFunction(Game1.currentLocation, (int)xTile, (int)yTile, 1, Game1.otherFarmers[who]); } } else if (toolFromDescription is MeleeWeapon) { Game1.otherFarmers[who].faceDirection((int)facingDirection); (toolFromDescription as MeleeWeapon).DoDamage(locationFromName, (int)xTile, (int)yTile, Game1.otherFarmers[who].facingDirection, 1, Game1.otherFarmers[who]); } else { toolFromDescription.DoFunction(locationFromName, (int)xTile, (int)yTile, 1, Game1.otherFarmers[who]); } if (Game1.IsServer) { MultiplayerUtility.broadcastToolAction(toolFromDescription, (int)xTile, (int)yTile, locationName, facingDirection, seed, who); } }
public static void performObjectAlteration(short x, short y, byte command, byte terrainFeatureIndex, int extraInfo) { switch (command) { case 0: extraInfo = MultiplayerUtility.translateObjectIndex(extraInfo); ((int)terrainFeatureIndex != 0 ? new Object(Vector2.Zero, extraInfo, false) : new Object(Vector2.Zero, extraInfo, (string)null, true, false, false, false)).placementAction(Game1.currentLocation, (int)x * Game1.tileSize, (int)y * Game1.tileSize, (Farmer)null); break; case 1: Object @object; Game1.currentLocation.objects.TryGetValue(new Vector2((float)x, (float)y), out @object); if (@object == null) { break; } Game1.currentLocation.objects.Remove(new Vector2((float)x, (float)y)); @object.performRemoveAction(new Vector2((float)x, (float)y), Game1.currentLocation); break; case 2: if (Game1.currentLocation.terrainFeatures.ContainsKey(new Vector2((float)x, (float)y))) { Game1.currentLocation.terrainFeatures[new Vector2((float)x, (float)y)] = TerrainFeatureFactory.getNewTerrainFeatureFromIndex(terrainFeatureIndex, extraInfo); break; } Game1.currentLocation.terrainFeatures.Add(new Vector2((float)x, (float)y), TerrainFeatureFactory.getNewTerrainFeatureFromIndex(terrainFeatureIndex, extraInfo)); break; case 3: Game1.currentLocation.terrainFeatures.Remove(new Vector2((float)x, (float)y)); break; } }
public static void performNPCMove(int x, int y, long id) { Character characterFromID = MultiplayerUtility.getCharacterFromID(id); if (characterFromID != null && !characterFromID.ignoreMultiplayerUpdates) { characterFromID.updatePositionFromServer(new Vector2((float)x, (float)y)); } }
public static void performNPCBehavior(long npcID, byte behavior) { Character characterFromID = MultiplayerUtility.getCharacterFromID(npcID); if (characterFromID != null && !characterFromID.ignoreMultiplayerUpdates) { characterFromID.performBehavior(behavior); } }
public static void performNPCBehavior(long npcID, byte behavior) { Character characterFromId = MultiplayerUtility.getCharacterFromID(npcID); if (characterFromId == null || characterFromId.ignoreMultiplayerUpdates) { return; } characterFromId.performBehavior(behavior); }
public static void performObjectAlteration(short x, short y, byte command, byte terrainFeatureIndex, int extraInfo) { switch (command) { case 0: { extraInfo = MultiplayerUtility.translateObjectIndex(extraInfo); Object @object; if (terrainFeatureIndex == 0) { @object = new Object(Vector2.Zero, extraInfo, null, true, false, false, false); } else { @object = new Object(Vector2.Zero, extraInfo, false); } @object.placementAction(Game1.currentLocation, (int)x * Game1.tileSize, (int)y * Game1.tileSize, null); return; } case 1: { Object @object; Game1.currentLocation.objects.TryGetValue(new Vector2((float)x, (float)y), out @object); if (@object != null) { Game1.currentLocation.objects.Remove(new Vector2((float)x, (float)y)); @object.performRemoveAction(new Vector2((float)x, (float)y), Game1.currentLocation); return; } break; } case 2: if (Game1.currentLocation.terrainFeatures.ContainsKey(new Vector2((float)x, (float)y))) { Game1.currentLocation.terrainFeatures[new Vector2((float)x, (float)y)] = TerrainFeatureFactory.getNewTerrainFeatureFromIndex(terrainFeatureIndex, extraInfo); return; } Game1.currentLocation.terrainFeatures.Add(new Vector2((float)x, (float)y), TerrainFeatureFactory.getNewTerrainFeatureFromIndex(terrainFeatureIndex, extraInfo)); return; case 3: Game1.currentLocation.terrainFeatures.Remove(new Vector2((float)x, (float)y)); break; default: return; } }
public static void allFarmersReadyCheck() { if (Game1.IsServer) { using (Dictionary <long, Farmer> .ValueCollection.Enumerator enumerator = Game1.otherFarmers.Values.GetEnumerator()) { while (enumerator.MoveNext()) { if (!enumerator.Current.readyConfirmation) { return; } } } if (Game1.player.readyConfirmation) { MultiplayerUtility.sendReadyConfirmation(Game1.player.uniqueMultiplayerID); using (Dictionary <long, Farmer> .ValueCollection.Enumerator enumerator = Game1.otherFarmers.Values.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.readyConfirmation = false; } } Game1.player.readyConfirmation = false; if (Game1.currentLocation.currentEvent != null) { Event expr_BF = Game1.currentLocation.currentEvent; int currentCommand = expr_BF.CurrentCommand; expr_BF.CurrentCommand = currentCommand + 1; return; } } } else { if (Game1.isFestival()) { Game1.currentLocation.currentEvent.allPlayersReady = true; } using (Dictionary <long, Farmer> .ValueCollection.Enumerator enumerator = Game1.otherFarmers.Values.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.readyConfirmation = false; } } } }
public static void receiveChatMessage(string message, long whichPlayer) { foreach (IClickableMenu current in Game1.onScreenMenus) { if (current is ChatBox) { ((ChatBox)current).receiveChatMessage(message, whichPlayer); break; } } if (Game1.IsServer) { MultiplayerUtility.sendChatMessage(message, whichPlayer); } }
public static void serverTryToPerformObjectAlteration(short x, short y, byte command, byte terrainFeatureIndex, int extraInfo, Farmer actionPerformer) { switch (command) { case 0: { extraInfo = MultiplayerUtility.translateObjectIndex(extraInfo); Object @object; if (terrainFeatureIndex == 0) { @object = new Object(Vector2.Zero, extraInfo, null, true, false, false, false); } else { @object = new Object(Vector2.Zero, extraInfo, false); } if (Utility.playerCanPlaceItemHere(actionPerformer.currentLocation, @object, (int)x, (int)y, actionPerformer)) { @object.placementAction(Game1.currentLocation, (int)x, (int)y, null); return; } break; } case 1: { Object @object = Game1.currentLocation.objects[new Vector2((float)x, (float)y)]; Game1.currentLocation.objects.Remove(new Vector2((float)x, (float)y)); if (@object != null) { @object.performRemoveAction(new Vector2((float)x, (float)y), Game1.currentLocation); return; } break; } case 2: Game1.currentLocation.terrainFeatures.Add(new Vector2((float)x, (float)y), TerrainFeatureFactory.getNewTerrainFeatureFromIndex(terrainFeatureIndex, extraInfo)); return; case 3: Game1.currentLocation.terrainFeatures.Remove(new Vector2((float)x, (float)y)); break; default: return; } }
public static void sendSwitchHeldItemMessage(int heldItemIndex, byte bigCraftable, long whichPlayer) { if (Game1.IsClient) { Game1.client.sendMessage(6, new object[] { bigCraftable, (short)heldItemIndex }); return; } if (Game1.IsServer) { MultiplayerUtility.broadcastSwitchHeldItem(bigCraftable, (short)heldItemIndex, whichPlayer, Game1.currentLocation.name); } }
public static void receiveChatMessage(string message, long whichPlayer) { foreach (IClickableMenu onScreenMenu in Game1.onScreenMenus) { if (onScreenMenu is ChatBox) { ((ChatBox)onScreenMenu).receiveChatMessage(message, whichPlayer); break; } } if (!Game1.IsServer) { return; } MultiplayerUtility.sendChatMessage(message, whichPlayer); }
public virtual void DoFunction(GameLocation location, int x, int y, int power, Farmer who) { this.lastUser = who; short seed = (short)Game1.random.Next((int)short.MinValue, 32768); if (Game1.IsClient && who.Equals((object)Game1.player)) { Game1.recentMultiplayerRandom = new Random((int)seed); ToolDescription indexFromTool = ToolFactory.getIndexFromTool(this); Game1.client.sendMessage((byte)7, new object[7] { (object)indexFromTool.index, (object)indexFromTool.upgradeLevel, (object)(short)x, (object)(short)y, (object)location.name, (object)(byte)who.FacingDirection, (object)seed }); } else if (Game1.IsServer && who.Equals((object)Game1.player)) { Game1.recentMultiplayerRandom = new Random((int)seed); MultiplayerUtility.broadcastToolAction(this, x, y, location.name, (byte)who.FacingDirection, seed, who.uniqueMultiplayerID); } if (this.isHeavyHitter() && !(this is MeleeWeapon)) { Rumble.rumble(0.1f + (float)(Game1.random.NextDouble() / 4.0), (float)(100 + Game1.random.Next(50))); location.damageMonster(new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), this.upgradeLevel + 1, (this.upgradeLevel + 1) * 3, false, who); } if (!(this is MeleeWeapon) || who.UsingTool && Game1.mouseClickPolling < 50 && ((this as MeleeWeapon).type != 1 && (this as MeleeWeapon).initialParentTileIndex != 47) && (MeleeWeapon.timedHitTimer <= 0 && who.FarmerSprite.indexInCurrentAnimation == 5 && (double)who.FarmerSprite.timer < (double)who.FarmerSprite.interval / 4.0)) { return; } if ((this as MeleeWeapon).type == 2 && (this as MeleeWeapon).isOnSpecial) { (this as MeleeWeapon).doClubFunction(who); } else { if (who.FarmerSprite.indexInCurrentAnimation <= 0) { return; } MeleeWeapon.timedHitTimer = 500; } }
public static void performDebrisCreate(short seed, int xPosition, int yPosition, byte facingDirection, byte type, short index, short stack, long who) { Game1.recentMultiplayerRandom = new Random((int)seed); Vector2 vector2 = new Vector2((float)xPosition, (float)yPosition); Vector2 debrisOrigin = new Vector2((float)xPosition, (float)yPosition); Item itemFromDescription = ObjectFactory.getItemFromDescription(type, (int)index, (int)stack); switch (facingDirection) { case 0: debrisOrigin.X -= (float)(Game1.tileSize / 2); debrisOrigin.Y -= (float)(Game1.tileSize * 2 + Game1.recentMultiplayerRandom.Next(Game1.tileSize / 2)); vector2.Y -= (float)(Game1.tileSize * 3); break; case 1: debrisOrigin.X += (float)(Game1.tileSize * 2 / 3); debrisOrigin.Y -= (float)(Game1.tileSize / 2 - Game1.recentMultiplayerRandom.Next(Game1.tileSize / 8)); vector2.X += (float)(Game1.tileSize * 4); break; case 2: debrisOrigin.X -= (float)(Game1.tileSize / 2); debrisOrigin.Y += (float)Game1.recentMultiplayerRandom.Next(Game1.tileSize / 2); vector2.Y += (float)(Game1.tileSize * 3 / 2); break; case 3: debrisOrigin.X -= (float)Game1.tileSize; debrisOrigin.Y -= (float)(Game1.tileSize / 2 - Game1.recentMultiplayerRandom.Next(Game1.tileSize / 8)); vector2.X -= (float)(Game1.tileSize * 4); break; } if (Game1.IsClient) { Game1.currentLocation.debris.Add(new Debris(itemFromDescription, debrisOrigin, vector2)); } else { if (!Game1.IsServer) { return; } Game1.otherFarmers[who].currentLocation.debris.Add(new Debris(itemFromDescription, debrisOrigin, vector2)); MultiplayerUtility.broadcastDebrisCreate(seed, vector2, (int)facingDirection, itemFromDescription, who); } }
// Token: 0x0600015C RID: 348 RVA: 0x0000EEE8 File Offset: 0x0000D0E8 public static void receiveNameChange(string message, long who) { Game1.ChatBox.receiveChatMessage(string.Concat(new string[] { Game1.otherFarmers[who].name, " changed ", Game1.otherFarmers[who].getHisOrHer(), " name to '", message, "'" }), -1L); Game1.otherFarmers[who].name = message; if (Game1.IsServer) { MultiplayerUtility.sendNameChange(message, who); } }
public static void performDebrisPickup(int uniqueID, string locationName, long whichPlayer) { GameLocation locationFromName = Game1.getLocationFromName(locationName); for (int i = 0; i < locationFromName.debris.Count; i++) { if (locationFromName.debris[i].uniqueID == uniqueID) { locationFromName.debris.RemoveAt(i); break; } } if (Game1.IsServer) { MultiplayerUtility.broadcastDebrisPickup(uniqueID, locationName, whichPlayer); } }
public static void receiveNameChange(string message, long who) { Game1.ChatBox.receiveChatMessage(Game1.otherFarmers[who].isMale ? Game1.content.LoadString("Strings\\StringsFromCSFiles:MultiplayerUtility.cs.12478", new object[] { Game1.otherFarmers[who].displayName, message }) : Game1.content.LoadString("Strings\\StringsFromCSFiles:MultiplayerUtility.cs.12479", new object[] { Game1.otherFarmers[who].displayName, message }), -1L); Game1.otherFarmers[who].name = message; if (Game1.IsServer) { MultiplayerUtility.sendNameChange(message, who); } }
public static void performCheckAction(short x, short y, string location, long who) { if (!Utility.canGrabSomethingFromHere((int)x * Game1.tileSize, (int)y * Game1.tileSize, Game1.otherFarmers[who]) || !Game1.getLocationFromName(location).objects.ContainsKey(new Vector2((float)x, (float)y)) || !Game1.getLocationFromName(location).objects[new Vector2((float)x, (float)y)].checkForAction(Game1.otherFarmers[who], false)) { if (Game1.isFestival()) { Game1.currentLocation.checkAction(new Location((int)x, (int)y), Game1.viewport, Game1.otherFarmers[who]); } else { Game1.getLocationFromName(location).checkAction(new Location((int)x, (int)y), Game1.viewport, Game1.otherFarmers[who]); } } if (Game1.IsServer) { MultiplayerUtility.broadcastCheckAction((int)x, (int)y, who, location); } }
// Token: 0x060007B1 RID: 1969 RVA: 0x000A8560 File Offset: 0x000A6760 public virtual void DoFunction(GameLocation location, int x, int y, int power, Farmer who) { this.lastUser = who; short seed = (short)Game1.random.Next(-32768, 32768); if (Game1.IsClient && who.Equals(Game1.player)) { Game1.recentMultiplayerRandom = new Random((int)seed); ToolDescription t = ToolFactory.getIndexFromTool(this); Game1.client.sendMessage(7, new object[] { t.index, t.upgradeLevel, (short)x, (short)y, location.name, (byte)who.FacingDirection, seed }); } else if (Game1.IsServer && who.Equals(Game1.player)) { Game1.recentMultiplayerRandom = new Random((int)seed); MultiplayerUtility.broadcastToolAction(this, x, y, location.name, (byte)who.FacingDirection, seed, who.uniqueMultiplayerID); } if (this.isHeavyHitter() && !(this is MeleeWeapon)) { Rumble.rumble(0.1f + (float)(Game1.random.NextDouble() / 4.0), (float)(100 + Game1.random.Next(50))); location.damageMonster(new Rectangle(x - Game1.tileSize / 2, y - Game1.tileSize / 2, Game1.tileSize, Game1.tileSize), this.upgradeLevel + 1, (this.upgradeLevel + 1) * 3, false, who); } if (this is MeleeWeapon && (!who.UsingTool || Game1.mouseClickPolling >= 50 || (this as MeleeWeapon).type == 1 || (this as MeleeWeapon).initialParentTileIndex == 47 || MeleeWeapon.timedHitTimer > 0 || who.FarmerSprite.indexInCurrentAnimation != 5 || who.FarmerSprite.timer >= who.FarmerSprite.interval / 4f)) { if ((this as MeleeWeapon).type == 2 && (this as MeleeWeapon).isOnSpecial) { (this as MeleeWeapon).doClubFunction(who); return; } if (who.FarmerSprite.indexInCurrentAnimation > 0) { MeleeWeapon.timedHitTimer = 500; } } }
public static void performSwitchHeldItem(long id, byte bigCraftable, int index) { if (index == -1) { Game1.otherFarmers[id].showNotCarrying(); if (Game1.otherFarmers[id].ActiveObject != null) { Game1.otherFarmers[id].ActiveObject.actionWhenStopBeingHeld(Game1.otherFarmers[id]); } Game1.otherFarmers[id].items[Game1.otherFarmers[id].CurrentToolIndex] = null; } else { Game1.otherFarmers[id].showCarrying(); Game1.otherFarmers[id].ActiveObject = ((bigCraftable == 1) ? new Object(Vector2.Zero, index, false) : new Object(Vector2.Zero, index, 1)); } if (Game1.IsServer) { MultiplayerUtility.sendSwitchHeldItemMessage(index, bigCraftable, id); } }
public static void allFarmersReadyCheck() { if (Game1.IsServer) { foreach (Farmer farmer in Game1.otherFarmers.Values) { if (!farmer.readyConfirmation) { return; } } if (!Game1.player.readyConfirmation) { return; } MultiplayerUtility.sendReadyConfirmation(Game1.player.uniqueMultiplayerID); foreach (Farmer farmer in Game1.otherFarmers.Values) { farmer.readyConfirmation = false; } Game1.player.readyConfirmation = false; if (Game1.currentLocation.currentEvent == null) { return; } ++Game1.currentLocation.currentEvent.CurrentCommand; } else { if (Game1.isFestival()) { Game1.currentLocation.currentEvent.allPlayersReady = true; } foreach (Farmer farmer in Game1.otherFarmers.Values) { farmer.readyConfirmation = false; } } }
public static void receiveNameChange(string message, long who) { ChatBox chatBox = Game1.ChatBox; string message1; if (!Game1.otherFarmers[who].isMale) { message1 = Game1.content.LoadString("Strings\\StringsFromCSFiles:MultiplayerUtility.cs.12479", (object)Game1.otherFarmers[who].displayName, (object)message); } else { message1 = Game1.content.LoadString("Strings\\StringsFromCSFiles:MultiplayerUtility.cs.12478", (object)Game1.otherFarmers[who].displayName, (object)message); } long who1 = -1; chatBox.receiveChatMessage(message1, who1); Game1.otherFarmers[who].name = message; if (!Game1.IsServer) { return; } MultiplayerUtility.sendNameChange(message, who); }
public static void interpretMessageToEveryone(int messageCategory, string message, long who) { switch (messageCategory) { case 0: if (Game1.isFestival()) { Game1.otherFarmers[who].dancePartner = Game1.currentLocation.currentEvent.getActorByName(message); } Game1.currentLocation.currentEvent.getActorByName(message).hasPartnerForDance = true; break; case 1: if (Game1.isFestival()) { Game1.currentLocation.currentEvent.addItemToLuauSoup(new Object(Convert.ToInt32(message.Split(new char[] { ' ' })[0]), 1, false, -1, Convert.ToInt32(message.Split(new char[] { ' ' })[1])), Game1.otherFarmers[who]); } break; case 2: if (Game1.isFestival()) { Game1.CurrentEvent.setGrangeDisplayUser(message.Equals("null") ? null : Game1.getFarmer(who)); } break; case 3: if (Game1.isFestival()) { string[] array = message.Split(new char[] { ' ' }); int num = Convert.ToInt32(array[0]); if (array[1].Equals("null")) { Game1.CurrentEvent.addItemToGrangeDisplay(null, num, true); } else { Game1.CurrentEvent.addItemToGrangeDisplay(new Object(Convert.ToInt32(array[1]), Convert.ToInt32(array[2]), false, -1, 0), num, true); } } break; case 4: Game1.CurrentEvent.grangeScore = Convert.ToInt32(message); Game1.ChatBox.receiveChatMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:MultiplayerUtility.cs.12488", new object[0]), -1L); Game1.CurrentEvent.interpretGrangeResults(); break; case 5: if (!Game1.player.mailReceived.Contains(message)) { Game1.player.mailReceived.Add(message); } break; case 6: (Game1.getLocationFromName("CommunityCenter") as CommunityCenter).completeBundle(Convert.ToInt32(message)); break; case 7: Game1.addMailForTomorrow(message, false, false); break; } if (Game1.IsServer) { MultiplayerUtility.sendMessageToEveryone(messageCategory, message, who); } }
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 void addNewHatchedAnimal(string name) { if (this.getBuilding() is Coop) { using (Dictionary <Vector2, Object> .ValueCollection.Enumerator enumerator = this.objects.Values.GetEnumerator()) { while (enumerator.MoveNext()) { Object current = enumerator.Current; if (current.bigCraftable && current.Name.Contains("Incubator") && current.heldObject != null && current.minutesUntilReady <= 0 && !this.isFull()) { string type = "??"; if (current.heldObject == null) { type = "White Chicken"; } else { int num = current.heldObject.ParentSheetIndex; if (num <= 176) { if (num != 107) { if (num == 174 || num == 176) { type = "White Chicken"; } } else { type = "Dinosaur"; } } else if (num <= 182) { if (num == 180 || num == 182) { type = "Brown Chicken"; } } else if (num != 305) { if (num == 442) { type = "Duck"; } } else { type = "Void Chicken"; } } FarmAnimal farmAnimal = new FarmAnimal(type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); farmAnimal.name = name; farmAnimal.displayName = name; Building building = this.getBuilding(); farmAnimal.home = building; farmAnimal.homeLocation = new Vector2((float)building.tileX, (float)building.tileY); farmAnimal.setRandomPosition(farmAnimal.home.indoors); (building.indoors as AnimalHouse).animals.Add(farmAnimal.myID, farmAnimal); (building.indoors as AnimalHouse).animalsThatLiveHere.Add(farmAnimal.myID); current.heldObject = null; current.ParentSheetIndex = 101; break; } } goto IL_2D6; } } if (Game1.farmEvent != null && Game1.farmEvent is QuestionEvent) { FarmAnimal farmAnimal2 = new FarmAnimal((Game1.farmEvent as QuestionEvent).animal.type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); farmAnimal2.name = name; farmAnimal2.displayName = name; farmAnimal2.parentId = (Game1.farmEvent as QuestionEvent).animal.myID; Building building2 = this.getBuilding(); farmAnimal2.home = building2; farmAnimal2.homeLocation = new Vector2((float)building2.tileX, (float)building2.tileY); (Game1.farmEvent as QuestionEvent).forceProceed = true; farmAnimal2.setRandomPosition(farmAnimal2.home.indoors); (building2.indoors as AnimalHouse).animals.Add(farmAnimal2.myID, farmAnimal2); (building2.indoors as AnimalHouse).animalsThatLiveHere.Add(farmAnimal2.myID); } IL_2D6: if (Game1.currentLocation.currentEvent != null) { Event expr_2EC = Game1.currentLocation.currentEvent; int num = expr_2EC.CurrentCommand; expr_2EC.CurrentCommand = num + 1; } Game1.exitActiveMenu(); }
public void addNewHatchedAnimal(string name) { if (this.getBuilding() is Coop) { foreach (Object @object in this.objects.Values) { if (@object.bigCraftable && @object.Name.Contains("Incubator") && (@object.heldObject != null && @object.minutesUntilReady <= 0) && !this.isFull()) { string type = "??"; if (@object.heldObject == null) { type = "White Chicken"; } else { switch (@object.heldObject.ParentSheetIndex) { case 305: type = "Void Chicken"; break; case 442: type = "Duck"; break; case 180: case 182: type = "Brown Chicken"; break; case 107: type = "Dinosaur"; break; case 174: case 176: type = "White Chicken"; break; } } FarmAnimal farmAnimal = new FarmAnimal(type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); farmAnimal.name = name; farmAnimal.displayName = name; Building building = this.getBuilding(); farmAnimal.home = building; farmAnimal.homeLocation = new Vector2((float)building.tileX, (float)building.tileY); farmAnimal.setRandomPosition(farmAnimal.home.indoors); (building.indoors as AnimalHouse).animals.Add(farmAnimal.myID, farmAnimal); (building.indoors as AnimalHouse).animalsThatLiveHere.Add(farmAnimal.myID); @object.heldObject = (Object)null; @object.ParentSheetIndex = 101; break; } } } else if (Game1.farmEvent != null && Game1.farmEvent is QuestionEvent) { FarmAnimal farmAnimal = new FarmAnimal((Game1.farmEvent as QuestionEvent).animal.type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID); farmAnimal.name = name; farmAnimal.displayName = name; farmAnimal.parentId = (Game1.farmEvent as QuestionEvent).animal.myID; Building building = this.getBuilding(); farmAnimal.home = building; farmAnimal.homeLocation = new Vector2((float)building.tileX, (float)building.tileY); (Game1.farmEvent as QuestionEvent).forceProceed = true; farmAnimal.setRandomPosition(farmAnimal.home.indoors); (building.indoors as AnimalHouse).animals.Add(farmAnimal.myID, farmAnimal); (building.indoors as AnimalHouse).animalsThatLiveHere.Add(farmAnimal.myID); } if (Game1.currentLocation.currentEvent != null) { ++Game1.currentLocation.currentEvent.CurrentCommand; } Game1.exitActiveMenu(); }
public virtual void update(GameTime time, GameLocation location, long id, bool move) { if (this.yJumpOffset != 0) { this.yJumpVelocity -= 0.5f; this.yJumpOffset -= (int)this.yJumpVelocity; if (this.yJumpOffset >= 0) { this.yJumpOffset = 0; this.yJumpVelocity = 0f; if (!this.IsMonster && (location == null || location.Equals(Game1.currentLocation))) { FarmerSprite.checkForFootstep(this); } } } if (this.faceTowardFarmerTimer > 0) { this.faceTowardFarmerTimer -= time.ElapsedGameTime.Milliseconds; if (!this.faceTowardFarmer && this.faceTowardFarmerTimer > 0 && Utility.tileWithinRadiusOfPlayer((int)this.getTileLocation().X, (int)this.getTileLocation().Y, this.faceTowardFarmerRadius, this.whoToFace)) { this.faceTowardFarmer = true; } else if (!Utility.tileWithinRadiusOfPlayer((int)this.getTileLocation().X, (int)this.getTileLocation().Y, this.faceTowardFarmerRadius, this.whoToFace) || this.faceTowardFarmerTimer <= 0) { this.faceDirection(this.facingDirectionBeforeSpeakingToPlayer); if (this.faceTowardFarmerTimer <= 0) { this.facingDirectionBeforeSpeakingToPlayer = -1; this.faceTowardFarmer = false; this.faceAwayFromFarmer = false; this.faceTowardFarmerTimer = 0; } } } if (this.forceUpdateTimer > 0) { this.forceUpdateTimer -= time.ElapsedGameTime.Milliseconds; } this.updateGlow(); this.updateEmote(time); if (!Game1.IsMultiplayer || Game1.IsServer || this.ignoreMultiplayerUpdates) { if (this.faceTowardFarmer && this.whoToFace != null) { this.faceGeneralDirection(this.whoToFace.getStandingPosition(), 0); if (this.faceAwayFromFarmer) { this.faceDirection((this.facingDirection + 2) % 4); } } if ((this.controller == null & move) && !this.freezeMotion) { this.updateMovement(location, time); } if (this.controller != null && !this.freezeMotion && this.controller.update(time)) { this.controller = null; } if (Game1.IsServer && !Game1.isFestival() && Game1.random.NextDouble() < 0.2) { MultiplayerUtility.broadcastNPCMove((int)this.position.X, (int)this.position.Y, id, location); return; } } else if (!Game1.eventUp) { this.lerpPosition(this.positionToLerpTo); if (this.distanceFromLastServerPosition() >= 8f) { this.animateInFacingDirection(time); } } }
// Token: 0x0600018E RID: 398 RVA: 0x00011DF8 File Offset: 0x0000FFF8 public bool updateChunks(GameTime time) { this.timeSinceDoneBouncing += (float)time.ElapsedGameTime.Milliseconds; if (this.timeSinceDoneBouncing >= (this.floppingFish ? 2500f : ((this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS) ? 1800f : 600f))) { if (this.debrisType == Debris.DebrisType.LETTERS || this.debrisType == Debris.DebrisType.NUMBERS || this.debrisType == Debris.DebrisType.SQUARES || this.debrisType == Debris.DebrisType.SPRITECHUNKS || (this.debrisType == Debris.DebrisType.CHUNKS && this.chunks[0].debrisType - this.chunks[0].debrisType % 2 != 8)) { return(true); } if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT || this.debrisType == Debris.DebrisType.RESOURCE || this.debrisType == Debris.DebrisType.CHUNKS) { this.chunksMoveTowardPlayer = true; } this.timeSinceDoneBouncing = 0f; } for (int i = this.chunks.Count - 1; i >= 0; i--) { if (this.chunks[i].alpha > 0.1f && (this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS) && this.timeSinceDoneBouncing > 600f) { this.chunks[i].alpha = (1800f - this.timeSinceDoneBouncing) / 1000f; } if (this.chunks[i].position.X < (float)(-(float)Game1.tileSize * 2) || this.chunks[i].position.Y < (float)(-(float)Game1.tileSize) || this.chunks[i].position.X >= (float)(Game1.currentLocation.map.DisplayWidth + Game1.tileSize) || this.chunks[i].position.Y >= (float)(Game1.currentLocation.map.DisplayHeight + Game1.tileSize)) { this.chunks.RemoveAt(i); } else { bool canMoveTowardPlayer = Math.Abs(this.chunks[i].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= (float)Game1.player.MagneticRadius && Math.Abs(this.chunks[i].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= (float)Game1.player.MagneticRadius; if (canMoveTowardPlayer) { switch (this.debrisType) { case Debris.DebrisType.ARCHAEOLOGY: case Debris.DebrisType.OBJECT: if (this.item != null) { canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisItem(this.item); goto IL_338; } canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisObject(this.chunks[i].debrisType, 1, this.itemQuality); if (this.chunks[i].debrisType == 102 && Game1.activeClickableMenu != null) { canMoveTowardPlayer = false; goto IL_338; } goto IL_338; case Debris.DebrisType.RESOURCE: canMoveTowardPlayer = Game1.player.couldInventoryAcceptThisObject(this.chunks[i].debrisType - this.chunks[i].debrisType % 2, 1, 0); goto IL_338; } canMoveTowardPlayer = true; } IL_338: if ((this.chunksMoveTowardPlayer || this.isFishable) & canMoveTowardPlayer) { if (this.chunks[i].position.X < Game1.player.position.X - 12f) { this.chunks[i].xVelocity = Math.Min(this.chunks[i].xVelocity + 0.8f, 8f); } else if (this.chunks[i].position.X > Game1.player.position.X + 12f) { this.chunks[i].xVelocity = Math.Max(this.chunks[i].xVelocity - 0.8f, -8f); } if (this.chunks[i].position.Y + (float)(Game1.tileSize / 2) < (float)(Game1.player.getStandingY() - 12)) { this.chunks[i].yVelocity = Math.Max(this.chunks[i].yVelocity - 0.8f, -8f); } else if (this.chunks[i].position.Y + (float)(Game1.tileSize / 2) > (float)(Game1.player.getStandingY() + 12)) { this.chunks[i].yVelocity = Math.Min(this.chunks[i].yVelocity + 0.8f, 8f); } Chunk expr_4EA_cp_0_cp_0 = this.chunks[i]; expr_4EA_cp_0_cp_0.position.X = expr_4EA_cp_0_cp_0.position.X + this.chunks[i].xVelocity; Chunk expr_515_cp_0_cp_0 = this.chunks[i]; expr_515_cp_0_cp_0.position.Y = expr_515_cp_0_cp_0.position.Y - this.chunks[i].yVelocity; if (Math.Abs(this.chunks[i].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= 64f && Math.Abs(this.chunks[i].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= 64f) { int switcher = (this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT) ? this.chunks[i].debrisType : (this.chunks[i].debrisType - this.chunks[i].debrisType % 2); if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY) { Game1.farmerFindsArtifact(this.chunks[i].debrisType); } else if (this.item != null) { if (!Game1.player.addItemToInventoryBool(this.item, false)) { goto IL_1077; } } else if (this.debrisType != Debris.DebrisType.CHUNKS || switcher != 8) { if (switcher <= -10000) { if (!Game1.player.addItemToInventoryBool(new MeleeWeapon(switcher), false)) { goto IL_1077; } } else if (switcher <= 0) { if (!Game1.player.addItemToInventoryBool(new Object(Vector2.Zero, -switcher, false), false)) { goto IL_1077; } } else { Farmer arg_6C2_0 = Game1.player; Object arg_6C2_1; if (switcher != 93 && switcher != 94) { (arg_6C2_1 = new Object(Vector2.Zero, switcher, 1)).quality = this.itemQuality; } else { arg_6C2_1 = new Torch(Vector2.Zero, 1, switcher); } if (!arg_6C2_0.addItemToInventoryBool(arg_6C2_1, false)) { goto IL_1077; } } } if (Game1.debrisSoundInterval <= 0f) { Game1.debrisSoundInterval = 10f; Game1.playSound("coin"); } if (Game1.IsMultiplayer) { MultiplayerUtility.broadcastDebrisPickup(this.uniqueID, Game1.currentLocation.name, Game1.player.uniqueMultiplayerID); } this.chunks.RemoveAt(i); } } else { if (this.debrisType == Debris.DebrisType.NUMBERS && this.toHover != null) { this.relativeXPosition += this.chunks[i].xVelocity; this.chunks[i].position.X = this.toHover.position.X + (float)(Game1.tileSize / 2) + this.relativeXPosition; this.chunks[i].scale = Math.Min(2f, Math.Max(1f, 0.9f + Math.Abs(this.chunks[i].position.Y - (float)this.chunkFinalYLevel) / ((float)Game1.tileSize * 2f))); this.chunkFinalYLevel = this.toHover.getStandingY() + 8; if (this.timeSinceDoneBouncing > 250f) { this.chunks[i].alpha = Math.Max(0f, this.chunks[i].alpha - 0.033f); } if (!this.toHover.Equals(Game1.player) && !this.nonSpriteChunkColor.Equals(Color.Yellow) && !this.nonSpriteChunkColor.Equals(Color.Green)) { this.nonSpriteChunkColor.R = (byte)Math.Max((double)Math.Min(255, 200 + this.chunkType), Math.Min((double)Math.Min(255, 220 + this.chunkType), 400.0 * Math.Sin((double)this.timeSinceDoneBouncing / 804.247719318987 + 0.26179938779914941))); this.nonSpriteChunkColor.G = (byte)Math.Max((double)(150 - this.chunkType), Math.Min((double)(255 - this.chunkType), (this.nonSpriteChunkColor.R > 220) ? (300.0 * Math.Sin((double)this.timeSinceDoneBouncing / 804.247719318987 + 0.26179938779914941)) : 0.0)); this.nonSpriteChunkColor.B = (byte)Math.Max(0, Math.Min(255, (int)((this.nonSpriteChunkColor.G > 200) ? (this.nonSpriteChunkColor.G - 20) : 0))); } } Chunk expr_9B4_cp_0_cp_0 = this.chunks[i]; expr_9B4_cp_0_cp_0.position.X = expr_9B4_cp_0_cp_0.position.X + this.chunks[i].xVelocity; Chunk expr_9DF_cp_0_cp_0 = this.chunks[i]; expr_9DF_cp_0_cp_0.position.Y = expr_9DF_cp_0_cp_0.position.Y - this.chunks[i].yVelocity; if (this.movingFinalYLevel) { this.chunkFinalYLevel -= (int)Math.Ceiling((double)(this.chunks[i].yVelocity / 2f)); if (this.chunkFinalYLevel <= this.chunkFinalYTarget) { this.chunkFinalYLevel = this.chunkFinalYTarget; this.movingFinalYLevel = false; } } if (this.debrisType == Debris.DebrisType.SQUARES && this.chunks[i].position.Y < (float)(this.chunkFinalYLevel - Game1.tileSize * 3 / 2) && Game1.random.NextDouble() < 0.1) { this.chunks[i].position.Y = (float)(this.chunkFinalYLevel - Game1.random.Next(1, Game1.tileSize / 3)); this.chunks[i].yVelocity = (float)Game1.random.Next(30, 80) / 40f; this.chunks[i].position.X = (float)Game1.random.Next((int)(this.chunks[i].position.X - this.chunks[i].position.X % (float)Game1.tileSize + 1f), (int)(this.chunks[i].position.X - this.chunks[i].position.X % (float)Game1.tileSize + 64f)); } if (this.debrisType != Debris.DebrisType.SQUARES) { this.chunks[i].yVelocity -= 0.4f; } bool destroyThisChunk = false; if (this.chunks[i].position.Y >= (float)this.chunkFinalYLevel && this.chunks[i].hasPassedRestingLineOnce && this.chunks[i].bounces <= (this.floppingFish ? 65 : 2)) { if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.NUMBERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && (this.debrisType != Debris.DebrisType.CHUNKS || this.chunks[i].debrisType - this.chunks[i].debrisType % 2 == 8)) { Game1.playSound("shiny4"); } this.chunks[i].bounces++; if (this.floppingFish) { this.chunks[i].yVelocity = Math.Abs(this.chunks[i].yVelocity) * ((this.movingUp && this.chunks[i].bounces < 2) ? 0.6f : 0.9f); this.chunks[i].xVelocity = (float)Game1.random.Next(-250, 250) / 100f; } else { this.chunks[i].yVelocity = Math.Abs(this.chunks[i].yVelocity * 2f / 3f); this.chunks[i].rotationVelocity = ((Game1.random.NextDouble() < 0.5) ? (this.chunks[i].rotationVelocity / 2f) : (-this.chunks[i].rotationVelocity * 2f / 3f)); this.chunks[i].xVelocity -= this.chunks[i].xVelocity / 2f; } if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && this.debrisType != Debris.DebrisType.NUMBERS && Game1.currentLocation.doesTileHaveProperty((int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), "Water", "Back") != null) { Game1.currentLocation.TemporarySprites.Add(new TemporaryAnimatedSprite(28, 300f, 2, 1, this.chunks[i].position, false, false)); Game1.playSound("dropItemInWater"); destroyThisChunk = true; } } if ((!this.chunks[i].hitWall && Game1.currentLocation.Map.GetLayer("Buildings").Tiles[(int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize)] != null) || Game1.currentLocation.Map.GetLayer("Back").Tiles[(int)((this.chunks[i].position.X + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize), (int)((this.chunks[i].position.Y + (float)(Game1.tileSize / 2)) / (float)Game1.tileSize)] == null) { this.chunks[i].xVelocity = -this.chunks[i].xVelocity; this.chunks[i].hitWall = true; } if (this.chunks[i].position.Y < (float)this.chunkFinalYLevel) { this.chunks[i].hasPassedRestingLineOnce = true; } if (this.chunks[i].bounces > (this.floppingFish ? 65 : 2)) { this.chunks[i].yVelocity = 0f; this.chunks[i].xVelocity = 0f; this.chunks[i].rotationVelocity = 0f; } this.chunks[i].rotation += this.chunks[i].rotationVelocity; if (destroyThisChunk) { this.chunks.RemoveAt(i); } } } IL_1077 :; } return(this.chunks.Count == 0); }
public bool updateChunks(GameTime time) { this.timeSinceDoneBouncing = this.timeSinceDoneBouncing + (float)time.ElapsedGameTime.Milliseconds; if ((double)this.timeSinceDoneBouncing >= (this.floppingFish ? 2500.0 : (this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS ? 1800.0 : 600.0))) { if (this.debrisType == Debris.DebrisType.LETTERS || this.debrisType == Debris.DebrisType.NUMBERS || (this.debrisType == Debris.DebrisType.SQUARES || this.debrisType == Debris.DebrisType.SPRITECHUNKS) || this.debrisType == Debris.DebrisType.CHUNKS && this.chunks[0].debrisType - this.chunks[0].debrisType % 2 != 8) { return(true); } if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT || (this.debrisType == Debris.DebrisType.RESOURCE || this.debrisType == Debris.DebrisType.CHUNKS)) { this.chunksMoveTowardPlayer = true; } this.timeSinceDoneBouncing = 0.0f; } for (int index = this.chunks.Count - 1; index >= 0; --index) { if ((double)this.chunks[index].alpha > 0.100000001490116 && (this.debrisType == Debris.DebrisType.SPRITECHUNKS || this.debrisType == Debris.DebrisType.NUMBERS) && (double)this.timeSinceDoneBouncing > 600.0) { this.chunks[index].alpha = (float)((1800.0 - (double)this.timeSinceDoneBouncing) / 1000.0); } if ((double)this.chunks[index].position.X < (double)(-Game1.tileSize * 2) || (double)this.chunks[index].position.Y < (double)-Game1.tileSize || ((double)this.chunks[index].position.X >= (double)(Game1.currentLocation.map.DisplayWidth + Game1.tileSize) || (double)this.chunks[index].position.Y >= (double)(Game1.currentLocation.map.DisplayHeight + Game1.tileSize))) { this.chunks.RemoveAt(index); } else { bool flag1 = (double)Math.Abs(this.chunks[index].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= (double)Game1.player.MagneticRadius && (double)Math.Abs(this.chunks[index].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= (double)Game1.player.MagneticRadius; if (flag1) { switch (this.debrisType) { case Debris.DebrisType.ARCHAEOLOGY: case Debris.DebrisType.OBJECT: if (this.item != null) { flag1 = Game1.player.couldInventoryAcceptThisItem(this.item); break; } flag1 = Game1.player.couldInventoryAcceptThisObject(this.chunks[index].debrisType, 1, this.itemQuality); if (this.chunks[index].debrisType == 102 && Game1.activeClickableMenu != null) { flag1 = false; break; } break; case Debris.DebrisType.RESOURCE: flag1 = Game1.player.couldInventoryAcceptThisObject(this.chunks[index].debrisType - this.chunks[index].debrisType % 2, 1, 0); break; default: flag1 = true; break; } } if (((this.chunksMoveTowardPlayer ? 1 : (this.isFishable ? 1 : 0)) & (flag1 ? 1 : 0)) != 0) { if ((double)this.chunks[index].position.X < (double)Game1.player.position.X - 12.0) { this.chunks[index].xVelocity = Math.Min(this.chunks[index].xVelocity + 0.8f, 8f); } else if ((double)this.chunks[index].position.X > (double)Game1.player.position.X + 12.0) { this.chunks[index].xVelocity = Math.Max(this.chunks[index].xVelocity - 0.8f, -8f); } if ((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2) < (double)(Game1.player.getStandingY() - 12)) { this.chunks[index].yVelocity = Math.Max(this.chunks[index].yVelocity - 0.8f, -8f); } else if ((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2) > (double)(Game1.player.getStandingY() + 12)) { this.chunks[index].yVelocity = Math.Min(this.chunks[index].yVelocity + 0.8f, 8f); } this.chunks[index].position.X += this.chunks[index].xVelocity; this.chunks[index].position.Y -= this.chunks[index].yVelocity; if ((double)Math.Abs(this.chunks[index].position.X + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingX()) <= 64.0 && (double)Math.Abs(this.chunks[index].position.Y + (float)(Game1.tileSize / 2) - (float)Game1.player.getStandingY()) <= 64.0) { int num1 = this.debrisType == Debris.DebrisType.ARCHAEOLOGY || this.debrisType == Debris.DebrisType.OBJECT ? this.chunks[index].debrisType : this.chunks[index].debrisType - this.chunks[index].debrisType % 2; if (this.debrisType == Debris.DebrisType.ARCHAEOLOGY) { Game1.farmerFindsArtifact(this.chunks[index].debrisType); } else if (this.item != null) { if (!Game1.player.addItemToInventoryBool(this.item, false)) { continue; } } else if (this.debrisType != Debris.DebrisType.CHUNKS || num1 != 8) { if (num1 <= -10000) { if (!Game1.player.addItemToInventoryBool((Item) new MeleeWeapon(num1), false)) { continue; } } else if (num1 <= 0) { if (!Game1.player.addItemToInventoryBool((Item) new Object(Vector2.Zero, -num1, false), false)) { continue; } } else { Farmer player = Game1.player; Object @object; if (num1 != 93 && num1 != 94) { @object = new Object(Vector2.Zero, num1, 1) { quality = this.itemQuality } } ; else { @object = (Object) new Torch(Vector2.Zero, 1, num1); } int num2 = 0; if (!player.addItemToInventoryBool((Item)@object, num2 != 0)) { continue; } } } if ((double)Game1.debrisSoundInterval <= 0.0) { Game1.debrisSoundInterval = 10f; Game1.playSound("coin"); } if (Game1.IsMultiplayer) { MultiplayerUtility.broadcastDebrisPickup(this.uniqueID, Game1.currentLocation.name, Game1.player.uniqueMultiplayerID); } this.chunks.RemoveAt(index); } } else { if (this.debrisType == Debris.DebrisType.NUMBERS && this.toHover != null) { this.relativeXPosition = this.relativeXPosition + this.chunks[index].xVelocity; this.chunks[index].position.X = this.toHover.position.X + (float)(Game1.tileSize / 2) + this.relativeXPosition; this.chunks[index].scale = Math.Min(2f, Math.Max(1f, (float)(0.899999976158142 + (double)Math.Abs(this.chunks[index].position.Y - (float)this.chunkFinalYLevel) / ((double)Game1.tileSize * 2.0)))); this.chunkFinalYLevel = this.toHover.getStandingY() + 8; if ((double)this.timeSinceDoneBouncing > 250.0) { this.chunks[index].alpha = Math.Max(0.0f, this.chunks[index].alpha - 0.033f); } if (!this.toHover.Equals((object)Game1.player) && !this.nonSpriteChunkColor.Equals(Color.Yellow) && !this.nonSpriteChunkColor.Equals(Color.Green)) { this.nonSpriteChunkColor.R = (byte)Math.Max((double)Math.Min((int)byte.MaxValue, 200 + this.chunkType), Math.Min((double)Math.Min((int)byte.MaxValue, 220 + this.chunkType), 400.0 * Math.Sin((double)this.timeSinceDoneBouncing / (256.0 * Math.PI) + Math.PI / 12.0))); this.nonSpriteChunkColor.G = (byte)Math.Max((double)(150 - this.chunkType), Math.Min((double)((int)byte.MaxValue - this.chunkType), (int)this.nonSpriteChunkColor.R > 220 ? 300.0 * Math.Sin((double)this.timeSinceDoneBouncing / (256.0 * Math.PI) + Math.PI / 12.0) : 0.0)); this.nonSpriteChunkColor.B = (byte)Math.Max(0, Math.Min((int)byte.MaxValue, (int)this.nonSpriteChunkColor.G > 200 ? (int)this.nonSpriteChunkColor.G - 20 : 0)); } } this.chunks[index].position.X += this.chunks[index].xVelocity; this.chunks[index].position.Y -= this.chunks[index].yVelocity; if (this.movingFinalYLevel) { this.chunkFinalYLevel = this.chunkFinalYLevel - (int)Math.Ceiling((double)this.chunks[index].yVelocity / 2.0); if (this.chunkFinalYLevel <= this.chunkFinalYTarget) { this.chunkFinalYLevel = this.chunkFinalYTarget; this.movingFinalYLevel = false; } } if (this.debrisType == Debris.DebrisType.SQUARES && (double)this.chunks[index].position.Y < (double)(this.chunkFinalYLevel - Game1.tileSize * 3 / 2) && Game1.random.NextDouble() < 0.1) { this.chunks[index].position.Y = (float)(this.chunkFinalYLevel - Game1.random.Next(1, Game1.tileSize / 3)); this.chunks[index].yVelocity = (float)Game1.random.Next(30, 80) / 40f; this.chunks[index].position.X = (float)Game1.random.Next((int)((double)this.chunks[index].position.X - (double)this.chunks[index].position.X % (double)Game1.tileSize + 1.0), (int)((double)this.chunks[index].position.X - (double)this.chunks[index].position.X % (double)Game1.tileSize + 64.0)); } if (this.debrisType != Debris.DebrisType.SQUARES) { this.chunks[index].yVelocity -= 0.4f; } bool flag2 = false; if ((double)this.chunks[index].position.Y >= (double)this.chunkFinalYLevel && this.chunks[index].hasPassedRestingLineOnce && this.chunks[index].bounces <= (this.floppingFish ? 65 : 2)) { if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.NUMBERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && (this.debrisType != Debris.DebrisType.CHUNKS || this.chunks[index].debrisType - this.chunks[index].debrisType % 2 == 8)) { Game1.playSound("shiny4"); } ++this.chunks[index].bounces; if (this.floppingFish) { this.chunks[index].yVelocity = Math.Abs(this.chunks[index].yVelocity) * (!this.movingUp || this.chunks[index].bounces >= 2 ? 0.9f : 0.6f); this.chunks[index].xVelocity = (float)Game1.random.Next(-250, 250) / 100f; } else { this.chunks[index].yVelocity = Math.Abs((float)((double)this.chunks[index].yVelocity * 2.0 / 3.0)); this.chunks[index].rotationVelocity = Game1.random.NextDouble() < 0.5 ? this.chunks[index].rotationVelocity / 2f : (float)(-(double)this.chunks[index].rotationVelocity * 2.0 / 3.0); this.chunks[index].xVelocity -= this.chunks[index].xVelocity / 2f; } if (this.debrisType != Debris.DebrisType.LETTERS && this.debrisType != Debris.DebrisType.SPRITECHUNKS && (this.debrisType != Debris.DebrisType.NUMBERS && Game1.currentLocation.doesTileHaveProperty((int)(((double)this.chunks[index].position.X + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize), (int)(((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize), "Water", "Back") != null)) { Game1.currentLocation.TemporarySprites.Add(new TemporaryAnimatedSprite(28, 300f, 2, 1, this.chunks[index].position, false, false)); Game1.playSound("dropItemInWater"); flag2 = true; } } if (!this.chunks[index].hitWall && Game1.currentLocation.Map.GetLayer("Buildings").Tiles[(int)(((double)this.chunks[index].position.X + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize), (int)(((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize)] != null || Game1.currentLocation.Map.GetLayer("Back").Tiles[(int)(((double)this.chunks[index].position.X + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize), (int)(((double)this.chunks[index].position.Y + (double)(Game1.tileSize / 2)) / (double)Game1.tileSize)] == null) { this.chunks[index].xVelocity = -this.chunks[index].xVelocity; this.chunks[index].hitWall = true; } if ((double)this.chunks[index].position.Y < (double)this.chunkFinalYLevel) { this.chunks[index].hasPassedRestingLineOnce = true; } if (this.chunks[index].bounces > (this.floppingFish ? 65 : 2)) { this.chunks[index].yVelocity = 0.0f; this.chunks[index].xVelocity = 0.0f; this.chunks[index].rotationVelocity = 0.0f; } this.chunks[index].rotation += this.chunks[index].rotationVelocity; if (flag2) { this.chunks.RemoveAt(index); } } } } return(this.chunks.Count == 0); }