286 lines
15 KiB
C#
286 lines
15 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace SystemRevivalServer.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class NpcSystemAndLootTableGold : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<float>(
|
|
name: "GoldDropChance",
|
|
table: "dungeon_loot_tables",
|
|
type: "float",
|
|
nullable: false,
|
|
defaultValue: 0f);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "MaxGold",
|
|
table: "dungeon_loot_tables",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false),
|
|
Description = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false),
|
|
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false),
|
|
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
DialogTreeId = table.Column<int>(type: "int", nullable: false),
|
|
NodeKey = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false),
|
|
Text = table.Column<string>(type: "varchar(2048)", maxLength: 2048, nullable: false),
|
|
IsRoot = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
IsTerminal = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
RewardType = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true),
|
|
RewardItemDefinitionId = table.Column<int>(type: "int", nullable: true),
|
|
RewardItemQuantity = table.Column<int>(type: "int", nullable: false),
|
|
RewardGold = table.Column<long>(type: "bigint", nullable: false),
|
|
RewardXp = table.Column<long>(type: "bigint", nullable: false),
|
|
RewardQuestKey = table.Column<string>(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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
ShopId = table.Column<int>(type: "int", nullable: false),
|
|
SlotIndex = table.Column<int>(type: "int", nullable: false),
|
|
ItemDefinitionId = table.Column<int>(type: "int", nullable: false),
|
|
Quantity = table.Column<int>(type: "int", nullable: false),
|
|
PriceGold = table.Column<long>(type: "bigint", nullable: false),
|
|
Restocks = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
RestockIntervalSeconds = table.Column<int>(type: "int", nullable: false),
|
|
LastRestockAt = table.Column<DateTime>(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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false),
|
|
Key = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false),
|
|
Description = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false),
|
|
Level = table.Column<int>(type: "int", nullable: false),
|
|
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
IsKillable = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
CanShop = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
HasDialog = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
CanWander = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
BehaviorMode = table.Column<int>(type: "int", nullable: false),
|
|
OnAttackBehavior = table.Column<int>(type: "int", nullable: false),
|
|
MaxHealth = table.Column<int>(type: "int", nullable: false),
|
|
AttackPower = table.Column<int>(type: "int", nullable: false),
|
|
Defense = table.Column<int>(type: "int", nullable: false),
|
|
Strength = table.Column<int>(type: "int", nullable: false),
|
|
Dexterity = table.Column<int>(type: "int", nullable: false),
|
|
Intelligence = table.Column<int>(type: "int", nullable: false),
|
|
Wisdom = table.Column<int>(type: "int", nullable: false),
|
|
Endurance = table.Column<int>(type: "int", nullable: false),
|
|
ResistancesJson = table.Column<string>(type: "varchar(2048)", maxLength: 2048, nullable: false),
|
|
SpriteConfigJson = table.Column<string>(type: "varchar(4096)", maxLength: 4096, nullable: true),
|
|
TintColor = table.Column<string>(type: "varchar(16)", maxLength: 16, nullable: false),
|
|
Scale = table.Column<float>(type: "float", nullable: false),
|
|
WanderRadiusPx = table.Column<float>(type: "float", nullable: false),
|
|
WanderIntervalSeconds = table.Column<float>(type: "float", nullable: false),
|
|
LootTableId = table.Column<int>(type: "int", nullable: true),
|
|
ShopId = table.Column<int>(type: "int", nullable: true),
|
|
DialogTreeId = table.Column<int>(type: "int", nullable: true),
|
|
AbilityDefinitionIdsJson = table.Column<string>(type: "varchar(2048)", maxLength: 2048, nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(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<int>(type: "int", nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
NodeId = table.Column<int>(type: "int", nullable: false),
|
|
PlayerText = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false),
|
|
NextNodeId = table.Column<int>(type: "int", nullable: true),
|
|
ConditionType = table.Column<int>(type: "int", nullable: false),
|
|
ConditionValue = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true),
|
|
ConditionQuantity = table.Column<int>(type: "int", nullable: false),
|
|
ConsumeConditionItem = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
|
SortOrder = table.Column<int>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
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");
|
|
}
|
|
}
|
|
}
|
|
|