package practice import ( "go_dreamfactory/comm" "go_dreamfactory/pb" ) //参数校验 func (this *apiComp) NPCBattkleCheck(session comm.IUserSession, req *pb.PracticeNPCBattkleReq) (code pb.ErrorCode) { return } ///npc 战斗请求 func (this *apiComp) NPCBattkle(session comm.IUserSession, req *pb.PracticeNPCBattkleReq) (code pb.ErrorCode, data *pb.ErrorData) { var ( err error room *pb.DBPracticeRoom record *pb.DBBattleRecord ) if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError return } if code, record = this.module.battle.CreateLPVEBattle(session, &pb.BattleLPVEReq{ Ptype: pb.PlayType_practicenpc, Format: req.Formation, Monsterleadpos: room.Captain, Monsters: room.Formation, }); code != pb.ErrorCode_Success { return } session.SendMsg(string(this.module.GetType()), "npcbattkle", &pb.PracticeNPCBattkleResp{ Info: &pb.BattleInfo{ Id: record.Id, Title: record.Title, Rulesid: 111, Btype: record.Btype, Ptype: record.Ptype, RedCompId: record.RedCompId, Redflist: record.Redflist, BlueCompId: record.BlueCompId, Buleflist: record.Buleflist, }, }) return }