IW4M-Admin/Plugins/Stats/Helpers/StreakMessage.cs

18 lines
577 B
C#
Raw Normal View History

2023-02-11 22:01:28 -05:00
using System.Linq;
using Stats.Config;
2023-02-11 22:01:28 -05:00
namespace IW4MAdmin.Plugins.Stats.Helpers;
public static class StreakMessage
{
2023-02-11 22:01:28 -05:00
public static string MessageOnStreak(int killStreak, int deathStreak, StatsConfiguration config)
{
2023-02-11 22:01:28 -05:00
var killstreakMessage = config.KillstreakMessages;
var deathstreakMessage = config.DeathstreakMessages;
2023-02-11 22:01:28 -05:00
var message = killstreakMessage?.FirstOrDefault(m => m.Count == killStreak)?.Message;
message ??= deathstreakMessage?.FirstOrDefault(m => m.Count == deathStreak)?.Message;
return message ?? "";
}
}