From 18fb3b5b16a2db2929e785c4352ded8f70265342 Mon Sep 17 00:00:00 2001 From: CWX Date: Fri, 25 Apr 2025 13:49:41 +0100 Subject: [PATCH 01/10] Make Loaded configs static --- .../Servers/ConfigServer.cs | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs b/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs index 888c5b38..106513ed 100644 --- a/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs +++ b/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs @@ -1,4 +1,5 @@ using SPTarkov.Common.Annotations; +using SPTarkov.Server.Core.Models.Eft.Common; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; @@ -10,11 +11,11 @@ namespace SPTarkov.Server.Core.Servers; [Injectable(InjectionType.Singleton)] public class ConfigServer { - protected static readonly string[] acceptableFileExtensions = ["json", "jsonc"]; + protected readonly string[] acceptableFileExtensions = ["json", "jsonc"]; protected FileUtil _fileUtil; protected JsonUtil _jsonUtil; protected ISptLogger _logger; - protected Dictionary configs = new(); + private static Dictionary _configs = new(); public ConfigServer( ISptLogger logger, @@ -25,18 +26,22 @@ public class ConfigServer _logger = logger; _jsonUtil = jsonUtil; _fileUtil = fileUtil; - Initialize(); + + if (_configs.Count == 0) + { + Initialize(); + } } public T GetConfig() where T : BaseConfig { var configKey = GetConfigKey(typeof(T)); - if (!configs.ContainsKey(configKey.GetValue())) + if (!_configs.ContainsKey(configKey.GetValue())) { throw new Exception($"Config: {configKey} is undefined. Ensure you have not broken it via editing"); } - return configs[configKey.GetValue()] as T; + return _configs[configKey.GetValue()] as T; } private ConfigTypes GetConfigKey(Type type) @@ -52,7 +57,7 @@ public class ConfigServer public T GetConfigByString(string configType) where T : BaseConfig { - return configs[configType] as T; + return _configs[configType] as T; } public void Initialize() @@ -80,18 +85,9 @@ public class ConfigServer throw new Exception($"Server will not run until the: {file} config error mentioned above is fixed"); } - configs[$"spt-{_fileUtil.StripExtension(file)}"] = deserializedContent; + _configs[$"spt-{_fileUtil.StripExtension(file)}"] = deserializedContent; } } - - /** TODO: deal with this: - this.logger.info(`Commit hash: { - globalThis.G_COMMIT || "DEBUG" - }`); - this.logger.info(`Build date: { - globalThis.G_BUILDTIME || "DEBUG" - }`); - **/ } private Type GetConfigTypeByFilename(string filename) From 89c36650ca383916cc79ab82cb76284f0280b922 Mon Sep 17 00:00:00 2001 From: hulkhan22 Date: Sat, 26 Apr 2025 19:33:35 +0200 Subject: [PATCH 02/10] Objects --- .../Models/Eft/Common/PmcData.cs | 8 ++++-- .../Models/Eft/Common/Tables/BotBase.cs | 26 ++++++++++++++++--- .../Models/Eft/Common/Tables/Item.cs | 21 ++++++++++----- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/PmcData.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/PmcData.cs index ee22fd8e..282b8f3b 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/PmcData.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/PmcData.cs @@ -1,4 +1,5 @@ -using System.Text.Json.Serialization; +using System.ComponentModel; +using System.Text.Json.Serialization; using SPTarkov.Server.Core.Models.Eft.Common.Tables; using SPTarkov.Server.Core.Utils.Json.Converters; @@ -20,7 +21,10 @@ public record PmcData : BotBase set; } - public object CheckedChambers + /// + /// Returns the list of IDs of the weapons, which the player has checked the chamber of in the last raid. + /// + public List CheckedChambers { get; set; diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs index ced49d93..7d540e94 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs @@ -763,11 +763,20 @@ public record BodyPartHealth public record BodyPartEffectProperties { + private object? _extraData; + // TODO: this was any, what actual type is it? public object? ExtraData { - get; - set; + get + { + return _extraData; + } + set + { + Console.WriteLine($"ExtraData: {value}"); + _extraData = value; + } } public double? Time @@ -1490,6 +1499,8 @@ public record DeathCause public record LastPlayerState { + private object? _equipment; + public LastPlayerStateInfo? Info { get; @@ -1505,8 +1516,15 @@ public record LastPlayerState // TODO: there is no definition on TS just any public object? Equipment { - get; - set; + get + { + return _equipment; + } + set + { + Console.WriteLine($"Equipment: {value}"); + _equipment = value; + } } } diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs index 19a04dce..7fa6c9df 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs @@ -169,11 +169,11 @@ public record ItemLocation } [JsonPropertyName("r")] - public object? R + public int R { get; set; - } // TODO: Can be string or number + } [JsonPropertyName("isSearched")] public bool? IsSearched @@ -186,11 +186,11 @@ public record ItemLocation /// SPT property? /// [JsonPropertyName("rotation")] - public object? Rotation + public bool? Rotation { get; set; - } // TODO: Can be string or boolean + } } public record Upd @@ -646,6 +646,8 @@ public record UpdLight public record UpdDogtag { + private object? _side; + [JsonPropertyName("AccountId")] public string? AccountId { @@ -670,8 +672,15 @@ public record UpdDogtag [JsonPropertyName("Side")] public object? Side { - get; - set; + get + { + return _side; + } + set + { + Console.WriteLine($"Side: {value}"); + _side = value; + } } [JsonPropertyName("Level")] From 0e176aba5ff69f9ac360616161780c55918c9dc7 Mon Sep 17 00:00:00 2001 From: hulkhan22 Date: Sat, 26 Apr 2025 20:53:14 +0200 Subject: [PATCH 03/10] Fix --- .../Controllers/BotController.cs | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs index 7525b2a7..78f8ae2c 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs @@ -1,3 +1,4 @@ +using System.Collections.Concurrent; using System.Diagnostics; using System.Text.Json.Serialization; using SPTarkov.Common.Annotations; @@ -179,7 +180,7 @@ public class BotController( /// List of generated bots protected List GenerateBotWaves(GenerateBotsRequestData request, PmcData? pmcProfile, string sessionId) { - var result = new List(); + var result = new ConcurrentBag(); var raidSettings = GetMostRecentRaidSettings(); @@ -201,8 +202,12 @@ public class BotController( condition.Limit), // Choose largest between value passed in from request vs what's in bot.config _botHelper.IsBotPmc(condition.Role)); - result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId)); - })).ToArray()); + var wave = GenerateBotWave(condition, botWaveGenerationDetails, sessionId); + foreach (var bot in wave) + { + result.Add(bot); + } + }))); stopwatch.Stop(); if (_logger.IsLogEnabled(LogLevel.Debug)) @@ -210,7 +215,7 @@ public class BotController( _logger.Debug($"Took {stopwatch.ElapsedMilliseconds}ms to GenerateMultipleBotsAndCache()"); } - return result; + return result.ToList(); } /// @@ -239,30 +244,38 @@ public class BotController( _logger.Debug($"Generating wave of: {botGenerationDetails.BotCountToGenerate} bots of type: {role} {botGenerationDetails.BotDifficulty}"); } - var results = new List(); + var results = new ConcurrentBag(); + var tasks = new Task[botGenerationDetails.BotCountToGenerate.Value]; + for (var i = 0; i < botGenerationDetails.BotCountToGenerate; i++) { - try + var task = Task.Run(() => { - var bot = _botGenerator.PrepareAndGenerateBot(sessionId, _cloner.Clone(botGenerationDetails)); - - // The client expects the Side for PMCs to be `Savage` - // We do this here so it's after we cache the bot in the match details lookup, as when you die, they will have the right side - if (bot.Info.Side is "Bear" or "Usec") + try { - bot.Info.Side = "Savage"; - } + var bot = _botGenerator.PrepareAndGenerateBot(sessionId, _cloner.Clone(botGenerationDetails)); - results.Add(bot); - // Store bot details in cache so post-raid PMC messages can use data - _matchBotDetailsCacheService.CacheBot(_cloner.Clone(bot)); - } - catch (Exception e) - { - _logger.Error($"Failed to generate bot: {botGenerationDetails.Role} #{i + 1}: {e.Message} {e.StackTrace}"); - } + // The client expects the Side for PMCs to be `Savage` + // We do this here so it's after we cache the bot in the match details lookup, as when you die, they will have the right side + if (bot.Info.Side is "Bear" or "Usec") + { + bot.Info.Side = "Savage"; + } + + results.Add(bot); + // Store bot details in cache so post-raid PMC messages can use data + _matchBotDetailsCacheService.CacheBot(_cloner.Clone(bot)); + } + catch (Exception e) + { + _logger.Error($"Failed to generate bot: {botGenerationDetails.Role} #{i + 1}: {e.Message} {e.StackTrace}"); + } + }); + tasks[i] = task; } + Task.WaitAll(tasks); + if (_logger.IsLogEnabled(LogLevel.Debug)) { _logger.Debug( @@ -271,7 +284,7 @@ public class BotController( ); } - return results; + return results.ToList(); } /// From 38f561b85d7dd3c1a4f8bf6f0b10fe83ee570c43 Mon Sep 17 00:00:00 2001 From: hulkhan22 Date: Sat, 26 Apr 2025 21:37:08 +0200 Subject: [PATCH 04/10] DogtagSide --- .../Models/Eft/Common/Tables/Item.cs | 14 +++----- .../Models/Enums/DogtagSide.cs | 12 +++++++ .../Json/Converters/DogtagSideConverter.cs | 33 +++++++++++++++++++ 3 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 Libraries/SPTarkov.Server.Core/Models/Enums/DogtagSide.cs create mode 100644 Libraries/SPTarkov.Server.Core/Utils/Json/Converters/DogtagSideConverter.cs diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs index 7fa6c9df..29be9361 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs @@ -670,17 +670,11 @@ public record UpdDogtag } [JsonPropertyName("Side")] - public object? Side + [JsonConverter(typeof(DogtagSideConverter))] + public DogtagSide? Side { - get - { - return _side; - } - set - { - Console.WriteLine($"Side: {value}"); - _side = value; - } + get; + set; } [JsonPropertyName("Level")] diff --git a/Libraries/SPTarkov.Server.Core/Models/Enums/DogtagSide.cs b/Libraries/SPTarkov.Server.Core/Models/Enums/DogtagSide.cs new file mode 100644 index 00000000..d94e0717 --- /dev/null +++ b/Libraries/SPTarkov.Server.Core/Models/Enums/DogtagSide.cs @@ -0,0 +1,12 @@ +namespace SPTarkov.Server.Core.Models.Enums; + +public enum DogtagSide +{ + /// + /// This is for the dogtag equipped by the player, which shows up as 0 (integer) on the profile json. + /// + NotApplicable, + + Usec, + Bear +} diff --git a/Libraries/SPTarkov.Server.Core/Utils/Json/Converters/DogtagSideConverter.cs b/Libraries/SPTarkov.Server.Core/Utils/Json/Converters/DogtagSideConverter.cs new file mode 100644 index 00000000..b7b2b4ae --- /dev/null +++ b/Libraries/SPTarkov.Server.Core/Utils/Json/Converters/DogtagSideConverter.cs @@ -0,0 +1,33 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using SPTarkov.Server.Core.Models.Enums; + +namespace SPTarkov.Server.Core.Utils.Json.Converters; + +public class DogtagSideConverter : JsonConverter +{ + public override DogtagSide Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType == JsonTokenType.Number) + { + return DogtagSide.NotApplicable; + } + + var value = reader.GetString(); + return value != null ? Enum.Parse(value) : DogtagSide.NotApplicable; + } + + public override void Write(Utf8JsonWriter writer, DogtagSide value, JsonSerializerOptions options) + { + switch (value) + { + case DogtagSide.NotApplicable: + writer.WriteNumberValue(0); + break; + case DogtagSide.Usec: + case DogtagSide.Bear: + writer.WriteStringValue(value.ToString()); + break; + } + } +} From 7e13c8c4465fbc611f26e6a6c29a3a1650e89d55 Mon Sep 17 00:00:00 2001 From: hulkhan22 Date: Sat, 26 Apr 2025 23:29:12 +0200 Subject: [PATCH 05/10] Revert "Fix" This reverts commit ce97c1676198197b8c2a0ef75eaee7df869cb3bd. --- .../Controllers/BotController.cs | 55 +++++++------------ 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs index 78f8ae2c..7525b2a7 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs @@ -1,4 +1,3 @@ -using System.Collections.Concurrent; using System.Diagnostics; using System.Text.Json.Serialization; using SPTarkov.Common.Annotations; @@ -180,7 +179,7 @@ public class BotController( /// List of generated bots protected List GenerateBotWaves(GenerateBotsRequestData request, PmcData? pmcProfile, string sessionId) { - var result = new ConcurrentBag(); + var result = new List(); var raidSettings = GetMostRecentRaidSettings(); @@ -202,12 +201,8 @@ public class BotController( condition.Limit), // Choose largest between value passed in from request vs what's in bot.config _botHelper.IsBotPmc(condition.Role)); - var wave = GenerateBotWave(condition, botWaveGenerationDetails, sessionId); - foreach (var bot in wave) - { - result.Add(bot); - } - }))); + result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId)); + })).ToArray()); stopwatch.Stop(); if (_logger.IsLogEnabled(LogLevel.Debug)) @@ -215,7 +210,7 @@ public class BotController( _logger.Debug($"Took {stopwatch.ElapsedMilliseconds}ms to GenerateMultipleBotsAndCache()"); } - return result.ToList(); + return result; } /// @@ -244,38 +239,30 @@ public class BotController( _logger.Debug($"Generating wave of: {botGenerationDetails.BotCountToGenerate} bots of type: {role} {botGenerationDetails.BotDifficulty}"); } - var results = new ConcurrentBag(); - var tasks = new Task[botGenerationDetails.BotCountToGenerate.Value]; - + var results = new List(); for (var i = 0; i < botGenerationDetails.BotCountToGenerate; i++) { - var task = Task.Run(() => + try { - try - { - var bot = _botGenerator.PrepareAndGenerateBot(sessionId, _cloner.Clone(botGenerationDetails)); + var bot = _botGenerator.PrepareAndGenerateBot(sessionId, _cloner.Clone(botGenerationDetails)); - // The client expects the Side for PMCs to be `Savage` - // We do this here so it's after we cache the bot in the match details lookup, as when you die, they will have the right side - if (bot.Info.Side is "Bear" or "Usec") - { - bot.Info.Side = "Savage"; - } - - results.Add(bot); - // Store bot details in cache so post-raid PMC messages can use data - _matchBotDetailsCacheService.CacheBot(_cloner.Clone(bot)); - } - catch (Exception e) + // The client expects the Side for PMCs to be `Savage` + // We do this here so it's after we cache the bot in the match details lookup, as when you die, they will have the right side + if (bot.Info.Side is "Bear" or "Usec") { - _logger.Error($"Failed to generate bot: {botGenerationDetails.Role} #{i + 1}: {e.Message} {e.StackTrace}"); + bot.Info.Side = "Savage"; } - }); - tasks[i] = task; + + results.Add(bot); + // Store bot details in cache so post-raid PMC messages can use data + _matchBotDetailsCacheService.CacheBot(_cloner.Clone(bot)); + } + catch (Exception e) + { + _logger.Error($"Failed to generate bot: {botGenerationDetails.Role} #{i + 1}: {e.Message} {e.StackTrace}"); + } } - Task.WaitAll(tasks); - if (_logger.IsLogEnabled(LogLevel.Debug)) { _logger.Debug( @@ -284,7 +271,7 @@ public class BotController( ); } - return results.ToList(); + return results; } /// From baed8d2b901f0455c41f3c0b89aa894eb911ae69 Mon Sep 17 00:00:00 2001 From: hulkhan22 Date: Sat, 26 Apr 2025 23:56:48 +0200 Subject: [PATCH 06/10] Revert to a lock --- Libraries/SPTarkov.Server.Core/Controllers/BotController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs index 7525b2a7..90397713 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs @@ -39,6 +39,7 @@ public class BotController( { private readonly BotConfig _botConfig = _configServer.GetConfig(); private readonly PmcConfig _pmcConfig = _configServer.GetConfig(); + private static readonly Lock BotListLock = new(); /// /// Return the number of bot load-out varieties to be generated @@ -201,7 +202,10 @@ public class BotController( condition.Limit), // Choose largest between value passed in from request vs what's in bot.config _botHelper.IsBotPmc(condition.Role)); - result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId)); + lock (BotListLock) + { + result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId)); + } })).ToArray()); stopwatch.Stop(); From 3b41b551cab2ca534eb19bd7f2809c238b0e169d Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 26 Apr 2025 23:12:19 +0100 Subject: [PATCH 07/10] Renamed lock vars to match convention --- .../Extensions/StringExtensions.cs | 16 ++++++++-------- .../Controllers/BotController.cs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Libraries/SPTarkov.Common/Extensions/StringExtensions.cs b/Libraries/SPTarkov.Common/Extensions/StringExtensions.cs index 4910e4a5..c444e332 100644 --- a/Libraries/SPTarkov.Common/Extensions/StringExtensions.cs +++ b/Libraries/SPTarkov.Common/Extensions/StringExtensions.cs @@ -5,18 +5,18 @@ namespace SPTarkov.Common.Extensions; public static class StringExtensions { - private static readonly Dictionary RegexCache = new(); - private static readonly Lock RegexCacheLock = new(); + private static readonly Dictionary _regexCache = new(); + private static readonly Lock _regexCacheLock = new(); public static string RegexReplace(this string source, [StringSyntax(StringSyntaxAttribute.Regex)] string regexString, string newValue) { Regex regex; - lock (RegexCacheLock) + lock (_regexCacheLock) { - if (!RegexCache.TryGetValue(regexString, out regex)) + if (!_regexCache.TryGetValue(regexString, out regex)) { regex = new Regex(regexString); - RegexCache[regexString] = regex; + _regexCache[regexString] = regex; } } @@ -26,12 +26,12 @@ public static class StringExtensions public static bool RegexMatch(this string source, [StringSyntax(StringSyntaxAttribute.Regex)] string regexString, out Match? matchedString) { Regex regex; - lock (RegexCacheLock) + lock (_regexCacheLock) { - if (!RegexCache.TryGetValue(regexString, out regex)) + if (!_regexCache.TryGetValue(regexString, out regex)) { regex = new Regex(regexString); - RegexCache[regexString] = regex; + _regexCache[regexString] = regex; } } diff --git a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs index 90397713..a0bc1189 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/BotController.cs @@ -39,7 +39,7 @@ public class BotController( { private readonly BotConfig _botConfig = _configServer.GetConfig(); private readonly PmcConfig _pmcConfig = _configServer.GetConfig(); - private static readonly Lock BotListLock = new(); + private static readonly Lock _botListLock = new(); /// /// Return the number of bot load-out varieties to be generated @@ -202,7 +202,7 @@ public class BotController( condition.Limit), // Choose largest between value passed in from request vs what's in bot.config _botHelper.IsBotPmc(condition.Role)); - lock (BotListLock) + lock (_botListLock) { result.AddRange(GenerateBotWave(condition, botWaveGenerationDetails, sessionId)); } From 871ca63aaad01518891098f0dce19c7b39f5b6a3 Mon Sep 17 00:00:00 2001 From: hulkhan22 Date: Sun, 27 Apr 2025 01:39:21 +0200 Subject: [PATCH 08/10] More type changes --- .../Assets/database/templates/quests.json | 2 +- .../Models/Eft/Common/Tables/BotBase.cs | 13 ++----------- .../Models/Eft/Common/Tables/Item.cs | 2 -- .../Models/Eft/Common/Tables/Quest.cs | 10 +++++----- UnitTests/TestAssets/quests.json | 2 +- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Libraries/SPTarkov.Server.Assets/Assets/database/templates/quests.json b/Libraries/SPTarkov.Server.Assets/Assets/database/templates/quests.json index 3386dc5d..8eb040f5 100644 --- a/Libraries/SPTarkov.Server.Assets/Assets/database/templates/quests.json +++ b/Libraries/SPTarkov.Server.Assets/Assets/database/templates/quests.json @@ -98657,7 +98657,7 @@ "conditionType": "Kills", "id": "655e484b52dc506c051b4409", "target": "AnyPmc", - "value": "1" + "value": 1 } ], "id": "655e483da3ee7d4c56241e18" diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs index 7d540e94..19b31bed 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs @@ -1499,8 +1499,6 @@ public record DeathCause public record LastPlayerState { - private object? _equipment; - public LastPlayerStateInfo? Info { get; @@ -1516,15 +1514,8 @@ public record LastPlayerState // TODO: there is no definition on TS just any public object? Equipment { - get - { - return _equipment; - } - set - { - Console.WriteLine($"Equipment: {value}"); - _equipment = value; - } + get; + set; } } diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs index 29be9361..438b70c8 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs @@ -646,8 +646,6 @@ public record UpdLight public record UpdDogtag { - private object? _side; - [JsonPropertyName("AccountId")] public string? AccountId { diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs index 6ccbbc4e..86972834 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs @@ -179,11 +179,11 @@ public record Quest /// Becomes 'AppearStatus' inside client /// [JsonPropertyName("status")] - public object? Status + public int? Status { get; set; - } // TODO: string | number + } [JsonPropertyName("KeyQuest")] public bool? KeyQuest @@ -447,11 +447,11 @@ public record QuestCondition } [JsonPropertyName("type")] - public object? Type + public string? Type { get; set; - } // TODO: boolean | string + } [JsonPropertyName("status")] public List? Status @@ -770,7 +770,7 @@ public record QuestConditionCounterCondition } [JsonPropertyName("value")] - public object? Value + public int? Value { get; set; diff --git a/UnitTests/TestAssets/quests.json b/UnitTests/TestAssets/quests.json index 0c12f837..cd3d3388 100644 --- a/UnitTests/TestAssets/quests.json +++ b/UnitTests/TestAssets/quests.json @@ -98796,7 +98796,7 @@ "conditionType": "Kills", "id": "655e484b52dc506c051b4409", "target": "AnyPmc", - "value": "1" + "value": 1 } ], "id": "655e483da3ee7d4c56241e18" From b1fd4d2055d7029832a70b4787256f36f4eccb15 Mon Sep 17 00:00:00 2001 From: hulkhan22 Date: Sun, 27 Apr 2025 01:50:26 +0200 Subject: [PATCH 09/10] revert --- .../Models/Eft/Common/Tables/BotBase.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs index 19b31bed..ced49d93 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/BotBase.cs @@ -763,20 +763,11 @@ public record BodyPartHealth public record BodyPartEffectProperties { - private object? _extraData; - // TODO: this was any, what actual type is it? public object? ExtraData { - get - { - return _extraData; - } - set - { - Console.WriteLine($"ExtraData: {value}"); - _extraData = value; - } + get; + set; } public double? Time From 850059416fecba36e4303ecc2ce08679a4680d0b Mon Sep 17 00:00:00 2001 From: hulkhan22 Date: Sun, 27 Apr 2025 02:45:59 +0200 Subject: [PATCH 10/10] Reverted data change --- .../Assets/database/templates/quests.json | 2 +- .../SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs | 2 +- UnitTests/TestAssets/quests.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/SPTarkov.Server.Assets/Assets/database/templates/quests.json b/Libraries/SPTarkov.Server.Assets/Assets/database/templates/quests.json index 8eb040f5..3386dc5d 100644 --- a/Libraries/SPTarkov.Server.Assets/Assets/database/templates/quests.json +++ b/Libraries/SPTarkov.Server.Assets/Assets/database/templates/quests.json @@ -98657,7 +98657,7 @@ "conditionType": "Kills", "id": "655e484b52dc506c051b4409", "target": "AnyPmc", - "value": 1 + "value": "1" } ], "id": "655e483da3ee7d4c56241e18" diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs index 86972834..6244b47b 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Quest.cs @@ -770,7 +770,7 @@ public record QuestConditionCounterCondition } [JsonPropertyName("value")] - public int? Value + public object? Value { get; set; diff --git a/UnitTests/TestAssets/quests.json b/UnitTests/TestAssets/quests.json index cd3d3388..0c12f837 100644 --- a/UnitTests/TestAssets/quests.json +++ b/UnitTests/TestAssets/quests.json @@ -98796,7 +98796,7 @@ "conditionType": "Kills", "id": "655e484b52dc506c051b4409", "target": "AnyPmc", - "value": 1 + "value": "1" } ], "id": "655e483da3ee7d4c56241e18"