上传秘境代码

This commit is contained in:
liwei1dao 2022-12-15 18:00:59 +08:00
parent 530ab21db4
commit d8a8f55e65
2 changed files with 55 additions and 37 deletions

View File

@ -60,6 +60,7 @@ func (f *ArenaScene) Run(ai lib.IRobot) (err error) {
return return
} }
Sleep(time.Second*3, time.Second*5) Sleep(time.Second*3, time.Second*5)
if challenge.Code == pb.ErrorCode_Success {
if code = ai.SendMsg("arena", "challengereward", &pb.ArenaChallengeRewardReq{ if code = ai.SendMsg("arena", "challengereward", &pb.ArenaChallengeRewardReq{
Iswin: true, Iswin: true,
Isai: v.Isai, Isai: v.Isai,
@ -77,6 +78,7 @@ func (f *ArenaScene) Run(ai lib.IRobot) (err error) {
return return
} }
Sleep(time.Second*1, time.Second*3) Sleep(time.Second*1, time.Second*3)
}
break break
} }
return return

View File

@ -30,19 +30,17 @@ func (f *MfantasyScene) Run(ai lib.IRobot) (err error) {
battlereq *pb.MoonfantasyBattleResp = &pb.MoonfantasyBattleResp{} battlereq *pb.MoonfantasyBattleResp = &pb.MoonfantasyBattleResp{}
) )
if herolist := ai.Get("hero.list"); herolist == nil { f.AddHero(ai, "25001") // 加阿宝
Sleep(time.Second*0, time.Second*1)
herolistreq := &pb.HeroListReq{}
herolistresp := &pb.HeroListResp{}
if code = ai.SendMsg("hero", "list", herolistreq, herolistresp); code != pb.ErrorCode_Success {
ai.Stop() ai.Stop()
return return
} else {
herolistrsp = herolist.(*pb.HeroListResp)
if herolistrsp.List == nil || len(herolistrsp.List) == 0 {
ai.Stop()
return
}
} }
Sleep(time.Second*0, time.Second*1) Sleep(time.Second*0, time.Second*1)
if code = ai.SendMsg("gm", "cmd", &pb.GMCmdReq{ if code = ai.SendMsg("gm", "cmd", &pb.GMCmdReq{
Cmod: "bingo:moon,1", Cmod: "bingo:moon,25001",
}, &pb.GMCmdResp{}); code != pb.ErrorCode_Success { }, &pb.GMCmdResp{}); code != pb.ErrorCode_Success {
ai.Stop() ai.Stop()
} }
@ -62,6 +60,7 @@ func (f *MfantasyScene) Run(ai lib.IRobot) (err error) {
ai.Stop() ai.Stop()
} }
Sleep(time.Second*3, time.Second*5) Sleep(time.Second*3, time.Second*5)
if battlereq.Code == pb.ErrorCode_Success {
if code = ai.SendMsg("moonfantasy", "receive", &pb.MoonfantasyReceiveReq{ if code = ai.SendMsg("moonfantasy", "receive", &pb.MoonfantasyReceiveReq{
Report: &pb.BattleReport{ Report: &pb.BattleReport{
Info: battlereq.Info, Info: battlereq.Info,
@ -75,8 +74,25 @@ func (f *MfantasyScene) Run(ai lib.IRobot) (err error) {
return return
} }
Sleep(time.Second, time.Second*3) Sleep(time.Second, time.Second*3)
}
break break
} }
return return
} }
// 加英雄
func (f *MfantasyScene) AddHero(robot lib.IRobot, cid string) error {
var (
code pb.ErrorCode
)
req := &pb.GMCmdReq{
Cmod: "bingo:hero," + cid + ",1",
}
rsp := &pb.GMCmdResp{}
code = robot.SendMsg("gm", "cmd", req, rsp)
if code != pb.ErrorCode_Success {
return nil
}
return nil
}