not working inventory :c

This commit is contained in:
2025-02-04 17:47:18 -03:00
parent f234b5d84d
commit 7a2c3d2f67
22 changed files with 2713 additions and 49 deletions
+17 -7
View File
@@ -1,5 +1,5 @@
using System.ComponentModel.DataAnnotations;
using PetCompanion.Models.Enums;
using System.ComponentModel.DataAnnotations.Schema;
namespace PetCompanion.Models
{
@@ -11,7 +11,6 @@ namespace PetCompanion.Models
public PetClass Class { get; set; }
public PetStats Stats { get; set; }
public Resources Resources { get; set; }
public Inventory Inventory { get; set; }
public int Level { get; set; }
public int Experience { get; set; }
public int Health { get; set; }
@@ -25,19 +24,30 @@ namespace PetCompanion.Models
public PetBasicAction PetBasicAction { get; set; }
public DateTime BasicActionCooldown { get; set; }
public Dictionary<EquipmentSlot, EquipableItem> Equipment { get; set; } = new();
public int SkillPoints { get; set; } = 2;
public virtual ICollection<PetSkill> Skills { get; set; } = new List<PetSkill>();
public Pet()
public virtual Inventory Inventory { get; set; }
[NotMapped]
public Dictionary<ItemEquipTarget, int> EquippedItems
{
foreach (EquipmentSlot slot in Enum.GetValues(typeof(EquipmentSlot)))
get => EquippedItemsList?.ToDictionary(e => e.EquipTarget, e => e.GameItemId) ?? new Dictionary<ItemEquipTarget, int>();
set
{
Equipment[slot] = null;
EquippedItemsList = value.Select(kvp => new EquippedItem
{
PetId = Id,
EquipTarget = kvp.Key,
GameItemId = kvp.Value
}).ToList();
}
}
public virtual ICollection<EquippedItem> EquippedItemsList { get; set; } = new List<EquippedItem>();
public Pet() { }
public void IncrementIntelligence(int amount)
{
var newValue = Stats.Intelligence + amount;