优化装备升级机器单元
This commit is contained in:
parent
b23a88b63f
commit
9f221bf4fc
@ -70,7 +70,7 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT
|
|||||||
heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero)
|
heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero)
|
||||||
heros = heromodule.heros
|
heros = heromodule.heros
|
||||||
for _, hero = range 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
|
return
|
||||||
}
|
}
|
||||||
if change {
|
if change {
|
||||||
@ -88,7 +88,36 @@ func (this *ModuleRobot_Equipment) DoTask(robot IRobot, taskconf *cfg.GameWorldT
|
|||||||
} else {
|
} else {
|
||||||
err = fmt.Errorf("no fund can use equipments")
|
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 (
|
var (
|
||||||
equipment *pb.DB_Equipment
|
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 (
|
var (
|
||||||
conf *cfg.GameEquipData
|
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 {
|
if conf, err = this.getGameEquipData(equipment.CId); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if conf.Color < minstar {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if conf.Pos == int32(i) { //找到匹配装备
|
if conf.Pos == int32(i) { //找到匹配装备
|
||||||
equipments[i] = equipment.Id
|
equipments[i] = equipment.Id
|
||||||
change = true
|
change = true
|
||||||
@ -208,7 +240,7 @@ func (this *ModuleRobot_Equipment) findcanupgrade() (equipment *pb.DB_Equipment,
|
|||||||
if conf, err = this.getGameEquipData(equipment.CId); err != nil {
|
if conf, err = this.getGameEquipData(equipment.CId); err != nil {
|
||||||
return
|
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
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ func (this *ModuleRobot_Item) DoPipeline(robot IRobot) (err error) {
|
|||||||
var (
|
var (
|
||||||
errdata *pb.ErrorData
|
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)
|
err = errors.New(errdata.Message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -40,15 +40,6 @@ func (this *ModuleRobot_Pagoda) Receive(robot IRobot, stype string, message prot
|
|||||||
|
|
||||||
//机器人执行流
|
//机器人执行流
|
||||||
func (this *ModuleRobot_Pagoda) DoPipeline(robot IRobot) (err error) {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +50,11 @@ func (this *ModuleRobot_Pagoda) DoTask(robot IRobot, taskconf *cfg.GameWorldTask
|
|||||||
errdata *pb.ErrorData
|
errdata *pb.ErrorData
|
||||||
conf *cfg.GamePagodaData
|
conf *cfg.GamePagodaData
|
||||||
)
|
)
|
||||||
|
// 获取爬塔信息
|
||||||
|
if _, errdata = robot.SendMessage("pagoda", "getlist", &pb.PagodaGetListReq{}); errdata != nil {
|
||||||
|
err = errors.New(errdata.Message)
|
||||||
|
return
|
||||||
|
}
|
||||||
switch comm.TaskType(condconf.Type) {
|
switch comm.TaskType(condconf.Type) {
|
||||||
case comm.Rtype168: //完成功夫大师挑战塔第X层
|
case comm.Rtype168: //完成功夫大师挑战塔第X层
|
||||||
var (
|
var (
|
||||||
|
@ -129,10 +129,12 @@ locp:
|
|||||||
module = comm.ModulePractice
|
module = comm.ModulePractice
|
||||||
case comm.Rtype61:
|
case comm.Rtype61:
|
||||||
module = comm.ModuleMainline
|
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
|
module = comm.ModuleEquipment
|
||||||
case comm.Rtype128, comm.Rtype129, comm.Rtype131:
|
case comm.Rtype128, comm.Rtype129, comm.Rtype131:
|
||||||
module = comm.ModuleArena
|
module = comm.ModuleArena
|
||||||
|
case comm.Rtype168:
|
||||||
|
module = comm.ModulePagoda
|
||||||
default:
|
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 !"})
|
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
|
break locp
|
||||||
|
Loading…
Reference in New Issue
Block a user