上传休眠时间
This commit is contained in:
parent
09f8cd1926
commit
6c5898f42c
@ -58,7 +58,7 @@ func (f *ArenaScene) Run(ai lib.IRobot) (err error) {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second * 5)
|
||||
Sleep(time.Second*3, time.Second*5)
|
||||
if code = ai.SendMsg("arena", "challengereward", &pb.ArenaChallengeRewardReq{
|
||||
Iswin: true,
|
||||
Isai: v.Isai,
|
||||
@ -74,7 +74,7 @@ func (f *ArenaScene) Run(ai lib.IRobot) (err error) {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second * 2)
|
||||
Sleep(time.Second*1, time.Second*3)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func (f *ChatScene) Run(ai lib.IRobot) (err error) {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second * 1)
|
||||
Sleep(time.Second*1, time.Second*3)
|
||||
}
|
||||
}
|
||||
|
||||
|
12
busi/core.go
Normal file
12
busi/core.go
Normal file
@ -0,0 +1,12 @@
|
||||
package busi
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Sleep(min, max time.Duration) {
|
||||
ulit := int64(max - min)
|
||||
t := time.Duration(rand.Int63n(ulit)) + min
|
||||
time.Sleep(t)
|
||||
}
|
80
busi/mfantasy.go
Normal file
80
busi/mfantasy.go
Normal file
@ -0,0 +1,80 @@
|
||||
package busi
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"legu.airobot/lib"
|
||||
"legu.airobot/pb"
|
||||
)
|
||||
|
||||
//竞技场场景
|
||||
|
||||
var _ lib.IScene = (*MfantasyScene)(nil)
|
||||
|
||||
type MfantasyScene struct {
|
||||
lib.Action
|
||||
}
|
||||
|
||||
func (f *MfantasyScene) Info() lib.SceneInfo {
|
||||
return lib.SceneInfo{
|
||||
Name: "秘境",
|
||||
Desc: "秘境测试",
|
||||
}
|
||||
}
|
||||
|
||||
func (f *MfantasyScene) Run(ai lib.IRobot) (err error) {
|
||||
var (
|
||||
code pb.ErrorCode
|
||||
herolistrsp *pb.HeroListResp
|
||||
mflist *pb.MoonfantasyGetListResp = &pb.MoonfantasyGetListResp{}
|
||||
battlereq *pb.MoonfantasyBattleResp = &pb.MoonfantasyBattleResp{}
|
||||
)
|
||||
|
||||
if herolist := ai.Get("hero.list"); herolist == nil {
|
||||
ai.Stop()
|
||||
return
|
||||
} else {
|
||||
herolistrsp = herolist.(*pb.HeroListResp)
|
||||
if herolistrsp.List == nil || len(herolistrsp.List) == 0 {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if code = ai.SendMsg("gm", "cmd", &pb.GMCmdReq{
|
||||
Cmod: "bingo:moon,1",
|
||||
}, &pb.GMCmdResp{}); code != pb.ErrorCode_Success {
|
||||
ai.Stop()
|
||||
}
|
||||
|
||||
if code = ai.SendMsg("moonfantasy", "getlist", &pb.MoonfantasyGetListReq{}, mflist); code != pb.ErrorCode_Success {
|
||||
ai.Stop()
|
||||
}
|
||||
|
||||
for _, v := range mflist.Dfantasys {
|
||||
if code = ai.SendMsg("moonfantasy", "battle", &pb.MoonfantasyBattleReq{
|
||||
Mid: v.Monster,
|
||||
Battle: &pb.BattleFormation{
|
||||
Leadpos: 0,
|
||||
Format: []string{herolistrsp.List[0].Id},
|
||||
},
|
||||
}, battlereq); code != pb.ErrorCode_Success {
|
||||
ai.Stop()
|
||||
}
|
||||
Sleep(time.Second*3, time.Second*5)
|
||||
if code = ai.SendMsg("moonfantasy", "receive", &pb.MoonfantasyReceiveReq{
|
||||
Report: &pb.BattleReport{
|
||||
Info: battlereq.Info,
|
||||
Costtime: 1,
|
||||
Process: []byte{123},
|
||||
Completetask: []int32{},
|
||||
},
|
||||
}, &pb.MoonfantasyReceiveResp{}); code != pb.ErrorCode_Success {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
Sleep(time.Second, time.Second*3)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user