53 lines
1.3 KiB
Go
53 lines
1.3 KiB
Go
package practice
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) NPCBattkleCheck(session comm.IUserSession, req *pb.PracticeNPCBattkleReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
///npc 战斗请求
|
|
func (this *apiComp) NPCBattkle(session comm.IUserSession, req *pb.PracticeNPCBattkleReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
err error
|
|
room *pb.DBPracticeRoom
|
|
record *pb.DBBattleRecord
|
|
)
|
|
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if errdata, record = this.module.battle.CreateLPVEBattle(session, &pb.BattleLPVEReq{
|
|
Ptype: pb.PlayType_practicenpc,
|
|
Format: req.Formation,
|
|
Monsterleadpos: room.Captain,
|
|
Monsters: room.Formation,
|
|
}); errdata != nil {
|
|
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
|
|
}
|