Added more type changes

This commit is contained in:
Chomp
2025-01-29 22:22:00 +00:00
parent feeec4ba6b
commit 58db41dd1e
15 changed files with 146 additions and 61 deletions
@@ -334,7 +334,7 @@ public class PlayerScavGenerator(
// Set cooldown time.
// Make sure to apply ScavCooldownTimer bonus from Hideout if the player has it.
var scavLockDuration = _databaseService.GetGlobals().Configuration.SavagePlayCooldown;
var modifier = 1D;
var modifier = 1;
foreach (var bonus in pmcData.Bonuses)
{
@@ -342,12 +342,12 @@ public class PlayerScavGenerator(
{
// Value is negative, so add.
// Also note that for scav cooldown, multiple bonuses stack additively.
modifier += (bonus?.Value ?? 1) / 100;
modifier += (int)(bonus?.Value ?? 1) / 100;
}
}
var fenceInfo = _fenceService.GetFenceInfo(pmcData);
modifier *= fenceInfo.SavageCooldownModifier ?? 1;
modifier *= (int)(fenceInfo.SavageCooldownModifier ?? 1);
scavLockDuration *= modifier;
var fullProfile = _profileHelper.GetFullProfile(pmcData?.SessionId);
@@ -355,7 +355,7 @@ public class PlayerScavGenerator(
scavLockDuration = 10;
if (scavData?.Info != null)
scavData.Info.SavageLockTime = Math.Round(_timeUtil.GetTimeStamp() / 1000 + scavLockDuration ?? 0);
scavData.Info.SavageLockTime = Math.Round((double)(_timeUtil.GetTimeStamp() / 1000 + scavLockDuration ?? 0));
return scavData;
}
+2 -2
View File
@@ -183,7 +183,7 @@ public class QuestHelper(
/// <returns>true if loyalty is high enough to fulfill quest requirement</returns>
public bool TraderLoyaltyLevelRequirementCheck(QuestCondition questProperties, PmcData profile)
{
var requiredLoyaltyLevel = questProperties.Value as float?;
var requiredLoyaltyLevel = questProperties.Value as double?;
if (!profile.TradersInfo.TryGetValue(
questProperties.Target.IsItem
? questProperties.Target.Item
@@ -227,7 +227,7 @@ public class QuestHelper(
return CompareAvailableForValues(trader.Standing ?? 1, requiredLoyaltyLevel, questProperties.CompareMethod);
}
protected bool CompareAvailableForValues(double current, float required, string compareMethod)
protected bool CompareAvailableForValues(double current, double required, string compareMethod)
{
switch (compareMethod)
{
+9 -4
View File
@@ -1,3 +1,4 @@
using Core.Models.Eft.Common;
using SptCommon.Annotations;
using Core.Models.Eft.Common.Tables;
using Core.Models.Spt.Config;
@@ -7,6 +8,7 @@ using Core.Services;
using Core.Utils;
using Core.Utils.Cloners;
using LogLevel = Core.Models.Spt.Logging.LogLevel;
using Core.Models.Enums;
namespace Core.Helpers;
@@ -71,7 +73,7 @@ public class RepairHelper(
if (applyMaxDurabilityDegradation) {
var randomisedWearAmount = isArmor
? GetRandomisedArmorRepairDegradationValue(
itemToRepairDetails.Properties.ArmorMaterial,
itemToRepairDetails.Properties.ArmorMaterial.Value,
useRepairKit,
itemCurrentMaxDurability ?? 0,
traderQualityMultipler
@@ -101,20 +103,23 @@ public class RepairHelper(
/// <summary>
/// Repairing armor reduces the total durability value slightly, get a randomised (to 2dp) amount based on armor material
/// </summary>
/// <param name="armorMaterial">What material is the armor being repaired made of</param>
/// <param name="material">What material is the armor being repaired made of</param>
/// <param name="isRepairKit">Was a repair kit used</param>
/// <param name="armorMax">Max amount of durability item can have</param>
/// <param name="traderQualityMultipler">Different traders produce different loss values</param>
/// <returns>Amount to reduce max durability by</returns>
protected double GetRandomisedArmorRepairDegradationValue(
string armorMaterial,
ArmorMaterial material,
bool isRepairKit,
double armorMax,
double traderQualityMultipler
)
{
// Degradation value is based on the armor material
var armorMaterialSettings = _databaseService.GetGlobals().Configuration.ArmorMaterials[armorMaterial];
if (!_databaseService.GetGlobals().Configuration.ArmorMaterials.TryGetValue(material, out var armorMaterialSettings))
{
_logger.Error($"Unable to find armor with a type of: {material}");
}
var minMultiplier = isRepairKit
? armorMaterialSettings.MinRepairKitDegradation
+49 -30
View File
@@ -258,38 +258,43 @@ public record ProjectileExplosionParams
[JsonPropertyName("ArmorDistanceDistanceDamage")]
public XYZ? ArmorDistanceDistanceDamage { get; set; }
// Checked in client
[JsonPropertyName("MinExplosionDistance")]
public float? MinExplosionDistance { get; set; }
public double? MinExplosionDistance { get; set; }
[JsonPropertyName("MaxExplosionDistance")]
public float? MaxExplosionDistance { get; set; }
// Checked in client
[JsonPropertyName("FragmentsCount")]
public double? FragmentsCount { get; set; }
public int? FragmentsCount { get; set; }
[JsonPropertyName("Strength")]
public float? Strength { get; set; }
public double? Strength { get; set; }
// Checked in client
[JsonPropertyName("ArmorDamage")]
public float? ArmorDamage { get; set; }
public double? ArmorDamage { get; set; }
// Checked in client
[JsonPropertyName("StaminaBurnRate")]
public float? StaminaBurnRate { get; set; }
public double? StaminaBurnRate { get; set; }
// Checked in client
[JsonPropertyName("PenetrationPower")]
public float? PenetrationPower { get; set; }
public double? PenetrationPower { get; set; }
[JsonPropertyName("DirectionalDamageAngle")]
public float? DirectionalDamageAngle { get; set; }
public double? DirectionalDamageAngle { get; set; }
[JsonPropertyName("DirectionalDamageMultiplier")]
public float? DirectionalDamageMultiplier { get; set; }
public double? DirectionalDamageMultiplier { get; set; }
[JsonPropertyName("FragmentType")]
public string? FragmentType { get; set; }
[JsonPropertyName("DeadlyDistance")]
public float? DeadlyDistance { get; set; }
public double? DeadlyDistance { get; set; }
}
public record Config
@@ -333,8 +338,9 @@ public record Config
[JsonPropertyName("RunddansSettings")]
public RunddansSettings? RunddansSettings { get; set; }
// Checked in client
[JsonPropertyName("SavagePlayCooldown")]
public double? SavagePlayCooldown { get; set; }
public int? SavagePlayCooldown { get; set; }
[JsonPropertyName("SavagePlayCooldownNdaFree")]
public double? SavagePlayCooldownNdaFree { get; set; }
@@ -433,7 +439,7 @@ public record Config
public AirdropGlobalSettings? Airdrop { get; set; }
[JsonPropertyName("ArmorMaterials")]
public Dictionary<string, ArmorType>? ArmorMaterials { get; set; }
public Dictionary<ArmorMaterial, ArmorType>? ArmorMaterials { get; set; }
[JsonPropertyName("ArenaEftTransferSettings")]
public ArenaEftTransferSettings
@@ -1121,14 +1127,17 @@ public record Exp
[JsonPropertyName("loot_attempts")]
public List<LootAttempt>? LootAttempts { get; set; }
// Confirmed in client
[JsonPropertyName("expForLevelOneDogtag")]
public double? ExpForLevelOneDogtag { get; set; }
// Confirmed in client
[JsonPropertyName("expForLockedDoorOpen")]
public double? ExpForLockedDoorOpen { get; set; }
public int? ExpForLockedDoorOpen { get; set; }
// Confirmed in client
[JsonPropertyName("expForLockedDoorBreach")]
public double? ExpForLockedDoorBreach { get; set; }
public int? ExpForLockedDoorBreach { get; set; }
[JsonPropertyName("triggerMult")]
public double? TriggerMult { get; set; }
@@ -1151,20 +1160,24 @@ public record MatchEnd
[JsonPropertyName("README")]
public string? ReadMe { get; set; }
// Confirmed in client
[JsonPropertyName("survived_exp_requirement")]
public double? SurvivedExperienceRequirement { get; set; }
public int? SurvivedExperienceRequirement { get; set; }
// Confirmed in client
[JsonPropertyName("survived_seconds_requirement")]
public double? SurvivedSecondsRequirement { get; set; }
public int? SurvivedSecondsRequirement { get; set; }
// Confirmed in client
[JsonPropertyName("survived_exp_reward")]
public double? SurvivedExperienceReward { get; set; }
public int? SurvivedExperienceReward { get; set; }
// Confirmed in client
[JsonPropertyName("mia_exp_reward")]
public double? MiaExperienceReward { get; set; }
public int? MiaExperienceReward { get; set; }
[JsonPropertyName("runner_exp_reward")]
public double? RunnerExperienceReward { get; set; }
public int? RunnerExperienceReward { get; set; }
[JsonPropertyName("leftMult")]
public double? LeftMultiplier { get; set; }
@@ -1271,8 +1284,9 @@ public record Armor
public record Class
{
// Checked in client
[JsonPropertyName("resistance")]
public double? Resistance { get; set; }
public int? Resistance { get; set; }
}
public record Mastering
@@ -1283,11 +1297,13 @@ public record Mastering
[JsonPropertyName("Templates")]
public List<string>? Templates { get; set; }
// Checked in client
[JsonPropertyName("Level2")]
public double? Level2 { get; set; }
public int? Level2 { get; set; }
// Checked in client
[JsonPropertyName("Level3")]
public double? Level3 { get; set; }
public int? Level3 { get; set; }
}
public record Customization
@@ -2273,8 +2289,9 @@ public record RagFair
[JsonPropertyName("priceStabilizerStartIntervalInHours")]
public double? PriceStabilizerStartIntervalInHours { get; set; }
// Checked in client
[JsonPropertyName("minUserLevel")]
public double? MinUserLevel { get; set; }
public int? MinUserLevel { get; set; }
[JsonPropertyName("communityTax")]
public float? CommunityTax { get; set; }
@@ -2282,8 +2299,9 @@ public record RagFair
[JsonPropertyName("communityItemTax")]
public float? CommunityItemTax { get; set; }
// Checked in client
[JsonPropertyName("communityRequirementTax")]
public float? CommunityRequirementTax { get; set; }
public double? CommunityRequirementTax { get; set; }
[JsonPropertyName("offerPriorityCost")]
public float? OfferPriorityCost { get; set; }
@@ -2316,7 +2334,7 @@ public record RagFair
public float? BalancerAveragePriceCoefficient { get; set; }
[JsonPropertyName("delaySinceOfferAdd")]
public float? DelaySinceOfferAdd { get; set; }
public int? DelaySinceOfferAdd { get; set; }
[JsonPropertyName("uniqueBuyerTimeoutInDays")]
public double? UniqueBuyerTimeoutInDays { get; set; }
@@ -2328,28 +2346,28 @@ public record RagFair
public long? RagfairTurnOnTimestamp { get; set; }
[JsonPropertyName("ratingSumForIncrease")]
public float? RatingSumForIncrease { get; set; }
public double? RatingSumForIncrease { get; set; }
[JsonPropertyName("ratingIncreaseCount")]
public double? RatingIncreaseCount { get; set; }
[JsonPropertyName("ratingSumForDecrease")]
public float? RatingSumForDecrease { get; set; }
public double? RatingSumForDecrease { get; set; }
[JsonPropertyName("ratingDecreaseCount")]
public double? RatingDecreaseCount { get; set; }
[JsonPropertyName("maxSumForIncreaseRatingPerOneSale")]
public float? MaxSumForIncreaseRatingPerOneSale { get; set; }
public double? MaxSumForIncreaseRatingPerOneSale { get; set; }
[JsonPropertyName("maxSumForDecreaseRatingPerOneSale")]
public float? MaxSumForDecreaseRatingPerOneSale { get; set; }
public double? MaxSumForDecreaseRatingPerOneSale { get; set; }
[JsonPropertyName("maxSumForRarity")]
public MaxSumForRarity? MaxSumForRarity { get; set; }
[JsonPropertyName("ChangePriceCoef")]
public float? ChangePriceCoef { get; set; }
public double? ChangePriceCoef { get; set; }
[JsonPropertyName("ItemRestrictions")]
public List<ItemGlobalRestrictions>? ItemRestrictions { get; set; }
@@ -3930,11 +3948,12 @@ public record Overheat
public record FenceSettings
{
// MongoId
[JsonPropertyName("FenceId")]
public string? FenceIdentifier { get; set; }
[JsonPropertyName("Levels")]
public Dictionary<string, FenceLevel>? Levels { get; set; }
public Dictionary<double, FenceLevel>? Levels { get; set; }
[JsonPropertyName("paidExitStandingNumerator")]
public double? PaidExitStandingNumerator { get; set; }
@@ -1,5 +1,6 @@
using System.Text.Json.Serialization;
using Core.Models.Common;
using Core.Models.Enums;
using Core.Utils.Json;
using Core.Utils.Json.Converters;
@@ -273,8 +274,9 @@ public record LocationBase
[JsonPropertyName("Events")]
public LocationEvents? Events { get; set; }
// Checked in client
[JsonPropertyName("exit_access_time")]
public double? ExitAccessTime { get; set; }
public int? ExitAccessTime { get; set; }
[JsonPropertyName("ForceOnlineRaidInPVE")]
public bool? ForceOnlineRaidInPVE { get; set; }
@@ -613,7 +615,7 @@ public record ChancedEnemy
public int? EnemyChance { get; set; }
[JsonPropertyName("Role")]
public string? Role { get; set; }
public WildSpawnType? Role { get; set; }
}
public record MinMaxBot : MinMax
@@ -745,10 +747,10 @@ public record Exit
public double? ExfiltrationTimePVE { get; set; }
[JsonPropertyName("ExfiltrationType")]
public string? ExfiltrationType { get; set; }
public ExfiltrationType? ExfiltrationType { get; set; }
[JsonPropertyName("RequiredSlot")]
public string? RequiredSlot { get; set; }
public EquipmentSlots? RequiredSlot { get; set; }
[JsonPropertyName("Id")]
public string? Id { get; set; }
@@ -759,6 +761,7 @@ public record Exit
[JsonPropertyName("MaxTimePVE")]
public double? MaxTimePVE { get; set; }
// Checked in client
[JsonPropertyName("MinTime")]
public double? MinTime { get; set; }
@@ -775,7 +778,7 @@ public record Exit
public string? _NameLower { get; set; }
[JsonPropertyName("PassageRequirement")]
public string? PassageRequirement { get; set; }
public RequirementState? PassageRequirement { get; set; }
[JsonPropertyName("PlayersCount")]
public int? PlayersCount { get; set; }
@@ -5,9 +5,11 @@ namespace Core.Models.Eft.Common.Tables;
public record Item
{
// MongoId
[JsonPropertyName("_id")]
public string? Id { get; set; }
// MongoId
[JsonPropertyName("_tpl")]
public string? Template { get; set; }
@@ -581,8 +581,9 @@ public record Props
[JsonPropertyName("BluntThroughput")]
public double? BluntThroughput { get; set; }
[JsonConverter(typeof(JsonStringEnumConverter))]
[JsonPropertyName("ArmorMaterial")]
public string? ArmorMaterial { get; set; }
public ArmorMaterial? ArmorMaterial { get; set; }
[JsonPropertyName("ArmorType")]
public string? ArmorType { get; set; }
@@ -68,7 +68,7 @@ public record TraderBase
public double? GridHeight { get; set; }
[JsonPropertyName("sell_modifier_for_prohibited_items")]
public decimal? SellModifierForProhibitedItems { get; set; }
public int? ProhibitedItemsSellModifier { get; set; }
[JsonPropertyName("insurance")]
public TraderInsurance? Insurance { get; set; }
@@ -122,9 +122,11 @@ public record TraderBase
public record ItemBuyData
{
// MongoId
[JsonPropertyName("category")]
public List<string>? Category { get; set; }
// MongoId
[JsonPropertyName("id_list")]
public List<string>? IdList { get; set; }
}
@@ -134,20 +136,24 @@ public record TraderInsurance
[JsonPropertyName("availability")]
public bool? Availability { get; set; }
// MongoId
[JsonPropertyName("excluded_category")]
public List<string>? ExcludedCategory { get; set; }
// Confirmed in client
[JsonPropertyName("max_return_hour")]
public double? MaxReturnHour { get; set; }
public int? MaxReturnHour { get; set; }
[JsonPropertyName("max_storage_time")]
public double? MaxStorageTime { get; set; }
// Confirmed in client
[JsonPropertyName("min_payment")]
public double? MinPayment { get; set; }
public int? MinPayment { get; set; }
// Confirmed in client
[JsonPropertyName("min_return_hour")]
public double? MinReturnHour { get; set; }
public int? MinReturnHour { get; set; }
}
public record TraderLoyaltyLevel
@@ -165,11 +171,12 @@ public record TraderLoyaltyLevel
[JsonConverter(typeof(StringToNumberFactoryConverter))]
public double? InsurancePriceCoefficient { get; set; }
// Chceked on client
[JsonPropertyName("minLevel")]
public double? MinLevel { get; set; }
public int? MinLevel { get; set; }
[JsonPropertyName("minSalesSum")]
public double? MinSalesSum { get; set; }
public long? MinSalesSum { get; set; }
[JsonPropertyName("minStanding")]
public double? MinStanding { get; set; }
@@ -279,6 +286,7 @@ public record SuitRequirements
[JsonPropertyName("profileLevel")]
public double? ProfileLevel { get; set; }
// Checked in client
[JsonPropertyName("standing")]
public double? Standing { get; set; }
@@ -0,0 +1,14 @@
namespace Core.Models.Enums
{
public enum ArmorMaterial
{
UHMWPE,
Aramid,
Combined,
Titan,
Aluminium,
ArmoredSteel,
Ceramic,
Glass
}
}
@@ -0,0 +1,9 @@
namespace Core.Models.Enums
{
public enum ExfiltrationType
{
Individual,
SharedTimer,
Manual
}
}
@@ -0,0 +1,20 @@
namespace Core.Models.Enums
{
public enum RequirementState
{
None,
Empty,
TransferItem,
WorldEvent,
NotEmpty,
HasItem,
WearsItem,
EmptyOrSize,
SkillLevel,
Reference,
ScavCooperation,
Train,
Timer,
SecretTransferItem
}
}
+5 -5
View File
@@ -1542,25 +1542,25 @@ public class FenceService(
if (pmcFenceInfo == null)
{
return fenceSettings.Levels["0"];
return fenceSettings.Levels[0];
}
var fenceLevels = fenceSettings.Levels.Keys.Select(int.Parse);
var fenceLevels = fenceSettings.Levels.Keys;
var minLevel = fenceLevels.Min();
var maxLevel = fenceLevels.Max();
var pmcFenceLevel = Math.Floor((double)pmcFenceInfo.Standing);
if (pmcFenceLevel < minLevel)
{
return fenceSettings.Levels[minLevel.ToString()];
return fenceSettings.Levels[minLevel];
}
if (pmcFenceLevel > maxLevel)
{
return fenceSettings.Levels[maxLevel.ToString()];
return fenceSettings.Levels[maxLevel];
}
return fenceSettings.Levels[pmcFenceLevel.ToString()];
return fenceSettings.Levels[pmcFenceLevel];
}
/**
@@ -3,6 +3,7 @@ using Core.Helpers;
using SptCommon.Annotations;
using Core.Models.Eft.Common;
using Core.Models.Eft.Game;
using Core.Models.Enums;
using Core.Models.Spt.Config;
using Core.Models.Spt.Location;
using Core.Models.Utils;
@@ -199,12 +200,12 @@ public class RaidTimeAdjustmentService(
List<ExtractChange> result = [];
// Adjust train exits only
foreach (var exit in mapBase.Exits) {
if (exit.PassageRequirement != "Train") {
if (exit.PassageRequirement != RequirementState.Train) {
continue;
}
// Prepare train adjustment object
ExtractChange exitChange = new ExtractChange {
var exitChange = new ExtractChange {
Name = exit.Name,
MinTime = null,
MaxTime = null,
+2 -2
View File
@@ -383,8 +383,8 @@ public class RepairService(
var durabilityPointCostArmor = globalRepairSettings.DurabilityPointCostArmor;
var repairArmorBonus = GetBonusMultiplierValue(BonusType.RepairArmorBonus, pmcData);
var armorBonus = 1.0 - (repairArmorBonus - 1.0) - intellectPointReduction;
var materialType = itemToRepairDetails.Properties.ArmorMaterial ?? "";
var armorMaterial = globalConfig.ArmorMaterials[materialType];
var materialType = itemToRepairDetails.Properties.ArmorMaterial.Value;
globalConfig.ArmorMaterials.TryGetValue(materialType, out var armorMaterial);
var destructability = 1 + armorMaterial.Destructibility;
var armorClass = itemToRepairDetails.Properties.ArmorClass.Value;
var armorClassDivisor = globals.Configuration.RepairSettings.ArmorClassDivisor;
+3
View File
@@ -47,6 +47,9 @@ public class JsonUtil
new EftEnumConverter<TraderServiceType>(),
new EftEnumConverter<CurrencyType>(),
new EftEnumConverter<RadioStationType>(),
new EftEnumConverter<ArmorMaterial>(),
new EftEnumConverter<RequirementState>(),
new EftEnumConverter<ExfiltrationType>(),
new BaseInteractionRequestDataConverter()
}
};