From de38f1fe88a163bc5fd7691fd5a0301d19c8e41f Mon Sep 17 00:00:00 2001 From: Chris Adamson Date: Tue, 29 Apr 2025 10:57:12 -0500 Subject: [PATCH 1/3] try just the enum --- .../Generators/LocationLootGenerator.cs | 2 +- .../Helpers/BotGeneratorHelper.cs | 2 +- .../Helpers/InventoryHelper.cs | 7 +++--- .../Models/Eft/Common/Tables/Item.cs | 22 +++++++++++++------ .../SPTarkov.Server.Core/Utils/JsonUtil.cs | 1 + 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs index edf8f073..4c1b4a45 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs @@ -503,7 +503,7 @@ public class LocationLootGenerator( { X = result.X, Y = result.Y, - R = result.Rotation.GetValueOrDefault(false) ? 1 : 0 + R = result.Rotation.GetValueOrDefault(false) ? ItemRotation.Vertical : ItemRotation.Horizontal }; // Add loot to container before returning diff --git a/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs index bb25ed63..1873ea63 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs @@ -651,7 +651,7 @@ public class BotGeneratorHelper( { X = findSlotResult.X, Y = findSlotResult.Y, - R = findSlotResult.Rotation ?? false ? 1 : 0 + R = findSlotResult.Rotation ?? false ? ItemRotation.Vertical : ItemRotation.Horizontal } ; } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs index 3b6ab782..1a164b11 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs @@ -324,7 +324,7 @@ public class InventoryHelper( { X = findSlotResult.X, Y = findSlotResult.Y, - R = findSlotResult.Rotation.GetValueOrDefault(false) ? 1 : 0, + R = findSlotResult.Rotation.GetValueOrDefault(false) ? ItemRotation.Vertical : ItemRotation.Horizontal, Rotation = findSlotResult.Rotation }; @@ -382,7 +382,7 @@ public class InventoryHelper( { X = findSlotResult.X, Y = findSlotResult.Y, - R = findSlotResult.Rotation.Value ? 1 : 0, + R = findSlotResult.Rotation.Value ? ItemRotation.Vertical : ItemRotation.Horizontal, Rotation = findSlotResult.Rotation }; @@ -423,7 +423,7 @@ public class InventoryHelper( { X = findSortingSlotResult.X, Y = findSortingSlotResult.Y, - R = findSortingSlotResult.Rotation.Value ? 1 : 0, + R = findSortingSlotResult.Rotation.Value ? ItemRotation.Vertical : ItemRotation.Horizontal, Rotation = findSortingSlotResult.Rotation }; } @@ -845,6 +845,7 @@ public class InventoryHelper( ItemLocation? itemLocation; if (item.Location is JsonElement) { + Console.WriteLine(item.Location); itemLocation = ((JsonElement) item.Location).ToObject(); } else 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 b0c8ec80..69343168 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs @@ -168,13 +168,6 @@ public record ItemLocation set; } - [JsonPropertyName("r")] - public int R - { - get; - set; - } - [JsonPropertyName("isSearched")] public bool? IsSearched { @@ -191,6 +184,21 @@ public record ItemLocation get; set; } + + [JsonPropertyName("r")] + public ItemRotation R + { + get; + set; + } +} + +public enum ItemRotation +{ + // Token: 0x0400259F RID: 9631 + Horizontal, + // Token: 0x040025A0 RID: 9632 + Vertical } public record Upd diff --git a/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs index ccd1fba7..5a58360d 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs @@ -59,6 +59,7 @@ public class JsonUtil new EftEnumConverter(), new EftEnumConverter(), new EftEnumConverter(), + new EftEnumConverter(), new EftListEnumConverter(), new EftListEnumConverter(), From a446f039c9329868ba1460c7066fbded68d18c33 Mon Sep 17 00:00:00 2001 From: Chris Adamson Date: Tue, 29 Apr 2025 11:44:25 -0500 Subject: [PATCH 2/3] location enum for fresh profiles --- Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs | 1 + Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) 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 69343168..962c2094 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Tables/Item.cs @@ -186,6 +186,7 @@ public record ItemLocation } [JsonPropertyName("r")] + [JsonConverter(typeof(JsonStringEnumConverter))] public ItemRotation R { get; diff --git a/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs b/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs index 5a58360d..ccd1fba7 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/JsonUtil.cs @@ -59,7 +59,6 @@ public class JsonUtil new EftEnumConverter(), new EftEnumConverter(), new EftEnumConverter(), - new EftEnumConverter(), new EftListEnumConverter(), new EftListEnumConverter(), From 9fb8b62630d72cc85a1c3f9554ae1c3bbe48e7dd Mon Sep 17 00:00:00 2001 From: Chris Adamson Date: Tue, 29 Apr 2025 12:45:36 -0500 Subject: [PATCH 3/3] remove logs --- Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs index 1a164b11..64063bc1 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs @@ -845,7 +845,6 @@ public class InventoryHelper( ItemLocation? itemLocation; if (item.Location is JsonElement) { - Console.WriteLine(item.Location); itemLocation = ((JsonElement) item.Location).ToObject(); } else