feat(game): 宠物融合系统添加物品消耗异常处理 - 在宠物融合过程中添加物品扣除失败的错误检查 - 当物品不足时返回ErrInsufficientItems错误码 fix(pet): 宠物仓库管理功能增加数据库操作错误处理 - 在宠物释放到仓库和从仓库取出时验证数据库更新结果 - 添加宠物背包切换功能的错误检查机制 feat(fight):
This commit is contained in:
@@ -66,7 +66,10 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result
|
||||
// utils.CountSliceElements(data.Item1[:])
|
||||
|
||||
for _, v := range data.Item1 {
|
||||
c.Service.Item.UPDATE(v, -1)
|
||||
err := c.Service.Item.UPDATE(v, -1)
|
||||
if err != nil {
|
||||
return result, errorcode.ErrorCodes.ErrInsufficientItems
|
||||
}
|
||||
|
||||
}
|
||||
result = &pet.PetFusionInfo{
|
||||
|
||||
@@ -85,7 +85,9 @@ func (h Controller) PetReleaseToWarehouse(
|
||||
return nil, errorcode.ErrorCodes.ErrCannotReleaseNonWarehouse
|
||||
}
|
||||
|
||||
player.Service.Pet.UPdateFree(data.CatchTime, 1)
|
||||
if !player.Service.Pet.UPdateFree(data.CatchTime, 1) {
|
||||
return nil, errorcode.ErrorCodes.ErrSystemError
|
||||
}
|
||||
return nil, err
|
||||
|
||||
}
|
||||
@@ -96,7 +98,10 @@ func (h Controller) PetRetrieveFromWarehouse(
|
||||
|
||||
//如果背包没找到,再放入背包
|
||||
if _, _, ok := player.FindPet(data.CatchTime); !ok {
|
||||
player.Service.Pet.UPdateFree(data.CatchTime, 0)
|
||||
if !player.Service.Pet.UPdateFree(data.CatchTime, 0) {
|
||||
return nil, errorcode.ErrorCodes.ErrSystemError
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil, 0
|
||||
@@ -127,7 +132,10 @@ func (h Controller) TogglePetBagWarehouse(
|
||||
if index < 0 || index >= len(player.Info.PetList) {
|
||||
return result, errorcode.ErrorCodes.ErrPokemonIDMismatch
|
||||
}
|
||||
player.Service.Pet.UPdate(*pet)
|
||||
err := player.Service.Pet.UPdate(*pet)
|
||||
if err != nil {
|
||||
return result, errorcode.ErrorCodes.ErrSystemError
|
||||
}
|
||||
|
||||
player.Info.PetList = append(player.Info.PetList[:index], player.Info.PetList[index+1:]...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user