fix(pet_skill): 修复宠物技能设置中的变量引用错误

- 修复了 SetPetSkill 函数中使用错误变量名的问题
- 将 onpet 替换为正确的 currentPet 变量引用
- 确保技能学习范围和技能列表检查使用正确的宠物对象
```
This commit is contained in:
2025-12-24 19:04:21 +08:00
parent d9112c1510
commit 61ffa9c640

View File

@@ -26,7 +26,7 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re
if !ok {
return nil, errorcode.ErrorCodes.ErrSystemBusy
}
canleaernskill := onpet.GetLevelRangeCanLearningSkills(1, onpet.Level)
canleaernskill := currentPet.GetLevelRangeCanLearningSkills(1, currentPet.Level)
_, ok = lo.Find(canleaernskill, func(item uint32) bool {
return item == data.ReplaceSkill
@@ -35,7 +35,7 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re
if !ok {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
_, _, ok = utils.FindWithIndex(onpet.SkillList, func(item model.SkillInfo) bool { //已经存在技能
_, _, ok = utils.FindWithIndex(currentPet.SkillList, func(item model.SkillInfo) bool { //已经存在技能
return item.ID == data.ReplaceSkill
})
if ok {