diff --git a/bin/json/game_buriedcondi.json b/bin/json/game_buriedcondi.json new file mode 100644 index 000000000..172ddbdbd --- /dev/null +++ b/bin/json/game_buriedcondi.json @@ -0,0 +1,22 @@ +[ + { + "id": 101, + "rtype": 2, + "type_sp": 0, + "tasktxt": { + "key": "Localize_Localize_Program_tasktxt_1", + "text": "" + }, + "type": 1, + "valid": 0, + "NPC": 0, + "vtype": 1, + "value": 1, + "filter": [ + { + "s": "eq", + "d": 25001 + } + ] + } +] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index a5ecfbc49..2775d07af 100644 --- a/comm/const.go +++ b/comm/const.go @@ -458,6 +458,11 @@ type TaskParam struct { TT TaskType Params []int32 } +type BuriedParam struct { + Btype TaskType + Value int32 + Filter []int32 +} // 日常任务事件类型 const ( diff --git a/modules/buried/configure.go b/modules/buried/configure.go index a65bd02b7..3f040b33a 100644 --- a/modules/buried/configure.go +++ b/modules/buried/configure.go @@ -11,7 +11,7 @@ import ( ) const ( - gameTaskCond = "game_rdtaskcondi.json" + game_buriedcondi = "game_buriedcondi.json" ) //配置管理组件 @@ -19,31 +19,31 @@ type configureComp struct { modules.MCompConfigure module *Buried lock sync.RWMutex - group map[comm.TaskType][]*cfg.GameRdtaskCondiData //安排点类型 分组 + group map[comm.TaskType][]*cfg.GameBuriedCondiData //安排点类型 分组 } //组件初始化接口 func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.MCompConfigure.Init(service, module, comp, options) this.module = module.(*Buried) - this.LoadConfigure(gameTaskCond, cfg.NewGameRdtaskCondi) - configure.RegisterConfigure(gameTaskCond, cfg.NewGameRdtaskCondi, this.updateconfigure) + this.LoadConfigure(game_buriedcondi, cfg.NewGameBuriedCondi) + configure.RegisterConfigure(game_buriedcondi, cfg.NewGameBuriedCondi, this.updateconfigure) return } //动态更新配置 func (this *configureComp) updateconfigure() { - if v, err := this.GetConfigure(gameTaskCond); err != nil { + if v, err := this.GetConfigure(game_buriedcondi); err != nil { return } else { - if data, ok := v.(*cfg.GameRdtaskCondi); !ok { - err = fmt.Errorf("%T is *cfg.GameRdtaskCondi", v) + if data, ok := v.(*cfg.GameBuriedCondi); !ok { + err = fmt.Errorf("%T is *cfg.GameBuriedCondi", v) return } else { - group := map[comm.TaskType][]*cfg.GameRdtaskCondiData{} + group := map[comm.TaskType][]*cfg.GameBuriedCondiData{} for _, v := range data.GetDataList() { if _, ok = group[comm.TaskType(v.Type)]; !ok { - group[comm.TaskType(v.Type)] = make([]*cfg.GameRdtaskCondiData, 0) + group[comm.TaskType(v.Type)] = make([]*cfg.GameBuriedCondiData, 0) } group[comm.TaskType(v.Type)] = append(group[comm.TaskType(v.Type)], v) } @@ -55,8 +55,8 @@ func (this *configureComp) updateconfigure() { } //读取埋点条件配置 -func (this *configureComp) getCondiDatas(tt comm.TaskType) (result []*cfg.GameRdtaskCondiData) { - result = make([]*cfg.GameRdtaskCondiData, 0) +func (this *configureComp) getCondiDatas(tt comm.TaskType) (result []*cfg.GameBuriedCondiData) { + result = make([]*cfg.GameBuriedCondiData, 0) this.lock.RLock() if _, ok := this.group[tt]; ok { result = this.group[tt] diff --git a/modules/buried/core.go b/modules/buried/core.go index 4908d47a2..edb813ee1 100644 --- a/modules/buried/core.go +++ b/modules/buried/core.go @@ -2,18 +2,83 @@ package buried import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" ) -//判断埋点数据的有效性 -func checkburied(buried *comm.TaskParam, conf *cfg.GameRdtaskCondiData) (efficient bool) { +const ( + //创号后入录数据 + rtype1 = 1 + //接任务后入录数据 + rtype2 = 2 +) - return false +const ( + //叠加数据 + overlay = 1 + //覆盖数据 + cover = 2 +) + +const ( + eq = "eq" // == + gt = "gt" // > + gte = "gte" //>= + lt = "lt" // < + lte = "lte" // <= + ne = "ne" // != +) + +//判断埋点数据的有效性 +func checkburied(buried *comm.BuriedParam, conf *cfg.GameBuriedCondiData) (efficient bool) { + if len(buried.Filter) != len(conf.Filter) { + log.Error("校验埋点错误!", log.Field{Key: "buried", Value: buried}, log.Field{Key: "conf", Value: conf}) + return + } + for i, v := range conf.Filter { + efficient = false + value := buried.Filter[i] + switch v.S { + case eq: //== + if value == v.D { + efficient = true + } + case gt: //> + if value > v.D { + efficient = true + } + case gte: //>= + if value >= v.D { + efficient = true + } + case lt: //< + if value < v.D { + efficient = true + } + case lte: //<= + if value <= v.D { + efficient = true + } + case ne: //!= + if value != v.D { + efficient = true + } + default: + log.Error("校验埋点配置错误!", log.Field{Key: "不存在的比较符号", Value: v}, log.Field{Key: "buried", Value: buried}, log.Field{Key: "conf", Value: conf}) + return + } + + if !efficient { //校验不过 + return + } + } + efficient = true + return } //更新埋点数据 -func updateburied(buried *comm.TaskParam, conf *cfg.GameRdtaskCondiData, data *pb.DBBuriedItem) (err error) { - +func updateburied(buried *comm.TaskParam, conf *cfg.GameBuriedCondiData, data *pb.DBBuriedItem) (err error) { + return } diff --git a/modules/buried/modelburied.go b/modules/buried/modelburied.go index 8183b0226..71043ef67 100644 --- a/modules/buried/modelburied.go +++ b/modules/buried/modelburied.go @@ -3,7 +3,9 @@ package buried import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/mgo" "go_dreamfactory/modules" + "go_dreamfactory/pb" "go_dreamfactory/sys/db" "go.mongodb.org/mongo-driver/mongo" @@ -28,15 +30,38 @@ func (this *modelBuried) Init(service core.IService, module core.IModule, comp c //更新埋点数据到db中 func (this *modelBuried) getburiedModel(uid string) (model *buriedModel, err error) { + var m *db.DBModel if db.IsCross() { - this.module.GetDBModelByUid(uid, this.TableName) + if m, err = this.module.GetDBModelByUid(uid, this.TableName); err != nil { + return + } + model = &buriedModel{module: this.module, model: m} } else { - + model = &buriedModel{module: this.module, model: this.DBModel} } return } //埋点专属模型 会封装特殊的数据转换接口 type buriedModel struct { - db.DBModel + module *Buried + model *db.DBModel +} + +//获取用户全部的埋点数据 +func (this *buriedModel) getUserBurieds(uid string) (results map[int32]*pb.DBBuried, err error) { + temp := make([]*pb.DBBuried, 0) + if err = this.model.GetList(uid, &temp); err != nil && err != mgo.MongodbNil { + this.module.Errorln(err) + return + } + for _, v := range temp { + results[v.Btype] = v + } + return +} + +func (this *buriedModel) updateUserBurieds(bdatas map[int32]*pb.DBBuried) (err error) { + + return } diff --git a/modules/buried/module.go b/modules/buried/module.go index 8909ec589..6f78fefaf 100644 --- a/modules/buried/module.go +++ b/modules/buried/module.go @@ -1,10 +1,15 @@ package buried import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + "time" ) /* @@ -47,14 +52,108 @@ func (this *Buried) OnInstallComp() { this.modelBuried = this.RegisterComp(new(modelBuried)).(*modelBuried) } +//激活数据采集点 +func (this *Buried) ActivationBuried(uid string, conids ...int32) (err error) { + + return +} + //触发埋点 -func (this *Buried) TriggerBuried(uid string, taskParams ...*comm.TaskParam) { - for _, buried := range taskParams { - conds := this.configure.getCondiDatas(buried.TT) +func (this *Buried) TriggerBuried(uid string, burieds ...*comm.BuriedParam) { + var ( + pass map[*comm.BuriedParam][]*cfg.GameBuriedCondiData = make(map[*comm.BuriedParam][]*cfg.GameBuriedCondiData) + model *buriedModel + bdatas map[int32]*pb.DBBuried + bdata *pb.DBBuried + ok bool + complete bool + completeConIds []int32 //完成id列表 + err error + ) + if model, err = this.modelBuried.getburiedModel(uid); err != nil { + this.Error("获取用户埋点数据模型对象失败!", log.Field{Key: "err", Value: err.Error()}) + return + } + for _, buried := range burieds { + conds := this.configure.getCondiDatas(buried.Btype) for _, cond := range conds { if checkburied(buried, cond) { //判断此埋点数据是否有效 - + if _, ok := pass[buried]; !ok { + pass[buried] = make([]*cfg.GameBuriedCondiData, 0) + } + pass[buried] = append(pass[buried], cond) } } } + if len(pass) > 0 { + if bdatas, err = model.getUserBurieds(uid); err != nil { + return + } + } + completeConIds = make([]int32, 0) + //处理校验通过埋点数据 + for buried, conds := range pass { + if bdata, ok = bdatas[bdata.Btype]; !ok { + bdatas[bdata.Btype] = &pb.DBBuried{ + Uid: uid, + Btype: bdata.Btype, + Items: make(map[int32]*pb.DBBuriedItem), + } + } + for _, cond := range conds { + if cond.Rtype == rtype1 { //创号后入录 + if complete, err = this.updateAndCheckBuried(bdata, buried, cond, true); complete { + completeConIds = append(completeConIds, cond.Id) + } + } else if cond.Rtype == rtype2 { //任务接取后才会录入 判断用户埋点数据是否存在 不存在等待任务系统调用接口 ActivationBuried 激活 + if complete, err = this.updateAndCheckBuried(bdata, buried, cond, false); complete { + completeConIds = append(completeConIds, cond.Id) + } + } + } + } + //通知事件 + if len(completeConIds) > 0 { + + } +} + +//更新并校验完成 +func (this *Buried) updateAndCheckBuried(bdata *pb.DBBuried, burie *comm.BuriedParam, cond *cfg.GameBuriedCondiData, autoActivated bool) (complete bool, err error) { + var ( + ok bool + bitem *pb.DBBuriedItem + ) + + if bitem, ok = bdata.Items[int32(cond.Id)]; !ok { + if autoActivated { //自动激活 + bitem = &pb.DBBuriedItem{ + Conid: cond.Id, + State: pb.BuriedItemState_Activated, + Value: 0, + Timestamp: time.Now().Unix(), + } + } else { + return + } + } + + if bitem.State == pb.BuriedItemState_Inactivated || bitem.State == pb.BuriedItemState_Freeze { //未激活和冻结 不在处理 + return + } + + switch cond.Vtype { //数据接入方式 + case overlay: //累加数据 + bitem.Value += burie.Value + case cover: + bitem.Value = burie.Value + default: + err = fmt.Errorf("未知的埋点数据处理类型:%d", cond.Vtype) + return + } + + if bitem.Value >= cond.Value { //完成进度 + complete = true + } + return } diff --git a/pb/buried_db.pb.go b/pb/buried_db.pb.go index e0f729850..e6db88c7c 100644 --- a/pb/buried_db.pb.go +++ b/pb/buried_db.pb.go @@ -20,15 +20,69 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +//任务条件状态 +type BuriedItemState int32 + +const ( + BuriedItemState_Inactivated BuriedItemState = 0 //未激活 不接受输入入录 + BuriedItemState_Activated BuriedItemState = 1 //已激活 接受输入入录 + BuriedItemState_Freeze BuriedItemState = 2 //冻结 数据保留 不接受数据变化和时间推送 + BuriedItemState_Sleep BuriedItemState = 3 //数据更新但是不主动触发时间 +) + +// Enum value maps for BuriedItemState. +var ( + BuriedItemState_name = map[int32]string{ + 0: "Inactivated", + 1: "Activated", + 2: "Freeze", + 3: "Sleep", + } + BuriedItemState_value = map[string]int32{ + "Inactivated": 0, + "Activated": 1, + "Freeze": 2, + "Sleep": 3, + } +) + +func (x BuriedItemState) Enum() *BuriedItemState { + p := new(BuriedItemState) + *p = x + return p +} + +func (x BuriedItemState) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BuriedItemState) Descriptor() protoreflect.EnumDescriptor { + return file_buried_buried_db_proto_enumTypes[0].Descriptor() +} + +func (BuriedItemState) Type() protoreflect.EnumType { + return &file_buried_buried_db_proto_enumTypes[0] +} + +func (x BuriedItemState) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use BuriedItemState.Descriptor instead. +func (BuriedItemState) EnumDescriptor() ([]byte, []int) { + return file_buried_buried_db_proto_rawDescGZIP(), []int{0} +} + //埋点对应的条件数据 type DBBuriedItem struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Condid int32 `protobuf:"varint,1,opt,name=condid,proto3" json:"condid"` //条件id - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp"` //最后一次操作时间 - Value map[string]int32 `protobuf:"bytes,3,rep,name=value,proto3" json:"value" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //完成条件数据 + Conid int32 `protobuf:"varint,1,opt,name=conid,proto3" json:"conid" bson:"conid"` //条件id + State BuriedItemState `protobuf:"varint,2,opt,name=state,proto3,enum=BuriedItemState" json:"state" bson:"state"` //状态 + Value int32 `protobuf:"varint,3,opt,name=value,proto3" json:"value" bson:"value"` //条件值 + Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp" bson:"timestamp"` //最后一次操作时间 } func (x *DBBuriedItem) Reset() { @@ -63,9 +117,23 @@ func (*DBBuriedItem) Descriptor() ([]byte, []int) { return file_buried_buried_db_proto_rawDescGZIP(), []int{0} } -func (x *DBBuriedItem) GetCondid() int32 { +func (x *DBBuriedItem) GetConid() int32 { if x != nil { - return x.Condid + return x.Conid + } + return 0 +} + +func (x *DBBuriedItem) GetState() BuriedItemState { + if x != nil { + return x.State + } + return BuriedItemState_Inactivated +} + +func (x *DBBuriedItem) GetValue() int32 { + if x != nil { + return x.Value } return 0 } @@ -77,22 +145,15 @@ func (x *DBBuriedItem) GetTimestamp() int64 { return 0 } -func (x *DBBuriedItem) GetValue() map[string]int32 { - if x != nil { - return x.Value - } - return nil -} - //DB埋点数据 type DBBuried struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID - Btype int32 `protobuf:"varint,2,opt,name=btype,proto3" json:"btype" bson:"btype"` //埋点类型 - Data []*DBBuriedItem `protobuf:"bytes,3,rep,name=data,proto3" json:"data" bson:"data"` //埋点同居诗句 + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID + Btype int32 `protobuf:"varint,2,opt,name=btype,proto3" json:"btype"` //@go_tags(`bson:"btype"`)埋点类型 + Items map[int32]*DBBuriedItem `protobuf:"bytes,3,rep,name=items,proto3" json:"items" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3" bson:"burieds"` //埋点数据 key条件id } func (x *DBBuried) Reset() { @@ -141,9 +202,9 @@ func (x *DBBuried) GetBtype() int32 { return 0 } -func (x *DBBuried) GetData() []*DBBuriedItem { +func (x *DBBuried) GetItems() map[int32]*DBBuriedItem { if x != nil { - return x.Data + return x.Items } return nil } @@ -152,24 +213,31 @@ var File_buried_buried_db_proto protoreflect.FileDescriptor var file_buried_buried_db_proto_rawDesc = []byte{ 0x0a, 0x16, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2f, 0x62, 0x75, 0x72, 0x69, 0x65, 0x64, 0x5f, - 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x42, - 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, - 0x64, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x64, 0x69, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x2e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, - 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, - 0x38, 0x0a, 0x0a, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 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, 0x22, 0x55, 0x0a, 0x08, 0x44, 0x42, 0x42, - 0x75, 0x72, 0x69, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, - 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x80, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x42, + 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6e, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x6e, 0x69, 0x64, 0x12, + 0x26, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x10, + 0x2e, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xa7, 0x01, 0x0a, 0x08, + 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x14, 0x2e, 0x44, 0x42, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x47, 0x0a, 0x0a, + 0x49, 0x74, 0x65, 0x6d, 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, 0x23, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, + 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x48, 0x0a, 0x0f, 0x42, 0x75, 0x72, 0x69, 0x65, 0x64, 0x49, + 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x6e, 0x61, 0x63, + 0x74, 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x63, 0x74, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x72, 0x65, 0x65, + 0x7a, 0x65, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x6c, 0x65, 0x65, 0x70, 0x10, 0x03, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -184,20 +252,23 @@ func file_buried_buried_db_proto_rawDescGZIP() []byte { return file_buried_buried_db_proto_rawDescData } +var file_buried_buried_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_buried_buried_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_buried_buried_db_proto_goTypes = []interface{}{ - (*DBBuriedItem)(nil), // 0: DBBuriedItem - (*DBBuried)(nil), // 1: DBBuried - nil, // 2: DBBuriedItem.ValueEntry + (BuriedItemState)(0), // 0: BuriedItemState + (*DBBuriedItem)(nil), // 1: DBBuriedItem + (*DBBuried)(nil), // 2: DBBuried + nil, // 3: DBBuried.ItemsEntry } var file_buried_buried_db_proto_depIdxs = []int32{ - 2, // 0: DBBuriedItem.value:type_name -> DBBuriedItem.ValueEntry - 0, // 1: DBBuried.data:type_name -> DBBuriedItem - 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 + 0, // 0: DBBuriedItem.state:type_name -> BuriedItemState + 3, // 1: DBBuried.items:type_name -> DBBuried.ItemsEntry + 1, // 2: DBBuried.ItemsEntry.value:type_name -> DBBuriedItem + 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_buried_buried_db_proto_init() } @@ -236,13 +307,14 @@ func file_buried_buried_db_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_buried_buried_db_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 3, NumExtensions: 0, NumServices: 0, }, GoTypes: file_buried_buried_db_proto_goTypes, DependencyIndexes: file_buried_buried_db_proto_depIdxs, + EnumInfos: file_buried_buried_db_proto_enumTypes, MessageInfos: file_buried_buried_db_proto_msgTypes, }.Build() File_buried_buried_db_proto = out.File diff --git a/sys/configure/structs/Game.BuriedCondi.go b/sys/configure/structs/Game.BuriedCondi.go new file mode 100644 index 000000000..c08817b3c --- /dev/null +++ b/sys/configure/structs/Game.BuriedCondi.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 GameBuriedCondi struct { + _dataMap map[int32]*GameBuriedCondiData + _dataList []*GameBuriedCondiData +} + +func NewGameBuriedCondi(_buf []map[string]interface{}) (*GameBuriedCondi, error) { + _dataList := make([]*GameBuriedCondiData, 0, len(_buf)) + dataMap := make(map[int32]*GameBuriedCondiData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameBuriedCondiData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &GameBuriedCondi{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameBuriedCondi) GetDataMap() map[int32]*GameBuriedCondiData { + return table._dataMap +} + +func (table *GameBuriedCondi) GetDataList() []*GameBuriedCondiData { + return table._dataList +} + +func (table *GameBuriedCondi) Get(key int32) *GameBuriedCondiData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.BuriedCondiData.go b/sys/configure/structs/Game.BuriedCondiData.go new file mode 100644 index 000000000..60cb9105c --- /dev/null +++ b/sys/configure/structs/Game.BuriedCondiData.go @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// 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 GameBuriedCondiData struct { + Id int32 + Rtype int32 + TypeSp int32 + Tasktxt string + Type int32 + Valid int32 + NPC int32 + Vtype int32 + Value int32 + Filter []*Gamecompare +} + +const TypeId_GameBuriedCondiData = 1792922092 + +func (*GameBuriedCondiData) GetTypeId() int32 { + return 1792922092 +} + +func (_v *GameBuriedCondiData)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 _tempNum_ float64; if _tempNum_, _ok_ = _buf["rtype"].(float64); !_ok_ { err = errors.New("rtype error"); return }; _v.Rtype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type_sp"].(float64); !_ok_ { err = errors.New("type_sp error"); return }; _v.TypeSp = int32(_tempNum_) } + {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["tasktxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Tasktxt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Tasktxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["valid"].(float64); !_ok_ { err = errors.New("valid error"); return }; _v.Valid = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["NPC"].(float64); !_ok_ { err = errors.New("NPC error"); return }; _v.NPC = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["vtype"].(float64); !_ok_ { err = errors.New("vtype error"); return }; _v.Vtype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["value"].(float64); !_ok_ { err = errors.New("value error"); return }; _v.Value = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["filter"].([]interface{}); !_ok_ { err = errors.New("filter error"); return } + + _v.Filter = make([]*Gamecompare, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Gamecompare + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGamecompare(_x_); err != nil { return } } + _v.Filter = append(_v.Filter, _list_v_) + } + } + + return +} + +func DeserializeGameBuriedCondiData(_buf map[string]interface{}) (*GameBuriedCondiData, error) { + v := &GameBuriedCondiData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Game.compare.go b/sys/configure/structs/Game.compare.go new file mode 100644 index 000000000..8ccde899e --- /dev/null +++ b/sys/configure/structs/Game.compare.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 Gamecompare struct { + S string + D int32 +} + +const TypeId_Gamecompare = -229713143 + +func (*Gamecompare) GetTypeId() int32 { + return -229713143 +} + +func (_v *Gamecompare)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; if _v.S, _ok_ = _buf["s"].(string); !_ok_ { err = errors.New("s error"); return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["d"].(float64); !_ok_ { err = errors.New("d error"); return }; _v.D = int32(_tempNum_) } + return +} + +func DeserializeGamecompare(_buf map[string]interface{}) (*Gamecompare, error) { + v := &Gamecompare{} + 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 8381077b7..597e02e8e 100644 --- a/sys/configure/structs/Tables.go +++ b/sys/configure/structs/Tables.go @@ -196,6 +196,7 @@ type Tables struct { RuleDesc *GameRuleDesc HeroTalent *GameHeroTalent TalentBox *GameTalentBox + BuriedCondi *GameBuriedCondi } func NewTables(loader JsonLoader) (*Tables, error) { @@ -1313,5 +1314,11 @@ func NewTables(loader JsonLoader) (*Tables, error) { if tables.TalentBox, err = NewGameTalentBox(buf) ; err != nil { return nil, err } + if buf, err = loader("game_buriedcondi") ; err != nil { + return nil, err + } + if tables.BuriedCondi, err = NewGameBuriedCondi(buf) ; err != nil { + return nil, err + } return tables, nil }