diff --git a/logic/controller/PET_FUSION.go b/logic/controller/PET_FUSION.go index 73a85d2a3..5897e85a5 100644 --- a/logic/controller/PET_FUSION.go +++ b/logic/controller/PET_FUSION.go @@ -15,6 +15,7 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result if !c.UseCoins(1000) { return result, errorcode.ErrorCodes.ErrSystemBusy } + // g.Dump(c.Info.PetList) //防止同一只 if data.Mcatchtime == data.Auxcatchtime { @@ -37,7 +38,7 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result if xmlres.PetMAP[int(Auxpetinfo.ID)].FuseSub == 0 { return result, errorcode.ErrorCodes.ErrPokemonNotFusionReady3 } - + //println(len(c.Info.PetList), data.Mcatchtime, data.Auxcatchtime, Mcatchpetinfo.CatchTime, Auxpetinfo.CatchTime) ///性格生成 var natureId int32 = -1 if Auxpetinfo.Nature == Mcatchpetinfo.Nature { @@ -58,8 +59,11 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result r := model.GenPetInfo(resid, int(dv), int(natureId), effect, -1, 1) r.OldCatchTime = Mcatchpetinfo.CatchTime c.Service.Pet.PetAdd(r) - c.Pet_del(Auxpetinfo.CatchTime) - c.Pet_del(Mcatchpetinfo.CatchTime) + println(len(c.Info.PetList), data.Mcatchtime, data.Auxcatchtime, Mcatchpetinfo.CatchTime, Auxpetinfo.CatchTime) + c.Pet_del(data.Auxcatchtime) + c.Pet_del(data.Mcatchtime) + //fmt.Println(len(c.Info.PetList)) + // g.Dump(c.Info.PetList) //todo材料扣除 return &pet.PetFusionInfo{ ObtainTime: r.CatchTime, diff --git a/logic/service/fight/loop.go b/logic/service/fight/loop.go index 790133bc6..0aeaa3795 100644 --- a/logic/service/fight/loop.go +++ b/logic/service/fight/loop.go @@ -76,7 +76,7 @@ func (f *FightC) battleLoop() { f.Our.Player.(*player.Player).Service.Pet.PetAdd(&f.Opp.Player.GetInfo().PetList[0]) f.Our.Player.SendPackCmd(2409, &info.CatchMonsterOutboundInfo{ - CatchTime: uint32(f.Opp.CurrentPet.Info.CatchTime), + CatchTime: uint32(f.Opp.Player.GetInfo().PetList[0].CatchTime), PetId: uint32(f.Opp.CurrentPet.ID), }) //f.Reason = 0 //清空 diff --git a/logic/service/player/base.go b/logic/service/player/base.go index f34711293..9d1ec60dd 100644 --- a/logic/service/player/base.go +++ b/logic/service/player/base.go @@ -51,13 +51,15 @@ func (f *baseplayer) FindPet(CatchTime uint32) (int, *model.PetInfo, bool) { }) } func (f *Player) Pet_del(CatchTime uint32) { - + //println("删除精灵1", CatchTime) index, _, ok := f.FindPet(CatchTime) if ok { - f.Info.PetList = append(f.Info.PetList[:index], f.Info.PetList[index+1:]...) + // println("删除精灵", CatchTime) + copy(f.Info.PetList[index:], f.Info.PetList[index+1:]) + f.Info.PetList = f.Info.PetList[:len(f.Info.PetList)-1] + f.Service.Pet.Pet_del(CatchTime) } - f.Service.Pet.Pet_del(CatchTime) } // // 计算整数的二进制1的个数(Integer.bitCount) diff --git a/modules/base/service/base_sys_user.go b/modules/base/service/base_sys_user.go index c6f927cac..efb8e40cd 100644 --- a/modules/base/service/base_sys_user.go +++ b/modules/base/service/base_sys_user.go @@ -308,7 +308,8 @@ func NewBaseSysUserService() *BaseSysUserService { Extend: func(ctx g.Ctx, m *gdb.Model) *gdb.Model { return m.Group(`base_sys_user.id`) }, - KeyWordField: []string{"username", "email", "id"}, + KeyWordField: []string{"username", "email"}, + FieldEQ: []string{"id"}, }, }, } diff --git a/modules/blazing/service/pet.go b/modules/blazing/service/pet.go index 0ab9e90cd..d1f194ca3 100644 --- a/modules/blazing/service/pet.go +++ b/modules/blazing/service/pet.go @@ -67,6 +67,7 @@ func (s *PetService) PetAdd(y *model.PetInfo) { _, err := m1.Insert(player) if err != nil { + fmt.Println("添加失败id自增1继续添加") y.CatchTime += 1 //自增保持时间排序 continue } @@ -111,12 +112,12 @@ func NewPetService(userid uint32) *PetService { if userId != 10001 { return [][]interface{}{ {"player_id", userId, true}, - {"free", 0, true}, + {"free", 1, true}, } } else { return [][]interface{}{ {"player_id", userId, true}, - {"free", 0, true}, + {"free", 1, true}, } }