拾取宝箱机器人功能补全

This commit is contained in:
liwei1dao 2023-12-15 15:19:39 +08:00
parent 54087998b4
commit 424957278a
2 changed files with 27 additions and 1 deletions

View File

@ -87,6 +87,10 @@ func (this *ModuleRobot_WTask) Receive(robot IRobot, stype string, message proto
} }
} }
break break
case "boxchange":
resp := message.(*pb.WTaskBoxChangePush)
this.info.Boxs = resp.Boxs
break
} }
return return
} }
@ -228,6 +232,22 @@ func (this *ModuleRobot_WTask) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskD
return return
} }
break 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 return
} }

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase" "go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
"os" "os"
"sort" "sort"
"sync" "sync"
@ -111,11 +112,16 @@ func (this *statisticalComp) OutReport() {
func (this *statisticalComp) run() { func (this *statisticalComp) run() {
timer := time.NewTicker(time.Second * 10) timer := time.NewTicker(time.Second * 10)
locp:
for { for {
select { select {
case <-timer.C: case <-timer.C:
this.OutReport() this.OutReport()
if this.failclientNum+this.succclientNum >= this.module.options.RobotTotalNum {
break locp
}
} }
} }
timer.Stop()
log.Debug("[机器人 WTask]")
} }