0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/Aki.Custom/Utils/DifficultyManager.cs
kiobu cc2377bf72 fix: difficulties response parsing (!113)
fixed bot difficulties model to match server response for `/singleplayer/settings/bot/difficulties`
also bumps up the sptBear and sptUsec enums so they don't collide with new pmcUSEC and pmcBEAR

Reviewed-on: SPT-AKI/Modules#113
Co-authored-by: kiobu <kiobu@sdf.org>
Co-committed-by: kiobu <kiobu@sdf.org>
2024-04-28 08:17:13 +00:00

35 lines
1.0 KiB
C#

using System.Collections.Generic;
using EFT;
using Aki.Common.Http;
using Aki.Common.Utils;
using Aki.Custom.Models;
namespace Aki.Custom.Utils
{
public static class DifficultyManager
{
public static Dictionary<string, DifficultyInfo> Difficulties { get; private set; }
static DifficultyManager()
{
Difficulties = new Dictionary<string, DifficultyInfo>();
}
public static void Update()
{
// remove existing list
Difficulties.Clear();
// get new difficulties
var json = RequestHandler.GetJson("/singleplayer/settings/bot/difficulties");
Difficulties = Json.Deserialize<Dictionary<string, DifficultyInfo>>(json);
}
public static string Get(BotDifficulty botDifficulty, WildSpawnType role)
{
var difficultyMatrix = Difficulties[role.ToString().ToLower()];
return Json.Serialize(difficultyMatrix[botDifficulty.ToString().ToLower()]);
}
}
}