diff --git a/MarketService.Response/Interface/IItemProductSchema.cs b/MarketService.Response/Interface/IItemProductSchema.cs index 5465679..5964af3 100644 --- a/MarketService.Response/Interface/IItemProductSchema.cs +++ b/MarketService.Response/Interface/IItemProductSchema.cs @@ -7,6 +7,7 @@ namespace MarketService.Response.Interface; public interface IItemProductSchema : IProductSchema { public int ItemId { get; set; } + public int IconId { get; set; } public int Grade { get; set; } public ItemType ItemType { get; set; } public ItemSubType ItemSubType { get; set; } @@ -19,4 +20,8 @@ public interface IItemProductSchema : IProductSchema public ICollection SkillModels { get; } public ICollection StatModels { get; } public int OptionCountFromCombination { get; set; } + + // Custom Crafted Equipment + public bool ByCustomCraft { get; set; } + public bool HasRandomOnlyIcon { get; set; } } diff --git a/MarketService.Response/ItemProductResponseModel.cs b/MarketService.Response/ItemProductResponseModel.cs index 5c41419..6e642c3 100644 --- a/MarketService.Response/ItemProductResponseModel.cs +++ b/MarketService.Response/ItemProductResponseModel.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using Libplanet; using Libplanet.Crypto; using MarketService.Response.Interface; using Nekoyume.Model.Elemental; @@ -20,6 +19,7 @@ public class ItemProductResponseModel : IItemProductSchema public bool Exist { get; set; } public bool Legacy { get; set; } public int ItemId { get; set; } + public int IconId { get; set; } public int Grade { get; set; } public ItemType ItemType { get; set; } public ItemSubType ItemSubType { get; set; } @@ -34,5 +34,9 @@ public class ItemProductResponseModel : IItemProductSchema public decimal UnitPrice { get; set; } public int Crystal { get; set; } public int CrystalPerPrice { get; set; } + + // CustomCraft + public bool ByCustomCraft { get; set; } + public bool HasRandomOnlyIcon { get; set; } } -} +} \ No newline at end of file diff --git a/MarketService.Tests/RpcClientTest.cs b/MarketService.Tests/RpcClientTest.cs index a565771..052bda7 100644 --- a/MarketService.Tests/RpcClientTest.cs +++ b/MarketService.Tests/RpcClientTest.cs @@ -13,8 +13,6 @@ using Libplanet.Types.Assets; using Libplanet.Mocks; using Libplanet.Types.Blocks; -using Libplanet.Types.Evidence; -using Libplanet.Types.Tx; using MagicOnion; using MagicOnion.Server; using MarketService.Models; @@ -328,7 +326,7 @@ public RpcClientTest(ITestOutputHelper output) new DbContextOptionsBuilder().UseNpgsql(_connectionString) .UseLowerCaseNamingConvention().Options, new DbContextFactorySource()); #pragma warning restore EF1001 - var rpcConfigOptions = new RpcConfigOptions {Host = "localhost", Port = 5000}; + var rpcConfigOptions = new RpcConfigOptions { Host = "localhost", Port = 5000 }; var receiver = new Receiver(new Logger(new LoggerFactory())); using var logger = _output.BuildLoggerFor(); _client = new TestClient(new OptionsWrapper(rpcConfigOptions), @@ -365,7 +363,7 @@ public async Task SyncOrder_Cancel(ItemSubType itemSubType) tradableItem = ItemFactory.CreateCostume(row, order.TradableId); } - item = (ItemBase) tradableItem; + item = (ItemBase)tradableItem; var blockIndex = ActionObsoleteConfig.V100080ObsoleteIndex + 1L; var orderDigest = new OrderDigest( @@ -429,7 +427,7 @@ public async Task SyncOrder_ReRegister(ItemSubType itemSubType) itemSubType, 1); _testService.SetOrder(order); var item = ItemFactory.CreateItemUsable(_row, order.TradableId, 0L); - ((Equipment) item).optionCountFromCombination = 1; + ((Equipment)item).optionCountFromCombination = 1; var blockIndex = ActionObsoleteConfig.V100080ObsoleteIndex + 1L; var orderDigest = new OrderDigest( agentAddress, @@ -496,8 +494,11 @@ await _client.SyncOrder(null!, _crystalEquipmentGrindingSheet, Assert.True(newProduct.Exist); } - [Fact] - public async Task SyncProduct() + [Theory] + [InlineData(10151000, false, false)] + [InlineData(10151000, true, false)] + [InlineData(10120000, true, true)] + public async Task SyncProduct(int iconId, bool byCustomCraft, bool hasRandomOnlyIcon) { var ct = new CancellationToken(); #pragma warning disable EF1001 @@ -517,7 +518,11 @@ public async Task SyncProduct() { var tradableId = Guid.NewGuid(); var productId = Guid.NewGuid(); - var item = ItemFactory.CreateItemUsable(_row, tradableId, 1L, i + 1); + var item = (Equipment)ItemFactory.CreateItemUsable(_row, tradableId, 1L, i + 1); + item.IconId = iconId; + item.ByCustomCraft = byCustomCraft; + item.HasRandomOnlyIcon = hasRandomOnlyIcon; + var itemProduct = new ItemProduct { ProductId = productId, @@ -553,6 +558,10 @@ await _client.SyncProduct(null!, _crystalEquipmentGrindingSheet, _crystalMonster Assert.True(itemProduct.CombatPoint > 0); Assert.True(itemProduct.Level > 0); Assert.Equal(1, itemProduct.Grade); + // If item does not have IconId, IconId is same as ItemId + Assert.Equal(iconId, itemProduct.IconId); + Assert.Equal(byCustomCraft, itemProduct.ByCustomCraft); + Assert.Equal(hasRandomOnlyIcon, itemProduct.HasRandomOnlyIcon); } } @@ -876,8 +885,9 @@ private void SetShopStates(ItemSubType itemSubType, OrderDigest orderDigest) { shopState.Add(orderDigest, 0L); } + _testService.SetState(shopAddress, shopState.Serialize()); } } } -} +} \ No newline at end of file diff --git a/MarketService/Migrations/20240904015056_AddIconId.Designer.cs b/MarketService/Migrations/20240904015056_AddIconId.Designer.cs new file mode 100644 index 0000000..aa9efbe --- /dev/null +++ b/MarketService/Migrations/20240904015056_AddIconId.Designer.cs @@ -0,0 +1,277 @@ +// +using System; +using MarketService; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace MarketService.Migrations +{ + [DbContext(typeof(MarketContext))] + [Migration("20240904015056_AddIconId")] + partial class AddIconId + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("MarketService.Models.ProductModel", b => + { + b.Property("ProductId") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("productid"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasColumnName("createdat"); + + b.Property("Exist") + .HasColumnType("boolean") + .HasColumnName("exist"); + + b.Property("Legacy") + .HasColumnType("boolean") + .HasColumnName("legacy"); + + b.Property("Price") + .HasColumnType("numeric") + .HasColumnName("price"); + + b.Property("Quantity") + .HasColumnType("numeric") + .HasColumnName("quantity"); + + b.Property("RegisteredBlockIndex") + .HasColumnType("bigint") + .HasColumnName("registeredblockindex"); + + b.Property("SellerAgentAddress") + .IsRequired() + .HasColumnType("text") + .HasColumnName("selleragentaddress"); + + b.Property("SellerAvatarAddress") + .IsRequired() + .HasColumnType("text") + .HasColumnName("selleravataraddress"); + + b.Property("UnitPrice") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)") + .HasColumnName("unitprice"); + + b.Property("product_type") + .IsRequired() + .HasColumnType("text") + .HasColumnName("product_type"); + + b.HasKey("ProductId") + .HasName("pk_products"); + + b.HasIndex("Exist") + .HasDatabaseName("ix_products_exist"); + + b.ToTable("products", (string)null); + + b.HasDiscriminator("product_type").HasValue("ProductModel"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("MarketService.Models.FungibleAssetValueProductModel", b => + { + b.HasBaseType("MarketService.Models.ProductModel"); + + b.Property("DecimalPlaces") + .HasColumnType("smallint") + .HasColumnName("decimalplaces"); + + b.Property("Ticker") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ticker"); + + b.HasDiscriminator().HasValue("fav"); + }); + + modelBuilder.Entity("MarketService.Models.ItemProductModel", b => + { + b.HasBaseType("MarketService.Models.ProductModel"); + + b.Property("CombatPoint") + .HasColumnType("integer") + .HasColumnName("combatpoint"); + + b.Property("Crystal") + .HasColumnType("integer") + .HasColumnName("crystal"); + + b.Property("CrystalPerPrice") + .HasColumnType("integer") + .HasColumnName("crystalperprice"); + + b.Property("ElementalType") + .HasColumnType("integer") + .HasColumnName("elementaltype"); + + b.Property("Grade") + .HasColumnType("integer") + .HasColumnName("grade"); + + b.Property("IconId") + .HasColumnType("integer") + .HasColumnName("iconid"); + + b.Property("ItemId") + .HasColumnType("integer") + .HasColumnName("itemid"); + + b.Property("ItemSubType") + .HasColumnType("integer") + .HasColumnName("itemsubtype"); + + b.Property("ItemType") + .HasColumnType("integer") + .HasColumnName("itemtype"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("OptionCountFromCombination") + .HasColumnType("integer") + .HasColumnName("optioncountfromcombination"); + + b.Property("SetId") + .HasColumnType("integer") + .HasColumnName("setid"); + + b.Property("TradableId") + .HasColumnType("uuid") + .HasColumnName("tradableid"); + + b.HasDiscriminator().HasValue("item"); + }); + + modelBuilder.Entity("MarketService.Models.ItemProductModel", b => + { + b.OwnsMany("MarketService.Models.SkillModel", "Skills", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("Chance") + .HasColumnType("integer") + .HasColumnName("chance"); + + b1.Property("Cooldown") + .HasColumnType("integer") + .HasColumnName("cooldown"); + + b1.Property("ElementalType") + .HasColumnType("integer") + .HasColumnName("elementaltype"); + + b1.Property("HitCount") + .HasColumnType("integer") + .HasColumnName("hitcount"); + + b1.Property("Power") + .HasColumnType("bigint") + .HasColumnName("power"); + + b1.Property("ProductId") + .HasColumnType("uuid") + .HasColumnName("productid"); + + b1.Property("ReferencedStatType") + .HasColumnType("integer") + .HasColumnName("referencedstattype"); + + b1.Property("SkillCategory") + .HasColumnType("integer") + .HasColumnName("skillcategory"); + + b1.Property("SkillId") + .HasColumnType("integer") + .HasColumnName("skillid"); + + b1.Property("StatPowerRatio") + .HasColumnType("integer") + .HasColumnName("statpowerratio"); + + b1.HasKey("Id") + .HasName("pk_skillmodel"); + + b1.HasIndex("ProductId") + .HasDatabaseName("ix_skillmodel_productid"); + + b1.ToTable("skillmodel", (string)null); + + b1.WithOwner() + .HasForeignKey("ProductId") + .HasConstraintName("fk_skillmodel_products_itemproductmodelproductid"); + }); + + b.OwnsMany("MarketService.Models.StatModel", "Stats", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("Additional") + .HasColumnType("boolean") + .HasColumnName("additional"); + + b1.Property("ProductId") + .HasColumnType("uuid") + .HasColumnName("productid"); + + b1.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b1.Property("Value") + .HasColumnType("bigint") + .HasColumnName("value"); + + b1.HasKey("Id") + .HasName("pk_statmodel"); + + b1.HasIndex("ProductId") + .HasDatabaseName("ix_statmodel_productid"); + + b1.ToTable("statmodel", (string)null); + + b1.WithOwner() + .HasForeignKey("ProductId") + .HasConstraintName("fk_statmodel_products_itemproductmodelproductid"); + }); + + b.Navigation("Skills"); + + b.Navigation("Stats"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/MarketService/Migrations/20240904015056_AddIconId.cs b/MarketService/Migrations/20240904015056_AddIconId.cs new file mode 100644 index 0000000..c3e75f2 --- /dev/null +++ b/MarketService/Migrations/20240904015056_AddIconId.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace MarketService.Migrations +{ + /// + public partial class AddIconId : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "iconid", + table: "products", + type: "integer", + nullable: true + ); + + migrationBuilder.Sql("UPDATE products SET iconid=itemid"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "iconid", + table: "products"); + } + } +} diff --git a/MarketService/Migrations/20240904131328_CustomCraft.Designer.cs b/MarketService/Migrations/20240904131328_CustomCraft.Designer.cs new file mode 100644 index 0000000..e2d6ee6 --- /dev/null +++ b/MarketService/Migrations/20240904131328_CustomCraft.Designer.cs @@ -0,0 +1,285 @@ +// +using System; +using MarketService; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace MarketService.Migrations +{ + [DbContext(typeof(MarketContext))] + [Migration("20240904131328_CustomCraft")] + partial class CustomCraft + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("MarketService.Models.ProductModel", b => + { + b.Property("ProductId") + .ValueGeneratedOnAdd() + .HasColumnType("uuid") + .HasColumnName("productid"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasColumnName("createdat"); + + b.Property("Exist") + .HasColumnType("boolean") + .HasColumnName("exist"); + + b.Property("Legacy") + .HasColumnType("boolean") + .HasColumnName("legacy"); + + b.Property("Price") + .HasColumnType("numeric") + .HasColumnName("price"); + + b.Property("Quantity") + .HasColumnType("numeric") + .HasColumnName("quantity"); + + b.Property("RegisteredBlockIndex") + .HasColumnType("bigint") + .HasColumnName("registeredblockindex"); + + b.Property("SellerAgentAddress") + .IsRequired() + .HasColumnType("text") + .HasColumnName("selleragentaddress"); + + b.Property("SellerAvatarAddress") + .IsRequired() + .HasColumnType("text") + .HasColumnName("selleravataraddress"); + + b.Property("UnitPrice") + .HasPrecision(18, 4) + .HasColumnType("numeric(18,4)") + .HasColumnName("unitprice"); + + b.Property("product_type") + .IsRequired() + .HasColumnType("text") + .HasColumnName("product_type"); + + b.HasKey("ProductId") + .HasName("pk_products"); + + b.HasIndex("Exist") + .HasDatabaseName("ix_products_exist"); + + b.ToTable("products", (string)null); + + b.HasDiscriminator("product_type").HasValue("ProductModel"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("MarketService.Models.FungibleAssetValueProductModel", b => + { + b.HasBaseType("MarketService.Models.ProductModel"); + + b.Property("DecimalPlaces") + .HasColumnType("smallint") + .HasColumnName("decimalplaces"); + + b.Property("Ticker") + .IsRequired() + .HasColumnType("text") + .HasColumnName("ticker"); + + b.HasDiscriminator().HasValue("fav"); + }); + + modelBuilder.Entity("MarketService.Models.ItemProductModel", b => + { + b.HasBaseType("MarketService.Models.ProductModel"); + + b.Property("ByCustomCraft") + .HasColumnType("boolean") + .HasColumnName("bycustomcraft"); + + b.Property("CombatPoint") + .HasColumnType("integer") + .HasColumnName("combatpoint"); + + b.Property("Crystal") + .HasColumnType("integer") + .HasColumnName("crystal"); + + b.Property("CrystalPerPrice") + .HasColumnType("integer") + .HasColumnName("crystalperprice"); + + b.Property("ElementalType") + .HasColumnType("integer") + .HasColumnName("elementaltype"); + + b.Property("Grade") + .HasColumnType("integer") + .HasColumnName("grade"); + + b.Property("HasRandomOnlyIcon") + .HasColumnType("boolean") + .HasColumnName("hasrandomonlyicon"); + + b.Property("IconId") + .HasColumnType("integer") + .HasColumnName("iconid"); + + b.Property("ItemId") + .HasColumnType("integer") + .HasColumnName("itemid"); + + b.Property("ItemSubType") + .HasColumnType("integer") + .HasColumnName("itemsubtype"); + + b.Property("ItemType") + .HasColumnType("integer") + .HasColumnName("itemtype"); + + b.Property("Level") + .HasColumnType("integer") + .HasColumnName("level"); + + b.Property("OptionCountFromCombination") + .HasColumnType("integer") + .HasColumnName("optioncountfromcombination"); + + b.Property("SetId") + .HasColumnType("integer") + .HasColumnName("setid"); + + b.Property("TradableId") + .HasColumnType("uuid") + .HasColumnName("tradableid"); + + b.HasDiscriminator().HasValue("item"); + }); + + modelBuilder.Entity("MarketService.Models.ItemProductModel", b => + { + b.OwnsMany("MarketService.Models.SkillModel", "Skills", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("Chance") + .HasColumnType("integer") + .HasColumnName("chance"); + + b1.Property("Cooldown") + .HasColumnType("integer") + .HasColumnName("cooldown"); + + b1.Property("ElementalType") + .HasColumnType("integer") + .HasColumnName("elementaltype"); + + b1.Property("HitCount") + .HasColumnType("integer") + .HasColumnName("hitcount"); + + b1.Property("Power") + .HasColumnType("bigint") + .HasColumnName("power"); + + b1.Property("ProductId") + .HasColumnType("uuid") + .HasColumnName("productid"); + + b1.Property("ReferencedStatType") + .HasColumnType("integer") + .HasColumnName("referencedstattype"); + + b1.Property("SkillCategory") + .HasColumnType("integer") + .HasColumnName("skillcategory"); + + b1.Property("SkillId") + .HasColumnType("integer") + .HasColumnName("skillid"); + + b1.Property("StatPowerRatio") + .HasColumnType("integer") + .HasColumnName("statpowerratio"); + + b1.HasKey("Id") + .HasName("pk_skillmodel"); + + b1.HasIndex("ProductId") + .HasDatabaseName("ix_skillmodel_productid"); + + b1.ToTable("skillmodel", (string)null); + + b1.WithOwner() + .HasForeignKey("ProductId") + .HasConstraintName("fk_skillmodel_products_itemproductmodelproductid"); + }); + + b.OwnsMany("MarketService.Models.StatModel", "Stats", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); + + b1.Property("Additional") + .HasColumnType("boolean") + .HasColumnName("additional"); + + b1.Property("ProductId") + .HasColumnType("uuid") + .HasColumnName("productid"); + + b1.Property("Type") + .HasColumnType("integer") + .HasColumnName("type"); + + b1.Property("Value") + .HasColumnType("bigint") + .HasColumnName("value"); + + b1.HasKey("Id") + .HasName("pk_statmodel"); + + b1.HasIndex("ProductId") + .HasDatabaseName("ix_statmodel_productid"); + + b1.ToTable("statmodel", (string)null); + + b1.WithOwner() + .HasForeignKey("ProductId") + .HasConstraintName("fk_statmodel_products_itemproductmodelproductid"); + }); + + b.Navigation("Skills"); + + b.Navigation("Stats"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/MarketService/Migrations/20240904131328_CustomCraft.cs b/MarketService/Migrations/20240904131328_CustomCraft.cs new file mode 100644 index 0000000..81064e6 --- /dev/null +++ b/MarketService/Migrations/20240904131328_CustomCraft.cs @@ -0,0 +1,41 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace MarketService.Migrations +{ + /// + public partial class CustomCraft : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "bycustomcraft", + table: "products", + type: "boolean", + nullable: true); + + migrationBuilder.AddColumn( + name: "hasrandomonlyicon", + table: "products", + type: "boolean", + nullable: true); + + migrationBuilder.Sql("UPDATE products SET bycustomcraft = FALSE WHERE product_type = 'item'"); + migrationBuilder.Sql("UPDATE products SET hasrandomonlyicon = FALSE where product_type = 'item'"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "bycustomcraft", + table: "products"); + + migrationBuilder.DropColumn( + name: "hasrandomonlyicon", + table: "products"); + } + } +} diff --git a/MarketService/Migrations/MarketContextModelSnapshot.cs b/MarketService/Migrations/MarketContextModelSnapshot.cs index 0ca6d69..4f4b3cf 100644 --- a/MarketService/Migrations/MarketContextModelSnapshot.cs +++ b/MarketService/Migrations/MarketContextModelSnapshot.cs @@ -107,6 +107,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("MarketService.Models.ProductModel"); + b.Property("ByCustomCraft") + .HasColumnType("boolean") + .HasColumnName("bycustomcraft"); + b.Property("CombatPoint") .HasColumnType("integer") .HasColumnName("combatpoint"); @@ -127,6 +131,14 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("integer") .HasColumnName("grade"); + b.Property("HasRandomOnlyIcon") + .HasColumnType("boolean") + .HasColumnName("hasrandomonlyicon"); + + b.Property("IconId") + .HasColumnType("integer") + .HasColumnName("iconid"); + b.Property("ItemId") .HasColumnType("integer") .HasColumnName("itemid"); diff --git a/MarketService/Models/ItemProductModel.cs b/MarketService/Models/ItemProductModel.cs index d3065f1..7d6979c 100644 --- a/MarketService/Models/ItemProductModel.cs +++ b/MarketService/Models/ItemProductModel.cs @@ -15,6 +15,7 @@ namespace MarketService.Models; public class ItemProductModel : ProductModel, IItemProductModel { public int ItemId { get; set; } + public int IconId { get; set; } public int Grade { get; set; } public ItemType ItemType { get; set; } public ItemSubType ItemSubType { get; set; } @@ -32,6 +33,9 @@ public class ItemProductModel : ProductModel, IItemProductModel [NotMapped] public ICollection StatModels => Stats.Select(s => s.ToResponse()).ToList(); + public bool ByCustomCraft { get; set; } + public bool HasRandomOnlyIcon { get; set; } + public int OptionCountFromCombination { get; set; } public ItemProductResponseModel ToResponse() @@ -47,6 +51,7 @@ public ItemProductResponseModel ToResponse() Exist = Exist, Legacy = Legacy, ItemId = ItemId, + IconId = IconId, Grade = Grade, ItemType = ItemType, ItemSubType = ItemSubType, @@ -61,6 +66,8 @@ public ItemProductResponseModel ToResponse() CrystalPerPrice = CrystalPerPrice, OptionCountFromCombination = OptionCountFromCombination, UnitPrice = UnitPrice, + ByCustomCraft = ByCustomCraft, + HasRandomOnlyIcon = HasRandomOnlyIcon, }; } @@ -100,6 +107,9 @@ public void Update(ITradableItem tradableItem, FungibleAssetValue price, Costume { SetId = equipment.SetId; Level = equipment.level; + IconId = equipment.IconId; + ByCustomCraft = equipment.ByCustomCraft; + HasRandomOnlyIcon = equipment.HasRandomOnlyIcon; OptionCountFromCombination = equipment.optionCountFromCombination; var skillModels = new List(); skillModels.AddRange(equipment.Skills.Select(s => new SkillModel diff --git a/MarketService/RpcClient.cs b/MarketService/RpcClient.cs index 7a3e71c..af748f5 100644 --- a/MarketService/RpcClient.cs +++ b/MarketService/RpcClient.cs @@ -207,7 +207,8 @@ public async Task SyncOrder(byte[] hashBytes, ItemSubType.EarCostume, ItemSubType.EyeCostume, ItemSubType.TailCostume, - ItemSubType.Title + ItemSubType.Title, + // Currently shop is not managed by "order", so don't need to add new types in here }; var agentAddresses = new ConcurrentBag
(); @@ -364,6 +365,7 @@ public async Task InsertOrders(byte[] hashBytes, List orderIds, List Exist = true, Legacy = true, }; + itemProduct.Update(item, orderDigest.Price, costumeStatSheet, crystalEquipmentGrindingSheet, crystalMonsterCollectionMultiplierSheet); productBag.Add(itemProduct); @@ -758,4 +760,4 @@ public async Task> GetOrderDigests(List
avatarAddress }); return orderDigests.ToList(); } -} +} \ No newline at end of file diff --git a/lib9c b/lib9c index 776c911..bbe9200 160000 --- a/lib9c +++ b/lib9c @@ -1 +1 @@ -Subproject commit 776c9113f7fd8f99b5645222d45b57dd7ad2cb82 +Subproject commit bbe92005e00028e0caac21040c95eb49d99baade