From 0e883f3ec737123dc900209abaa95079324459f3 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 8 Jan 2025 00:04:02 +0000 Subject: [PATCH] more db work --- Core/Models/Eft/Common/Location.cs | 7 +++ Core/Models/Eft/Common/LocationBase.cs | 60 +++++++++++++++++-- Core/Models/Eft/Common/LooseLoot.cs | 2 +- Core/Models/Eft/Common/Tables/Item.cs | 2 +- .../Models/Eft/Common/Tables/LocationsBase.cs | 2 + Core/Models/Spt/Server/LocaleBase.cs | 2 +- Core/Utils/ImporterUtil.cs | 2 +- 7 files changed, 69 insertions(+), 8 deletions(-) diff --git a/Core/Models/Eft/Common/Location.cs b/Core/Models/Eft/Common/Location.cs index d9ccba3a..9ea70742 100644 --- a/Core/Models/Eft/Common/Location.cs +++ b/Core/Models/Eft/Common/Location.cs @@ -31,6 +31,10 @@ public class Location /** All possible map extracts */ [JsonPropertyName("allExtracts")] public Exit[] AllExtracts { get; set; } + + // TODO: talk to chomp about this type! + [JsonPropertyName("statics")] + public Dictionary Statics { get; set; } } public class StaticContainer @@ -184,4 +188,7 @@ public class StaticItem [JsonPropertyName("_tpl")] public string Tpl { get; set; } + + [JsonPropertyName("upd")] + public Upd Upd { get; set; } } \ No newline at end of file diff --git a/Core/Models/Eft/Common/LocationBase.cs b/Core/Models/Eft/Common/LocationBase.cs index fcc8ee2c..2d75c79b 100644 --- a/Core/Models/Eft/Common/LocationBase.cs +++ b/Core/Models/Eft/Common/LocationBase.cs @@ -14,6 +14,15 @@ public class LocationBase [JsonPropertyName("AirdropParameters")] public List AirdropParameters { get; set; } + [JsonPropertyName("NewSpawnForPlayers")] + public bool NewSpawnForPlayers { get; set; } + + [JsonPropertyName("OfflineNewSpawn")] + public bool OfflineNewSpawn { get; set; } + + [JsonPropertyName("OfflineOldSpawn")] + public bool OfflineOldSpawn { get; set; } + [JsonPropertyName("Area")] public double Area { get; set; } @@ -29,6 +38,12 @@ public class LocationBase [JsonPropertyName("BossLocationSpawn")] public List BossLocationSpawn { get; set; } + [JsonPropertyName("secretExits")] + public List SecretExits { get; set; } + + [JsonPropertyName("BotStartPlayer")] + public int BotStartPlayer { get; set; } + [JsonPropertyName("BotAssault")] public int BotAssault { get; set; } @@ -236,7 +251,14 @@ public class LocationBase [JsonPropertyName("EscapeTimeLimit")] public int EscapeTimeLimit { get; set; } - + + // BSG fucked up another property name + [JsonPropertyName("escape_time_limit")] + public int Escape_Time_Limit_Do_Not_Use + { + set => EscapeTimeLimit = value; + } + [JsonPropertyName("EscapeTimeLimitCoop")] public int EscapeTimeLimitCoop { get; set; } @@ -308,6 +330,9 @@ public class Transit { [JsonPropertyName("active")] public bool IsActive { get; set; } + [JsonPropertyName("events")] + public bool Events { get; set; } + [JsonPropertyName("name")] public string Name { get; set; } @@ -461,7 +486,7 @@ public class BossLocationSpawn { [JsonPropertyName("sptId")] public string SptId { get; set; } - [JsonPropertyName("spawnMode")] + [JsonPropertyName("SpawnMode")] public string[] SpawnMode { get; set; } } @@ -651,6 +676,9 @@ public class Props [JsonPropertyName("Center")] public XYZ Center { get; set; } + [JsonPropertyName("Size")] + public XYZ? Size { get; set; } + [JsonPropertyName("Radius")] public float Radius { get; set; } } @@ -662,19 +690,33 @@ public class Exit public double Chance { get; set; } [JsonPropertyName("ChancePVE")] - public int ChancePVE { get; set; } + public double ChancePVE { get; set; } [JsonPropertyName("Count")] public int Count { get; set; } + [JsonPropertyName("CountPve")] + public int CountPve { get; set; } + + // Had to add this property as BSG sometimes names the properties with full PVE capitals + // This property will just point the value to CountPve [JsonPropertyName("CountPVE")] - public int CountPVE { get; set; } + public int CountPVE + { + set => CountPve = value; + } [JsonPropertyName("EntryPoints")] public string EntryPoints { get; set; } [JsonPropertyName("EventAvailable")] public bool EventAvailable { get; set; } + + [JsonPropertyName("EligibleForPMC")] + public bool? EligibleForPMC { get; set; } + + [JsonPropertyName("EligibleForScav")] + public bool? EligibleForScav { get; set; } [JsonPropertyName("ExfiltrationTime")] public double ExfiltrationTime { get; set; } @@ -743,6 +785,7 @@ public class Wave public string SpawnPoints { get; set; } [JsonPropertyName("WildSpawnType")] + [JsonConverter(typeof(JsonStringEnumConverter))] public WildSpawnType WildSpawnType { get; set; } [JsonPropertyName("isPlayers")] @@ -779,6 +822,13 @@ public class LocationEvents { [JsonPropertyName("Halloween2024")] public Halloween2024 Halloween2024 { get; set; } + + public Khorovod? Khorovod { get; set; } +} + +public class Khorovod +{ + public double Chance { get; set; } } public class Halloween2024 @@ -824,6 +874,8 @@ public class Halloween2024 [JsonPropertyName("InfectionPercentage")] public double InfectionPercentage { get; set; } + + public Khorovod? Khorovod { get; set; } } public class CrowdAttackSpawnParam diff --git a/Core/Models/Eft/Common/LooseLoot.cs b/Core/Models/Eft/Common/LooseLoot.cs index f88b6164..2d8fa8bb 100644 --- a/Core/Models/Eft/Common/LooseLoot.cs +++ b/Core/Models/Eft/Common/LooseLoot.cs @@ -80,7 +80,7 @@ public class GroupPosition [JsonPropertyName("Weight")] public double Weight { get; set; } - [JsonPropertyName("Postion")] + [JsonPropertyName("Position")] public XYZ Position { get; set; } [JsonPropertyName("Rotation")] diff --git a/Core/Models/Eft/Common/Tables/Item.cs b/Core/Models/Eft/Common/Tables/Item.cs index 3c8046c3..bc329258 100644 --- a/Core/Models/Eft/Common/Tables/Item.cs +++ b/Core/Models/Eft/Common/Tables/Item.cs @@ -40,7 +40,7 @@ public class Upd [JsonPropertyName("sptPresetId")] public string? SptPresetId { get; set; } public UpdFaceShield? FaceShield { get; set; } - public int? StackObjectsCount { get; set; } + public double? StackObjectsCount { get; set; } public bool? UnlimitedCount { get; set; } public UpdRepairable? Repairable { get; set; } public UpdRecodableComponent? RecodableComponent { get; set; } diff --git a/Core/Models/Eft/Common/Tables/LocationsBase.cs b/Core/Models/Eft/Common/Tables/LocationsBase.cs index 9ad47b78..0dc3d3a9 100644 --- a/Core/Models/Eft/Common/Tables/LocationsBase.cs +++ b/Core/Models/Eft/Common/Tables/LocationsBase.cs @@ -23,4 +23,6 @@ public class Path [JsonPropertyName("Destination")] public string Destination { get; set; } + + public bool Event { get; set; } } \ No newline at end of file diff --git a/Core/Models/Spt/Server/LocaleBase.cs b/Core/Models/Spt/Server/LocaleBase.cs index 9898ffc3..1d72df31 100644 --- a/Core/Models/Spt/Server/LocaleBase.cs +++ b/Core/Models/Spt/Server/LocaleBase.cs @@ -8,7 +8,7 @@ public class LocaleBase public Dictionary> Global { get; set; } [JsonPropertyName("menu")] - public Dictionary Menu { get; set; } + public Dictionary> Menu { get; set; } [JsonPropertyName("languages")] public Dictionary Languages { get; set; } diff --git a/Core/Utils/ImporterUtil.cs b/Core/Utils/ImporterUtil.cs index fb43f071..67350667 100644 --- a/Core/Utils/ImporterUtil.cs +++ b/Core/Utils/ImporterUtil.cs @@ -77,7 +77,7 @@ public class ImporterUtil // deep tree search foreach (var directory in directories) { - var matchedProperty = loadedType.GetProperties().FirstOrDefault(prop => prop.Name.ToLower() == directory.Split("/").Last().ToLower()); + var matchedProperty = loadedType.GetProperties().FirstOrDefault(prop => prop.Name.ToLower() == directory.Split("/").Last().Replace("_", "").ToLower()); if (matchedProperty == null) throw new Exception($"Unable to find property '{directory}' for type '{loadedType.Name}'"); matchedProperty.GetSetMethod().Invoke(result, [await LoadRecursiveAsync($"{directory}/", matchedProperty.PropertyType)]);