Merge branch 'main' of https://github.com/sp-tarkov/server-csharp
# Conflicts: # Core/Services/BackupService.cs
This commit is contained in:
@@ -18,82 +18,38 @@ using Core.Utils.Cloners;
|
||||
namespace Core.Controllers;
|
||||
|
||||
[Injectable]
|
||||
public class BotController
|
||||
{
|
||||
protected ISptLogger<BotController> _logger;
|
||||
|
||||
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 MatchBotDetailsCacheService _matchBotDetailsCacheService;
|
||||
protected ProfileHelper _profileHelper;
|
||||
protected ConfigServer _configServer;
|
||||
protected ApplicationContext _applicationContext;
|
||||
protected RandomUtil _randomUtil;
|
||||
protected ICloner _cloner;
|
||||
|
||||
protected BotConfig _botConfig;
|
||||
protected PmcConfig _pmcConfig;
|
||||
|
||||
public BotController
|
||||
(
|
||||
ISptLogger<BotController> logger,
|
||||
DatabaseService databaseService,
|
||||
BotGenerator botGenerator,
|
||||
BotHelper botHelper,
|
||||
BotDifficultyHelper botDifficultyHelper,
|
||||
WeightedRandomHelper weightedRandomHelper,
|
||||
BotGenerationCacheService botGenerationCacheService,
|
||||
MatchBotDeatilsCacheService matchBotDeatilsCacheService,
|
||||
LocalisationService localisationService,
|
||||
SeasonalEventService seasonalEventService,
|
||||
MatchBotDetailsCacheService matchBotDetailsCacheService,
|
||||
ProfileHelper profileHelper,
|
||||
ConfigServer configServer,
|
||||
ApplicationContext applicationContext,
|
||||
RandomUtil randomUtil,
|
||||
ICloner cloner
|
||||
public class BotController(
|
||||
ISptLogger<BotController> _logger,
|
||||
DatabaseService _databaseService,
|
||||
BotGenerator _botGenerator,
|
||||
BotHelper _botHelper,
|
||||
BotDifficultyHelper _botDifficultyHelper,
|
||||
WeightedRandomHelper _weightedRandomHelper,
|
||||
BotGenerationCacheService _botGenerationCacheService,
|
||||
MatchBotDeatilsCacheService _matchBotDeatilsCacheService,
|
||||
LocalisationService _localisationService,
|
||||
SeasonalEventService _seasonalEventService,
|
||||
MatchBotDetailsCacheService _matchBotDetailsCacheService,
|
||||
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;
|
||||
_matchBotDetailsCacheService = matchBotDetailsCacheService;
|
||||
_profileHelper = profileHelper;
|
||||
_configServer = configServer;
|
||||
_applicationContext = applicationContext;
|
||||
_randomUtil = randomUtil;
|
||||
_cloner = cloner;
|
||||
_botConfig = _configServer.GetConfig<BotConfig>();
|
||||
_pmcConfig = _configServer.GetConfig<PmcConfig>();
|
||||
}
|
||||
{
|
||||
private readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
|
||||
private readonly PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
|
||||
|
||||
public int GetBotPresetGenerationLimit(string type)
|
||||
public int? GetBotPresetGenerationLimit(string type)
|
||||
{
|
||||
var typeInLower = type.ToLower();
|
||||
var value = (int)typeof(PresetBatch).GetProperties().First(p => p.Name.ToLower() == (typeInLower == "assaultgroup" ? "assault" : typeInLower))
|
||||
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;
|
||||
if (value != null) return value;
|
||||
|
||||
_logger.Warning(_localisationService.GetText("bot-bot_preset_count_value_missing", type));
|
||||
return 30;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> GetBotCoreDifficulty()
|
||||
|
||||
Reference in New Issue
Block a user