From f4ec14b47233d9d4b6ea18388a4f3e657606081e Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Fri, 24 Feb 2023 18:25:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BE=E9=81=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_dispatch_task.json | 276 ++++++--- comm/weight.go | 36 ++ modules/dispatch/api_do.go | 32 ++ modules/dispatch/api_notice.go | 29 + modules/dispatch/api_receive.go | 30 + modules/dispatch/api_refresh.go | 21 + modules/dispatch/configure.go | 84 +++ modules/dispatch/model_dispatch.go | 178 ++++++ modules/dispatch/module.go | 14 +- modules/smithy/api_trade.go | 14 +- pb/dispatch_db.pb.go | 349 ++++++++++++ pb/dispatch_msg.pb.go | 538 ++++++++++++++++++ pb/errorcode.pb.go | 12 +- sys/configure/structs/Game.DispatchCond.go | 37 ++ .../structs/Game.DispatchCondType.go | 14 + sys/configure/structs/Game.Dispatch_LvData.go | 8 +- .../structs/Game.Dispatch_TaskData.go | 24 +- sys/configure/structs/Game.dispatch.go | 50 ++ utils/utils_test.go | 2 +- 19 files changed, 1626 insertions(+), 122 deletions(-) create mode 100644 comm/weight.go create mode 100644 modules/dispatch/api_do.go create mode 100644 modules/dispatch/api_notice.go create mode 100644 modules/dispatch/api_receive.go create mode 100644 modules/dispatch/api_refresh.go create mode 100644 modules/dispatch/configure.go create mode 100644 pb/dispatch_db.pb.go create mode 100644 pb/dispatch_msg.pb.go create mode 100644 sys/configure/structs/Game.DispatchCond.go create mode 100644 sys/configure/structs/Game.DispatchCondType.go create mode 100644 sys/configure/structs/Game.dispatch.go diff --git a/bin/json/game_dispatch_task.json b/bin/json/game_dispatch_task.json index 9aea54395..eeeb6157e 100644 --- a/bin/json/game_dispatch_task.json +++ b/bin/json/game_dispatch_task.json @@ -14,12 +14,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -51,12 +55,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -88,12 +96,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -125,12 +137,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -162,12 +178,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -199,12 +219,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -236,12 +260,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -273,12 +301,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -310,12 +342,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -347,12 +383,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -384,12 +424,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -421,12 +465,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -458,12 +506,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -495,12 +547,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -532,12 +588,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -569,12 +629,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -606,12 +670,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -643,12 +711,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -680,12 +752,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -717,12 +793,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -754,12 +834,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -791,12 +875,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { @@ -828,12 +916,16 @@ }, "taskneed": 2, "taskreq": [ - "lv", - "1" + { + "key": 1, + "param": 1 + } ], "taskreqex": [ - "star", - "5" + { + "key": 2, + "param": 5 + } ], "reward": [ { diff --git a/comm/weight.go b/comm/weight.go new file mode 100644 index 000000000..0c08b97ff --- /dev/null +++ b/comm/weight.go @@ -0,0 +1,36 @@ +package comm + +import "math/rand" + +type WeightItem struct { + Id interface{} + Weight int +} + +// 权重项目 +type WeightedRandom struct { + items []*WeightItem + totalWeight int +} + +func NewWeightedRandom(items []*WeightItem) *WeightedRandom { + wr := &WeightedRandom{items: items} + for _, item := range wr.items { + wr.totalWeight += int(item.Weight) + } + return wr +} + +func (wr *WeightedRandom) Pick() *WeightItem { + if wr.totalWeight <= 0 { + return nil + } + randomNumber := rand.Intn(wr.totalWeight) + for _, item := range wr.items { + if randomNumber < int(item.Weight) { + return item + } + randomNumber -= int(item.Weight) + } + return nil +} diff --git a/modules/dispatch/api_do.go b/modules/dispatch/api_do.go new file mode 100644 index 000000000..113dbcd44 --- /dev/null +++ b/modules/dispatch/api_do.go @@ -0,0 +1,32 @@ +package dispatch + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "github.com/golang/protobuf/proto" +) + +// 派遣 + +func (a *apiComp) DoCheck(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode) { + if len(req.HeroId) == 0 || req.TaskId == 0 { + return + } + return +} + +func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode, data proto.Message) { + if code = a.DoCheck(session, req); code != pb.ErrorCode_Success { + return + } + + if err := a.module.modelDispatch.dispatch(session.GetUserId(), req.TaskId, req.HeroId); err != nil { + code = pb.ErrorCode_DBError + return + } + rsp := &pb.DispatchDoResp{} + + session.SendMsg(string(a.module.GetType()), "do", rsp) + return +} diff --git a/modules/dispatch/api_notice.go b/modules/dispatch/api_notice.go new file mode 100644 index 000000000..fa94e54bf --- /dev/null +++ b/modules/dispatch/api_notice.go @@ -0,0 +1,29 @@ +package dispatch + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +// 公告板信息 + +func (a *apiComp) NoticeCheck(session comm.IUserSession, req *pb.DispatchNoticeReq) (code pb.ErrorCode) { + return +} + +func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (code pb.ErrorCode, data proto.Message) { + d := a.module.modelDispatch.getDBDispatch(session.GetUserId()) + + if d == nil { + d = a.module.modelDispatch.initDispatch(session.GetUserId()) + return + } + rsp := &pb.DispatchNoticeResp{ + Dispatch: d, + } + + session.SendMsg(string(a.module.GetType()), "notice", rsp) + return +} diff --git a/modules/dispatch/api_receive.go b/modules/dispatch/api_receive.go new file mode 100644 index 000000000..a66ca3e7a --- /dev/null +++ b/modules/dispatch/api_receive.go @@ -0,0 +1,30 @@ +package dispatch + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +// 领取派遣奖励 + +func (a *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.DispatchReceiveReq) (code pb.ErrorCode) { + return +} + +func (a *apiComp) Receive(session comm.IUserSession, req *pb.DispatchReceiveReq) (code pb.ErrorCode, data proto.Message) { + + d := a.module.modelDispatch.getDBDispatch(session.GetUserId()) + if d == nil { + code = pb.ErrorCode_DBError + return + } + + a.module.modelDispatch.taskRandom(session.GetUserId(), d.Nb.Lv) + + rsp := &pb.DispatchReceiveResp{} + + session.SendMsg(string(a.module.GetType()), "receive", rsp) + return +} diff --git a/modules/dispatch/api_refresh.go b/modules/dispatch/api_refresh.go new file mode 100644 index 000000000..3c38c2583 --- /dev/null +++ b/modules/dispatch/api_refresh.go @@ -0,0 +1,21 @@ +package dispatch + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +// 刷新 +func (a *apiComp) RefreshCheck(session comm.IUserSession, req *pb.DispatchRefreshReq) (code pb.ErrorCode) { + return +} + +func (a *apiComp) Refresh(session comm.IUserSession, req *pb.DispatchRefreshReq) (code pb.ErrorCode, data proto.Message) { + + rsp := &pb.DispatchRefreshResp{} + + session.SendMsg(string(a.module.GetType()), "refresh", rsp) + return +} diff --git a/modules/dispatch/configure.go b/modules/dispatch/configure.go new file mode 100644 index 000000000..150f8c928 --- /dev/null +++ b/modules/dispatch/configure.go @@ -0,0 +1,84 @@ +package dispatch + +import ( + "fmt" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + cfg "go_dreamfactory/sys/configure/structs" +) + +const ( + gameDispatchLv = "game_dispatch_lv.json" + gameDispatchTask = "game_dispatch_task.json" +) + +type configureComp struct { + modules.MCompConfigure +} + +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.LoadMultiConfigure(map[string]interface{}{ + gameDispatchLv: cfg.NewGameDispatch_Lv, + gameDispatchTask: cfg.NewGameDispatch_Task, + }) + return +} + +// 公告栏配置 +func (this *configureComp) getDispatchLvConf(lv int32) (data *cfg.GameDispatch_LvData, err error) { + var v interface{} + + if v, err = this.GetConfigure(gameDispatchLv); err != nil { + err = fmt.Errorf("%T no is *cfg.GameDispatchLv", v) + return + } else { + d, ok := v.(*cfg.GameDispatch_Lv) + if !ok { + err = fmt.Errorf("%T is not *cfg.GameDispatchLv", v) + return + } + + if data, ok = d.GetDataMap()[lv]; ok { + return + } + } + return +} + +//任务配置 +func(this *configureComp) getDispatchTaskConf(taskId int32) (data *cfg.GameDispatch_TaskData,err error) { + var v interface{} + + if v, err = this.GetConfigure(gameDispatchTask); err != nil { + err = fmt.Errorf("%T no is *cfg.GameDispatchTask", v) + return + } else { + d, ok := v.(*cfg.GameDispatch_Task) + if !ok { + err = fmt.Errorf("%T is not *cfg.GameDispatchTask", v) + return + } + + if data, ok = d.GetDataMap()[taskId]; ok { + return + } + } + return +} + +// 任务列表 +func (this *configureComp) getDispatchListConf() (list []*cfg.GameDispatch_TaskData) { + if v, err := this.GetConfigure(gameDispatchTask); err != nil { + return + } else { + d, ok := v.(*cfg.GameDispatch_Task) + if !ok { + err = fmt.Errorf("%T is not *cfg.GameDispatch_Task", v) + return + } + + list = d.GetDataList() + } + return +} diff --git a/modules/dispatch/model_dispatch.go b/modules/dispatch/model_dispatch.go index 347acabc4..a92f66cf8 100644 --- a/modules/dispatch/model_dispatch.go +++ b/modules/dispatch/model_dispatch.go @@ -1,9 +1,13 @@ package dispatch import ( + "errors" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" + "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" + "go_dreamfactory/utils" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/bsonx" @@ -26,3 +30,177 @@ func (this *modelDispatch) Init(service core.IService, module core.IModule, comp return } + +func (this *modelDispatch) initDispatch(uid string) (dis *pb.DBDispatch) { + taskIds, err := this.taskRandom(uid, 1) + if err != nil { + return + } + if len(taskIds) == 0 { + return + } + + dis = &pb.DBDispatch{ + Uid: uid, + Ticket: 6, + Nb: &pb.Noticeboard{ + Lv: 1, + }, + } + + for _, v := range taskIds { + taskConf, err := this.module.configure.getDispatchTaskConf(v) + if err != nil { + continue + } + //接续截至时间 + duration := configure.Now().Unix() + int64(taskConf.Taskcd) + dis.Nb.Tasks = append(dis.Nb.Tasks, &pb.DispatchTask{ + TaskId: v, + Duration: duration, + }) + } + + if err := this.Add(uid, dis); err != nil { + return + } + + return +} + +// 获取派遣数据 +func (this *modelDispatch) getDBDispatch(uid string) *pb.DBDispatch { + dis := &pb.DBDispatch{} + if err := this.Get(uid, dis); err != nil { + return nil + } + return nil +} + +// 随机任务 +func (this *modelDispatch) taskRandom(uid string, noticeLv int32) (taskIds []int32, err error) { + d := this.getDBDispatch(uid) + if d == nil { + return nil, errors.New("no data") + } + + if d.Nb == nil { + return nil, errors.New("notice is nil") + } + + conf, err := this.module.configure.getDispatchLvConf(noticeLv) + if err != nil { + return nil, err + } + + var items []*comm.WeightItem + for i, v := range conf.Probability { + items = append(items, &comm.WeightItem{Id: (i + 1), Weight: int(v)}) + } + + wr := comm.NewWeightedRandom(items) + //任务类型 + var taskType int + if c := wr.Pick(); c != nil { + taskType = c.Id.(int) + } + + confList := this.module.configure.getDispatchListConf() + var tIds []int32 + for _, v := range confList { + if int(v.Type) == taskType { + tIds = append(tIds, v.Id) + } + } + + //判断随机数量 + var n int + n = len(d.Nb.Tasks) + + if len(taskIds) > 0 { + ids := utils.RandomNumbers(0, len(tIds), n) + for i := 0; i < len(ids); i++ { + taskIds = append(taskIds, tIds[i]) + } + } + return +} + +// 验证英雄的条件 +func (this *modelDispatch) validHeroCond(uid string, taskId int32, heroId string) (ok bool, err error) { + //taskConf + gd, err := this.module.configure.getDispatchTaskConf(taskId) + if err != nil { + return + } + + //获取英雄信息 + hero, code := this.module.ModuleHero.GetHeroByObjID(uid, heroId) + + //校验英雄的条件 + if code == pb.ErrorCode_Success && hero != nil { + for _, v := range gd.Taskreq { + switch v.Key { + case 1: //lv + if hero.Lv >= v.Param { + ok = true + return + } + case 2: //star + if hero.Star >= v.Param { + ok = true + return + } + } + } + } + + //校验英雄是否已被派遣 + dispatch := this.getDBDispatch(uid) + if dispatch == nil { + return + } + + for _, v := range dispatch.Nb.Tasks { + for _, h := range v.HeroIds { + if h == heroId { + ok = false + return + } + } + } + + return +} + +// 派遣 +func (this *modelDispatch) dispatch(uid string, taskId int32, heroIds []string) error { + for _, heroId := range heroIds { + if ok, err := this.validHeroCond(uid, taskId, heroId); err == nil { + if !ok { + return comm.NewCustomError(pb.ErrorCode_DispatchHeroNoReached) + } + } else { + return err + } + } + + d := this.getDBDispatch(uid) + if d == nil { + return errors.New("no data") + } + + for _, v := range d.Nb.Tasks { + if v.TaskId == taskId && v.Status == 0 { + v.HeroIds = heroIds + } + } + + update := map[string]interface{}{ + "nb": d.Nb.Tasks, + } + if err := this.Change(uid, update); err != nil { + return err + } + return nil +} diff --git a/modules/dispatch/module.go b/modules/dispatch/module.go index 3ab56bfb5..444974531 100644 --- a/modules/dispatch/module.go +++ b/modules/dispatch/module.go @@ -9,19 +9,27 @@ import ( // 派遣 type Dispatch struct { modules.ModuleBase - api *apiComp + api *apiComp + configure *configureComp + modelDispatch *modelDispatch } func NewModule() core.IModule { return &Dispatch{} } -func (this *Dispatch) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error){ +func (this *Dispatch) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) return } - func (this *Dispatch) GetType() core.M_Modules { return comm.ModuleDispatch } + +func (this *Dispatch) OnInstallComp() { + this.ModuleBase.OnInstallComp() + this.api = this.RegisterComp(new(apiComp)).(*apiComp) + this.configure = this.RegisterComp(new(configureComp)).(*configureComp) + this.modelDispatch = this.RegisterComp(new(modelDispatch)).(*modelDispatch) +} diff --git a/modules/smithy/api_trade.go b/modules/smithy/api_trade.go index 9b2160a5e..4710c7ae8 100644 --- a/modules/smithy/api_trade.go +++ b/modules/smithy/api_trade.go @@ -38,14 +38,14 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (cod return } - conf := this.module.configure.GetSmithyCustomerConf(req.CustomerId) - if conf == nil { - code = pb.ErrorCode_ConfigNoFound - return - } + // conf := this.module.configure.GetSmithyCustomerConf(req.CustomerId) + // if conf == nil { + // code = pb.ErrorCode_ConfigNoFound + // return + // } - // 发奖励 - this.module.DispenseRes(session, conf.Reword, true) + // // 发奖励 + // this.module.DispenseRes(session, conf.Reword, true) rsp := &pb.SmithySellResp{ CustomerId: req.CustomerId, diff --git a/pb/dispatch_db.pb.go b/pb/dispatch_db.pb.go new file mode 100644 index 000000000..4b536cae1 --- /dev/null +++ b/pb/dispatch_db.pb.go @@ -0,0 +1,349 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: dispatch/dispatch_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 DBDispatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` // + Ticket int32 `protobuf:"varint,2,opt,name=ticket,proto3" json:"ticket" bson:"ticket"` //门票 + Nb *Noticeboard `protobuf:"bytes,3,opt,name=nb,proto3" json:"nb" bson:"nb"` //公告栏 +} + +func (x *DBDispatch) Reset() { + *x = DBDispatch{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_db_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBDispatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBDispatch) ProtoMessage() {} + +func (x *DBDispatch) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_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 DBDispatch.ProtoReflect.Descriptor instead. +func (*DBDispatch) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_db_proto_rawDescGZIP(), []int{0} +} + +func (x *DBDispatch) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *DBDispatch) GetTicket() int32 { + if x != nil { + return x.Ticket + } + return 0 +} + +func (x *DBDispatch) GetNb() *Noticeboard { + if x != nil { + return x.Nb + } + return nil +} + +// 公告栏 +type Noticeboard struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Lv int32 `protobuf:"varint,1,opt,name=lv,proto3" json:"lv" bson:"lv"` // 公告栏等级 + NoticeType int32 `protobuf:"varint,2,opt,name=noticeType,proto3" json:"noticeType" bson:"noticeType"` // 公告栏类型 + Tasks []*DispatchTask `protobuf:"bytes,3,rep,name=tasks,proto3" json:"tasks" bson:"tasks"` //当前公告任务 +} + +func (x *Noticeboard) Reset() { + *x = Noticeboard{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_db_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Noticeboard) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Noticeboard) ProtoMessage() {} + +func (x *Noticeboard) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_db_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 Noticeboard.ProtoReflect.Descriptor instead. +func (*Noticeboard) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_db_proto_rawDescGZIP(), []int{1} +} + +func (x *Noticeboard) GetLv() int32 { + if x != nil { + return x.Lv + } + return 0 +} + +func (x *Noticeboard) GetNoticeType() int32 { + if x != nil { + return x.NoticeType + } + return 0 +} + +func (x *Noticeboard) GetTasks() []*DispatchTask { + if x != nil { + return x.Tasks + } + return nil +} + +// 派遣任务 +type DispatchTask struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //任务ID + Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //任务状态 默认0 1任务中 2任务完成 + Duration int64 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration" bson:"duration"` //持续截至时间 + LeftTime int64 `protobuf:"varint,4,opt,name=leftTime,proto3" json:"leftTime" bson:"leftTime"` //任务截至时间 + HeroIds []string `protobuf:"bytes,5,rep,name=heroIds,proto3" json:"heroIds"` //go_tags(`bson:"heroIds"`) 派遣的英雄 +} + +func (x *DispatchTask) Reset() { + *x = DispatchTask{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_db_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchTask) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchTask) ProtoMessage() {} + +func (x *DispatchTask) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_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 DispatchTask.ProtoReflect.Descriptor instead. +func (*DispatchTask) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_db_proto_rawDescGZIP(), []int{2} +} + +func (x *DispatchTask) GetTaskId() int32 { + if x != nil { + return x.TaskId + } + return 0 +} + +func (x *DispatchTask) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *DispatchTask) GetDuration() int64 { + if x != nil { + return x.Duration + } + return 0 +} + +func (x *DispatchTask) GetLeftTime() int64 { + if x != nil { + return x.LeftTime + } + return 0 +} + +func (x *DispatchTask) GetHeroIds() []string { + if x != nil { + return x.HeroIds + } + return nil +} + +var File_dispatch_dispatch_db_proto protoreflect.FileDescriptor + +var file_dispatch_dispatch_db_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x54, 0x0a, 0x0a, + 0x44, 0x42, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, + 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x69, + 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x02, 0x6e, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0c, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x02, + 0x6e, 0x62, 0x22, 0x62, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x62, 0x6f, 0x61, 0x72, + 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, + 0x76, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x52, + 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x22, 0x90, 0x01, 0x0a, 0x0c, 0x44, 0x69, 0x73, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x65, 0x66, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_dispatch_dispatch_db_proto_rawDescOnce sync.Once + file_dispatch_dispatch_db_proto_rawDescData = file_dispatch_dispatch_db_proto_rawDesc +) + +func file_dispatch_dispatch_db_proto_rawDescGZIP() []byte { + file_dispatch_dispatch_db_proto_rawDescOnce.Do(func() { + file_dispatch_dispatch_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_dispatch_dispatch_db_proto_rawDescData) + }) + return file_dispatch_dispatch_db_proto_rawDescData +} + +var file_dispatch_dispatch_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_dispatch_dispatch_db_proto_goTypes = []interface{}{ + (*DBDispatch)(nil), // 0: DBDispatch + (*Noticeboard)(nil), // 1: Noticeboard + (*DispatchTask)(nil), // 2: DispatchTask +} +var file_dispatch_dispatch_db_proto_depIdxs = []int32{ + 1, // 0: DBDispatch.nb:type_name -> Noticeboard + 2, // 1: Noticeboard.tasks:type_name -> DispatchTask + 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 +} + +func init() { file_dispatch_dispatch_db_proto_init() } +func file_dispatch_dispatch_db_proto_init() { + if File_dispatch_dispatch_db_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_dispatch_dispatch_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBDispatch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Noticeboard); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchTask); 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_dispatch_dispatch_db_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_dispatch_dispatch_db_proto_goTypes, + DependencyIndexes: file_dispatch_dispatch_db_proto_depIdxs, + MessageInfos: file_dispatch_dispatch_db_proto_msgTypes, + }.Build() + File_dispatch_dispatch_db_proto = out.File + file_dispatch_dispatch_db_proto_rawDesc = nil + file_dispatch_dispatch_db_proto_goTypes = nil + file_dispatch_dispatch_db_proto_depIdxs = nil +} diff --git a/pb/dispatch_msg.pb.go b/pb/dispatch_msg.pb.go new file mode 100644 index 000000000..7be098a6b --- /dev/null +++ b/pb/dispatch_msg.pb.go @@ -0,0 +1,538 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: dispatch/dispatch_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 DispatchNoticeReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DispatchNoticeReq) Reset() { + *x = DispatchNoticeReq{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchNoticeReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchNoticeReq) ProtoMessage() {} + +func (x *DispatchNoticeReq) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_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 DispatchNoticeReq.ProtoReflect.Descriptor instead. +func (*DispatchNoticeReq) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{0} +} + +type DispatchNoticeResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Dispatch *DBDispatch `protobuf:"bytes,1,opt,name=dispatch,proto3" json:"dispatch"` +} + +func (x *DispatchNoticeResp) Reset() { + *x = DispatchNoticeResp{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchNoticeResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchNoticeResp) ProtoMessage() {} + +func (x *DispatchNoticeResp) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_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 DispatchNoticeResp.ProtoReflect.Descriptor instead. +func (*DispatchNoticeResp) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{1} +} + +func (x *DispatchNoticeResp) GetDispatch() *DBDispatch { + if x != nil { + return x.Dispatch + } + return nil +} + +//刷新公告 +type DispatchRefreshReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DispatchRefreshReq) Reset() { + *x = DispatchRefreshReq{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchRefreshReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchRefreshReq) ProtoMessage() {} + +func (x *DispatchRefreshReq) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_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 DispatchRefreshReq.ProtoReflect.Descriptor instead. +func (*DispatchRefreshReq) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{2} +} + +type DispatchRefreshResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DispatchRefreshResp) Reset() { + *x = DispatchRefreshResp{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchRefreshResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchRefreshResp) ProtoMessage() {} + +func (x *DispatchRefreshResp) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[3] + 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 DispatchRefreshResp.ProtoReflect.Descriptor instead. +func (*DispatchRefreshResp) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{3} +} + +//一键领取奖励 +type DispatchReceiveReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DispatchReceiveReq) Reset() { + *x = DispatchReceiveReq{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchReceiveReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchReceiveReq) ProtoMessage() {} + +func (x *DispatchReceiveReq) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[4] + 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 DispatchReceiveReq.ProtoReflect.Descriptor instead. +func (*DispatchReceiveReq) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{4} +} + +type DispatchReceiveResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DispatchReceiveResp) Reset() { + *x = DispatchReceiveResp{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchReceiveResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchReceiveResp) ProtoMessage() {} + +func (x *DispatchReceiveResp) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[5] + 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 DispatchReceiveResp.ProtoReflect.Descriptor instead. +func (*DispatchReceiveResp) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{5} +} + +// 派遣 +type DispatchDoReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId"` + HeroId []string `protobuf:"bytes,2,rep,name=heroId,proto3" json:"heroId"` +} + +func (x *DispatchDoReq) Reset() { + *x = DispatchDoReq{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchDoReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchDoReq) ProtoMessage() {} + +func (x *DispatchDoReq) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[6] + 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 DispatchDoReq.ProtoReflect.Descriptor instead. +func (*DispatchDoReq) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{6} +} + +func (x *DispatchDoReq) GetTaskId() int32 { + if x != nil { + return x.TaskId + } + return 0 +} + +func (x *DispatchDoReq) GetHeroId() []string { + if x != nil { + return x.HeroId + } + return nil +} + +type DispatchDoResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DispatchDoResp) Reset() { + *x = DispatchDoResp{} + if protoimpl.UnsafeEnabled { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DispatchDoResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DispatchDoResp) ProtoMessage() {} + +func (x *DispatchDoResp) ProtoReflect() protoreflect.Message { + mi := &file_dispatch_dispatch_msg_proto_msgTypes[7] + 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 DispatchDoResp.ProtoReflect.Descriptor instead. +func (*DispatchDoResp) Descriptor() ([]byte, []int) { + return file_dispatch_dispatch_msg_proto_rawDescGZIP(), []int{7} +} + +var File_dispatch_dispatch_msg_proto protoreflect.FileDescriptor + +var file_dispatch_dispatch_msg_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x64, + 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x2f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, 0x11, 0x44, 0x69, 0x73, + 0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x22, 0x3d, + 0x0a, 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x44, 0x69, 0x73, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x08, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x22, 0x14, 0x0a, + 0x12, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, + 0x52, 0x65, 0x71, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, + 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x22, 0x14, 0x0a, 0x12, 0x44, 0x69, + 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, + 0x22, 0x15, 0x0a, 0x13, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x3f, 0x0a, 0x0d, 0x44, 0x69, 0x73, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x69, 0x73, 0x70, + 0x61, 0x74, 0x63, 0x68, 0x44, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_dispatch_dispatch_msg_proto_rawDescOnce sync.Once + file_dispatch_dispatch_msg_proto_rawDescData = file_dispatch_dispatch_msg_proto_rawDesc +) + +func file_dispatch_dispatch_msg_proto_rawDescGZIP() []byte { + file_dispatch_dispatch_msg_proto_rawDescOnce.Do(func() { + file_dispatch_dispatch_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_dispatch_dispatch_msg_proto_rawDescData) + }) + return file_dispatch_dispatch_msg_proto_rawDescData +} + +var file_dispatch_dispatch_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_dispatch_dispatch_msg_proto_goTypes = []interface{}{ + (*DispatchNoticeReq)(nil), // 0: DispatchNoticeReq + (*DispatchNoticeResp)(nil), // 1: DispatchNoticeResp + (*DispatchRefreshReq)(nil), // 2: DispatchRefreshReq + (*DispatchRefreshResp)(nil), // 3: DispatchRefreshResp + (*DispatchReceiveReq)(nil), // 4: DispatchReceiveReq + (*DispatchReceiveResp)(nil), // 5: DispatchReceiveResp + (*DispatchDoReq)(nil), // 6: DispatchDoReq + (*DispatchDoResp)(nil), // 7: DispatchDoResp + (*DBDispatch)(nil), // 8: DBDispatch +} +var file_dispatch_dispatch_msg_proto_depIdxs = []int32{ + 8, // 0: DispatchNoticeResp.dispatch:type_name -> DBDispatch + 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_dispatch_dispatch_msg_proto_init() } +func file_dispatch_dispatch_msg_proto_init() { + if File_dispatch_dispatch_msg_proto != nil { + return + } + file_dispatch_dispatch_db_proto_init() + if !protoimpl.UnsafeEnabled { + file_dispatch_dispatch_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchNoticeReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchNoticeResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchRefreshReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchRefreshResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchReceiveReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchReceiveResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchDoReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_dispatch_dispatch_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DispatchDoResp); 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_dispatch_dispatch_msg_proto_rawDesc, + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_dispatch_dispatch_msg_proto_goTypes, + DependencyIndexes: file_dispatch_dispatch_msg_proto_depIdxs, + MessageInfos: file_dispatch_dispatch_msg_proto_msgTypes, + }.Build() + File_dispatch_dispatch_msg_proto = out.File + file_dispatch_dispatch_msg_proto_rawDesc = nil + file_dispatch_dispatch_msg_proto_goTypes = nil + file_dispatch_dispatch_msg_proto_depIdxs = nil +} diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index f31f4aad3..dda496e7a 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -334,6 +334,8 @@ const ( ErrorCode_SmithyNoActivateAtlas ErrorCode = 4113 // 没有图鉴更新数据 ErrorCode_SmithyLvToolsFailed ErrorCode = 4114 // ErrorCode_SmithyLvToolsPre ErrorCode = 4115 // 前置条件不足 + // dispatch + ErrorCode_DispatchHeroNoReached ErrorCode = 4201 //英雄条件未达标 ) // Enum value maps for ErrorCode. @@ -618,6 +620,7 @@ var ( 4113: "SmithyNoActivateAtlas", 4114: "SmithyLvToolsFailed", 4115: "SmithyLvToolsPre", + 4201: "DispatchHeroNoReached", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -899,6 +902,7 @@ var ( "SmithyNoActivateAtlas": 4113, "SmithyLvToolsFailed": 4114, "SmithyLvToolsPre": 4115, + "DispatchHeroNoReached": 4201, } ) @@ -933,7 +937,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xe3, 0x32, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xff, 0x32, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -1339,8 +1343,10 @@ var file_errorcode_proto_rawDesc = []byte{ 0x6c, 0x61, 0x73, 0x10, 0x91, 0x20, 0x12, 0x18, 0x0a, 0x13, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x4c, 0x76, 0x54, 0x6f, 0x6f, 0x6c, 0x73, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x92, 0x20, 0x12, 0x15, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x4c, 0x76, 0x54, 0x6f, 0x6f, 0x6c, - 0x73, 0x50, 0x72, 0x65, 0x10, 0x93, 0x20, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x50, 0x72, 0x65, 0x10, 0x93, 0x20, 0x12, 0x1a, 0x0a, 0x15, 0x44, 0x69, 0x73, 0x70, 0x61, + 0x74, 0x63, 0x68, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, + 0x10, 0xe9, 0x20, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/sys/configure/structs/Game.DispatchCond.go b/sys/configure/structs/Game.DispatchCond.go new file mode 100644 index 000000000..3bf298e05 --- /dev/null +++ b/sys/configure/structs/Game.DispatchCond.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 GameDispatchCond struct { + Key int32 + Param int32 +} + +const TypeId_GameDispatchCond = -852261064 + +func (*GameDispatchCond) GetTypeId() int32 { + return -852261064 +} + +func (_v *GameDispatchCond)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["param"].(float64); !_ok_ { err = errors.New("param error"); return }; _v.Param = int32(_tempNum_) } + return +} + +func DeserializeGameDispatchCond(_buf map[string]interface{}) (*GameDispatchCond, error) { + v := &GameDispatchCond{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Game.DispatchCondType.go b/sys/configure/structs/Game.DispatchCondType.go new file mode 100644 index 000000000..347eb7b26 --- /dev/null +++ b/sys/configure/structs/Game.DispatchCondType.go @@ -0,0 +1,14 @@ +//------------------------------------------------------------------------------ +// +// 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 + +const ( + GameDispatchCondType_Lv = 1 + GameDispatchCondType_Star = 2 +) diff --git a/sys/configure/structs/Game.Dispatch_LvData.go b/sys/configure/structs/Game.Dispatch_LvData.go index f09d821aa..41cc0d187 100644 --- a/sys/configure/structs/Game.Dispatch_LvData.go +++ b/sys/configure/structs/Game.Dispatch_LvData.go @@ -12,7 +12,7 @@ import "errors" type GameDispatch_LvData struct { Lv int32 - Probability []float32 + Probability []int32 Upgrade int32 } @@ -29,11 +29,11 @@ func (_v *GameDispatch_LvData)Deserialize(_buf map[string]interface{}) (err erro var _ok_ bool if _arr_, _ok_ = _buf["probability"].([]interface{}); !_ok_ { err = errors.New("probability error"); return } - _v.Probability = make([]float32, 0, len(_arr_)) + _v.Probability = make([]int32, 0, len(_arr_)) for _, _e_ := range _arr_ { - var _list_v_ float32 - { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = float32(_x_) } + var _list_v_ int32 + { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } _v.Probability = append(_v.Probability, _list_v_) } } diff --git a/sys/configure/structs/Game.Dispatch_TaskData.go b/sys/configure/structs/Game.Dispatch_TaskData.go index 92ef5e605..552aead52 100644 --- a/sys/configure/structs/Game.Dispatch_TaskData.go +++ b/sys/configure/structs/Game.Dispatch_TaskData.go @@ -14,12 +14,12 @@ type GameDispatch_TaskData struct { Id int32 Type int32 Taskname string - Taskcd float32 - Tasktime float32 + Taskcd int32 + Tasktime int32 Tasktxt string Taskneed int32 - Taskreq []string - Taskreqex []string + Taskreq []*GameDispatchCond + Taskreqex []*GameDispatchCond Reward []*Gameatn Rewardex []*Gameatn } @@ -34,8 +34,8 @@ func (_v *GameDispatch_TaskData)Deserialize(_buf map[string]interface{}) (err er { 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["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["taskname"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Taskname error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Taskname, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskcd"].(float64); !_ok_ { err = errors.New("taskcd error"); return }; _v.Taskcd = float32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tasktime"].(float64); !_ok_ { err = errors.New("tasktime error"); return }; _v.Tasktime = float32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["taskcd"].(float64); !_ok_ { err = errors.New("taskcd error"); return }; _v.Taskcd = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tasktime"].(float64); !_ok_ { err = errors.New("tasktime error"); return }; _v.Tasktime = 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["taskneed"].(float64); !_ok_ { err = errors.New("taskneed error"); return }; _v.Taskneed = int32(_tempNum_) } { @@ -43,11 +43,11 @@ func (_v *GameDispatch_TaskData)Deserialize(_buf map[string]interface{}) (err er var _ok_ bool if _arr_, _ok_ = _buf["taskreq"].([]interface{}); !_ok_ { err = errors.New("taskreq error"); return } - _v.Taskreq = make([]string, 0, len(_arr_)) + _v.Taskreq = make([]*GameDispatchCond, 0, len(_arr_)) for _, _e_ := range _arr_ { - var _list_v_ string - { if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } } + var _list_v_ *GameDispatchCond + { 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 = DeserializeGameDispatchCond(_x_); err != nil { return } } _v.Taskreq = append(_v.Taskreq, _list_v_) } } @@ -57,11 +57,11 @@ func (_v *GameDispatch_TaskData)Deserialize(_buf map[string]interface{}) (err er var _ok_ bool if _arr_, _ok_ = _buf["taskreqex"].([]interface{}); !_ok_ { err = errors.New("taskreqex error"); return } - _v.Taskreqex = make([]string, 0, len(_arr_)) + _v.Taskreqex = make([]*GameDispatchCond, 0, len(_arr_)) for _, _e_ := range _arr_ { - var _list_v_ string - { if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } } + var _list_v_ *GameDispatchCond + { 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 = DeserializeGameDispatchCond(_x_); err != nil { return } } _v.Taskreqex = append(_v.Taskreqex, _list_v_) } } diff --git a/sys/configure/structs/Game.dispatch.go b/sys/configure/structs/Game.dispatch.go new file mode 100644 index 000000000..f0e0a6f87 --- /dev/null +++ b/sys/configure/structs/Game.dispatch.go @@ -0,0 +1,50 @@ +//------------------------------------------------------------------------------ +// +// 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 Gamedispatch struct { + N int32 + G []*Gameatn +} + +const TypeId_Gamedispatch = -1941607722 + +func (*Gamedispatch) GetTypeId() int32 { + return -1941607722 +} + +func (_v *Gamedispatch)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["n"].(float64); !_ok_ { err = errors.New("n error"); return }; _v.N = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["g"].([]interface{}); !_ok_ { err = errors.New("g error"); return } + + _v.G = make([]*Gameatn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Gameatn + { 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 = DeserializeGameatn(_x_); err != nil { return } } + _v.G = append(_v.G, _list_v_) + } + } + + return +} + +func DeserializeGamedispatch(_buf map[string]interface{}) (*Gamedispatch, error) { + v := &Gamedispatch{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/utils/utils_test.go b/utils/utils_test.go index 0ebb63e76..daafaac4f 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -36,7 +36,7 @@ func TestRandom(t *testing.T) { func TestNumber(t *testing.T) { for i := 0; i < 100; i++ { - fmt.Println(utils.RandomNumbers(0, 99, 10)) + fmt.Println(utils.RandomNumbers(0, 4, 6)) } }