``` refactor(pet): 优化宠物特性随机逻辑并修复宠物删除数组操作
This commit is contained in:
@@ -68,8 +68,8 @@ func (f *baseplayer) FindPet(catchTime uint32) (int, *model.PetInfo, bool) {
|
||||
func (f *Player) PetDel(catchTime uint32) {
|
||||
index, olpet, ok := f.FindPet(catchTime)
|
||||
if ok {
|
||||
copy(f.Info.PetList[index:], f.Info.PetList[index+1:])
|
||||
f.Info.PetList = f.Info.PetList[:len(f.Info.PetList)-1]
|
||||
f.Info.PetList = append(f.Info.PetList[:index], f.Info.PetList[index+1:]...)
|
||||
|
||||
//先将背包更新
|
||||
f.Service.Pet.PetInfo_One_exec(catchTime, func(petData *model.PetEX) {
|
||||
petData.Data = *olpet
|
||||
|
||||
Reference in New Issue
Block a user