diff --git a/modules/mainline/api_challengeover.go b/modules/mainline/api_challengeover.go index eb4489b97..65d6b06fa 100644 --- a/modules/mainline/api_challengeover.go +++ b/modules/mainline/api_challengeover.go @@ -25,9 +25,13 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh mainline *pb.DBMainline // 当前章节信息 res []*cfg.Gameatn // 小章节奖励 isWin bool + user *pb.DBUser + hero []string //新的英雄 + newhero []string //新的英雄 ) res = make([]*cfg.Gameatn, 0) - + hero = make([]string, 0) + newhero = make([]string, 0) code = this.ChallengeOverCheck(session, req) if code != pb.ErrorCode_Success { return // 参数校验失败直接返回 @@ -63,7 +67,20 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh } } res = append(res, node.Award...) - + for _, v := range res { + if v.A == comm.HeroType { + hero = append(hero, v.T) + } + } + if len(hero) > 0 { + ishave := this.module.ModuleUser.CheckTujianHero(session, hero) + for i, v := range ishave { + if v { + newhero = append(newhero, hero[i]) + } + } + } + user = this.module.ModuleUser.GetUser(session.GetUserId()) mainline.MainlineId = int32(req.MainlineId) mainline.BranchID = append(mainline.BranchID, int32(req.MainlineId)) update := map[string]interface{}{ @@ -95,7 +112,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh if code = this.module.DispenseRes(session, res, true); code != pb.ErrorCode_Success { this.module.Debugf("DispenseRes err:+%v", res) } - session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline}) + session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline, Newheros: newhero, Olv: user.Lv}) return } } @@ -122,7 +139,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh } } - session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline}) + session.SendMsg(string(this.module.GetType()), MainlineChallengeOverResp, &pb.MainlineChallengeOverResp{Data: mainline, Newheros: newhero, Olv: user.Lv}) // 主线任务统计 Rtype60 this.module.ModuleRtask.SendToRtask(session, comm.Rtype60, 1) this.module.ModuleRtask.SendToRtask(session, comm.Rtype61, int32(req.MainlineId)) diff --git a/modules/worldtask/api_battlefinish.go b/modules/worldtask/api_battlefinish.go index 1d6f3702d..58c633b2f 100644 --- a/modules/worldtask/api_battlefinish.go +++ b/modules/worldtask/api_battlefinish.go @@ -19,6 +19,10 @@ func (this *apiComp) BattlefinishCheck(session comm.IUserSession, req *pb.Worldt } func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBattleFinishReq) (code pb.ErrorCode, data proto.Message) { + var ( + user *pb.DBUser + ) + if code = this.BattlefinishCheck(session, req); code != pb.ErrorCode_Success { return } @@ -36,9 +40,11 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa code = pb.ErrorCode_DBError return } - + user = this.module.ModuleUser.GetUser(session.GetUserId()) rsp := &pb.WorldtaskBattleFinishResp{ - TaskId: req.TaskId, + TaskId: req.TaskId, + Newheros: make([]string, 0), + Olv: user.Lv, } if taskConf.Completetask == 0 { diff --git a/pb/mainline_msg.pb.go b/pb/mainline_msg.pb.go index bbd7216c4..a92d4b3e0 100644 --- a/pb/mainline_msg.pb.go +++ b/pb/mainline_msg.pb.go @@ -406,7 +406,9 @@ type MainlineChallengeOverResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Data *DBMainline `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` //当前章节信息 + Data *DBMainline `protobuf:"bytes,1,opt,name=data,proto3" json:"data"` //当前章节信息 + Newheros []string `protobuf:"bytes,2,rep,name=newheros,proto3" json:"newheros"` //获得的新英雄 + Olv int32 `protobuf:"varint,3,opt,name=olv,proto3" json:"olv"` //以前的等级 } func (x *MainlineChallengeOverResp) Reset() { @@ -448,6 +450,20 @@ func (x *MainlineChallengeOverResp) GetData() *DBMainline { return nil } +func (x *MainlineChallengeOverResp) GetNewheros() []string { + if x != nil { + return x.Newheros + } + return nil +} + +func (x *MainlineChallengeOverResp) GetOlv() int32 { + if x != nil { + return x.Olv + } + return 0 +} + // 推送新章节 type MainlineNewChapterPush struct { state protoimpl.MessageState @@ -540,16 +556,19 @@ var file_mainline_mainline_msg_proto_rawDesc = []byte{ 0x6e, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x3c, 0x0a, + 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x6a, 0x0a, 0x19, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x39, 0x0a, 0x16, 0x4d, - 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, - 0x72, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x6e, + 0x65, 0x77, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6e, + 0x65, 0x77, 0x68, 0x65, 0x72, 0x6f, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x6c, 0x76, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6f, 0x6c, 0x76, 0x22, 0x39, 0x0a, 0x16, 0x4d, 0x61, 0x69, + 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x4e, 0x65, 0x77, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x50, + 0x75, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/worldtask_msg.pb.go b/pb/worldtask_msg.pb.go index 4cf522f30..8cd966591 100644 --- a/pb/worldtask_msg.pb.go +++ b/pb/worldtask_msg.pb.go @@ -437,7 +437,9 @@ type WorldtaskBattleFinishResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` //任务ID + TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` //任务ID + Newheros []string `protobuf:"bytes,2,rep,name=newheros,proto3" json:"newheros"` //获得的新英雄 + Olv int32 `protobuf:"varint,3,opt,name=olv,proto3" json:"olv"` //以前的等级 } func (x *WorldtaskBattleFinishResp) Reset() { @@ -479,6 +481,20 @@ func (x *WorldtaskBattleFinishResp) GetTaskId() int32 { return 0 } +func (x *WorldtaskBattleFinishResp) GetNewheros() []string { + if x != nil { + return x.Newheros + } + return nil +} + +func (x *WorldtaskBattleFinishResp) GetOlv() int32 { + if x != nil { + return x.Olv + } + return 0 +} + // 当前完成的任务列表推送 type WorldtaskFinishIdsPush struct { state protoimpl.MessageState @@ -571,15 +587,18 @@ var file_worldtask_worldtask_msg_proto_rawDesc = []byte{ 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x22, 0x33, 0x0a, 0x19, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, + 0x22, 0x61, 0x0a, 0x19, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, - 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x40, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, - 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x49, 0x64, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, - 0x26, 0x0a, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0a, 0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, - 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x68, 0x65, 0x72, 0x6f, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x68, 0x65, 0x72, 0x6f, + 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, + 0x6f, 0x6c, 0x76, 0x22, 0x40, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, + 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x49, 0x64, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x26, 0x0a, + 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x0a, 0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, 0x61, 0x73, + 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (