庆典活动数据变化贴推送

This commit is contained in:
meixiongfeng 2023-08-04 14:47:52 +08:00
parent e7959048eb
commit 990d3eafc8
6 changed files with 111 additions and 28 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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