using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; using RadicadeServer.RecNet.Enums.Players.Avatar; using RadicadeServer.RecNet.Enums.Store; using RadicadeServer.Radicade.Gifts.Enums; namespace RadicadeServer.RecNet.Avatar { public class Gift { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public long GiftDropId { get; set; } public long ItemSetId { get; set; } = 0; public string ItemSetFriendlyName { get; set; } = string.Empty; public string FriendlyName { get; set; } = string.Empty; public string Tooltip { get; set; } = string.Empty; public bool IsQuery { get; set; } = false; public bool Unique { get; set; } = false; public bool SubscribersOnly { get; set; } = false; public string ConsumableItemDesc { get; set; } = string.Empty; public string AvatarItemDesc { get; set; } = string.Empty; public AvatarItemType AvatarItemType { get; set; } public string EquipmentPrefabName { get; set; } = string.Empty; public string EquipmentModificationGuid { get; set; } = string.Empty; public CurrencyType CurrencyType { get; set; } = CurrencyType.RecCenterTokens; public int Currency { get; set; } = 0; public int Xp { get; set; } = 0; public int Platform { get; set; } = 0; public int PlatformsToSpawnOn { get; set; } = 0; public long FromPlayerId { get; set; } = 0; public int? BalanceType { get; set; } = null; public RadicadeServer.RecNet.Enums.Store.GiftContext Context { get; set; } = RadicadeServer.RecNet.Enums.Store.GiftContext.Commerce_Purchase; public Rarity Rarity { get; set; } = Rarity.Common; [JsonIgnore] public bool IsFeatured { get; set; } [JsonIgnore] public ItemAccessibility Accessibility { get; set; } = ItemAccessibility.Purchasable; [System.Text.Json.Serialization.JsonPropertyName("Id")] [Newtonsoft.Json.JsonProperty("Id")] [System.ComponentModel.DataAnnotations.Schema.NotMapped] public long Id { get => GiftDropId; set => GiftDropId = value; } [System.Text.Json.Serialization.JsonPropertyName("Message")] [Newtonsoft.Json.JsonProperty("Message")] [System.ComponentModel.DataAnnotations.Schema.NotMapped] public string Message { get => Tooltip; set => Tooltip = value ?? string.Empty; } [System.Text.Json.Serialization.JsonPropertyName("GiftRarity")] [Newtonsoft.Json.JsonProperty("GiftRarity")] [System.ComponentModel.DataAnnotations.Schema.NotMapped] public int GiftRarity { get => (int)Rarity; set => Rarity = (Rarity)value; } [System.Text.Json.Serialization.JsonPropertyName("GiftContext")] [Newtonsoft.Json.JsonProperty("GiftContext")] [System.ComponentModel.DataAnnotations.Schema.NotMapped] public int GiftContext { get => (int)Context; set => Context = (RadicadeServer.RecNet.Enums.Store.GiftContext)value; } [System.Text.Json.Serialization.JsonPropertyName("GiftPackageId")] [Newtonsoft.Json.JsonProperty("GiftPackageId")] [System.ComponentModel.DataAnnotations.Schema.NotMapped] public long GiftPackageId { get => GiftDropId; set => GiftDropId = value; } public Gift Clone() => (Gift)MemberwiseClone(); public Gift ForClient() { var copy = (Gift)MemberwiseClone(); copy.ConsumableItemDesc = ConsumableCatalog.ToClientDesc(ConsumableItemDesc); copy.Platform = -1; copy.PlatformsToSpawnOn = -1; return copy; } } }