Skip to content

Commit

Permalink
handle Costume
Browse files Browse the repository at this point in the history
  • Loading branch information
boscohyun committed Sep 25, 2024
1 parent ef1f00c commit 56140d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Lib9c.Models/Items/Costume.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace Lib9c.Models.Items;
/// </summary>
public record Costume : ItemBase
{
public bool Equipped { get; }
public string SpineResourcePath { get; }
public Guid ItemId { get; }
public long RequiredBlockIndex { get; }
public bool Equipped { get; init; }
public string SpineResourcePath { get; init; }
public Guid ItemId { get; init; }
public long RequiredBlockIndex { get; init; }

[BsonIgnore, GraphQLIgnore]
public override IValue Bencoded
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Lib9c.Models.Items;
using Mimir.MongoDB.Bson.Extensions;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
Expand All @@ -11,6 +12,15 @@ public class CostumeSerializer : ClassSerializerBase<Costume>

public static Costume Deserialize(BsonDocument doc) => new()
{
Id = doc["Id"].AsInt32,
Grade = doc["Grade"].AsInt32,
ItemType = (Nekoyume.Model.Item.ItemType)doc["ItemType"].AsInt32,
ItemSubType = (Nekoyume.Model.Item.ItemSubType)doc["ItemSubType"].AsInt32,
ElementalType = (Nekoyume.Model.Elemental.ElementalType)doc["ElementalType"].AsInt32,
Equipped = doc["Equipped"].AsBoolean,
SpineResourcePath = doc["SpineResourcePath"].AsString,
ItemId = doc["ItemId"].AsGuid,
RequiredBlockIndex = doc["RequiredBlockIndex"].ToLong(),
};

public override Costume Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
Expand Down

0 comments on commit 56140d0

Please sign in to comment.