From 18058e075f93332421f7fc4fd55ad3a252fd0313 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 13 Oct 2022 17:09:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=81=E7=BB=8A=E6=95=B0=E6=8D=AEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hunting/api_challengeover.go | 23 +++--- modules/library/api_getfetterlist.go | 2 +- modules/library/module.go | 4 +- modules/viking/api_challengeover.go | 23 +++--- pb/library_msg.pb.go | 103 ++++++++++++++++++++++----- 5 files changed, 111 insertions(+), 44 deletions(-) diff --git a/modules/hunting/api_challengeover.go b/modules/hunting/api_challengeover.go index 4459a295e..5d41770f7 100644 --- a/modules/hunting/api_challengeover.go +++ b/modules/hunting/api_challengeover.go @@ -64,21 +64,22 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha hunting.Boss[req.BossType] += 1 mapData["boss"] = hunting.Boss mapData["challengeTime"] = hunting.BossTime - if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { - sz := make([]*pb.LineUp, 5) - for i, v := range req.Report.Info.Redflist[0].Team { - if v != nil { - sz[i] = &pb.LineUp{ - Cid: v.HeroID, - Star: v.Star, - Lv: v.Lv, - } + } + // 查询是不是最高难度的挑战 + + if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 && value == req.Difficulty { + sz := make([]*pb.LineUp, 5) + for i, v := range req.Report.Info.Redflist[0].Team { + if v != nil { + sz[i] = &pb.LineUp{ + Cid: v.HeroID, + Star: v.Star, + Lv: v.Lv, } } - this.module.modulerank.updatehuntingRankList(session, req.Difficulty, req.BossType, req.Report.Info.Redflist[0].Leadpos, sz, req.Report.Costtime) } + this.module.modulerank.updatehuntingRankList(session, req.Difficulty, req.BossType, req.Report.Info.Redflist[0].Leadpos, sz, req.Report.Costtime) } - // check code, _ = this.module.battle.CheckBattleReport(session, req.Report) if code != pb.ErrorCode_Success { diff --git a/modules/library/api_getfetterlist.go b/modules/library/api_getfetterlist.go index 5e6bcd37f..87ab18d1f 100644 --- a/modules/library/api_getfetterlist.go +++ b/modules/library/api_getfetterlist.go @@ -22,7 +22,7 @@ func (this *apiComp) GetFetterList(session comm.IUserSession, req *pb.LibraryGet rsp := &pb.LibraryGetFetterListResp{} rsp.Data = this.module.GetHeroFetterList(session.GetUserId()) - session.SendMsg(string(this.module.GetType()), LibraryGetListResp, rsp) + session.SendMsg(string(this.module.GetType()), LibraryGetFetterListResp, rsp) return } diff --git a/modules/library/module.go b/modules/library/module.go index 82cb31fa1..8956169c2 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -78,7 +78,7 @@ func (this *Library) CreateLibrary(uid string, fids []int32, heroConfId string) } conf := this.configure.GetLibraryFetter(fid, 1) - if conf == nil { + if conf != nil { for _, v := range conf.Hid { obj.Hero[v] = 0 // 默认值 if v == heroConfId { @@ -149,6 +149,8 @@ func (this *Library) AddHeroFetterData(uid string, heroConfId string) { obj := this.GetLibraryListByFid(uid, fid) if obj == nil { // 没有羁绊信息 this.createHeroFetter(uid, heroConfId) + this.CreateLibrary(uid, []int32{fid}, heroConfId) + } else { // 羁绊信息中没有这个heroid 也需要加进来 for k, v := range obj.Hero { if v == 0 && k == heroConfId { diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go index 7b20d0f0f..166566e6d 100644 --- a/modules/viking/api_challengeover.go +++ b/modules/viking/api_challengeover.go @@ -64,21 +64,20 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal } viking.Boss[req.BossType] += 1 mapData["boss"] = viking.Boss - - if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { - sz := make([]*pb.LineUp, 5) - for i, v := range req.Report.Info.Redflist[0].Team { - if v != nil { - sz[i] = &pb.LineUp{ - Cid: v.HeroID, - Star: v.Star, - Lv: v.Lv, - } + } + if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 && value == req.Difficulty { + sz := make([]*pb.LineUp, 5) + for i, v := range req.Report.Info.Redflist[0].Team { + if v != nil { + sz[i] = &pb.LineUp{ + Cid: v.HeroID, + Star: v.Star, + Lv: v.Lv, } } - - this.module.modulerank.updateVikingRankList(session, req.Difficulty, req.BossType, req.Report.Info.Redflist[0].Leadpos, sz, req.Report.Costtime) } + // 刷新难度最高的记录 + this.module.modulerank.updateVikingRankList(session, req.Difficulty, req.BossType, req.Report.Info.Redflist[0].Leadpos, sz, req.Report.Costtime) } // 耗时校验 当前战斗胜利时间消耗小于之前刷新数据 code, _ = this.module.battle.CheckBattleReport(session, req.Report) diff --git a/pb/library_msg.pb.go b/pb/library_msg.pb.go index 39b7127c7..2c1403e8b 100644 --- a/pb/library_msg.pb.go +++ b/pb/library_msg.pb.go @@ -604,6 +604,54 @@ func (x *LibraryActivationFetterResp) GetData() *DBLibrary { return nil } +// 羁绊数据变化推送 +type LibraryChangePush struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []*DBLibrary `protobuf:"bytes,1,rep,name=data,proto3" json:"data"` +} + +func (x *LibraryChangePush) Reset() { + *x = LibraryChangePush{} + if protoimpl.UnsafeEnabled { + mi := &file_library_library_msg_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LibraryChangePush) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LibraryChangePush) ProtoMessage() {} + +func (x *LibraryChangePush) ProtoReflect() protoreflect.Message { + mi := &file_library_library_msg_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LibraryChangePush.ProtoReflect.Descriptor instead. +func (*LibraryChangePush) Descriptor() ([]byte, []int) { + return file_library_library_msg_proto_rawDescGZIP(), []int{12} +} + +func (x *LibraryChangePush) GetData() []*DBLibrary { + if x != nil { + return x.Data + } + return nil +} + var File_library_library_msg_proto protoreflect.FileDescriptor var file_library_library_msg_proto_rawDesc = []byte{ @@ -659,8 +707,11 @@ var file_library_library_msg_proto_rawDesc = []byte{ 0x69, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x61, 0x22, 0x33, 0x0a, 0x11, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x43, 0x68, 0x61, 0x6e, + 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -675,7 +726,7 @@ func file_library_library_msg_proto_rawDescGZIP() []byte { return file_library_library_msg_proto_rawDescData } -var file_library_library_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_library_library_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_library_library_msg_proto_goTypes = []interface{}{ (*LibraryGetListReq)(nil), // 0: LibraryGetListReq (*LibraryGetListResp)(nil), // 1: LibraryGetListResp @@ -689,23 +740,25 @@ var file_library_library_msg_proto_goTypes = []interface{}{ (*LibraryUseGiftResp)(nil), // 9: LibraryUseGiftResp (*LibraryActivationFetterReq)(nil), // 10: LibraryActivationFetterReq (*LibraryActivationFetterResp)(nil), // 11: LibraryActivationFetterResp - nil, // 12: LibraryUseGiftReq.ItemsEntry - (*DBLibrary)(nil), // 13: DBLibrary - (*DBHeroFetter)(nil), // 14: DBHeroFetter + (*LibraryChangePush)(nil), // 12: LibraryChangePush + nil, // 13: LibraryUseGiftReq.ItemsEntry + (*DBLibrary)(nil), // 14: DBLibrary + (*DBHeroFetter)(nil), // 15: DBHeroFetter } var file_library_library_msg_proto_depIdxs = []int32{ - 13, // 0: LibraryGetListResp.data:type_name -> DBLibrary - 14, // 1: LibraryGetFetterListResp.data:type_name -> DBHeroFetter - 13, // 2: LibraryGetRewardResp.data:type_name -> DBLibrary - 13, // 3: LibraryGetStoryRewardResp.data:type_name -> DBLibrary - 12, // 4: LibraryUseGiftReq.items:type_name -> LibraryUseGiftReq.ItemsEntry - 14, // 5: LibraryUseGiftResp.data:type_name -> DBHeroFetter - 13, // 6: LibraryActivationFetterResp.data:type_name -> DBLibrary - 7, // [7:7] is the sub-list for method output_type - 7, // [7:7] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 14, // 0: LibraryGetListResp.data:type_name -> DBLibrary + 15, // 1: LibraryGetFetterListResp.data:type_name -> DBHeroFetter + 14, // 2: LibraryGetRewardResp.data:type_name -> DBLibrary + 14, // 3: LibraryGetStoryRewardResp.data:type_name -> DBLibrary + 13, // 4: LibraryUseGiftReq.items:type_name -> LibraryUseGiftReq.ItemsEntry + 15, // 5: LibraryUseGiftResp.data:type_name -> DBHeroFetter + 14, // 6: LibraryActivationFetterResp.data:type_name -> DBLibrary + 14, // 7: LibraryChangePush.data:type_name -> DBLibrary + 8, // [8:8] is the sub-list for method output_type + 8, // [8:8] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name } func init() { file_library_library_msg_proto_init() } @@ -859,6 +912,18 @@ func file_library_library_msg_proto_init() { return nil } } + file_library_library_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LibraryChangePush); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -866,7 +931,7 @@ func file_library_library_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_library_library_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 14, NumExtensions: 0, NumServices: 0, },