修改随机任务战斗结束处理

This commit is contained in:
wh_zcy 2022-09-23 14:45:38 +08:00
parent f3319fa989
commit b35f18cf26
2 changed files with 47 additions and 62 deletions

View File

@ -20,20 +20,7 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.RtaskBattle
return return
} }
//校验战斗结果 if req.IsWin {
iBattle, err := this.moduleRtask.modelRtask.service.GetModule(comm.ModuleBattle)
if err != nil {
code = pb.ErrorCode_SystemError
return
}
var isWin bool
if b, y := iBattle.(comm.IBattle); y {
if code, isWin = b.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success {
return
}
if isWin {
// 获取玩家的任务 // 获取玩家的任务
rtask := &pb.DBRtask{} rtask := &pb.DBRtask{}
if err := this.moduleRtask.modelRtask.Get(session.GetUserId(), rtask); err != nil { if err := this.moduleRtask.modelRtask.Get(session.GetUserId(), rtask); err != nil {
@ -71,12 +58,10 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.RtaskBattle
return return
} }
} }
}
if err := session.SendMsg(string(this.moduleRtask.GetType()), RtaskSubTypeBattleFinish, if err := session.SendMsg(string(this.moduleRtask.GetType()), RtaskSubTypeBattleFinish,
&pb.RtaskBattleFinishResp{ &pb.RtaskBattleFinishResp{
RtaskId: req.RtaskId, RtaskId: req.RtaskId,
IsWin: isWin,
}); err != nil { }); err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
} }

View File

@ -622,6 +622,7 @@ type RtaskBattleFinishReq struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
RtaskId int32 `protobuf:"varint,1,opt,name=rtaskId,proto3" json:"rtaskId"` //任务ID RtaskId int32 `protobuf:"varint,1,opt,name=rtaskId,proto3" json:"rtaskId"` //任务ID
IsWin bool `protobuf:"varint,2,opt,name=isWin,proto3" json:"isWin"` //战斗结果
Report *BattleReport `protobuf:"bytes,4,opt,name=report,proto3" json:"report"` //战报 Report *BattleReport `protobuf:"bytes,4,opt,name=report,proto3" json:"report"` //战报
} }
@ -664,6 +665,13 @@ func (x *RtaskBattleFinishReq) GetRtaskId() int32 {
return 0 return 0
} }
func (x *RtaskBattleFinishReq) GetIsWin() bool {
if x != nil {
return x.IsWin
}
return false
}
func (x *RtaskBattleFinishReq) GetReport() *BattleReport { func (x *RtaskBattleFinishReq) GetReport() *BattleReport {
if x != nil { if x != nil {
return x.Report return x.Report
@ -677,7 +685,6 @@ type RtaskBattleFinishResp struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
RtaskId int32 `protobuf:"varint,1,opt,name=rtaskId,proto3" json:"rtaskId"` //任务ID RtaskId int32 `protobuf:"varint,1,opt,name=rtaskId,proto3" json:"rtaskId"` //任务ID
IsWin bool `protobuf:"varint,2,opt,name=isWin,proto3" json:"isWin"` //战斗结果
} }
func (x *RtaskBattleFinishResp) Reset() { func (x *RtaskBattleFinishResp) Reset() {
@ -719,13 +726,6 @@ func (x *RtaskBattleFinishResp) GetRtaskId() int32 {
return 0 return 0
} }
func (x *RtaskBattleFinishResp) GetIsWin() bool {
if x != nil {
return x.IsWin
}
return false
}
//获取玩家任务记录 //获取玩家任务记录
type RtaskGetrecordReq struct { type RtaskGetrecordReq struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -979,17 +979,17 @@ var file_rtask_rtask_msg_proto_rawDesc = []byte{
0x22, 0x37, 0x0a, 0x14, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x22, 0x37, 0x0a, 0x14, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53,
0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x57, 0x0a, 0x14, 0x52, 0x74, 0x61, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x6d, 0x0a, 0x14, 0x52, 0x74, 0x61,
0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65,
0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69,
0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x57, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x57, 0x69,
0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28,
0x72, 0x74, 0x22, 0x47, 0x0a, 0x15, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74,
0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x31, 0x0a, 0x15, 0x52, 0x74, 0x61, 0x73,
0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73,
0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x57, 0x69, 0x6e, 0x18, 0x02, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x57, 0x69, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x13, 0x0a, 0x11, 0x52,
0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71,
0x22, 0x3c, 0x0a, 0x12, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f, 0x22, 0x3c, 0x0a, 0x12, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f,
0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64,