上传压测工具代码
This commit is contained in:
parent
3db40119a8
commit
635ec1a35c
63
modules/robot/modulerobot_practice.go
Normal file
63
modules/robot/modulerobot_practice.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package robot
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
//用户模块 机器人
|
||||||
|
type ModuleRobot_Practice struct {
|
||||||
|
Info *pb.DBPracticeRoom
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ModuleRobot_Practice) Init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//接收到消息
|
||||||
|
func (this *ModuleRobot_Practice) Receive(robot IRobot, stype string, message proto.Message) (err error) {
|
||||||
|
switch stype {
|
||||||
|
case "info":
|
||||||
|
resp := message.(*pb.PracticeInfoResp)
|
||||||
|
this.Info = resp.Info
|
||||||
|
break
|
||||||
|
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//机器人执行流
|
||||||
|
func (this *ModuleRobot_Practice) DoPipeline(robot IRobot) (err error) {
|
||||||
|
var (
|
||||||
|
errdata *pb.ErrorData
|
||||||
|
)
|
||||||
|
if _, errdata = robot.SendMessage("hero", "list", &pb.HeroListReq{}); errdata != nil {
|
||||||
|
err = errors.New(errdata.Message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//做任务
|
||||||
|
func (this *ModuleRobot_Practice) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskData, condconf *cfg.GameBuriedCondiData) (err error) {
|
||||||
|
var (
|
||||||
|
errdata *pb.ErrorData
|
||||||
|
)
|
||||||
|
if _, errdata = robot.SendMessage("practice", "info", &pb.PracticeInfoReq{}); errdata != nil {
|
||||||
|
err = errors.New(errdata.Message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch comm.TaskType(condconf.Type) {
|
||||||
|
case comm.Rtype149:
|
||||||
|
|
||||||
|
if _, errdata = robot.SendMessage("practice", "practice", &pb.PracticePracticeReq{}); errdata != nil {
|
||||||
|
err = errors.New(errdata.Message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user