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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user