Replaced EliminationTarget with a dictionary
This commit is contained in:
@@ -323,7 +323,7 @@ public class RepeatableQuestController
|
||||
// Target is boss
|
||||
if (targetKvP.Data.IsBoss.GetValueOrDefault(false))
|
||||
{
|
||||
var targets = questPool.Pool.Elimination.Targets.Get<TargetLocation>(targetKvP.Key);
|
||||
questPool.Pool.Elimination.Targets.TryGetValue(targetKvP.Key, out var targets);
|
||||
targets.Locations.Clear();
|
||||
targets.Locations.Add("any");
|
||||
}
|
||||
@@ -332,7 +332,7 @@ public class RepeatableQuestController
|
||||
// Non-boss targets
|
||||
var possibleLocations = locations;
|
||||
|
||||
var targets = questPool.Pool.Elimination.Targets.Get<TargetLocation>(targetKvP.Key);
|
||||
questPool.Pool.Elimination.Targets.TryGetValue(targetKvP.Key, out var targets);
|
||||
var targetsClone = _cloner.Clone(targets);
|
||||
var allowedLocations = targetKvP.Key == "Savage"
|
||||
? targetsClone.Locations.Where((location) => location != "laboratory") // Exclude labs for Savage targets.
|
||||
@@ -360,7 +360,7 @@ public class RepeatableQuestController
|
||||
},
|
||||
Elimination = new EliminationPool
|
||||
{
|
||||
Targets = new EliminationTargetPool()
|
||||
Targets = new Dictionary<string, TargetLocation>()
|
||||
},
|
||||
Pickup = new ExplorationPool
|
||||
{
|
||||
|
||||
@@ -150,6 +150,7 @@ public class RepeatableQuestGenerator
|
||||
|
||||
var maxKillDifficulty = eliminationConfig.MaxKills;
|
||||
|
||||
var targetPool = questTypePool.Pool.Elimination;
|
||||
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)))
|
||||
{
|
||||
|
||||
@@ -36,55 +36,7 @@ public record ExplorationPool
|
||||
public record EliminationPool
|
||||
{
|
||||
[JsonPropertyName("targets")]
|
||||
public EliminationTargetPool? Targets { get; set; }
|
||||
}
|
||||
|
||||
public record EliminationTargetPool
|
||||
{
|
||||
[JsonPropertyName("Savage")]
|
||||
public TargetLocation? Savage { get; set; }
|
||||
|
||||
[JsonPropertyName("AnyPmc")]
|
||||
public TargetLocation? AnyPmc { get; set; }
|
||||
|
||||
[JsonPropertyName("bossBully")]
|
||||
public TargetLocation? BossBully { get; set; }
|
||||
|
||||
[JsonPropertyName("bossGluhar")]
|
||||
public TargetLocation? BossGluhar { get; set; }
|
||||
|
||||
[JsonPropertyName("bossKilla")]
|
||||
public TargetLocation? BossKilla { get; set; }
|
||||
|
||||
[JsonPropertyName("bossSanitar")]
|
||||
public TargetLocation? BossSanitar { get; set; }
|
||||
|
||||
[JsonPropertyName("bossTagilla")]
|
||||
public TargetLocation? BossTagilla { get; set; }
|
||||
|
||||
[JsonPropertyName("bossKnight")]
|
||||
public TargetLocation? BossKnight { get; set; }
|
||||
|
||||
[JsonPropertyName("bossZryachiy")]
|
||||
public TargetLocation? BossZryachiy { get; set; }
|
||||
|
||||
[JsonPropertyName("bossBoar")]
|
||||
public TargetLocation? BossBoar { get; set; }
|
||||
|
||||
[JsonPropertyName("bossBoarSniper")]
|
||||
public TargetLocation? BossBoarSniper { get; set; }
|
||||
|
||||
public EliminationTargetPool? this[string toLower]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (EliminationTargetPool?)GetType().GetProperties().SingleOrDefault(p => p.GetJsonName() == toLower)?.GetValue(this);
|
||||
}
|
||||
set
|
||||
{
|
||||
// Implement
|
||||
}
|
||||
}
|
||||
public Dictionary<string, TargetLocation>? Targets { get; set; }
|
||||
}
|
||||
|
||||
public record TargetLocation
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using Core.Models.Spt.Repeatable;
|
||||
|
||||
namespace Core.Utils.Extensions
|
||||
{
|
||||
public static class EliminationTargetPoolExtensions
|
||||
{
|
||||
public static void Remove(this EliminationTargetPool pool, string key)
|
||||
{
|
||||
pool[key] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user