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:
2025-02-09 21:22:52 -03:00
parent 653cc451d2
commit 215d4ecb72
18 changed files with 481 additions and 41 deletions

22
Models/ActionGathered.cs Normal file
View File

@@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace PetCompanion.Models
{
public class ActionGathered
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public int Id { get; set; }
[ForeignKey("Pet")]
public string PetId { get; set; }
public string? Resource { get; set; }
[ForeignKey("GameItem")]
public int? ItemId { get; set; }
public int Amount { get; set; }
[JsonIgnore]
public virtual Pet Pet { get; set; }
public virtual GameItem? GameItem { get; set; }
}
}

View File

@@ -27,6 +27,8 @@ namespace PetCompanion.Models
public virtual Inventory Inventory { get; set; }
public virtual ICollection<EquippedItem> EquippedItemsList { get; set; } = new List<EquippedItem>();
public virtual ICollection<ActionGathered> ActionGathered { get; set; } = new List<ActionGathered>();
[NotMapped]
public Dictionary<ItemEquipTarget, int> EquippedItems
{

View File

@@ -14,5 +14,7 @@
GATHERING_WISDOM,
GATHERING_GOLD,
GATHERING_FOOD,
EXPLORE,
BATTLE
}
}