Refactor inventory unequip logic to use item ID instead of equip target; update README for inventory and skill tree progress

This commit is contained in:
2025-02-05 20:37:12 -03:00
parent 5289910270
commit f553196ca0
5 changed files with 32 additions and 17 deletions

View File

@@ -32,6 +32,7 @@ namespace PetCompanion.Services
if (pet.SkillPoints <= 0)
throw new Exception("No skill points available");
var skill = _petSkillRepository.GetSkill(skillId);
var skills = _petSkillRepository.GetPetSkills(petId);
var existingSkill = skills.FirstOrDefault(s => s.SkillId == skillId);
@@ -45,6 +46,11 @@ namespace PetCompanion.Services
}
else
{
if (!skill.SkillsIdRequired.TrueForAll(ni => pet.Skills.Any(s => s.SkillId == ni)))
{
throw new Exception("Missing required skill");
}
existingSkill = new PetSkill
{
PetId = petId,