diff --git a/Migrations/20251228033248_RecreateMissingTables.Designer.cs b/Migrations/20251228033248_RecreateMissingTables.Designer.cs new file mode 100644 index 0000000..b1650a2 --- /dev/null +++ b/Migrations/20251228033248_RecreateMissingTables.Designer.cs @@ -0,0 +1,2384 @@ +// +using System; +using DataServer.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + [DbContext(typeof(GameDbContext))] + [Migration("20251228033248_RecreateMissingTables")] + partial class RecreateMissingTables + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("DataServer.Data.Account", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BannedUntil") + .HasColumnType("datetime(6)"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("Email") + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("IsBanned") + .HasColumnType("tinyint(1)"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("varbinary(64)"); + + b.Property("PasswordSalt") + .IsRequired() + .HasColumnType("varbinary(32)"); + + b.Property("Role") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.Property("Username") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.HasKey("Id"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("Username") + .IsUnique(); + + b.ToTable("accounts", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Entities.ClientAsset", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AssetType") + .HasColumnType("int"); + + b.Property("CdnPath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FileHash") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("FilePath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("FileSize") + .HasColumnType("bigint"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsRequired") + .HasColumnType("tinyint(1)"); + + b.Property("MinClientVersion") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("client_assets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DamageResistanceType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Color") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IconPath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("damage_resistance_types"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DungeonInstanceId") + .HasColumnType("char(36)"); + + b.Property("EmptiedAt") + .HasColumnType("datetime(6)"); + + b.Property("GoldAmount") + .HasColumnType("bigint"); + + b.Property("IsEmpty") + .HasColumnType("tinyint(1)"); + + b.Property("OwnerCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("VictimCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("VictimMobDefinitionId") + .HasColumnType("int"); + + b.Property("X") + .HasColumnType("float"); + + b.Property("Y") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("OwnerCharacterId"); + + b.HasIndex("VictimCharacterId"); + + b.ToTable("dungeon_death_chests"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChestItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DeathChestId") + .HasColumnType("bigint unsigned"); + + b.Property("IsTaken") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.Property("TakenAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("DeathChestId"); + + b.HasIndex("ItemDefinitionId"); + + b.ToTable("dungeon_death_chest_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonBeltItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("InventorySlotIndex") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.ToTable("dungeon_belt_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("BossesKilled") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CurrentHealth") + .HasColumnType("int"); + + b.Property("CurrentMana") + .HasColumnType("int"); + + b.Property("Dexterity") + .HasColumnType("int"); + + b.Property("DungeonsCompleted") + .HasColumnType("int"); + + b.Property("Endurance") + .HasColumnType("int"); + + b.Property("EquippedAccessory") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedBoots") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedChest") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedGloves") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedHead") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedLegs") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedOffhand") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedWeapon") + .HasColumnType("bigint unsigned"); + + b.Property("Experience") + .HasColumnType("bigint"); + + b.Property("Gold") + .HasColumnType("bigint"); + + b.Property("Intelligence") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastPlayedAt") + .HasColumnType("datetime(6)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("PlayersKilled") + .HasColumnType("int"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Strength") + .HasColumnType("int"); + + b.Property("TotalDeaths") + .HasColumnType("int"); + + b.Property("TotalKills") + .HasColumnType("int"); + + b.Property("UnspentStatPoints") + .HasColumnType("int"); + + b.Property("Wisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.ToTable("dungeon_characters"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterCraftingSkill", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("Experience") + .HasColumnType("bigint"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("SkillType") + .HasColumnType("int"); + + b.Property("TotalItemsCrafted") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.ToTable("dungeon_character_crafting_skills"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AcquiredAt") + .HasColumnType("datetime(6)"); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("EquipSlot") + .HasColumnType("int"); + + b.Property("IsEquipped") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("ItemDefinitionId"); + + b.ToTable("dungeon_character_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItemCraftedLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterItemId") + .HasColumnType("bigint unsigned"); + + b.Property("CraftedItemId") + .HasColumnType("bigint unsigned"); + + b.HasKey("Id"); + + b.HasIndex("CharacterItemId"); + + b.HasIndex("CraftedItemId"); + + b.ToTable("dungeon_character_item_crafted_link"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterKnownRecipe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DiscoveredAt") + .HasColumnType("datetime(6)"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("TimesCrafted") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_character_known_recipes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftedItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BaseItemDefinitionId") + .HasColumnType("int"); + + b.Property("CraftedAt") + .HasColumnType("datetime(6)"); + + b.Property("CrafterId") + .HasColumnType("bigint unsigned"); + + b.Property("CrafterName") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CraftingLevelAtCreation") + .HasColumnType("int"); + + b.Property("CustomName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("QualityRating") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("RollHistoryJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RolledBonusArmor") + .HasColumnType("int"); + + b.Property("RolledBonusDexterity") + .HasColumnType("int"); + + b.Property("RolledBonusEndurance") + .HasColumnType("int"); + + b.Property("RolledBonusHealAmount") + .HasColumnType("int"); + + b.Property("RolledBonusHealth") + .HasColumnType("int"); + + b.Property("RolledBonusIntelligence") + .HasColumnType("int"); + + b.Property("RolledBonusMagicResist") + .HasColumnType("int"); + + b.Property("RolledBonusMana") + .HasColumnType("int"); + + b.Property("RolledBonusManaRestore") + .HasColumnType("int"); + + b.Property("RolledBonusMaxDamage") + .HasColumnType("int"); + + b.Property("RolledBonusMinDamage") + .HasColumnType("int"); + + b.Property("RolledBonusStrength") + .HasColumnType("int"); + + b.Property("RolledBonusWisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("BaseItemDefinitionId"); + + b.HasIndex("CrafterId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_crafted_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BaseXp") + .HasColumnType("int"); + + b.Property("BonusOutputChanceAtMinLevel") + .HasColumnType("float"); + + b.Property("BonusOutputItemDefinitionId") + .HasColumnType("int"); + + b.Property("BonusOutputMaxLevel") + .HasColumnType("int"); + + b.Property("BonusOutputMinLevel") + .HasColumnType("int"); + + b.Property("BonusOutputQuantity") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("HasStatRolls") + .HasColumnType("tinyint(1)"); + + b.Property("IsBaseRecipe") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OutputItemDefinitionId") + .HasColumnType("int"); + + b.Property("OutputQuantity") + .HasColumnType("int"); + + b.Property("PossibleStatsJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("SkillType") + .HasColumnType("int"); + + b.Property("Tier") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OutputItemDefinitionId"); + + b.ToTable("dungeon_crafting_recipes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipeIngredient", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.Property("SlotOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_crafting_recipe_ingredients"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonItemDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Armor") + .HasColumnType("int"); + + b.Property("AttackRange") + .HasColumnType("float"); + + b.Property("BonusDexterity") + .HasColumnType("int"); + + b.Property("BonusEndurance") + .HasColumnType("int"); + + b.Property("BonusHealth") + .HasColumnType("int"); + + b.Property("BonusIntelligence") + .HasColumnType("int"); + + b.Property("BonusMana") + .HasColumnType("int"); + + b.Property("BonusStrength") + .HasColumnType("int"); + + b.Property("BonusWisdom") + .HasColumnType("int"); + + b.Property("BuffDuration") + .HasColumnType("int"); + + b.Property("BuffResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EquipSlot") + .HasColumnType("int"); + + b.Property("HealAmount") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleportScroll") + .HasColumnType("tinyint(1)"); + + b.Property("ManaRestore") + .HasColumnType("int"); + + b.Property("MaxDamage") + .HasColumnType("int"); + + b.Property("MaxStack") + .HasColumnType("int"); + + b.Property("MinDamage") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Rarity") + .HasColumnType("int"); + + b.Property("RequiredDexterity") + .HasColumnType("int"); + + b.Property("RequiredIntelligence") + .HasColumnType("int"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("RequiredStrength") + .HasColumnType("int"); + + b.Property("RequiredWisdom") + .HasColumnType("int"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Stackable") + .HasColumnType("tinyint(1)"); + + b.Property("StaminaRestore") + .HasColumnType("int"); + + b.Property("TeachesSpellId") + .HasColumnType("int"); + + b.Property("TintColor") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_item_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLearnedSpell", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DefinitionId") + .HasColumnType("int"); + + b.Property("LearnedAt") + .HasColumnType("datetime(6)"); + + b.Property("SpellDefinitionId") + .HasColumnType("int"); + + b.Property("SpellLevel") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("DefinitionId"); + + b.ToTable("dungeon_learned_spells"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .HasColumnType("float"); + + b.Property("GuaranteedDrop") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxDrops") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinDrops") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_loot_tables"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTableEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DropChance") + .HasColumnType("float"); + + b.Property("DropChancePerTier") + .HasColumnType("float"); + + b.Property("Guaranteed") + .HasColumnType("tinyint(1)"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxDropChance") + .HasColumnType("float"); + + b.Property("MaxQuantity") + .HasColumnType("int"); + + b.Property("MinQuantity") + .HasColumnType("int"); + + b.Property("Weight") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("LootTableId"); + + b.ToTable("dungeon_loot_table_entries"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AggroRange") + .HasColumnType("float"); + + b.Property("AnimationSpeed") + .HasColumnType("float"); + + b.Property("ArmorPerTier") + .HasColumnType("float"); + + b.Property("AttackRange") + .HasColumnType("float"); + + b.Property("AttackSpeed") + .HasColumnType("float"); + + b.Property("BaseArmor") + .HasColumnType("int"); + + b.Property("BaseHealth") + .HasColumnType("int"); + + b.Property("BaseMagicDamage") + .HasColumnType("int"); + + b.Property("BaseMagicResist") + .HasColumnType("int"); + + b.Property("BaseMana") + .HasColumnType("int"); + + b.Property("BasePhysicalDamage") + .HasColumnType("int"); + + b.Property("BaseXp") + .HasColumnType("int"); + + b.Property("Behavior") + .HasColumnType("int"); + + b.Property("CallForHelpRadius") + .HasColumnType("float"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DropChanceMultiplier") + .HasColumnType("float"); + + b.Property("FleeThreshold") + .HasColumnType("float"); + + b.Property("HealthPerTier") + .HasColumnType("float"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LeashRange") + .HasColumnType("float"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("MoveSpeed") + .HasColumnType("float"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PhasesJson") + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("PreferredRange") + .HasColumnType("float"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("SpriteConfigJson") + .HasMaxLength(8192) + .HasColumnType("varchar(8192)"); + + b.Property("TintColor") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("XpPerTier") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("dungeon_mob_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobLootTable", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("RollChance") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("LootTableId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("dungeon_mob_loot_tables"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPersistence", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("BossKilled") + .HasColumnType("tinyint(1)"); + + b.Property("ChestStateJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("CreatorCharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatorId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatorLevel") + .HasColumnType("int"); + + b.Property("CreatorName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsCleared") + .HasColumnType("tinyint(1)"); + + b.Property("LastActivity") + .HasColumnType("datetime(6)"); + + b.Property("LevelBracketMax") + .HasColumnType("int"); + + b.Property("LevelBracketMin") + .HasColumnType("int"); + + b.Property("LootChestStateJson") + .HasColumnType("json"); + + b.Property("MobStateJson") + .HasColumnType("json"); + + b.Property("PersistedAt") + .HasColumnType("datetime(6)"); + + b.Property("Seed") + .HasColumnType("int"); + + b.Property("Tier") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatorId"); + + b.ToTable("dungeon_instances"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonRecipeScroll", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("RecipeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("RecipeId"); + + b.ToTable("dungeon_recipe_scrolls"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonSpellDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AreaOfEffect") + .HasColumnType("float"); + + b.Property("BaseDamage") + .HasColumnType("int"); + + b.Property("BaseHealing") + .HasColumnType("int"); + + b.Property("Cooldown") + .HasColumnType("float"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EffectColor") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsShield") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleport") + .HasColumnType("tinyint(1)"); + + b.Property("ManaCost") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("RequiredIntelligence") + .HasColumnType("int"); + + b.Property("RequiredLevel") + .HasColumnType("int"); + + b.Property("RequiredWisdom") + .HasColumnType("int"); + + b.Property("ShieldAmount") + .HasColumnType("int"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_spell_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonStashItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CharacterId") + .HasColumnType("bigint unsigned"); + + b.Property("DefinitionId") + .HasColumnType("int"); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.Property("StoredAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId"); + + b.HasIndex("DefinitionId"); + + b.ToTable("dungeon_stash_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DefaultTileMapSheetId") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("GenerationParamsJson") + .HasColumnType("json"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsHandCrafted") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RoomPlacementsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Tier") + .HasColumnType("int"); + + b.Property("TileDataJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DefaultTileMapSheetId"); + + b.ToTable("dungeon_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAnimationMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityAssignmentId") + .HasColumnType("int"); + + b.Property("AnimationKey") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("DirectionSuffix") + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.HasKey("Id"); + + b.HasIndex("AbilityAssignmentId"); + + b.ToTable("mob_ability_animation_mappings"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityDefinitionId") + .HasColumnType("int"); + + b.Property("CooldownOverride") + .HasColumnType("float"); + + b.Property("DamageOverride") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxHpPercent") + .HasColumnType("float"); + + b.Property("MinHpPercent") + .HasColumnType("float"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("Phase") + .HasColumnType("int"); + + b.Property("PriorityOverride") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AbilityDefinitionId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("dungeon_mob_ability_assignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityType") + .HasColumnType("int"); + + b.Property("AffectedStat") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("AnimationDuration") + .HasColumnType("float"); + + b.Property("AnimationKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("AoeRadius") + .HasColumnType("float"); + + b.Property("BaseDamage") + .HasColumnType("int"); + + b.Property("CastTime") + .HasColumnType("float"); + + b.Property("ConeAngle") + .HasColumnType("float"); + + b.Property("Cooldown") + .HasColumnType("float"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DamagePerTier") + .HasColumnType("float"); + + b.Property("DamageTypeKey") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DisplacementDistance") + .HasColumnType("float"); + + b.Property("DotDamagePerTick") + .HasColumnType("int"); + + b.Property("DotTickInterval") + .HasColumnType("float"); + + b.Property("EffectDuration") + .HasColumnType("float"); + + b.Property("HpThresholdAbove") + .HasColumnType("float"); + + b.Property("HpThresholdBelow") + .HasColumnType("float"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ManaCost") + .HasColumnType("int"); + + b.Property("MinTargetsInRange") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("ProjectileSpeed") + .HasColumnType("float"); + + b.Property("ProjectileSprite") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Range") + .HasColumnType("float"); + + b.Property("SoundEffectKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpeedModifier") + .HasColumnType("float"); + + b.Property("StatModifier") + .HasColumnType("float"); + + b.Property("SummonCount") + .HasColumnType("int"); + + b.Property("SummonMobId") + .HasColumnType("int"); + + b.Property("Targeting") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("VisualEffectKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_mob_abilities"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationAssignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationDefinitionId") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MobDefinitionId") + .HasColumnType("int"); + + b.Property("OverrideKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Priority") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AnimationDefinitionId"); + + b.HasIndex("MobDefinitionId"); + + b.ToTable("mob_animation_assignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("FlipX") + .HasColumnType("tinyint(1)"); + + b.Property("FlipY") + .HasColumnType("tinyint(1)"); + + b.Property("Fps") + .HasColumnType("float"); + + b.Property("FrameSequence") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Loop") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpriteSheetId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpriteSheetId"); + + b.ToTable("mob_animation_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobSpriteSheet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CdnPath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("FrameHeight") + .HasColumnType("int"); + + b.Property("FrameWidth") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SheetHeight") + .HasColumnType("int"); + + b.Property("SheetWidth") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("mob_sprite_sheets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.RoomTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConnectionPointsJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpawnPointsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileDataJson") + .HasColumnType("json"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("room_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RenderLayer") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileMapSheetId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TileMapSheetId"); + + b.ToTable("tile_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileMapSheet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CdnPath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SheetHeight") + .HasColumnType("int"); + + b.Property("SheetWidth") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileHeight") + .HasColumnType("int"); + + b.Property("TileWidth") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("tilemap_sheets"); + }); + + modelBuilder.Entity("DataServer.Data.Session", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccountId") + .HasColumnType("bigint unsigned"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("CreatedIp") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ExpiresAt") + .HasColumnType("datetime(6)"); + + b.Property("RevokedAt") + .HasColumnType("datetime(6)"); + + b.Property("TokenHash") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("UserAgent") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("AccountId"); + + b.HasIndex("TokenHash") + .IsUnique(); + + b.ToTable("sessions", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Zone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + b.Property("MaxX") + .HasColumnType("double"); + + b.Property("MaxY") + .HasColumnType("double"); + + b.Property("MaxZ") + .HasColumnType("double"); + + b.Property("MinX") + .HasColumnType("double"); + + b.Property("MinY") + .HasColumnType("double"); + + b.Property("MinZ") + .HasColumnType("double"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("datetime(6)") + .HasDefaultValueSql("CURRENT_TIMESTAMP(6)"); + + MySqlPropertyBuilderExtensions.UseMySqlComputedColumn(b.Property("UpdatedAt")); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("zones", (string)null); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "OwnerCharacter") + .WithMany() + .HasForeignKey("OwnerCharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "VictimCharacter") + .WithMany() + .HasForeignKey("VictimCharacterId"); + + b.Navigation("OwnerCharacter"); + + b.Navigation("VictimCharacter"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChestItem", b => + { + b.HasOne("DataServer.Data.Entities.DeathChest", "DeathChest") + .WithMany("Items") + .HasForeignKey("DeathChestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeathChest"); + + b.Navigation("ItemDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonBeltItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Characters") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterCraftingSkill", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("CraftingSkills") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("Inventory") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("ItemDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterItemCraftedLink", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacterItem", "CharacterItem") + .WithMany() + .HasForeignKey("CharacterItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftedItem", "CraftedItem") + .WithMany() + .HasForeignKey("CraftedItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CharacterItem"); + + b.Navigation("CraftedItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacterKnownRecipe", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("KnownRecipes") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftedItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "BaseItemDefinition") + .WithMany() + .HasForeignKey("BaseItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Crafter") + .WithMany() + .HasForeignKey("CrafterId"); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId"); + + b.Navigation("BaseItemDefinition"); + + b.Navigation("Crafter"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "OutputItem") + .WithMany() + .HasForeignKey("OutputItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OutputItem"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipeIngredient", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany("Ingredients") + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLearnedSpell", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("LearnedSpells") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonSpellDefinition", "Definition") + .WithMany() + .HasForeignKey("DefinitionId"); + + b.Navigation("Character"); + + b.Navigation("Definition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTableEntry", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany("Entries") + .HasForeignKey("LootTableId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("LootTable"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobLootTable", b => + { + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany() + .HasForeignKey("LootTableId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany() + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LootTable"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPersistence", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Creator") + .WithMany() + .HasForeignKey("CreatorId"); + + b.Navigation("Creator"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonRecipeScroll", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCraftingRecipe", "Recipe") + .WithMany() + .HasForeignKey("RecipeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Recipe"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonStashItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonCharacter", "Character") + .WithMany("Stash") + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "Definition") + .WithMany() + .HasForeignKey("DefinitionId"); + + b.Navigation("Character"); + + b.Navigation("Definition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonTemplate", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "DefaultTileMapSheet") + .WithMany() + .HasForeignKey("DefaultTileMapSheetId"); + + b.Navigation("DefaultTileMapSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAnimationMapping", b => + { + b.HasOne("DataServer.Data.Entities.MobAbilityAssignment", "AbilityAssignment") + .WithMany() + .HasForeignKey("AbilityAssignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AbilityAssignment"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b => + { + b.HasOne("DataServer.Data.Entities.MobAbilityDefinition", "AbilityDefinition") + .WithMany() + .HasForeignKey("AbilityDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany("AbilityAssignments") + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AbilityDefinition"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationAssignment", b => + { + b.HasOne("DataServer.Data.Entities.MobAnimationDefinition", "AnimationDefinition") + .WithMany() + .HasForeignKey("AnimationDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition") + .WithMany() + .HasForeignKey("MobDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AnimationDefinition"); + + b.Navigation("MobDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobAnimationDefinition", b => + { + b.HasOne("DataServer.Data.Entities.MobSpriteSheet", "SpriteSheet") + .WithMany("Animations") + .HasForeignKey("SpriteSheetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SpriteSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "TileMapSheet") + .WithMany("Tiles") + .HasForeignKey("TileMapSheetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TileMapSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Session", b => + { + b.HasOne("DataServer.Data.Account", "Account") + .WithMany("Sessions") + .HasForeignKey("AccountId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Account"); + }); + + modelBuilder.Entity("DataServer.Data.Account", b => + { + b.Navigation("Characters"); + + b.Navigation("Sessions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DeathChest", b => + { + b.Navigation("Items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCharacter", b => + { + b.Navigation("CraftingSkills"); + + b.Navigation("Inventory"); + + b.Navigation("KnownRecipes"); + + b.Navigation("LearnedSpells"); + + b.Navigation("Stash"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonCraftingRecipe", b => + { + b.Navigation("Ingredients"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonLootTable", b => + { + b.Navigation("Entries"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Navigation("AbilityAssignments"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.MobSpriteSheet", b => + { + b.Navigation("Animations"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileMapSheet", b => + { + b.Navigation("Tiles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20251228033248_RecreateMissingTables.cs b/Migrations/20251228033248_RecreateMissingTables.cs new file mode 100644 index 0000000..98e1212 --- /dev/null +++ b/Migrations/20251228033248_RecreateMissingTables.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + /// + public partial class RecreateMissingTables : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/Migrations/GameDbContextModelSnapshot.cs b/Migrations/GameDbContextModelSnapshot.cs index a646df6..96a541a 100644 --- a/Migrations/GameDbContextModelSnapshot.cs +++ b/Migrations/GameDbContextModelSnapshot.cs @@ -1309,6 +1309,67 @@ namespace SystemRevivalServer.Migrations b.ToTable("dungeon_stash_items"); }); + modelBuilder.Entity("DataServer.Data.Entities.DungeonTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DefaultTileMapSheetId") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("GenerationParamsJson") + .HasColumnType("json"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsHandCrafted") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RoomPlacementsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Tier") + .HasColumnType("int"); + + b.Property("TileDataJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DefaultTileMapSheetId"); + + b.ToTable("dungeon_templates"); + }); + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAnimationMapping", b => { b.Property("Id") @@ -1639,6 +1700,166 @@ namespace SystemRevivalServer.Migrations b.ToTable("mob_sprite_sheets"); }); + modelBuilder.Entity("DataServer.Data.Entities.RoomTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConnectionPointsJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpawnPointsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileDataJson") + .HasColumnType("json"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("room_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RenderLayer") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileMapSheetId") + .HasColumnType("int"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TileMapSheetId"); + + b.ToTable("tile_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileMapSheet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CdnPath") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SheetHeight") + .HasColumnType("int"); + + b.Property("SheetWidth") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileHeight") + .HasColumnType("int"); + + b.Property("TileWidth") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("tilemap_sheets"); + }); + modelBuilder.Entity("DataServer.Data.Session", b => { b.Property("Id") @@ -2014,6 +2235,15 @@ namespace SystemRevivalServer.Migrations b.Navigation("Definition"); }); + modelBuilder.Entity("DataServer.Data.Entities.DungeonTemplate", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "DefaultTileMapSheet") + .WithMany() + .HasForeignKey("DefaultTileMapSheetId"); + + b.Navigation("DefaultTileMapSheet"); + }); + modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAnimationMapping", b => { b.HasOne("DataServer.Data.Entities.MobAbilityAssignment", "AbilityAssignment") @@ -2074,6 +2304,17 @@ namespace SystemRevivalServer.Migrations b.Navigation("SpriteSheet"); }); + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "TileMapSheet") + .WithMany("Tiles") + .HasForeignKey("TileMapSheetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TileMapSheet"); + }); + modelBuilder.Entity("DataServer.Data.Session", b => { b.HasOne("DataServer.Data.Account", "Account") @@ -2129,6 +2370,11 @@ namespace SystemRevivalServer.Migrations { b.Navigation("Animations"); }); + + modelBuilder.Entity("DataServer.Data.Entities.TileMapSheet", b => + { + b.Navigation("Tiles"); + }); #pragma warning restore 612, 618 } } diff --git a/Services/Admin/Pages/Shared/_Layout.cshtml b/Services/Admin/Pages/Shared/_Layout.cshtml index 68d3a5a..9e9cb49 100644 --- a/Services/Admin/Pages/Shared/_Layout.cshtml +++ b/Services/Admin/Pages/Shared/_Layout.cshtml @@ -152,6 +152,13 @@ Sprite Sheets + + + + + TileMaps + + diff --git a/Services/Admin/Pages/TileMaps/Edit.cshtml b/Services/Admin/Pages/TileMaps/Edit.cshtml new file mode 100644 index 0000000..a347af0 --- /dev/null +++ b/Services/Admin/Pages/TileMaps/Edit.cshtml @@ -0,0 +1,473 @@ +@page "/admin/tilemaps/edit" +@model TileMaps.EditModel +@using DataServer.Data.Entities +@{ + ViewData["Title"] = Model.Sheet.Id == 0 ? "New TileMap Sheet" : $"Edit: {Model.Sheet.Name}"; + var tileTypes = Enum.GetValues(); +} + + + +@if (!string.IsNullOrEmpty(Model.Message)) +{ +
+ @Model.Message +
+} + +
+ +
+

