From 15a53a403c5dba0a630469aa598ea80044f784f8 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 9 Nov 2022 16:30:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=88=98=E6=96=97=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/academy/api_challenge.go | 1 + modules/academy/api_receive.go | 22 ++++++------- modules/academy/api_teaching.go | 1 + modules/academy/api_teachingreceive.go | 12 ++++--- pb/battle_msg.pb.go | 44 +++++++++++++++++++------- 5 files changed, 51 insertions(+), 29 deletions(-) diff --git a/modules/academy/api_challenge.go b/modules/academy/api_challenge.go index 1423d53b8..143c9f6f9 100644 --- a/modules/academy/api_challenge.go +++ b/modules/academy/api_challenge.go @@ -33,6 +33,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.AcademyChallen Redflist: record.Redflist, BlueCompId: record.BlueCompId, Buleflist: record.Buleflist, + Tasks: level.Task, }}) } else { session.SendMsg(string(this.module.GetType()), "challenge", &pb.AcademyChallengeResp{Code: cd, Info: nil}) diff --git a/modules/academy/api_receive.go b/modules/academy/api_receive.go index 3e14d121f..ba01d7bfc 100644 --- a/modules/academy/api_receive.go +++ b/modules/academy/api_receive.go @@ -34,6 +34,14 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe code = pb.ErrorCode_DBError return } + if level, err = this.module.configure.getGameTeaching(req.Level); err != nil { + code = pb.ErrorCode_DBError + return + } + if req.Report.Completetask == nil || len(req.Report.Completetask) != len(level.Task) { + return + } + if !info.Level[req.Level] { info.Level[req.Level] = true } @@ -41,19 +49,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe code = pb.ErrorCode_DBError return } - if level, err = this.module.configure.getGameTeaching(req.Level); err != nil { - code = pb.ErrorCode_DBError - return - } - // if group, err = this.module.configure.getGameTeachingByGroup(req.Group); err != nil { - // code = pb.ErrorCode_ConfigNoFound - // return - // } - // for _, v := range group { - // if !info.Level[v.Id] { - // return - // } - // } + this.module.DispenseRes(session, level.Award, true) } session.SendMsg(string(this.module.GetType()), "receive", &pb.AcademyReceiveResp{Issucc: true}) diff --git a/modules/academy/api_teaching.go b/modules/academy/api_teaching.go index f5e6585f3..397e1ea4b 100644 --- a/modules/academy/api_teaching.go +++ b/modules/academy/api_teaching.go @@ -33,6 +33,7 @@ func (this *apiComp) Teaching(session comm.IUserSession, req *pb.AcademyTeaching Redflist: record.Redflist, BlueCompId: record.BlueCompId, Buleflist: record.Buleflist, + Tasks: level.Task, }}) } else { session.SendMsg(string(this.module.GetType()), "teaching", &pb.AcademyTeachingResp{Code: cd, Info: nil}) diff --git a/modules/academy/api_teachingreceive.go b/modules/academy/api_teachingreceive.go index b15ec9937..96a562cde 100644 --- a/modules/academy/api_teachingreceive.go +++ b/modules/academy/api_teachingreceive.go @@ -34,6 +34,13 @@ func (this *apiComp) TeachingReceive(session comm.IUserSession, req *pb.AcademyT code = pb.ErrorCode_DBError return } + if level, err = this.module.configure.getGameHeroTeaching(req.HeroId); err != nil { + code = pb.ErrorCode_DBError + return + } + if req.Report.Completetask == nil || len(req.Report.Completetask) != len(level.Task) { + return + } if !info.Hero[req.HeroId] { info.Hero[req.HeroId] = true } @@ -41,10 +48,7 @@ func (this *apiComp) TeachingReceive(session comm.IUserSession, req *pb.AcademyT code = pb.ErrorCode_DBError return } - if level, err = this.module.configure.getGameHeroTeaching(req.HeroId); err != nil { - code = pb.ErrorCode_DBError - return - } + this.module.DispenseRes(session, level.Award, true) } session.SendMsg(string(this.module.GetType()), "teachingreceive", &pb.AcademyTeachingReceiveResp{Issucc: true}) diff --git a/pb/battle_msg.pb.go b/pb/battle_msg.pb.go index 64bdc3f3e..8c6d531a3 100644 --- a/pb/battle_msg.pb.go +++ b/pb/battle_msg.pb.go @@ -441,6 +441,7 @@ type BattleInfo struct { Redflist []*DBBattleFormt `protobuf:"bytes,6,rep,name=redflist,proto3" json:"redflist"` //红方阵型列表 BlueCompId string `protobuf:"bytes,7,opt,name=blueCompId,proto3" json:"blueCompId"` //蓝方阵营id Buleflist []*DBBattleFormt `protobuf:"bytes,8,rep,name=buleflist,proto3" json:"buleflist"` //红方阵型列表 + Tasks []int32 `protobuf:"varint,9,rep,packed,name=tasks,proto3" json:"tasks"` //任务列表 } func (x *BattleInfo) Reset() { @@ -531,15 +532,23 @@ func (x *BattleInfo) GetBuleflist() []*DBBattleFormt { return nil } +func (x *BattleInfo) GetTasks() []int32 { + if x != nil { + return x.Tasks + } + return nil +} + //战报数据 type BattleReport struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Info *BattleInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info"` - Costtime int32 `protobuf:"varint,2,opt,name=Costtime,proto3" json:"Costtime"` //战斗时长 单位ms - Process []byte `protobuf:"bytes,3,opt,name=process,proto3" json:"process"` //战斗过程数据 + Info *BattleInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info"` + Costtime int32 `protobuf:"varint,2,opt,name=Costtime,proto3" json:"Costtime"` //战斗时长 单位ms + Process []byte `protobuf:"bytes,3,opt,name=process,proto3" json:"process"` //战斗过程数据 + Completetask []int32 `protobuf:"varint,4,rep,packed,name=completetask,proto3" json:"completetask"` //完成任务 } func (x *BattleReport) Reset() { @@ -595,6 +604,13 @@ func (x *BattleReport) GetProcess() []byte { return nil } +func (x *BattleReport) GetCompletetask() []int32 { + if x != nil { + return x.Completetask + } + return nil +} + var File_battle_battle_msg_proto protoreflect.FileDescriptor var file_battle_battle_msg_proto_rawDesc = []byte{ @@ -646,7 +662,7 @@ var file_battle_battle_msg_proto_rawDesc = []byte{ 0x61, 0x74, 0x12, 0x2d, 0x0a, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x50, 0x56, 0x50, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x22, 0x8e, 0x02, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x74, 0x22, 0xa4, 0x02, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, 0x18, @@ -663,14 +679,18 @@ var file_battle_battle_msg_proto_rawDesc = []byte{ 0x6d, 0x70, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x09, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74, 0x52, 0x09, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6c, 0x69, - 0x73, 0x74, 0x22, 0x65, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 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, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6f, 0x73, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x43, 0x6f, 0x73, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, + 0x05, 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x74, + 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, + 0x6f, 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, 0x12, 0x1a, 0x0a, 0x08, 0x43, 0x6f, + 0x73, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x43, 0x6f, + 0x73, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, + 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, + 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x74, 0x61, 0x73, 0x6b, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, + 0x74, 0x61, 0x73, 0x6b, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var (