/// <summary> /// Creates a payload from event args. /// </summary> /// <param name="e">Event args to construct from.</param> /// <returns>Constructed event payload.</returns> public static ProbePlayerEventPayload FromEventArgs(PlayerAsyncEventArgs e) => new ProbePlayerEventPayload { Id = e.Player.Id, Name = e.Player.Name, IsDead = e.Player.IsDead, IsImpostor = e.Player.IsImpostor };
private async Task Game_PlayerLeft(AmongUsGame sender, PlayerAsyncEventArgs e) { this.GameManager.RemovePlayer(e.Player.Name); var chn = this.GameManager.TextChannel; if (chn == 0ul) { return; } await this.DiscordBot.SendMessageAsync(chn, "Game ended"); }
private async Task Game_PlayerJoined(AmongUsGame sender, PlayerAsyncEventArgs e) { this.GameManager.AddPlayer(e.Player.Name); var chn = this.GameManager.TextChannel; if (chn == 0ul) { return; } await this.DiscordBot.SendMessageAsync(chn, $"New player: {e.Player.Name}"); }
private async Task Game_PlayerDied(AmongUsGame sender, PlayerAsyncEventArgs e) => await this.Comms.SendEventAsync(new ProbeEvent(ProbeEventType.PlayerDeath, ProbePlayerEventPayload.FromEventArgs(e)));
private Task Game_PlayerDied(AmongUsGame sender, PlayerAsyncEventArgs e) { this.GameManager.MarkDead(e.Player.Name); return(Task.CompletedTask); }