using SharedLibrary; using SharedLibrary.Helpers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace StatsPlugin.Helpers { public class StreakMessage { private ConfigurationManager config; public StreakMessage(Server sv) { config = new ConfigurationManager(sv); // initialize default messages if (config.GetProperty>("KillstreakMessages") == null) { var killstreakMessages = new Dictionary() { { -1, "Try not to kill yourself anymore" }, { 5, "Great job! You're on a ^55 killstreak!" }, { 10, "Amazing! ^510 kills ^7without dying!" }, { 25, "You better call in that nuke, ^525 killstreak!" } }; config.AddProperty(new KeyValuePair("KillstreakMessages", killstreakMessages)); } if (config.GetProperty>("DeathstreakMessages") == null) { var deathstreakMessages = new Dictionary() { { 5, "Pick it up soldier, you've died ^55 times ^7in a row..." }, { 10, "Seriously? ^510 deaths ^7without getting a kill?" }, }; config.AddProperty(new KeyValuePair("DeathstreakMessages", deathstreakMessages)); } } /// /// Get a message from the configuration encouraging or discouraging clients /// /// how many kills the client has without dying /// how many deaths the client has without getting a kill /// message to send to the client public string MessageOnStreak(int killStreak, int deathStreak) { var killstreakMessage = config.GetProperty>("KillstreakMessages"); var deathstreakMessage = config.GetProperty>("DeathstreakMessages"); string message = ""; if (killstreakMessage.ContainsKey(killStreak)) message =killstreakMessage[killStreak]; else if (deathstreakMessage.ContainsKey(deathStreak)) message = deathstreakMessage[deathStreak]; return message; } } }