2018-02-10 23:33:42 -05:00
|
|
|
|
using SharedLibrary;
|
|
|
|
|
using SharedLibrary.Helpers;
|
|
|
|
|
using System;
|
2018-02-09 02:21:25 -05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace StatsPlugin.Helpers
|
|
|
|
|
{
|
|
|
|
|
public class StreakMessage
|
|
|
|
|
{
|
2018-02-10 23:33:42 -05:00
|
|
|
|
private ConfigurationManager config;
|
|
|
|
|
|
|
|
|
|
public StreakMessage(Server sv)
|
2018-02-09 02:21:25 -05:00
|
|
|
|
{
|
2018-02-10 23:33:42 -05:00
|
|
|
|
config = new ConfigurationManager(sv);
|
|
|
|
|
|
|
|
|
|
// initialize default messages
|
|
|
|
|
if (config.GetProperty<Dictionary<int, string>>("KillstreakMessages") == null)
|
2018-02-09 02:21:25 -05:00
|
|
|
|
{
|
2018-02-10 23:33:42 -05:00
|
|
|
|
var killstreakMessages = new Dictionary<int, string>()
|
|
|
|
|
{
|
2018-02-11 20:17:20 -05:00
|
|
|
|
{ -1, "Try not to kill yourself anymore" },
|
2018-02-10 23:33:42 -05:00
|
|
|
|
{ 5, "Great job! You're on a ^55 killstreak!" },
|
|
|
|
|
{ 10, "Amazing! ^510 kills ^7without dying!" },
|
2018-02-15 23:01:28 -05:00
|
|
|
|
{ 25, "You better call in that nuke, ^525 killstreak^7!" }
|
2018-02-10 23:33:42 -05:00
|
|
|
|
};
|
|
|
|
|
config.AddProperty(new KeyValuePair<string, object>("KillstreakMessages", killstreakMessages));
|
2018-02-09 02:21:25 -05:00
|
|
|
|
}
|
|
|
|
|
|
2018-02-10 23:33:42 -05:00
|
|
|
|
if (config.GetProperty<Dictionary<int, string>>("DeathstreakMessages") == null)
|
2018-02-09 02:21:25 -05:00
|
|
|
|
{
|
2018-02-10 23:33:42 -05:00
|
|
|
|
var deathstreakMessages = new Dictionary<int, string>()
|
|
|
|
|
{
|
|
|
|
|
{ 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<string, object>("DeathstreakMessages", deathstreakMessages));
|
2018-02-09 02:21:25 -05:00
|
|
|
|
}
|
2018-02-10 23:33:42 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a message from the configuration encouraging or discouraging clients
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="killStreak">how many kills the client has without dying</param>
|
|
|
|
|
/// <param name="deathStreak">how many deaths the client has without getting a kill</param>
|
|
|
|
|
/// <returns>message to send to the client</returns>
|
|
|
|
|
public string MessageOnStreak(int killStreak, int deathStreak)
|
|
|
|
|
{
|
|
|
|
|
var killstreakMessage = config.GetProperty<Dictionary<int, string>>("KillstreakMessages");
|
|
|
|
|
var deathstreakMessage = config.GetProperty<Dictionary<int, string>>("DeathstreakMessages");
|
|
|
|
|
|
|
|
|
|
string message = "";
|
|
|
|
|
|
|
|
|
|
if (killstreakMessage.ContainsKey(killStreak))
|
|
|
|
|
message =killstreakMessage[killStreak];
|
|
|
|
|
else if (deathstreakMessage.ContainsKey(deathStreak))
|
|
|
|
|
message = deathstreakMessage[deathStreak];
|
2018-02-09 02:21:25 -05:00
|
|
|
|
|
2018-02-10 23:33:42 -05:00
|
|
|
|
return message;
|
2018-02-09 02:21:25 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|