diff --git a/Libraries/Core/Models/Eft/Common/LooseLoot.cs b/Libraries/Core/Models/Eft/Common/LooseLoot.cs index 83e12da7..f4594048 100644 --- a/Libraries/Core/Models/Eft/Common/LooseLoot.cs +++ b/Libraries/Core/Models/Eft/Common/LooseLoot.cs @@ -1,4 +1,4 @@ -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; using Core.Models.Eft.Common.Tables; namespace Core.Models.Eft.Common; @@ -53,8 +53,13 @@ public record SpawnpointTemplate [JsonPropertyName("GroupPositions")] public List? GroupPositions { get; set; } + private string? _root; [JsonPropertyName("Root")] - public string? Root { get; set; } + public string? Root + { + get => _root; + set => _root = value == null ? null : string.Intern(value); + } [JsonPropertyName("Items")] public List? Items { get; set; } @@ -62,8 +67,13 @@ public record SpawnpointTemplate public record GroupPosition { + private string? _name; [JsonPropertyName("Name")] - public string? Name { get; set; } + public string? Name + { + get => _name; + set => _name = value == null ? null : string.Intern(value); + } [JsonPropertyName("Weight")] public double? Weight { get; set; } diff --git a/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs b/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs index 4126f9a8..03fb105f 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/BotBase.cs @@ -152,12 +152,25 @@ public record Info public string? Nickname { get; set; } public string? MainProfileNickname { get; set; } public string? LowerNickname { get; set; } - public string? Side { get; set; } + + private string? _side; + public string? Side + { + get => _side; + set => _side = string.Intern(value); + } + public bool? SquadInviteRestriction { get; set; } // Confirmed in client public int? PrestigeLevel { get; set; } - public string? Voice { get; set; } + + private string? _voice; + public string? Voice + { + get => _voice; + set => _voice = value == null ? null : string.Intern(value); + } public int? Level { get; set; } //Experience the bot has gained @@ -212,8 +225,19 @@ public record Info public record BotInfoSettings { - public string? Role { get; set; } - public string? BotDifficulty { get; set; } + private string? _role; + public string? Role + { + get => _role; + set => _role = value == null ? null : string.Intern(value); + } + + private string? _botDifficulty; + public string? BotDifficulty + { + get => _botDifficulty; + set => _botDifficulty = value == null ? null : string.Intern(value); + } // Experience given for being killed public int? Experience { get; set; } @@ -244,11 +268,40 @@ public enum BanType public record Customization { - public string? Head { get; set; } - public string? Body { get; set; } - public string? Feet { get; set; } - public string? Hands { get; set; } - public string? DogTag { get; set; } + private string? _head; + public string? Head + { + get => _head; + set => _head = value == null ? null : string.Intern(value); + } + + private string? _body; + public string? Body + { + get => _body; + set => _body = value == null ? null : string.Intern(value); + } + + private string? _feet; + public string? Feet + { + get => _feet; + set => _feet = value == null ? null : string.Intern(value); + } + + private string? _hands; + public string? Hands + { + get => _hands; + set => _hands = value == null ? null : string.Intern(value); + } + + private string? _dogtag; + public string? DogTag + { + get => _dogtag; + set => _dogtag = value == null ? null : string.Intern(value); + } } public record BotBaseHealth diff --git a/Libraries/Core/Models/Eft/Common/Tables/Item.cs b/Libraries/Core/Models/Eft/Common/Tables/Item.cs index ee2a80b1..ece117c3 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/Item.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/Item.cs @@ -9,15 +9,30 @@ public record Item [JsonPropertyName("_id")] public string? Id { get; set; } - // MongoId + private string? _tpl; [JsonPropertyName("_tpl")] - public string? Template { get; set; } + // MongoId + public string? Template + { + get => _tpl; + set => _tpl = string.Intern(value); + } + private string? _parentId; [JsonPropertyName("parentId")] - public string? ParentId { get; set; } + public string? ParentId + { + get => _parentId; + set => _parentId = value == null ? null : string.Intern(value); + } + private string? _SlotId; [JsonPropertyName("slotId")] - public string? SlotId { get; set; } + public string? SlotId + { + get => _SlotId; + set => _SlotId = value == null ? null : string.Intern(value); + } [JsonPropertyName("location")] public object? Location { get; set; } // TODO: Can be IItemLocation or number @@ -27,17 +42,6 @@ public record Item [JsonPropertyName("upd")] public Upd? Upd { get; set; } - - public HideoutItem ConvertToHideoutItem(Item item, double? count = null) - { - return new HideoutItem() - { - Id = item.Id, - Template = item.Template, - Upd = item.Upd, - Count = count - }; - } } public record HideoutItem diff --git a/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs b/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs index 1d61b18c..dd8afcc6 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/TemplateItem.cs @@ -6,17 +6,37 @@ namespace Core.Models.Eft.Common.Tables; public record TemplateItem { + private string? _id; [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get => _id; + set => _id = string.Intern(value); + } + private string? _name; [JsonPropertyName("_name")] - public string? Name { get; set; } + public string? Name + { + get => _name; + set => _name = string.Intern(value); + } + private string? _parent; [JsonPropertyName("_parent")] - public string? Parent { get; set; } + public string? Parent + { + get => _parent; + set => _parent = string.Intern(value); + } + private string? _type; [JsonPropertyName("_type")] - public string? Type { get; set; } + public string? Type + { + get => _type; + set => _type = string.Intern(value); + } [JsonPropertyName("_props")] public Props? Properties { get; set; } @@ -182,8 +202,13 @@ public record Props [JsonPropertyName("MergesWithChildren")] public bool? MergesWithChildren { get; set; } + private string? _metascoreGroup; [JsonPropertyName("MetascoreGroup")] - public string? MetaScoreGroup { get; set; } + public string? MetascoreGroup + { + get => _metascoreGroup; + set => _metascoreGroup = value == null ? null : string.Intern(value); + } [JsonPropertyName("NpcCompressorSendLevel")] public double? NpcCompressorSendLevel { get; set; } @@ -203,8 +228,13 @@ public record Props [JsonPropertyName("Unlootable")] public bool? Unlootable { get; set; } + private string? _unlootableFromSlot; [JsonPropertyName("UnlootableFromSlot")] - public string? UnlootableFromSlot { get; set; } + public string? UnlootableFromSlot + { + get => _unlootableFromSlot; + set => _unlootableFromSlot = value == null ? null : string.Intern(value); + } [JsonPropertyName("UnlootableFromSide")] public List? UnlootableFromSide { get; set; } @@ -223,8 +253,13 @@ public record Props [JsonPropertyName("RagFairCommissionModifier")] public double? RagFairCommissionModifier { get; set; } + private string? _rarityPvE; [JsonPropertyName("RarityPvE")] - public string? RarityPvE { get; set; } + public string? RarityPvE + { + get => _rarityPvE; + set => _rarityPvE = value == null ? null : string.Intern(value); + } [JsonPropertyName("IsAlwaysAvailableForInsurance")] public bool? IsAlwaysAvailableForInsurance { get; set; } @@ -1575,8 +1610,13 @@ public record GridFilter public record Slot { + private string? _name; [JsonPropertyName("_name")] - public string? Name { get; set; } + public string? Name + { + get => _name; + set => _name = value == null ? null : string.Intern(value); + } [JsonPropertyName("_id")] public string? Id { get; set; } @@ -1596,8 +1636,13 @@ public record Slot [JsonPropertyName("_mergeSlotWithChildren")] public bool? MergeSlotWithChildren { get; set; } + private string? _proto; [JsonPropertyName("_proto")] - public string? Proto { get; set; } + public string? Proto + { + get => _proto; + set => _proto = value == null ? null : string.Intern(value); + } } public record SlotProps diff --git a/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs b/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs index 7b2648f4..17fc9adb 100644 --- a/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs +++ b/Libraries/Core/Models/Eft/Ragfair/RagfairOffer.cs @@ -9,8 +9,13 @@ public record RagfairOffer [JsonPropertyName("sellResult")] public List? SellResults { get; set; } + private string? _id; [JsonPropertyName("_id")] - public string? Id { get; set; } + public string? Id + { + get => _id; + set => _id = string.Intern(value); + } [JsonPropertyName("items")] public List? Items { get; set; } @@ -18,8 +23,13 @@ public record RagfairOffer [JsonPropertyName("requirements")] public List? Requirements { get; set; } + private string? _root; [JsonPropertyName("root")] - public string? Root { get; set; } + public string? Root + { + get => _root; + set => _root = string.Intern(value); + } [JsonPropertyName("intId")] public int? InternalId { get; set; } @@ -69,8 +79,13 @@ public record RagfairOffer public record OfferRequirement { + private string? _tpl; [JsonPropertyName("_tpl")] - public string? Template { get; set; } + public string? Template + { + get => _tpl; + set => _tpl = string.Intern(value); + } [JsonPropertyName("count")] public double? Count { get; set; } @@ -87,8 +102,13 @@ public record OfferRequirement public record RagfairOfferUser { + private string? _id; [JsonPropertyName("id")] - public string? Id { get; set; } + public string? Id + { + get => _id; + set => _id = string.Intern(value); + } [JsonPropertyName("nickname")] public string? Nickname { get; set; }