上传战斗任务协议

This commit is contained in:
liwei1dao 2022-11-09 16:30:36 +08:00
parent 1883467116
commit 15a53a403c
5 changed files with 51 additions and 29 deletions

View File

@ -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})

View File

@ -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})

View File

@ -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})

View File

@ -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})

View File

@ -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 (