2024-04-20 22:32:28 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using EFT;
|
2024-05-21 19:10:17 +01:00
|
|
|
using SPT.Common.Http;
|
|
|
|
using SPT.Common.Utils;
|
|
|
|
using SPT.Custom.Models;
|
2024-04-20 22:32:28 +00:00
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
namespace SPT.Custom.Utils
|
2024-04-20 22:32:28 +00:00
|
|
|
{
|
|
|
|
public static class DifficultyManager
|
|
|
|
{
|
2024-04-28 08:17:13 +00:00
|
|
|
public static Dictionary<string, DifficultyInfo> Difficulties { get; private set; }
|
2024-04-20 22:32:28 +00:00
|
|
|
|
|
|
|
static DifficultyManager()
|
|
|
|
{
|
2024-04-28 08:17:13 +00:00
|
|
|
Difficulties = new Dictionary<string, DifficultyInfo>();
|
2024-04-20 22:32:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void Update()
|
|
|
|
{
|
|
|
|
// remove existing list
|
|
|
|
Difficulties.Clear();
|
|
|
|
|
|
|
|
// get new difficulties
|
|
|
|
var json = RequestHandler.GetJson("/singleplayer/settings/bot/difficulties");
|
2024-04-28 08:17:13 +00:00
|
|
|
Difficulties = Json.Deserialize<Dictionary<string, DifficultyInfo>>(json);
|
2024-04-20 22:32:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static string Get(BotDifficulty botDifficulty, WildSpawnType role)
|
|
|
|
{
|
2024-04-28 08:17:13 +00:00
|
|
|
var difficultyMatrix = Difficulties[role.ToString().ToLower()];
|
|
|
|
return Json.Serialize(difficultyMatrix[botDifficulty.ToString().ToLower()]);
|
2024-04-20 22:32:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|