using Core.Annotations; using Core.Context; using Core.Controllers; using Core.Models.Eft.Bot; using Core.Models.Eft.Common; using Core.Models.Eft.Common.Tables; using Core.Models.Eft.HttpResponse; using Core.Models.Eft.Match; using Core.Utils; namespace Core.Callbacks; [Injectable(InjectableTypeOverride = typeof(BotCallbacks))] public class BotCallbacks { protected BotController _botController; protected HttpResponseUtil _httpResponseUtil; protected ApplicationContext _applicationContext; public BotCallbacks ( BotController botController, HttpResponseUtil httpResponseUtil, ApplicationContext applicationContext ) { _botController = botController; _httpResponseUtil = httpResponseUtil; _applicationContext = applicationContext; } /// /// Handle singleplayer/settings/bot/limit /// Is called by client to define each bot roles wave limit /// /// /// /// /// /// public string GetBotLimit(string url, EmptyRequestData info, string sessionID) { var splitUrl = url.Split('/'); var type = splitUrl[splitUrl.Length - 1]; return _httpResponseUtil.NoBody(_botController.GetBotPresetGenerationLimit(type)); } /// /// Handle singleplayer/settings/bot/difficulty /// /// /// /// /// public string GetBotDifficulty(string url, EmptyRequestData info, string sessionID) { var splitUrl = url.Split('/'); var type = splitUrl[splitUrl.Length - 2].ToLower(); var difficulty = splitUrl[splitUrl.Length - 1]; if (difficulty == "core") return _httpResponseUtil.NoBody(_botController.GetBotCoreDifficulty()); var raidConfig = _applicationContext.GetLatestValue(ContextVariableType.RAID_CONFIGURATION)?.GetValue(); return _httpResponseUtil.NoBody(_botController.GetBotDifficulty(type, difficulty, raidConfig)); } /// /// Handle singleplayer/settings/bot/difficulties /// /// /// /// /// public string GetAllBotDifficulties(string url, EmptyRequestData info, string sessionID) { return _httpResponseUtil.NoBody(_botController.GetAllBotDifficulties()); } /// /// Handle client/game/bot/generate /// /// /// /// /// public string GenerateBots(string url, GenerateBotsRequestData info, string sessionID) { return _httpResponseUtil.GetBody(_botController.Generate(sessionID, info)); } /// /// Handle singleplayer/settings/bot/maxCap /// /// public string GetBotCap(string url, EmptyRequestData info, string sessionID) { var splitUrl = url.Split('/'); var location = splitUrl[splitUrl.Length - 1]; return _httpResponseUtil.NoBody(_botController.GetBotCap(location)); } /// /// Handle singleplayer/settings/bot/getBotBehaviours /// /// public string GetBotBehaviours() { return _httpResponseUtil.NoBody(_botController.GetAiBotBrainTypes()); } }