Implement most of the callbacks, few other changes too
This commit is contained in:
@@ -1,44 +1,131 @@
|
||||
using Core.Models.Common;
|
||||
using Core.Context;
|
||||
using Core.Generators;
|
||||
using Core.Helpers;
|
||||
using Core.Models.Common;
|
||||
using Core.Models.Eft.Bot;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Eft.Match;
|
||||
using Core.Models.Enums;
|
||||
using Core.Models.Spt.Bots;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Servers;
|
||||
using Core.Services;
|
||||
using Core.Utils;
|
||||
using Core.Utils.Cloners;
|
||||
using Condition = Core.Models.Spt.Config.Condition;
|
||||
using ILogger = Core.Models.Utils.ILogger;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
public class BotController
|
||||
{
|
||||
private BotConfig _botConfig;
|
||||
private PmcConfig _pmcConfig;
|
||||
protected ILogger _logger;
|
||||
|
||||
public BotController()
|
||||
protected DatabaseService _databaseService;
|
||||
protected BotGenerator _botGenerator;
|
||||
protected BotHelper _botHelper;
|
||||
protected BotDifficultyHelper _botDifficultyHelper;
|
||||
protected WeightedRandomHelper _weightedRandomHelper;
|
||||
protected BotGenerationCacheService _botGenerationCacheService;
|
||||
protected MatchBotDeatilsCacheService _matchBotDeatilsCacheService;
|
||||
protected LocalisationService _localisationService;
|
||||
protected SeasonalEventService _seasonalEventService;
|
||||
protected ProfileHelper _profileHelper;
|
||||
protected ConfigServer _configServer;
|
||||
protected ApplicationContext _applicationContext;
|
||||
protected RandomUtil _randomUtil;
|
||||
protected ICloner _cloner;
|
||||
|
||||
protected BotConfig _botConfig;
|
||||
protected PmcConfig _pmcConfig;
|
||||
|
||||
public BotController
|
||||
(
|
||||
ILogger logger,
|
||||
DatabaseService databaseService,
|
||||
BotGenerator botGenerator,
|
||||
BotHelper botHelper,
|
||||
BotDifficultyHelper botDifficultyHelper,
|
||||
WeightedRandomHelper weightedRandomHelper,
|
||||
BotGenerationCacheService botGenerationCacheService,
|
||||
MatchBotDeatilsCacheService matchBotDeatilsCacheService,
|
||||
LocalisationService localisationService,
|
||||
SeasonalEventService seasonalEventService,
|
||||
ProfileHelper profileHelper,
|
||||
ConfigServer configServer,
|
||||
ApplicationContext applicationContext,
|
||||
RandomUtil randomUtil,
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
_logger = logger;
|
||||
_databaseService = databaseService;
|
||||
_botGenerator = botGenerator;
|
||||
_botHelper = botHelper;
|
||||
_botDifficultyHelper = botDifficultyHelper;
|
||||
_weightedRandomHelper = weightedRandomHelper;
|
||||
_botGenerationCacheService = botGenerationCacheService;
|
||||
_matchBotDeatilsCacheService = matchBotDeatilsCacheService;
|
||||
_localisationService = localisationService;
|
||||
_seasonalEventService = seasonalEventService;
|
||||
_profileHelper = profileHelper;
|
||||
_configServer = configServer;
|
||||
_applicationContext = applicationContext;
|
||||
_randomUtil = randomUtil;
|
||||
_cloner = cloner;
|
||||
_botConfig = _configServer.GetConfig<BotConfig>(ConfigTypes.BOT);
|
||||
_pmcConfig = _configServer.GetConfig<PmcConfig>(ConfigTypes.PMC);
|
||||
}
|
||||
|
||||
public int GetBotPresetGenerationLimit(string type)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var typeInLower = type.ToLower();
|
||||
var value = (int)typeof(PresetBatch).GetProperties().First(p => p.Name.ToLower() == (typeInLower == "assaultgroup" ? "assault" : typeInLower))
|
||||
.GetValue(_botConfig.PresetBatch);
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
_logger.Warning(_localisationService.GetText("bot-bot_preset_count_value_missing", type));
|
||||
return 30;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetBotCoreDifficulty()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return _databaseService.GetBots().Core;
|
||||
}
|
||||
|
||||
public object GetBotDifficulty(string type, string difficulty) // TODO: return type was: IBotCore | IDifficultyCategories
|
||||
public DifficultyCategories GetBotDifficulty(string type, string diffLevel, GetRaidConfigurationRequestData raidConfig, bool ignoreRaidSettings = false)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var difficulty = diffLevel.ToLower();
|
||||
|
||||
if (!(raidConfig != null || ignoreRaidSettings)) // TODD: this might be wrong logic
|
||||
_logger.Error(_localisationService.GetText("bot-missing_application_context", "RAID_CONFIGURATION"));
|
||||
|
||||
// Check value chosen in pre-raid difficulty dropdown
|
||||
// If value is not 'asonline', change requested difficulty to be what was chosen in dropdown
|
||||
var botDifficultyDropDownValue = raidConfig?.WavesSettings?.BotDifficulty?.ToString().ToLower() ?? "asonline";
|
||||
if (botDifficultyDropDownValue != "asonline")
|
||||
difficulty = _botDifficultyHelper.ConvertBotDifficultyDropdownToBotDifficulty(botDifficultyDropDownValue);
|
||||
|
||||
var botDb = _databaseService.GetBots();
|
||||
return _botDifficultyHelper.GetBotDifficultySettings(type, difficulty, botDb);
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetAllBotDifficulties()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var result = new Dictionary<string, object>();
|
||||
|
||||
var botTypesDb = _databaseService.GetBots().Types;
|
||||
// TODO: Come back to this, brainfuck
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<BotBase>> Generate(GenerateBotsRequestData info, bool playerscav)
|
||||
public List<BotBase> Generate(string sessionId, GenerateBotsRequestData info)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@@ -90,7 +177,7 @@ public class BotController
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetBotCap()
|
||||
public int GetBotCap(string location)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@@ -99,4 +186,4 @@ public class BotController
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user