feat: add inventory/item data

This commit is contained in:
Timothy Schenk 2023-11-08 15:33:04 +01:00
parent 85aaec2371
commit f6c2f4d2b6
5 changed files with 39 additions and 3 deletions

View file

@ -14,4 +14,5 @@ public class Character
public Gender Gender { get; set; } public Gender Gender { get; set; }
public long Experience { get; set; } public long Experience { get; set; }
public byte Level { get; set; } public byte Level { get; set; }
public ICollection<InventoryItem> InventoryItems { get; set; }
} }

View file

@ -0,0 +1,20 @@
namespace Server.DB.Documents;
public class InventoryItem
{
public Guid CharacterId { get; set; }
public Character Character { get; set; }
public Guid Id { get; set; }
public short ItemId { get; set; }
public ushort Count { get; set; }
public byte Slot { get; set; }
public ItemType ItemType { get; set; }
public byte Level { get; set; }
public byte Rarity { get; set; }
public byte AddOption { get; set; }
public byte AddOption2 { get; set; }
public byte AddOption3 { get; set; }
public short Option { get; set; }
public short Option2 { get; set; }
public short Option3 { get; set; }
}

View file

@ -0,0 +1,12 @@
namespace Server.DB.Documents;
public enum ItemType : byte
{
WornEquipment = 0,
WornCashEquipment = 1,
Equipment = 2,
Etc = 3,
Cash = 4,
Warehouse = 5,
GiftBox = 6
}

View file

@ -32,10 +32,13 @@ public class WonderkingContext : DbContext
builder.Property(b => b.Password).HasColumnType("bytea"); builder.Property(b => b.Password).HasColumnType("bytea");
builder.Property(b => b.Salt).HasColumnType("bytea"); builder.Property(b => b.Salt).HasColumnType("bytea");
builder.HasKey(b => b.Id); builder.HasKey(b => b.Id);
builder.HasMany(e => e.Characters).WithOne(e => e.Account).HasForeignKey(e => e.AccountId).IsRequired(); builder.HasMany(e => e.Characters).WithOne(e => e.Account).HasForeignKey(e => e.AccountId)
.IsRequired();
}).Entity<Character>(builder => }).Entity<Character>(builder =>
{ {
builder.HasKey(c => c.Id); builder.HasKey(c => c.Id);
builder.Property(c => c.Name).HasColumnType("varchar(20)"); builder.Property(c => c.Name).HasColumnType("varchar(20)");
}); builder.HasMany(e => e.InventoryItems).WithOne(e => e.Character)
.HasForeignKey(e => e.CharacterId).IsRequired();
}).Entity<InventoryItem>(builder => { builder.HasKey(i => i.Id); });
} }

View file

@ -13,7 +13,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="JetBrains.Annotations" Version="2023.2.0" /> <PackageReference Include="JetBrains.Annotations" Version="2023.2.0" />
<PackageReference Include="Meziantou.Analyzer" Version="2.0.104"> <PackageReference Include="Meziantou.Analyzer" Version="2.0.105">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>