爬塔前置条件判断

This commit is contained in:
meixiongfeng 2023-09-14 14:23:43 +08:00
parent a1f7e39c9e
commit b98daf11fa

View File

@ -15,7 +15,7 @@ import (
type ModuleRobot_Pagoda struct { type ModuleRobot_Pagoda struct {
pagoda *pb.DBPagoda pagoda *pb.DBPagoda
_mapPagoda map[int32]*cfg.GamePagodaData _mapPagoda map[int32]*cfg.GamePagodaData
//mainline *ModuleRobot_MainLine mainline *ModuleRobot_MainLine
} }
func (this *ModuleRobot_Pagoda) Init() (err error) { func (this *ModuleRobot_Pagoda) Init() (err error) {
@ -33,7 +33,7 @@ func (this *ModuleRobot_Pagoda) Init() (err error) {
} }
} }
//this.mainline = robot.GetModule(comm.ModuleMainline).(*ModuleRobot_MainLine) //
return return
} }
@ -71,18 +71,20 @@ func (this *ModuleRobot_Pagoda) DoPipeline(robot IRobot) (err error) {
) )
heromodule := robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero) heromodule := robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero)
heros := heromodule.getbattlehero() heros := heromodule.getbattlehero()
this.mainline = robot.GetModule(comm.ModuleMainline).(*ModuleRobot_MainLine)
this.pagoda.PagodaId += 1 this.pagoda.PagodaId += 1
// 校验能不能打 // 校验能不能打
if c, e := this.getPagodaDataById(this.pagoda.PagodaId); e != nil { // 参数有误 if c, e := this.getPagodaDataById(this.pagoda.PagodaId); e != nil { // 参数有误
return return
} else { } else {
if c.Unlock != 0 { if c.Unlock != 0 {
this.pagoda.PagodaId -= 1 if _, ok := this.mainline.info.Level[c.Unlock]; !ok {
return
} }
} }
if this.pagoda.PagodaId == 0 {
this.pagoda.PagodaId = 1
} }
if resp, errdata = robot.SendMessage("pagoda", "challenge", &pb.PagodaChallengeReq{ if resp, errdata = robot.SendMessage("pagoda", "challenge", &pb.PagodaChallengeReq{
Cid: +1, Cid: +1,
Battle: &pb.BattleFormation{ Battle: &pb.BattleFormation{