using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SystemRevivalServer.Migrations { /// public partial class NPCS : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "GoldDropChance", table: "dungeon_loot_tables", type: "float", nullable: false, defaultValue: 0f); migrationBuilder.AddColumn( name: "MaxGold", table: "dungeon_loot_tables", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "MinGold", table: "dungeon_loot_tables", type: "int", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "dungeon_npc_dialog_trees", 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), Description = table.Column(type: "varchar(256)", maxLength: 256, 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_dungeon_npc_dialog_trees", x => x.Id); }); migrationBuilder.CreateTable( name: "dungeon_npc_shops", 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), 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_dungeon_npc_shops", x => x.Id); }); migrationBuilder.CreateTable( name: "dungeon_npc_dialog_nodes", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), DialogTreeId = table.Column(type: "int", nullable: false), NodeKey = table.Column(type: "varchar(128)", maxLength: 128, nullable: false), Text = table.Column(type: "varchar(2048)", maxLength: 2048, nullable: false), IsRoot = table.Column(type: "tinyint(1)", nullable: false), IsTerminal = table.Column(type: "tinyint(1)", nullable: false), RewardType = table.Column(type: "varchar(64)", maxLength: 64, nullable: true), RewardItemDefinitionId = table.Column(type: "int", nullable: true), RewardItemQuantity = table.Column(type: "int", nullable: false), RewardGold = table.Column(type: "bigint", nullable: false), RewardXp = table.Column(type: "bigint", nullable: false), RewardQuestKey = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) }, constraints: table => { table.PrimaryKey("PK_dungeon_npc_dialog_nodes", x => x.Id); table.ForeignKey( name: "FK_dungeon_npc_dialog_nodes_dungeon_npc_dialog_trees_DialogTreeId", column: x => x.DialogTreeId, principalTable: "dungeon_npc_dialog_trees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "dungeon_npc_shop_items", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), ShopId = table.Column(type: "int", nullable: false), SlotIndex = table.Column(type: "int", nullable: false), ItemDefinitionId = table.Column(type: "int", nullable: false), Quantity = table.Column(type: "int", nullable: false), PriceGold = table.Column(type: "bigint", nullable: false), Restocks = table.Column(type: "tinyint(1)", nullable: false), RestockIntervalSeconds = table.Column(type: "int", nullable: false), LastRestockAt = table.Column(type: "datetime(6)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_dungeon_npc_shop_items", x => x.Id); table.ForeignKey( name: "FK_dungeon_npc_shop_items_dungeon_item_definitions_ItemDefinitionId", column: x => x.ItemDefinitionId, principalTable: "dungeon_item_definitions", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_dungeon_npc_shop_items_dungeon_npc_shops_ShopId", column: x => x.ShopId, principalTable: "dungeon_npc_shops", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "dungeon_npc_definitions", 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), Key = table.Column(type: "varchar(64)", maxLength: 64, nullable: false), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false), Level = table.Column(type: "int", nullable: false), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), IsKillable = table.Column(type: "tinyint(1)", nullable: false), CanShop = table.Column(type: "tinyint(1)", nullable: false), HasDialog = table.Column(type: "tinyint(1)", nullable: false), CanWander = table.Column(type: "tinyint(1)", nullable: false), BehaviorMode = table.Column(type: "int", nullable: false), OnAttackBehavior = table.Column(type: "int", nullable: false), MaxHealth = table.Column(type: "int", nullable: false), AttackPower = table.Column(type: "int", nullable: false), Defense = table.Column(type: "int", nullable: false), Strength = table.Column(type: "int", nullable: false), Dexterity = table.Column(type: "int", nullable: false), Intelligence = table.Column(type: "int", nullable: false), Wisdom = table.Column(type: "int", nullable: false), Endurance = table.Column(type: "int", nullable: false), ResistancesJson = table.Column(type: "varchar(2048)", maxLength: 2048, nullable: false), SpriteConfigJson = table.Column(type: "varchar(4096)", maxLength: 4096, nullable: true), TintColor = table.Column(type: "varchar(16)", maxLength: 16, nullable: false), Scale = table.Column(type: "float", nullable: false), WanderRadiusPx = table.Column(type: "float", nullable: false), WanderIntervalSeconds = table.Column(type: "float", nullable: false), LootTableId = table.Column(type: "int", nullable: true), ShopId = table.Column(type: "int", nullable: true), DialogTreeId = table.Column(type: "int", nullable: true), AbilityDefinitionIdsJson = table.Column(type: "varchar(2048)", maxLength: 2048, nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(type: "datetime(6)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_npc_definitions", x => x.Id); table.ForeignKey( name: "FK_dungeon_npc_definitions_dungeon_loot_tables_LootTableId", column: x => x.LootTableId, principalTable: "dungeon_loot_tables", principalColumn: "Id"); table.ForeignKey( name: "FK_dungeon_npc_definitions_dungeon_npc_dialog_trees_DialogTreeId", column: x => x.DialogTreeId, principalTable: "dungeon_npc_dialog_trees", principalColumn: "Id"); table.ForeignKey( name: "FK_dungeon_npc_definitions_dungeon_npc_shops_ShopId", column: x => x.ShopId, principalTable: "dungeon_npc_shops", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "dungeon_npc_dialog_options", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), NodeId = table.Column(type: "int", nullable: false), PlayerText = table.Column(type: "varchar(256)", maxLength: 256, nullable: false), NextNodeId = table.Column(type: "int", nullable: true), ConditionType = table.Column(type: "int", nullable: false), ConditionValue = table.Column(type: "varchar(64)", maxLength: 64, nullable: true), ConditionQuantity = table.Column(type: "int", nullable: false), ConsumeConditionItem = table.Column(type: "tinyint(1)", nullable: false), SortOrder = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_dungeon_npc_dialog_options", x => x.Id); table.ForeignKey( name: "FK_dungeon_npc_dialog_options_dungeon_npc_dialog_nodes_NodeId", column: x => x.NodeId, principalTable: "dungeon_npc_dialog_nodes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_dungeon_npc_definitions_DialogTreeId", table: "dungeon_npc_definitions", column: "DialogTreeId"); migrationBuilder.CreateIndex( name: "IX_dungeon_npc_definitions_LootTableId", table: "dungeon_npc_definitions", column: "LootTableId"); migrationBuilder.CreateIndex( name: "IX_dungeon_npc_definitions_ShopId", table: "dungeon_npc_definitions", column: "ShopId"); migrationBuilder.CreateIndex( name: "IX_dungeon_npc_dialog_nodes_DialogTreeId", table: "dungeon_npc_dialog_nodes", column: "DialogTreeId"); migrationBuilder.CreateIndex( name: "IX_dungeon_npc_dialog_options_NodeId", table: "dungeon_npc_dialog_options", column: "NodeId"); migrationBuilder.CreateIndex( name: "IX_dungeon_npc_shop_items_ItemDefinitionId", table: "dungeon_npc_shop_items", column: "ItemDefinitionId"); migrationBuilder.CreateIndex( name: "IX_dungeon_npc_shop_items_ShopId", table: "dungeon_npc_shop_items", column: "ShopId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "dungeon_npc_definitions"); migrationBuilder.DropTable( name: "dungeon_npc_dialog_options"); migrationBuilder.DropTable( name: "dungeon_npc_shop_items"); migrationBuilder.DropTable( name: "dungeon_npc_dialog_nodes"); migrationBuilder.DropTable( name: "dungeon_npc_shops"); migrationBuilder.DropTable( name: "dungeon_npc_dialog_trees"); migrationBuilder.DropColumn( name: "GoldDropChance", table: "dungeon_loot_tables"); migrationBuilder.DropColumn( name: "MaxGold", table: "dungeon_loot_tables"); migrationBuilder.DropColumn( name: "MinGold", table: "dungeon_loot_tables"); } } }