Working on Networking

This commit is contained in:
dingo
2025-11-07 09:03:02 -05:00
parent 6c4ba9b568
commit 28f7c83b64
24 changed files with 2023 additions and 20 deletions
+33
View File
@@ -0,0 +1,33 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Server.Data;
public sealed class ItemTemplate
{
public ulong Id { get; set; }
public string Name { get; set; } = "";
public byte ItemType { get; set; } = 1;
public byte Rarity { get; set; } = 1;
public uint MaxStack { get; set; } = 1;
public uint Weight { get; set; } = 0;
public string? StatsJson { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
public sealed class ItemTemplateConfig : IEntityTypeConfiguration<ItemTemplate>
{
public void Configure(EntityTypeBuilder<ItemTemplate> e)
{
e.ToTable("item_templates");
e.HasKey(x => x.Id);
e.Property(x => x.Id).ValueGeneratedOnAdd();
e.Property(x => x.Name).HasMaxLength(64).IsRequired();
e.HasIndex(x => x.Name).IsUnique();
e.Property(x => x.StatsJson).HasColumnType("json");
e.Property(x => x.CreatedAt).HasDefaultValueSql("CURRENT_TIMESTAMP(6)");
e.Property(x => x.UpdatedAt).HasDefaultValueSql("CURRENT_TIMESTAMP(6)")
.ValueGeneratedOnAddOrUpdate();
}
}