fix assort filtering
This commit is contained in:
@@ -130,7 +130,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));
|
||||
targetsConfig = (ProbabilityObjectArray<Target, string, BossInfo>)targetsConfig.Where((x) => questTypePool.Pool.Elimination.Targets.ContainsKey(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
|
||||
|
||||
@@ -5,7 +5,6 @@ using Core.Models.Enums;
|
||||
using Core.Models.Utils;
|
||||
using Core.Servers;
|
||||
using Core.Services;
|
||||
using SptCommon.Extensions;
|
||||
|
||||
namespace Core.Helpers;
|
||||
|
||||
@@ -74,7 +73,7 @@ public class AssortHelper(
|
||||
Dictionary<string, Dictionary<string, string>> mergedQuestAssorts,
|
||||
string assortId)
|
||||
{
|
||||
if (mergedQuestAssorts.TryGetValue("started", out var dict1) && dict1.Contains(assortId))
|
||||
if (mergedQuestAssorts.TryGetValue("started", out var dict1) && dict1.ContainsKey(assortId))
|
||||
{
|
||||
// Assort unlocked by starting quest, assort is visible to player when : started or ready to hand in + handed in
|
||||
return new KeyValuePair<string, List<QuestStatusEnum>>(
|
||||
@@ -83,7 +82,7 @@ public class AssortHelper(
|
||||
);
|
||||
}
|
||||
|
||||
if (mergedQuestAssorts.TryGetValue("started", out var dict2) && dict2.Contains(assortId))
|
||||
if (mergedQuestAssorts.TryGetValue("success", out var dict2) && dict2.ContainsKey(assortId))
|
||||
{
|
||||
return new KeyValuePair<string, List<QuestStatusEnum>>(
|
||||
mergedQuestAssorts["success"][assortId],
|
||||
@@ -91,7 +90,7 @@ public class AssortHelper(
|
||||
);
|
||||
}
|
||||
|
||||
if (mergedQuestAssorts.TryGetValue("fail", out var dict3) && dict3.Contains(assortId))
|
||||
if (mergedQuestAssorts.TryGetValue("fail", out var dict3) && dict3.ContainsKey(assortId))
|
||||
{
|
||||
return new KeyValuePair<string, List<QuestStatusEnum>>(
|
||||
mergedQuestAssorts["fail"][assortId],
|
||||
@@ -124,7 +123,7 @@ public class AssortHelper(
|
||||
// Remove items restricted by loyalty levels above those reached by the player
|
||||
foreach (var item in assort.LoyalLevelItems)
|
||||
{
|
||||
if (pmcProfile.TradersInfo.TryGetValue(traderId, out var info) && assort.LoyalLevelItems[item.Key] > info.LoyaltyLevel)
|
||||
if (pmcProfile.TradersInfo.TryGetValue(traderId, out var info) && assort.LoyalLevelItems[item.Key] > info.LoyaltyLevel)
|
||||
{
|
||||
strippedAssort = RemoveItemFromAssort(assort, item.Key);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,14 @@ namespace SptCommon.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CARE WHEN USING THIS, THIS IS TO GET PROP ON A TYPE
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public static bool Contains<T>(this object? obj, T key)
|
||||
{
|
||||
if (obj == null)
|
||||
|
||||
Reference in New Issue
Block a user