From 990d3eafc8c4ec2c754f820359c9e9a0b0277b5e Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 4 Aug 2023 14:47:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=86=E5=85=B8=E6=B4=BB=E5=8A=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8F=98=E5=8C=96=E8=B4=B4=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/activity/module.go | 8 ++- modules/hunting/api_challengeover.go | 14 ++-- modules/viking/api_challengeover.go | 11 ++- pb/activity_db.pb.go | 2 +- pb/activity_msg.pb.go | 102 ++++++++++++++++++++++----- 6 files changed, 111 insertions(+), 28 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index d8afed5e9..02bc224a5 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -596,7 +596,7 @@ type ( UpdateActivitySlider(session IUserSession) // 修改活动进度 // 庆典活动 - HDCelebration(session IUserSession, systemtype int32, bosstype int32) + HDCelebration(session IUserSession, systemtype int32, bosstype int32) bool } //每日任务 IDailytask interface { diff --git a/modules/activity/module.go b/modules/activity/module.go index 469d168db..7bf2e14aa 100644 --- a/modules/activity/module.go +++ b/modules/activity/module.go @@ -237,13 +237,13 @@ func (this *Activity) HDCelebration(session comm.IUserSession, systemtype int32, pos++ if data.Val == pos { if conf, err := this.configure.GetHDCelebration(int32(index) + 1); err != nil { - // kay = bosstype << 8 + systemtype + if conf.Systemtype == systemtype { data.Gotarr[bosstype] += 1 // 天数 var idays int32 for i, v1 := range conf.Bosstype { - if v1 == systemtype { + if v1 == systemtype || v1 == 0 { // bosstype 为0 表示所有的boss 类型都算 idays = conf.Num[i] break } @@ -261,6 +261,10 @@ func (this *Activity) HDCelebration(session comm.IUserSession, systemtype int32, } if bChange { this.modelhdData.ModifyActivityList(session.GetUserId(), data.Id, update) + // 推送活动数据进度变化 + session.SendMsg(string(this.GetType()), "change", &pb.ActivityDataChangePush{ + Data: []*pb.DBActivityData{data}, + }) } } } diff --git a/modules/hunting/api_challengeover.go b/modules/hunting/api_challengeover.go index df348bb2a..de3afdbbf 100644 --- a/modules/hunting/api_challengeover.go +++ b/modules/hunting/api_challengeover.go @@ -97,12 +97,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha key := strconv.Itoa(int(req.BossType)) + "_" + strconv.Itoa(int(req.Difficulty)) if hunting.BossTime[key] == 0 { // 新关卡挑战通过 发放首通奖励 - //hunting.BossTime[key] = req.Report.Costtime - //mapData["bossTime"] = hunting.BossTime res = append(res, cfgHunting.Firstprize...) - // if errdata = this.module.DispenseRes(session, cfgHunting.Firstprize, true); errdata != nil { - // return - // } + for _, v := range cfgHunting.Firstprize { if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil { if _conf.Usetype == comm.UseType8 { @@ -121,6 +117,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha //reward = this.module.configure.GetDropReward(cfgHunting.Drop) // 获取掉落奖励 user := this.module.ModuleUser.GetUser(session.GetUserId()) reward = this.module.ModuleTools.GetGroupDataByLottery(cfgHunting.Drop, user.Vip, user.Lv) // 走新的掉落 + b := this.module.ModuleActivity.HDCelebration(session, 1, req.BossType) for _, v := range reward { bFound := false if v.A == "equp" { @@ -131,6 +128,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha bFound = true del = append(del, cfg.Id) res = append(res, cfg.Sale...) + if b { + del = append(del, cfg.Id) + res = append(res, cfg.Sale...) + } } break } @@ -138,6 +139,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha } if !bFound { res = append(res, v) + if b { + res = append(res, v) + } } } if errdata, atno = this.module.DispenseAtno(session, res, true); errdata != nil { diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go index 2c382d37a..d0a411257 100644 --- a/modules/viking/api_challengeover.go +++ b/modules/viking/api_challengeover.go @@ -117,6 +117,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal viking.Round[req.Auto] = req.Report.Round mapData["round"] = viking.Round } + // 连续自动战斗 if len(viking.Round) == 10 { var total int32 for _, v := range viking.Round { @@ -141,7 +142,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal user := this.module.ModuleUser.GetUser(session.GetUserId()) reward = this.module.ModuleTools.GetGroupDataByLottery(vikingCfg.Drop, user.Vip, user.Lv) - //reward = this.module.configure.GetDropReward(vikingCfg.Drop) // 获取掉落奖励 + + b := this.module.ModuleActivity.HDCelebration(session, 2, req.BossId) // 星级校验 for _, v := range reward { bFound := false @@ -153,6 +155,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal bFound = true del = append(del, cfg.Id) res = append(res, cfg.Sale...) + if b { // 活动双倍 + del = append(del, cfg.Id) + res = append(res, cfg.Sale...) + } } break } @@ -161,6 +167,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal if !bFound { res = append(res, v) + if b { // 活动双倍 + res = append(res, v) + } } } diff --git a/pb/activity_db.pb.go b/pb/activity_db.pb.go index f1031592b..7d60e0e73 100644 --- a/pb/activity_db.pb.go +++ b/pb/activity_db.pb.go @@ -332,7 +332,7 @@ type DBActivityData struct { Hdoid string `protobuf:"bytes,3,opt,name=hdoid,proto3" json:"hdoid"` // 活动唯一id Gotarr map[int32]int32 `protobuf:"bytes,4,rep,name=gotarr,proto3" json:"gotarr" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` Lasttime int64 `protobuf:"varint,5,opt,name=lasttime,proto3" json:"lasttime"` - Val int32 `protobuf:"varint,6,opt,name=val,proto3" json:"val"` // 第几天登录 + Val int32 `protobuf:"varint,6,opt,name=val,proto3" json:"val"` } func (x *DBActivityData) Reset() { diff --git a/pb/activity_msg.pb.go b/pb/activity_msg.pb.go index 003aa4c90..f0e1625e6 100644 --- a/pb/activity_msg.pb.go +++ b/pb/activity_msg.pb.go @@ -418,6 +418,54 @@ func (x *ActivityTurntableRewardResp) GetAtno() []*UserAtno { return nil } +// 活动数据变更推送 +type ActivityDataChangePush struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []*DBActivityData `protobuf:"bytes,1,rep,name=data,proto3" json:"data"` +} + +func (x *ActivityDataChangePush) Reset() { + *x = ActivityDataChangePush{} + if protoimpl.UnsafeEnabled { + mi := &file_activity_activity_msg_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActivityDataChangePush) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActivityDataChangePush) ProtoMessage() {} + +func (x *ActivityDataChangePush) ProtoReflect() protoreflect.Message { + mi := &file_activity_activity_msg_proto_msgTypes[8] + 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 ActivityDataChangePush.ProtoReflect.Descriptor instead. +func (*ActivityDataChangePush) Descriptor() ([]byte, []int) { + return file_activity_activity_msg_proto_rawDescGZIP(), []int{8} +} + +func (x *ActivityDataChangePush) GetData() []*DBActivityData { + if x != nil { + return x.Data + } + return nil +} + var File_activity_activity_msg_proto protoreflect.FileDescriptor var file_activity_activity_msg_proto_rawDesc = []byte{ @@ -455,8 +503,12 @@ var file_activity_activity_msg_proto_rawDesc = []byte{ 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, - 0x52, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x22, 0x3d, 0x0a, 0x16, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, + 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, + 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, + 0x2e, 0x44, 0x42, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -471,7 +523,7 @@ func file_activity_activity_msg_proto_rawDescGZIP() []byte { return file_activity_activity_msg_proto_rawDescData } -var file_activity_activity_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_activity_activity_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_activity_activity_msg_proto_goTypes = []interface{}{ (*ActivityGetListReq)(nil), // 0: ActivityGetListReq (*ActivityGetListResp)(nil), // 1: ActivityGetListResp @@ -481,22 +533,24 @@ var file_activity_activity_msg_proto_goTypes = []interface{}{ (*ActivityGetRewardResp)(nil), // 5: ActivityGetRewardResp (*ActivityTurntableRewardReq)(nil), // 6: ActivityTurntableRewardReq (*ActivityTurntableRewardResp)(nil), // 7: ActivityTurntableRewardResp - (*DBHuodong)(nil), // 8: DBHuodong - (*DBActivityData)(nil), // 9: DBActivityData - (*UserAtno)(nil), // 10: UserAtno + (*ActivityDataChangePush)(nil), // 8: ActivityDataChangePush + (*DBHuodong)(nil), // 9: DBHuodong + (*DBActivityData)(nil), // 10: DBActivityData + (*UserAtno)(nil), // 11: UserAtno } var file_activity_activity_msg_proto_depIdxs = []int32{ - 8, // 0: ActivityGetListResp.data:type_name -> DBHuodong - 9, // 1: ActivityGetHdDataResp.data:type_name -> DBActivityData - 9, // 2: ActivityGetRewardResp.data:type_name -> DBActivityData - 10, // 3: ActivityGetRewardResp.atno:type_name -> UserAtno - 9, // 4: ActivityTurntableRewardResp.data:type_name -> DBActivityData - 10, // 5: ActivityTurntableRewardResp.atno:type_name -> UserAtno - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 9, // 0: ActivityGetListResp.data:type_name -> DBHuodong + 10, // 1: ActivityGetHdDataResp.data:type_name -> DBActivityData + 10, // 2: ActivityGetRewardResp.data:type_name -> DBActivityData + 11, // 3: ActivityGetRewardResp.atno:type_name -> UserAtno + 10, // 4: ActivityTurntableRewardResp.data:type_name -> DBActivityData + 11, // 5: ActivityTurntableRewardResp.atno:type_name -> UserAtno + 10, // 6: ActivityDataChangePush.data:type_name -> DBActivityData + 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 } func init() { file_activity_activity_msg_proto_init() } @@ -603,6 +657,18 @@ func file_activity_activity_msg_proto_init() { return nil } } + file_activity_activity_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActivityDataChangePush); 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{ @@ -610,7 +676,7 @@ func file_activity_activity_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_activity_activity_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 0, },