Add action gathering functionality: implement ActionGathered model and repository, update Pet model and services, and enhance GameItemsRepository with item retrieval methods.
This commit is contained in:
409
Migrations/20250209234852_InitialCreate.cs
Normal file
409
Migrations/20250209234852_InitialCreate.cs
Normal file
@@ -0,0 +1,409 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace PetCompanion.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "GameItems",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Rarity = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Description = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Price = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Effect = table.Column<string>(type: "TEXT", nullable: false),
|
||||
EquipTarget = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_GameItems", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Pets",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Class = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Level = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Health = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
MaxHealth = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
UserId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
IsDead = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||
PetGatherAction = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
GatherActionSince = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||
PetBasicAction = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
BasicActionCooldown = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Pets", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Skills",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Description = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Type = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Icon = table.Column<string>(type: "TEXT", nullable: false),
|
||||
SkillsIdRequired = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Skills", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ActionGathered",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Resource = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ItemId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Amount = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ActionGathered", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ActionGathered_GameItems_ItemId",
|
||||
column: x => x.ItemId,
|
||||
principalTable: "GameItems",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_ActionGathered_Pets_PetId",
|
||||
column: x => x.PetId,
|
||||
principalTable: "Pets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EquippedItems",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
EquipTarget = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
GameItemId = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EquippedItems", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EquippedItems_GameItems_GameItemId",
|
||||
column: x => x.GameItemId,
|
||||
principalTable: "GameItems",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_EquippedItems_Pets_PetId",
|
||||
column: x => x.PetId,
|
||||
principalTable: "Pets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Inventories",
|
||||
columns: table => new
|
||||
{
|
||||
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Items = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Capacity = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Inventories", x => x.PetId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Inventories_Pets_PetId",
|
||||
column: x => x.PetId,
|
||||
principalTable: "Pets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PetStats",
|
||||
columns: table => new
|
||||
{
|
||||
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Intelligence = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Strength = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Charisma = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Luck = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Agility = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Perception = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
MaxIntelligence = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
MaxStrength = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
MaxCharisma = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PetStats", x => x.PetId);
|
||||
table.ForeignKey(
|
||||
name: "FK_PetStats_Pets_PetId",
|
||||
column: x => x.PetId,
|
||||
principalTable: "Pets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Resources",
|
||||
columns: table => new
|
||||
{
|
||||
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Wisdom = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Gold = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Food = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Junk = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Resources", x => x.PetId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Resources_Pets_PetId",
|
||||
column: x => x.PetId,
|
||||
principalTable: "Pets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PetSkills",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
SkillId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
CurrentTier = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PetSkills", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_PetSkills_Pets_PetId",
|
||||
column: x => x.PetId,
|
||||
principalTable: "Pets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_PetSkills_Skills_SkillId",
|
||||
column: x => x.SkillId,
|
||||
principalTable: "Skills",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SkillEffects",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
SkillId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Tier = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Effect = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Value = table.Column<decimal>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SkillEffects", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SkillEffects_Skills_SkillId",
|
||||
column: x => x.SkillId,
|
||||
principalTable: "Skills",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SkillRequirement",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
SkillId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Resource = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Cost = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SkillRequirement", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SkillRequirement_Skills_SkillId",
|
||||
column: x => x.SkillId,
|
||||
principalTable: "Skills",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Skills",
|
||||
columns: new[] { "Id", "Description", "Icon", "Name", "SkillsIdRequired", "Type" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "Increases maximum health of your pet, making it more resilient.", "❤", "Vitality Mastery", null, 0 },
|
||||
{ 2, "Increases maximum intelligence of your pet, improving its learning capabilities.", "🧠", "Mind Enhancement", null, 0 },
|
||||
{ 3, "Increases maximum strength of your pet, making it more powerful.", "💪", "Strength Training", null, 0 },
|
||||
{ 4, "Increases maximum charisma of your pet, making it more charming.", "🎭", "Charisma Boost", null, 0 },
|
||||
{ 5, "Increases luck of your pet, making it more fortunate to find rare items.", "🍀", "Luck of the Draw", "[4]", 0 },
|
||||
{ 6, "Increases agility of your pet, making it faster in combat.", "🏃", "Agility Training", "[3]", 0 },
|
||||
{ 7, "Increases perception of your pet, making it more aware of its surroundings.", "👀", "Perception Boost", "[2]", 0 },
|
||||
{ 8, "Increases the amount of resources gathered by your pet.", "📦", "Resourcefulness", "[5,6,7]", 1 }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "SkillEffects",
|
||||
columns: new[] { "Id", "Effect", "SkillId", "Tier", "Value" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, "MaxHealth", 1, 1, 25m },
|
||||
{ 2, "MaxHealth", 1, 2, 50m },
|
||||
{ 3, "MaxHealth", 1, 3, 100m },
|
||||
{ 4, "MaxIntelligence", 2, 1, 5m },
|
||||
{ 5, "MaxIntelligence", 2, 2, 10m },
|
||||
{ 6, "MaxIntelligence", 2, 3, 20m },
|
||||
{ 7, "MaxStrength", 3, 1, 5m },
|
||||
{ 8, "MaxStrength", 3, 2, 10m },
|
||||
{ 9, "MaxStrength", 3, 3, 20m },
|
||||
{ 10, "MaxCharisma", 4, 1, 5m },
|
||||
{ 11, "MaxCharisma", 4, 2, 10m },
|
||||
{ 12, "MaxCharisma", 4, 3, 20m },
|
||||
{ 13, "Luck", 5, 1, 1m },
|
||||
{ 14, "Luck", 5, 2, 2m },
|
||||
{ 15, "Luck", 5, 3, 3m },
|
||||
{ 16, "Agility", 6, 1, 1m },
|
||||
{ 17, "Agility", 6, 2, 2m },
|
||||
{ 18, "Agility", 6, 3, 3m },
|
||||
{ 19, "Perception", 7, 1, 1m },
|
||||
{ 20, "Perception", 7, 2, 2m },
|
||||
{ 21, "Perception", 7, 3, 3m },
|
||||
{ 22, "Resourcefulness", 8, 1, 1m },
|
||||
{ 23, "Resourcefulness", 8, 2, 2m },
|
||||
{ 24, "Resourcefulness", 8, 3, 3m }
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "SkillRequirement",
|
||||
columns: new[] { "Id", "Cost", "Resource", "SkillId" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ 1, 100, "Wisdom", 1 },
|
||||
{ 2, 150, "Food", 1 },
|
||||
{ 3, 150, "Wisdom", 2 },
|
||||
{ 4, 100, "Gold", 3 },
|
||||
{ 5, 150, "Food", 3 },
|
||||
{ 6, 200, "Wisdom", 4 },
|
||||
{ 7, 200, "Gold", 5 },
|
||||
{ 8, 200, "Gold", 6 },
|
||||
{ 9, 100, "Gold", 7 },
|
||||
{ 10, 100, "Junk", 7 },
|
||||
{ 11, 500, "Gold", 8 },
|
||||
{ 12, 500, "Junk", 8 },
|
||||
{ 13, 300, "Wisdom", 8 },
|
||||
{ 14, 300, "Food", 8 }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ActionGathered_ItemId",
|
||||
table: "ActionGathered",
|
||||
column: "ItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ActionGathered_PetId",
|
||||
table: "ActionGathered",
|
||||
column: "PetId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EquippedItems_GameItemId",
|
||||
table: "EquippedItems",
|
||||
column: "GameItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EquippedItems_PetId",
|
||||
table: "EquippedItems",
|
||||
column: "PetId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PetSkills_PetId",
|
||||
table: "PetSkills",
|
||||
column: "PetId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PetSkills_SkillId",
|
||||
table: "PetSkills",
|
||||
column: "SkillId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SkillEffects_SkillId",
|
||||
table: "SkillEffects",
|
||||
column: "SkillId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SkillRequirement_SkillId",
|
||||
table: "SkillRequirement",
|
||||
column: "SkillId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ActionGathered");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EquippedItems");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Inventories");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PetSkills");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "PetStats");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Resources");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SkillEffects");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SkillRequirement");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "GameItems");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Pets");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Skills");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user