```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(item-use): 完善玄彩道具使用逻辑并添加宠物闪亮状态修复功能

- 在玄彩道具使用过程中添加闪亮状态修复检查,确保道具使用前宠物状态正常
- 修改FixShiny方法返回布尔值以指示操作是否成功
- 当物品不足时返回ErrItemUnusable错误码
- 调整代码执行顺序,先进行闪亮状态修复再更新物品数量
```
This commit is contained in:
昔念
2026-03-04 14:12:48 +08:00
parent fc8fc1ed8d
commit 5874ae270f
2 changed files with 9 additions and 3 deletions

View File

@@ -102,8 +102,13 @@ func (h Controller) handlexuancaiItem(currentPet *model.PetInfo, c *player.Playe
if items < 100 {
return errorcode.ErrorCodes.ErrInsufficientItems
}
ok := currentPet.FixShiny()
if !ok {
return errorcode.ErrorCodes.ErrItemUnusable
}
c.Service.Item.UPDATE(uint32(items), -100)
currentPet.FixShiny()
return 0
}

View File

@@ -245,13 +245,14 @@ func (pet *PetInfo) Cure() {
}
// 强制选色,这个是给熔炉用的
func (pet *PetInfo) FixShiny() {
func (pet *PetInfo) FixShiny() bool {
co := service.NewShinyService().RandShiny(pet.ID)
if co != nil {
pet.ShinyInfo = []data.GlowFilter{*co}
return true
}
return false
}
// 比重融合