diff --git a/Core/Annotations/Injectable.cs b/Core/Annotations/Injectable.cs index 86b1d906..45caefde 100644 --- a/Core/Annotations/Injectable.cs +++ b/Core/Annotations/Injectable.cs @@ -1,10 +1,11 @@ namespace Core.Annotations; [AttributeUsage(AttributeTargets.Class)] -public class Injectable(InjectionType injectionType = InjectionType.Scoped, Type? type = null) : Attribute +public class Injectable(InjectionType injectionType = InjectionType.Scoped, Type? type = null, int typePriority = Int32.MaxValue) : Attribute { public InjectionType InjectionType { get; set; } = injectionType; public Type? InjectableTypeOverride { get; set; } = type; + public int TypePriority { get; set; } = typePriority; } public enum InjectionType diff --git a/Core/Callbacks/HttpCallbacks.cs b/Core/Callbacks/HttpCallbacks.cs index 2f355169..7aa6f9dc 100644 --- a/Core/Callbacks/HttpCallbacks.cs +++ b/Core/Callbacks/HttpCallbacks.cs @@ -1,26 +1,34 @@ -using Core.DI; +using Core.Annotations; +using Core.Context; +using Core.DI; +using Core.Servers; namespace Core.Callbacks; +[Injectable(InjectionType.Singleton, typePriority: 1)] public class HttpCallbacks : OnLoad { - public HttpCallbacks() + private readonly HttpServer _httpServer; + private readonly ApplicationContext _applicationContext; + public HttpCallbacks(HttpServer httpServer, ApplicationContext applicationContext) { - + _httpServer = httpServer; + _applicationContext = applicationContext; } public async Task OnLoad() { - throw new NotImplementedException(); + _httpServer.Load((WebApplicationBuilder) _applicationContext.GetLatestValue(ContextVariableType.APP_BUILDER).Value); + _applicationContext.ClearValues(ContextVariableType.APP_BUILDER); } public string GetRoute() { - throw new NotImplementedException(); + return "spt-http"; } public string GetImage() { - throw new NotImplementedException(); + return ""; } } \ No newline at end of file diff --git a/Core/Context/ContextVariableType.cs b/Core/Context/ContextVariableType.cs index 409e7656..eb3b54ce 100644 --- a/Core/Context/ContextVariableType.cs +++ b/Core/Context/ContextVariableType.cs @@ -13,4 +13,5 @@ public enum ContextVariableType RAID_ADJUSTMENTS = 4, /** Data returned from client request object from endLocalRaid() */ TRANSIT_INFO = 5, + APP_BUILDER = 6 } \ No newline at end of file diff --git a/Core/Controllers/DialogueController.cs b/Core/Controllers/DialogueController.cs index 53981eb9..c2cdd595 100644 --- a/Core/Controllers/DialogueController.cs +++ b/Core/Controllers/DialogueController.cs @@ -10,10 +10,12 @@ public class DialogueController /// /// /// + /* public void RegisterChatBot(DialogueChatBot chatBot) // TODO: this is in with the helper types { throw new NotImplementedException(); } + */ /// /// Handle onUpdate spt event diff --git a/Core/Controllers/GameController.cs b/Core/Controllers/GameController.cs index 74278ab6..930c91a7 100644 --- a/Core/Controllers/GameController.cs +++ b/Core/Controllers/GameController.cs @@ -70,10 +70,12 @@ public class GameController /// /// /// + /* public CurrentGroupResponse GetCurrentGroup(string sessionId) { throw new NotImplementedException(); } + */ /// /// Handle client/checkVersion diff --git a/Core/Controllers/TradeController.cs b/Core/Controllers/TradeController.cs index fbccc2af..ff25706e 100644 --- a/Core/Controllers/TradeController.cs +++ b/Core/Controllers/TradeController.cs @@ -125,7 +125,7 @@ public class TradeController private void MailMoneyToPlayer( string sessionId, int roublesToSend, - Traders trader) // TODO: This is a static class now and cannot be passed as a param. + string trader) { throw new NotImplementedException(); } diff --git a/Core/Models/Eft/Common/Globals.cs b/Core/Models/Eft/Common/Globals.cs index a523ae92..e81126f9 100644 --- a/Core/Models/Eft/Common/Globals.cs +++ b/Core/Models/Eft/Common/Globals.cs @@ -92,34 +92,34 @@ public class RadioStation public class LocationInfection { [JsonPropertyName("Interchange")] - public int Interchange { get; set; } + public double Interchange { get; set; } [JsonPropertyName("Lighthouse")] - public int Lighthouse { get; set; } + public double Lighthouse { get; set; } [JsonPropertyName("RezervBase")] - public int RezervBase { get; set; } + public double RezervBase { get; set; } [JsonPropertyName("Sandbox")] - public int Sandbox { get; set; } + public double Sandbox { get; set; } [JsonPropertyName("Shoreline")] - public int Shoreline { get; set; } + public double Shoreline { get; set; } [JsonPropertyName("TarkovStreets")] - public int TarkovStreets { get; set; } + public double TarkovStreets { get; set; } [JsonPropertyName("Woods")] - public int Woods { get; set; } + public double Woods { get; set; } [JsonPropertyName("bigmap")] - public int BigMap { get; set; } + public double BigMap { get; set; } [JsonPropertyName("factory4")] - public int Factory4 { get; set; } + public double Factory4 { get; set; } [JsonPropertyName("laboratory")] - public int Laboratory { get; set; } + public double Laboratory { get; set; } } public class ArtilleryShelling @@ -131,7 +131,7 @@ public class ArtilleryShelling public ProjectileExplosionParams ProjectileExplosionParams { get; set; } [JsonPropertyName("MaxCalledShellingCount")] - public int MaxCalledShellingCount { get; set; } + public double MaxCalledShellingCount { get; set; } } public class ArtilleryMapSettings @@ -140,22 +140,22 @@ public class ArtilleryMapSettings public bool PlanedShellingOn { get; set; } [JsonPropertyName("InitShellingTimer")] - public int InitShellingTimer { get; set; } + public double InitShellingTimer { get; set; } [JsonPropertyName("BeforeShellingSignalTime")] - public int BeforeShellingSignalTime { get; set; } + public double BeforeShellingSignalTime { get; set; } [JsonPropertyName("ShellingCount")] - public int ShellingCount { get; set; } + public double ShellingCount { get; set; } [JsonPropertyName("ZonesInShelling")] - public int ZonesInShelling { get; set; } + public double ZonesInShelling { get; set; } [JsonPropertyName("NewZonesForEachShelling")] public bool NewZonesForEachShelling { get; set; } [JsonPropertyName("InitCalledShellingTime")] - public int InitCalledShellingTime { get; set; } + public double InitCalledShellingTime { get; set; } [JsonPropertyName("ShellingZones")] public List ShellingZones { get; set; } @@ -173,16 +173,16 @@ public class ArtilleryMapSettings public class ShellingZone { [JsonPropertyName("ID")] - public int ID { get; set; } + public double ID { get; set; } [JsonPropertyName("PointsInShellings")] public XYZ PointsInShellings { get; set; } [JsonPropertyName("ShellingRounds")] - public int ShellingRounds { get; set; } + public double ShellingRounds { get; set; } [JsonPropertyName("ShotCount")] - public int ShotCount { get; set; } + public double ShotCount { get; set; } [JsonPropertyName("PauseBetweenRounds")] public XYZ PauseBetweenRounds { get; set; } @@ -194,7 +194,7 @@ public class ShellingZone public XYZ Center { get; set; } [JsonPropertyName("Rotate")] - public int Rotate { get; set; } + public double Rotate { get; set; } [JsonPropertyName("GridStep")] public XYZ GridStep { get; set; } @@ -203,7 +203,7 @@ public class ShellingZone public XYZ Points { get; set; } [JsonPropertyName("PointRadius")] - public int PointRadius { get; set; } + public double PointRadius { get; set; } [JsonPropertyName("ExplosionDistanceRange")] public XYZ ExplosionDistanceRange { get; set; } @@ -212,7 +212,7 @@ public class ShellingZone public List AlarmStages { get; set; } [JsonPropertyName("BeforeShellingSignalTime")] - public int BeforeShellingSignalTime { get; set; } + public double BeforeShellingSignalTime { get; set; } [JsonPropertyName("UsedInPlanedShelling")] public bool UsedInPlanedShelling { get; set; } @@ -233,7 +233,7 @@ public class AlarmStage public class Brigade { [JsonPropertyName("ID")] - public int Id { get; set; } + public double Id { get; set; } [JsonPropertyName("ArtilleryGuns")] public List ArtilleryGuns { get; set; } @@ -251,7 +251,7 @@ public class ArtilleryShellingAirDropSettings public bool UseAirDrop { get; set; } [JsonPropertyName("AirDropTime")] - public int AirDropTime { get; set; } + public double AirDropTime { get; set; } [JsonPropertyName("AirDropPosition")] public XYZ AirDropPosition { get; set; } @@ -278,7 +278,7 @@ public class ProjectileExplosionParams public float MaxExplosionDistance { get; set; } [JsonPropertyName("FragmentsCount")] - public int FragmentsCount { get; set; } + public double FragmentsCount { get; set; } [JsonPropertyName("Strength")] public float Strength { get; set; } @@ -335,13 +335,13 @@ public class Config public Armor Armor { get; set; } [JsonPropertyName("SessionsToShowHotKeys")] - public int SessionsToShowHotKeys { get; set; } + public double SessionsToShowHotKeys { get; set; } [JsonPropertyName("MaxBotsAliveOnMap")] - public int MaxBotsAliveOnMap { get; set; } + public double MaxBotsAliveOnMap { get; set; } [JsonPropertyName("MaxBotsAliveOnMapPvE")] - public int MaxBotsAliveOnMapPvE { get; set; } + public double MaxBotsAliveOnMapPvE { get; set; } [JsonPropertyName("RunddansSettings")] public RunddansSettings RunddansSettings { get; set; } @@ -626,43 +626,43 @@ public class RunddansSettings public bool ActivePVE { get; set; } [JsonPropertyName("applyFrozenEverySec")] - public int ApplyFrozenEverySec { get; set; } + public double ApplyFrozenEverySec { get; set; } [JsonPropertyName("consumables")] public List Consumables { get; set; } [JsonPropertyName("drunkImmunitySec")] - public int DrunkImmunitySec { get; set; } + public double DrunkImmunitySec { get; set; } [JsonPropertyName("durability")] public XY Durability { get; set; } [JsonPropertyName("fireDistanceToHeat")] - public int FireDistanceToHeat { get; set; } + public double FireDistanceToHeat { get; set; } [JsonPropertyName("grenadeDistanceToBreak")] - public int GrenadeDistanceToBreak { get; set; } + public double GrenadeDistanceToBreak { get; set; } [JsonPropertyName("interactionDistance")] - public int InteractionDistance { get; set; } + public double InteractionDistance { get; set; } [JsonPropertyName("knifeCritChanceToBreak")] - public int KnifeCritChanceToBreak { get; set; } + public double KnifeCritChanceToBreak { get; set; } [JsonPropertyName("locations")] public List Locations { get; set; } [JsonPropertyName("multitoolRepairSec")] - public int MultitoolRepairSec { get; set; } + public double MultitoolRepairSec { get; set; } [JsonPropertyName("nonExitsLocations")] public List NonExitsLocations { get; set; } [JsonPropertyName("rainForFrozen")] - public int RainForFrozen { get; set; } + public double RainForFrozen { get; set; } [JsonPropertyName("repairSec")] - public int RepairSec { get; set; } + public double RepairSec { get; set; } [JsonPropertyName("secToBreak")] public XY SecToBreak { get; set; } @@ -686,7 +686,7 @@ public class SeasonActivityHalloween public bool Enabled { get; set; } [JsonPropertyName("ZombieBleedMul")] - public int ZombieBleedMul { get; set; } + public double ZombieBleedMul { get; set; } } public class EnvironmentSetting2 @@ -854,10 +854,10 @@ public class EventWeather public double Cloudness { get; set; } [JsonPropertyName("Hour")] - public int Hour { get; set; } + public double Hour { get; set; } [JsonPropertyName("Minute")] - public int Minute { get; set; } + public double Minute { get; set; } [JsonPropertyName("Rain")] public double Rain { get; set; } @@ -1145,7 +1145,7 @@ public class Content public string Ip { get; set; } [JsonPropertyName("port")] - public int Port { get; set; } + public double Port { get; set; } [JsonPropertyName("root")] public string Root { get; set; } @@ -1198,40 +1198,40 @@ public class MatchEnd { public string ReadMe { get; set; } [JsonPropertyName("survived_exp_requirement")] - public int SurvivedExperienceRequirement { get; set; } + public double SurvivedExperienceRequirement { get; set; } [JsonPropertyName("survived_seconds_requirement")] - public int SurvivedSecondsRequirement { get; set; } + public double SurvivedSecondsRequirement { get; set; } [JsonPropertyName("survived_exp_reward")] - public int SurvivedExperienceReward { get; set; } + public double SurvivedExperienceReward { get; set; } [JsonPropertyName("mia_exp_reward")] - public int MiaExperienceReward { get; set; } + public double MiaExperienceReward { get; set; } [JsonPropertyName("runner_exp_reward")] - public int RunnerExperienceReward { get; set; } + public double RunnerExperienceReward { get; set; } [JsonPropertyName("leftMult")] - public int LeftMultiplier { get; set; } + public double LeftMultiplier { get; set; } [JsonPropertyName("miaMult")] - public int MiaMultiplier { get; set; } + public double MiaMultiplier { get; set; } [JsonPropertyName("survivedMult")] - public int SurvivedMultiplier { get; set; } + public double SurvivedMultiplier { get; set; } [JsonPropertyName("runnerMult")] - public int RunnerMultiplier { get; set; } + public double RunnerMultiplier { get; set; } [JsonPropertyName("killedMult")] - public int KilledMultiplier { get; set; } + public double KilledMultiplier { get; set; } [JsonPropertyName("transit_exp_reward")] - public int TransitExperienceReward { get; set; } + public double TransitExperienceReward { get; set; } [JsonPropertyName("transit_mult")] - public int[][] TransitMultiplier { get; set; } + public List> TransitMultiplier { get; set; } } public class Kill { @@ -1239,39 +1239,39 @@ public class Kill { public Combo[] Combos { get; set; } [JsonPropertyName("victimLevelExp")] - public int VictimLevelExperience { get; set; } + public double VictimLevelExperience { get; set; } [JsonPropertyName("headShotMult")] - public int HeadShotMultiplier { get; set; } + public double HeadShotMultiplier { get; set; } [JsonPropertyName("expOnDamageAllHealth")] - public int ExperienceOnDamageAllHealth { get; set; } + public double ExperienceOnDamageAllHealth { get; set; } [JsonPropertyName("longShotDistance")] - public int LongShotDistance { get; set; } + public double LongShotDistance { get; set; } [JsonPropertyName("bloodLossToLitre")] - public int BloodLossToLitre { get; set; } + public double BloodLossToLitre { get; set; } [JsonPropertyName("botExpOnDamageAllHealth")] - public int BotExperienceOnDamageAllHealth { get; set; } + public double BotExperienceOnDamageAllHealth { get; set; } [JsonPropertyName("botHeadShotMult")] - public int BotHeadShotMultiplier { get; set; } + public double BotHeadShotMultiplier { get; set; } [JsonPropertyName("victimBotLevelExp")] - public int VictimBotLevelExperience { get; set; } + public double VictimBotLevelExperience { get; set; } [JsonPropertyName("pmcExpOnDamageAllHealth")] - public int PmcExperienceOnDamageAllHealth { get; set; } + public double PmcExperienceOnDamageAllHealth { get; set; } [JsonPropertyName("pmcHeadShotMult")] - public int PmcHeadShotMultiplier { get; set; } + public double PmcHeadShotMultiplier { get; set; } } public class Combo { [JsonPropertyName("percent")] - public int Percentage { get; set; } + public double Percentage { get; set; } } public class Level { @@ -1279,31 +1279,31 @@ public class Level { public ExpTable[] ExperienceTable { get; set; } [JsonPropertyName("trade_level")] - public int TradeLevel { get; set; } + public double TradeLevel { get; set; } [JsonPropertyName("savage_level")] - public int SavageLevel { get; set; } + public double SavageLevel { get; set; } [JsonPropertyName("clan_level")] - public int ClanLevel { get; set; } + public double ClanLevel { get; set; } [JsonPropertyName("mastering1")] - public int Mastering1 { get; set; } + public double Mastering1 { get; set; } [JsonPropertyName("mastering2")] - public int Mastering2 { get; set; } + public double Mastering2 { get; set; } } public class ExpTable { [JsonPropertyName("exp")] - public int Experience { get; set; } + public double Experience { get; set; } } public class LootAttempt { [JsonPropertyName("k_exp")] - public int ExperiencePoints { get; set; } + public double ExperiencePoints { get; set; } } public class Armor @@ -1315,7 +1315,7 @@ public class Armor public class Class { [JsonPropertyName("resistance")] - public int Resistance { get; set; } + public double Resistance { get; set; } } public class Mastering @@ -1327,10 +1327,10 @@ public class Mastering public List Templates { get; set; } [JsonPropertyName("Level2")] - public int Level2 { get; set; } + public double Level2 { get; set; } [JsonPropertyName("Level3")] - public int Level3 { get; set; } + public double Level3 { get; set; } } public class Customization @@ -1668,7 +1668,7 @@ public class BodyParts public class AirdropGlobalSettings { - [JsonPropertyName("airdropViewType")] + [JsonPropertyName("AirdropViewType")] public string AirdropViewType { get; set; } [JsonPropertyName("parachuteEndOpenHeight")] @@ -1780,22 +1780,22 @@ public class ArmorMaterials public class ArmorType { [JsonPropertyName("Destructibility")] - public int Destructibility { get; set; } + public double Destructibility { get; set; } [JsonPropertyName("MinRepairDegradation")] - public int MinRepairDegradation { get; set; } + public double MinRepairDegradation { get; set; } [JsonPropertyName("MaxRepairDegradation")] - public int MaxRepairDegradation { get; set; } + public double MaxRepairDegradation { get; set; } [JsonPropertyName("ExplosionDestructibility")] - public int ExplosionDestructibility { get; set; } + public double ExplosionDestructibility { get; set; } [JsonPropertyName("MinRepairKitDegradation")] - public int MinRepairKitDegradation { get; set; } + public double MinRepairKitDegradation { get; set; } [JsonPropertyName("MaxRepairKitDegradation")] - public int MaxRepairKitDegradation { get; set; } + public double MaxRepairKitDegradation { get; set; } } public class Health @@ -1816,10 +1816,10 @@ public class Health public class Falling { [JsonPropertyName("DamagePerMeter")] - public int DamagePerMeter { get; set; } + public double DamagePerMeter { get; set; } [JsonPropertyName("SafeHeight")] - public int SafeHeight { get; set; } + public double SafeHeight { get; set; } } public class Effects @@ -1912,79 +1912,79 @@ public class Effects public class ZombieInfection { [JsonPropertyName("Dehydration")] - public int Dehydration { get; set; } + public double Dehydration { get; set; } [JsonPropertyName("HearingDebuffPercentage")] - public int HearingDebuffPercentage { get; set; } + public double HearingDebuffPercentage { get; set; } [JsonPropertyName("CumulativeTime")] - public int CumulativeTime { get; set; } + public double CumulativeTime { get; set; } } public class Existence { [JsonPropertyName("EnergyLoopTime")] - public int EnergyLoopTime { get; set; } + public double EnergyLoopTime { get; set; } [JsonPropertyName("HydrationLoopTime")] - public int HydrationLoopTime { get; set; } + public double HydrationLoopTime { get; set; } [JsonPropertyName("EnergyDamage")] - public int EnergyDamage { get; set; } + public double EnergyDamage { get; set; } [JsonPropertyName("HydrationDamage")] - public int HydrationDamage { get; set; } + public double HydrationDamage { get; set; } [JsonPropertyName("DestroyedStomachEnergyTimeFactor")] - public int DestroyedStomachEnergyTimeFactor { get; set; } + public double DestroyedStomachEnergyTimeFactor { get; set; } [JsonPropertyName("DestroyedStomachHydrationTimeFactor")] - public int DestroyedStomachHydrationTimeFactor { get; set; } + public double DestroyedStomachHydrationTimeFactor { get; set; } } public class Dehydration { [JsonPropertyName("DefaultDelay")] - public int DefaultDelay { get; set; } + public double DefaultDelay { get; set; } [JsonPropertyName("DefaultResidueTime")] - public int DefaultResidueTime { get; set; } + public double DefaultResidueTime { get; set; } [JsonPropertyName("BleedingHealth")] - public int BleedingHealth { get; set; } + public double BleedingHealth { get; set; } [JsonPropertyName("BleedingLoopTime")] - public int BleedingLoopTime { get; set; } + public double BleedingLoopTime { get; set; } [JsonPropertyName("BleedingLifeTime")] - public int BleedingLifeTime { get; set; } + public double BleedingLifeTime { get; set; } [JsonPropertyName("DamageOnStrongDehydration")] - public int DamageOnStrongDehydration { get; set; } + public double DamageOnStrongDehydration { get; set; } [JsonPropertyName("StrongDehydrationLoopTime")] - public int StrongDehydrationLoopTime { get; set; } + public double StrongDehydrationLoopTime { get; set; } } public class BreakPart { [JsonPropertyName("DefaultDelay")] - public int DefaultDelay { get; set; } + public double DefaultDelay { get; set; } [JsonPropertyName("DefaultResidueTime")] - public int DefaultResidueTime { get; set; } + public double DefaultResidueTime { get; set; } [JsonPropertyName("HealExperience")] - public int HealExperience { get; set; } + public double HealExperience { get; set; } [JsonPropertyName("OfflineDurationMin")] - public int OfflineDurationMin { get; set; } + public double OfflineDurationMin { get; set; } [JsonPropertyName("OfflineDurationMax")] - public int OfflineDurationMax { get; set; } + public double OfflineDurationMax { get; set; } [JsonPropertyName("RemovePrice")] - public int RemovePrice { get; set; } + public double RemovePrice { get; set; } [JsonPropertyName("RemovedAfterDeath")] public bool RemovedAfterDeath { get; set; } @@ -1999,94 +1999,94 @@ public class BreakPart public class Contusion { [JsonPropertyName("Dummy")] - public int Dummy { get; set; } + public double Dummy { get; set; } } public class Disorientation { [JsonPropertyName("Dummy")] - public int Dummy { get; set; } + public double Dummy { get; set; } } public class Exhaustion { [JsonPropertyName("DefaultDelay")] - public int DefaultDelay { get; set; } + public double DefaultDelay { get; set; } [JsonPropertyName("DefaultResidueTime")] - public int DefaultResidueTime { get; set; } + public double DefaultResidueTime { get; set; } [JsonPropertyName("Damage")] - public int Damage { get; set; } + public double Damage { get; set; } [JsonPropertyName("DamageLoopTime")] - public int DamageLoopTime { get; set; } + public double DamageLoopTime { get; set; } } public class LowEdgeHealth { [JsonPropertyName("DefaultDelay")] - public int DefaultDelay { get; set; } + public double DefaultDelay { get; set; } [JsonPropertyName("DefaultResidueTime")] - public int DefaultResidueTime { get; set; } + public double DefaultResidueTime { get; set; } [JsonPropertyName("StartCommonHealth")] - public int StartCommonHealth { get; set; } + public double StartCommonHealth { get; set; } } public class RadExposure { [JsonPropertyName("Damage")] - public int Damage { get; set; } + public double Damage { get; set; } [JsonPropertyName("DamageLoopTime")] - public int DamageLoopTime { get; set; } + public double DamageLoopTime { get; set; } } public class Stun { [JsonPropertyName("Dummy")] - public int Dummy { get; set; } + public double Dummy { get; set; } } public class Intoxication { [JsonPropertyName("DefaultDelay")] - public int DefaultDelay { get; set; } + public double DefaultDelay { get; set; } [JsonPropertyName("DefaultResidueTime")] - public int DefaultResidueTime { get; set; } + public double DefaultResidueTime { get; set; } [JsonPropertyName("DamageHealth")] - public int DamageHealth { get; set; } + public double DamageHealth { get; set; } [JsonPropertyName("HealthLoopTime")] - public int HealthLoopTime { get; set; } + public double HealthLoopTime { get; set; } [JsonPropertyName("OfflineDurationMin")] - public int OfflineDurationMin { get; set; } + public double OfflineDurationMin { get; set; } [JsonPropertyName("OfflineDurationMax")] - public int OfflineDurationMax { get; set; } + public double OfflineDurationMax { get; set; } [JsonPropertyName("RemovedAfterDeath")] public bool RemovedAfterDeath { get; set; } [JsonPropertyName("HealExperience")] - public int HealExperience { get; set; } + public double HealExperience { get; set; } [JsonPropertyName("RemovePrice")] - public int RemovePrice { get; set; } + public double RemovePrice { get; set; } } public class Regeneration { [JsonPropertyName("LoopTime")] - public int LoopTime { get; set; } + public double LoopTime { get; set; } [JsonPropertyName("MinimumHealthPercentage")] - public int MinimumHealthPercentage { get; set; } + public double MinimumHealthPercentage { get; set; } [JsonPropertyName("Energy")] - public int Energy { get; set; } + public double Energy { get; set; } [JsonPropertyName("Hydration")] - public int Hydration { get; set; } + public double Hydration { get; set; } [JsonPropertyName("BodyHealth")] public BodyHealth BodyHealth { get; set; } @@ -2223,34 +2223,34 @@ public class Pain public class PainKiller { [JsonPropertyName("dummy")] - public int Dummy { get; set; } + public double Dummy { get; set; } } public class SandingScreen { [JsonPropertyName("dummy")] - public int Dummy { get; set; } + public double Dummy { get; set; } } public class MusclePainEffect { [JsonPropertyName("gymEffectivity")] - public int GymEffectivity { get; set; } + public double GymEffectivity { get; set; } [JsonPropertyName("offlineDurationMax")] - public int OfflineDurationMax { get; set; } + public double OfflineDurationMax { get; set; } [JsonPropertyName("offlineDurationMin")] - public int OfflineDurationMin { get; set; } + public double OfflineDurationMin { get; set; } [JsonPropertyName("traumaChance")] - public int TraumaChance { get; set; } + public double TraumaChance { get; set; } } public class Stimulator { [JsonPropertyName("buffLoopTime")] - public int BuffLoopTime { get; set; } + public double BuffLoopTime { get; set; } [JsonPropertyName("buffs")] public Buffs Buffs { get; set; } @@ -2599,10 +2599,10 @@ public class HealPrice public double EnergyPointPrice { get; set; } [JsonPropertyName("TrialLevels")] - public int TrialLevels { get; set; } + public double TrialLevels { get; set; } [JsonPropertyName("TrialRaids")] - public int TrialRaids { get; set; } + public double TrialRaids { get; set; } } public class ProfileHealthSettings @@ -2644,13 +2644,13 @@ public class BodyPartsSettings public class BodyPartsSetting { [JsonPropertyName("Minimum")] - public int Minimum { get; set; } + public double Minimum { get; set; } [JsonPropertyName("Maximum")] - public int Maximum { get; set; } + public double Maximum { get; set; } [JsonPropertyName("Default")] - public int Default { get; set; } + public double Default { get; set; } [JsonPropertyName("EnvironmentDamageMultiplier")] public float EnvironmentDamageMultiplier { get; set; } @@ -2680,22 +2680,22 @@ public class HealthFactorsSettings public class HealthFactorSetting { [JsonPropertyName("Minimum")] - public int Minimum { get; set; } + public double Minimum { get; set; } [JsonPropertyName("Maximum")] - public int Maximum { get; set; } + public double Maximum { get; set; } [JsonPropertyName("Default")] - public int Default { get; set; } + public double Default { get; set; } } public class Rating { [JsonPropertyName("levelRequired")] - public int LevelRequired { get; set; } + public double LevelRequired { get; set; } [JsonPropertyName("limit")] - public int Limit { get; set; } + public double Limit { get; set; } [JsonPropertyName("categories")] public Categories Categories { get; set; } @@ -2740,10 +2740,10 @@ public class Tournament public TournamentCategories Categories { get; set; } [JsonPropertyName("limit")] - public int Limit { get; set; } + public double Limit { get; set; } [JsonPropertyName("levelRequired")] - public int LevelRequired { get; set; } + public double LevelRequired { get; set; } } public class TournamentCategories @@ -2764,10 +2764,10 @@ public class RagFair public bool IncludePveTraderSales { get; set; } [JsonPropertyName("priceStabilizerStartIntervalInHours")] - public int PriceStabilizerStartIntervalInHours { get; set; } + public double PriceStabilizerStartIntervalInHours { get; set; } [JsonPropertyName("minUserLevel")] - public int MinUserLevel { get; set; } + public double MinUserLevel { get; set; } [JsonPropertyName("communityTax")] public float CommunityTax { get; set; } @@ -2782,16 +2782,16 @@ public class RagFair public float OfferPriorityCost { get; set; } [JsonPropertyName("offerDurationTimeInHour")] - public int OfferDurationTimeInHour { get; set; } + public double OfferDurationTimeInHour { get; set; } [JsonPropertyName("offerDurationTimeInHourAfterRemove")] - public int OfferDurationTimeInHourAfterRemove { get; set; } + public double OfferDurationTimeInHourAfterRemove { get; set; } [JsonPropertyName("priorityTimeModifier")] public float PriorityTimeModifier { get; set; } [JsonPropertyName("maxRenewOfferTimeInHour")] - public int MaxRenewOfferTimeInHour { get; set; } + public double MaxRenewOfferTimeInHour { get; set; } [JsonPropertyName("renewPricePerHour")] public float RenewPricePerHour { get; set; } @@ -2812,7 +2812,7 @@ public class RagFair public float DelaySinceOfferAdd { get; set; } [JsonPropertyName("uniqueBuyerTimeoutInDays")] - public int UniqueBuyerTimeoutInDays { get; set; } + public double UniqueBuyerTimeoutInDays { get; set; } [JsonPropertyName("userRatingChangeFrequencyMultiplayer")] public float UserRatingChangeFrequencyMultiplayer { get; set; } @@ -2824,13 +2824,13 @@ public class RagFair public float RatingSumForIncrease { get; set; } [JsonPropertyName("ratingIncreaseCount")] - public int RatingIncreaseCount { get; set; } + public double RatingIncreaseCount { get; set; } [JsonPropertyName("ratingSumForDecrease")] public float RatingSumForDecrease { get; set; } [JsonPropertyName("ratingDecreaseCount")] - public int RatingDecreaseCount { get; set; } + public double RatingDecreaseCount { get; set; } [JsonPropertyName("maxSumForIncreaseRatingPerOneSale")] public float MaxSumForIncreaseRatingPerOneSale { get; set; } @@ -2854,25 +2854,25 @@ public class RagFair public float BalancerUserItemSaleCooldown { get; set; } [JsonPropertyName("youSellOfferMaxStorageTimeInHour")] - public int YouSellOfferMaxStorageTimeInHour { get; set; } + public double YouSellOfferMaxStorageTimeInHour { get; set; } [JsonPropertyName("yourOfferDidNotSellMaxStorageTimeInHour")] - public int YourOfferDidNotSellMaxStorageTimeInHour { get; set; } + public double YourOfferDidNotSellMaxStorageTimeInHour { get; set; } [JsonPropertyName("isOnlyFoundInRaidAllowed")] public bool IsOnlyFoundInRaidAllowed { get; set; } [JsonPropertyName("sellInOnePiece")] - public int SellInOnePiece { get; set; } + public double SellInOnePiece { get; set; } } public class ItemGlobalRestrictions { [JsonPropertyName("MaxFlea")] - public int MaxFlea { get; set; } + public double MaxFlea { get; set; } [JsonPropertyName("MaxFleaStacked")] - public int MaxFleaStacked { get; set; } + public double MaxFleaStacked { get; set; } [JsonPropertyName("TemplateId")] public string TemplateId { get; set; } @@ -2881,13 +2881,13 @@ public class ItemGlobalRestrictions public class MaxActiveOfferCount { [JsonPropertyName("from")] - public int From { get; set; } + public double From { get; set; } [JsonPropertyName("to")] - public int To { get; set; } + public double To { get; set; } [JsonPropertyName("count")] - public int Count { get; set; } + public double Count { get; set; } } public class MaxSumForRarity @@ -2908,7 +2908,7 @@ public class MaxSumForRarity public class RarityMaxSum { [JsonPropertyName("value")] - public int Value { get; set; } + public double Value { get; set; } } public class Handbook @@ -2920,43 +2920,43 @@ public class Handbook public class Stamina { [JsonPropertyName("Capacity")] - public int Capacity { get; set; } + public double Capacity { get; set; } [JsonPropertyName("SprintDrainRate")] - public int SprintDrainRate { get; set; } + public double SprintDrainRate { get; set; } [JsonPropertyName("BaseRestorationRate")] - public int BaseRestorationRate { get; set; } + public double BaseRestorationRate { get; set; } [JsonPropertyName("BipodAimDrainRateMultiplier")] - public int BipodAimDrainRateMultiplier { get; set; } + public double BipodAimDrainRateMultiplier { get; set; } [JsonPropertyName("JumpConsumption")] - public int JumpConsumption { get; set; } + public double JumpConsumption { get; set; } [JsonPropertyName("MountingHorizontalAimDrainRateMultiplier")] - public int MountingHorizontalAimDrainRateMultiplier { get; set; } + public double MountingHorizontalAimDrainRateMultiplier { get; set; } [JsonPropertyName("MountingVerticalAimDrainRateMultiplier")] - public int MountingVerticalAimDrainRateMultiplier { get; set; } + public double MountingVerticalAimDrainRateMultiplier { get; set; } [JsonPropertyName("GrenadeHighThrow")] - public int GrenadeHighThrow { get; set; } + public double GrenadeHighThrow { get; set; } [JsonPropertyName("GrenadeLowThrow")] - public int GrenadeLowThrow { get; set; } + public double GrenadeLowThrow { get; set; } [JsonPropertyName("AimDrainRate")] - public int AimDrainRate { get; set; } + public double AimDrainRate { get; set; } [JsonPropertyName("AimRangeFinderDrainRate")] - public int AimRangeFinderDrainRate { get; set; } + public double AimRangeFinderDrainRate { get; set; } [JsonPropertyName("OxygenCapacity")] - public int OxygenCapacity { get; set; } + public double OxygenCapacity { get; set; } [JsonPropertyName("OxygenRestoration")] - public int OxygenRestoration { get; set; } + public double OxygenRestoration { get; set; } [JsonPropertyName("WalkOverweightLimits")] public XYZ WalkOverweightLimits { get; set; } @@ -2983,13 +2983,13 @@ public class Stamina public XYZ TransitionSpeed { get; set; } [JsonPropertyName("SprintAccelerationLowerLimit")] - public int SprintAccelerationLowerLimit { get; set; } + public double SprintAccelerationLowerLimit { get; set; } [JsonPropertyName("SprintSpeedLowerLimit")] - public int SprintSpeedLowerLimit { get; set; } + public double SprintSpeedLowerLimit { get; set; } [JsonPropertyName("SprintSensitivityLowerLimit")] - public int SprintSensitivityLowerLimit { get; set; } + public double SprintSensitivityLowerLimit { get; set; } [JsonPropertyName("AimConsumptionByPose")] public XYZ AimConsumptionByPose { get; set; } @@ -3001,49 +3001,49 @@ public class Stamina public XYZ OverweightConsumptionByPose { get; set; } [JsonPropertyName("AimingSpeedMultiplier")] - public int AimingSpeedMultiplier { get; set; } + public double AimingSpeedMultiplier { get; set; } [JsonPropertyName("WalkVisualEffectMultiplier")] - public int WalkVisualEffectMultiplier { get; set; } + public double WalkVisualEffectMultiplier { get; set; } [JsonPropertyName("WeaponFastSwitchConsumption")] - public int WeaponFastSwitchConsumption { get; set; } + public double WeaponFastSwitchConsumption { get; set; } [JsonPropertyName("HandsCapacity")] - public int HandsCapacity { get; set; } + public double HandsCapacity { get; set; } [JsonPropertyName("HandsRestoration")] - public int HandsRestoration { get; set; } + public double HandsRestoration { get; set; } [JsonPropertyName("ProneConsumption")] - public int ProneConsumption { get; set; } + public double ProneConsumption { get; set; } [JsonPropertyName("BaseHoldBreathConsumption")] - public int BaseHoldBreathConsumption { get; set; } + public double BaseHoldBreathConsumption { get; set; } [JsonPropertyName("SoundRadius")] public XYZ SoundRadius { get; set; } [JsonPropertyName("ExhaustedMeleeSpeed")] - public int ExhaustedMeleeSpeed { get; set; } + public double ExhaustedMeleeSpeed { get; set; } [JsonPropertyName("FatigueRestorationRate")] - public int FatigueRestorationRate { get; set; } + public double FatigueRestorationRate { get; set; } [JsonPropertyName("FatigueAmountToCreateEffect")] - public int FatigueAmountToCreateEffect { get; set; } + public double FatigueAmountToCreateEffect { get; set; } [JsonPropertyName("ExhaustedMeleeDamageMultiplier")] - public int ExhaustedMeleeDamageMultiplier { get; set; } + public double ExhaustedMeleeDamageMultiplier { get; set; } [JsonPropertyName("FallDamageMultiplier")] - public int FallDamageMultiplier { get; set; } + public double FallDamageMultiplier { get; set; } [JsonPropertyName("SafeHeightOverweight")] - public int SafeHeightOverweight { get; set; } + public double SafeHeightOverweight { get; set; } [JsonPropertyName("SitToStandConsumption")] - public int SitToStandConsumption { get; set; } + public double SitToStandConsumption { get; set; } [JsonPropertyName("StaminaExhaustionCausesJiggle")] public bool StaminaExhaustionCausesJiggle { get; set; } @@ -3124,7 +3124,7 @@ public class Alpinist public string Id { get; set; } [JsonPropertyName("Count")] - public int Count { get; set; } + public double Count { get; set; } [JsonPropertyName("RequiredSlot")] public string RequiredSlot { get; set; } @@ -3136,10 +3136,10 @@ public class Alpinist public class RestrictionsInRaid { [JsonPropertyName("MaxInLobby")] - public int MaxInLobby { get; set; } + public double MaxInLobby { get; set; } [JsonPropertyName("MaxInRaid")] - public int MaxInRaid { get; set; } + public double MaxInRaid { get; set; } [JsonPropertyName("TemplateId")] public string TemplateId { get; set; } @@ -3148,10 +3148,10 @@ public class RestrictionsInRaid public class FavoriteItemsSettings { [JsonPropertyName("WeaponStandMaxItemsCount")] - public int WeaponStandMaxItemsCount { get; set; } + public double WeaponStandMaxItemsCount { get; set; } [JsonPropertyName("PlaceOfFameMaxItemsCount")] - public int PlaceOfFameMaxItemsCount { get; set; } + public double PlaceOfFameMaxItemsCount { get; set; } } public class VaultingSettings @@ -3172,34 +3172,34 @@ public class VaultingSettings public class VaultingGridSettings { [JsonPropertyName("GridSizeX")] - public int GridSizeX { get; set; } + public double GridSizeX { get; set; } [JsonPropertyName("GridSizeY")] - public int GridSizeY { get; set; } + public double GridSizeY { get; set; } [JsonPropertyName("GridSizeZ")] - public int GridSizeZ { get; set; } + public double GridSizeZ { get; set; } [JsonPropertyName("SteppingLengthX")] - public int SteppingLengthX { get; set; } + public double SteppingLengthX { get; set; } [JsonPropertyName("SteppingLengthY")] - public int SteppingLengthY { get; set; } + public double SteppingLengthY { get; set; } [JsonPropertyName("SteppingLengthZ")] - public int SteppingLengthZ { get; set; } + public double SteppingLengthZ { get; set; } [JsonPropertyName("GridOffsetX")] - public int GridOffsetX { get; set; } + public double GridOffsetX { get; set; } [JsonPropertyName("GridOffsetY")] - public int GridOffsetY { get; set; } + public double GridOffsetY { get; set; } [JsonPropertyName("GridOffsetZ")] - public int GridOffsetZ { get; set; } + public double GridOffsetZ { get; set; } [JsonPropertyName("OffsetFactor")] - public int OffsetFactor { get; set; } + public double OffsetFactor { get; set; } } public class VaultingMovesSettings @@ -3217,7 +3217,7 @@ public class VaultingSubMoveSettings public bool IsActive { get; set; } [JsonPropertyName("MaxWithoutHandHeight")] - public int MaxWithoutHandHeight { get; set; } + public double MaxWithoutHandHeight { get; set; } [JsonPropertyName("SpeedRange")] public XYZ SpeedRange { get; set; } @@ -3235,19 +3235,19 @@ public class MoveRestrictions public bool IsActive { get; set; } [JsonPropertyName("MinDistantToInteract")] - public int MinDistantToInteract { get; set; } + public double MinDistantToInteract { get; set; } [JsonPropertyName("MinHeight")] - public int MinHeight { get; set; } + public double MinHeight { get; set; } [JsonPropertyName("MaxHeight")] - public int MaxHeight { get; set; } + public double MaxHeight { get; set; } [JsonPropertyName("MinLength")] - public int MinLength { get; set; } + public double MinLength { get; set; } [JsonPropertyName("MaxLength")] - public int MaxLength { get; set; } + public double MaxLength { get; set; } } public class BTRSettings @@ -3256,64 +3256,64 @@ public class BTRSettings public List LocationsWithBTR { get; set; } [JsonPropertyName("BasePriceTaxi")] - public int BasePriceTaxi { get; set; } + public double BasePriceTaxi { get; set; } [JsonPropertyName("AddPriceTaxi")] - public int AddPriceTaxi { get; set; } + public double AddPriceTaxi { get; set; } [JsonPropertyName("CleanUpPrice")] - public int CleanUpPrice { get; set; } + public double CleanUpPrice { get; set; } [JsonPropertyName("DeliveryPrice")] - public int DeliveryPrice { get; set; } + public double DeliveryPrice { get; set; } [JsonPropertyName("ModDeliveryCost")] - public int ModDeliveryCost { get; set; } + public double ModDeliveryCost { get; set; } [JsonPropertyName("BearPriceMod")] - public int BearPriceMod { get; set; } + public double BearPriceMod { get; set; } [JsonPropertyName("UsecPriceMod")] - public int UsecPriceMod { get; set; } + public double UsecPriceMod { get; set; } [JsonPropertyName("ScavPriceMod")] - public int ScavPriceMod { get; set; } + public double ScavPriceMod { get; set; } [JsonPropertyName("CoefficientDiscountCharisma")] - public int CoefficientDiscountCharisma { get; set; } + public double CoefficientDiscountCharisma { get; set; } [JsonPropertyName("DeliveryMinPrice")] - public int DeliveryMinPrice { get; set; } + public double DeliveryMinPrice { get; set; } [JsonPropertyName("TaxiMinPrice")] - public int TaxiMinPrice { get; set; } + public double TaxiMinPrice { get; set; } [JsonPropertyName("BotCoverMinPrice")] - public int BotCoverMinPrice { get; set; } + public double BotCoverMinPrice { get; set; } [JsonPropertyName("MapsConfigs")] public Dictionary MapsConfigs { get; set; } [JsonPropertyName("DiameterWheel")] - public int DiameterWheel { get; set; } + public double DiameterWheel { get; set; } [JsonPropertyName("HeightWheel")] - public int HeightWheel { get; set; } + public double HeightWheel { get; set; } [JsonPropertyName("HeightWheelMaxPosLimit")] - public int HeightWheelMaxPosLimit { get; set; } + public double HeightWheelMaxPosLimit { get; set; } [JsonPropertyName("HeightWheelMinPosLimit")] - public int HeightWheelMinPosLimit { get; set; } + public double HeightWheelMinPosLimit { get; set; } [JsonPropertyName("SnapToSurfaceWheelsSpeed")] - public int SnapToSurfaceWheelsSpeed { get; set; } + public double SnapToSurfaceWheelsSpeed { get; set; } [JsonPropertyName("CheckSurfaceForWheelsTimer")] - public int CheckSurfaceForWheelsTimer { get; set; } + public double CheckSurfaceForWheelsTimer { get; set; } [JsonPropertyName("HeightWheelOffset")] - public int HeightWheelOffset { get; set; } + public double HeightWheelOffset { get; set; } } public class BtrMapConfig @@ -3322,40 +3322,40 @@ public class BtrMapConfig public string BtrSkin { get; set; } [JsonPropertyName("CheckSurfaceForWheelsTimer")] - public int CheckSurfaceForWheelsTimer { get; set; } + public double CheckSurfaceForWheelsTimer { get; set; } [JsonPropertyName("DiameterWheel")] - public int DiameterWheel { get; set; } + public double DiameterWheel { get; set; } [JsonPropertyName("HeightWheel")] - public int HeightWheel { get; set; } + public double HeightWheel { get; set; } [JsonPropertyName("HeightWheelMaxPosLimit")] - public int HeightWheelMaxPosLimit { get; set; } + public double HeightWheelMaxPosLimit { get; set; } [JsonPropertyName("HeightWheelMinPosLimit")] - public int HeightWheelMinPosLimit { get; set; } + public double HeightWheelMinPosLimit { get; set; } [JsonPropertyName("HeightWheelOffset")] - public int HeightWheelOffset { get; set; } + public double HeightWheelOffset { get; set; } [JsonPropertyName("SnapToSurfaceWheelsSpeed")] - public int SnapToSurfaceWheelsSpeed { get; set; } + public double SnapToSurfaceWheelsSpeed { get; set; } [JsonPropertyName("SuspensionDamperStiffness")] - public int SuspensionDamperStiffness { get; set; } + public double SuspensionDamperStiffness { get; set; } [JsonPropertyName("SuspensionRestLength")] - public int SuspensionRestLength { get; set; } + public double SuspensionRestLength { get; set; } [JsonPropertyName("SuspensionSpringStiffness")] - public int SuspensionSpringStiffness { get; set; } + public double SuspensionSpringStiffness { get; set; } [JsonPropertyName("SuspensionTravel")] - public int SuspensionTravel { get; set; } + public double SuspensionTravel { get; set; } [JsonPropertyName("SuspensionWheelRadius")] - public int SuspensionWheelRadius { get; set; } + public double SuspensionWheelRadius { get; set; } [JsonPropertyName("mapID")] public string MapID { get; set; } @@ -3388,34 +3388,34 @@ public class PathConfig public bool Circle { get; set; } [JsonPropertyName("circleCount")] - public int CircleCount { get; set; } + public double CircleCount { get; set; } } public class SquadSettings { [JsonPropertyName("CountOfRequestsToOnePlayer")] - public int CountOfRequestsToOnePlayer { get; set; } + public double CountOfRequestsToOnePlayer { get; set; } [JsonPropertyName("SecondsForExpiredRequest")] - public int SecondsForExpiredRequest { get; set; } + public double SecondsForExpiredRequest { get; set; } [JsonPropertyName("SendRequestDelaySeconds")] - public int SendRequestDelaySeconds { get; set; } + public double SendRequestDelaySeconds { get; set; } } public class Insurance { [JsonPropertyName("ChangeForReturnItemsInOfflineRaid")] - public int ChangeForReturnItemsInOfflineRaid { get; set; } + public double ChangeForReturnItemsInOfflineRaid { get; set; } [JsonPropertyName("MaxStorageTimeInHour")] - public int MaxStorageTimeInHour { get; set; } + public double MaxStorageTimeInHour { get; set; } [JsonPropertyName("CoefOfSendingMessageTime")] - public int CoefOfSendingMessageTime { get; set; } + public double CoefOfSendingMessageTime { get; set; } [JsonPropertyName("CoefOfHavingMarkOfUnknown")] - public int CoefOfHavingMarkOfUnknown { get; set; } + public double CoefOfHavingMarkOfUnknown { get; set; } [JsonPropertyName("EditionSendingMessageTime")] public Dictionary EditionSendingMessageTime { get; set; } @@ -3649,7 +3649,7 @@ public class MeleeSkill public class ArmorSkills { [JsonPropertyName("buffMaxCount")] - public int BuffMaxCount { get; set; } + public double BuffMaxCount { get; set; } [JsonPropertyName("buffSettings")] public BuffSettings BuffSettings { get; set; } @@ -3658,28 +3658,28 @@ public class ArmorSkills public ArmorCounters Counters { get; set; } [JsonPropertyName("moveSpeedPenaltyReductionHVestsReducePerLevel")] - public int MoveSpeedPenaltyReductionHVestsReducePerLevel { get; set; } + public double MoveSpeedPenaltyReductionHVestsReducePerLevel { get; set; } [JsonPropertyName("ricochetChanceHVestsCurrentDurabilityThreshold")] - public int RicochetChanceHVestsCurrentDurabilityThreshold { get; set; } + public double RicochetChanceHVestsCurrentDurabilityThreshold { get; set; } [JsonPropertyName("ricochetChanceHVestsEliteLevel")] - public int RicochetChanceHVestsEliteLevel { get; set; } + public double RicochetChanceHVestsEliteLevel { get; set; } [JsonPropertyName("ricochetChanceHVestsMaxDurabilityThreshold")] - public int RicochetChanceHVestsMaxDurabilityThreshold { get; set; } + public double RicochetChanceHVestsMaxDurabilityThreshold { get; set; } [JsonPropertyName("meleeDamageLVestsReducePerLevel")] - public int MeleeDamageLVestsReducePerLevel { get; set; } + public double MeleeDamageLVestsReducePerLevel { get; set; } [JsonPropertyName("moveSpeedPenaltyReductionLVestsReducePerLevel")] - public int MoveSpeedPenaltyReductionLVestsReducePerLevel { get; set; } + public double MoveSpeedPenaltyReductionLVestsReducePerLevel { get; set; } [JsonPropertyName("wearAmountRepairLVestsReducePerLevel")] - public int WearAmountRepairLVestsReducePerLevel { get; set; } + public double WearAmountRepairLVestsReducePerLevel { get; set; } [JsonPropertyName("wearChanceRepairLVestsReduceEliteLevel")] - public int WearChanceRepairLVestsReduceEliteLevel { get; set; } + public double WearChanceRepairLVestsReduceEliteLevel { get; set; } } public class ArmorCounters @@ -3691,19 +3691,19 @@ public class ArmorCounters public class HideoutManagement { [JsonPropertyName("skillPointsPerAreaUpgrade")] - public int SkillPointsPerAreaUpgrade { get; set; } + public double SkillPointsPerAreaUpgrade { get; set; } [JsonPropertyName("skillPointsPerCraft")] - public int SkillPointsPerCraft { get; set; } + public double SkillPointsPerCraft { get; set; } [JsonPropertyName("circleOfCultistsBonusPercent")] - public int CircleOfCultistsBonusPercent { get; set; } + public double CircleOfCultistsBonusPercent { get; set; } [JsonPropertyName("consumptionReductionPerLevel")] - public int ConsumptionReductionPerLevel { get; set; } + public double ConsumptionReductionPerLevel { get; set; } [JsonPropertyName("skillBoostPercent")] - public int SkillBoostPercent { get; set; } + public double SkillBoostPercent { get; set; } [JsonPropertyName("skillPointsRate")] public SkillPointsRate SkillPointsRate { get; set; } @@ -3730,10 +3730,10 @@ public class SkillPointsRate public class SkillPointRate { [JsonPropertyName("resourceSpent")] - public int ResourceSpent { get; set; } + public double ResourceSpent { get; set; } [JsonPropertyName("pointsGained")] - public int PointsGained { get; set; } + public double PointsGained { get; set; } } public class EliteSlots @@ -3754,91 +3754,91 @@ public class EliteSlots public class EliteSlot { [JsonPropertyName("slots")] - public int Slots { get; set; } + public double Slots { get; set; } [JsonPropertyName("container")] - public int Container { get; set; } + public double Container { get; set; } } public class Crafting { [JsonPropertyName("PointsPerCraftingCycle")] - public int PointsPerCraftingCycle { get; set; } + public double PointsPerCraftingCycle { get; set; } [JsonPropertyName("CraftingCycleHours")] - public int CraftingCycleHours { get; set; } + public double CraftingCycleHours { get; set; } [JsonPropertyName("PointsPerUniqueCraftCycle")] - public int PointsPerUniqueCraftCycle { get; set; } + public double PointsPerUniqueCraftCycle { get; set; } [JsonPropertyName("UniqueCraftsPerCycle")] - public int UniqueCraftsPerCycle { get; set; } + public double UniqueCraftsPerCycle { get; set; } [JsonPropertyName("CraftTimeReductionPerLevel")] - public int CraftTimeReductionPerLevel { get; set; } + public double CraftTimeReductionPerLevel { get; set; } [JsonPropertyName("ProductionTimeReductionPerLevel")] - public int ProductionTimeReductionPerLevel { get; set; } + public double ProductionTimeReductionPerLevel { get; set; } [JsonPropertyName("EliteExtraProductions")] - public int EliteExtraProductions { get; set; } + public double EliteExtraProductions { get; set; } [JsonPropertyName("CraftingPointsToIntelligence")] - public int CraftingPointsToIntelligence { get; set; } + public double CraftingPointsToIntelligence { get; set; } } public class Metabolism { [JsonPropertyName("HydrationRecoveryRate")] - public int HydrationRecoveryRate { get; set; } + public double HydrationRecoveryRate { get; set; } [JsonPropertyName("EnergyRecoveryRate")] - public int EnergyRecoveryRate { get; set; } + public double EnergyRecoveryRate { get; set; } [JsonPropertyName("IncreasePositiveEffectDurationRate")] - public int IncreasePositiveEffectDurationRate { get; set; } + public double IncreasePositiveEffectDurationRate { get; set; } [JsonPropertyName("DecreaseNegativeEffectDurationRate")] - public int DecreaseNegativeEffectDurationRate { get; set; } + public double DecreaseNegativeEffectDurationRate { get; set; } [JsonPropertyName("DecreasePoisonDurationRate")] - public int DecreasePoisonDurationRate { get; set; } + public double DecreasePoisonDurationRate { get; set; } } public class Immunity { [JsonPropertyName("ImmunityMiscEffects")] - public int ImmunityMiscEffects { get; set; } + public double ImmunityMiscEffects { get; set; } [JsonPropertyName("ImmunityPoisonBuff")] - public int ImmunityPoisonBuff { get; set; } + public double ImmunityPoisonBuff { get; set; } [JsonPropertyName("ImmunityPainKiller")] - public int ImmunityPainKiller { get; set; } + public double ImmunityPainKiller { get; set; } [JsonPropertyName("HealthNegativeEffect")] - public int HealthNegativeEffect { get; set; } + public double HealthNegativeEffect { get; set; } [JsonPropertyName("StimulatorNegativeBuff")] - public int StimulatorNegativeBuff { get; set; } + public double StimulatorNegativeBuff { get; set; } } public class Endurance { [JsonPropertyName("MovementAction")] - public int MovementAction { get; set; } + public double MovementAction { get; set; } [JsonPropertyName("SprintAction")] - public int SprintAction { get; set; } + public double SprintAction { get; set; } [JsonPropertyName("GainPerFatigueStack")] - public int GainPerFatigueStack { get; set; } + public double GainPerFatigueStack { get; set; } [JsonPropertyName("DependentSkillRatios")] public List DependentSkillRatios { get; set; } [JsonPropertyName("QTELevelMultipliers")] - public Dictionary> QTELevelMultipliers { get; set; } + public Dictionary> QTELevelMultipliers { get; set; } } public class Strength @@ -3847,37 +3847,37 @@ public class Strength public List DependentSkillRatios { get; set; } [JsonPropertyName("SprintActionMin")] - public int SprintActionMin { get; set; } + public double SprintActionMin { get; set; } [JsonPropertyName("SprintActionMax")] - public int SprintActionMax { get; set; } + public double SprintActionMax { get; set; } [JsonPropertyName("MovementActionMin")] - public int MovementActionMin { get; set; } + public double MovementActionMin { get; set; } [JsonPropertyName("MovementActionMax")] - public int MovementActionMax { get; set; } + public double MovementActionMax { get; set; } [JsonPropertyName("PushUpMin")] - public int PushUpMin { get; set; } + public double PushUpMin { get; set; } [JsonPropertyName("PushUpMax")] - public int PushUpMax { get; set; } + public double PushUpMax { get; set; } [JsonPropertyName("QTELevelMultipliers")] public List QTELevelMultipliers { get; set; } [JsonPropertyName("FistfightAction")] - public int FistfightAction { get; set; } + public double FistfightAction { get; set; } [JsonPropertyName("ThrowAction")] - public int ThrowAction { get; set; } + public double ThrowAction { get; set; } } public class DependentSkillRatio { [JsonPropertyName("Ratio")] - public int Ratio { get; set; } + public double Ratio { get; set; } [JsonPropertyName("SkillId")] public string SkillId { get; set; } @@ -3886,85 +3886,85 @@ public class DependentSkillRatio public class QTELevelMultiplier { [JsonPropertyName("Level")] - public int Level { get; set; } + public double Level { get; set; } [JsonPropertyName("Multiplier")] - public int Multiplier { get; set; } + public double Multiplier { get; set; } } public class Vitality { [JsonPropertyName("DamageTakenAction")] - public int DamageTakenAction { get; set; } + public double DamageTakenAction { get; set; } [JsonPropertyName("HealthNegativeEffect")] - public int HealthNegativeEffect { get; set; } + public double HealthNegativeEffect { get; set; } } public class HealthSkillProgress { [JsonPropertyName("SkillProgress")] - public int SkillProgress { get; set; } + public double SkillProgress { get; set; } } public class StressResistance { [JsonPropertyName("HealthNegativeEffect")] - public int HealthNegativeEffect { get; set; } + public double HealthNegativeEffect { get; set; } [JsonPropertyName("LowHPDuration")] - public int LowHPDuration { get; set; } + public double LowHPDuration { get; set; } } public class Throwing { [JsonPropertyName("ThrowAction")] - public int ThrowAction { get; set; } + public double ThrowAction { get; set; } } public class RecoilControl { [JsonPropertyName("RecoilAction")] - public int RecoilAction { get; set; } + public double RecoilAction { get; set; } [JsonPropertyName("RecoilBonusPerLevel")] - public int RecoilBonusPerLevel { get; set; } + public double RecoilBonusPerLevel { get; set; } } public class WeaponSkills { [JsonPropertyName("WeaponReloadAction")] - public int WeaponReloadAction { get; set; } + public double WeaponReloadAction { get; set; } [JsonPropertyName("WeaponShotAction")] - public int WeaponShotAction { get; set; } + public double WeaponShotAction { get; set; } [JsonPropertyName("WeaponFixAction")] - public int WeaponFixAction { get; set; } + public double WeaponFixAction { get; set; } [JsonPropertyName("WeaponChamberAction")] - public int WeaponChamberAction { get; set; } + public double WeaponChamberAction { get; set; } } public class CovertMovement { [JsonPropertyName("MovementAction")] - public int MovementAction { get; set; } + public double MovementAction { get; set; } } public class Search { [JsonPropertyName("SearchAction")] - public int SearchAction { get; set; } + public double SearchAction { get; set; } [JsonPropertyName("FindAction")] - public int FindAction { get; set; } + public double FindAction { get; set; } } public class WeaponTreatment { [JsonPropertyName("BuffMaxCount")] - public int BuffMaxCount { get; set; } + public double BuffMaxCount { get; set; } [JsonPropertyName("BuffSettings")] public BuffSettings BuffSettings { get; set; } @@ -3973,19 +3973,19 @@ public class WeaponTreatment public WeaponTreatmentCounters Counters { get; set; } [JsonPropertyName("DurLossReducePerLevel")] - public int DurLossReducePerLevel { get; set; } + public double DurLossReducePerLevel { get; set; } [JsonPropertyName("SkillPointsPerRepair")] - public int SkillPointsPerRepair { get; set; } + public double SkillPointsPerRepair { get; set; } [JsonPropertyName("Filter")] public List Filter { get; set; } [JsonPropertyName("WearAmountRepairGunsReducePerLevel")] - public int WearAmountRepairGunsReducePerLevel { get; set; } + public double WearAmountRepairGunsReducePerLevel { get; set; } [JsonPropertyName("WearChanceRepairGunsReduceEliteLevel")] - public int WearChanceRepairGunsReduceEliteLevel { get; set; } + public double WearChanceRepairGunsReduceEliteLevel { get; set; } } public class WeaponTreatmentCounters @@ -4098,13 +4098,13 @@ public class Attention { public SkillRatio[] DependentSkillRatios { get; set; } [JsonPropertyName("ExamineWithInstruction")] - public int ExamineWithInstruction { get; set; } + public double ExamineWithInstruction { get; set; } [JsonPropertyName("FindActionFalse")] - public int FindActionFalse { get; set; } + public double FindActionFalse { get; set; } [JsonPropertyName("FindActionTrue")] - public int FindActionTrue { get; set; } + public double FindActionTrue { get; set; } } public class Charisma { @@ -4115,13 +4115,13 @@ public class Charisma { public CharismaSkillCounters Counters { get; set; } [JsonPropertyName("SkillProgressInt")] - public int SkillProgressInt { get; set; } + public double SkillProgressInt { get; set; } [JsonPropertyName("SkillProgressAtn")] - public int SkillProgressAtn { get; set; } + public double SkillProgressAtn { get; set; } [JsonPropertyName("SkillProgressPer")] - public int SkillProgressPer { get; set; } + public double SkillProgressPer { get; set; } } public class CharismaSkillCounters { @@ -4151,73 +4151,73 @@ public class BonusSettings { public class EliteBonusSettings { [JsonPropertyName("FenceStandingLossDiscount")] - public int FenceStandingLossDiscount { get; set; } + public double FenceStandingLossDiscount { get; set; } [JsonPropertyName("RepeatableQuestExtraCount")] - public int RepeatableQuestExtraCount { get; set; } + public double RepeatableQuestExtraCount { get; set; } [JsonPropertyName("ScavCaseDiscount")] - public int ScavCaseDiscount { get; set; } + public double ScavCaseDiscount { get; set; } } public class LevelBonusSettings { [JsonPropertyName("HealthRestoreDiscount")] - public int HealthRestoreDiscount { get; set; } + public double HealthRestoreDiscount { get; set; } [JsonPropertyName("HealthRestoreTraderDiscount")] - public int HealthRestoreTraderDiscount { get; set; } + public double HealthRestoreTraderDiscount { get; set; } [JsonPropertyName("InsuranceDiscount")] - public int InsuranceDiscount { get; set; } + public double InsuranceDiscount { get; set; } [JsonPropertyName("InsuranceTraderDiscount")] - public int InsuranceTraderDiscount { get; set; } + public double InsuranceTraderDiscount { get; set; } [JsonPropertyName("PaidExitDiscount")] - public int PaidExitDiscount { get; set; } + public double PaidExitDiscount { get; set; } [JsonPropertyName("RepeatableQuestChangeDiscount")] - public int RepeatableQuestChangeDiscount { get; set; } + public double RepeatableQuestChangeDiscount { get; set; } } public class Memory { [JsonPropertyName("AnySkillUp")] - public int AnySkillUp { get; set; } + public double AnySkillUp { get; set; } [JsonPropertyName("SkillProgress")] - public int SkillProgress { get; set; } + public double SkillProgress { get; set; } } public class Surgery { [JsonPropertyName("SurgeryAction")] - public int SurgeryAction { get; set; } + public double SurgeryAction { get; set; } [JsonPropertyName("SkillProgress")] - public int SkillProgress { get; set; } + public double SkillProgress { get; set; } } public class AimDrills { [JsonPropertyName("WeaponShotAction")] - public int WeaponShotAction { get; set; } + public double WeaponShotAction { get; set; } } public class TroubleShooting { [JsonPropertyName("MalfRepairSpeedBonusPerLevel")] - public int MalfRepairSpeedBonusPerLevel { get; set; } + public double MalfRepairSpeedBonusPerLevel { get; set; } [JsonPropertyName("SkillPointsPerMalfFix")] - public int SkillPointsPerMalfFix { get; set; } + public double SkillPointsPerMalfFix { get; set; } [JsonPropertyName("EliteDurabilityChanceReduceMult")] - public int EliteDurabilityChanceReduceMult { get; set; } + public double EliteDurabilityChanceReduceMult { get; set; } [JsonPropertyName("EliteAmmoChanceReduceMult")] - public int EliteAmmoChanceReduceMult { get; set; } + public double EliteAmmoChanceReduceMult { get; set; } [JsonPropertyName("EliteMagChanceReduceMult")] - public int EliteMagChanceReduceMult { get; set; } + public double EliteMagChanceReduceMult { get; set; } } public class Aiming @@ -4226,34 +4226,34 @@ public class Aiming public XYZ ProceduralIntensityByPose { get; set; } [JsonPropertyName("AimProceduralIntensity")] - public int AimProceduralIntensity { get; set; } + public double AimProceduralIntensity { get; set; } [JsonPropertyName("HeavyWeight")] - public int HeavyWeight { get; set; } + public double HeavyWeight { get; set; } [JsonPropertyName("LightWeight")] - public int LightWeight { get; set; } + public double LightWeight { get; set; } [JsonPropertyName("MaxTimeHeavy")] - public int MaxTimeHeavy { get; set; } + public double MaxTimeHeavy { get; set; } [JsonPropertyName("MinTimeHeavy")] - public int MinTimeHeavy { get; set; } + public double MinTimeHeavy { get; set; } [JsonPropertyName("MaxTimeLight")] - public int MaxTimeLight { get; set; } + public double MaxTimeLight { get; set; } [JsonPropertyName("MinTimeLight")] - public int MinTimeLight { get; set; } + public double MinTimeLight { get; set; } [JsonPropertyName("RecoilScaling")] - public int RecoilScaling { get; set; } + public double RecoilScaling { get; set; } [JsonPropertyName("RecoilDamping")] - public int RecoilDamping { get; set; } + public double RecoilDamping { get; set; } [JsonPropertyName("CameraSnapGlobalMult")] - public int CameraSnapGlobalMult { get; set; } + public double CameraSnapGlobalMult { get; set; } [JsonPropertyName("RecoilXIntensityByPose")] public XYZ RecoilXIntensityByPose { get; set; } @@ -4268,94 +4268,94 @@ public class Aiming public bool RecoilCrank { get; set; } [JsonPropertyName("RecoilHandDamping")] - public int RecoilHandDamping { get; set; } + public double RecoilHandDamping { get; set; } [JsonPropertyName("RecoilConvergenceMult")] - public int RecoilConvergenceMult { get; set; } + public double RecoilConvergenceMult { get; set; } [JsonPropertyName("RecoilVertBonus")] - public int RecoilVertBonus { get; set; } + public double RecoilVertBonus { get; set; } [JsonPropertyName("RecoilBackBonus")] - public int RecoilBackBonus { get; set; } + public double RecoilBackBonus { get; set; } } public class Malfunction { [JsonPropertyName("AmmoMalfChanceMult")] - public int AmmoMalfChanceMult { get; set; } + public double AmmoMalfChanceMult { get; set; } [JsonPropertyName("MagazineMalfChanceMult")] - public int MagazineMalfChanceMult { get; set; } + public double MagazineMalfChanceMult { get; set; } [JsonPropertyName("MalfRepairHardSlideMult")] - public int MalfRepairHardSlideMult { get; set; } + public double MalfRepairHardSlideMult { get; set; } [JsonPropertyName("MalfRepairOneHandBrokenMult")] - public int MalfRepairOneHandBrokenMult { get; set; } + public double MalfRepairOneHandBrokenMult { get; set; } [JsonPropertyName("MalfRepairTwoHandsBrokenMult")] - public int MalfRepairTwoHandsBrokenMult { get; set; } + public double MalfRepairTwoHandsBrokenMult { get; set; } [JsonPropertyName("AllowMalfForBots")] public bool AllowMalfForBots { get; set; } [JsonPropertyName("ShowGlowAttemptsCount")] - public int ShowGlowAttemptsCount { get; set; } + public double ShowGlowAttemptsCount { get; set; } [JsonPropertyName("OutToIdleSpeedMultForPistol")] - public int OutToIdleSpeedMultForPistol { get; set; } + public double OutToIdleSpeedMultForPistol { get; set; } [JsonPropertyName("IdleToOutSpeedMultOnMalf")] - public int IdleToOutSpeedMultOnMalf { get; set; } + public double IdleToOutSpeedMultOnMalf { get; set; } [JsonPropertyName("TimeToQuickdrawPistol")] - public int TimeToQuickdrawPistol { get; set; } + public double TimeToQuickdrawPistol { get; set; } [JsonPropertyName("DurRangeToIgnoreMalfs")] public XYZ DurRangeToIgnoreMalfs { get; set; } [JsonPropertyName("DurFeedWt")] - public int DurFeedWt { get; set; } + public double DurFeedWt { get; set; } [JsonPropertyName("DurMisfireWt")] - public int DurMisfireWt { get; set; } + public double DurMisfireWt { get; set; } [JsonPropertyName("DurJamWt")] - public int DurJamWt { get; set; } + public double DurJamWt { get; set; } [JsonPropertyName("DurSoftSlideWt")] - public int DurSoftSlideWt { get; set; } + public double DurSoftSlideWt { get; set; } [JsonPropertyName("DurHardSlideMinWt")] - public int DurHardSlideMinWt { get; set; } + public double DurHardSlideMinWt { get; set; } [JsonPropertyName("DurHardSlideMaxWt")] - public int DurHardSlideMaxWt { get; set; } + public double DurHardSlideMaxWt { get; set; } [JsonPropertyName("AmmoMisfireWt")] - public int AmmoMisfireWt { get; set; } + public double AmmoMisfireWt { get; set; } [JsonPropertyName("AmmoFeedWt")] - public int AmmoFeedWt { get; set; } + public double AmmoFeedWt { get; set; } [JsonPropertyName("AmmoJamWt")] - public int AmmoJamWt { get; set; } + public double AmmoJamWt { get; set; } [JsonPropertyName("OverheatFeedWt")] - public int OverheatFeedWt { get; set; } + public double OverheatFeedWt { get; set; } [JsonPropertyName("OverheatJamWt")] - public int OverheatJamWt { get; set; } + public double OverheatJamWt { get; set; } [JsonPropertyName("OverheatSoftSlideWt")] - public int OverheatSoftSlideWt { get; set; } + public double OverheatSoftSlideWt { get; set; } [JsonPropertyName("OverheatHardSlideMinWt")] - public int OverheatHardSlideMinWt { get; set; } + public double OverheatHardSlideMinWt { get; set; } [JsonPropertyName("OverheatHardSlideMaxWt")] - public int OverheatHardSlideMaxWt { get; set; } + public double OverheatHardSlideMaxWt { get; set; } } public class Overheat @@ -4496,7 +4496,7 @@ public class FenceLevel public double ExfiltrationPriceModifier { get; set; } [JsonPropertyName("AvailableExits")] - public int AvailableExits { get; set; } + public double AvailableExits { get; set; } [JsonPropertyName("BotApplySilenceChance")] public double BotApplySilenceChance { get; set; } @@ -4544,7 +4544,7 @@ public class Inertia public XYZ InertiaLimits { get; set; } [JsonPropertyName("InertiaLimitsStep")] - public int InertiaLimitsStep { get; set; } + public double InertiaLimitsStep { get; set; } [JsonPropertyName("ExitMovementStateSpeedThreshold")] public XYZ ExitMovementStateSpeedThreshold { get; set; } @@ -4553,7 +4553,7 @@ public class Inertia public XYZ WalkInertia { get; set; } [JsonPropertyName("FallThreshold")] - public int FallThreshold { get; set; } + public double FallThreshold { get; set; } [JsonPropertyName("SpeedLimitAfterFallMin")] public XYZ SpeedLimitAfterFallMin { get; set; } @@ -4571,16 +4571,16 @@ public class Inertia public XYZ SpeedInertiaAfterJump { get; set; } [JsonPropertyName("BaseJumpPenaltyDuration")] - public int BaseJumpPenaltyDuration { get; set; } + public double BaseJumpPenaltyDuration { get; set; } [JsonPropertyName("DurationPower")] - public int DurationPower { get; set; } + public double DurationPower { get; set; } [JsonPropertyName("BaseJumpPenalty")] - public int BaseJumpPenalty { get; set; } + public double BaseJumpPenalty { get; set; } [JsonPropertyName("PenaltyPower")] - public int PenaltyPower { get; set; } + public double PenaltyPower { get; set; } [JsonPropertyName("InertiaTiltCurveMin")] public XYZ InertiaTiltCurveMin { get; set; } @@ -4604,7 +4604,7 @@ public class Inertia public XYZ TiltAcceleration { get; set; } [JsonPropertyName("AverageRotationFrameSpan")] - public int AverageRotationFrameSpan { get; set; } + public double AverageRotationFrameSpan { get; set; } [JsonPropertyName("SprintSpeedInertiaCurveMin")] public XYZ SprintSpeedInertiaCurveMin { get; set; } @@ -4637,7 +4637,7 @@ public class Inertia public XYZ MaxTimeWithoutInput { get; set; } [JsonPropertyName("MinDirectionBlendTime")] - public int MinDirectionBlendTime { get; set; } + public double MinDirectionBlendTime { get; set; } [JsonPropertyName("MoveTimeRange")] public XYZ MoveTimeRange { get; set; } @@ -4658,7 +4658,7 @@ public class Inertia public class Ballistic { [JsonPropertyName("GlobalDamageDegradationCoefficient")] - public int GlobalDamageDegradationCoefficient { get; set; } + public double GlobalDamageDegradationCoefficient { get; set; } } public class RepairSettings @@ -4667,19 +4667,19 @@ public class RepairSettings public ItemEnhancementSettings ItemEnhancementSettings { get; set; } [JsonPropertyName("MinimumLevelToApplyBuff")] - public int MinimumLevelToApplyBuff { get; set; } + public double MinimumLevelToApplyBuff { get; set; } [JsonPropertyName("RepairStrategies")] public RepairStrategies RepairStrategies { get; set; } [JsonPropertyName("armorClassDivisor")] - public int ArmorClassDivisor { get; set; } + public double ArmorClassDivisor { get; set; } [JsonPropertyName("durabilityPointCostArmor")] - public int DurabilityPointCostArmor { get; set; } + public double DurabilityPointCostArmor { get; set; } [JsonPropertyName("durabilityPointCostGuns")] - public int DurabilityPointCostGuns { get; set; } + public double DurabilityPointCostGuns { get; set; } } public class ItemEnhancementSettings @@ -4772,7 +4772,7 @@ public class AudioGroupPreset public double DistanceToAllowBinaural { get; set; } [JsonPropertyName("GroupType")] - public int GroupType { get; set; } + public double GroupType { get; set; } [JsonPropertyName("HeightToAllowBinaural")] public double HeightToAllowBinaural { get; set; } @@ -4817,13 +4817,13 @@ public class BotWeaponScattering public string Name { get; set; } [JsonPropertyName("PriorityScatter1meter")] - public int PriorityScatter1Meter { get; set; } + public double PriorityScatter1Meter { get; set; } [JsonPropertyName("PriorityScatter10meter")] - public int PriorityScatter10Meter { get; set; } + public double PriorityScatter10Meter { get; set; } [JsonPropertyName("PriorityScatter100meter")] - public int PriorityScatter100Meter { get; set; } + public double PriorityScatter100Meter { get; set; } } public class Preset @@ -4854,8 +4854,8 @@ public class Preset public class QuestSettings { [JsonPropertyName("GlobalRewardRepModifierDailyQuestPvE")] - public int GlobalRewardRepModifierDailyQuestPvE { get; set; } + public double GlobalRewardRepModifierDailyQuestPvE { get; set; } [JsonPropertyName("GlobalRewardRepModifierQuestPvE")] - public int GlobalRewardRepModifierQuestPvE { get; set; } + public double GlobalRewardRepModifierQuestPvE { get; set; } } \ No newline at end of file diff --git a/Core/Models/Eft/Common/Tables/Item.cs b/Core/Models/Eft/Common/Tables/Item.cs index 5bf3ff62..3c8046c3 100644 --- a/Core/Models/Eft/Common/Tables/Item.cs +++ b/Core/Models/Eft/Common/Tables/Item.cs @@ -9,9 +9,13 @@ public class Item public string Id { get; set; } [JsonPropertyName("_tpl")] public string Template { get; set; } + [JsonPropertyName("parentId")] public string? ParentId { get; set; } + [JsonPropertyName("slotId")] public string? SlotId { get; set; } + [JsonPropertyName("location")] public object? Location { get; set; } // TODO: Can be IItemLocation or number + [JsonPropertyName("upd")] public Upd? Update { get; set; } } diff --git a/Core/Models/Eft/Ws/WsGroupMatchInviteAccept.cs b/Core/Models/Eft/Ws/WsGroupMatchInviteAccept.cs index 4febe122..2acf8c90 100644 --- a/Core/Models/Eft/Ws/WsGroupMatchInviteAccept.cs +++ b/Core/Models/Eft/Ws/WsGroupMatchInviteAccept.cs @@ -1,7 +1,32 @@ +using System.Text.Json.Serialization; using Core.Models.Eft.Match; namespace Core.Models.Eft.Ws; -public class WsGroupMatchInviteAccept : WsNotificationEvent, GroupCharacter // TODO: trying to inherit multiTypes +public class WsGroupMatchInviteAccept : WsNotificationEvent // TODO: trying to inherit multiTypes { + // Copy pasted properties from GroupCharacter to resolve multitype + [JsonPropertyName("_id")] + public string Id { get; set; } + + [JsonPropertyName("aid")] + public int Aid { get; set; } + + [JsonPropertyName("Info")] + public CharacterInfo Info { get; set; } + + [JsonPropertyName("PlayerVisualRepresentation")] + public PlayerVisualRepresentation? VisualRepresentation { get; set; } + + [JsonPropertyName("isLeader")] + public bool IsLeader { get; set; } + + [JsonPropertyName("isReady")] + public bool? IsReady { get; set; } + + [JsonPropertyName("region")] + public string? Region { get; set; } + + [JsonPropertyName("lookingGroup")] + public bool? LookingGroup { get; set; } } \ No newline at end of file diff --git a/Core/Models/Enums/ModSpawn.cs b/Core/Models/Enums/ModSpawn.cs new file mode 100644 index 00000000..f62e3b9b --- /dev/null +++ b/Core/Models/Enums/ModSpawn.cs @@ -0,0 +1,11 @@ +namespace Core.Models.Enums; + +public enum ModSpawn +{ + /** Chosen mod should be the tpl from the default weapon template */ + DEFAULT_MOD = 0, + /** Normal behaviour */ + SPAWN = 1, + /** Item should not be chosen */ + SKIP = 2, +} \ No newline at end of file diff --git a/Core/Models/Spt/Bots/GenerateEquipmentProperties.cs b/Core/Models/Spt/Bots/GenerateEquipmentProperties.cs index e07f0549..6179a6dc 100644 --- a/Core/Models/Spt/Bots/GenerateEquipmentProperties.cs +++ b/Core/Models/Spt/Bots/GenerateEquipmentProperties.cs @@ -19,7 +19,7 @@ public class GenerateEquipmentProperties public Dictionary RootEquipmentPool { get; set; } [JsonPropertyName("modPool")] - public Mods ModPool { get; set; } + public GlobalMods ModPool { get; set; } /// /// Dictionary of mod items and their chance to spawn for this bot type @@ -34,7 +34,7 @@ public class GenerateEquipmentProperties public BotData BotData { get; set; } [JsonPropertyName("inventory")] - public PmcInventory Inventory { get; set; } + public BotBaseInventory Inventory { get; set; } [JsonPropertyName("botEquipmentConfig")] public EquipmentFilters BotEquipmentConfig { get; set; } diff --git a/Core/Models/Spt/Bots/GenerateWeaponRequest.cs b/Core/Models/Spt/Bots/GenerateWeaponRequest.cs index b0e14e0f..77ed728a 100644 --- a/Core/Models/Spt/Bots/GenerateWeaponRequest.cs +++ b/Core/Models/Spt/Bots/GenerateWeaponRequest.cs @@ -11,7 +11,7 @@ public class GenerateWeaponRequest /** Pool of compatible mods to attach to weapon */ [JsonPropertyName("modPool")] - public Mods ModPool { get; set; } + public GlobalMods ModPool { get; set; } /** ParentId of weapon */ [JsonPropertyName("weaponId")] @@ -71,4 +71,31 @@ public class WeaponStats [JsonPropertyName("hasRearIronSight")] public bool? HasRearIronSight { get; set; } +} + +public class BotModLimits +{ + [JsonPropertyName("scope")] + public ItemCount Scope { get; set; } + + [JsonPropertyName("scopeMax")] + public int ScopeMax { get; set; } + + [JsonPropertyName("scopeBaseTypes")] + public string[] ScopeBaseTypes { get; set; } + + [JsonPropertyName("flashlightLaser")] + public ItemCount FlashlightLaser { get; set; } + + [JsonPropertyName("flashlightLaserMax")] + public int FlashlightLaserMax { get; set; } + + [JsonPropertyName("flashlightLaserBaseTypes")] + public string[] FlashlightLaserBaseTypes { get; set; } +} + +public class ItemCount +{ + [JsonPropertyName("count")] + public int Count { get; set; } } \ No newline at end of file diff --git a/Core/Models/Spt/Bots/GenerateWeaponResult.cs b/Core/Models/Spt/Bots/GenerateWeaponResult.cs index a1603cc8..b9a65f94 100644 --- a/Core/Models/Spt/Bots/GenerateWeaponResult.cs +++ b/Core/Models/Spt/Bots/GenerateWeaponResult.cs @@ -15,7 +15,7 @@ public class GenerateWeaponResult public string ChosenUbglAmmoTemplate { get; set; } [JsonPropertyName("weaponMods")] - public Mods WeaponMods { get; set; } + public GlobalMods WeaponMods { get; set; } [JsonPropertyName("weaponTemplate")] public TemplateItem WeaponTemplate { get; set; } diff --git a/Core/Models/Spt/Bots/ModToSpawnRequest.cs b/Core/Models/Spt/Bots/ModToSpawnRequest.cs index 6db35e39..eb3282b1 100644 --- a/Core/Models/Spt/Bots/ModToSpawnRequest.cs +++ b/Core/Models/Spt/Bots/ModToSpawnRequest.cs @@ -1,5 +1,6 @@ using System.Text.Json.Serialization; using Core.Models.Eft.Common.Tables; +using Core.Models.Enums; using Core.Models.Spt.Config; namespace Core.Models.Spt.Bots; diff --git a/Core/Models/Spt/Config/HttpConfig.cs b/Core/Models/Spt/Config/HttpConfig.cs index d465daa5..c53ec739 100644 --- a/Core/Models/Spt/Config/HttpConfig.cs +++ b/Core/Models/Spt/Config/HttpConfig.cs @@ -23,7 +23,7 @@ public class HttpConfig : BaseConfig public string BackendIp { get; set; } [JsonPropertyName("backendPort")] - public string BackendPort { get; set; } + public int BackendPort { get; set; } [JsonPropertyName("webSocketPingDelayMs")] public int WebSocketPingDelayMs { get; set; } diff --git a/Core/Models/Spt/Config/LocationConfig.cs b/Core/Models/Spt/Config/LocationConfig.cs index 05effbec..595d6d5f 100644 --- a/Core/Models/Spt/Config/LocationConfig.cs +++ b/Core/Models/Spt/Config/LocationConfig.cs @@ -205,55 +205,55 @@ public class BotTypeLimit : MinMax public class LootMultiplier { [JsonPropertyName("bigmap")] - public int BigMap { get; set; } + public double BigMap { get; set; } [JsonPropertyName("develop")] - public int Develop { get; set; } + public double Develop { get; set; } [JsonPropertyName("factory4_day")] - public int Factory4Day { get; set; } + public double Factory4Day { get; set; } [JsonPropertyName("factory4_night")] - public int Factory4Night { get; set; } + public double Factory4Night { get; set; } [JsonPropertyName("interchange")] - public int Interchange { get; set; } + public double Interchange { get; set; } [JsonPropertyName("laboratory")] - public int Laboratory { get; set; } + public double Laboratory { get; set; } [JsonPropertyName("rezervbase")] - public int RezervBase { get; set; } + public double RezervBase { get; set; } [JsonPropertyName("shoreline")] - public int Shoreline { get; set; } + public double Shoreline { get; set; } [JsonPropertyName("woods")] - public int Woods { get; set; } + public double Woods { get; set; } [JsonPropertyName("hideout")] - public int Hideout { get; set; } + public double Hideout { get; set; } [JsonPropertyName("lighthouse")] - public int Lighthouse { get; set; } + public double Lighthouse { get; set; } [JsonPropertyName("privatearea")] - public int PrivateArea { get; set; } + public double PrivateArea { get; set; } [JsonPropertyName("suburbs")] - public int Suburbs { get; set; } + public double Suburbs { get; set; } [JsonPropertyName("tarkovstreets")] - public int TarkovStreets { get; set; } + public double TarkovStreets { get; set; } [JsonPropertyName("terminal")] - public int Terminal { get; set; } + public double Terminal { get; set; } [JsonPropertyName("town")] - public int Town { get; set; } + public double Town { get; set; } [JsonPropertyName("sandbox")] - public int Sandbox { get; set; } + public double Sandbox { get; set; } } public class ContainerRandomisationSettings diff --git a/Core/Models/Spt/Config/QuestConfig.cs b/Core/Models/Spt/Config/QuestConfig.cs index 62a17e9a..29fa0175 100644 --- a/Core/Models/Spt/Config/QuestConfig.cs +++ b/Core/Models/Spt/Config/QuestConfig.cs @@ -1,6 +1,7 @@ using System.Text.Json.Serialization; using Core.Models.Common; using Core.Models.Enums; +using Core.Utils.Json.Converters; namespace Core.Models.Spt.Config; @@ -77,7 +78,8 @@ public class EventQuestData public long StartTimestamp { get; set; } [JsonPropertyName("endTimestamp")] - public long EndTimestamp { get; set; } + [JsonConverter(typeof(NullableObjectToLongConverter))] + public long? EndTimestamp { get; set; } [JsonPropertyName("yearly")] public bool Yearly { get; set; } @@ -157,13 +159,13 @@ public class RewardScaling public List Items { get; set; } [JsonPropertyName("reputation")] - public List Reputation { get; set; } + public List Reputation { get; set; } [JsonPropertyName("rewardSpread")] - public int RewardSpread { get; set; } + public double RewardSpread { get; set; } [JsonPropertyName("skillRewardChance")] - public List SkillRewardChance { get; set; } + public List SkillRewardChance { get; set; } [JsonPropertyName("skillPointReward")] public List SkillPointReward { get; set; } @@ -217,7 +219,7 @@ public class Exploration : BaseQuestConfig public class SpecificExits { [JsonPropertyName("probability")] - public int Probability { get; set; } + public double Probability { get; set; } [JsonPropertyName("passageRequirementWhitelist")] public List PassageRequirementWhitelist { get; set; } diff --git a/Core/Models/Spt/Config/RagfairConfig.cs b/Core/Models/Spt/Config/RagfairConfig.cs index a1ced8ff..49498e51 100644 --- a/Core/Models/Spt/Config/RagfairConfig.cs +++ b/Core/Models/Spt/Config/RagfairConfig.cs @@ -59,7 +59,7 @@ public class Chance /** Value to multiply the sell chance by */ [JsonPropertyName("sellMultiplier")] - public int SellMultiplier { get; set; } + public double SellMultiplier { get; set; } /** Max possible sell chance % for a player listed offer */ [JsonPropertyName("maxSellChancePercent")] diff --git a/Core/Models/Spt/Config/WeatherConfig.cs b/Core/Models/Spt/Config/WeatherConfig.cs index 27d9add0..be4a8ec0 100644 --- a/Core/Models/Spt/Config/WeatherConfig.cs +++ b/Core/Models/Spt/Config/WeatherConfig.cs @@ -1,6 +1,7 @@ using System.Text.Json.Serialization; using Core.Models.Common; using Core.Models.Enums; +using Core.Utils.Json.Converters; namespace Core.Models.Spt.Config; @@ -31,15 +32,19 @@ public class SeasonDateTimes public string Name { get; set; } [JsonPropertyName("startDay")] + [JsonConverter(typeof(NotNullObjectToIntConverter))] public int StartDay { get; set; } [JsonPropertyName("startMonth")] + [JsonConverter(typeof(NotNullObjectToIntConverter))] public int StartMonth { get; set; } [JsonPropertyName("endDay")] + [JsonConverter(typeof(NotNullObjectToIntConverter))] public int EndDay { get; set; } [JsonPropertyName("endMonth")] + [JsonConverter(typeof(NotNullObjectToIntConverter))] public int EndMonth { get; set; } } @@ -60,7 +65,7 @@ public class WeatherValues public class SeasonalValues { [JsonPropertyName("clouds")] - public WeatherSettings Clouds { get; set; } + public WeatherSettings Clouds { get; set; } [JsonPropertyName("windSpeed")] public WeatherSettings WindSpeed { get; set; } @@ -78,7 +83,7 @@ public class SeasonalValues public MinMax RainIntensity { get; set; } [JsonPropertyName("fog")] - public WeatherSettings Fog { get; set; } + public WeatherSettings Fog { get; set; } [JsonPropertyName("temp")] public TempDayNight Temp { get; set; } diff --git a/Core/Models/Spt/Dialog/SendMessageDetails.cs b/Core/Models/Spt/Dialog/SendMessageDetails.cs index 2ed09391..c249a5a6 100644 --- a/Core/Models/Spt/Dialog/SendMessageDetails.cs +++ b/Core/Models/Spt/Dialog/SendMessageDetails.cs @@ -89,7 +89,7 @@ public class ProfileChangeEvent public ProfileChangeEventType Type { get; set; } [JsonPropertyName("value")] - public int Value { get; set; } + public double Value { get; set; } [JsonPropertyName("entity")] public string? Entity { get; set; } diff --git a/Core/Models/Spt/Server/DatabaseTables.cs b/Core/Models/Spt/Server/DatabaseTables.cs index d5d4db71..53e7dfc3 100644 --- a/Core/Models/Spt/Server/DatabaseTables.cs +++ b/Core/Models/Spt/Server/DatabaseTables.cs @@ -5,14 +5,14 @@ namespace Core.Models.Spt.Server; public class DatabaseTables { - public Bots.Bots? bots { get; } - public Hideout.Hideout? hideout { get; } - public LocaleBase? locales { get; } - public Locations? locations { get; } - public Match? match { get; } - public Templates.Templates? templates { get; } - public Dictionary? traders { get; } - public Globals? globals { get; } - public ServerBase? server { get; } - public SettingsBase? settings { get; } + public Bots.Bots? bots { get; set; } + public Hideout.Hideout? hideout { get; set; } + public LocaleBase? locales { get; set; } + public Locations? locations { get; set; } + public Match? match { get; set; } + public Templates.Templates? templates { get; set; } + public Dictionary? traders { get; set; } + public Globals? globals { get; set; } + public ServerBase? server { get; set; } + public SettingsBase? settings { get; set; } } \ No newline at end of file diff --git a/Core/Servers/ConfigServer.cs b/Core/Servers/ConfigServer.cs index 8c6503b2..cecbcabf 100644 --- a/Core/Servers/ConfigServer.cs +++ b/Core/Servers/ConfigServer.cs @@ -1,5 +1,6 @@ using System.Runtime.InteropServices.JavaScript; using System.Text.Json; +using System.Text.Json.Serialization; using Core.Annotations; using Core.Models.Enums; using Core.Models.Spt.Config; @@ -11,8 +12,8 @@ namespace Core.Servers; public class ConfigServer { private ILogger _logger; - protected Dictionary configs; - protected readonly string[] acceptableFileExtensions = ["json", "jsonc"]; + protected Dictionary configs = new(); + protected readonly string[] acceptableFileExtensions = [".json", ".jsonc"]; public ConfigServer( ILogger logger @@ -53,7 +54,7 @@ public class ConfigServer { var fileContent = File.ReadAllText(file); var type = GetConfigTypeByFilename(file); - var deserializedContent = JsonSerializer.Deserialize(fileContent, type); + var deserializedContent = JsonSerializer.Deserialize(fileContent, type, options: new JsonSerializerOptions() {Converters = { new JsonStringEnumConverter() }}); if (deserializedContent == null) { @@ -61,7 +62,7 @@ public class ConfigServer throw new Exception($"Server will not run until the: {file} config error mentioned above is fixed"); } - this.configs[$"spt-{Path.GetFileNameWithoutExtension(file)}"] = deserializedContent; + configs[$"spt-{Path.GetFileNameWithoutExtension(file)}"] = deserializedContent; } } diff --git a/Core/Servers/DatabaseServer.cs b/Core/Servers/DatabaseServer.cs index 2f7dab14..3a731900 100644 --- a/Core/Servers/DatabaseServer.cs +++ b/Core/Servers/DatabaseServer.cs @@ -1,7 +1,9 @@ -using Core.Models.Spt.Server; +using Core.Annotations; +using Core.Models.Spt.Server; namespace Core.Servers; +[Injectable(InjectionType.Singleton)] public class DatabaseServer { protected DatabaseTables tableData = new(); diff --git a/Core/Services/LocalisationService.cs b/Core/Services/LocalisationService.cs index 1130e576..0ba6e197 100644 --- a/Core/Services/LocalisationService.cs +++ b/Core/Services/LocalisationService.cs @@ -36,7 +36,7 @@ public class LocalisationService public string GetText(string key, object? args = null) { - throw new NotImplementedException(); + return _i18nService.GetLocalised(key, args); } public ICollection GetKeys() diff --git a/Core/Utils/App.cs b/Core/Utils/App.cs index 8c73b614..7e460f44 100644 --- a/Core/Utils/App.cs +++ b/Core/Utils/App.cs @@ -1,4 +1,5 @@ using Core.Annotations; +using Core.DI; using Core.Models.Enums; using Core.Models.Spt.Config; using Core.Servers; @@ -46,4 +47,83 @@ public class App _coreConfig = configServer.GetConfig(ConfigTypes.CORE); } + + public async Task Load() + { + // execute onLoad callbacks + _logger.Info(_localisationService.GetText("executing_startup_callbacks")); + + /* + _logger.Debug($"OS: {os.arch()} | {os.version()} | {process.platform}"); + _logger.Debug($"CPU: {os.cpus()[0]?.model} cores: {os.cpus().length}"); + _logger.Debug($"RAM: {(os.totalmem() / 1024 / 1024 / 1024).toFixed(2)}GB"); + _logger.Debug($"PATH: {this.encodingUtil.toBase64(process.argv[0])}"); + _logger.Debug($"PATH: {this.encodingUtil.toBase64(process.execPath)}"); + _logger.Debug($"Server: {ProgramStatics.SPT_VERSION || this.coreConfig.sptVersion}"); + + const nodeVersion = process.version.replace(/^v/, ""); + if (ProgramStatics.EXPECTED_NODE && nodeVersion !== ProgramStatics.EXPECTED_NODE) { + this.logger.error( + "Node version mismatch. Required: ${ProgramStatics.EXPECTED_NODE} | Current: ${nodeVersion}", + ); + process.exit(1); + } + _logger.Debug("Node: ${nodeVersion}"); + + if (ProgramStatics.BUILD_TIME) { + _logger.Debug("Date: ${ProgramStatics.BUILD_TIME}"); + } + + if (ProgramStatics.COMMIT) { + _logger.Debug("Commit: ${ProgramStatics.COMMIT}"); + } + */ + foreach (var onLoad in _onLoad) + { + await onLoad.OnLoad(); + } + + var timer = new Timer(_ => + { + update(_onUpdate); + }, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(5000)); + } + + protected async Task update(IEnumerable onUpdateComponents) + { + // If the server has failed to start, skip any update calls + if (!_httpServer.IsStarted() || !_databaseService.IsDatabaseValid()) { + return; + } + + foreach (var updateable in onUpdateComponents) + { + var success = false; + if (!_onUpdateLastRun.TryGetValue(updateable.GetRoute(), out var lastRunTimeTimestamp)) + lastRunTimeTimestamp = 0; + var secondsSinceLastRun = _timeUtil.GetTimeStamp() - lastRunTimeTimestamp; + + try { + success = await updateable.OnUpdate(secondsSinceLastRun); + } catch (Exception err) { + LogUpdateException(err, updateable); + } + + if (success) { + _onUpdateLastRun[updateable.GetRoute()] = _timeUtil.GetTimeStamp(); + } else { + /* temporary for debug */ + var warnTime = 20 * 60; + + if (secondsSinceLastRun % warnTime == 0) { + _logger.Debug(_localisationService.GetText("route_onupdate_no_response", updateable.GetRoute())); + } + } + } + } + + protected void LogUpdateException(Exception err, OnUpdate updateable) { + _logger.Error(_localisationService.GetText("scheduled_event_failed_to_run", updateable.GetRoute())); + _logger.Error(err.ToString()); + } } \ No newline at end of file diff --git a/Core/Utils/DatabaseImporter.cs b/Core/Utils/DatabaseImporter.cs new file mode 100644 index 00000000..a0bc89c5 --- /dev/null +++ b/Core/Utils/DatabaseImporter.cs @@ -0,0 +1,209 @@ +using Core.Annotations; +using Core.DI; +using Core.Models.Enums; +using Core.Models.Spt.Config; +using Core.Models.Spt.Server; +using Core.Servers; +using Core.Services; +using ILogger = Core.Models.Utils.ILogger; + +namespace Core.Utils; + +[Injectable(InjectionType.Singleton, typePriority: 0)] +public class DatabaseImporter : OnLoad +{ + private object hashedFile; + private ValidationResult valid = ValidationResult.UNDEFINED; + private string filepath; + protected HttpConfig httpConfig; + + protected readonly ILogger _logger; + protected readonly LocalisationService _localisationService; + protected readonly DatabaseServer _databaseServer; + //protected readonly ImageRouter _imageRouter; + protected readonly EncodingUtil _encodingUtil; + protected readonly HashUtil _hashUtil; + protected readonly ImporterUtil _importerUtil; + protected readonly ConfigServer _configServer; + + public DatabaseImporter( + ILogger logger, + // TODO: are we gonna use this? @inject("JsonUtil") protected jsonUtil: JsonUtil, + LocalisationService localisationService, + DatabaseServer databaseServer, + //ImageRouter imageRouter, + EncodingUtil encodingUtil, + HashUtil hashUtil, + ImporterUtil importerUtil, + ConfigServer configServer + ) { + _logger = logger; + _localisationService = localisationService; + _databaseServer = databaseServer; + _encodingUtil = encodingUtil; + _hashUtil = hashUtil; + _importerUtil = importerUtil; + _configServer = configServer; + httpConfig = _configServer.GetConfig(ConfigTypes.HTTP); + } + + /** + * Get path to spt data + * @returns path to data + */ + public string GetSptDataPath() { + return "./Assets/"; + } + + public async Task OnLoad() + { + filepath = GetSptDataPath(); + + /* + if (ProgramStatics.COMPILED) { + try { + // Reading the dynamic SHA1 file + const file = "checks.dat"; + const fileWithPath = `${this.filepath}${file}`; + if (this.vfs.exists(fileWithPath)) { + this.hashedFile = this.jsonUtil.deserialize( + this.encodingUtil.fromBase64(this.vfs.readFile(fileWithPath)), + file, + ); + } else { + this.valid = ValidationResult.NOT_FOUND; + this.logger.debug(this.localisationService.getText("validation_not_found")); + } + } catch (e) { + this.valid = ValidationResult.FAILED; + this.logger.warning(this.localisationService.getText("validation_error_decode")); + } + } + */ + + await HydrateDatabase(filepath); + + var imageFilePath = $"${filepath}images/"; + /* + var directories = this.vfs.getDirs(imageFilePath); + this.loadImages(imageFilePath, directories, [ + "/files/achievement/", + "/files/CONTENT/banners/", + "/files/handbook/", + "/files/Hideout/", + "/files/launcher/", + "/files/prestige/", + "/files/quest/icon/", + "/files/trader/avatar/", + ]); + */ + } + + /** + * Read all json files in database folder and map into a json object + * @param filepath path to database folder + */ + protected async Task HydrateDatabase(string filepath) + { + _logger.Info(_localisationService.GetText("importing_database")); + + var dataToImport = await _importerUtil.LoadRecursiveAsync( + $"{filepath}database/", + typeof(DatabaseTables), + OnReadValidate + ); + + var validation = valid == ValidationResult.FAILED || this.valid == ValidationResult.NOT_FOUND ? "." : ""; + _logger.Info($"{_localisationService.GetText("importing_database_finish")}{validation}"); + _databaseServer.SetTables((DatabaseTables) dataToImport); + } + + protected void OnReadValidate(string fileWithPath, string data) + { + // Validate files + //if (ProgramStatics.COMPILED && hashedFile && !ValidateFile(fileWithPath, data)) { + // this.valid = ValidationResult.FAILED; + //} + } + + public string GetRoute() + { + return "spt-database"; + } + + protected bool ValidateFile(string filePathAndName, object fileData) + { + /* + try { + const finalPath = filePathAndName.replace(this.filepath, "").replace(".json", ""); + let tempObject: any; + for (const prop of finalPath.split("/")) { + if (!tempObject) { + tempObject = this.hashedFile[prop]; + } else { + tempObject = tempObject[prop]; + } + } + + if (tempObject !== this.hashUtil.generateSha1ForData(fileData)) { + this.logger.debug(this.localisationService.getText("validation_error_file", filePathAndName)); + return false; + } + } catch (e) { + this.logger.warning(this.localisationService.getText("validation_error_exception", filePathAndName)); + this.logger.warning(e); + return false; + } + return true; + */ + return true; + } + + /** + * Find and map files with image router inside a designated path + * @param filepath Path to find files in + */ + public void LoadImages(string filepath, List directories, List routes) + { + /* + for (const directoryIndex in directories) { + // Get all files in directory + const filesInDirectory = this.vfs.getFiles(`${filepath}${directories[directoryIndex]}`); + for (const file of filesInDirectory) { + // Register each file in image router + const filename = this.vfs.stripExtension(file); + const routeKey = `${routes[directoryIndex]}${filename}`; + let imagePath = `${filepath}${directories[directoryIndex]}/${file}`; + + const pathOverride = this.getImagePathOverride(imagePath); + if (pathOverride) { + this.logger.debug(`overrode route: ${routeKey} endpoint: ${imagePath} with ${pathOverride}`); + imagePath = pathOverride; + } + + this.imageRouter.addRoute(routeKey, imagePath); + } + } + + // Map icon file separately + this.imageRouter.addRoute("/favicon.ico", `${filepath}icon.ico`); + */ + } + + /** + * Check for a path override in the http json config file + * @param imagePath Key + * @returns override for key + */ + protected string GetImagePathOverride(string imagePath) + { + return httpConfig.ServerImagePathOverride[imagePath]; + } +} + +enum ValidationResult { + SUCCESS = 0, + FAILED = 1, + NOT_FOUND = 2, + UNDEFINED = 3, +} diff --git a/Core/Utils/FileUtil.cs b/Core/Utils/FileUtil.cs new file mode 100644 index 00000000..0fabd1a3 --- /dev/null +++ b/Core/Utils/FileUtil.cs @@ -0,0 +1,29 @@ +using Core.Annotations; + +namespace Core.Utils; + +[Injectable] +public class FileUtil +{ + public List GetFiles(string path, bool recursive = false) + { + var files = new List(Directory.GetFiles(path)); + + if (recursive) + files.AddRange(Directory.GetDirectories(path).SelectMany(d => GetFiles(d, recursive))); + + return files; + } + + public string[] GetDirectories(string path) + { + return Directory.GetDirectories(path); + } + + public string GetFileExtension(string path) + { + return Path.GetExtension(path).Replace(".", ""); + } + +} + diff --git a/Core/Utils/ImporterUtil.cs b/Core/Utils/ImporterUtil.cs new file mode 100644 index 00000000..40c2bc9f --- /dev/null +++ b/Core/Utils/ImporterUtil.cs @@ -0,0 +1,181 @@ +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using Core.Annotations; + +namespace Core.Utils; + +[Injectable(InjectionType.Singleton)] +public class ImporterUtil +{ + private readonly FileUtil _fileUtil; + + public ImporterUtil(FileUtil fileUtil) + { + _fileUtil = fileUtil; + } + + /** + * Load files into js objects recursively (asynchronous) + * @param filepath Path to folder with files + * @returns Promise return T type associated with this class + */ + public async Task LoadRecursiveAsync( + string filepath, + Type loadedType, + Action? onReadCallback = null, + Action? onObjectDeserialized = null + ) { + var result = Activator.CreateInstance(loadedType); + + // get all filepaths + var files = _fileUtil.GetFiles(filepath); + var directories = _fileUtil.GetDirectories(filepath); + + // add file content to result + foreach (var file in files) + { + if (_fileUtil.GetFileExtension(file) != "json") continue; + // const filename = this.vfs.stripExtension(file); + // const filePathAndName = `${filepath}${file}`; + var fileData = await File.ReadAllTextAsync(file); + if (onReadCallback != null) + onReadCallback(file, fileData); + + var matchedProperty = loadedType.GetProperties().FirstOrDefault(prop => prop.Name.ToLower() == Path.GetFileNameWithoutExtension(file).ToLower()); + if (matchedProperty == null) + throw new Exception($"Unable to find property '{Path.GetFileNameWithoutExtension(file)}' for type '{loadedType.Name}'"); + var propertyType = matchedProperty.PropertyType; + var fileDeserialized = JsonSerializer.Deserialize(fileData, propertyType, new JsonSerializerOptions { UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow }); + if (onObjectDeserialized != null) + onObjectDeserialized(file, fileDeserialized); + + matchedProperty.SetValue(result, fileDeserialized); + } + + // deep tree search + foreach (var directory in directories) + { + var matchedProperty = loadedType.GetProperties().FirstOrDefault(prop => prop.Name.ToLower() == directory.ToLower()); + if (matchedProperty == null) + throw new Exception($"Unable to find property '{directory}' for type '{loadedType.Name}'"); + matchedProperty.GetSetMethod().Invoke(result, [await LoadRecursiveAsync($"{filepath}{directory}/", matchedProperty.PropertyType)]); + } + + // return the result of all async fetch + return result; + } + + /** + * Load files into js objects recursively (synchronous) + * @param filepath Path to folder with files + * @returns + */ + public object LoadRecursive( + string filepath, + Type loadedType, + Action? onReadCallback = null, + Action? onObjectDeserialized = null + ) + { + var result = Activator.CreateInstance(loadedType); + + // get all filepaths + var files = Directory.GetFiles(filepath); + var directories = Directory.GetDirectories(filepath); + + foreach (var file in files) + { + if (Path.GetExtension(file) == "json") + { + // const filename = this.vfs.stripExtension(file); + // const filePathAndName = `${filepath}${file}`; + var fileData = File.ReadAllText(file); + onReadCallback(file, fileData); + var matchedProperty = loadedType.GetProperties().FirstOrDefault(prop => prop.Name.ToLower() == Path.GetFileNameWithoutExtension(file).ToLower()); + if (matchedProperty == null) + throw new Exception($"Unable to find property '{Path.GetFileNameWithoutExtension(file)}' for type '{loadedType.Name}'"); + var propertyType = matchedProperty.PropertyType; + var fileDeserialized = JsonSerializer.Deserialize(fileData, propertyType); + onObjectDeserialized(file, fileDeserialized); + + matchedProperty.GetSetMethod().Invoke(result, [fileDeserialized]); + } + } + + // deep tree search + foreach (var directory in directories) + { + var matchedProperty = loadedType.GetProperties().FirstOrDefault(prop => prop.Name.ToLower() == directory.ToLower()); + if (matchedProperty == null) + throw new Exception($"Unable to find property '{directory}' for type '{loadedType.Name}'"); + matchedProperty.GetSetMethod().Invoke(result, [LoadRecursive($"{filepath}{directory}/", matchedProperty.PropertyType)]); + } + + // return the result of all async fetch + return result; + } + + public async Task LoadAsync( + string filepath, + Type loadedType, + string strippablePath = "", + Action? onReadCallback = null, + Action? onObjectDeserialized = null + ) + { + var result = Activator.CreateInstance(loadedType); + var promises = new List>(); + var filesToProcess = new Queue(_fileUtil.GetFiles(filepath, true)); + + while (filesToProcess.Count != 0) { + var fileNode = filesToProcess.Dequeue(); + if (fileNode == null || _fileUtil.GetFileExtension(fileNode) != "json") { + continue; + } + + promises.Add(File.ReadAllTextAsync(fileNode).ContinueWith(fd => + { + onReadCallback(fileNode, fd.Result); + return JsonSerializer.Deserialize(fd.Result, typeof(object)); + })); + /* + this.vfs + .readFileAsync(filePathAndName) + .then(async (fileData) => { + onReadCallback(filePathAndName, fileData); + return this.jsonUtil.deserializeWithCacheCheckAsync(fileData, filePathAndName); + }) + .then(async (fileDeserialized) => { + onObjectDeserialized(filePathAndName, fileDeserialized); + const strippedFilePath = this.vfs.stripExtension(filePathAndName).replace(filepath, ""); + this.placeObject(fileDeserialized, strippedFilePath, result, strippablePath); + }) + .then(() => progressWriter.increment()), + );*/ + } + + //await JSType.Promise<>.all(promises).catch((e) => console.error(e)); + + return result; + } + + /* + protected placeObject(fileDeserialized: any, strippedFilePath: string, result: T, strippablePath: string): void { + const strippedFinalPath = strippedFilePath.replace(strippablePath, ""); + let temp = result; + const propertiesToVisit = strippedFinalPath.split("/"); + for (let i = 0; i < propertiesToVisit.length; i++) { + const property = propertiesToVisit[i]; + + if (i === propertiesToVisit.length - 1) { + temp[property] = fileDeserialized; + } else { + if (!temp[property]) { + temp[property] = {}; + } + temp = temp[property]; + } + } + }*/ +} \ No newline at end of file diff --git a/Core/Utils/Json/Converters/NotNullObjectToIntConverter.cs b/Core/Utils/Json/Converters/NotNullObjectToIntConverter.cs new file mode 100644 index 00000000..85fe83db --- /dev/null +++ b/Core/Utils/Json/Converters/NotNullObjectToIntConverter.cs @@ -0,0 +1,36 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Core.Utils.Json.Converters; + +public class NotNullObjectToIntConverter : JsonConverter +{ + public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + int result; + switch (reader.TokenType) + { + case JsonTokenType.String: + var value = reader.GetString(); + if (string.IsNullOrWhiteSpace(value) || !int.TryParse(value, out result)) + return 0; + break; + case JsonTokenType.Number: + result = reader.GetInt32(); + break; + case JsonTokenType.Null: + return 0; + default: + throw new ArgumentOutOfRangeException(); + } + return result; + } + + public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options) + { + if (value == null) + writer.WriteStringValue(""); + else + writer.WriteStringValue($"{value}"); + } +} \ No newline at end of file diff --git a/Core/Utils/Json/Converters/NullableObjectToLongConverter.cs b/Core/Utils/Json/Converters/NullableObjectToLongConverter.cs new file mode 100644 index 00000000..36b8baf2 --- /dev/null +++ b/Core/Utils/Json/Converters/NullableObjectToLongConverter.cs @@ -0,0 +1,38 @@ +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Core.Utils.Json.Converters; + +public class NullableObjectToLongConverter : JsonConverter +{ + public override long? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + long result; + switch (reader.TokenType) + { + case JsonTokenType.String: + var value = reader.GetString(); + if (string.IsNullOrWhiteSpace(value) || !long.TryParse(value, out result)) + return null; + break; + case JsonTokenType.Number: + result = reader.GetInt64(); + break; + case JsonTokenType.Null: + return null; + default: + throw new ArgumentOutOfRangeException(); + } + return result; + } + + public override void Write(Utf8JsonWriter writer, long? value, JsonSerializerOptions options) + { + if (value == null) + writer.WriteStringValue(""); + else if (value is long longValue) + writer.WriteNumberValue(longValue); + else + throw new Exception("Cannot convert the object valur to a long."); + } +} \ No newline at end of file diff --git a/Server/Assets/configs/bot.json b/Server/Assets/configs/bot.json index 0eaa64d3..bfaa1ca9 100644 --- a/Server/Assets/configs/bot.json +++ b/Server/Assets/configs/bot.json @@ -1156,7 +1156,7 @@ "5": 3, "10": 1 }, - "whitelist": [] + "whitelist": {} }, "pocketLoot": { "weights": { @@ -1165,7 +1165,7 @@ "2": 2, "3": 1 }, - "whitelist": [] + "whitelist": {} }, "vestLoot": { "weights": { @@ -1175,7 +1175,7 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { @@ -1184,14 +1184,14 @@ "2": 4, "3": 3 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 10, "1": 1 }, - "whitelist": [] + "whitelist": {} } }, "equipment": { diff --git a/Server/Assets/configs/playerscav.json b/Server/Assets/configs/playerscav.json index e9c81b05..cc638f89 100644 --- a/Server/Assets/configs/playerscav.json +++ b/Server/Assets/configs/playerscav.json @@ -43,38 +43,38 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "1": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} } }, "labsAccessCardChancePercent": 0, @@ -123,20 +123,20 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "0": 1, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -146,21 +146,21 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "1": 2, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": {} @@ -208,20 +208,20 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -231,21 +231,21 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "1": 2, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": {} @@ -293,20 +293,20 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -316,21 +316,21 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "1": 2, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": {} @@ -378,20 +378,20 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -401,21 +401,21 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "1": 2, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": {} @@ -463,20 +463,20 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -486,21 +486,21 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "1": 2, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": {} @@ -548,20 +548,20 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -571,21 +571,21 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "1": 2, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": {} @@ -633,20 +633,20 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -656,21 +656,21 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "1": 1, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": {} @@ -718,7 +718,7 @@ "0": 2, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { @@ -726,13 +726,13 @@ "1": 1, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -741,7 +741,7 @@ "3": 1, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { @@ -749,7 +749,7 @@ "2": 2, "3": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { @@ -757,7 +757,7 @@ "1": 1, "2": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": { @@ -808,42 +808,42 @@ "1": 1, "2": 2 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "1": 1, "2": 2 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "0": 1, "1": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { "2": 2, "3": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "2": 2, "3": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "1": 1, "2": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": { @@ -895,21 +895,21 @@ "1": 1, "2": 2 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "1": 1, "2": 2 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "1": 5, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -918,7 +918,7 @@ "4": 1, "5": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { @@ -926,14 +926,14 @@ "3": 2, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "1": 1, "2": 2 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": { @@ -984,21 +984,21 @@ "weights": { "2": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "2": 1, "3": 2 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "1": 1, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -1007,7 +1007,7 @@ "5": 1, "6": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { @@ -1015,14 +1015,14 @@ "3": 2, "4": 1 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "2": 1, "3": 2 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": { @@ -1074,21 +1074,21 @@ "2": 5, "3": 1 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "2": 1, "3": 2 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "1": 1, "2": 1 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -1097,21 +1097,21 @@ "5": 2, "6": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "3": 2, "4": 2 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "2": 2, "3": 1 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": { @@ -1180,21 +1180,21 @@ "2": 1, "3": 2 }, - "whitelist": [] + "whitelist": {} }, "drugs": { "weights": { "3": 1, "4": 2 }, - "whitelist": [] + "whitelist": {} }, "stims": { "weights": { "2": 1, "3": 2 }, - "whitelist": [] + "whitelist": {} }, "looseLoot": { "weights": { @@ -1202,21 +1202,21 @@ "6": 2, "7": 1 }, - "whitelist": [] + "whitelist": {} }, "magazines": { "weights": { "3": 1, "4": 4 }, - "whitelist": [] + "whitelist": {} }, "grenades": { "weights": { "3": 1, "4": 2 }, - "whitelist": [] + "whitelist": {} } }, "lootItemsToAddChancePercent": { diff --git a/Server/Program.cs b/Server/Program.cs index 6e6d8a21..b71ce40c 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -1,5 +1,7 @@ using Core.Annotations; +using Core.Context; using Core.Servers; +using Core.Utils; namespace Server; @@ -8,22 +10,32 @@ public static class Program public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); - + RegisterSptComponents(builder.Services); - + // TODO: deal with modding overriding services here! - var httpServer = builder.Services.BuildServiceProvider().GetService(); - httpServer.Load(builder); + try + { + + var serviceProvider = builder.Services.BuildServiceProvider(); + var app = serviceProvider.GetService(); + var appContext = serviceProvider.GetService(); + appContext.AddValue(ContextVariableType.APP_BUILDER, builder); + app.Load().Wait(); + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + } } private static void RegisterComponents(IServiceCollection builderServices, IEnumerable types) { - // We get all injectable services to register them on our services - foreach (var injectableType in types) + var groupedTypes = types.Select(t => { - var attribute = (Injectable) Attribute.GetCustomAttribute(injectableType, typeof(Injectable))!; - var registerableType = injectableType; + var attribute = (Injectable)Attribute.GetCustomAttribute(t, typeof(Injectable))!; + var registerableType = t; // if we have a type override this takes priority if (attribute.InjectableTypeOverride != null) { @@ -34,28 +46,36 @@ public static class Program { registerableType = registerableType.GetInterfaces()[0]; } - - switch (attribute.InjectionType) + + return (registerableInterface: registerableType, typeToRegister: t, injectableAttribute: attribute); + }).GroupBy(t => t.registerableInterface.FullName); + // We get all injectable services to register them on our services + foreach (var groupedInjectables in groupedTypes) + { + foreach (var valueTuple in groupedInjectables.OrderBy(t => t.injectableAttribute.TypePriority)) { - case InjectionType.Singleton: - builderServices.AddSingleton(registerableType, injectableType); - break; - case InjectionType.Transient: - builderServices.AddTransient(registerableType, injectableType); - break; - case InjectionType.Scoped: - builderServices.AddScoped(registerableType, injectableType); - break; - default: - throw new ArgumentOutOfRangeException(); + switch (valueTuple.injectableAttribute.InjectionType) + { + case InjectionType.Singleton: + builderServices.AddSingleton(valueTuple.registerableInterface, valueTuple.typeToRegister); + break; + case InjectionType.Transient: + builderServices.AddTransient(valueTuple.registerableInterface, valueTuple.typeToRegister); + break; + case InjectionType.Scoped: + builderServices.AddScoped(valueTuple.registerableInterface, valueTuple.typeToRegister); + break; + default: + throw new ArgumentOutOfRangeException(); + } } - } + } } - + private static void RegisterSptComponents(IServiceCollection builderServices) { // We get all the services from this assembly first, since mods will override them later - RegisterComponents(builderServices, typeof(Program).Assembly.GetTypes() + RegisterComponents(builderServices, typeof(App).Assembly.GetTypes() .Where(type => Attribute.IsDefined(type, typeof(Injectable)))); } } \ No newline at end of file diff --git a/Server/Server.csproj b/Server/Server.csproj index 938279c6..fbd00ca6 100644 --- a/Server/Server.csproj +++ b/Server/Server.csproj @@ -1,6 +1,7 @@  + false net9.0 enable enable