From de38f1fe88a163bc5fd7691fd5a0301d19c8e41f Mon Sep 17 00:00:00 2001 From: Chris Adamson Date: Tue, 29 Apr 2025 10:57:12 -0500 Subject: [PATCH] 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(),