diff --git a/comm/imodule.go b/comm/imodule.go index e14cbaabc..cb886ab70 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -608,6 +608,8 @@ type ( BingoJumpLevel(session IUserSession, level int32) (errdata *pb.ErrorData) //查询主线通关进度 InquireMainLinePassLevel(uid string) (levels map[int32]int32) + // 任务条件达成通知 + IBuriedUpdateNotify } //工会boos战 IGuildgve interface { diff --git a/modules/mainline/api_shop.go b/modules/mainline/api_shop.go index dcc826e3c..c647f80bd 100644 --- a/modules/mainline/api_shop.go +++ b/modules/mainline/api_shop.go @@ -17,7 +17,6 @@ func (this *apiComp) Shop(session comm.IUserSession, req *pb.MainlineShopReq) (e info *pb.DBMainlineShop err error shopinfo []*cfg.GameMainShopItemData - szUnlock []int32 condiIds []int32 ) errdata = this.ShopCheck(session, req) @@ -42,7 +41,6 @@ func (this *apiComp) Shop(session comm.IUserSession, req *pb.MainlineShopReq) (e if data, err := this.module.ModuleBuried.CheckCondition(session.GetUserId(), condiIds...); err == nil { for pos, v := range data { if int32(v.State) == 1 { // 记录解锁的数据 - szUnlock = append(szUnlock, int32(v.State)) shopid := shopinfo[pos].Shopid if _, ok := info.Unlock[shopid]; !ok { info.Unlock[shopid] = 1 diff --git a/modules/mainline/module.go b/modules/mainline/module.go index eb8e45246..c05b3afb2 100644 --- a/modules/mainline/module.go +++ b/modules/mainline/module.go @@ -3,6 +3,7 @@ package mainline import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -155,3 +156,33 @@ func (this *Mainline) InquireMainLinePassLevel(uid string) (levels map[int32]int levels = info.Level return } + +// 埋点完成通知 +func (this *Mainline) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIProgress) { + this.Debug("主线任务通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "conds", Value: conds}) + var ( + szChange []int32 + ) + info, err := this.modelShop.getMainlineShopData(session.GetUserId()) + if err == nil { + shopinfo := this.configure.GetAllShopConf() + + info.Unlock = make(map[int32]int32) + for _, v1 := range shopinfo { + if _, ok := info.Unlock[v1.Id]; !ok { + for _, v := range conds { + if int32(v.State) == 1 && v.Conid == v1.Unlock { // 记录解锁的数据 + info.Unlock[v1.Id] = 1 + szChange = append(szChange, v1.Id) + } + } + } + } + if len(szChange) > 0 { + this.modelShop.updateMainlineShopData(session.GetUserId(), info) + session.SendMsg(string(this.GetType()), "shopchange", &pb.MainlineShopChangePush{ + Cid: szChange, + }) + } + } +} diff --git a/pb/mainline_msg.pb.go b/pb/mainline_msg.pb.go index f65973214..29af47210 100644 --- a/pb/mainline_msg.pb.go +++ b/pb/mainline_msg.pb.go @@ -821,6 +821,53 @@ func (x *MainlineShopBuyResp) GetItem() []*UserAtno { return nil } +type MainlineShopChangePush struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Cid []int32 `protobuf:"varint,1,rep,packed,name=cid,proto3" json:"cid"` // 商店解锁数据变更推送 +} + +func (x *MainlineShopChangePush) Reset() { + *x = MainlineShopChangePush{} + if protoimpl.UnsafeEnabled { + mi := &file_mainline_mainline_msg_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MainlineShopChangePush) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MainlineShopChangePush) ProtoMessage() {} + +func (x *MainlineShopChangePush) ProtoReflect() protoreflect.Message { + mi := &file_mainline_mainline_msg_proto_msgTypes[14] + 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 MainlineShopChangePush.ProtoReflect.Descriptor instead. +func (*MainlineShopChangePush) Descriptor() ([]byte, []int) { + return file_mainline_mainline_msg_proto_rawDescGZIP(), []int{14} +} + +func (x *MainlineShopChangePush) GetCid() []int32 { + if x != nil { + return x.Cid + } + return nil +} + var File_mainline_mainline_msg_proto protoreflect.FileDescriptor var file_mainline_mainline_msg_proto_rawDesc = []byte{ @@ -903,8 +950,10 @@ var file_mainline_mainline_msg_proto_rawDesc = []byte{ 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x1d, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x04, 0x69, 0x74, 0x65, - 0x6d, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6d, 0x22, 0x2a, 0x0a, 0x16, 0x4d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x68, 0x6f, + 0x70, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x63, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -919,7 +968,7 @@ func file_mainline_mainline_msg_proto_rawDescGZIP() []byte { return file_mainline_mainline_msg_proto_rawDescData } -var file_mainline_mainline_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_mainline_mainline_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_mainline_mainline_msg_proto_goTypes = []interface{}{ (*MainlineInfoReq)(nil), // 0: MainlineInfoReq (*MainlineInfoResp)(nil), // 1: MainlineInfoResp @@ -935,24 +984,25 @@ var file_mainline_mainline_msg_proto_goTypes = []interface{}{ (*MainlineShopResp)(nil), // 11: MainlineShopResp (*MainlineShopBuyReq)(nil), // 12: MainlineShopBuyReq (*MainlineShopBuyResp)(nil), // 13: MainlineShopBuyResp - (*DBMainline)(nil), // 14: DBMainline - (*BattleFormation)(nil), // 15: BattleFormation - (*BattleInfo)(nil), // 16: BattleInfo - (*BattleReport)(nil), // 17: BattleReport - (*UserAtno)(nil), // 18: UserAtno - (*DBMainlineShop)(nil), // 19: DBMainlineShop + (*MainlineShopChangePush)(nil), // 14: MainlineShopChangePush + (*DBMainline)(nil), // 15: DBMainline + (*BattleFormation)(nil), // 16: BattleFormation + (*BattleInfo)(nil), // 17: BattleInfo + (*BattleReport)(nil), // 18: BattleReport + (*UserAtno)(nil), // 19: UserAtno + (*DBMainlineShop)(nil), // 20: DBMainlineShop } var file_mainline_mainline_msg_proto_depIdxs = []int32{ - 14, // 0: MainlineInfoResp.info:type_name -> DBMainline - 15, // 1: MainlineChallengeReq.battle:type_name -> BattleFormation - 16, // 2: MainlineChallengeResp.info:type_name -> BattleInfo - 17, // 3: MainlineChallengeOverReq.report:type_name -> BattleReport - 18, // 4: MainlineChallengeOverResp.reward:type_name -> UserAtno - 18, // 5: MainlineLevelPassResp.reward:type_name -> UserAtno - 18, // 6: MainlineReceiveAwardResp.reward:type_name -> UserAtno - 19, // 7: MainlineShopResp.info:type_name -> DBMainlineShop - 19, // 8: MainlineShopBuyResp.info:type_name -> DBMainlineShop - 18, // 9: MainlineShopBuyResp.item:type_name -> UserAtno + 15, // 0: MainlineInfoResp.info:type_name -> DBMainline + 16, // 1: MainlineChallengeReq.battle:type_name -> BattleFormation + 17, // 2: MainlineChallengeResp.info:type_name -> BattleInfo + 18, // 3: MainlineChallengeOverReq.report:type_name -> BattleReport + 19, // 4: MainlineChallengeOverResp.reward:type_name -> UserAtno + 19, // 5: MainlineLevelPassResp.reward:type_name -> UserAtno + 19, // 6: MainlineReceiveAwardResp.reward:type_name -> UserAtno + 20, // 7: MainlineShopResp.info:type_name -> DBMainlineShop + 20, // 8: MainlineShopBuyResp.info:type_name -> DBMainlineShop + 19, // 9: MainlineShopBuyResp.item:type_name -> UserAtno 10, // [10:10] is the sub-list for method output_type 10, // [10:10] is the sub-list for method input_type 10, // [10:10] is the sub-list for extension type_name @@ -1137,6 +1187,18 @@ func file_mainline_mainline_msg_proto_init() { return nil } } + file_mainline_mainline_msg_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MainlineShopChangePush); 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{ @@ -1144,7 +1206,7 @@ func file_mainline_mainline_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_mainline_mainline_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 15, NumExtensions: 0, NumServices: 0, },