Further work on repeatables

This commit is contained in:
Chomp
2025-01-17 21:39:03 +00:00
parent 1aa1737db3
commit 7a4bc0a3a6
3 changed files with 24 additions and 3 deletions
+3 -2
View File
@@ -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
+11 -1
View File
@@ -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
+10
View File
@@ -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());
}
}
}