help
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Core.Annotations;
|
||||
using Core.Annotations;
|
||||
using Core.Models.Eft.Common;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
using Core.Models.Eft.Health;
|
||||
@@ -12,6 +12,8 @@ using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
using System.Collections.Generic;
|
||||
using Core.Helpers;
|
||||
using Core.Services;
|
||||
using Core.Utils.Collections;
|
||||
using BodyPart = Core.Models.Spt.Config.BodyPart;
|
||||
|
||||
namespace Core.Generators;
|
||||
|
||||
@@ -104,11 +106,10 @@ public class RepeatableQuestGenerator
|
||||
{
|
||||
var eliminationConfig = _repeatableQuestHelper.GetEliminationConfigByPmcLevel(pmcLevel, repeatableConfig);
|
||||
var locationsConfig = repeatableConfig.Locations;
|
||||
var targetsConfig = _repeatableQuestHelper.ProbabilityObjectArray<string, BossInfo>(eliminationConfig.Targets);
|
||||
var bodypartsConfig = _repeatableQuestHelper.ProbabilityObjectArray<string, List<string>>(eliminationConfig.BodyParts);
|
||||
var weaponCategoryRequirementConfig = _repeatableQuestHelper.ProbabilityObjectArray<string, List<string>>(
|
||||
eliminationConfig.WeaponCategoryRequirements);
|
||||
var weaponRequirementConfig = _repeatableQuestHelper.ProbabilityObjectArray<string, List<string>>(eliminationConfig.WeaponRequirements);
|
||||
var targetsConfig = _repeatableQuestHelper.ProbabilityObjectArray<Target, string, BossInfo>(eliminationConfig.Targets);
|
||||
var bodypartsConfig = _repeatableQuestHelper.ProbabilityObjectArray<BodyPart, string, List<string>>(eliminationConfig.BodyParts);
|
||||
var weaponCategoryRequirementConfig = _repeatableQuestHelper.ProbabilityObjectArray<WeaponRequirement, string, List<string>>(eliminationConfig.WeaponCategoryRequirements);
|
||||
var weaponRequirementConfig = _repeatableQuestHelper.ProbabilityObjectArray<WeaponRequirement, string, List<string>>(eliminationConfig.WeaponRequirements);
|
||||
|
||||
// the difficulty of the quest varies in difficulty depending on the condition
|
||||
// possible conditions are
|
||||
|
||||
@@ -38,13 +38,13 @@ public class RepeatableQuestHelper
|
||||
);
|
||||
}
|
||||
|
||||
public ProbabilityObjectArray<K, V>
|
||||
ProbabilityObjectArray<K, V>(
|
||||
List<ProbabilityObject<K, V>>? configArrayInput
|
||||
)
|
||||
public ProbabilityObjectArray<T, K, V>
|
||||
ProbabilityObjectArray<T, K, V>(
|
||||
List<T>? configArrayInput
|
||||
) where T : ProbabilityObject<K, V>
|
||||
{
|
||||
var configArray = _cloner.Clone(configArrayInput);
|
||||
var probabilityArray = new ProbabilityObjectArray<K, V>(_mathUtil, _cloner, configArray);
|
||||
var probabilityArray = new ProbabilityObjectArray<T, K, V>(_mathUtil, _cloner, configArray);
|
||||
return probabilityArray;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json.Serialization;
|
||||
using Core.Models.Common;
|
||||
using Core.Models.Enums;
|
||||
using Core.Utils.Collections;
|
||||
@@ -65,7 +65,7 @@ public record QuestTypeIds
|
||||
|
||||
[JsonPropertyName("exploration")]
|
||||
public string? Exploration { get; set; }
|
||||
|
||||
|
||||
[JsonPropertyName("pickup")]
|
||||
public string? Pickup { get; set; }
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public record TraderWhitelist
|
||||
{
|
||||
[JsonPropertyName("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
|
||||
[JsonPropertyName("traderId")]
|
||||
public string? TraderId { get; set; }
|
||||
|
||||
@@ -260,9 +260,9 @@ public record Pickup : BaseQuestConfig
|
||||
{
|
||||
[JsonPropertyName("ItemTypeToFetchWithMaxCount")]
|
||||
public List<PickupTypeWithMaxCount>? ItemTypeToFetchWithMaxCount { get; set; }
|
||||
|
||||
|
||||
public List<string>? ItemTypesToFetch { get; set; }
|
||||
|
||||
|
||||
[JsonPropertyName("maxItemFetchCount")]
|
||||
public int? MaxItemFetchCount { get; set; }
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Core.Utils.Collections;
|
||||
* // count the elements which should be distributed according to the relative probabilities
|
||||
* res.filter(x => x==="b").reduce((sum, x) => sum + 1 , 0)
|
||||
*/
|
||||
public class ProbabilityObjectArray<K, V> : List<ProbabilityObject<K, V?>>
|
||||
public class ProbabilityObjectArray<T, K, V> : List<ProbabilityObject<K, V?>> where T : ProbabilityObject<K,V>
|
||||
{
|
||||
private MathUtil _mathUtil;
|
||||
private ICloner _cloner;
|
||||
@@ -26,27 +26,7 @@ public class ProbabilityObjectArray<K, V> : List<ProbabilityObject<K, V?>>
|
||||
public ProbabilityObjectArray(
|
||||
MathUtil mathUtil,
|
||||
ICloner cloner,
|
||||
ProbabilityObject<K, V>[] items
|
||||
) : base(items)
|
||||
{
|
||||
_mathUtil = mathUtil;
|
||||
_cloner = cloner;
|
||||
}
|
||||
|
||||
public ProbabilityObjectArray(
|
||||
MathUtil mathUtil,
|
||||
ICloner cloner,
|
||||
List<ProbabilityObject<K, V>> items
|
||||
) : base(items)
|
||||
{
|
||||
_mathUtil = mathUtil;
|
||||
_cloner = cloner;
|
||||
}
|
||||
|
||||
public ProbabilityObjectArray(
|
||||
MathUtil mathUtil,
|
||||
ICloner cloner,
|
||||
ICollection<ProbabilityObject<K, V>> items
|
||||
ICollection<T> items
|
||||
) : base(items)
|
||||
{
|
||||
_mathUtil = mathUtil;
|
||||
@@ -70,13 +50,13 @@ public class ProbabilityObjectArray<K, V> : List<ProbabilityObject<K, V?>>
|
||||
* Clone this ProbabilitObjectArray
|
||||
* @returns {ProbabilityObjectArray} Deep Copy of this ProbabilityObjectArray
|
||||
*/
|
||||
public ProbabilityObjectArray<K, V> Clone()
|
||||
public ProbabilityObjectArray<T, K, V> Clone()
|
||||
{
|
||||
var clone = _cloner.Clone(this);
|
||||
var probabliltyObjects = new ProbabilityObjectArray<K, V>(
|
||||
var probabliltyObjects = new ProbabilityObjectArray<T, K, V>(
|
||||
_mathUtil,
|
||||
_cloner,
|
||||
new List<ProbabilityObject<K, V>>()
|
||||
new List<T>()
|
||||
);
|
||||
probabliltyObjects.AddRange(clone);
|
||||
return probabliltyObjects;
|
||||
@@ -88,9 +68,9 @@ public class ProbabilityObjectArray<K, V> : List<ProbabilityObject<K, V?>>
|
||||
* @param {string} key The key of the element to drop
|
||||
* @returns {ProbabilityObjectArray} ProbabilityObjectArray without the dropped element
|
||||
*/
|
||||
public ProbabilityObjectArray<K, V> Drop(K key)
|
||||
public ProbabilityObjectArray<T, K, V> Drop(K key)
|
||||
{
|
||||
return (ProbabilityObjectArray<K, V>)this.Where((r) => !r.Key?.Equals(key) ?? false);
|
||||
return (ProbabilityObjectArray<T, K, V>)this.Where((r) => !r.Key?.Equals(key) ?? false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user