From 9f221bf4fc47ae760101a6005e2e046934d00885 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 24 Aug 2023 19:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A3=85=E5=A4=87=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E6=9C=BA=E5=99=A8=E5=8D=95=E5=85=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/robot/modulerobot_equipment.go | 40 +++++++++++++++++++++++--- modules/robot/modulerobot_item.go | 2 +- modules/robot/modulerobot_pagoda.go | 15 ++++------ modules/robot/modulerobot_wtask.go | 4 ++- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/modules/robot/modulerobot_equipment.go b/modules/robot/modulerobot_equipment.go index a9271b860..bef7d5af3 100644 --- a/modules/robot/modulerobot_equipment.go +++ b/modules/robot/modulerobot_equipment.go @@ -70,7 +70,7 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero) heros = heromodule.heros for _, hero = range heros { - if equipments, change, err = this.findcanEquipEquipment(hero); err != nil { + if equipments, change, err = this.findcanEquipEquipment(hero, 0); err != nil { return } if change { @@ -88,7 +88,36 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT } else { err = fmt.Errorf("no fund can use equipments") } - case comm.Rtype92, comm.Rtype96: //强化 + case comm.Rtype41: //穿戴 + var ( + heromodule *ModuleRobot_Hero + heros map[string]*pb.DBHero + equipments []string + hero *pb.DBHero + change bool + ) + heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero) + heros = heromodule.heros + for _, hero = range heros { + if equipments, change, err = this.findcanEquipEquipment(hero, condconf.Filter[0]); err != nil { + return + } + if change { + break + } + } + if change { + if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "equipment", "equip", &pb.EquipmentEquipReq{ + HeroCardId: hero.Id, + EquipmentId: equipments, + }); errdata != nil { + err = errors.New(errdata.Message) + return + } + } else { + err = fmt.Errorf("no fund can use equipments") + } + case comm.Rtype43, comm.Rtype92, comm.Rtype96: //强化 var ( equipment *pb.DB_Equipment ) @@ -167,7 +196,7 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT } //查询能穿戴的装备 -func (this *ModuleRobot_Equipment) findcanEquipEquipment(hero *pb.DBHero) (equipments []string, change bool, err error) { +func (this *ModuleRobot_Equipment) findcanEquipEquipment(hero *pb.DBHero, minstar int32) (equipments []string, change bool, err error) { var ( conf *cfg.GameEquipData ) @@ -179,6 +208,9 @@ func (this *ModuleRobot_Equipment) findcanEquipEquipment(hero *pb.DBHero) (equip if conf, err = this.getGameEquipData(equipment.CId); err != nil { return } + if conf.Color < minstar { + continue + } if conf.Pos == int32(i) { //找到匹配装备 equipments[i] = equipment.Id change = true @@ -208,7 +240,7 @@ func (this *ModuleRobot_Equipment) findcanupgrade() (equipment *pb.DB_Equipment, if conf, err = this.getGameEquipData(equipment.CId); err != nil { return } - if upconf, err = this.getEquipmentMaxIntensifyConfigure(conf.EquipId, conf.Color); err == nil && upconf.Level < equipment.Lv { + if upconf, err = this.getEquipmentMaxIntensifyConfigure(conf.EquipId, conf.Color); err == nil && upconf.Level > equipment.Lv { return } } diff --git a/modules/robot/modulerobot_item.go b/modules/robot/modulerobot_item.go index f12d0d5bb..b84a38736 100644 --- a/modules/robot/modulerobot_item.go +++ b/modules/robot/modulerobot_item.go @@ -43,7 +43,7 @@ func (this *ModuleRobot_Item) DoPipeline(robot IRobot) (err error) { var ( errdata *pb.ErrorData ) - if _, errdata = robot.SendMessage("item", "getlist", &pb.ItemsGetlistReq{}); errdata != nil { + if _, errdata = robot.SendMessage("items", "getlist", &pb.ItemsGetlistReq{}); errdata != nil { err = errors.New(errdata.Message) return } diff --git a/modules/robot/modulerobot_pagoda.go b/modules/robot/modulerobot_pagoda.go index bc1b05446..73e390ac9 100644 --- a/modules/robot/modulerobot_pagoda.go +++ b/modules/robot/modulerobot_pagoda.go @@ -40,15 +40,6 @@ func (this *ModuleRobot_Pagoda) Receive(robot IRobot, stype string, message prot //机器人执行流 func (this *ModuleRobot_Pagoda) DoPipeline(robot IRobot) (err error) { - var ( - errdata *pb.ErrorData - ) - // 获取爬塔信息 - if _, errdata = robot.SendMessage("pagoda", "getlist", &pb.PagodaGetListReq{}); errdata != nil { - err = errors.New(errdata.Message) - return - } - return } @@ -59,7 +50,11 @@ func (this *ModuleRobot_Pagoda) DoTask(robot IRobot, taskconf *cfg.GameWorldTask errdata *pb.ErrorData conf *cfg.GamePagodaData ) - + // 获取爬塔信息 + if _, errdata = robot.SendMessage("pagoda", "getlist", &pb.PagodaGetListReq{}); errdata != nil { + err = errors.New(errdata.Message) + return + } switch comm.TaskType(condconf.Type) { case comm.Rtype168: //完成功夫大师挑战塔第X层 var ( diff --git a/modules/robot/modulerobot_wtask.go b/modules/robot/modulerobot_wtask.go index d0bb8f609..a0d5539b9 100644 --- a/modules/robot/modulerobot_wtask.go +++ b/modules/robot/modulerobot_wtask.go @@ -129,10 +129,12 @@ locp: module = comm.ModulePractice case comm.Rtype61: module = comm.ModuleMainline - case comm.Rtype5, comm.Rtype92, comm.Rtype94, comm.Rtype95, comm.Rtype96: + case comm.Rtype5, comm.Rtype41, comm.Rtype43, comm.Rtype92, comm.Rtype94, comm.Rtype95, comm.Rtype96: module = comm.ModuleEquipment case comm.Rtype128, comm.Rtype129, comm.Rtype131: module = comm.ModuleArena + case comm.Rtype168: + module = comm.ModulePagoda default: log.Error("[Robot DoTask]", log.Field{Key: "ctype", Value: cconf.Type}, log.Field{Key: "conld", Value: cconf.Id}, log.Field{Key: "err", Value: "Not Achieved !"}) break locp