diff --git a/Migrations/20260214185025_AddOverworldRegionZoneChunkEditor.Designer.cs b/Migrations/20260214185025_AddOverworldRegionZoneChunkEditor.Designer.cs new file mode 100644 index 0000000..1788305 --- /dev/null +++ b/Migrations/20260214185025_AddOverworldRegionZoneChunkEditor.Designer.cs @@ -0,0 +1,4079 @@ +// +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("20260214185025_AddOverworldRegionZoneChunkEditor")] + partial class AddOverworldRegionZoneChunkEditor + { + /// + 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.BuilderRoomTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllowMirror") + .HasColumnType("tinyint(1)"); + + b.Property("AllowRotation") + .HasColumnType("tinyint(1)"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ConnectionPointsJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ExitPortalX") + .HasColumnType("int"); + + b.Property("ExitPortalY") + .HasColumnType("int"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("ItemSpawnsJson") + .HasColumnType("json"); + + b.Property("MaxConnections") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinConnections") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("MobSpawnsJson") + .HasColumnType("json"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ObjectPlacementsJson") + .HasColumnType("json"); + + b.Property("PlayerSpawnX") + .HasColumnType("int"); + + b.Property("PlayerSpawnY") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TileGridJson") + .HasColumnType("json"); + + b.Property("TilePlacementsJson") + .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("builder_room_templates"); + }); + + 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("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("EquippedNecklace") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedOffhand") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedQuiver") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedRing1") + .HasColumnType("bigint unsigned"); + + b.Property("EquippedRing2") + .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("CraftedItemId") + .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("CraftedItemId"); + + 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("AmmunitionType") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Armor") + .HasColumnType("int"); + + b.Property("ArrowRecoveryChance") + .HasColumnType("float"); + + 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("IsLinearProjectile") + .HasColumnType("tinyint(1)"); + + b.Property("IsTeleportScroll") + .HasColumnType("tinyint(1)"); + + b.Property("IsThrowable") + .HasColumnType("tinyint(1)"); + + b.Property("ManaRestore") + .HasColumnType("int"); + + b.Property("MaxArmor") + .HasColumnType("int"); + + b.Property("MaxBonusDexterity") + .HasColumnType("int"); + + b.Property("MaxBonusEndurance") + .HasColumnType("int"); + + b.Property("MaxBonusHealth") + .HasColumnType("int"); + + b.Property("MaxBonusIntelligence") + .HasColumnType("int"); + + b.Property("MaxBonusMana") + .HasColumnType("int"); + + b.Property("MaxBonusStrength") + .HasColumnType("int"); + + b.Property("MaxBonusWisdom") + .HasColumnType("int"); + + b.Property("MaxDamage") + .HasColumnType("int"); + + b.Property("MaxMaxDamage") + .HasColumnType("int"); + + b.Property("MaxMinDamage") + .HasColumnType("int"); + + b.Property("MaxStack") + .HasColumnType("int"); + + b.Property("MinArmor") + .HasColumnType("int"); + + b.Property("MinBonusDexterity") + .HasColumnType("int"); + + b.Property("MinBonusEndurance") + .HasColumnType("int"); + + b.Property("MinBonusHealth") + .HasColumnType("int"); + + b.Property("MinBonusIntelligence") + .HasColumnType("int"); + + b.Property("MinBonusMana") + .HasColumnType("int"); + + b.Property("MinBonusStrength") + .HasColumnType("int"); + + b.Property("MinBonusWisdom") + .HasColumnType("int"); + + b.Property("MinDamage") + .HasColumnType("int"); + + b.Property("MinMaxDamage") + .HasColumnType("int"); + + b.Property("MinMinDamage") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ProjectileBackX") + .HasColumnType("int"); + + b.Property("ProjectileBackY") + .HasColumnType("int"); + + b.Property("ProjectileFrontX") + .HasColumnType("int"); + + b.Property("ProjectileFrontY") + .HasColumnType("int"); + + b.Property("ProjectileRange") + .HasColumnType("int"); + + b.Property("ProjectileSpeed") + .HasColumnType("float"); + + b.Property("QuiverCapacity") + .HasColumnType("int"); + + 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("RequiresAmmunition") + .HasColumnType("tinyint(1)"); + + 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("GoldDropChance") + .HasColumnType("float"); + + b.Property("GuaranteedDrop") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxDrops") + .HasColumnType("int"); + + b.Property("MaxGold") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinDrops") + .HasColumnType("int"); + + b.Property("MinGold") + .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.DungeonNpcDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AbilityDefinitionIdsJson") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("AttackPower") + .HasColumnType("int"); + + b.Property("BehaviorMode") + .HasColumnType("int"); + + b.Property("CanShop") + .HasColumnType("tinyint(1)"); + + b.Property("CanWander") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Defense") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Dexterity") + .HasColumnType("int"); + + b.Property("DialogTreeId") + .HasColumnType("int"); + + b.Property("Endurance") + .HasColumnType("int"); + + b.Property("HasDialog") + .HasColumnType("tinyint(1)"); + + b.Property("Intelligence") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsKillable") + .HasColumnType("tinyint(1)"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxHealth") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OnAttackBehavior") + .HasColumnType("int"); + + b.Property("ResistancesJson") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.Property("Scale") + .HasColumnType("float"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.Property("SpriteConfigJson") + .HasMaxLength(4096) + .HasColumnType("varchar(4096)"); + + b.Property("Strength") + .HasColumnType("int"); + + b.Property("TintColor") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("WanderIntervalSeconds") + .HasColumnType("float"); + + b.Property("WanderRadiusPx") + .HasColumnType("float"); + + b.Property("Wisdom") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DialogTreeId"); + + b.HasIndex("LootTableId"); + + b.HasIndex("ShopId"); + + b.ToTable("dungeon_npc_definitions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogNode", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DialogTreeId") + .HasColumnType("int"); + + b.Property("IsRoot") + .HasColumnType("tinyint(1)"); + + b.Property("IsTerminal") + .HasColumnType("tinyint(1)"); + + b.Property("NodeKey") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("RewardGold") + .HasColumnType("bigint"); + + b.Property("RewardItemDefinitionId") + .HasColumnType("int"); + + b.Property("RewardItemQuantity") + .HasColumnType("int"); + + b.Property("RewardQuestKey") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RewardType") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RewardXp") + .HasColumnType("bigint"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.HasKey("Id"); + + b.HasIndex("DialogTreeId"); + + b.ToTable("dungeon_npc_dialog_nodes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogOption", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConditionQuantity") + .HasColumnType("int"); + + b.Property("ConditionType") + .HasColumnType("int"); + + b.Property("ConditionValue") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ConsumeConditionItem") + .HasColumnType("tinyint(1)"); + + b.Property("NextNodeId") + .HasColumnType("int"); + + b.Property("NodeId") + .HasColumnType("int"); + + b.Property("PlayerText") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("SortOrder") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NodeId"); + + b.ToTable("dungeon_npc_dialog_options"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogTree", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_npc_dialog_trees"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcShop", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("dungeon_npc_shops"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcShopItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("LastRestockAt") + .HasColumnType("datetime(6)"); + + b.Property("PriceGold") + .HasColumnType("bigint"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("RestockIntervalSeconds") + .HasColumnType("int"); + + b.Property("Restocks") + .HasColumnType("tinyint(1)"); + + b.Property("ShopId") + .HasColumnType("int"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("ShopId"); + + b.ToTable("dungeon_npc_shop_items"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonObjectDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationFps") + .HasColumnType("float"); + + b.Property("AnimationFrameCount") + .HasColumnType("int"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksMovement") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("Health") + .HasColumnType("int"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("InteractedSpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("InteractionType") + .HasColumnType("int"); + + b.Property("IsAnimated") + .HasColumnType("tinyint(1)"); + + b.Property("IsDestructible") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsInteractable") + .HasColumnType("tinyint(1)"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("SpriteId") + .HasColumnType("int"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("dungeon_objects"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonPalette", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AllowedBucketIdsJson") + .HasColumnType("json"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("ContainerDensity") + .HasColumnType("int"); + + b.Property("ContainerIdsJson") + .HasColumnType("json"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DecorationDensity") + .HasColumnType("int"); + + b.Property("DecorationIdsJson") + .HasColumnType("json"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DoorTemplateIdsJson") + .HasColumnType("json"); + + b.Property("EnforceBiomeBuckets") + .HasColumnType("tinyint(1)"); + + b.Property("FloorTemplateIdsJson") + .HasColumnType("json"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("MaxCorridorWidth") + .HasColumnType("int"); + + b.Property("MaxRoomHeight") + .HasColumnType("int"); + + b.Property("MaxRoomWidth") + .HasColumnType("int"); + + b.Property("MaxRooms") + .HasColumnType("int"); + + b.Property("MinCorridorWidth") + .HasColumnType("int"); + + b.Property("MinRoomHeight") + .HasColumnType("int"); + + b.Property("MinRoomWidth") + .HasColumnType("int"); + + b.Property("MinRooms") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RoomTemplateIdsJson") + .HasColumnType("json"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TrapDensity") + .HasColumnType("int"); + + b.Property("TrapIdsJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("WallTemplateIdsJson") + .HasColumnType("json"); + + b.HasKey("Id"); + + b.ToTable("dungeon_palettes"); + }); + + 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.DungeonQuiverAmmoSlot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint unsigned"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ItemDefinitionId") + .HasColumnType("int"); + + b.Property("MaxQuantity") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("QuiverCharacterItemId") + .HasColumnType("bigint unsigned"); + + b.Property("QuiverItemId") + .HasColumnType("bigint unsigned"); + + b.Property("SlotIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemDefinitionId"); + + b.HasIndex("QuiverItemId"); + + b.ToTable("dungeon_quiver_ammo_slots"); + }); + + 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("HazardTintColor") + .IsRequired() + .HasMaxLength(16) + .HasColumnType("varchar(16)"); + + b.Property("HazardTintOpacity") + .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.ObjectTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationFps") + .HasColumnType("float"); + + b.Property("AnimationFrameCount") + .HasColumnType("int"); + + b.Property("AnimationLoops") + .HasColumnType("tinyint(1)"); + + b.Property("AnimationStatesJson") + .HasColumnType("json"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlockedCellsJson") + .HasColumnType("json"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksMovement") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Damage") + .HasColumnType("int"); + + b.Property("DamageTypeKey") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("DefaultState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("DestroyedLootTableId") + .HasColumnType("int"); + + b.Property("DestroyedState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("GoldAmount") + .HasColumnType("int"); + + b.Property("Health") + .HasColumnType("int"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("InteractionCooldown") + .HasColumnType("float"); + + b.Property("InteractionState") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("InteractionType") + .HasColumnType("int"); + + b.Property("IsAnimated") + .HasColumnType("tinyint(1)"); + + b.Property("IsDestructible") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsInteractable") + .HasColumnType("tinyint(1)"); + + b.Property("LootTableId") + .HasColumnType("int"); + + b.Property("MaxPerRoom") + .HasColumnType("int"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("OffsetX") + .HasColumnType("int"); + + b.Property("OffsetY") + .HasColumnType("int"); + + b.Property("Placement") + .HasColumnType("int"); + + b.Property("RequiredItemId") + .HasColumnType("int"); + + b.Property("ResetTime") + .HasColumnType("float"); + + b.Property("SpritePath") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("SpriteSheetId") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TriggerDelay") + .HasColumnType("float"); + + b.Property("TriggeredByWalk") + .HasColumnType("tinyint(1)"); + + b.Property("Type") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.Property("XpReward") + .HasColumnType("int"); + + b.Property("ZIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("SpriteSheetId"); + + b.ToTable("object_templates"); + }); + + 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.SocketName", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UsageCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("socket_names"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileBucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BucketType") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.HasKey("Id"); + + b.ToTable("tile_buckets"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileBucketRule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("SourceBucketId") + .HasColumnType("int"); + + b.Property("TargetBucketId") + .HasColumnType("int"); + + b.Property("Weight") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("SourceBucketId"); + + b.HasIndex("TargetBucketId"); + + b.ToTable("tile_bucket_rules"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AnimationFps") + .HasColumnType("float"); + + b.Property("AnimationFrameCount") + .HasColumnType("int"); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("IsAnimated") + .HasColumnType("tinyint(1)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsInteractable") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RenderLayer") + .HasColumnType("int"); + + b.Property("SocketE") + .HasColumnType("int"); + + b.Property("SocketECustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketN") + .HasColumnType("int"); + + b.Property("SocketNCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketS") + .HasColumnType("int"); + + b.Property("SocketSCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SocketW") + .HasColumnType("int"); + + b.Property("SocketWCustom") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + 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.TileDefinitionBucket", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("TileBucketId") + .HasColumnType("int"); + + b.Property("TileDefinitionId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TileBucketId"); + + b.HasIndex("TileDefinitionId"); + + b.ToTable("tile_definition_buckets"); + }); + + 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.Entities.TileStamp", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TilesJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("tile_stamps"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Biome") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("BlocksLineOfSight") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksMovement") + .HasColumnType("tinyint(1)"); + + b.Property("BlocksProjectiles") + .HasColumnType("tinyint(1)"); + + b.Property("Category") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Height") + .HasColumnType("int"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("MaxTier") + .HasColumnType("int"); + + b.Property("MinTier") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("PrimaryTileDefinitionId") + .HasColumnType("int"); + + b.Property("SocketConfigJson") + .HasColumnType("json"); + + b.Property("SocketCustom") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("SocketE") + .HasColumnType("int"); + + b.Property("SocketN") + .HasColumnType("int"); + + b.Property("SocketS") + .HasColumnType("int"); + + b.Property("SocketW") + .HasColumnType("int"); + + b.Property("Tags") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TilesJson") + .HasColumnType("json"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Weight") + .HasColumnType("int"); + + b.Property("Width") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PrimaryTileDefinitionId"); + + b.ToTable("tile_templates"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunk", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ChunkX") + .HasColumnType("int"); + + b.Property("ChunkY") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("bigint"); + + b.Property("WorldZoneId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("WorldZoneId", "ChunkX", "ChunkY") + .IsUnique(); + + b.ToTable("world_chunks"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkNpcSpawn", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("MetadataJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("NpcDefinitionId") + .HasColumnType("int"); + + b.Property("Rotation") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("NpcDefinitionId"); + + b.HasIndex("WorldChunkId", "TileX", "TileY", "NpcDefinitionId"); + + b.ToTable("world_chunk_npc_spawns"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkObject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("MetadataJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ObjectDefinitionId") + .HasColumnType("int"); + + b.Property("Rotation") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ObjectDefinitionId"); + + b.HasIndex("WorldChunkId", "TileX", "TileY", "ObjectDefinitionId"); + + b.ToTable("world_chunk_objects"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkTile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("IsInvisiblePaywall") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("SheetId") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("WorldChunkId", "TileX", "TileY") + .IsUnique(); + + b.ToTable("world_chunk_tiles"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldRegion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ChunkHeightTiles") + .HasColumnType("int"); + + b.Property("ChunkWidthTiles") + .HasColumnType("int"); + + b.Property("ChunksPerZoneX") + .HasColumnType("int"); + + b.Property("ChunksPerZoneY") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ZonesPerRegionX") + .HasColumnType("int"); + + b.Property("ZonesPerRegionY") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("world_regions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldZone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RegionId") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ZoneX") + .HasColumnType("int"); + + b.Property("ZoneY") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RegionId", "ZoneX", "ZoneY") + .IsUnique(); + + b.ToTable("world_zones"); + }); + + 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.DungeonCraftedItem", "CraftedItem") + .WithMany() + .HasForeignKey("CraftedItemId"); + + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("CraftedItem"); + + 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.DungeonNpcDefinition", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDialogTree", "DialogTree") + .WithMany() + .HasForeignKey("DialogTreeId"); + + b.HasOne("DataServer.Data.Entities.DungeonLootTable", "LootTable") + .WithMany() + .HasForeignKey("LootTableId"); + + b.HasOne("DataServer.Data.Entities.DungeonNpcShop", "Shop") + .WithMany() + .HasForeignKey("ShopId"); + + b.Navigation("DialogTree"); + + b.Navigation("LootTable"); + + b.Navigation("Shop"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogNode", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDialogTree", "DialogTree") + .WithMany("Nodes") + .HasForeignKey("DialogTreeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DialogTree"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogOption", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDialogNode", "Node") + .WithMany("Options") + .HasForeignKey("NodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Node"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcShopItem", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonNpcShop", "Shop") + .WithMany("Items") + .HasForeignKey("ShopId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ItemDefinition"); + + b.Navigation("Shop"); + }); + + 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.DungeonQuiverAmmoSlot", b => + { + b.HasOne("DataServer.Data.Entities.DungeonItemDefinition", "ItemDefinition") + .WithMany() + .HasForeignKey("ItemDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.DungeonCharacterItem", "QuiverItem") + .WithMany() + .HasForeignKey("QuiverItemId"); + + b.Navigation("ItemDefinition"); + + b.Navigation("QuiverItem"); + }); + + 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.ObjectTemplate", b => + { + b.HasOne("DataServer.Data.Entities.TileMapSheet", "SpriteSheet") + .WithMany() + .HasForeignKey("SpriteSheetId"); + + b.Navigation("SpriteSheet"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileBucketRule", b => + { + b.HasOne("DataServer.Data.Entities.TileBucket", "SourceBucket") + .WithMany() + .HasForeignKey("SourceBucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.TileBucket", "TargetBucket") + .WithMany() + .HasForeignKey("TargetBucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SourceBucket"); + + b.Navigation("TargetBucket"); + }); + + 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.Entities.TileDefinitionBucket", b => + { + b.HasOne("DataServer.Data.Entities.TileBucket", "TileBucket") + .WithMany() + .HasForeignKey("TileBucketId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.TileDefinition", "TileDefinition") + .WithMany() + .HasForeignKey("TileDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TileBucket"); + + b.Navigation("TileDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.TileTemplate", b => + { + b.HasOne("DataServer.Data.Entities.TileDefinition", "PrimaryTileDefinition") + .WithMany() + .HasForeignKey("PrimaryTileDefinitionId"); + + b.Navigation("PrimaryTileDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunk", b => + { + b.HasOne("DataServer.Data.Entities.WorldZone", "Zone") + .WithMany() + .HasForeignKey("WorldZoneId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Zone"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkNpcSpawn", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDefinition", "NpcDefinition") + .WithMany() + .HasForeignKey("NpcDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + + b.Navigation("NpcDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkObject", b => + { + b.HasOne("DataServer.Data.Entities.DungeonObjectDefinition", "ObjectDefinition") + .WithMany() + .HasForeignKey("ObjectDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + + b.Navigation("ObjectDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkTile", b => + { + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldZone", b => + { + b.HasOne("DataServer.Data.Entities.WorldRegion", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Region"); + }); + + 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.DungeonNpcDialogNode", b => + { + b.Navigation("Options"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogTree", b => + { + b.Navigation("Nodes"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcShop", b => + { + b.Navigation("Items"); + }); + + 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/20260214185025_AddOverworldRegionZoneChunkEditor.cs b/Migrations/20260214185025_AddOverworldRegionZoneChunkEditor.cs new file mode 100644 index 0000000..fab7e2c --- /dev/null +++ b/Migrations/20260214185025_AddOverworldRegionZoneChunkEditor.cs @@ -0,0 +1,248 @@ +using System; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SystemRevivalServer.Migrations +{ + /// + public partial class AddOverworldRegionZoneChunkEditor : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "world_regions", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + ZonesPerRegionX = table.Column(type: "int", nullable: false), + ZonesPerRegionY = table.Column(type: "int", nullable: false), + ChunksPerZoneX = table.Column(type: "int", nullable: false), + ChunksPerZoneY = table.Column(type: "int", nullable: false), + ChunkWidthTiles = table.Column(type: "int", nullable: false), + ChunkHeightTiles = table.Column(type: "int", nullable: false), + IsEnabled = table.Column(type: "tinyint(1)", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_world_regions", x => x.Id); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "world_zones", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + RegionId = table.Column(type: "int", nullable: false), + ZoneX = table.Column(type: "int", nullable: false), + ZoneY = table.Column(type: "int", nullable: false), + Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"), + IsEnabled = table.Column(type: "tinyint(1)", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_world_zones", x => x.Id); + table.ForeignKey( + name: "FK_world_zones_world_regions_RegionId", + column: x => x.RegionId, + principalTable: "world_regions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "world_chunks", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + WorldZoneId = table.Column(type: "bigint", nullable: false), + ChunkX = table.Column(type: "int", nullable: false), + ChunkY = table.Column(type: "int", nullable: false), + Version = table.Column(type: "bigint", nullable: false), + CreatedAt = table.Column(type: "datetime(6)", nullable: false), + UpdatedAt = table.Column(type: "datetime(6)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_world_chunks", x => x.Id); + table.ForeignKey( + name: "FK_world_chunks_world_zones_WorldZoneId", + column: x => x.WorldZoneId, + principalTable: "world_zones", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "world_chunk_npc_spawns", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + WorldChunkId = table.Column(type: "bigint", nullable: false), + NpcDefinitionId = table.Column(type: "int", nullable: false), + TileX = table.Column(type: "int", nullable: false), + TileY = table.Column(type: "int", nullable: false), + Rotation = table.Column(type: "int", nullable: false), + MetadataJson = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_world_chunk_npc_spawns", x => x.Id); + table.ForeignKey( + name: "FK_world_chunk_npc_spawns_dungeon_npc_definitions_NpcDefinition~", + column: x => x.NpcDefinitionId, + principalTable: "dungeon_npc_definitions", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_world_chunk_npc_spawns_world_chunks_WorldChunkId", + column: x => x.WorldChunkId, + principalTable: "world_chunks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "world_chunk_objects", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + WorldChunkId = table.Column(type: "bigint", nullable: false), + ObjectDefinitionId = table.Column(type: "int", nullable: false), + TileX = table.Column(type: "int", nullable: false), + TileY = table.Column(type: "int", nullable: false), + Rotation = table.Column(type: "int", nullable: false), + MetadataJson = table.Column(type: "varchar(1024)", maxLength: 1024, nullable: true) + .Annotation("MySql:CharSet", "utf8mb4") + }, + constraints: table => + { + table.PrimaryKey("PK_world_chunk_objects", x => x.Id); + table.ForeignKey( + name: "FK_world_chunk_objects_dungeon_objects_ObjectDefinitionId", + column: x => x.ObjectDefinitionId, + principalTable: "dungeon_objects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_world_chunk_objects_world_chunks_WorldChunkId", + column: x => x.WorldChunkId, + principalTable: "world_chunks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateTable( + name: "world_chunk_tiles", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + WorldChunkId = table.Column(type: "bigint", nullable: false), + TileX = table.Column(type: "int", nullable: false), + TileY = table.Column(type: "int", nullable: false), + SheetId = table.Column(type: "int", nullable: false), + FrameIndex = table.Column(type: "int", nullable: false), + IsWalkable = table.Column(type: "tinyint(1)", nullable: false), + IsInvisiblePaywall = table.Column(type: "tinyint(1)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_world_chunk_tiles", x => x.Id); + table.ForeignKey( + name: "FK_world_chunk_tiles_world_chunks_WorldChunkId", + column: x => x.WorldChunkId, + principalTable: "world_chunks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.CreateIndex( + name: "IX_world_chunk_npc_spawns_NpcDefinitionId", + table: "world_chunk_npc_spawns", + column: "NpcDefinitionId"); + + migrationBuilder.CreateIndex( + name: "IX_world_chunk_npc_spawns_WorldChunkId_TileX_TileY_NpcDefinitio~", + table: "world_chunk_npc_spawns", + columns: new[] { "WorldChunkId", "TileX", "TileY", "NpcDefinitionId" }); + + migrationBuilder.CreateIndex( + name: "IX_world_chunk_objects_ObjectDefinitionId", + table: "world_chunk_objects", + column: "ObjectDefinitionId"); + + migrationBuilder.CreateIndex( + name: "IX_world_chunk_objects_WorldChunkId_TileX_TileY_ObjectDefinitio~", + table: "world_chunk_objects", + columns: new[] { "WorldChunkId", "TileX", "TileY", "ObjectDefinitionId" }); + + migrationBuilder.CreateIndex( + name: "IX_world_chunk_tiles_WorldChunkId_TileX_TileY", + table: "world_chunk_tiles", + columns: new[] { "WorldChunkId", "TileX", "TileY" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_world_chunks_WorldZoneId_ChunkX_ChunkY", + table: "world_chunks", + columns: new[] { "WorldZoneId", "ChunkX", "ChunkY" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_world_regions_Name", + table: "world_regions", + column: "Name", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_world_zones_RegionId_ZoneX_ZoneY", + table: "world_zones", + columns: new[] { "RegionId", "ZoneX", "ZoneY" }, + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "world_chunk_npc_spawns"); + + migrationBuilder.DropTable( + name: "world_chunk_objects"); + + migrationBuilder.DropTable( + name: "world_chunk_tiles"); + + migrationBuilder.DropTable( + name: "world_chunks"); + + migrationBuilder.DropTable( + name: "world_zones"); + + migrationBuilder.DropTable( + name: "world_regions"); + } + } +} diff --git a/Migrations/GameDbContextModelSnapshot.cs b/Migrations/GameDbContextModelSnapshot.cs index ec63ad0..5d5c463 100644 --- a/Migrations/GameDbContextModelSnapshot.cs +++ b/Migrations/GameDbContextModelSnapshot.cs @@ -1093,28 +1093,28 @@ namespace SystemRevivalServer.Migrations b.Property("DropChanceMultiplier") .HasColumnType("float"); + b.Property("GoldDropChance") + .HasColumnType("float"); + b.Property("GuaranteedDrop") .HasColumnType("tinyint(1)"); b.Property("IsEnabled") .HasColumnType("tinyint(1)"); - b.Property("GoldDropChance") - .HasColumnType("float"); - - b.Property("MaxGold") + b.Property("MaxDrops") .HasColumnType("int"); - b.Property("MaxDrops") + b.Property("MaxGold") .HasColumnType("int"); b.Property("MaxTier") .HasColumnType("int"); - b.Property("MinGold") + b.Property("MinDrops") .HasColumnType("int"); - b.Property("MinDrops") + b.Property("MinGold") .HasColumnType("int"); b.Property("MinTier") @@ -1367,14 +1367,14 @@ namespace SystemRevivalServer.Migrations b.Property("Defense") .HasColumnType("int"); - b.Property("Dexterity") - .HasColumnType("int"); - b.Property("Description") .IsRequired() .HasMaxLength(256) .HasColumnType("varchar(256)"); + b.Property("Dexterity") + .HasColumnType("int"); + b.Property("DialogTreeId") .HasColumnType("int"); @@ -1483,6 +1483,9 @@ namespace SystemRevivalServer.Migrations .HasMaxLength(128) .HasColumnType("varchar(128)"); + b.Property("RewardGold") + .HasColumnType("bigint"); + b.Property("RewardItemDefinitionId") .HasColumnType("int"); @@ -1493,9 +1496,6 @@ namespace SystemRevivalServer.Migrations .HasMaxLength(64) .HasColumnType("varchar(64)"); - b.Property("RewardGold") - .HasColumnType("bigint"); - b.Property("RewardType") .HasMaxLength(64) .HasColumnType("varchar(64)"); @@ -1526,6 +1526,9 @@ namespace SystemRevivalServer.Migrations b.Property("ConditionQuantity") .HasColumnType("int"); + b.Property("ConditionType") + .HasColumnType("int"); + b.Property("ConditionValue") .HasMaxLength(64) .HasColumnType("varchar(64)"); @@ -1533,9 +1536,6 @@ namespace SystemRevivalServer.Migrations b.Property("ConsumeConditionItem") .HasColumnType("tinyint(1)"); - b.Property("ConditionType") - .HasColumnType("int"); - b.Property("NextNodeId") .HasColumnType("int"); @@ -3098,6 +3098,236 @@ namespace SystemRevivalServer.Migrations b.ToTable("tile_templates"); }); + modelBuilder.Entity("DataServer.Data.Entities.WorldChunk", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ChunkX") + .HasColumnType("int"); + + b.Property("ChunkY") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("Version") + .HasColumnType("bigint"); + + b.Property("WorldZoneId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("WorldZoneId", "ChunkX", "ChunkY") + .IsUnique(); + + b.ToTable("world_chunks"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkNpcSpawn", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("MetadataJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("NpcDefinitionId") + .HasColumnType("int"); + + b.Property("Rotation") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("NpcDefinitionId"); + + b.HasIndex("WorldChunkId", "TileX", "TileY", "NpcDefinitionId"); + + b.ToTable("world_chunk_npc_spawns"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkObject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("MetadataJson") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ObjectDefinitionId") + .HasColumnType("int"); + + b.Property("Rotation") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ObjectDefinitionId"); + + b.HasIndex("WorldChunkId", "TileX", "TileY", "ObjectDefinitionId"); + + b.ToTable("world_chunk_objects"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkTile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("FrameIndex") + .HasColumnType("int"); + + b.Property("IsInvisiblePaywall") + .HasColumnType("tinyint(1)"); + + b.Property("IsWalkable") + .HasColumnType("tinyint(1)"); + + b.Property("SheetId") + .HasColumnType("int"); + + b.Property("TileX") + .HasColumnType("int"); + + b.Property("TileY") + .HasColumnType("int"); + + b.Property("WorldChunkId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("WorldChunkId", "TileX", "TileY") + .IsUnique(); + + b.ToTable("world_chunk_tiles"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldRegion", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ChunkHeightTiles") + .HasColumnType("int"); + + b.Property("ChunkWidthTiles") + .HasColumnType("int"); + + b.Property("ChunksPerZoneX") + .HasColumnType("int"); + + b.Property("ChunksPerZoneY") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ZonesPerRegionX") + .HasColumnType("int"); + + b.Property("ZonesPerRegionY") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("world_regions"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldZone", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("IsEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("RegionId") + .HasColumnType("int"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("ZoneX") + .HasColumnType("int"); + + b.Property("ZoneY") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RegionId", "ZoneX", "ZoneY") + .IsUnique(); + + b.ToTable("world_zones"); + }); + modelBuilder.Entity("DataServer.Data.Session", b => { b.Property("Id") @@ -3694,6 +3924,77 @@ namespace SystemRevivalServer.Migrations b.Navigation("PrimaryTileDefinition"); }); + modelBuilder.Entity("DataServer.Data.Entities.WorldChunk", b => + { + b.HasOne("DataServer.Data.Entities.WorldZone", "Zone") + .WithMany() + .HasForeignKey("WorldZoneId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Zone"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkNpcSpawn", b => + { + b.HasOne("DataServer.Data.Entities.DungeonNpcDefinition", "NpcDefinition") + .WithMany() + .HasForeignKey("NpcDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + + b.Navigation("NpcDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkObject", b => + { + b.HasOne("DataServer.Data.Entities.DungeonObjectDefinition", "ObjectDefinition") + .WithMany() + .HasForeignKey("ObjectDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + + b.Navigation("ObjectDefinition"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldChunkTile", b => + { + b.HasOne("DataServer.Data.Entities.WorldChunk", "Chunk") + .WithMany() + .HasForeignKey("WorldChunkId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Chunk"); + }); + + modelBuilder.Entity("DataServer.Data.Entities.WorldZone", b => + { + b.HasOne("DataServer.Data.Entities.WorldRegion", "Region") + .WithMany() + .HasForeignKey("RegionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Region"); + }); + modelBuilder.Entity("DataServer.Data.Session", b => { b.HasOne("DataServer.Data.Account", "Account") @@ -3740,6 +4041,11 @@ namespace SystemRevivalServer.Migrations b.Navigation("Entries"); }); + modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => + { + b.Navigation("AbilityAssignments"); + }); + modelBuilder.Entity("DataServer.Data.Entities.DungeonNpcDialogNode", b => { b.Navigation("Options"); @@ -3755,11 +4061,6 @@ namespace SystemRevivalServer.Migrations b.Navigation("Items"); }); - modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b => - { - b.Navigation("AbilityAssignments"); - }); - modelBuilder.Entity("DataServer.Data.Entities.MobSpriteSheet", b => { b.Navigation("Animations"); diff --git a/Services/Admin/Pages/Shared/_Layout.cshtml b/Services/Admin/Pages/Shared/_Layout.cshtml index cd45d3c..292f991 100644 --- a/Services/Admin/Pages/Shared/_Layout.cshtml +++ b/Services/Admin/Pages/Shared/_Layout.cshtml @@ -160,6 +160,10 @@ Dungeons + + + World Editor + Players diff --git a/Services/Admin/Pages/WorldEditor/Index.cshtml b/Services/Admin/Pages/WorldEditor/Index.cshtml new file mode 100644 index 0000000..8a7691c --- /dev/null +++ b/Services/Admin/Pages/WorldEditor/Index.cshtml @@ -0,0 +1,532 @@ +@page "/admin/worldeditor" +@model GameServices.Admin.Pages.WorldEditor.IndexModel +@using System.Text.Json +@{ + ViewData["Title"] = "World Editor"; + + var regionsJson = JsonSerializer.Serialize(Model.Regions.Select(r => new + { + id = r.Id, + name = r.Name, + zonesX = r.ZonesPerRegionX, + zonesY = r.ZonesPerRegionY, + chunksPerZoneX = r.ChunksPerZoneX, + chunksPerZoneY = r.ChunksPerZoneY, + chunkWidthTiles = r.ChunkWidthTiles, + chunkHeightTiles = r.ChunkHeightTiles + })); + + var sheetsJson = JsonSerializer.Serialize(Model.TileSheets.Select(s => new + { + id = s.Id, + name = s.Name, + path = s.CdnPath, + tileW = s.TileWidth, + tileH = s.TileHeight, + cols = s.Columns, + sheetW = s.SheetWidth, + sheetH = s.SheetHeight + })); + + var objectsJson = JsonSerializer.Serialize(Model.ObjectDefinitions.Select(o => new { id = o.Id, name = o.Name })); + var npcsJson = JsonSerializer.Serialize(Model.NpcDefinitions.Select(n => new { id = n.Id, name = n.Name })); +} + + + +@section Scripts { + +} diff --git a/Services/Admin/Pages/WorldEditor/Index.cshtml.cs b/Services/Admin/Pages/WorldEditor/Index.cshtml.cs new file mode 100644 index 0000000..1d992ef --- /dev/null +++ b/Services/Admin/Pages/WorldEditor/Index.cshtml.cs @@ -0,0 +1,624 @@ +using DataServer.Data; +using DataServer.Data.Entities; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace GameServices.Admin.Pages.WorldEditor; + +public class IndexModel : AdminPageModel +{ + private readonly GameDbContext _db; + + public IndexModel(GameDbContext db) + { + _db = db; + } + + public List Regions { get; set; } = new(); + public List TileSheets { get; set; } = new(); + public List ObjectDefinitions { get; set; } = new(); + public List NpcDefinitions { get; set; } = new(); + + public int SelectedRegionId { get; set; } + public int SelectedZoneX { get; set; } + public int SelectedZoneY { get; set; } + public int SelectedChunkX { get; set; } + public int SelectedChunkY { get; set; } + + public async Task OnGetAsync(int? regionId, int zoneX = 0, int zoneY = 0, int chunkX = 0, int chunkY = 0) + { + await EnsureDefaultRegionAsync(); + + Regions = await _db.WorldRegions + .Where(r => r.IsEnabled) + .OrderBy(r => r.Id) + .ToListAsync(); + + var selected = Regions.FirstOrDefault(r => r.Id == regionId) ?? Regions.First(); + SelectedRegionId = selected.Id; + SelectedZoneX = Math.Clamp(zoneX, 0, Math.Max(0, selected.ZonesPerRegionX - 1)); + SelectedZoneY = Math.Clamp(zoneY, 0, Math.Max(0, selected.ZonesPerRegionY - 1)); + SelectedChunkX = Math.Clamp(chunkX, 0, Math.Max(0, selected.ChunksPerZoneX - 1)); + SelectedChunkY = Math.Clamp(chunkY, 0, Math.Max(0, selected.ChunksPerZoneY - 1)); + + await EnsureZonesAsync(selected); + + TileSheets = await _db.TileMapSheets + .Where(s => s.IsEnabled) + .OrderBy(s => s.Name) + .ToListAsync(); + + ObjectDefinitions = await _db.DungeonObjects + .Where(o => o.IsEnabled) + .OrderBy(o => o.Name) + .ToListAsync(); + + NpcDefinitions = await _db.DungeonNpcDefinitions + .Where(n => n.IsEnabled) + .OrderBy(n => n.Name) + .ToListAsync(); + } + + public async Task OnGetRegionAsync(int regionId) + { + var region = await _db.WorldRegions.FirstOrDefaultAsync(r => r.Id == regionId && r.IsEnabled); + if (region == null) + { + return new JsonResult(new { success = false, error = "region_not_found" }) { StatusCode = 404 }; + } + + await EnsureZonesAsync(region); + + var zones = await _db.WorldZones + .Where(z => z.RegionId == region.Id && z.IsEnabled) + .OrderBy(z => z.ZoneY).ThenBy(z => z.ZoneX) + .ToListAsync(); + + var zoneIds = zones.Select(z => z.Id).ToList(); + var chunkCounts = await _db.WorldChunks + .Where(c => zoneIds.Contains(c.WorldZoneId)) + .GroupBy(c => c.WorldZoneId) + .Select(g => new { ZoneId = g.Key, Count = g.Count() }) + .ToDictionaryAsync(x => x.ZoneId, x => x.Count); + + return new JsonResult(new + { + success = true, + region = new + { + id = region.Id, + name = region.Name, + zonesX = region.ZonesPerRegionX, + zonesY = region.ZonesPerRegionY, + chunksPerZoneX = region.ChunksPerZoneX, + chunksPerZoneY = region.ChunksPerZoneY, + chunkWidthTiles = region.ChunkWidthTiles, + chunkHeightTiles = region.ChunkHeightTiles + }, + zones = zones.Select(z => new + { + id = z.Id, + zoneX = z.ZoneX, + zoneY = z.ZoneY, + name = z.Name, + editedChunkCount = chunkCounts.GetValueOrDefault(z.Id) + }) + }); + } + + public async Task OnGetZoneAsync(int regionId, int zoneX, int zoneY) + { + var region = await _db.WorldRegions.FirstOrDefaultAsync(r => r.Id == regionId && r.IsEnabled); + if (region == null) + { + return new JsonResult(new { success = false, error = "region_not_found" }) { StatusCode = 404 }; + } + + if (!IsInside(region.ZonesPerRegionX, region.ZonesPerRegionY, zoneX, zoneY)) + { + return new JsonResult(new { success = false, error = "zone_out_of_bounds" }) { StatusCode = 400 }; + } + + await EnsureZonesAsync(region); + var zone = await _db.WorldZones.FirstAsync(z => z.RegionId == regionId && z.ZoneX == zoneX && z.ZoneY == zoneY); + + var chunks = await _db.WorldChunks + .Where(c => c.WorldZoneId == zone.Id) + .Select(c => new { c.ChunkX, c.ChunkY, c.Version }) + .ToListAsync(); + + return new JsonResult(new + { + success = true, + zone = new + { + id = zone.Id, + regionId, + zoneX, + zoneY, + chunksPerZoneX = region.ChunksPerZoneX, + chunksPerZoneY = region.ChunksPerZoneY + }, + chunks + }); + } + + public async Task OnGetChunkAsync(int regionId, int zoneX, int zoneY, int chunkX, int chunkY) + { + var locate = await GetOrCreateChunkAsync(regionId, zoneX, zoneY, chunkX, chunkY); + if (!locate.Success || locate.Region == null || locate.Zone == null || locate.Chunk == null) + { + return new JsonResult(new { success = false, error = locate.Error }) { StatusCode = 400 }; + } + + var chunk = locate.Chunk; + var region = locate.Region; + + var tiles = await _db.WorldChunkTiles + .Where(t => t.WorldChunkId == chunk.Id) + .OrderBy(t => t.TileY).ThenBy(t => t.TileX) + .Select(t => new + { + id = t.Id, + x = t.TileX, + y = t.TileY, + sheetId = t.SheetId, + frameIndex = t.FrameIndex, + isWalkable = t.IsWalkable, + isInvisiblePaywall = t.IsInvisiblePaywall + }) + .ToListAsync(); + + var objects = await _db.WorldChunkObjects + .Include(o => o.ObjectDefinition) + .Where(o => o.WorldChunkId == chunk.Id) + .OrderBy(o => o.TileY).ThenBy(o => o.TileX) + .Select(o => new + { + id = o.Id, + x = o.TileX, + y = o.TileY, + objectDefinitionId = o.ObjectDefinitionId, + objectName = o.ObjectDefinition != null ? o.ObjectDefinition.Name : $"Object {o.ObjectDefinitionId}", + rotation = o.Rotation, + metadataJson = o.MetadataJson + }) + .ToListAsync(); + + var npcs = await _db.WorldChunkNpcSpawns + .Include(n => n.NpcDefinition) + .Where(n => n.WorldChunkId == chunk.Id) + .OrderBy(n => n.TileY).ThenBy(n => n.TileX) + .Select(n => new + { + id = n.Id, + x = n.TileX, + y = n.TileY, + npcDefinitionId = n.NpcDefinitionId, + npcName = n.NpcDefinition != null ? n.NpcDefinition.Name : $"NPC {n.NpcDefinitionId}", + rotation = n.Rotation, + metadataJson = n.MetadataJson + }) + .ToListAsync(); + + return new JsonResult(new + { + success = true, + chunk = new + { + id = chunk.Id, + regionId, + zoneX, + zoneY, + chunkX, + chunkY, + version = chunk.Version, + width = region.ChunkWidthTiles, + height = region.ChunkHeightTiles + }, + tiles, + objects, + npcs + }); + } + + public async Task OnPostUpsertTileAsync( + int regionId, + int zoneX, + int zoneY, + int chunkX, + int chunkY, + int x, + int y, + int sheetId, + int frameIndex, + bool isWalkable, + bool isInvisiblePaywall) + { + var locate = await GetOrCreateChunkAsync(regionId, zoneX, zoneY, chunkX, chunkY); + if (!locate.Success || locate.Region == null || locate.Chunk == null) + { + return new JsonResult(new { success = false, error = locate.Error }) { StatusCode = 400 }; + } + + if (!IsInside(locate.Region.ChunkWidthTiles, locate.Region.ChunkHeightTiles, x, y)) + { + return new JsonResult(new { success = false, error = "tile_out_of_bounds" }) { StatusCode = 400 }; + } + + var sheetExists = await _db.TileMapSheets.AnyAsync(s => s.Id == sheetId && s.IsEnabled); + if (!sheetExists) + { + return new JsonResult(new { success = false, error = "sheet_not_found" }) { StatusCode = 404 }; + } + + var tile = await _db.WorldChunkTiles + .FirstOrDefaultAsync(t => t.WorldChunkId == locate.Chunk.Id && t.TileX == x && t.TileY == y); + + if (tile == null) + { + tile = new WorldChunkTile + { + WorldChunkId = locate.Chunk.Id, + TileX = x, + TileY = y + }; + _db.WorldChunkTiles.Add(tile); + } + + tile.SheetId = sheetId; + tile.FrameIndex = frameIndex; + tile.IsWalkable = isWalkable; + tile.IsInvisiblePaywall = isInvisiblePaywall; + + locate.Chunk.Version++; + locate.Chunk.UpdatedAt = DateTime.UtcNow; + await _db.SaveChangesAsync(); + + return new JsonResult(new + { + success = true, + chunkVersion = locate.Chunk.Version, + op = new + { + type = "tile_upsert", + x, + y, + sheetId, + frameIndex, + isWalkable, + isInvisiblePaywall + } + }); + } + + public async Task OnPostRemoveTileAsync(int regionId, int zoneX, int zoneY, int chunkX, int chunkY, int x, int y) + { + var locate = await GetOrCreateChunkAsync(regionId, zoneX, zoneY, chunkX, chunkY); + if (!locate.Success || locate.Chunk == null) + { + return new JsonResult(new { success = false, error = locate.Error }) { StatusCode = 400 }; + } + + var tile = await _db.WorldChunkTiles + .FirstOrDefaultAsync(t => t.WorldChunkId == locate.Chunk.Id && t.TileX == x && t.TileY == y); + if (tile != null) + { + _db.WorldChunkTiles.Remove(tile); + locate.Chunk.Version++; + locate.Chunk.UpdatedAt = DateTime.UtcNow; + await _db.SaveChangesAsync(); + } + + return new JsonResult(new + { + success = true, + chunkVersion = locate.Chunk.Version, + op = new { type = "tile_remove", x, y } + }); + } + + public async Task OnPostUpsertObjectAsync( + int regionId, + int zoneX, + int zoneY, + int chunkX, + int chunkY, + long? id, + int objectDefinitionId, + int x, + int y, + int rotation = 0, + string? metadataJson = null) + { + var locate = await GetOrCreateChunkAsync(regionId, zoneX, zoneY, chunkX, chunkY); + if (!locate.Success || locate.Region == null || locate.Chunk == null) + { + return new JsonResult(new { success = false, error = locate.Error }) { StatusCode = 400 }; + } + + if (!IsInside(locate.Region.ChunkWidthTiles, locate.Region.ChunkHeightTiles, x, y)) + { + return new JsonResult(new { success = false, error = "tile_out_of_bounds" }) { StatusCode = 400 }; + } + + var objectExists = await _db.DungeonObjects.AnyAsync(o => o.Id == objectDefinitionId && o.IsEnabled); + if (!objectExists) + { + return new JsonResult(new { success = false, error = "object_definition_not_found" }) { StatusCode = 404 }; + } + + WorldChunkObject obj; + if (id.HasValue) + { + obj = await _db.WorldChunkObjects.FirstOrDefaultAsync(o => o.Id == id.Value && o.WorldChunkId == locate.Chunk.Id) + ?? new WorldChunkObject { WorldChunkId = locate.Chunk.Id }; + if (obj.Id == 0) + { + _db.WorldChunkObjects.Add(obj); + } + } + else + { + obj = new WorldChunkObject { WorldChunkId = locate.Chunk.Id }; + _db.WorldChunkObjects.Add(obj); + } + + obj.ObjectDefinitionId = objectDefinitionId; + obj.TileX = x; + obj.TileY = y; + obj.Rotation = rotation; + obj.MetadataJson = string.IsNullOrWhiteSpace(metadataJson) ? null : metadataJson.Trim(); + + locate.Chunk.Version++; + locate.Chunk.UpdatedAt = DateTime.UtcNow; + await _db.SaveChangesAsync(); + + return new JsonResult(new + { + success = true, + chunkVersion = locate.Chunk.Version, + op = new + { + type = "object_upsert", + id = obj.Id, + x = obj.TileX, + y = obj.TileY, + objectDefinitionId = obj.ObjectDefinitionId, + rotation = obj.Rotation, + metadataJson = obj.MetadataJson + } + }); + } + + public async Task OnPostRemoveObjectAsync(int regionId, int zoneX, int zoneY, int chunkX, int chunkY, long id) + { + var locate = await GetOrCreateChunkAsync(regionId, zoneX, zoneY, chunkX, chunkY); + if (!locate.Success || locate.Chunk == null) + { + return new JsonResult(new { success = false, error = locate.Error }) { StatusCode = 400 }; + } + + var obj = await _db.WorldChunkObjects.FirstOrDefaultAsync(o => o.Id == id && o.WorldChunkId == locate.Chunk.Id); + if (obj != null) + { + _db.WorldChunkObjects.Remove(obj); + locate.Chunk.Version++; + locate.Chunk.UpdatedAt = DateTime.UtcNow; + await _db.SaveChangesAsync(); + } + + return new JsonResult(new + { + success = true, + chunkVersion = locate.Chunk.Version, + op = new { type = "object_remove", id } + }); + } + + public async Task OnPostUpsertNpcAsync( + int regionId, + int zoneX, + int zoneY, + int chunkX, + int chunkY, + long? id, + int npcDefinitionId, + int x, + int y, + int rotation = 0, + string? metadataJson = null) + { + var locate = await GetOrCreateChunkAsync(regionId, zoneX, zoneY, chunkX, chunkY); + if (!locate.Success || locate.Region == null || locate.Chunk == null) + { + return new JsonResult(new { success = false, error = locate.Error }) { StatusCode = 400 }; + } + + if (!IsInside(locate.Region.ChunkWidthTiles, locate.Region.ChunkHeightTiles, x, y)) + { + return new JsonResult(new { success = false, error = "tile_out_of_bounds" }) { StatusCode = 400 }; + } + + var npcExists = await _db.DungeonNpcDefinitions.AnyAsync(n => n.Id == npcDefinitionId && n.IsEnabled); + if (!npcExists) + { + return new JsonResult(new { success = false, error = "npc_definition_not_found" }) { StatusCode = 404 }; + } + + WorldChunkNpcSpawn npc; + if (id.HasValue) + { + npc = await _db.WorldChunkNpcSpawns.FirstOrDefaultAsync(n => n.Id == id.Value && n.WorldChunkId == locate.Chunk.Id) + ?? new WorldChunkNpcSpawn { WorldChunkId = locate.Chunk.Id }; + if (npc.Id == 0) + { + _db.WorldChunkNpcSpawns.Add(npc); + } + } + else + { + npc = new WorldChunkNpcSpawn { WorldChunkId = locate.Chunk.Id }; + _db.WorldChunkNpcSpawns.Add(npc); + } + + npc.NpcDefinitionId = npcDefinitionId; + npc.TileX = x; + npc.TileY = y; + npc.Rotation = rotation; + npc.MetadataJson = string.IsNullOrWhiteSpace(metadataJson) ? null : metadataJson.Trim(); + + locate.Chunk.Version++; + locate.Chunk.UpdatedAt = DateTime.UtcNow; + await _db.SaveChangesAsync(); + + return new JsonResult(new + { + success = true, + chunkVersion = locate.Chunk.Version, + op = new + { + type = "npc_upsert", + id = npc.Id, + x = npc.TileX, + y = npc.TileY, + npcDefinitionId = npc.NpcDefinitionId, + rotation = npc.Rotation, + metadataJson = npc.MetadataJson + } + }); + } + + public async Task OnPostRemoveNpcAsync(int regionId, int zoneX, int zoneY, int chunkX, int chunkY, long id) + { + var locate = await GetOrCreateChunkAsync(regionId, zoneX, zoneY, chunkX, chunkY); + if (!locate.Success || locate.Chunk == null) + { + return new JsonResult(new { success = false, error = locate.Error }) { StatusCode = 400 }; + } + + var npc = await _db.WorldChunkNpcSpawns.FirstOrDefaultAsync(n => n.Id == id && n.WorldChunkId == locate.Chunk.Id); + if (npc != null) + { + _db.WorldChunkNpcSpawns.Remove(npc); + locate.Chunk.Version++; + locate.Chunk.UpdatedAt = DateTime.UtcNow; + await _db.SaveChangesAsync(); + } + + return new JsonResult(new + { + success = true, + chunkVersion = locate.Chunk.Version, + op = new { type = "npc_remove", id } + }); + } + + private async Task EnsureDefaultRegionAsync() + { + if (await _db.WorldRegions.AnyAsync()) + return; + + _db.WorldRegions.Add(new WorldRegion + { + Name = "Default Region", + ZonesPerRegionX = 4, + ZonesPerRegionY = 4, + ChunksPerZoneX = 8, + ChunksPerZoneY = 8, + ChunkWidthTiles = 64, + ChunkHeightTiles = 64, + IsEnabled = true, + CreatedAt = DateTime.UtcNow, + UpdatedAt = DateTime.UtcNow + }); + await _db.SaveChangesAsync(); + } + + private async Task EnsureZonesAsync(WorldRegion region) + { + var existing = await _db.WorldZones + .Where(z => z.RegionId == region.Id) + .Select(z => new { z.ZoneX, z.ZoneY }) + .ToListAsync(); + + var existingSet = existing.Select(z => $"{z.ZoneX}:{z.ZoneY}").ToHashSet(); + var now = DateTime.UtcNow; + var added = false; + for (var y = 0; y < region.ZonesPerRegionY; y++) + { + for (var x = 0; x < region.ZonesPerRegionX; x++) + { + if (existingSet.Contains($"{x}:{y}")) + continue; + + _db.WorldZones.Add(new WorldZone + { + RegionId = region.Id, + ZoneX = x, + ZoneY = y, + Name = $"Zone {x},{y}", + IsEnabled = true, + CreatedAt = now, + UpdatedAt = now + }); + added = true; + } + } + + if (added) + { + await _db.SaveChangesAsync(); + } + } + + private async Task<(bool Success, string? Error, WorldRegion? Region, WorldZone? Zone, WorldChunk? Chunk)> GetOrCreateChunkAsync( + int regionId, + int zoneX, + int zoneY, + int chunkX, + int chunkY) + { + var region = await _db.WorldRegions.FirstOrDefaultAsync(r => r.Id == regionId && r.IsEnabled); + if (region == null) + return (false, "region_not_found", null, null, null); + + if (!IsInside(region.ZonesPerRegionX, region.ZonesPerRegionY, zoneX, zoneY)) + return (false, "zone_out_of_bounds", region, null, null); + + if (!IsInside(region.ChunksPerZoneX, region.ChunksPerZoneY, chunkX, chunkY)) + return (false, "chunk_out_of_bounds", region, null, null); + + await EnsureZonesAsync(region); + + var zone = await _db.WorldZones + .FirstOrDefaultAsync(z => z.RegionId == regionId && z.ZoneX == zoneX && z.ZoneY == zoneY && z.IsEnabled); + if (zone == null) + return (false, "zone_not_found", region, null, null); + + var chunk = await _db.WorldChunks + .FirstOrDefaultAsync(c => c.WorldZoneId == zone.Id && c.ChunkX == chunkX && c.ChunkY == chunkY); + + if (chunk == null) + { + chunk = new WorldChunk + { + WorldZoneId = zone.Id, + ChunkX = chunkX, + ChunkY = chunkY, + Version = 1, + CreatedAt = DateTime.UtcNow, + UpdatedAt = DateTime.UtcNow + }; + _db.WorldChunks.Add(chunk); + await _db.SaveChangesAsync(); + } + + return (true, null, region, zone, chunk); + } + + private static bool IsInside(int width, int height, int x, int y) + { + return x >= 0 && y >= 0 && x < width && y < height; + } +} diff --git a/data/DesignTimeDbContextFactory.cs b/data/DesignTimeDbContextFactory.cs index 7de71f1..57d90a4 100644 --- a/data/DesignTimeDbContextFactory.cs +++ b/data/DesignTimeDbContextFactory.cs @@ -24,7 +24,8 @@ public sealed class DesignTimeDbContextFactory : IDesignTimeDbContextFactory() - .UseMySql(cs, ServerVersion.AutoDetect(cs)) + // Keep design-time independent of live DB connectivity. + .UseMySql(cs, new MySqlServerVersion(new Version(8, 0, 36))) .Options; return new GameDbContext(opts); diff --git a/data/GameDbContext.cs b/data/GameDbContext.cs index f98ebec..9ccb281 100644 --- a/data/GameDbContext.cs +++ b/data/GameDbContext.cs @@ -79,6 +79,14 @@ public sealed class GameDbContext : DbContext public DbSet DungeonNpcDialogTrees => Set(); public DbSet DungeonNpcDialogNodes => Set(); public DbSet DungeonNpcDialogOptions => Set(); + + // Overworld system + public DbSet WorldRegions => Set(); + public DbSet WorldZones => Set(); + public DbSet WorldChunks => Set(); + public DbSet WorldChunkTiles => Set(); + public DbSet WorldChunkObjects => Set(); + public DbSet WorldChunkNpcSpawns => Set(); protected override void OnModelCreating(ModelBuilder b) { diff --git a/data/entities/WorldEntities.cs b/data/entities/WorldEntities.cs new file mode 100644 index 0000000..7ff12a1 --- /dev/null +++ b/data/entities/WorldEntities.cs @@ -0,0 +1,198 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace DataServer.Data.Entities; + +[Table("world_regions")] +public class WorldRegion +{ + [Key] + public int Id { get; set; } + + [Required] + [MaxLength(64)] + public string Name { get; set; } = ""; + + public int ZonesPerRegionX { get; set; } = 4; + public int ZonesPerRegionY { get; set; } = 4; + public int ChunksPerZoneX { get; set; } = 8; + public int ChunksPerZoneY { get; set; } = 8; + public int ChunkWidthTiles { get; set; } = 64; + public int ChunkHeightTiles { get; set; } = 64; + + public bool IsEnabled { get; set; } = true; + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; +} + +[Table("world_zones")] +public class WorldZone +{ + [Key] + public long Id { get; set; } + + public int RegionId { get; set; } + [ForeignKey(nameof(RegionId))] + public WorldRegion? Region { get; set; } + + public int ZoneX { get; set; } + public int ZoneY { get; set; } + + [MaxLength(64)] + public string Name { get; set; } = ""; + + public bool IsEnabled { get; set; } = true; + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; +} + +[Table("world_chunks")] +public class WorldChunk +{ + [Key] + public long Id { get; set; } + + public long WorldZoneId { get; set; } + [ForeignKey(nameof(WorldZoneId))] + public WorldZone? Zone { get; set; } + + public int ChunkX { get; set; } + public int ChunkY { get; set; } + public long Version { get; set; } = 1; + + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; +} + +[Table("world_chunk_tiles")] +public class WorldChunkTile +{ + [Key] + public long Id { get; set; } + + public long WorldChunkId { get; set; } + [ForeignKey(nameof(WorldChunkId))] + public WorldChunk? Chunk { get; set; } + + public int TileX { get; set; } + public int TileY { get; set; } + + public int SheetId { get; set; } + public int FrameIndex { get; set; } + public bool IsWalkable { get; set; } = true; + public bool IsInvisiblePaywall { get; set; } = false; +} + +[Table("world_chunk_objects")] +public class WorldChunkObject +{ + [Key] + public long Id { get; set; } + + public long WorldChunkId { get; set; } + [ForeignKey(nameof(WorldChunkId))] + public WorldChunk? Chunk { get; set; } + + public int ObjectDefinitionId { get; set; } + [ForeignKey(nameof(ObjectDefinitionId))] + public DungeonObjectDefinition? ObjectDefinition { get; set; } + + public int TileX { get; set; } + public int TileY { get; set; } + public int Rotation { get; set; } + + [MaxLength(1024)] + public string? MetadataJson { get; set; } +} + +[Table("world_chunk_npc_spawns")] +public class WorldChunkNpcSpawn +{ + [Key] + public long Id { get; set; } + + public long WorldChunkId { get; set; } + [ForeignKey(nameof(WorldChunkId))] + public WorldChunk? Chunk { get; set; } + + public int NpcDefinitionId { get; set; } + [ForeignKey(nameof(NpcDefinitionId))] + public DungeonNpcDefinition? NpcDefinition { get; set; } + + public int TileX { get; set; } + public int TileY { get; set; } + public int Rotation { get; set; } + + [MaxLength(1024)] + public string? MetadataJson { get; set; } +} + +public sealed class WorldRegionConfig : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder e) + { + e.HasIndex(x => x.Name).IsUnique(); + } +} + +public sealed class WorldZoneConfig : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder e) + { + e.HasIndex(x => new { x.RegionId, x.ZoneX, x.ZoneY }).IsUnique(); + e.HasOne(x => x.Region) + .WithMany() + .HasForeignKey(x => x.RegionId) + .OnDelete(DeleteBehavior.Cascade); + } +} + +public sealed class WorldChunkConfig : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder e) + { + e.HasIndex(x => new { x.WorldZoneId, x.ChunkX, x.ChunkY }).IsUnique(); + e.HasOne(x => x.Zone) + .WithMany() + .HasForeignKey(x => x.WorldZoneId) + .OnDelete(DeleteBehavior.Cascade); + } +} + +public sealed class WorldChunkTileConfig : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder e) + { + e.HasIndex(x => new { x.WorldChunkId, x.TileX, x.TileY }).IsUnique(); + e.HasOne(x => x.Chunk) + .WithMany() + .HasForeignKey(x => x.WorldChunkId) + .OnDelete(DeleteBehavior.Cascade); + } +} + +public sealed class WorldChunkObjectConfig : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder e) + { + e.HasIndex(x => new { x.WorldChunkId, x.TileX, x.TileY, x.ObjectDefinitionId }); + e.HasOne(x => x.Chunk) + .WithMany() + .HasForeignKey(x => x.WorldChunkId) + .OnDelete(DeleteBehavior.Cascade); + } +} + +public sealed class WorldChunkNpcSpawnConfig : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder e) + { + e.HasIndex(x => new { x.WorldChunkId, x.TileX, x.TileY, x.NpcDefinitionId }); + e.HasOne(x => x.Chunk) + .WithMany() + .HasForeignKey(x => x.WorldChunkId) + .OnDelete(DeleteBehavior.Cascade); + } +}