list to ienumerable changes
This commit is contained in:
@@ -104,7 +104,7 @@ public class LocationLootGenerator(
|
||||
/// <returns>List of container objects</returns>
|
||||
public List<SpawnpointTemplate> GenerateStaticContainers(
|
||||
string locationId,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist
|
||||
)
|
||||
{
|
||||
var staticLootItemCount = 0;
|
||||
@@ -530,7 +530,7 @@ public class LocationLootGenerator(
|
||||
StaticContainerData staticContainer,
|
||||
IEnumerable<StaticForced>? staticForced,
|
||||
Dictionary<string, StaticLootDetails> staticLootDist,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist,
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist,
|
||||
string locationName
|
||||
)
|
||||
{
|
||||
@@ -761,7 +761,7 @@ public class LocationLootGenerator(
|
||||
/// <returns>Array of spawn points with loot in them</returns>
|
||||
public List<SpawnpointTemplate> GenerateDynamicLoot(
|
||||
LooseLoot dynamicLootDist,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist,
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist,
|
||||
string locationName
|
||||
)
|
||||
{
|
||||
@@ -1024,7 +1024,7 @@ public class LocationLootGenerator(
|
||||
protected List<SpawnpointTemplate> GetForcedDynamicLoot(
|
||||
IEnumerable<Spawnpoint> forcedSpawnPoints,
|
||||
string locationName,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist
|
||||
)
|
||||
{
|
||||
var result = new List<SpawnpointTemplate>();
|
||||
@@ -1097,7 +1097,7 @@ public class LocationLootGenerator(
|
||||
protected ContainerItem CreateDynamicLootItem(
|
||||
SptLootItem chosenItem,
|
||||
IEnumerable<SptLootItem> lootItems,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist
|
||||
)
|
||||
{
|
||||
var chosenTpl = chosenItem.Template;
|
||||
@@ -1188,8 +1188,8 @@ public class LocationLootGenerator(
|
||||
|
||||
// TODO: rewrite, BIG yikes
|
||||
protected ContainerItem? CreateStaticLootItem(
|
||||
string chosenTpl,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist,
|
||||
MongoId chosenTpl,
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist,
|
||||
string? parentId = null
|
||||
)
|
||||
{
|
||||
@@ -1310,7 +1310,7 @@ public class LocationLootGenerator(
|
||||
/// <returns>Root Item</returns>
|
||||
protected Item? CreateWeaponRootAndChildren(
|
||||
string chosenTpl,
|
||||
Dictionary<string, List<StaticAmmoDetails>> cartridgePool,
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> cartridgePool,
|
||||
string? parentId,
|
||||
ref List<Item> items
|
||||
)
|
||||
@@ -1427,7 +1427,7 @@ public class LocationLootGenerator(
|
||||
}
|
||||
|
||||
protected void GenerateStaticMagazineItem(
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist,
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist,
|
||||
Item? rootItem,
|
||||
TemplateItem itemTemplate,
|
||||
List<Item> items
|
||||
|
||||
@@ -166,7 +166,7 @@ public class InRaidHelper(
|
||||
/// Used post-raid to remove items after death.
|
||||
/// </summary>
|
||||
/// <param name="pmcData">Player profile</param>
|
||||
/// <param name="sessionId">Session id</param>
|
||||
/// <param name="sessionId">Player/Session id</param>
|
||||
public void DeleteInventory(PmcData pmcData, MongoId sessionId)
|
||||
{
|
||||
// Get inventory item ids to remove from players profile
|
||||
@@ -179,7 +179,7 @@ public class InRaidHelper(
|
||||
}
|
||||
|
||||
// Remove contents of fast panel
|
||||
pmcData.Inventory.FastPanel = new Dictionary<string, MongoId>();
|
||||
pmcData.Inventory.FastPanel = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1462,7 +1462,7 @@ public class ItemHelper(
|
||||
public void FillMagazineWithRandomCartridge(
|
||||
List<Item> magazine,
|
||||
TemplateItem magTemplate,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist,
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist,
|
||||
string? caliber = null,
|
||||
double minSizePercent = 0.25,
|
||||
MongoId? defaultCartridgeTpl = null,
|
||||
@@ -1629,23 +1629,23 @@ public class ItemHelper(
|
||||
/// <returns>Tpl of cartridge</returns>
|
||||
protected MongoId? DrawAmmoTpl(
|
||||
string caliber,
|
||||
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist,
|
||||
Dictionary<string, IEnumerable<StaticAmmoDetails>> staticAmmoDist,
|
||||
MongoId? fallbackCartridgeTpl = null,
|
||||
ICollection<MongoId>? cartridgeWhitelist = null
|
||||
)
|
||||
{
|
||||
var ammos = staticAmmoDist.GetValueOrDefault(caliber, []);
|
||||
if (ammos.Count == 0 && fallbackCartridgeTpl is not null)
|
||||
if (!ammos.Any())
|
||||
{
|
||||
logger.Warning(
|
||||
$"Unable to pick a cartridge for caliber: {caliber}, staticAmmoDist has no data. using fallback value of {fallbackCartridgeTpl}"
|
||||
);
|
||||
if (fallbackCartridgeTpl is not null)
|
||||
{
|
||||
logger.Warning(
|
||||
$"Unable to pick a cartridge for caliber: {caliber}, staticAmmoDist has no data. using fallback value of {fallbackCartridgeTpl}"
|
||||
);
|
||||
|
||||
return fallbackCartridgeTpl;
|
||||
}
|
||||
return fallbackCartridgeTpl;
|
||||
}
|
||||
|
||||
if (ammos.Count == 0 && fallbackCartridgeTpl is null)
|
||||
{
|
||||
logger.Warning(
|
||||
$"Unable to pick a cartridge for caliber: {caliber}, staticAmmoDist has no data. No fallback value provided"
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ public record Location
|
||||
public LazyLoad<StaticContainerDetails>? StaticContainers { get; set; }
|
||||
|
||||
[JsonPropertyName("staticAmmo")]
|
||||
public Dictionary<string, List<StaticAmmoDetails>> StaticAmmo { get; set; }
|
||||
public Dictionary<string, IEnumerable<StaticAmmoDetails>> StaticAmmo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// All possible static containers on map + their assign groupings
|
||||
@@ -130,7 +130,7 @@ public record StaticContainerDetails
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
[JsonPropertyName("staticWeapons")]
|
||||
public List<SpawnpointTemplate> StaticWeapons { get; set; }
|
||||
public IEnumerable<SpawnpointTemplate> StaticWeapons { get; set; }
|
||||
|
||||
[JsonPropertyName("staticContainers")]
|
||||
public IEnumerable<StaticContainerData> StaticContainers { get; set; }
|
||||
|
||||
@@ -11,10 +11,10 @@ public record LocationBase
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
[JsonPropertyName("AccessKeys")]
|
||||
public List<string>? AccessKeys { get; set; }
|
||||
public IEnumerable<string>? AccessKeys { get; set; }
|
||||
|
||||
[JsonPropertyName("AccessKeysPvE")]
|
||||
public List<string>? AccessKeysPvE { get; set; }
|
||||
public IEnumerable<string>? AccessKeysPvE { get; set; }
|
||||
|
||||
[JsonPropertyName("AirdropParameters")]
|
||||
public List<AirdropParameter>? AirdropParameters { get; set; }
|
||||
@@ -197,7 +197,7 @@ public record LocationBase
|
||||
public bool? Locked { get; set; }
|
||||
|
||||
[JsonPropertyName("Loot")]
|
||||
public List<SpawnpointTemplate>? Loot { get; set; }
|
||||
public IEnumerable<SpawnpointTemplate>? Loot { get; set; }
|
||||
|
||||
[JsonPropertyName("MatchMakerMinPlayersByWaitTime")]
|
||||
public List<MinPlayerWaitTime>? MatchMakerMinPlayersByWaitTime { get; set; }
|
||||
@@ -281,7 +281,7 @@ public record LocationBase
|
||||
public bool? NoGroupSpawn { get; set; }
|
||||
|
||||
[JsonPropertyName("SpawnPointParams")]
|
||||
public List<SpawnPointParam>? SpawnPointParams { get; set; }
|
||||
public IEnumerable<SpawnPointParam>? SpawnPointParams { get; set; }
|
||||
|
||||
[JsonPropertyName("areas")]
|
||||
public Dictionary<string, Area>? Areas { get; set; }
|
||||
@@ -337,13 +337,13 @@ public record LocationBase
|
||||
public bool? OneTimeSpawn { get; set; }
|
||||
|
||||
[JsonPropertyName("exits")]
|
||||
public List<Exit> Exits { get; set; }
|
||||
public IEnumerable<Exit> Exits { get; set; }
|
||||
|
||||
[JsonPropertyName("filter_ex")]
|
||||
public List<string>? FilterEx { get; set; }
|
||||
public IEnumerable<string>? FilterEx { get; set; }
|
||||
|
||||
[JsonPropertyName("limits")]
|
||||
public List<Limit>? Limits { get; set; }
|
||||
public IEnumerable<Limit>? Limits { get; set; }
|
||||
|
||||
[JsonPropertyName("matching_min_seconds")]
|
||||
public int? MatchingMinSeconds { get; set; }
|
||||
@@ -352,7 +352,7 @@ public record LocationBase
|
||||
public bool? GenerateLocalLootCache { get; set; }
|
||||
|
||||
[JsonPropertyName("maxItemCountInLocation")]
|
||||
public List<MaxItemCountInLocation>? MaxItemCountInLocation { get; set; }
|
||||
public IEnumerable<MaxItemCountInLocation>? MaxItemCountInLocation { get; set; }
|
||||
|
||||
[JsonPropertyName("sav_summon_seconds")]
|
||||
public int? SavSummonSeconds { get; set; }
|
||||
@@ -361,7 +361,7 @@ public record LocationBase
|
||||
public int? TmpLocationFieldRemoveMe { get; set; }
|
||||
|
||||
[JsonPropertyName("transits")]
|
||||
public List<Transit>? Transits { get; set; }
|
||||
public IEnumerable<Transit>? Transits { get; set; }
|
||||
|
||||
[JsonPropertyName("users_gather_seconds")]
|
||||
public int? UsersGatherSeconds { get; set; }
|
||||
@@ -453,7 +453,7 @@ public record NonWaveGroupScenario
|
||||
public record Limit : MinMax<int>
|
||||
{
|
||||
[JsonPropertyName("items")]
|
||||
public List<string>? Items { get; set; }
|
||||
public IEnumerable<string>? Items { get; set; }
|
||||
}
|
||||
|
||||
public record AirdropParameter
|
||||
@@ -586,13 +586,13 @@ public record BossLocationSpawn
|
||||
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
[JsonPropertyName("Supports")]
|
||||
public List<BossSupport> Supports { get; set; }
|
||||
public IEnumerable<BossSupport> Supports { get; set; }
|
||||
|
||||
[JsonPropertyName("sptId")]
|
||||
public string? SptId { get; set; }
|
||||
|
||||
[JsonPropertyName("SpawnMode")]
|
||||
public List<string> SpawnMode { get; set; }
|
||||
public IEnumerable<string> SpawnMode { get; set; }
|
||||
}
|
||||
|
||||
public record BossSupport
|
||||
@@ -619,7 +619,7 @@ public record BotLocationModifier
|
||||
public double? AccuracySpeed { get; set; }
|
||||
|
||||
[JsonPropertyName("AdditionalHostilitySettings")]
|
||||
public List<AdditionalHostilitySettings> AdditionalHostilitySettings { get; set; }
|
||||
public IEnumerable<AdditionalHostilitySettings> AdditionalHostilitySettings { get; set; }
|
||||
|
||||
[JsonPropertyName("DistToActivate")]
|
||||
public double? DistanceToActivate { get; set; }
|
||||
@@ -703,10 +703,10 @@ public record AdditionalHostilitySettings
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
[JsonPropertyName("AlwaysEnemies")]
|
||||
public List<string>? AlwaysEnemies { get; set; }
|
||||
public HashSet<string>? AlwaysEnemies { get; set; }
|
||||
|
||||
[JsonPropertyName("AlwaysFriends")]
|
||||
public List<string>? AlwaysFriends { get; set; }
|
||||
public HashSet<string>? AlwaysFriends { get; set; }
|
||||
|
||||
[JsonPropertyName("BearEnemyChance")]
|
||||
public double? BearEnemyChance { get; set; }
|
||||
@@ -721,7 +721,7 @@ public record AdditionalHostilitySettings
|
||||
public List<ChancedEnemy>? ChancedEnemies { get; set; }
|
||||
|
||||
[JsonPropertyName("Neutral")]
|
||||
public List<string>? Neutral { get; set; }
|
||||
public HashSet<string>? Neutral { get; set; }
|
||||
|
||||
[JsonPropertyName("SavagePlayerBehaviour")]
|
||||
public string? SavagePlayerBehaviour { get; set; }
|
||||
@@ -736,7 +736,7 @@ public record AdditionalHostilitySettings
|
||||
public string? UsecPlayerBehaviour { get; set; }
|
||||
|
||||
[JsonPropertyName("Warn")]
|
||||
public List<string>? Warn { get; set; }
|
||||
public IEnumerable<string>? Warn { get; set; }
|
||||
}
|
||||
|
||||
public record ChancedEnemy
|
||||
@@ -802,7 +802,7 @@ public record SpawnPointParam
|
||||
public string? BotZoneName { get; set; }
|
||||
|
||||
[JsonPropertyName("Categories")]
|
||||
public List<string>? Categories { get; set; }
|
||||
public IEnumerable<string>? Categories { get; set; }
|
||||
|
||||
[JsonPropertyName("ColliderParams")]
|
||||
public ColliderParams? ColliderParams { get; set; }
|
||||
@@ -826,7 +826,7 @@ public record SpawnPointParam
|
||||
public double? Rotation { get; set; }
|
||||
|
||||
[JsonPropertyName("Sides")]
|
||||
public List<string>? Sides { get; set; }
|
||||
public IEnumerable<string>? Sides { get; set; }
|
||||
}
|
||||
|
||||
public record ColliderParams
|
||||
@@ -1022,7 +1022,7 @@ public record Wave
|
||||
/// 'pve' and/or 'regular'
|
||||
/// </summary>
|
||||
[JsonPropertyName("SpawnMode")]
|
||||
public List<string>? SpawnMode { get; set; }
|
||||
public HashSet<string>? SpawnMode { get; set; }
|
||||
|
||||
[JsonPropertyName("OpenZones")]
|
||||
public string? OpenZones { get; set; }
|
||||
@@ -1056,7 +1056,7 @@ public record Halloween2024
|
||||
public double? CrowdAttackBlockRadius { get; set; }
|
||||
|
||||
[JsonPropertyName("CrowdAttackSpawnParams")]
|
||||
public List<CrowdAttackSpawnParam>? CrowdAttackSpawnParams { get; set; }
|
||||
public IEnumerable<CrowdAttackSpawnParam>? CrowdAttackSpawnParams { get; set; }
|
||||
|
||||
[JsonPropertyName("CrowdCooldownPerPlayerSec")]
|
||||
public double? CrowdCooldownPerPlayerSec { get; set; }
|
||||
@@ -1130,7 +1130,7 @@ public record Area
|
||||
public XYZ? Position { get; set; }
|
||||
|
||||
[JsonPropertyName("sides")]
|
||||
public List<string>? Sides { get; set; }
|
||||
public HashSet<string>? Sides { get; set; }
|
||||
|
||||
[JsonPropertyName("size")]
|
||||
public XYZ? Size { get; set; }
|
||||
|
||||
@@ -178,7 +178,7 @@ public record DeletedItem
|
||||
public Dictionary<string, object>? ExtensionData { get; set; }
|
||||
|
||||
[JsonPropertyName("_id")]
|
||||
public string Id { get; set; }
|
||||
public MongoId Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -167,15 +167,13 @@ public class LocationLifecycleService(
|
||||
}
|
||||
|
||||
// Find only scav extracts and overwrite existing exits with them
|
||||
var scavExtracts = mapExtracts
|
||||
.Where(extract =>
|
||||
string.Equals(extract.Side, "scav", StringComparison.OrdinalIgnoreCase)
|
||||
)
|
||||
.ToList();
|
||||
if (scavExtracts.Count > 0)
|
||||
var scavExtracts = mapExtracts.Where(extract =>
|
||||
string.Equals(extract.Side, "scav", StringComparison.OrdinalIgnoreCase)
|
||||
);
|
||||
if (scavExtracts.Any())
|
||||
// Scav extracts found, use them
|
||||
{
|
||||
locationData.Exits.AddRange(scavExtracts);
|
||||
locationData.Exits = locationData.Exits.Union(scavExtracts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user