From c7ed61fb5a29e0b36d50628bc414023120f6301b Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 2 Nov 2023 14:01:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=B5=B0=E6=A3=8B?= =?UTF-8?q?=E6=B8=B8=E6=88=8F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/caninerabbit/module.go | 8 ++++---- pb/caninerabbit_db.pb.go | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/caninerabbit/module.go b/modules/caninerabbit/module.go index f725edea7..5f530b599 100644 --- a/modules/caninerabbit/module.go +++ b/modules/caninerabbit/module.go @@ -91,25 +91,25 @@ func (this *CanineRabbit) CreateRoom(sessions []comm.IUserSession, rulesStr stri roomid = primitive.NewObjectID().Hex() chess = append(chess, &pb.DBCanineRabbitChess{ - Id: primitive.NewObjectID().Hex(), + Id: 1, Stype: 0, X: 4, Y: 1, }) chess = append(chess, &pb.DBCanineRabbitChess{ - Id: primitive.NewObjectID().Hex(), + Id: 2, Stype: 1, X: 1, Y: 0, }) chess = append(chess, &pb.DBCanineRabbitChess{ - Id: primitive.NewObjectID().Hex(), + Id: 3, Stype: 1, X: 0, Y: 1, }) chess = append(chess, &pb.DBCanineRabbitChess{ - Id: primitive.NewObjectID().Hex(), + Id: 4, Stype: 1, X: 1, Y: 2, diff --git a/pb/caninerabbit_db.pb.go b/pb/caninerabbit_db.pb.go index e089bed60..847042adb 100644 --- a/pb/caninerabbit_db.pb.go +++ b/pb/caninerabbit_db.pb.go @@ -170,10 +170,10 @@ type DBCanineRabbitChess struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` - Stype int32 `protobuf:"varint,2,opt,name=stype,proto3" json:"stype"` //0兔子 1猎犬 - X int32 `protobuf:"varint,3,opt,name=x,proto3" json:"x"` - Y int32 `protobuf:"varint,4,opt,name=y,proto3" json:"y"` + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + Stype int32 `protobuf:"varint,2,opt,name=stype,proto3" json:"stype"` //0兔子 1猎犬 + X int32 `protobuf:"varint,3,opt,name=x,proto3" json:"x"` + Y int32 `protobuf:"varint,4,opt,name=y,proto3" json:"y"` } func (x *DBCanineRabbitChess) Reset() { @@ -208,11 +208,11 @@ func (*DBCanineRabbitChess) Descriptor() ([]byte, []int) { return file_caninerabbit_caninerabbit_db_proto_rawDescGZIP(), []int{2} } -func (x *DBCanineRabbitChess) GetId() string { +func (x *DBCanineRabbitChess) GetId() int32 { if x != nil { return x.Id } - return "" + return 0 } func (x *DBCanineRabbitChess) GetStype() int32 { @@ -432,7 +432,7 @@ var file_caninerabbit_caninerabbit_db_proto_rawDesc = []byte{ 0x0a, 0x09, 0x48, 0x65, 0x61, 0x64, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x48, 0x65, 0x61, 0x64, 0x73, 0x74, 0x61, 0x72, 0x74, 0x22, 0x57, 0x0a, 0x13, 0x44, 0x42, 0x43, 0x61, 0x6e, 0x69, 0x6e, 0x65, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x43, 0x68, - 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x74, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x04, 0x20, 0x01, From 7bc8592e27d8c5b5df84da5d87f75142ee069d1e Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 2 Nov 2023 14:35:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=BD=A9=E8=9B=8B?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_hero.json | 4 +- comm/const.go | 3 + modules/egghunt/api.go | 17 ++ modules/egghunt/api_award.go | 37 ++++ modules/egghunt/configure.go | 41 ++++ modules/egghunt/model.go | 45 +++++ modules/egghunt/module.go | 49 +++++ pb/egghunt_db.pb.go | 151 ++++++++++++++ pb/egghunt_msg.pb.go | 217 +++++++++++++++++++++ services/worker/main.go | 2 + sys/configure/structs/Game.TDLv.go | 42 ++++ sys/configure/structs/Game.TDLvData.go | 37 ++++ sys/configure/structs/Game.TDWeapon.go | 42 ++++ sys/configure/structs/Game.TDWeaponData.go | 51 +++++ sys/configure/structs/Tables.go | 21 +- 15 files changed, 750 insertions(+), 9 deletions(-) create mode 100644 modules/egghunt/api.go create mode 100644 modules/egghunt/api_award.go create mode 100644 modules/egghunt/configure.go create mode 100644 modules/egghunt/model.go create mode 100644 modules/egghunt/module.go create mode 100644 pb/egghunt_db.pb.go create mode 100644 pb/egghunt_msg.pb.go create mode 100644 sys/configure/structs/Game.TDLv.go create mode 100644 sys/configure/structs/Game.TDLvData.go create mode 100644 sys/configure/structs/Game.TDWeapon.go create mode 100644 sys/configure/structs/Game.TDWeaponData.go diff --git a/bin/json/game_hero.json b/bin/json/game_hero.json index e96dd9297..1f70bafc2 100644 --- a/bin/json/game_hero.json +++ b/bin/json/game_hero.json @@ -10925,7 +10925,7 @@ "hid": "54015", "name": { "key": "hero_main_name_54015", - "text": "伪装老太太" + "text": "受伤的老太太" }, "star": 3, "color": 2, @@ -10996,7 +10996,7 @@ "expitemnum": 7, "herointr": { "key": "hero_main_herointr_140", - "text": "传说中的守护者“伪装老太太”,拥有不俗的战斗能力" + "text": "传说中的守护者“受伤的老太太”,拥有不俗的战斗能力" } }, { diff --git a/comm/const.go b/comm/const.go index e47b23fb2..0d1852e6c 100644 --- a/comm/const.go +++ b/comm/const.go @@ -121,6 +121,7 @@ const ( ModuleGameInvite core.M_Modules = "gameinvite" //游戏邀请 ModuleCanineRabbit core.M_Modules = "caninerabbit" //犬兔游戏 ModuleIsLand core.M_Modules = "island" //海岛探险 + ModuleEgghunt core.M_Modules = "egghunt" //彩蛋 ) // 数据表名定义处 @@ -412,6 +413,8 @@ const ( TableIsLand = "island" //海岛 TableIsLandHero = "islandhero" + //彩蛋 + TableEgghunt = "egghunt" ) // RPC服务接口定义处 diff --git a/modules/egghunt/api.go b/modules/egghunt/api.go new file mode 100644 index 000000000..6095e969c --- /dev/null +++ b/modules/egghunt/api.go @@ -0,0 +1,17 @@ +package egghunt + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type apiComp struct { + modules.MCompGate + module *Egghunt +} + +func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + _ = this.MCompGate.Init(service, module, comp, options) + this.module = module.(*Egghunt) + return +} diff --git a/modules/egghunt/api_award.go b/modules/egghunt/api_award.go new file mode 100644 index 000000000..14196fdd1 --- /dev/null +++ b/modules/egghunt/api_award.go @@ -0,0 +1,37 @@ +package egghunt + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" +) + +func (this *apiComp) AwardCheck(session comm.IUserSession, req *pb.EgghuntAwardReq) (errdata *pb.ErrorData) { + return +} + +func (this *apiComp) Award(session comm.IUserSession, req *pb.EgghuntAwardReq) (errdata *pb.ErrorData) { + var ( + conf *cfg.GameRepeatAllData + atno []*pb.UserAtno + err error + ) + if errdata = this.AwardCheck(session, req); errdata != nil { + return + } + + if conf, err = this.module.configure.getGameRepeatAllData(req.Id); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } + + if errdata, atno = this.module.DispenseAtno(session, conf.Reward, true); errdata != nil { + return + } + + session.SendMsg(string(this.module.GetType()), "info", &pb.EgghuntAwardResp{Id: req.Id, Award: atno}) + return +} diff --git a/modules/egghunt/configure.go b/modules/egghunt/configure.go new file mode 100644 index 000000000..359ec2375 --- /dev/null +++ b/modules/egghunt/configure.go @@ -0,0 +1,41 @@ +package egghunt + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + cfg "go_dreamfactory/sys/configure/structs" +) + +const ( + game_repeatall = "game_repeatall.json" +) + +type configureComp struct { + modules.MCompConfigure + module *Egghunt +} + +func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompConfigure.Init(service, module, comp, options) + err = this.LoadConfigure(game_repeatall, cfg.NewGameRepeatAll) + return +} + +// 读取装备出售系数配置 +func (this *configureComp) getGameRepeatAllData(id int32) (result *cfg.GameRepeatAllData, err error) { + var ( + v interface{} + ok bool + ) + if v, err = this.GetConfigure(game_repeatall); err != nil { + this.module.Errorf("err:%v", err) + return + } else { + if result, ok = v.(*cfg.GameRepeatAll).GetDataMap()[id]; !ok { + err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_repeatall, id) + return + } + } + return +} diff --git a/modules/egghunt/model.go b/modules/egghunt/model.go new file mode 100644 index 000000000..ab7161228 --- /dev/null +++ b/modules/egghunt/model.go @@ -0,0 +1,45 @@ +package egghunt + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/mgo" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + + "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" +) + +type modelComp struct { + modules.MCompModel + module *Egghunt +} + +func (this *modelComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompModel.Init(service, module, comp, options) + this.TableName = comm.TableEgghunt + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) + return +} + +// 获取用户全部的埋点数据 +func (this *modelComp) getModel(uid string) (info *pb.DBDColor, err error) { + info = &pb.DBDColor{} + if err = this.Get(uid, info); err != nil && err != mgo.MongodbNil { + this.module.Errorln(err) + return + } + if err == mgo.MongodbNil { + info = &pb.DBDColor{ + Id: primitive.NewObjectID().Hex(), + Uid: uid, + Integral: 0, + } + err = this.Add(uid, info) + } + return +} diff --git a/modules/egghunt/module.go b/modules/egghunt/module.go new file mode 100644 index 000000000..59ab1dfb9 --- /dev/null +++ b/modules/egghunt/module.go @@ -0,0 +1,49 @@ +package egghunt + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +func NewModule() core.IModule { + m := new(Egghunt) + return m +} + +/* +模块名称:猜颜色 +*/ +type Egghunt struct { + modules.ModuleBase + service comm.IService + api *apiComp + configure *configureComp + model *modelComp +} + +// 模块名 +func (this *Egghunt) GetType() core.M_Modules { + return comm.ModuleEgghunt +} + +// 模块初始化接口 注册用户创建角色事件 +func (this *Egghunt) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { + err = this.ModuleBase.Init(service, module, options) + this.service = service.(comm.IService) + return +} + +func (this *Egghunt) Start() (err error) { + if err = this.ModuleBase.Start(); err != nil { + return + } + return +} + +func (this *Egghunt) OnInstallComp() { + this.ModuleBase.OnInstallComp() + this.api = this.RegisterComp(new(apiComp)).(*apiComp) + this.configure = this.RegisterComp(new(configureComp)).(*configureComp) + this.model = this.RegisterComp(new(modelComp)).(*modelComp) +} diff --git a/pb/egghunt_db.pb.go b/pb/egghunt_db.pb.go new file mode 100644 index 000000000..89c4fde0a --- /dev/null +++ b/pb/egghunt_db.pb.go @@ -0,0 +1,151 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: egghunt/egghunt_db.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//彩蛋 +type DBEgghunt struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户ID +} + +func (x *DBEgghunt) Reset() { + *x = DBEgghunt{} + if protoimpl.UnsafeEnabled { + mi := &file_egghunt_egghunt_db_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBEgghunt) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBEgghunt) ProtoMessage() {} + +func (x *DBEgghunt) ProtoReflect() protoreflect.Message { + mi := &file_egghunt_egghunt_db_proto_msgTypes[0] + 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 DBEgghunt.ProtoReflect.Descriptor instead. +func (*DBEgghunt) Descriptor() ([]byte, []int) { + return file_egghunt_egghunt_db_proto_rawDescGZIP(), []int{0} +} + +func (x *DBEgghunt) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBEgghunt) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +var File_egghunt_egghunt_db_proto protoreflect.FileDescriptor + +var file_egghunt_egghunt_db_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x65, 0x67, 0x67, 0x68, 0x75, 0x6e, 0x74, 0x2f, 0x65, 0x67, 0x67, 0x68, 0x75, 0x6e, + 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x09, 0x44, 0x42, + 0x45, 0x67, 0x67, 0x68, 0x75, 0x6e, 0x74, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_egghunt_egghunt_db_proto_rawDescOnce sync.Once + file_egghunt_egghunt_db_proto_rawDescData = file_egghunt_egghunt_db_proto_rawDesc +) + +func file_egghunt_egghunt_db_proto_rawDescGZIP() []byte { + file_egghunt_egghunt_db_proto_rawDescOnce.Do(func() { + file_egghunt_egghunt_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_egghunt_egghunt_db_proto_rawDescData) + }) + return file_egghunt_egghunt_db_proto_rawDescData +} + +var file_egghunt_egghunt_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_egghunt_egghunt_db_proto_goTypes = []interface{}{ + (*DBEgghunt)(nil), // 0: DBEgghunt +} +var file_egghunt_egghunt_db_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_egghunt_egghunt_db_proto_init() } +func file_egghunt_egghunt_db_proto_init() { + if File_egghunt_egghunt_db_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_egghunt_egghunt_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBEgghunt); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_egghunt_egghunt_db_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_egghunt_egghunt_db_proto_goTypes, + DependencyIndexes: file_egghunt_egghunt_db_proto_depIdxs, + MessageInfos: file_egghunt_egghunt_db_proto_msgTypes, + }.Build() + File_egghunt_egghunt_db_proto = out.File + file_egghunt_egghunt_db_proto_rawDesc = nil + file_egghunt_egghunt_db_proto_goTypes = nil + file_egghunt_egghunt_db_proto_depIdxs = nil +} diff --git a/pb/egghunt_msg.pb.go b/pb/egghunt_msg.pb.go new file mode 100644 index 000000000..de380d64f --- /dev/null +++ b/pb/egghunt_msg.pb.go @@ -0,0 +1,217 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: egghunt/egghunt_msg.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type EgghuntAwardReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` +} + +func (x *EgghuntAwardReq) Reset() { + *x = EgghuntAwardReq{} + if protoimpl.UnsafeEnabled { + mi := &file_egghunt_egghunt_msg_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EgghuntAwardReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EgghuntAwardReq) ProtoMessage() {} + +func (x *EgghuntAwardReq) ProtoReflect() protoreflect.Message { + mi := &file_egghunt_egghunt_msg_proto_msgTypes[0] + 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 EgghuntAwardReq.ProtoReflect.Descriptor instead. +func (*EgghuntAwardReq) Descriptor() ([]byte, []int) { + return file_egghunt_egghunt_msg_proto_rawDescGZIP(), []int{0} +} + +func (x *EgghuntAwardReq) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +type EgghuntAwardResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + Award []*UserAtno `protobuf:"bytes,3,rep,name=award,proto3" json:"award"` //获取资源 +} + +func (x *EgghuntAwardResp) Reset() { + *x = EgghuntAwardResp{} + if protoimpl.UnsafeEnabled { + mi := &file_egghunt_egghunt_msg_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EgghuntAwardResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EgghuntAwardResp) ProtoMessage() {} + +func (x *EgghuntAwardResp) ProtoReflect() protoreflect.Message { + mi := &file_egghunt_egghunt_msg_proto_msgTypes[1] + 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 EgghuntAwardResp.ProtoReflect.Descriptor instead. +func (*EgghuntAwardResp) Descriptor() ([]byte, []int) { + return file_egghunt_egghunt_msg_proto_rawDescGZIP(), []int{1} +} + +func (x *EgghuntAwardResp) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *EgghuntAwardResp) GetAward() []*UserAtno { + if x != nil { + return x.Award + } + return nil +} + +var File_egghunt_egghunt_msg_proto protoreflect.FileDescriptor + +var file_egghunt_egghunt_msg_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x65, 0x67, 0x67, 0x68, 0x75, 0x6e, 0x74, 0x2f, 0x65, 0x67, 0x67, 0x68, 0x75, 0x6e, + 0x74, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, + 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x21, 0x0a, 0x0f, 0x45, 0x67, 0x67, 0x68, 0x75, + 0x6e, 0x74, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x43, 0x0a, 0x10, 0x45, 0x67, + 0x67, 0x68, 0x75, 0x6e, 0x74, 0x41, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, + 0x0a, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x05, 0x61, 0x77, 0x61, 0x72, 0x64, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_egghunt_egghunt_msg_proto_rawDescOnce sync.Once + file_egghunt_egghunt_msg_proto_rawDescData = file_egghunt_egghunt_msg_proto_rawDesc +) + +func file_egghunt_egghunt_msg_proto_rawDescGZIP() []byte { + file_egghunt_egghunt_msg_proto_rawDescOnce.Do(func() { + file_egghunt_egghunt_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_egghunt_egghunt_msg_proto_rawDescData) + }) + return file_egghunt_egghunt_msg_proto_rawDescData +} + +var file_egghunt_egghunt_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_egghunt_egghunt_msg_proto_goTypes = []interface{}{ + (*EgghuntAwardReq)(nil), // 0: EgghuntAwardReq + (*EgghuntAwardResp)(nil), // 1: EgghuntAwardResp + (*UserAtno)(nil), // 2: UserAtno +} +var file_egghunt_egghunt_msg_proto_depIdxs = []int32{ + 2, // 0: EgghuntAwardResp.award:type_name -> UserAtno + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_egghunt_egghunt_msg_proto_init() } +func file_egghunt_egghunt_msg_proto_init() { + if File_egghunt_egghunt_msg_proto != nil { + return + } + file_comm_proto_init() + if !protoimpl.UnsafeEnabled { + file_egghunt_egghunt_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EgghuntAwardReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_egghunt_egghunt_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EgghuntAwardResp); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_egghunt_egghunt_msg_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_egghunt_egghunt_msg_proto_goTypes, + DependencyIndexes: file_egghunt_egghunt_msg_proto_depIdxs, + MessageInfos: file_egghunt_egghunt_msg_proto_msgTypes, + }.Build() + File_egghunt_egghunt_msg_proto = out.File + file_egghunt_egghunt_msg_proto_rawDesc = nil + file_egghunt_egghunt_msg_proto_goTypes = nil + file_egghunt_egghunt_msg_proto_depIdxs = nil +} diff --git a/services/worker/main.go b/services/worker/main.go index 9b738acb9..c2fde1c24 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -21,6 +21,7 @@ import ( "go_dreamfactory/modules/dcolor" "go_dreamfactory/modules/dispatch" "go_dreamfactory/modules/dragon" + "go_dreamfactory/modules/egghunt" "go_dreamfactory/modules/enchant" "go_dreamfactory/modules/entertainment" "go_dreamfactory/modules/equipment" @@ -182,6 +183,7 @@ func main() { gameinvite.NewModule(), caninerabbit.NewModule(), island.NewModule(), + egghunt.NewModule(), ) } diff --git a/sys/configure/structs/Game.TDLv.go b/sys/configure/structs/Game.TDLv.go new file mode 100644 index 000000000..b25bd12b3 --- /dev/null +++ b/sys/configure/structs/Game.TDLv.go @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +type GameTDLv struct { + _dataMap map[int32]*GameTDLvData + _dataList []*GameTDLvData +} + +func NewGameTDLv(_buf []map[string]interface{}) (*GameTDLv, error) { + _dataList := make([]*GameTDLvData, 0, len(_buf)) + dataMap := make(map[int32]*GameTDLvData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameTDLvData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.TdLv] = _v + } + } + return &GameTDLv{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameTDLv) GetDataMap() map[int32]*GameTDLvData { + return table._dataMap +} + +func (table *GameTDLv) GetDataList() []*GameTDLvData { + return table._dataList +} + +func (table *GameTDLv) Get(key int32) *GameTDLvData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.TDLvData.go b/sys/configure/structs/Game.TDLvData.go new file mode 100644 index 000000000..a9dea7e9a --- /dev/null +++ b/sys/configure/structs/Game.TDLvData.go @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +import "errors" + +type GameTDLvData struct { + TdLv int32 + Exp int32 +} + +const TypeId_GameTDLvData = 648422720 + +func (*GameTDLvData) GetTypeId() int32 { + return 648422720 +} + +func (_v *GameTDLvData)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["td_lv"].(float64); !_ok_ { err = errors.New("td_lv error"); return }; _v.TdLv = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exp"].(float64); !_ok_ { err = errors.New("exp error"); return }; _v.Exp = int32(_tempNum_) } + return +} + +func DeserializeGameTDLvData(_buf map[string]interface{}) (*GameTDLvData, error) { + v := &GameTDLvData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Game.TDWeapon.go b/sys/configure/structs/Game.TDWeapon.go new file mode 100644 index 000000000..6df732f61 --- /dev/null +++ b/sys/configure/structs/Game.TDWeapon.go @@ -0,0 +1,42 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +type GameTDWeapon struct { + _dataMap map[int32]*GameTDWeaponData + _dataList []*GameTDWeaponData +} + +func NewGameTDWeapon(_buf []map[string]interface{}) (*GameTDWeapon, error) { + _dataList := make([]*GameTDWeaponData, 0, len(_buf)) + dataMap := make(map[int32]*GameTDWeaponData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameTDWeaponData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &GameTDWeapon{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameTDWeapon) GetDataMap() map[int32]*GameTDWeaponData { + return table._dataMap +} + +func (table *GameTDWeapon) GetDataList() []*GameTDWeaponData { + return table._dataList +} + +func (table *GameTDWeapon) Get(key int32) *GameTDWeaponData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.TDWeaponData.go b/sys/configure/structs/Game.TDWeaponData.go new file mode 100644 index 000000000..a80f83806 --- /dev/null +++ b/sys/configure/structs/Game.TDWeaponData.go @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg + +import "errors" + +type GameTDWeaponData struct { + Id int32 + Name string + Describe string + Sak int32 + AtkSpeed int32 + WeaponType int32 + FlySpeed float32 + Data int32 + Pro int32 +} + +const TypeId_GameTDWeaponData = -310580526 + +func (*GameTDWeaponData) GetTypeId() int32 { + return -310580526 +} + +func (_v *GameTDWeaponData)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } + {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["name"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Name error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Name, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } + {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["describe"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Describe error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Describe, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["sak"].(float64); !_ok_ { err = errors.New("sak error"); return }; _v.Sak = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["atk_speed"].(float64); !_ok_ { err = errors.New("atk_speed error"); return }; _v.AtkSpeed = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["weapon_type"].(float64); !_ok_ { err = errors.New("weapon_type error"); return }; _v.WeaponType = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["fly_speed"].(float64); !_ok_ { err = errors.New("fly_speed error"); return }; _v.FlySpeed = float32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data"].(float64); !_ok_ { err = errors.New("data error"); return }; _v.Data = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pro"].(float64); !_ok_ { err = errors.New("pro error"); return }; _v.Pro = int32(_tempNum_) } + return +} + +func DeserializeGameTDWeaponData(_buf map[string]interface{}) (*GameTDWeaponData, error) { + v := &GameTDWeaponData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Tables.go b/sys/configure/structs/Tables.go index 9c33551de..1d31461f1 100644 --- a/sys/configure/structs/Tables.go +++ b/sys/configure/structs/Tables.go @@ -283,12 +283,13 @@ type Tables struct { RepeatAll *GameRepeatAll TDMonster *GameTDMonster TDMonsterAppear *GameTDMonsterAppear + TDLv *GameTDLv + TDWeapon *GameTDWeapon PuggsyIsLand *GamePuggsyIsLand PuggsyEvent *GamePuggsyEvent PuggsyFight *GamePuggsyFight PuggsyScore *GamePuggsyScore PuggsySkill *GamePuggsySkill - PuggsyPasscheck *GamePuggsyPasscheck } func NewTables(loader JsonLoader) (*Tables, error) { @@ -1928,6 +1929,18 @@ func NewTables(loader JsonLoader) (*Tables, error) { if tables.TDMonsterAppear, err = NewGameTDMonsterAppear(buf) ; err != nil { return nil, err } + if buf, err = loader("game_tdlv") ; err != nil { + return nil, err + } + if tables.TDLv, err = NewGameTDLv(buf) ; err != nil { + return nil, err + } + if buf, err = loader("game_tdweapon") ; err != nil { + return nil, err + } + if tables.TDWeapon, err = NewGameTDWeapon(buf) ; err != nil { + return nil, err + } if buf, err = loader("game_puggsyisland") ; err != nil { return nil, err } @@ -1958,11 +1971,5 @@ func NewTables(loader JsonLoader) (*Tables, error) { if tables.PuggsySkill, err = NewGamePuggsySkill(buf) ; err != nil { return nil, err } - if buf, err = loader("game_puggsypasscheck") ; err != nil { - return nil, err - } - if tables.PuggsyPasscheck, err = NewGamePuggsyPasscheck(buf) ; err != nil { - return nil, err - } return tables, nil }