diff --git a/modules/robot/modulerobot_wtask.go b/modules/robot/modulerobot_wtask.go index fe3d0c447..a20441d48 100644 --- a/modules/robot/modulerobot_wtask.go +++ b/modules/robot/modulerobot_wtask.go @@ -87,6 +87,10 @@ func (this *ModuleRobot_WTask) Receive(robot IRobot, stype string, message proto } } break + case "boxchange": + resp := message.(*pb.WTaskBoxChangePush) + this.info.Boxs = resp.Boxs + break } return } @@ -228,6 +232,22 @@ func (this *ModuleRobot_WTask) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskD return } break + case comm.Rtype205: //拾取宝箱 + boxid := int32(0) + for k, v := range this.info.Boxs[taskconf.Key].Boxs { + if v == 0 { + boxid = k + break + } + } + if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "wtask", "boxreceive", &pb.WTaskBoxReceiveReq{ + Tid: taskconf.Key, + Boxid: boxid, + }); errdata != nil { + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) + return + } + break } return } diff --git a/modules/robot/statisticalcomp.go b/modules/robot/statisticalcomp.go index fa2fca4ee..b20125144 100644 --- a/modules/robot/statisticalcomp.go +++ b/modules/robot/statisticalcomp.go @@ -4,6 +4,7 @@ import ( "fmt" "go_dreamfactory/lego/core" "go_dreamfactory/lego/core/cbase" + "go_dreamfactory/lego/sys/log" "os" "sort" "sync" @@ -111,11 +112,16 @@ func (this *statisticalComp) OutReport() { func (this *statisticalComp) run() { timer := time.NewTicker(time.Second * 10) +locp: for { select { case <-timer.C: this.OutReport() + if this.failclientNum+this.succclientNum >= this.module.options.RobotTotalNum { + break locp + } } } - + timer.Stop() + log.Debug("[机器人 WTask]") }