连续自动战斗 自动使用体力药剂

This commit is contained in:
meixiongfeng 2023-06-08 11:39:39 +08:00
parent 2f34d17669
commit 3fe6c89068
2 changed files with 27 additions and 32 deletions

View File

@ -80,22 +80,19 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
"ps": hunting.Ps,
})
}
// if errdata = this.module.CheckRes(session, cfgData.PsConsume); errdata != nil {
// if req.AutoBuy { // 不够的时候看是否能自动购买
// var count int32
// for _, v := range cfgData.PsConsume {
// if v.N > 0 {
// count += v.N
// }
// }
// if errdata = this.module.ModuleItems.BuyUnifiedTicket(session, count); errdata != nil {
// return
// }
// } else {
// code = pb.ErrorCode_VikingMaxChallengeCount
// return
// }
// }
if errdata = this.module.CheckRes(session, cfgData.PsConsume); errdata != nil {
if req.AutoBuy { // 不够的时候看是否能自动购买
resSell := this.module.ModuleTools.GetGlobalConf().PsItem
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{resSell}); errdata != nil {
return
}
m := make(map[string]int32, 0)
m[resSell.T] = resSell.N
this.module.ModuleItems.SellItem(session, m, true)
} else {
return
}
}
value, ok := hunting.Boss[req.BossType]
if !ok { // 类型校验

View File

@ -69,22 +69,20 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
})
}
// if errdata = this.module.CheckRes(session, cfgData.PsConsume); errdata != nil {
// if req.AutoBuy { // 不够的时候自动使用
// var count int32
// for _, v := range cfgData.PsConsume {
// if v.N > 0 {
// count += v.N
// }
// }
// if errdata = this.module.ModuleItems.BuyUnifiedTicket(session, count); errdata != nil {
// return
// }
// } else {
// code = pb.ErrorCode_VikingMaxChallengeCount
// return
// }
// }
if errdata = this.module.CheckRes(session, cfgData.PsConsume); errdata != nil {
if req.AutoBuy { // 不够的时候自动使用
resSell := this.module.ModuleTools.GetGlobalConf().PsItem
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{resSell}); errdata != nil {
return
}
m := make(map[string]int32, 0)
m[resSell.T] = resSell.N
this.module.ModuleItems.SellItem(session, m, true)
} else { // 体力不够
return
}
}
if req.Difficulty == 1 && viking.Boss[req.BossId] == 0 { // 当前难度第一次打
viking.Boss[req.BossId] = 1