diff --git a/modules/robot/modulerobot_pagoda.go b/modules/robot/modulerobot_pagoda.go index 49b8ac7d8..765d9b78b 100644 --- a/modules/robot/modulerobot_pagoda.go +++ b/modules/robot/modulerobot_pagoda.go @@ -15,6 +15,7 @@ import ( type ModuleRobot_Pagoda struct { pagoda *pb.DBPagoda _mapPagoda map[int32]*cfg.GamePagodaData + //mainline *ModuleRobot_MainLine } func (this *ModuleRobot_Pagoda) Init() (err error) { @@ -31,6 +32,9 @@ func (this *ModuleRobot_Pagoda) Init() (err error) { return } } + + //this.mainline = robot.GetModule(comm.ModuleMainline).(*ModuleRobot_MainLine) + return } @@ -67,9 +71,20 @@ func (this *ModuleRobot_Pagoda) DoPipeline(robot IRobot) (err error) { ) heromodule := robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero) heros := heromodule.getbattlehero() - + this.pagoda.PagodaId += 1 + // 校验能不能打 + if c, e := this.getPagodaDataById(this.pagoda.PagodaId); e != nil { // 参数有误 + return + } else { + if c.Unlock != 0 { + this.pagoda.PagodaId -= 1 + } + } + if this.pagoda.PagodaId == 0 { + this.pagoda.PagodaId = 1 + } if resp, errdata = robot.SendMessage("pagoda", "challenge", &pb.PagodaChallengeReq{ - Cid: this.pagoda.PagodaId + 1, + Cid: +1, Battle: &pb.BattleFormation{ Format: heros, }}); errdata != nil { @@ -151,3 +166,19 @@ func (this *ModuleRobot_Pagoda) getPagodaData(tab int32, lv int32) (conf *cfg.Ga err = comm.NewNotFoundConfErr("robot", game_buriedcondi, fmt.Sprintf("tab:%d,lv:%d", tab, lv)) return } + +func (this *ModuleRobot_Pagoda) getPagodaDataById(id int32) (conf *cfg.GamePagodaData, err error) { + var ( + v interface{} + ) + if v, err = configure.GetConfigure(game_pagoda); err != nil { + return + } else { + conf = v.(*cfg.GamePagoda).Get(id) + if conf != nil { + return + } + } + err = comm.NewNotFoundConfErr("robot", game_buriedcondi, id) + return +}