From 93357d6eeba6c65b318c6c805bd680b75feb53ea Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Tue, 30 Aug 2022 12:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=9A=8F=E6=9C=BA=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 75 +++++++++++++++++-- modules/rtask/model_rtask.go | 5 ++ modules/rtask/module.go | 12 +-- pb/rtask_db.pb.go | 137 +++++++++++++++++++++++++++++++---- 4 files changed, 203 insertions(+), 26 deletions(-) diff --git a/comm/const.go b/comm/const.go index fa5c8a7ef..6c1bcdc3e 100644 --- a/comm/const.go +++ b/comm/const.go @@ -197,12 +197,75 @@ const ( // 随机任务类型 const ( - RtaskTypeHeroTarget TaskType = 1 //英雄指定 - RtaskTypePoltId TaskType = 2 //剧情ID - RtaskTypeTaskDay TaskType = 3 //每日任务 - RtaskTypeHeroLvTarget TaskType = 4 //指定英雄的等级 - RtaskTypeEquipNum TaskType = 5 //指定英雄的装备数量 - RtaskTypeHeroStarTarget TaskType = 6 //指定英雄的星级 + Rtype1 TaskType = 1 //英雄指定 + Rtype2 TaskType = 2 //主线之内触发了剧情Id + Rtype3 TaskType = 3 //每日任务 + Rtask4 TaskType = 4 //指定英雄的等级限制 + Rtype5 TaskType = 5 //指定英雄的装备数量 + Rtype6 TaskType = 6 //指定英雄的星级 + Rtype7 TaskType = 7 //日常登录一次 + Rtype8 TaskType = 8 //累计登陆xx天 + Rtype9 TaskType = 9 //连续登陆xx天 + Rtype10 TaskType = 10 //拥有xx个好友 + Rtype11 TaskType = 11 //赠送X次友情点 + Rtask12 TaskType = 12 //使用好友助战英雄xx次 + Rtask13 TaskType = 13 //更换X次助战英雄 + Rtype14 TaskType = 14 //累计xx次普通招募 + Rtype15 TaskType = 15 //累计xx次阵营招募 + Rtype16 TaskType = 16 //招募获得xx品质英雄xx个 + Rtype17 TaskType = 17 //普通招募十连,获得xx个以上xx星英雄 + Rtype18 TaskType = 18 //xx次普通招募 + Rtype19 TaskType = 19 //xx次阵营招募 + Rtype20 TaskType = 20 //用户等级达到xx级 + Rtype21 TaskType = 21 //英雄合成xx次 + Rtype22 TaskType = 22 //合成xx英雄 + Rtype23 TaskType = 23 //拥有xx个xx星级的xx等级英雄 + Rtype24 TaskType = 24 //为任意英雄提升xx次等级 + Rtype25 TaskType = 25 //xx名xx英雄升至xx星 + Rtype26 TaskType = 26 //xx名英雄从三星升四星 + Rtype27 TaskType = 27 //xx名英雄从四星升五星 + Rtype28 TaskType = 28 //xx名英雄从五星升六星 + Rtype29 TaskType = 29 //拥有xx个xx级及以上的【xx】英雄 + Rtype30 TaskType = 30 //获得xx个品质为xx的英雄 + Rtype31 TaskType = 31 //获得xx个品质为xx以上的英雄 + Rtype32 TaskType = 32 //xx个品质为xx的英雄升到xx级 + Rtype33 TaskType = 33 //xx个品质为xx以及以上英雄升到xx级 + Rtype34 TaskType = 34 //xx个英雄觉醒达到xx阶段 + Rtype35 TaskType = 35 //xx英雄觉醒达到xx阶段 + Rtype36 TaskType = 36 //xx位xx品质xx职业英雄(xx阵营)觉醒达到xx阶段 + Rtype37 TaskType = 37 //xx名xx品质英雄满共鸣、等级、觉醒 + Rtype38 TaskType = 38 //xx英雄满级、共鸣、觉醒至最高状态 + Rtype39 TaskType = 39 //累计英雄共鸣xx次 + Rtype40 TaskType = 40 //xx个英雄共鸣满xx次 + Rtype41 TaskType = 41 //xx名英雄穿戴xx件xx星级的装备 + Rtype42 TaskType = 42 //xx名英雄穿戴xx件xx等级的装备 + Rtype43 TaskType = 43 //将xx件装备强化至xx级 + Rtype44 TaskType = 44 //任意装备强化到xx级 + Rtype45 TaskType = 45 //将xx件xx星【xx】套装装备强化至xx级 + Rtype46 TaskType = 46 //为xx名英雄穿戴完整xx星【xx】套装装备 + Rtype47 TaskType = 47 //累计强化装备成功xx次 + Rtype48 TaskType = 48 //xx次xx星的二件套装备强化至xx并穿戴 + Rtype49 TaskType = 49 //xx次xx星的四件套装备强化至xx并穿戴 + Rtype50 TaskType = 50 //获得xx星以上装备xx件 + Rtype51 TaskType = 51 //在铁匠铺中获得xx件xx星装备 + Rtype52 TaskType = 52 //xx英雄提升xx次技能等级 + Rtype53 TaskType = 53 //技能升级累计xx次 + Rtype54 TaskType = 54 //x名卡牌角色技能全满级 + Rtype55 TaskType = 55 //xx品质英雄提升xx次技能等级 + Rtype56 TaskType = 56 //拥有xx名技能升级xx次的xx职业英雄 + Rtype57 TaskType = 57 //xx名英雄技能满级 + Rtype58 TaskType = 58 //通关任意普通爬塔层数 + Rtype59 TaskType = 59 //通关普通爬塔xx层 + Rtype60 TaskType = 60 //任意主线副本通关1次 + Rtype61 TaskType = 61 //通关主线关卡xx + Rtype62 TaskType = 62 //世界聊天发言xx次 + Rtype63 TaskType = 63 //日常任务活跃度达到xx + Rtype64 TaskType = 64 //任意商品购买xx次 + Rtype65 TaskType = 65 //在商店购买xx商品xx件 + Rtype66 TaskType = 66 //xx商店购买任意商品xx次 + Rtype67 TaskType = 67 //商店购物消耗xx货币xx个 + Rtype68 TaskType = 68 //任意渠道消耗xx金币 + Rtype69 TaskType = 69 //与其他玩家切磋xx次 ) const ( diff --git a/modules/rtask/model_rtask.go b/modules/rtask/model_rtask.go index c8b057ac8..271c84166 100644 --- a/modules/rtask/model_rtask.go +++ b/modules/rtask/model_rtask.go @@ -81,6 +81,11 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32) (ok bool) { return false } +// 任务记录 +func (this *ModelRtask) record(uid string,rtypeId int32, val... int32) { + +} + // 英雄指定 func (this *ModelRtask) HeroTarget(uid string, cfg *cfg.GameRdtaskCondiData) (ok bool) { heroModule, err := this.service.GetModule(comm.ModuleHero) diff --git a/modules/rtask/module.go b/modules/rtask/module.go index 113691115..21059d513 100644 --- a/modules/rtask/module.go +++ b/modules/rtask/module.go @@ -73,35 +73,35 @@ func (this *ModuleRtask) initRtaskHandle() { if typeCfg, err := this.configure.getRtaskTypeById(v.Id); err == nil { if typeCfg != nil { switch comm.TaskType(typeCfg.Type) { - case comm.RtaskTypeHeroTarget: + case comm.Rtype1: this.register(v.Id, &rtaskCondi{ cfg: typeCfg, fn: this.modelRtask.HeroTarget, }) - case comm.RtaskTypeHeroLvTarget: + case comm.Rtask4: this.register(v.Id, &rtaskCondi{ cfg: typeCfg, fn: this.modelRtask.HeroLvTarget, }) - case comm.RtaskTypeHeroStarTarget: + case comm.Rtype6: this.register(v.Id, &rtaskCondi{ cfg: typeCfg, fn: this.modelRtask.HeroStarTarget, }) - case comm.RtaskTypeEquipNum: + case comm.Rtype5: this.register(v.Id, &rtaskCondi{ cfg: typeCfg, fn: this.modelRtask.EquipNum, }) - case comm.RtaskTypePoltId: + case comm.Rtype2: this.register(v.Id, &rtaskCondi{ cfg: typeCfg, fn: this.modelRtask.PoltId, }) - case comm.RtaskTypeTaskDay: + case comm.Rtype3: this.register(v.Id, &rtaskCondi{ cfg: typeCfg, fn: this.modelRtask.TaskDay, diff --git a/pb/rtask_db.pb.go b/pb/rtask_db.pb.go index 8af2fa3ab..c0352fec8 100644 --- a/pb/rtask_db.pb.go +++ b/pb/rtask_db.pb.go @@ -67,6 +67,7 @@ func (x *FrtaskIds) GetRtaskIds() []int32 { return nil } +// 玩家任务状态 type DBRtask struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -146,6 +147,86 @@ func (x *DBRtask) GetIsReward() bool { return false } +// 玩家任务记录 +type DBRtaskRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID + RType int32 `protobuf:"varint,3,opt,name=rType,proto3" json:"rType" bson:"rType"` //任务类型 + Vals map[int32]int32 `protobuf:"bytes,4,rep,name=vals,proto3" json:"vals" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"vals"` //任务记录值 + Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp"` //@go_tasg(`bson:"timestamp"`) 时间戳 +} + +func (x *DBRtaskRecord) Reset() { + *x = DBRtaskRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_rtask_rtask_db_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBRtaskRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBRtaskRecord) ProtoMessage() {} + +func (x *DBRtaskRecord) ProtoReflect() protoreflect.Message { + mi := &file_rtask_rtask_db_proto_msgTypes[2] + 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 DBRtaskRecord.ProtoReflect.Descriptor instead. +func (*DBRtaskRecord) Descriptor() ([]byte, []int) { + return file_rtask_rtask_db_proto_rawDescGZIP(), []int{2} +} + +func (x *DBRtaskRecord) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBRtaskRecord) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *DBRtaskRecord) GetRType() int32 { + if x != nil { + return x.RType + } + return 0 +} + +func (x *DBRtaskRecord) GetVals() map[int32]int32 { + if x != nil { + return x.Vals + } + return nil +} + +func (x *DBRtaskRecord) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + var File_rtask_rtask_db_proto protoreflect.FileDescriptor var file_rtask_rtask_db_proto_rawDesc = []byte{ @@ -167,8 +248,21 @@ var file_rtask_rtask_db_proto_rawDesc = []byte{ 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x66, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, - 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, - 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xcc, 0x01, 0x0a, + 0x0d, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x0a, 0x04, 0x76, 0x61, 0x6c, 0x73, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x2e, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, + 0x76, 0x61, 0x6c, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x1a, 0x37, 0x0a, 0x09, 0x56, 0x61, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -183,20 +277,23 @@ func file_rtask_rtask_db_proto_rawDescGZIP() []byte { return file_rtask_rtask_db_proto_rawDescData } -var file_rtask_rtask_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_rtask_rtask_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_rtask_rtask_db_proto_goTypes = []interface{}{ - (*FrtaskIds)(nil), // 0: frtaskIds - (*DBRtask)(nil), // 1: DBRtask - nil, // 2: DBRtask.FrtaskIdsEntry + (*FrtaskIds)(nil), // 0: frtaskIds + (*DBRtask)(nil), // 1: DBRtask + (*DBRtaskRecord)(nil), // 2: DBRtaskRecord + nil, // 3: DBRtask.FrtaskIdsEntry + nil, // 4: DBRtaskRecord.ValsEntry } var file_rtask_rtask_db_proto_depIdxs = []int32{ - 2, // 0: DBRtask.frtaskIds:type_name -> DBRtask.FrtaskIdsEntry - 0, // 1: DBRtask.FrtaskIdsEntry.value:type_name -> frtaskIds - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 3, // 0: DBRtask.frtaskIds:type_name -> DBRtask.FrtaskIdsEntry + 4, // 1: DBRtaskRecord.vals:type_name -> DBRtaskRecord.ValsEntry + 0, // 2: DBRtask.FrtaskIdsEntry.value:type_name -> frtaskIds + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_rtask_rtask_db_proto_init() } @@ -229,6 +326,18 @@ func file_rtask_rtask_db_proto_init() { return nil } } + file_rtask_rtask_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBRtaskRecord); 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{ @@ -236,7 +345,7 @@ func file_rtask_rtask_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_rtask_rtask_db_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 5, NumExtensions: 0, NumServices: 0, },