Further work on repeatables
This commit is contained in:
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
||||
using Core.Helpers;
|
||||
using Core.Services;
|
||||
using Core.Utils.Collections;
|
||||
using Core.Utils.Extensions;
|
||||
using BodyPart = Core.Models.Spt.Config.BodyPart;
|
||||
|
||||
namespace Core.Generators;
|
||||
@@ -145,8 +146,8 @@ public class RepeatableQuestGenerator
|
||||
|
||||
var maxKillDifficulty = eliminationConfig.MaxKills;
|
||||
|
||||
targetsConfig = targetsConfig.Where((x) => questTypePool.Pool.Elimination.Targets.Contains(x.Key));
|
||||
if (targetsConfig.Count == 0 || targetsConfig.All((x) => x.Data.IsBoss))
|
||||
targetsConfig = (ProbabilityObjectArray<Target, string, BossInfo>)targetsConfig.Where((x) => questTypePool.Pool.Elimination.Targets.Contains(x.Key));
|
||||
if (targetsConfig.Count == 0 || targetsConfig.All((x) => x.Data.IsBoss.GetValueOrDefault(false)))
|
||||
{
|
||||
// There are no more targets left for elimination; delete it as a possible quest type
|
||||
// also if only bosses are left we need to leave otherwise it's a guaranteed boss elimination
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Enums;
|
||||
using Core.Utils.Extensions;
|
||||
|
||||
namespace Core.Models.Spt.Repeatable;
|
||||
|
||||
@@ -71,6 +73,14 @@ public record EliminationTargetPool
|
||||
|
||||
[JsonPropertyName("bossBoarSniper")]
|
||||
public TargetLocation? BossBoarSniper { get; set; }
|
||||
|
||||
public EliminationTargetPool this[string toLower]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (EliminationTargetPool?)GetType().GetProperties().SingleOrDefault(p => p.GetJsonName() == toLower)?.GetValue(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public record TargetLocation
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Core.Utils.Extensions
|
||||
{
|
||||
public static class ObjectExtensions
|
||||
{
|
||||
public static bool Contains<T>(this object obj, T key)
|
||||
{
|
||||
return obj.GetType().GetProperties().Any(x => x.Name == key.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user