TileMap Sheet Settings

+ +
+ @Html.AntiForgeryToken() + + +
+
+ + +
+ +
+ +
+ + +
+
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+ + +
+ + +
+
+
+ + +
+

Preview

+ + @if (!string.IsNullOrEmpty(Model.Sheet.CdnPath)) + { +
+
+ @Model.Sheet.Name + + +
+
+

+ Grid: @Model.Sheet.Columns columns × @Model.Sheet.Rows rows = @Model.Sheet.TotalTiles tiles +

+ } + else + { +
+ Select a CDN path to preview the tilemap +
+ } +
+
+ +@if (Model.Sheet.Id > 0) +{ + +
+
+

Tile Definitions

+
+
+ + + +
+
+
+ +

Click on a tile to define its properties. Defined tiles: @Model.TileDefinitions.Count / @Model.Sheet.TotalTiles

+ + +
+
+ @if (!string.IsNullOrEmpty(Model.Sheet.CdnPath)) + { + @Model.Sheet.Name + + +
+ @for (int row = 0; row < Model.Sheet.Rows; row++) + { + @for (int col = 0; col < Model.Sheet.Columns; col++) + { + var frameIndex = row * Model.Sheet.Columns + col; + var tileDef = Model.TileDefinitions.FirstOrDefault(t => t.FrameIndex == frameIndex); + var hasDefinition = tileDef != null; + var tileColor = hasDefinition ? GetTileTypeColor(tileDef!.Type) : "transparent"; + +
+ @if (hasDefinition) + { + @frameIndex + } +
+ } + } +
+ } +
+
+ + +
+ Legend: + Floor + Wall + Door + Water + Lava + Spawn +
+ + + @if (Model.TileDefinitions.Count > 0) + { +
+

Defined Tiles

+
+ + + + + + + + + + + + + + @foreach (var tile in Model.TileDefinitions) + { + var col = tile.FrameIndex % Model.Sheet.Columns; + var row = tile.FrameIndex / Model.Sheet.Columns; + + + + + + + + + + + } + +
FramePreviewNameTypeTagsPropertiesActions
@tile.FrameIndex +
+
+
+
@(tile.Name ?? "-") + @tile.Type + @(tile.Tags ?? "-") + @if (tile.IsWalkable) { Walk } + @if (tile.BlocksProjectiles) { NoProj } + @if (tile.BlocksLineOfSight) { NoLOS } + + +
+ + + +
+
+
+
+ } +
+} + + + + + + + +@section Scripts { + +} + +@functions { + string GetTileTypeColor(TileType type) + { + return type switch + { + TileType.Floor => "rgba(34, 197, 94, 0.3)", + TileType.Wall => "rgba(239, 68, 68, 0.3)", + TileType.Door => "rgba(168, 85, 247, 0.3)", + TileType.Water => "rgba(59, 130, 246, 0.3)", + TileType.Lava => "rgba(249, 115, 22, 0.3)", + TileType.Pit => "rgba(31, 41, 55, 0.5)", + TileType.Stairs => "rgba(236, 72, 153, 0.3)", + TileType.PlayerSpawn => "rgba(234, 179, 8, 0.4)", + TileType.MobSpawn => "rgba(234, 179, 8, 0.3)", + TileType.BossSpawn => "rgba(220, 38, 38, 0.4)", + TileType.ChestSpawn => "rgba(251, 191, 36, 0.4)", + TileType.Trigger => "rgba(139, 92, 246, 0.3)", + TileType.Transition => "rgba(14, 165, 233, 0.3)", + TileType.Secret => "rgba(163, 163, 163, 0.3)", + TileType.Trap => "rgba(239, 68, 68, 0.4)", + TileType.FloorDecor => "rgba(34, 197, 94, 0.2)", + TileType.WallDecor => "rgba(239, 68, 68, 0.2)", + _ => "transparent" + }; + } +} diff --git a/Services/Admin/Pages/TileMaps/Edit.cshtml.cs b/Services/Admin/Pages/TileMaps/Edit.cshtml.cs new file mode 100644 index 0000000..4d64f90 --- /dev/null +++ b/Services/Admin/Pages/TileMaps/Edit.cshtml.cs @@ -0,0 +1,206 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using DataServer.Data; +using DataServer.Data.Entities; + +namespace Server.Services.Admin.Pages.TileMaps; + +public class EditModel : AdminPageModel +{ + private readonly GameDbContext _db; + private readonly IConfiguration _config; + + public EditModel(GameDbContext db, IConfiguration config) + { + _db = db; + _config = config; + } + + [BindProperty] + public TileMapSheet Sheet { get; set; } = new(); + + public List TileDefinitions { get; set; } = new(); + public List CdnImages { get; set; } = new(); + public string CdnBaseUrl { get; set; } = ""; + + public string? Message { get; set; } + public bool IsError { get; set; } + + public async Task OnGetAsync(int? id) + { + CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com"; + CdnImages = await _db.ClientAssets + .Where(a => a.AssetType == ClientAssetType.Texture && a.IsEnabled) + .Where(a => a.FilePath.StartsWith("textures/tilemaps/") || a.FilePath.Contains("tilemap")) + .OrderBy(a => a.FilePath) + .ToListAsync(); + + // Also get all textures as fallback + if (CdnImages.Count == 0) + { + CdnImages = await _db.ClientAssets + .Where(a => a.AssetType == ClientAssetType.Texture && a.IsEnabled) + .OrderBy(a => a.FilePath) + .ToListAsync(); + } + + if (id.HasValue) + { + var sheet = await _db.TileMapSheets + .Include(s => s.Tiles) + .FirstOrDefaultAsync(s => s.Id == id.Value); + + if (sheet != null) + { + Sheet = sheet; + TileDefinitions = sheet.Tiles?.OrderBy(t => t.FrameIndex).ToList() ?? new(); + } + } + else + { + Sheet = new TileMapSheet + { + IsEnabled = true, + TileWidth = 32, + TileHeight = 32 + }; + } + } + + public async Task OnPostAsync() + { + CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com"; + + try + { + if (Sheet.Id == 0) + { + Sheet.CreatedAt = DateTime.UtcNow; + Sheet.UpdatedAt = DateTime.UtcNow; + _db.TileMapSheets.Add(Sheet); + await _db.SaveChangesAsync(); + Message = $"TileMap sheet '{Sheet.Name}' created."; + return RedirectToPage(new { id = Sheet.Id }); + } + else + { + var existing = await _db.TileMapSheets.FindAsync(Sheet.Id); + if (existing == null) + { + Message = "TileMap sheet not found."; + IsError = true; + return Page(); + } + + existing.Name = Sheet.Name; + existing.CdnPath = Sheet.CdnPath; + existing.Tags = Sheet.Tags; + existing.SheetWidth = Sheet.SheetWidth; + existing.SheetHeight = Sheet.SheetHeight; + existing.TileWidth = Sheet.TileWidth; + existing.TileHeight = Sheet.TileHeight; + existing.IsEnabled = Sheet.IsEnabled; + existing.UpdatedAt = DateTime.UtcNow; + + await _db.SaveChangesAsync(); + Sheet = existing; + Message = "TileMap sheet updated."; + + TileDefinitions = await _db.TileDefinitions + .Where(t => t.TileMapSheetId == Sheet.Id) + .OrderBy(t => t.FrameIndex) + .ToListAsync(); + } + } + catch (Exception ex) + { + Message = $"Error: {ex.Message}"; + IsError = true; + } + + CdnImages = await _db.ClientAssets + .Where(a => a.AssetType == ClientAssetType.Texture && a.IsEnabled) + .OrderBy(a => a.FilePath) + .ToListAsync(); + + return Page(); + } + + public async Task OnPostSaveTileAsync(int sheetId, int frameIndex, string? name, int type, string? tags, bool isWalkable, bool blocksProjectiles, bool blocksLineOfSight, int renderLayer) + { + var existing = await _db.TileDefinitions + .FirstOrDefaultAsync(t => t.TileMapSheetId == sheetId && t.FrameIndex == frameIndex); + + if (existing != null) + { + existing.Name = name; + existing.Type = (TileType)type; + existing.Tags = tags; + existing.IsWalkable = isWalkable; + existing.BlocksProjectiles = blocksProjectiles; + existing.BlocksLineOfSight = blocksLineOfSight; + existing.RenderLayer = renderLayer; + } + else + { + _db.TileDefinitions.Add(new TileDefinition + { + TileMapSheetId = sheetId, + FrameIndex = frameIndex, + Name = name, + Type = (TileType)type, + Tags = tags, + IsWalkable = isWalkable, + BlocksProjectiles = blocksProjectiles, + BlocksLineOfSight = blocksLineOfSight, + RenderLayer = renderLayer, + IsEnabled = true + }); + } + + await _db.SaveChangesAsync(); + return RedirectToPage(new { id = sheetId }); + } + + public async Task OnPostDeleteTileAsync(int tileId, int sheetId) + { + var tile = await _db.TileDefinitions.FindAsync(tileId); + if (tile != null) + { + _db.TileDefinitions.Remove(tile); + await _db.SaveChangesAsync(); + } + return RedirectToPage(new { id = sheetId }); + } + + public async Task OnPostAutoGenerateAsync(int sheetId, int defaultType) + { + var sheet = await _db.TileMapSheets.FindAsync(sheetId); + if (sheet == null) return RedirectToPage(); + + // Generate tile definitions for all frames that don't have one + var existingFrames = await _db.TileDefinitions + .Where(t => t.TileMapSheetId == sheetId) + .Select(t => t.FrameIndex) + .ToListAsync(); + + var totalTiles = sheet.TotalTiles; + for (int i = 0; i < totalTiles; i++) + { + if (!existingFrames.Contains(i)) + { + _db.TileDefinitions.Add(new TileDefinition + { + TileMapSheetId = sheetId, + FrameIndex = i, + Type = (TileType)defaultType, + IsWalkable = defaultType == 0, // Floor is walkable + IsEnabled = true + }); + } + } + + await _db.SaveChangesAsync(); + return RedirectToPage(new { id = sheetId }); + } +} diff --git a/Services/Admin/Pages/TileMaps/Index.cshtml b/Services/Admin/Pages/TileMaps/Index.cshtml new file mode 100644 index 0000000..4cab1f9 --- /dev/null +++ b/Services/Admin/Pages/TileMaps/Index.cshtml @@ -0,0 +1,84 @@ +@page "/admin/tilemaps" +@model TileMaps.IndexModel +@{ + ViewData["Title"] = "TileMap Sheets"; +} + +
+
+

TileMap Sheets

+

Manage tilemap sprite sheets for dungeon generation

+
+ + New TileMap Sheet +
+ +
+ @foreach (var sheet in Model.Sheets) + { +
+
+
+

@sheet.Name

+

@sheet.CdnPath

+
+ + @(sheet.IsEnabled ? "Enabled" : "Disabled") + +
+ + +
+ @sheet.Name +
+ +
+
+ Sheet Size: + @sheet.SheetWidth x @sheet.SheetHeight +
+
+ Tile Size: + @sheet.TileWidth x @sheet.TileHeight +
+
+ Grid: + @sheet.Columns x @sheet.Rows (@sheet.TotalTiles tiles) +
+
+ Defined: + @(sheet.Tiles?.Count ?? 0) tiles +
+
+ + @if (!string.IsNullOrEmpty(sheet.Tags)) + { +
+ @foreach (var tag in sheet.Tags.Split(',', StringSplitOptions.RemoveEmptyEntries)) + { + @tag.Trim() + } +
+ } + +
+ Edit +
+ + +
+
+
+ } +
+ +@if (Model.Sheets.Count == 0) +{ +
+

No tilemap sheets yet.

+ Create Your First TileMap Sheet +
+} diff --git a/Services/Admin/Pages/TileMaps/Index.cshtml.cs b/Services/Admin/Pages/TileMaps/Index.cshtml.cs new file mode 100644 index 0000000..caa3201 --- /dev/null +++ b/Services/Admin/Pages/TileMaps/Index.cshtml.cs @@ -0,0 +1,43 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using DataServer.Data; +using DataServer.Data.Entities; + +namespace Server.Services.Admin.Pages.TileMaps; + +public class IndexModel : AdminPageModel +{ + private readonly GameDbContext _db; + private readonly IConfiguration _config; + + public IndexModel(GameDbContext db, IConfiguration config) + { + _db = db; + _config = config; + } + + public List Sheets { get; set; } = new(); + public string CdnBaseUrl { get; set; } = ""; + + public async Task OnGetAsync() + { + CdnBaseUrl = _config["Cdn:BaseUrl"] ?? "https://assets.aeternalisgames.com"; + Sheets = await _db.TileMapSheets + .Include(s => s.Tiles) + .OrderBy(s => s.Name) + .ToListAsync(); + } + + public async Task OnPostDeleteAsync(int id) + { + var sheet = await _db.TileMapSheets.FindAsync(id); + if (sheet != null) + { + // Check if used in any room templates + // For now just delete - add check later + _db.TileMapSheets.Remove(sheet); + await _db.SaveChangesAsync(); + } + return RedirectToPage(); + } +} diff --git a/data/GameDbContext.cs b/data/GameDbContext.cs index 74a2839..1a68994 100644 --- a/data/GameDbContext.cs +++ b/data/GameDbContext.cs @@ -33,6 +33,12 @@ public sealed class GameDbContext : DbContext public DbSet MobAnimationAssignments => Set(); public DbSet MobAbilityAnimationMappings => Set(); + // TileMap system + public DbSet TileMapSheets => Set(); + public DbSet TileDefinitions => Set(); + public DbSet RoomTemplates => Set(); + public DbSet DungeonTemplates => Set(); + public DbSet DungeonBeltItems => Set(); public DbSet DeathChests => Set(); public DbSet DeathChestItems => Set(); diff --git a/data/entities/TileMap.cs b/data/entities/TileMap.cs new file mode 100644 index 0000000..ef77b69 --- /dev/null +++ b/data/entities/TileMap.cs @@ -0,0 +1,314 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace DataServer.Data.Entities; + +/// +/// A tilemap sprite sheet uploaded to CDN +/// +[Table("tilemap_sheets")] +public class TileMapSheet +{ + [Key] + public int Id { get; set; } + + /// Friendly name (e.g., "Dungeon Stone Set", "Cave Tiles") + [Required, MaxLength(64)] + public string Name { get; set; } = ""; + + /// CDN path (e.g., "textures/tilemaps/dungeon_stone.png") + [Required, MaxLength(256)] + public string CdnPath { get; set; } = ""; + + /// Tags for categorization (e.g., "dungeon,stone,dark") + [MaxLength(256)] + public string? Tags { get; set; } + + /// Total width of sprite sheet in pixels + public int SheetWidth { get; set; } = 512; + + /// Total height of sprite sheet in pixels + public int SheetHeight { get; set; } = 512; + + /// Width of each tile in pixels + public int TileWidth { get; set; } = 32; + + /// Height of each tile in pixels (for isometric, often 16 or TileWidth/2) + public int TileHeight { get; set; } = 32; + + /// Number of columns in sheet + [NotMapped] + public int Columns => TileWidth > 0 ? SheetWidth / TileWidth : 1; + + /// Number of rows in sheet + [NotMapped] + public int Rows => TileHeight > 0 ? SheetHeight / TileHeight : 1; + + /// Total tile count + [NotMapped] + public int TotalTiles => Columns * Rows; + + public bool IsEnabled { get; set; } = true; + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; + + // Navigation + public ICollection? Tiles { get; set; } +} + +/// +/// Definition of a single tile within a tilemap sheet +/// +[Table("tile_definitions")] +public class TileDefinition +{ + [Key] + public int Id { get; set; } + + public int TileMapSheetId { get; set; } + + [ForeignKey(nameof(TileMapSheetId))] + public TileMapSheet? TileMapSheet { get; set; } + + /// Frame index in the sheet (0-based, left-to-right, top-to-bottom) + public int FrameIndex { get; set; } + + /// Optional name for this specific tile + [MaxLength(64)] + public string? Name { get; set; } + + /// Tile type for game logic + public TileType Type { get; set; } = TileType.Floor; + + /// Tags for filtering/selection (e.g., "stone,cracked,corner_nw") + [MaxLength(256)] + public string? Tags { get; set; } + + /// Whether entities can walk on this tile + public bool IsWalkable { get; set; } = true; + + /// Whether projectiles can pass through + public bool BlocksProjectiles { get; set; } = false; + + /// Whether this blocks line of sight + public bool BlocksLineOfSight { get; set; } = false; + + /// Layer for rendering order (0=ground, 1=floor decor, 2=walls, 3=ceiling) + public int RenderLayer { get; set; } = 0; + + /// Z-index within the layer + public int ZIndex { get; set; } = 0; + + public bool IsEnabled { get; set; } = true; +} + +/// +/// Types of tiles for game logic +/// +public enum TileType +{ + Floor = 0, + Wall = 1, + Door = 2, + Water = 3, + Lava = 4, + Pit = 5, + Stairs = 6, + + // Spawn points + PlayerSpawn = 10, + MobSpawn = 11, + BossSpawn = 12, + ChestSpawn = 13, + + // Special + Trigger = 20, + Transition = 21, + Secret = 22, + Trap = 23, + + // Decorative (walkable but with visual interest) + FloorDecor = 30, + WallDecor = 31 +} + +/// +/// A room template that can be placed in dungeons +/// +[Table("room_templates")] +public class RoomTemplate +{ + [Key] + public int Id { get; set; } + + /// Name of this room template + [Required, MaxLength(64)] + public string Name { get; set; } = ""; + + /// Description of the room + [MaxLength(512)] + public string? Description { get; set; } + + /// Tags for categorization (e.g., "entrance,large,treasure") + [MaxLength(256)] + public string? Tags { get; set; } + + /// Room type for generation logic + public RoomType Type { get; set; } = RoomType.Normal; + + /// Width in tiles + public int Width { get; set; } = 10; + + /// Height in tiles + public int Height { get; set; } = 10; + + /// Minimum dungeon tier this room can appear in + public int MinTier { get; set; } = 1; + + /// Maximum dungeon tier (0 = no max) + public int MaxTier { get; set; } = 0; + + /// Spawn weight for random selection (higher = more common) + public int Weight { get; set; } = 100; + + /// JSON data containing tile placements + [Column(TypeName = "json")] + public string? TileDataJson { get; set; } + + /// JSON data containing spawn points + [Column(TypeName = "json")] + public string? SpawnPointsJson { get; set; } + + /// JSON data for connection points (where hallways can attach) + [Column(TypeName = "json")] + public string? ConnectionPointsJson { get; set; } + + public bool IsEnabled { get; set; } = true; + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; +} + +/// +/// Types of rooms for generation logic +/// +public enum RoomType +{ + Normal = 0, + Entrance = 1, + Exit = 2, + Boss = 3, + Treasure = 4, + Secret = 5, + Shop = 6, + Shrine = 7, + Challenge = 8, + Hallway = 9, + Junction = 10 +} + +/// +/// A complete dungeon template (optional - for hand-crafted dungeons) +/// +[Table("dungeon_templates")] +public class DungeonTemplate +{ + [Key] + public int Id { get; set; } + + /// Name of this dungeon + [Required, MaxLength(64)] + public string Name { get; set; } = ""; + + /// Description + [MaxLength(512)] + public string? Description { get; set; } + + /// Tags for categorization + [MaxLength(256)] + public string? Tags { get; set; } + + /// Dungeon tier (difficulty) + public int Tier { get; set; } = 1; + + /// Total width in tiles + public int Width { get; set; } = 100; + + /// Total height in tiles + public int Height { get; set; } = 100; + + /// If true, this is a complete hand-crafted dungeon. If false, it's generation parameters. + public bool IsHandCrafted { get; set; } = false; + + /// JSON containing full tile data (for hand-crafted) + [Column(TypeName = "json")] + public string? TileDataJson { get; set; } + + /// JSON containing room placements (for hand-crafted or as hints for generation) + [Column(TypeName = "json")] + public string? RoomPlacementsJson { get; set; } + + /// JSON containing generation parameters (room counts, weights, etc.) + [Column(TypeName = "json")] + public string? GenerationParamsJson { get; set; } + + /// Default tilemap sheet to use + public int? DefaultTileMapSheetId { get; set; } + + [ForeignKey(nameof(DefaultTileMapSheetId))] + public TileMapSheet? DefaultTileMapSheet { get; set; } + + public bool IsEnabled { get; set; } = true; + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; +} + +/// +/// Helper class for tile placement data (serialized to JSON) +/// +public class TilePlacement +{ + public int X { get; set; } + public int Y { get; set; } + public int TileDefinitionId { get; set; } + public int Layer { get; set; } = 0; + + /// Optional rotation (0, 90, 180, 270) + public int Rotation { get; set; } = 0; + + /// Optional flip X + public bool FlipX { get; set; } = false; + + /// Optional flip Y + public bool FlipY { get; set; } = false; +} + +/// +/// Helper class for spawn point data (serialized to JSON) +/// +public class SpawnPoint +{ + public int X { get; set; } + public int Y { get; set; } + public TileType Type { get; set; } + + /// Optional specific mob/item ID to spawn + public int? EntityId { get; set; } + + /// Tags for filtering what can spawn here + public string? Tags { get; set; } +} + +/// +/// Helper class for room connection points (where hallways attach) +/// +public class ConnectionPoint +{ + public int X { get; set; } + public int Y { get; set; } + + /// Direction this connection faces (north, south, east, west) + public string Direction { get; set; } = "north"; + + /// Width of the connection (for wider hallways) + public int Width { get; set; } = 1; +}