public override void Receive(Farmer source, List <object> data) { Round round = ModEntry.BRGame.GetActiveRound(); long playerId = Convert.ToInt64(data[0]); bool status = Convert.ToBoolean(data[1]); Farmer player = Game1.getFarmer(playerId); if (playerId == Game1.player.UniqueMultiplayerID) { ModEntry.BRGame.isSpectating = status; } if (round != null && round.AlivePlayers.Contains(player) && Game1.player.UniqueMultiplayerID == playerId) { FarmerUtils.TakeDamage(Game1.player, DamageSource.WORLD, 1000); } if (status) { ModEntry.BRGame.spectatingPlayers.Add(playerId); } else { ModEntry.BRGame.spectatingPlayers.Remove(playerId); if (round != null && round.AlivePlayers.Count <= 1 && !ModEntry.BRGame.waitingForNextRoundToStart && Game1.IsServer) { round.HandleWin(null, null); } } }
public override void Receive(Farmer source, List <object> data) { DamageSource damageSource = (DamageSource)Convert.ToInt32(data[0]); int damage = Convert.ToInt32(data[1]); long? damagerID = null; string monster = ""; if (damageSource == DamageSource.PLAYER && data.Count == 3 && data[2] != null) { damagerID = Convert.ToInt64(data[2]); } if (damageSource == DamageSource.MONSTER && data.Count == 3 && data[2] != null) { monster = Convert.ToString(data[2]); } FarmerUtils.TakeDamage(Game1.player, damageSource, damage, damagerID, monster); }