renamed methods
This commit is contained in:
@@ -238,7 +238,7 @@ public class BotController(
|
||||
pmcProfile,
|
||||
false,
|
||||
raidSettings,
|
||||
_botConfig.PresetBatch?.Get<int>(requestedBot?.Role ?? string.Empty),
|
||||
_botConfig.PresetBatch?.GetByJsonProp<int>(requestedBot?.Role ?? string.Empty),
|
||||
_botHelper.IsBotPmc(requestedBot?.Role)
|
||||
);
|
||||
|
||||
@@ -269,7 +269,7 @@ public class BotController(
|
||||
botGenerationDetails.Role = _botHelper.GetRandomizedPmcRole();
|
||||
botGenerationDetails.Side = _botHelper.GetPmcSideByRole(botGenerationDetails.Role);
|
||||
botGenerationDetails.BotDifficulty = GetPmcDifficulty(requestedBot?.Difficulty);
|
||||
botGenerationDetails.BotCountToGenerate = _botConfig.PresetBatch?.Get<int>(botGenerationDetails.Role);
|
||||
botGenerationDetails.BotCountToGenerate = _botConfig.PresetBatch?.GetByJsonProp<int>(botGenerationDetails.Role);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ public class BotController(
|
||||
var bossesToConvertToWeights = _botConfig.AssaultToBossConversion.BossesToConvertToWeights;
|
||||
if (bossConvertEnabled && botGenerationDetails.IsPmc is not null && !botGenerationDetails.IsPmc.Value)
|
||||
{
|
||||
var bossConvertPercent = bossConvertMinMax.Get<MinMax>(requestedBot?.Role?.ToLower() ?? string.Empty);
|
||||
var bossConvertPercent = bossConvertMinMax.GetByJsonProp<MinMax>(requestedBot?.Role?.ToLower() ?? string.Empty);
|
||||
if (bossConvertPercent is not null)
|
||||
{
|
||||
// Roll a percentage check if we should convert scav to boss
|
||||
@@ -330,7 +330,7 @@ public class BotController(
|
||||
|
||||
// Bosses are only ever 'normal'
|
||||
botGenerationDetails.BotDifficulty = "normal";
|
||||
botGenerationDetails.BotCountToGenerate = _botConfig.PresetBatch?.Get<int>(botGenerationDetails.Role);
|
||||
botGenerationDetails.BotCountToGenerate = _botConfig.PresetBatch?.GetByJsonProp<int>(botGenerationDetails.Role);
|
||||
}
|
||||
|
||||
private string? GetPmcDifficulty(string? requestedBotDifficulty)
|
||||
@@ -348,8 +348,8 @@ public class BotController(
|
||||
{
|
||||
var mapSpecificConversionValues = _pmcConfig.ConvertIntoPmcChance!.GetValueOrDefault(location?.ToLower(), null);
|
||||
return mapSpecificConversionValues is null
|
||||
? _pmcConfig.ConvertIntoPmcChance.Get<Dictionary<string, MinMax>>("default").Get<MinMax>(requestedBotRole)
|
||||
: mapSpecificConversionValues.Get<MinMax>(requestedBotRole?.ToLower());
|
||||
? _pmcConfig.ConvertIntoPmcChance.GetByJsonProp<Dictionary<string, MinMax>>("default").GetByJsonProp<MinMax>(requestedBotRole)
|
||||
: mapSpecificConversionValues.GetByJsonProp<MinMax>(requestedBotRole?.ToLower());
|
||||
}
|
||||
|
||||
private GetRaidConfigurationRequestData? GetMostRecentRaidSettings()
|
||||
|
||||
@@ -143,7 +143,7 @@ public class RepeatableQuestGenerator(
|
||||
var targetKey = targetsConfig.Draw()[0];
|
||||
var targetDifficulty = 1 / targetsConfig.Probability(targetKey);
|
||||
|
||||
var locations = questTypePool.Pool.Elimination.Targets.Get<TargetLocation>(targetKey).Locations;
|
||||
var locations = questTypePool.Pool.Elimination.Targets.GetByJsonProp<TargetLocation>(targetKey).Locations;
|
||||
|
||||
// we use any as location if "any" is in the pool and we do not hit the specific location random
|
||||
// we use any also if the random condition is not met in case only "any" was in the pool
|
||||
@@ -161,11 +161,11 @@ public class RepeatableQuestGenerator(
|
||||
if (locations.Count > 0)
|
||||
{
|
||||
locationKey = _randomUtil.DrawRandomFromList(locations).FirstOrDefault();
|
||||
questTypePool.Pool.Elimination.Targets.Get<TargetLocation>(targetKey).Locations = locations.Where(
|
||||
questTypePool.Pool.Elimination.Targets.GetByJsonProp<TargetLocation>(targetKey).Locations = locations.Where(
|
||||
(l) => l != locationKey
|
||||
)
|
||||
.ToList();
|
||||
if (questTypePool.Pool.Elimination.Targets.Get<TargetLocation>(targetKey).Locations.Count == 0)
|
||||
if (questTypePool.Pool.Elimination.Targets.GetByJsonProp<TargetLocation>(targetKey).Locations.Count == 0)
|
||||
{
|
||||
questTypePool.Pool.Elimination.Targets.Remove(targetKey);
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@ public class BotEquipmentFilterService
|
||||
|
||||
foreach (var itemKey in generationChanges)
|
||||
{
|
||||
baseBotGeneration.Items.Get<GenerationData>(itemKey.Key).Weights = generationChanges.Get<GenerationData>(itemKey.Key).Weights;
|
||||
baseBotGeneration.Items.Get<GenerationData>(itemKey.Key).Whitelist = generationChanges.Get<GenerationData>(itemKey.Key).Whitelist;
|
||||
baseBotGeneration.Items.GetByJsonProp<GenerationData>(itemKey.Key).Weights = generationChanges.GetByJsonProp<GenerationData>(itemKey.Key).Weights;
|
||||
baseBotGeneration.Items.GetByJsonProp<GenerationData>(itemKey.Key).Whitelist = generationChanges.GetByJsonProp<GenerationData>(itemKey.Key).Whitelist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace SptCommon.Extensions
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public static bool Contains<T>(this object? obj, T key)
|
||||
public static bool ContainsJsonProp<T>(this object? obj, T key)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace SptCommon.Extensions
|
||||
return TryGetCachedProperty(obj.GetType(), key.ToString(), out _);
|
||||
}
|
||||
|
||||
public static T? Get<T>(this object? obj, string? toLower)
|
||||
public static T? GetByJsonProp<T>(this object? obj, string? toLower)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(obj);
|
||||
ArgumentNullException.ThrowIfNull(toLower);
|
||||
|
||||
Reference in New Issue
Block a user