diff --git a/Mimir/Models/Items/Equipment.cs b/Mimir/Models/Items/Equipment.cs index 7028c726..9619b1fb 100644 --- a/Mimir/Models/Items/Equipment.cs +++ b/Mimir/Models/Items/Equipment.cs @@ -4,19 +4,16 @@ namespace Mimir.Models.Items; public class Equipment : Item { - public Guid NonFungibleId { get; set; } public int Level { get; set; } public Equipment(Nekoyume.Model.Item.Equipment equipment) : base(equipment, count: 1) { - NonFungibleId = equipment.NonFungibleId; Level = equipment.level; } public Equipment(BsonDocument equipment) : base(equipment) { - NonFungibleId = Guid.Parse(equipment["NonFungibleId"].AsString); Level = equipment["level"].AsInt32; } } diff --git a/Mimir/Models/Items/Item.cs b/Mimir/Models/Items/Item.cs index c7bec736..fcc51367 100644 --- a/Mimir/Models/Items/Item.cs +++ b/Mimir/Models/Items/Item.cs @@ -12,10 +12,12 @@ public class Item public ItemSubType ItemSubType { get; set; } public ElementalType ElementalType { get; set; } - public int? Count { get; set; } + public int Count { get; set; } + + public Guid? NonFungibleId { get; set; } public long? RequiredBlockIndex { get; set; } - public Item(ItemBase item, int? count) + public Item(ItemBase item, int count) { ItemSheetId = item.Id; Grade = item.Grade; @@ -24,10 +26,14 @@ public Item(ItemBase item, int? count) ElementalType = item.ElementalType; Count = count; + + NonFungibleId = item is INonFungibleItem nonFungibleItem + ? nonFungibleItem.NonFungibleId + : null; RequiredBlockIndex = item switch { - INonFungibleItem nonFungibleItem => nonFungibleItem.RequiredBlockIndex, - ITradableItem tradableItem => tradableItem.RequiredBlockIndex, + INonFungibleItem nfi => nfi.RequiredBlockIndex, + ITradableItem ti => ti.RequiredBlockIndex, _ => null }; } @@ -40,7 +46,9 @@ public Item(BsonDocument item) ItemSubType = (ItemSubType)item["ItemSubType"].AsInt32; ElementalType = (ElementalType)item["ElementalType"].AsInt32; - Count = item["Count"].AsNullableInt32; + Count = item["Count"].AsInt32; + + NonFungibleId = item["NonFungibleId"].AsNullableGuid; RequiredBlockIndex = item["RequiredBlockIndex"].AsNullableInt64; } }