Change property naming to be more consistent (#578)

This commit is contained in:
Archangel
2025-08-28 15:31:50 +02:00
parent da96cfbf79
commit 7e2e3db3fd
22 changed files with 105 additions and 106 deletions
@@ -177,15 +177,15 @@ public class HealthController(
var foodItemEffectDetails = foodItemDbDetails.Properties.EffectsHealth; var foodItemEffectDetails = foodItemDbDetails.Properties.EffectsHealth;
var foodIsSingleUse = foodItemDbDetails.Properties.MaxResource == 1; var foodIsSingleUse = foodItemDbDetails.Properties.MaxResource == 1;
foreach (var (key, effectProps) in foodItemEffectDetails) foreach (var (key, effectProperties) in foodItemEffectDetails)
{ {
switch (key) switch (key)
{ {
case HealthFactor.Hydration: case HealthFactor.Hydration:
ApplyEdibleEffect(pmcData.Health.Hydration, effectProps, foodIsSingleUse, request); ApplyEdibleEffect(pmcData.Health.Hydration, effectProperties, foodIsSingleUse, request);
break; break;
case HealthFactor.Energy: case HealthFactor.Energy:
ApplyEdibleEffect(pmcData.Health.Energy, effectProps, foodIsSingleUse, request); ApplyEdibleEffect(pmcData.Health.Energy, effectProperties, foodIsSingleUse, request);
break; break;
default: default:
@@ -206,7 +206,7 @@ public class HealthController(
/// <param name="request">Client request</param> /// <param name="request">Client request</param>
protected void ApplyEdibleEffect( protected void ApplyEdibleEffect(
CurrentMinMax bodyValue, CurrentMinMax bodyValue,
EffectsHealthProps consumptionDetails, EffectsHealthProperties consumptionDetails,
bool foodIsSingleUse, bool foodIsSingleUse,
OffraidEatRequestData request OffraidEatRequestData request
) )
@@ -56,7 +56,7 @@ public static class TemplateItemExtensions
string.Equals(slot.Name, modSlot, StringComparison.OrdinalIgnoreCase) string.Equals(slot.Name, modSlot, StringComparison.OrdinalIgnoreCase)
); );
return relatedItemDbModSlot?.Props?.Filters?.FirstOrDefault()?.Plate; return relatedItemDbModSlot?.Properties?.Filters?.FirstOrDefault()?.Plate;
} }
/// <summary> /// <summary>
@@ -1137,7 +1137,7 @@ public class BotEquipmentModGenerator(
} }
// Filter modpool to only items that appear in parents allowed list // Filter modpool to only items that appear in parents allowed list
preFilteredModPool = preFilteredModPool.Where(tpl => parentSlot.Props.Filters.First().Filter.Contains(tpl)).ToHashSet(); preFilteredModPool = preFilteredModPool.Where(tpl => parentSlot.Properties.Filters.First().Filter.Contains(tpl)).ToHashSet();
if (preFilteredModPool.Count == 0) if (preFilteredModPool.Count == 0)
{ {
return new ChooseRandomCompatibleModResult return new ChooseRandomCompatibleModResult
@@ -1326,7 +1326,7 @@ public class BotEquipmentModGenerator(
.ParentTemplate.Properties.Slots?.FirstOrDefault(slot => .ParentTemplate.Properties.Slots?.FirstOrDefault(slot =>
string.Equals(slot.Name.ToLowerInvariant(), request.ModSlot.ToLowerInvariant(), StringComparison.Ordinal) string.Equals(slot.Name.ToLowerInvariant(), request.ModSlot.ToLowerInvariant(), StringComparison.Ordinal)
) )
?.Props.Filters?.First() ?.Properties.Filters?.First()
.Filter; .Filter;
// Mod isn't in existing pool, only add if it has no children and exists inside parent filter // Mod isn't in existing pool, only add if it has no children and exists inside parent filter
@@ -1476,7 +1476,7 @@ public class BotEquipmentModGenerator(
public MongoId? GetRandomModTplFromItemDb(MongoId fallbackModTpl, Slot parentSlot, string modSlot, IEnumerable<Item> items) public MongoId? GetRandomModTplFromItemDb(MongoId fallbackModTpl, Slot parentSlot, string modSlot, IEnumerable<Item> items)
{ {
// Find compatible mods and make an array of them // Find compatible mods and make an array of them
var allowedItems = parentSlot.Props.Filters.First().Filter; var allowedItems = parentSlot.Properties.Filters.First().Filter;
// Find mod item that fits slot from sorted mod array // Find mod item that fits slot from sorted mod array
var exhaustableModPool = CreateExhaustableArray(allowedItems); var exhaustableModPool = CreateExhaustableArray(allowedItems);
@@ -1573,7 +1573,7 @@ public class BotEquipmentModGenerator(
{ {
var desiredSlotObject = modTemplate.Properties?.Slots?.FirstOrDefault(slot => slot.Name.Contains(desiredSlotName)); var desiredSlotObject = modTemplate.Properties?.Slots?.FirstOrDefault(slot => slot.Name.Contains(desiredSlotName));
var supportedSubMods = desiredSlotObject?.Props?.Filters?.FirstOrDefault()?.Filter; var supportedSubMods = desiredSlotObject?.Properties?.Filters?.FirstOrDefault()?.Filter;
if (supportedSubMods is null) if (supportedSubMods is null)
{ {
return; return;
@@ -1689,7 +1689,7 @@ public class BotEquipmentModGenerator(
modPool[cylinderMagTemplate.Id] = new Dictionary<string, HashSet<MongoId>>(); modPool[cylinderMagTemplate.Id] = new Dictionary<string, HashSet<MongoId>>();
foreach (var camora in camoraSlots) foreach (var camora in camoraSlots)
{ {
modPool[cylinderMagTemplate.Id][camora.Name] = camora.Props.Filters.First().Filter.ToHashSet(); modPool[cylinderMagTemplate.Id][camora.Name] = camora.Properties.Filters.First().Filter.ToHashSet();
} }
itemModPool = modPool[cylinderMagTemplate.Id]; itemModPool = modPool[cylinderMagTemplate.Id];
@@ -1818,7 +1818,7 @@ public class BotEquipmentModGenerator(
// Mods scope slot found must allow ALL whitelisted scope types OR be a mount // Mods scope slot found must allow ALL whitelisted scope types OR be a mount
if ( if (
scopeSlot?.All(slot => scopeSlot?.All(slot =>
slot.Props.Filters.FirstOrDefault() slot.Properties.Filters.FirstOrDefault()
.Filter.All(tpl => .Filter.All(tpl =>
itemHelper.IsOfBaseclasses(tpl, whitelistedSightTypes) || itemHelper.IsOfBaseclass(tpl, BaseClasses.MOUNT) itemHelper.IsOfBaseclasses(tpl, whitelistedSightTypes) || itemHelper.IsOfBaseclass(tpl, BaseClasses.MOUNT)
) )
@@ -204,7 +204,7 @@ public class BotWeaponGenerator(
// Add cartridge(s) to gun chamber(s) // Add cartridge(s) to gun chamber(s)
if ( if (
(weaponItemTemplate.Properties?.Chambers).Any() (weaponItemTemplate.Properties?.Chambers).Any()
&& weaponItemTemplate.Properties.Chambers.FirstOrDefault().Props.Filters.FirstOrDefault().Filter.Contains(ammoTpl) && weaponItemTemplate.Properties.Chambers.FirstOrDefault().Properties.Filters.FirstOrDefault().Filter.Contains(ammoTpl)
) )
{ {
// Guns have variety of possible Chamber ids, patron_in_weapon/patron_in_weapon_000/patron_in_weapon_001 // Guns have variety of possible Chamber ids, patron_in_weapon/patron_in_weapon_000/patron_in_weapon_001
@@ -671,7 +671,7 @@ public class BotWeaponGenerator(
{ {
ArgumentNullException.ThrowIfNull(weaponTemplate); ArgumentNullException.ThrowIfNull(weaponTemplate);
var cartridges = weaponTemplate.Properties?.Chambers?.FirstOrDefault()?.Props?.Filters?.First().Filter; var cartridges = weaponTemplate.Properties?.Chambers?.FirstOrDefault()?.Properties?.Filters?.First().Filter;
if (cartridges is not null) if (cartridges is not null)
{ {
return cartridges; return cartridges;
@@ -699,7 +699,7 @@ public class BotWeaponGenerator(
} }
var magazineTemplate = itemHelper.GetItem( var magazineTemplate = itemHelper.GetItem(
magazineSlot.Props?.Filters.FirstOrDefault()?.Filter?.FirstOrDefault() ?? new MongoId(null) magazineSlot.Properties?.Filters.FirstOrDefault()?.Filter?.FirstOrDefault() ?? new MongoId(null)
); );
if (!magazineTemplate.Key) if (!magazineTemplate.Key)
{ {
@@ -708,10 +708,8 @@ public class BotWeaponGenerator(
// Try to get cartridges from slots array first, if none found, try Cartridges array // Try to get cartridges from slots array first, if none found, try Cartridges array
var cartridges = var cartridges =
magazineTemplate.Value.Properties.Slots.FirstOrDefault()?.Props?.Filters.FirstOrDefault()?.Filter ?? magazineTemplate magazineTemplate.Value.Properties.Slots.FirstOrDefault()?.Properties?.Filters.FirstOrDefault()?.Filter
.Value.Properties.Cartridges.FirstOrDefault() ?? magazineTemplate.Value.Properties.Cartridges.FirstOrDefault()?.Properties?.Filters.FirstOrDefault()?.Filter;
?.Props?.Filters.FirstOrDefault()
?.Filter;
return cartridges ?? []; return cartridges ?? [];
} }
@@ -737,7 +735,7 @@ public class BotWeaponGenerator(
if (!string.IsNullOrEmpty(weaponTemplate.Properties.LinkedWeapon)) if (!string.IsNullOrEmpty(weaponTemplate.Properties.LinkedWeapon))
{ {
var ammoInChamber = itemHelper.GetItem( var ammoInChamber = itemHelper.GetItem(
weaponTemplate.Properties.Chambers.First().Props.Filters.First().Filter.FirstOrDefault() weaponTemplate.Properties.Chambers.First().Properties.Filters.First().Filter.FirstOrDefault()
); );
return !ammoInChamber.Key ? null : ammoInChamber.Value.Properties.Caliber; return !ammoInChamber.Key ? null : ammoInChamber.Value.Properties.Caliber;
} }
@@ -209,7 +209,7 @@ public class FenceBaseAssortGenerator(
if (itemHelper.IsOfBaseclass(rootItemDb.Id, BaseClasses.AMMO_BOX)) if (itemHelper.IsOfBaseclass(rootItemDb.Id, BaseClasses.AMMO_BOX))
{ {
// Get the cartridge tpl found inside ammo box // Get the cartridge tpl found inside ammo box
var cartridgeTplInBox = rootItemDb.Properties.StackSlots.First().Props.Filters.First().Filter.FirstOrDefault(); var cartridgeTplInBox = rootItemDb.Properties.StackSlots.First().Properties.Filters.First().Filter.FirstOrDefault();
// Look up cartridge tpl in db // Look up cartridge tpl in db
var ammoItemDb = itemHelper.GetItem(cartridgeTplInBox); var ammoItemDb = itemHelper.GetItem(cartridgeTplInBox);
@@ -253,8 +253,8 @@ public class FenceBaseAssortGenerator(
{ {
foreach (var requiredSlot in requiredSlots) foreach (var requiredSlot in requiredSlots)
{ {
var modItemDbDetails = itemHelper.GetItem(requiredSlot.Props.Filters.First().Plate.Value).Value; var modItemDbDetails = itemHelper.GetItem(requiredSlot.Properties.Filters.First().Plate.Value).Value;
var plateTpl = requiredSlot.Props.Filters.First().Plate; // `Plate` property appears to be the 'default' item for slot var plateTpl = requiredSlot.Properties.Filters.First().Plate; // `Plate` property appears to be the 'default' item for slot
if (plateTpl is null || plateTpl.Value.IsEmpty) if (plateTpl is null || plateTpl.Value.IsEmpty)
// Some bsg plate properties are empty, skip mod // Some bsg plate properties are empty, skip mod
{ {
@@ -287,7 +287,7 @@ public class FenceBaseAssortGenerator(
{ {
foreach (var plateSlot in plateSlots) foreach (var plateSlot in plateSlots)
{ {
var plateTpl = plateSlot.Props.Filters.First().Plate; var plateTpl = plateSlot.Properties.Filters.First().Plate;
if (string.IsNullOrEmpty(plateTpl)) if (string.IsNullOrEmpty(plateTpl))
// Bsg data lacks a default plate, skip adding mod // Bsg data lacks a default plate, skip adding mod
{ {
@@ -299,7 +299,7 @@ public class FenceBaseAssortGenerator(
new Item new Item
{ {
Id = new MongoId(), Id = new MongoId(),
Template = plateSlot.Props.Filters.First().Plate.Value, // `Plate` property appears to be the 'default' item for slot Template = plateSlot.Properties.Filters.First().Plate.Value, // `Plate` property appears to be the 'default' item for slot
ParentId = armor[0].Id, ParentId = armor[0].Id,
SlotId = plateSlot.Name, SlotId = plateSlot.Name,
Upd = new Upd Upd = new Upd
@@ -177,7 +177,7 @@ public class ExternalInventoryMagGen(
// All possible mags that fit into the weapon excluding blacklisted // All possible mags that fit into the weapon excluding blacklisted
var magazinePool = magSlot var magazinePool = magSlot
.Props.Filters.First() .Properties.Filters.First()
.Filter.Where(x => !magazineBlacklist.Contains(x)) .Filter.Where(x => !magazineBlacklist.Contains(x))
.Select(x => itemHelper.GetItem(x).Value); .Select(x => itemHelper.GetItem(x).Value);
if (magazinePool is null) if (magazinePool is null)
@@ -38,7 +38,8 @@ public class BotWeaponGeneratorHelper(
if (MagazineIsCylinderRelated(parentItem.Name ?? string.Empty)) if (MagazineIsCylinderRelated(parentItem.Name ?? string.Empty))
{ {
var firstSlotAmmoTpl = var firstSlotAmmoTpl =
magTemplate.Properties?.Cartridges?.FirstOrDefault()?.Props?.Filters?.First().Filter?.FirstOrDefault() ?? new MongoId(null); magTemplate.Properties?.Cartridges?.FirstOrDefault()?.Properties?.Filters?.First().Filter?.FirstOrDefault()
?? new MongoId(null);
var ammoMaxStackSize = itemHelper.GetItem(firstSlotAmmoTpl).Value?.Properties?.StackMaxSize ?? 1; var ammoMaxStackSize = itemHelper.GetItem(firstSlotAmmoTpl).Value?.Properties?.StackMaxSize ?? 1;
chamberBulletCount = chamberBulletCount =
ammoMaxStackSize == 1 ammoMaxStackSize == 1
@@ -913,8 +913,8 @@ public class InventoryHelper(
var containerTemplate = itemHelper.GetItem(containerTpl).Value; var containerTemplate = itemHelper.GetItem(containerTpl).Value;
var firstContainerGrid = containerTemplate.Properties.Grids.FirstOrDefault(); var firstContainerGrid = containerTemplate.Properties.Grids.FirstOrDefault();
var containerRowCount = firstContainerGrid.Props.CellsH; var containerRowCount = firstContainerGrid.Properties.CellsH;
var containerColumnCount = firstContainerGrid.Props.CellsV; var containerColumnCount = firstContainerGrid.Properties.CellsV;
return itemHelper.GetBlankContainerMap(containerColumnCount.Value, containerRowCount.Value); return itemHelper.GetBlankContainerMap(containerColumnCount.Value, containerRowCount.Value);
} }
@@ -959,8 +959,8 @@ public class InventoryHelper(
var firstStashItemGrid = stashItemDbItem?.Properties?.Grids?.FirstOrDefault(); var firstStashItemGrid = stashItemDbItem?.Properties?.Grids?.FirstOrDefault();
// Get horizontal and vertical size // Get horizontal and vertical size
var stashH = firstStashItemGrid.Props.CellsH != 0 ? firstStashItemGrid.Props.CellsH : 10; var stashH = firstStashItemGrid.Properties.CellsH != 0 ? firstStashItemGrid.Properties.CellsH : 10;
var stashV = firstStashItemGrid.Props.CellsV != 0 ? firstStashItemGrid.Props.CellsV : 66; var stashV = firstStashItemGrid.Properties.CellsV != 0 ? firstStashItemGrid.Properties.CellsV : 66;
// Player has a bonus, apply to vertical size // Player has a bonus, apply to vertical size
var stashRowBonus = pmcData.Bonuses.FirstOrDefault(bonus => bonus.Type == BonusType.StashRows); var stashRowBonus = pmcData.Bonuses.FirstOrDefault(bonus => bonus.Type == BonusType.StashRows);
@@ -1306,7 +1306,7 @@ public class ItemHelper(
/// <returns>Valid caliber for cartridge</returns> /// <returns>Valid caliber for cartridge</returns>
public MongoId? GetRandomCompatibleCaliberTemplateId(TemplateItem item) public MongoId? GetRandomCompatibleCaliberTemplateId(TemplateItem item)
{ {
var cartridges = item.Properties?.Cartridges?.FirstOrDefault()?.Props?.Filters?.FirstOrDefault()?.Filter; var cartridges = item.Properties?.Cartridges?.FirstOrDefault()?.Properties?.Filters?.FirstOrDefault()?.Filter;
if (cartridges is null) if (cartridges is null)
{ {
logger.Warning($"Failed to find cartridge for item: {item.Id} {item.Name}"); logger.Warning($"Failed to find cartridge for item: {item.Id} {item.Name}");
@@ -1324,7 +1324,7 @@ public class ItemHelper(
public void AddCartridgesToAmmoBox(List<Item> ammoBox, TemplateItem ammoBoxDetails) public void AddCartridgesToAmmoBox(List<Item> ammoBox, TemplateItem ammoBoxDetails)
{ {
var ammoBoxMaxCartridgeCount = ammoBoxDetails.Properties?.StackSlots?.First().MaxCount; var ammoBoxMaxCartridgeCount = ammoBoxDetails.Properties?.StackSlots?.First().MaxCount;
var cartridgeTpl = ammoBoxDetails.Properties?.StackSlots?.First().Props?.Filters?.First().Filter?.FirstOrDefault(); var cartridgeTpl = ammoBoxDetails.Properties?.StackSlots?.First().Properties?.Filters?.First().Filter?.FirstOrDefault();
var cartridgeDetails = GetItem(cartridgeTpl!.Value); var cartridgeDetails = GetItem(cartridgeTpl!.Value);
var cartridgeMaxStackSize = cartridgeDetails.Value?.Properties?.StackMaxSize; var cartridgeMaxStackSize = cartridgeDetails.Value?.Properties?.StackMaxSize;
@@ -1369,7 +1369,7 @@ public class ItemHelper(
public void AddSingleStackCartridgesToAmmoBox(List<Item> ammoBox, TemplateItem ammoBoxDetails) public void AddSingleStackCartridgesToAmmoBox(List<Item> ammoBox, TemplateItem ammoBoxDetails)
{ {
var ammoBoxMaxCartridgeCount = ammoBoxDetails.Properties?.StackSlots?.First().MaxCount ?? 0; var ammoBoxMaxCartridgeCount = ammoBoxDetails.Properties?.StackSlots?.First().MaxCount ?? 0;
var cartridgeTpl = ammoBoxDetails.Properties?.StackSlots?.First().Props?.Filters?.First().Filter?.FirstOrDefault(); var cartridgeTpl = ammoBoxDetails.Properties?.StackSlots?.First().Properties?.Filters?.First().Filter?.FirstOrDefault();
ammoBox.Add(CreateCartridges(ammoBox[0].Id, cartridgeTpl!.Value, (int)ammoBoxMaxCartridgeCount, 0)); ammoBox.Add(CreateCartridges(ammoBox[0].Id, cartridgeTpl!.Value, (int)ammoBoxMaxCartridgeCount, 0));
} }
@@ -1409,7 +1409,7 @@ public class ItemHelper(
chosenCaliber, chosenCaliber,
staticAmmoDist, staticAmmoDist,
defaultCartridgeTpl, defaultCartridgeTpl,
weapon?.Properties?.Chambers?.FirstOrDefault()?.Props?.Filters?.FirstOrDefault()?.Filter ?? null weapon?.Properties?.Chambers?.FirstOrDefault()?.Properties?.Filters?.FirstOrDefault()?.Filter ?? null
); );
if (cartridgeTpl is null) if (cartridgeTpl is null)
{ {
@@ -1459,10 +1459,10 @@ public class ItemHelper(
} }
// Get max number of cartridges in magazine, choose random value between min/max // Get max number of cartridges in magazine, choose random value between min/max
var magProps = magTemplate.Properties; var magProperties = magTemplate.Properties;
var magazineCartridgeMaxCount = IsOfBaseclass(magTemplate.Id, BaseClasses.SPRING_DRIVEN_CYLINDER) var magazineCartridgeMaxCount = IsOfBaseclass(magTemplate.Id, BaseClasses.SPRING_DRIVEN_CYLINDER)
? magProps?.Slots?.Count() // Edge case for rotating grenade launcher magazine ? magProperties?.Slots?.Count() // Edge case for rotating grenade launcher magazine
: magProps?.Cartridges?.FirstOrDefault()?.MaxCount; : magProperties?.Cartridges?.FirstOrDefault()?.MaxCount;
if (magazineCartridgeMaxCount is null) if (magazineCartridgeMaxCount is null)
{ {
@@ -1519,7 +1519,7 @@ public class ItemHelper(
/// <returns>Tpl of cartridge</returns> /// <returns>Tpl of cartridge</returns>
protected string? GetRandomValidCaliber(TemplateItem magTemplate) protected string? GetRandomValidCaliber(TemplateItem magTemplate)
{ {
var ammoTpls = magTemplate.Properties?.Cartridges?.First().Props?.Filters?.First().Filter; var ammoTpls = magTemplate.Properties?.Cartridges?.First().Properties?.Filters?.First().Filter;
var calibers = ammoTpls?.Where(x => GetItem(x).Key).Select(x => GetItem(x).Value?.Properties?.Caliber).ToList(); var calibers = ammoTpls?.Where(x => GetItem(x).Key).Select(x => GetItem(x).Value?.Properties?.Caliber).ToList();
if (calibers is null) if (calibers is null)
@@ -1679,7 +1679,7 @@ public class ItemHelper(
} }
} }
var itemPool = slot.Props?.Filters?.FirstOrDefault()?.Filter ?? []; var itemPool = slot.Properties?.Filters?.FirstOrDefault()?.Filter ?? [];
if (itemPool.Count == 0) if (itemPool.Count == 0)
{ {
if (logger.IsLogEnabled(LogLevel.Debug)) if (logger.IsLogEnabled(LogLevel.Debug))
@@ -1869,8 +1869,8 @@ public class ItemHelper(
var containerTemplate = GetItem(containerTpl).Value; var containerTemplate = GetItem(containerTpl).Value;
// Get height/width // Get height/width
var height = containerTemplate?.Properties?.Grids?.First().Props?.CellsV; var height = containerTemplate?.Properties?.Grids?.First().Properties?.CellsV;
var width = containerTemplate?.Properties?.Grids?.First().Props?.CellsH; var width = containerTemplate?.Properties?.Grids?.First().Properties?.CellsH;
if (height is null || width is null) if (height is null || width is null)
{ {
@@ -137,25 +137,25 @@ public class RepairHelper(
/// <summary> /// <summary>
/// Repairing weapons reduces the total durability value slightly, get a randomised (to 2dp) amount /// Repairing weapons reduces the total durability value slightly, get a randomised (to 2dp) amount
/// </summary> /// </summary>
/// <param name="itemProps">Weapon properties</param> /// <param name="itemProperties">Weapon properties</param>
/// <param name="isRepairKit">Was a repair kit used</param> /// <param name="isRepairKit">Was a repair kit used</param>
/// <param name="weaponMax">Max amount of durability item can have</param> /// <param name="weaponMax">Max amount of durability item can have</param>
/// <param name="traderQualityMultiplier">Different traders produce different loss values</param> /// <param name="traderQualityMultiplier">Different traders produce different loss values</param>
/// <returns>Amount to reduce max durability by</returns> /// <returns>Amount to reduce max durability by</returns>
protected double GetRandomisedWeaponRepairDegradationValue( protected double GetRandomisedWeaponRepairDegradationValue(
Props itemProps, TemplateItemProperties itemProperties,
bool isRepairKit, bool isRepairKit,
double weaponMax, double weaponMax,
double traderQualityMultiplier double traderQualityMultiplier
) )
{ {
var minRepairDeg = isRepairKit ? itemProps.MinRepairKitDegradation : itemProps.MinRepairDegradation; var minRepairDeg = isRepairKit ? itemProperties.MinRepairKitDegradation : itemProperties.MinRepairDegradation;
var maxRepairDeg = isRepairKit ? itemProps.MaxRepairKitDegradation : itemProps.MaxRepairDegradation; var maxRepairDeg = isRepairKit ? itemProperties.MaxRepairKitDegradation : itemProperties.MaxRepairDegradation;
// WORKAROUND: Some items are always 0 when repairkit is true // WORKAROUND: Some items are always 0 when repairkit is true
if (maxRepairDeg == 0) if (maxRepairDeg == 0)
{ {
maxRepairDeg = itemProps.MaxRepairDegradation; maxRepairDeg = itemProperties.MaxRepairDegradation;
} }
var duraLossPercent = randomUtil.GetDouble((double)minRepairDeg, (double)maxRepairDeg); var duraLossPercent = randomUtil.GetDouble((double)minRepairDeg, (double)maxRepairDeg);
@@ -790,10 +790,10 @@ public record ColliderParams
} }
[JsonPropertyName("_props")] [JsonPropertyName("_props")]
public ColliderProps? Props { get; set; } public ColliderProperties? Properties { get; set; }
} }
public record ColliderProps public record ColliderProperties
{ {
[JsonPropertyName("Center")] [JsonPropertyName("Center")]
public XYZ? Center { get; set; } public XYZ? Center { get; set; }
@@ -18,13 +18,13 @@ public record CustomizationItem
public string Type { get; set; } public string Type { get; set; }
[JsonPropertyName("_props")] [JsonPropertyName("_props")]
public CustomizationProps Properties { get; set; } public CustomizationProperties Properties { get; set; }
[JsonPropertyName("_proto")] [JsonPropertyName("_proto")]
public string Proto { get; set; } public string Proto { get; set; }
} }
public class CustomizationProps public class CustomizationProperties
{ {
[JsonPropertyName("Prefab")] [JsonPropertyName("Prefab")]
public object? Prefab { get; set; } // Prefab object or string public object? Prefab { get; set; } // Prefab object or string
@@ -37,7 +37,7 @@ public record TemplateItem
} }
[JsonPropertyName("_props")] [JsonPropertyName("_props")]
public Props? Properties { get; set; } public TemplateItemProperties? Properties { get; set; }
[JsonPropertyName("_proto")] [JsonPropertyName("_proto")]
public string? Prototype public string? Prototype
@@ -68,7 +68,7 @@ public record TemplateItem
} }
} }
public record Props public record TemplateItemProperties
{ {
private string? _backgroundColor; private string? _backgroundColor;
@@ -1108,12 +1108,12 @@ public record Props
[JsonPropertyName("effects_health")] [JsonPropertyName("effects_health")]
[JsonConverter(typeof(ArrayToObjectFactoryConverter))] [JsonConverter(typeof(ArrayToObjectFactoryConverter))]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public Dictionary<HealthFactor, EffectsHealthProps>? EffectsHealth { get; set; } public Dictionary<HealthFactor, EffectsHealthProperties>? EffectsHealth { get; set; }
[JsonPropertyName("effects_damage")] [JsonPropertyName("effects_damage")]
[JsonConverter(typeof(ArrayToObjectFactoryConverter))] [JsonConverter(typeof(ArrayToObjectFactoryConverter))]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)] [JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public Dictionary<DamageEffectType, EffectDamageProps>? EffectsDamage { get; set; } public Dictionary<DamageEffectType, EffectsDamageProperties>? EffectsDamage { get; set; }
// Confirmed in client // Confirmed in client
[JsonPropertyName("MaximumNumberOfUsage")] [JsonPropertyName("MaximumNumberOfUsage")]
@@ -1666,13 +1666,13 @@ public record Grid
public string? Parent { get; set; } public string? Parent { get; set; }
[JsonPropertyName("_props")] [JsonPropertyName("_props")]
public GridProps? Props { get; set; } public GridProperties? Properties { get; set; }
[JsonPropertyName("_proto")] [JsonPropertyName("_proto")]
public string? Proto { get; set; } public string? Proto { get; set; }
} }
public record GridProps public record GridProperties
{ {
[JsonPropertyName("filters")] [JsonPropertyName("filters")]
public IEnumerable<GridFilter>? Filters { get; set; } public IEnumerable<GridFilter>? Filters { get; set; }
@@ -1728,7 +1728,7 @@ public record Slot
public string? Parent { get; set; } public string? Parent { get; set; }
[JsonPropertyName("_props")] [JsonPropertyName("_props")]
public SlotProps? Props { get; set; } public SlotProperties? Properties { get; set; }
[JsonPropertyName("_max_count")] [JsonPropertyName("_max_count")]
public double? MaxCount { get; set; } public double? MaxCount { get; set; }
@@ -1747,7 +1747,7 @@ public record Slot
} }
} }
public record SlotProps public record SlotProperties
{ {
[JsonPropertyName("filters")] [JsonPropertyName("filters")]
public IEnumerable<SlotFilter>? Filters { get; set; } public IEnumerable<SlotFilter>? Filters { get; set; }
@@ -1801,7 +1801,7 @@ public record StackSlot
public double? MaxCount { get; set; } public double? MaxCount { get; set; }
[JsonPropertyName("_props")] [JsonPropertyName("_props")]
public StackSlotProps? Props { get; set; } public StackSlotProperties? Properties { get; set; }
[JsonPropertyName("_proto")] [JsonPropertyName("_proto")]
public string? Proto { get; set; } public string? Proto { get; set; }
@@ -1810,7 +1810,7 @@ public record StackSlot
public object? Upd { get; set; } // TODO: object here public object? Upd { get; set; } // TODO: object here
} }
public record StackSlotProps public record StackSlotProperties
{ {
[JsonPropertyName("filters")] [JsonPropertyName("filters")]
public IEnumerable<SlotFilter>? Filters { get; set; } public IEnumerable<SlotFilter>? Filters { get; set; }
@@ -1858,13 +1858,13 @@ public record RandomLootExcluded
public record EffectsHealth public record EffectsHealth
{ {
[JsonPropertyName("Energy")] [JsonPropertyName("Energy")]
public EffectsHealthProps? Energy { get; set; } public EffectsHealthProperties? Energy { get; set; }
[JsonPropertyName("Hydration")] [JsonPropertyName("Hydration")]
public EffectsHealthProps? Hydration { get; set; } public EffectsHealthProperties? Hydration { get; set; }
} }
public record EffectsHealthProps public record EffectsHealthProperties
{ {
[JsonPropertyName("value")] [JsonPropertyName("value")]
public double? Value { get; set; } public double? Value { get; set; }
@@ -1879,28 +1879,28 @@ public record EffectsHealthProps
public record EffectsDamage public record EffectsDamage
{ {
[JsonPropertyName("Pain")] [JsonPropertyName("Pain")]
public EffectDamageProps? Pain { get; set; } public EffectsDamageProperties? Pain { get; set; }
[JsonPropertyName("LightBleeding")] [JsonPropertyName("LightBleeding")]
public EffectDamageProps? LightBleeding { get; set; } public EffectsDamageProperties? LightBleeding { get; set; }
[JsonPropertyName("HeavyBleeding")] [JsonPropertyName("HeavyBleeding")]
public EffectDamageProps? HeavyBleeding { get; set; } public EffectsDamageProperties? HeavyBleeding { get; set; }
[JsonPropertyName("Contusion")] [JsonPropertyName("Contusion")]
public EffectDamageProps? Contusion { get; set; } public EffectsDamageProperties? Contusion { get; set; }
[JsonPropertyName("RadExposure")] [JsonPropertyName("RadExposure")]
public EffectDamageProps? RadExposure { get; set; } public EffectsDamageProperties? RadExposure { get; set; }
[JsonPropertyName("Fracture")] [JsonPropertyName("Fracture")]
public EffectDamageProps? Fracture { get; set; } public EffectsDamageProperties? Fracture { get; set; }
[JsonPropertyName("DestroyedPart")] [JsonPropertyName("DestroyedPart")]
public EffectDamageProps? DestroyedPart { get; set; } public EffectsDamageProperties? DestroyedPart { get; set; }
} }
public record EffectDamageProps public record EffectsDamageProperties
{ {
[JsonPropertyName("value")] [JsonPropertyName("value")]
public double? Value { get; set; } public double? Value { get; set; }
@@ -22,7 +22,7 @@ public record NewItemFromCloneDetails : NewItemDetailsBase
/// Item properties that should be applied over the top of the cloned base /// Item properties that should be applied over the top of the cloned base
/// </summary> /// </summary>
[JsonPropertyName("overrideProperties")] [JsonPropertyName("overrideProperties")]
public Props? OverrideProperties { get; set; } public TemplateItemProperties? OverrideProperties { get; set; }
/// <summary> /// <summary>
/// ParentId for the new item (item type) /// ParentId for the new item (item type)
@@ -83,7 +83,7 @@ public class BotEquipmentModPoolService(
foreach (var slot in item.Properties.Slots) foreach (var slot in item.Properties.Slots)
{ {
// Get mods that fit into the current mod slot // Get mods that fit into the current mod slot
var itemsThatFit = slot.Props.Filters.FirstOrDefault().Filter; var itemsThatFit = slot.Properties.Filters.FirstOrDefault().Filter;
// Get weapon/armor pool to add mod slots + mod tpls to // Get weapon/armor pool to add mod slots + mod tpls to
@@ -208,7 +208,7 @@ public class BotEquipmentModPoolService(
result.TryAdd(slot.Name, []); result.TryAdd(slot.Name, []);
// Add compatible tpls to dicts hashset // Add compatible tpls to dicts hashset
foreach (var compatibleItemTpl in slot.Props.Filters.FirstOrDefault().Filter) foreach (var compatibleItemTpl in slot.Properties.Filters.FirstOrDefault().Filter)
{ {
result[slot.Name].Add(compatibleItemTpl); result[slot.Name].Add(compatibleItemTpl);
} }
@@ -333,7 +333,7 @@ public class BotInventoryContainerService(ISptLogger<BotGeneratorHelper> logger,
{ {
// Assume all grids have same limitations // Assume all grids have same limitations
var firstSlotGrid = containerDetails.ContainerDbItem.Properties.Grids.FirstOrDefault(); var firstSlotGrid = containerDetails.ContainerDbItem.Properties.Grids.FirstOrDefault();
var propFilters = firstSlotGrid?.Props?.Filters; var propFilters = firstSlotGrid?.Properties?.Filters;
if (propFilters is null || !propFilters.Any()) if (propFilters is null || !propFilters.Any())
// No filters, item is fine to add // No filters, item is fine to add
{ {
@@ -425,7 +425,7 @@ public class BotInventoryContainerService(ISptLogger<BotGeneratorHelper> logger,
ContainerGridDetails.Add( ContainerGridDetails.Add(
new ContainerMapDetails new ContainerMapDetails
{ {
GridMap = new int[grid.Props.CellsV.GetValueOrDefault(), grid.Props.CellsH.GetValueOrDefault()], GridMap = new int[grid.Properties.CellsV.GetValueOrDefault(), grid.Properties.CellsH.GetValueOrDefault()],
GridFull = false, GridFull = false,
} }
); );
@@ -492,41 +492,41 @@ public class BotLootCacheService(
/// <summary> /// <summary>
/// Ammo/grenades have this property /// Ammo/grenades have this property
/// </summary> /// </summary>
/// <param name="props"></param> /// <param name="properties"></param>
/// <returns></returns> /// <returns></returns>
protected bool IsBulletOrGrenade(Props props) protected bool IsBulletOrGrenade(TemplateItemProperties properties)
{ {
return props.AmmoType is not null; return properties.AmmoType is not null;
} }
/// <summary> /// <summary>
/// Internal and external magazine have this property /// Internal and external magazine have this property
/// </summary> /// </summary>
/// <param name="props"></param> /// <param name="properties"></param>
/// <returns></returns> /// <returns></returns>
protected bool IsMagazine(Props props) protected bool IsMagazine(TemplateItemProperties properties)
{ {
return props.ReloadMagType is not null; return properties.ReloadMagType is not null;
} }
/// <summary> /// <summary>
/// Medical use items (e.g. morphine/lip balm/grizzly) /// Medical use items (e.g. morphine/lip balm/grizzly)
/// </summary> /// </summary>
/// <param name="props"></param> /// <param name="properties"></param>
/// <returns></returns> /// <returns></returns>
protected bool IsMedicalItem(Props props) protected bool IsMedicalItem(TemplateItemProperties properties)
{ {
return props.MedUseTime is not null; return properties.MedUseTime is not null;
} }
/// <summary> /// <summary>
/// Grenades have this property (e.g. smoke/frag/flash grenades) /// Grenades have this property (e.g. smoke/frag/flash grenades)
/// </summary> /// </summary>
/// <param name="props"></param> /// <param name="properties"></param>
/// <returns></returns> /// <returns></returns>
protected bool IsGrenade(Props props) protected bool IsGrenade(TemplateItemProperties properties)
{ {
return props.ThrowType is not null; return properties.ThrowType is not null;
} }
protected bool IsFood(MongoId tpl) protected bool IsFood(MongoId tpl)
@@ -1154,10 +1154,10 @@ public class FenceService(
{ {
foreach (var requiredSlot in softInsertSlots) foreach (var requiredSlot in softInsertSlots)
{ {
var modItemDbDetails = itemHelper.GetItem(requiredSlot.Props.Filters.First().Plate.Value).Value; var modItemDbDetails = itemHelper.GetItem(requiredSlot.Properties.Filters.First().Plate.Value).Value;
var durabilityValues = GetRandomisedArmorDurabilityValues(modItemDbDetails, traderConfig.Fence.ArmorMaxDurabilityPercentMinMax); var durabilityValues = GetRandomisedArmorDurabilityValues(modItemDbDetails, traderConfig.Fence.ArmorMaxDurabilityPercentMinMax);
var plateTpl = requiredSlot.Props.Filters.First().Plate ?? string.Empty; // "Plate" property appears to be the 'default' item for slot var plateTpl = requiredSlot.Properties.Filters.First().Plate ?? string.Empty; // "Plate" property appears to be the 'default' item for slot
if (plateTpl.IsEmpty) if (plateTpl.IsEmpty)
// Some bsg plate properties are empty, skip mod // Some bsg plate properties are empty, skip mod
{ {
@@ -1205,7 +1205,7 @@ public class FenceService(
{ {
foreach (var plateSlot in plateSlots) foreach (var plateSlot in plateSlots)
{ {
var plateTpl = plateSlot.Props.Filters.First().Plate; var plateTpl = plateSlot.Properties.Filters.First().Plate;
if (plateTpl == null || plateTpl.Value.IsEmpty) if (plateTpl == null || plateTpl.Value.IsEmpty)
// Bsg data lacks a default plate, skip randomising for this mod // Bsg data lacks a default plate, skip randomising for this mod
{ {
@@ -137,7 +137,7 @@ public class CustomItemService(
/// </summary> /// </summary>
/// <param name="overrideProperties"> New properties to apply </param> /// <param name="overrideProperties"> New properties to apply </param>
/// <param name="itemClone"> Item to update </param> /// <param name="itemClone"> Item to update </param>
protected void UpdateBaseItemPropertiesWithOverrides(Props? overrideProperties, TemplateItem itemClone) protected void UpdateBaseItemPropertiesWithOverrides(TemplateItemProperties? overrideProperties, TemplateItem itemClone)
{ {
if (overrideProperties is null || itemClone?.Properties is null) if (overrideProperties is null || itemClone?.Properties is null)
return; return;
@@ -285,7 +285,7 @@ public class CustomItemService(
var wall = itemHelper.GetItem(wallId); var wall = itemHelper.GetItem(wallId);
if (wall.Key) if (wall.Key)
{ {
wall.Value.Properties.Grids.First().Props.Filters.First().Filter.Add(newItemId); wall.Value.Properties.Grids.First().Properties.Filters.First().Filter.Add(newItemId);
} }
} }
} }
@@ -312,7 +312,7 @@ public class CustomItemService(
var weaponSlots = weapon.Value.Properties.Slots; var weaponSlots = weapon.Value.Properties.Slots;
foreach (var slot in weaponSlots) foreach (var slot in weaponSlots)
{ {
baseWeaponModObject[slot.Name] = [.. slot.Props.Filters.First().Filter]; baseWeaponModObject[slot.Name] = [.. slot.Properties.Filters.First().Filter];
} }
// Get PMCs // Get PMCs
@@ -121,7 +121,7 @@ public class RagfairLinkedItemService(DatabaseService databaseService, ItemHelpe
} }
// Get the first cylinder filter tpl // Get the first cylinder filter tpl
var cylinderTpl = cylinderMod.Props?.Filters?.First().Filter?.FirstOrDefault() ?? new MongoId(null); var cylinderTpl = cylinderMod.Properties?.Filters?.First().Filter?.FirstOrDefault() ?? new MongoId(null);
if (!cylinderTpl.IsValidMongoId()) if (!cylinderTpl.IsValidMongoId())
{ {
@@ -153,12 +153,12 @@ public class RagfairLinkedItemService(DatabaseService databaseService, ItemHelpe
// Check each slot and merge contents together into result set // Check each slot and merge contents together into result set
foreach (var slot in slots) foreach (var slot in slots)
{ {
if (slot.Props?.Filters is null) if (slot.Properties?.Filters is null)
{ {
continue; continue;
} }
foreach (var slotFilters in slot.Props.Filters) foreach (var slotFilters in slot.Properties.Filters)
{ {
result.UnionWith(slotFilters.Filter); result.UnionWith(slotFilters.Filter);
} }
@@ -179,12 +179,12 @@ public class RagfairLinkedItemService(DatabaseService databaseService, ItemHelpe
foreach (var chamber in chambers) foreach (var chamber in chambers)
{ {
if (chamber.Props?.Filters is null) if (chamber.Properties?.Filters is null)
{ {
continue; continue;
} }
foreach (var slotFilters in chamber.Props.Filters) foreach (var slotFilters in chamber.Properties.Filters)
{ {
result.UnionWith(slotFilters.Filter); result.UnionWith(slotFilters.Filter);
} }
@@ -205,12 +205,12 @@ public class RagfairLinkedItemService(DatabaseService databaseService, ItemHelpe
foreach (var cartridge in cartridges) foreach (var cartridge in cartridges)
{ {
if (cartridge.Props?.Filters is null) if (cartridge.Properties?.Filters is null)
{ {
continue; continue;
} }
foreach (var slotFilters in cartridge.Props.Filters) foreach (var slotFilters in cartridge.Properties.Filters)
{ {
result.UnionWith(slotFilters.Filter); result.UnionWith(slotFilters.Filter);
} }
@@ -175,9 +175,9 @@ public class ServerLocalisationService(
return rawLocalizedString; return rawLocalizedString;
} }
var typeProps = args.GetType().GetProperties(); var typeProperties = args.GetType().GetProperties();
foreach (var propertyInfo in typeProps) foreach (var propertyInfo in typeProperties)
{ {
var localizedName = $"{{{{{propertyInfo.GetJsonName()}}}}}"; var localizedName = $"{{{{{propertyInfo.GetJsonName()}}}}}";
if (rawLocalizedString.Contains(localizedName)) if (rawLocalizedString.Contains(localizedName))
@@ -376,14 +376,14 @@ public class ItemTplMongoIdGenerator(
private string GetAmmoBoxPrefix(TemplateItem item) private string GetAmmoBoxPrefix(TemplateItem item)
{ {
var ammoTpl = item.Properties?.StackSlots?.First()?.Props?.Filters?.First()?.Filter?.FirstOrDefault(); var ammoTpl = item.Properties?.StackSlots?.First()?.Properties?.Filters?.First()?.Filter?.FirstOrDefault();
return GetAmmoPrefix(_items[ammoTpl.Value]); return GetAmmoPrefix(_items[ammoTpl.Value]);
} }
private string GetMagazinePrefix(TemplateItem item) private string GetMagazinePrefix(TemplateItem item)
{ {
var ammoTpl = item.Properties?.Cartridges?.First()?.Props?.Filters?.First()?.Filter?.FirstOrDefault(); var ammoTpl = item.Properties?.Cartridges?.First()?.Properties?.Filters?.First()?.Filter?.FirstOrDefault();
return GetAmmoPrefix(_items[ammoTpl.Value]); return GetAmmoPrefix(_items[ammoTpl.Value]);
} }
@@ -459,7 +459,7 @@ public class ItemTplMongoIdGenerator(
// Add grid size for lootable containers // Add grid size for lootable containers
if (itemHelper.IsOfBaseclass(item.Id, BaseClasses.LOOT_CONTAINER)) if (itemHelper.IsOfBaseclass(item.Id, BaseClasses.LOOT_CONTAINER))
{ {
return $"{item.Properties.Grids.First()?.Props.CellsH}X{item.Properties.Grids.First()?.Props.CellsV}"; return $"{item.Properties.Grids.First()?.Properties.CellsH}X{item.Properties.Grids.First()?.Properties.CellsV}";
} }
// Add ammo caliber to conflicting weapons // Add ammo caliber to conflicting weapons