diff --git a/Discord/EliteAPI.Discord/EliteDangerousApiDiscordRichPresence.cs b/Discord/EliteAPI.Discord/EliteDangerousApiDiscordRichPresence.cs index beafefa1..96f28f07 100644 --- a/Discord/EliteAPI.Discord/EliteDangerousApiDiscordRichPresence.cs +++ b/Discord/EliteAPI.Discord/EliteDangerousApiDiscordRichPresence.cs @@ -50,6 +50,7 @@ public async Task StartAsync() _api.Events.On(OnMarketBuy); _api.Events.On(OnMarketSell); _api.Events.On(OnDestinationStatus); + _api.Events.On(OnUnderAttack); _api.Events.On(OnShutdown); _api.Events.On(e => @@ -432,6 +433,25 @@ private void OnDestinationStatus(DestinationStatusEvent @event, EventContext con }); } + private void OnUnderAttack(UnderAttackEvent @event, EventContext context) + { + if (context.IsRaisedDuringCatchup) + return; + + _client.SetPresence(new RichPresence + { + Details = "In active combat", + State = $"near {_currentBody}", + Assets = new Assets + { + LargeImageKey = "combat", + SmallImageKey = "ed", + SmallImageText = "EliteAPI" + }, + Timestamps = new Timestamps { Start = _playingSince } + }); + } + private void OnShutdown(ShutdownEvent @event, EventContext context) { if (context.IsRaisedDuringCatchup)