diff --git a/modules/battle/modelBattle.go b/modules/battle/modelBattle.go index 6ff609a78..4aef8b5bd 100644 --- a/modules/battle/modelBattle.go +++ b/modules/battle/modelBattle.go @@ -845,6 +845,10 @@ func (this *modelBattleComp) createMasterRoles(comp, wheel int, fid int32) (capt } return } else { + var szEquipSkill []*pb.SkillData + szEquipSkill = append(szEquipSkill, hero.EquipSkill...) + szEquipSkill = append(szEquipSkill, hero.Awakenskill...) // + szEquipSkill = append(szEquipSkill, hero.Talentskill...) roles[i] = &pb.BattleRole{ Tid: int32(comp + wheel*10 + i), Oid: hero.Id, @@ -854,7 +858,7 @@ func (this *modelBattleComp) createMasterRoles(comp, wheel int, fid int32) (capt Lv: hero.Lv, CaptainSkill: hero.CaptainSkill, NormalSkill: hero.NormalSkill, - EquipSkill: hero.EquipSkill, + EquipSkill: szEquipSkill, Property: make(map[int32]int32), Isboos: v.IsBoss, Monsterid: v.Heroid, diff --git a/modules/robot/modulerobot_viking.go b/modules/robot/modulerobot_viking.go new file mode 100644 index 000000000..6396370cc --- /dev/null +++ b/modules/robot/modulerobot_viking.go @@ -0,0 +1,88 @@ +package robot + +import ( + "errors" + "fmt" + "go_dreamfactory/comm" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + + "google.golang.org/protobuf/proto" +) + +//维京模块 机器人 +type ModuleRobot_Viking struct { + viking *pb.DBViking +} + +func (this *ModuleRobot_Viking) Init() (err error) { + return +} + +//接收到消息 +func (this *ModuleRobot_Viking) Receive(robot IRobot, stype string, message proto.Message) (err error) { + switch stype { + case "getlist": + resp := message.(*pb.VikingGetListResp) + this.viking = resp.Data + break + case "challengeover": // 更新塔信息 + resp := message.(*pb.VikingChallengeOverResp) + this.viking = resp.Data + break + } + + return +} + +//机器人执行流 +func (this *ModuleRobot_Viking) DoPipeline(robot IRobot) (err error) { + return +} + +//做任务 +func (this *ModuleRobot_Viking) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskData, condconf *cfg.GameBuriedCondiData) (err error) { + + var ( + errdata *pb.ErrorData + ) + // 获取爬塔信息 + if _, errdata = robot.SendMessage("viking", "getlist", &pb.VikingGetListReq{}); errdata != nil { + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) + return + } + switch comm.TaskType(condconf.Type) { + case comm.Rtype73: //通关难度A维京远征指定BOSSN次(从接到任务开始,只有通关A难度进度才+1) + var ( + heromodule *ModuleRobot_Hero + heros []string + resp proto.Message + ) + // if conf, err = this.getPagodaData(condconf.Filter[0], this.viking.Data[condconf.Filter[0]]+1); err != nil { // 参数有误 + // return + // } + heromodule = robot.GetModule(comm.ModuleHero).(*ModuleRobot_Hero) + heros = heromodule.getbattlehero() + if resp, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "viking", "challenge", &pb.VikingChallengeReq{ + BossId: condconf.Filter[0], + Difficulty: condconf.Filter[1], + Battle: &pb.BattleFormation{ + Format: heros, + }}); errdata != nil { + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) + return + } + if _, errdata = robot.SendTaskMessage(taskconf.Key, condconf.Id, "viking", "challengeover", &pb.VikingChallengeOverReq{ + BossId: condconf.Filter[0], + Difficulty: condconf.Filter[1], + Report: &pb.BattleReport{ + Info: resp.(*pb.VikingChallengeResp).Info, + WinSide: 1, + }}); errdata != nil { + err = errors.New(fmt.Sprintf("code:%d message:%s", errdata.Code, errdata.Message)) + return + } + break + } + return +}