-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from planetarium/expand-inventory-item-properties
Expand inventory item properties
- Loading branch information
Showing
8 changed files
with
120 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using MongoDB.Bson; | ||
|
||
namespace Mimir.Models.Items; | ||
|
||
public class Consumable : Item | ||
{ | ||
public Consumable(Nekoyume.Model.Item.Consumable consumable) : | ||
base(consumable, count: 1) | ||
{ | ||
} | ||
|
||
public Consumable(BsonDocument consumable) : base(consumable) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using MongoDB.Bson; | ||
|
||
namespace Mimir.Models.Items; | ||
|
||
public class Costume : Item | ||
{ | ||
public Costume(Nekoyume.Model.Item.Costume costume) : | ||
base(costume, count: 1) | ||
{ | ||
} | ||
|
||
public Costume(BsonDocument costume) : base(costume) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,46 @@ | ||
using MongoDB.Bson; | ||
using Nekoyume.Model.Elemental; | ||
using Nekoyume.Model.Item; | ||
|
||
namespace Mimir.Models.Items; | ||
|
||
public class Item | ||
{ | ||
public int ItemSheetId { get; set; } | ||
public int Grade { get; set; } | ||
public ItemType ItemType { get; set; } | ||
public ItemSubType ItemSubType { get; set; } | ||
public ElementalType ElementalType { get; set; } | ||
|
||
public Item(IItem item) | ||
public int? Count { get; set; } | ||
public long? RequiredBlockIndex { get; set; } | ||
|
||
public Item(ItemBase item, int? count) | ||
{ | ||
ItemSheetId = item.Id; | ||
Grade = item.Grade; | ||
ItemType = item.ItemType; | ||
ItemSubType = item.ItemSubType; | ||
ElementalType = item.ElementalType; | ||
|
||
Count = count; | ||
RequiredBlockIndex = item switch | ||
{ | ||
INonFungibleItem nonFungibleItem => nonFungibleItem.RequiredBlockIndex, | ||
ITradableItem tradableItem => tradableItem.RequiredBlockIndex, | ||
_ => null | ||
}; | ||
} | ||
|
||
public Item(BsonValue item) | ||
public Item(BsonDocument item) | ||
{ | ||
ItemSheetId = item["ItemSheetId"].AsInt32; | ||
Grade = item["Grade"].AsInt32; | ||
ItemType = (ItemType)item["ItemType"].AsInt32; | ||
ItemSubType = (ItemSubType)item["ItemSubType"].AsInt32; | ||
ElementalType = (ElementalType)item["ElementalType"].AsInt32; | ||
|
||
Count = item["Count"].AsNullableInt32; | ||
RequiredBlockIndex = item["RequiredBlockIndex"].AsNullableInt64; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using MongoDB.Bson; | ||
|
||
namespace Mimir.Models.Items; | ||
|
||
public class Material : Item | ||
{ | ||
public Material(Nekoyume.Model.Item.Material material, int count) : | ||
base(material, count) | ||
{ | ||
} | ||
|
||
public Material(BsonDocument material) : base(material) | ||
{ | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters