拾取宝箱机器人功能补全
This commit is contained in:
parent
54087998b4
commit
424957278a
@ -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
|
||||
}
|
||||
|
@ -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]")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user