爬塔战斗
This commit is contained in:
parent
a5e480e6ff
commit
05c56d6e00
@ -50,11 +50,41 @@ func (this *ModuleRobot_Pagoda) Receive(robot IRobot, stype string, message prot
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (this *ModuleRobot_Pagoda) OncePipeline(robot IRobot) (err error) {
|
func (this *ModuleRobot_Pagoda) OncePipeline(robot IRobot) (err error) {
|
||||||
|
|
||||||
|
if _, errdata := robot.SendMessage("pagoda", "getlist", &pb.PagodaGetListReq{}); errdata != nil {
|
||||||
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//机器人执行流
|
//机器人执行流
|
||||||
func (this *ModuleRobot_Pagoda) DoPipeline(robot IRobot) (err error) {
|
func (this *ModuleRobot_Pagoda) DoPipeline(robot IRobot) (err error) {
|
||||||
|
var (
|
||||||
|
resp proto.Message
|
||||||
|
errdata *pb.ErrorData
|
||||||
|
)
|
||||||
|
heromodule := robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero)
|
||||||
|
heros := heromodule.getbattlehero()
|
||||||
|
|
||||||
|
if resp, errdata = robot.SendMessage("pagoda", "challenge", &pb.PagodaChallengeReq{
|
||||||
|
Cid: this.pagoda.PagodaId + 1,
|
||||||
|
Battle: &pb.BattleFormation{
|
||||||
|
Format: heros,
|
||||||
|
}}); errdata != nil {
|
||||||
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if _, errdata = robot.SendMessage("pagoda", "challengeover", &pb.PagodaChallengeOverReq{
|
||||||
|
Cid: this.pagoda.PagodaId + 1,
|
||||||
|
Report: &pb.BattleReport{
|
||||||
|
Info: resp.(*pb.PagodaChallengeResp).Info,
|
||||||
|
WinSide: 1,
|
||||||
|
}}); errdata != nil {
|
||||||
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
|
return
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@ func (this *ModuleRobot_Viking) OncePipeline(robot IRobot) (err error) {
|
|||||||
|
|
||||||
//机器人执行流
|
//机器人执行流
|
||||||
func (this *ModuleRobot_Viking) DoPipeline(robot IRobot) (err error) {
|
func (this *ModuleRobot_Viking) DoPipeline(robot IRobot) (err error) {
|
||||||
|
var (
|
||||||
|
resp proto.Message
|
||||||
|
errdata *pb.ErrorData
|
||||||
|
)
|
||||||
// 获取爬塔信息
|
// 获取爬塔信息
|
||||||
if _, errdata := robot.SendMessage("viking", "getlist", &pb.VikingGetListReq{}); errdata != nil {
|
if _, errdata := robot.SendMessage("viking", "getlist", &pb.VikingGetListReq{}); errdata != nil {
|
||||||
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
@ -58,7 +62,7 @@ func (this *ModuleRobot_Viking) DoPipeline(robot IRobot) (err error) {
|
|||||||
bossid = 1
|
bossid = 1
|
||||||
difficulty = 1
|
difficulty = 1
|
||||||
}
|
}
|
||||||
if _, errdata := robot.SendMessage("viking", "challenge", &pb.VikingChallengeReq{
|
if resp, errdata = robot.SendMessage("viking", "challenge", &pb.VikingChallengeReq{
|
||||||
BossId: bossid,
|
BossId: bossid,
|
||||||
Difficulty: difficulty,
|
Difficulty: difficulty,
|
||||||
Battle: &pb.BattleFormation{
|
Battle: &pb.BattleFormation{
|
||||||
@ -67,6 +71,17 @@ func (this *ModuleRobot_Viking) DoPipeline(robot IRobot) (err error) {
|
|||||||
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, errdata := robot.SendMessage("viking", "challengeover", &pb.VikingChallengeOverReq{
|
||||||
|
BossId: bossid,
|
||||||
|
Difficulty: difficulty,
|
||||||
|
Report: &pb.BattleReport{
|
||||||
|
Info: resp.(*pb.VikingChallengeResp).Info,
|
||||||
|
WinSide: 1,
|
||||||
|
}}); errdata != nil {
|
||||||
|
err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message))
|
||||||
|
return
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user