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 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; } }
// 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; } } }