From 74344f18ac95ae77d013c86fae002f726e404886 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 23 Oct 2023 16:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E5=BA=8A=E6=8D=95=E7=BE=8A=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 10 +- comm/core.go | 24 +- modules/comp_match.go | 61 +++ modules/matchpool/module.go | 76 +++ modules/matchpool/pool.go | 115 ++++ modules/matchpool/pools.go | 82 +++ modules/parkour/ai.go | 2 +- modules/parkour/api_Info.go | 41 +- modules/parkour/api_racematch.go | 12 +- modules/parkour/api_racematchcancel.go | 4 +- modules/parkour/api_ready.go | 4 +- modules/parkour/api_recoverhp.go | 6 +- modules/parkour/match.go | 118 +++++ modules/parkour/model_parkour.go | 28 +- modules/parkour/module.go | 85 ++- modules/timer/module.go | 10 +- modules/timer/parkour.go | 696 ++++++++++++------------- pb/dcolor_db.pb.go | 78 ++- pb/dcolor_msg.pb.go | 45 +- pb/matchpool_db.pb.go | 61 +++ pb/matchpool_msg.pb.go | 520 ++++++++++++++++++ pb/parkour_db.pb.go | 510 +++++++++--------- services/comp_gateroute.go | 10 +- services/comp_match.go | 81 +++ services/mainte/main.go | 2 + services/worker/main.go | 1 + 26 files changed, 1920 insertions(+), 762 deletions(-) create mode 100644 modules/comp_match.go create mode 100644 modules/matchpool/module.go create mode 100644 modules/matchpool/pool.go create mode 100644 modules/matchpool/pools.go create mode 100644 modules/parkour/match.go create mode 100644 pb/matchpool_db.pb.go create mode 100644 pb/matchpool_msg.pb.go create mode 100644 services/comp_match.go diff --git a/comm/const.go b/comm/const.go index f806b0e95..6994f2af8 100644 --- a/comm/const.go +++ b/comm/const.go @@ -13,7 +13,8 @@ const ( ) const ( - SC_ServiceGateRouteComp core.S_Comps = "SC_GateRouteComp" //s_comps.ISC_GateRouteComp + SC_ServiceGateRouteComp core.S_Comps = "SC_GateRouteComp" //s_comps.ISC_GateRouteComp + SC_ServiceMatchComp core.S_Comps = "SC_ServiceMatchComp" //s_comps.ISC_GateRouteComp ) const ( @@ -115,6 +116,7 @@ const ( ModuleEntertainment core.M_Modules = "entertain" //消消乐 ModuleDcolor core.M_Modules = "dcolor" //猜颜色 ModuleMaincity core.M_Modules = "maincity" //主城同屏 + ModuleMatchPool core.M_Modules = "matchpool" //匹配 ) // 数据表名定义处 @@ -452,7 +454,11 @@ const ( //Rpc //PVP 离线托管 RPC_PVPTrusteeship core.Rpc_Key = "RPC_PVPTrusteeship" - + //捕羊大赛加入匹配请求 + RPC_JoinMatchPools core.Rpc_Key = "RPC_JoinMatchPools" //加入匹配池 + RPC_CancelMatch core.Rpc_Key = "RPC_CancelMatch" //取消匹配 + //成功匹配 + RPC_SuccMatchNotice core.Rpc_Key = "RPC_SuccMatchNotice" //成功匹配 //捕羊大赛加入匹配请求 RPC_ParkourJoinMatch core.Rpc_Key = "RPC_ParkourJoinMatch" //加入匹配 RPC_ParkourCancelMatch core.Rpc_Key = "RPC_ParkourCancelMatch" //取消匹配 diff --git a/comm/core.go b/comm/core.go index bc5258348..9500b2602 100644 --- a/comm/core.go +++ b/comm/core.go @@ -4,14 +4,15 @@ import ( "context" "crypto/rand" "fmt" + "go_dreamfactory/lego/base" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/utils/container/id" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" "math/big" "reflect" "strings" - "go_dreamfactory/lego/base" - "go_dreamfactory/lego/core" - "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" ) @@ -25,6 +26,12 @@ type ISC_GateRouteComp interface { PutUserSession(session IUserSession) } +// 服务匹配组件 +type ISC_MatchComp interface { + core.IServiceComp + RegisterMatchPool(poolName string, comp reflect.Value, msg reflect.Type, handle reflect.Method) +} + // 游戏类资源类型 const ( AttrType = "attr" //用户属性资源 例如货币 经验 之类的 @@ -211,3 +218,14 @@ func GetUserBaseInfo(user *pb.DBUser) *pb.BaseUserInfo { } return info } + +func GetRobotBaseInfo(robot *cfg.GameRobotData) *pb.BaseUserInfo { + info := &pb.BaseUserInfo{ + Uid: fmt.Sprintf("ai_%s", id.NewXId()), + Name: robot.Name, + Gender: robot.Sex, + Skin: robot.Showid, + Lv: robot.Lvshow, + } + return info +} diff --git a/modules/comp_match.go b/modules/comp_match.go new file mode 100644 index 000000000..494026f3e --- /dev/null +++ b/modules/comp_match.go @@ -0,0 +1,61 @@ +package modules + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/base" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/core/cbase" + "log" + "reflect" +) + +/* +模块 网关组件 接收处理用户传递消息 +*/ +type MCompMatch struct { + cbase.ModuleCompBase + service base.IRPCXService //rpc服务对象 + module core.IModule //当前业务模块 + comp core.IModuleComp //网关组件自己 + scomp comm.ISC_MatchComp + PoolName string +} + +//组件初始化接口 +func (this *MCompMatch) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.ModuleCompBase.Init(service, module, comp, options) + this.service = service.(base.IRPCXService) + this.module = module + this.comp = comp + return +} + +//组件启动接口,启动时将自己接收用户消息的处理函数注册到services/comp_gateroute.go 对象中 +func (this *MCompMatch) Start() (err error) { + if err = this.ModuleCompBase.Start(); err != nil { + return + } + var comp core.IServiceComp + //注册远程路由 + if comp, err = this.service.GetComp(comm.SC_ServiceMatchComp); err != nil { + return + } + this.scomp = comp.(comm.ISC_MatchComp) + this.suitableMethods() + return +} + +//反射注册相关接口道services/comp_gateroute.go 对象中 +func (this *MCompMatch) suitableMethods() { + typ := reflect.TypeOf(this.comp) + for m := 0; m < typ.NumMethod(); m++ { + method := typ.Method(m) + mname := method.Name + if mname == "MatchNotic" { + agrType := typ.In(1) + this.scomp.RegisterMatchPool(this.PoolName, reflect.ValueOf(this.comp), agrType, method) + return + } + } + log.Panicf("反射注册匹配池处理函数错误 [%s-%s] Api接口格式错误", this.module.GetType(), "MatchNotic") +} diff --git a/modules/matchpool/module.go b/modules/matchpool/module.go new file mode 100644 index 000000000..c3d1b10bb --- /dev/null +++ b/modules/matchpool/module.go @@ -0,0 +1,76 @@ +package matchpool + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/modules" + "go_dreamfactory/pb" +) + +/* +模块名:匹配池 +开发:李伟 +描述:集合项目中所有匹配玩法 +*/ +type MatchPool struct { + modules.ModuleBase + service comm.IService + pools *poolsComp +} + +func NewModule() core.IModule { + return &MatchPool{} +} + +func (this *MatchPool) GetType() core.M_Modules { + return comm.ModuleMatchPool +} + +func (this *MatchPool) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { + if err = this.ModuleBase.Init(service, module, options); err != nil { + return + } + this.service = service.(comm.IService) + return +} + +func (this *MatchPool) Start() (err error) { + if err = this.ModuleBase.Start(); err != nil { + return + } + this.service.RegisterFunctionName(string(comm.RPC_JoinMatchPools), this.JoinMatchPools) + this.service.RegisterFunctionName(string(comm.RPC_CancelMatch), this.CancelMatch) + return +} + +func (this *MatchPool) OnInstallComp() { + this.ModuleBase.OnInstallComp() + this.pools = this.RegisterComp(new(poolsComp)).(*poolsComp) +} + +//加入匹配池 +func (this *MatchPool) JoinMatchPools(ctx context.Context, req *pb.JoinMatchPoolReq, resp *pb.JoinMatchPoolResp) { + this.pools.joinPools(req) +} + +//取消匹配 +func (this *MatchPool) CancelMatch(ctx context.Context, req *pb.CancelMatchReq, resp *pb.CancelMatchResp) { + this.pools.cancelMatch(req) +} + +func (this *MatchPool) MatchNotice(req *pb.SuccMatchNoticeReq) { + var ( + err error + ) + if err = this.service.RpcCall(context.Background(), + comm.Service_Worker, + string(comm.RPC_SuccMatchNotice), + req, + &pb.RPCParkourMatchSuccResp{}, + ); err != nil { + this.Error("MatchNotice err!", log.Field{Key: "err", Value: err.Error()}) + return + } +} diff --git a/modules/matchpool/pool.go b/modules/matchpool/pool.go new file mode 100644 index 000000000..178399296 --- /dev/null +++ b/modules/matchpool/pool.go @@ -0,0 +1,115 @@ +package matchpool + +import ( + "go_dreamfactory/pb" + "sync" + "sync/atomic" + + anypb "google.golang.org/protobuf/types/known/anypb" +) + +type MatchPlayer struct { + Uid string + Dan int32 + Time int32 + Data *anypb.Any +} + +//基础匹配池 +type MPool struct { + module *MatchPool + Name string + MatchNum int32 + Timeout int32 + lock sync.RWMutex + state int32 + Players map[string]*MatchPlayer +} + +func (this *MPool) join(req *pb.JoinMatchPoolReq) { + this.lock.Lock() + player := &MatchPlayer{ + Uid: req.Uid, + Time: 0, + Data: req.Data, + } + this.Players[req.Uid] = player + this.lock.Unlock() + +} + +func (this *MPool) cancel(uid string) { + this.lock.Lock() + delete(this.Players, uid) + this.lock.Unlock() +} + +func (this *MPool) match(cd int32) { + if !atomic.CompareAndSwapInt32(&this.state, 1, 2) { //正在执行,就不要在进来了 + return + } + defer func() { + atomic.StoreInt32(&this.state, 1) //执行完毕释放 + }() + var ( + ok bool + playerNum int32 + danplayers map[int32][]*MatchPlayer = make(map[int32][]*MatchPlayer) + group []*MatchPlayer + ) + this.lock.Lock() + for _, v := range this.Players { + v.Time += cd + playerNum += 1 + } + for _, v := range this.Players { + if _, ok = danplayers[v.Dan]; !ok { + danplayers[v.Dan] = make([]*MatchPlayer, 0) + } + danplayers[v.Dan] = append(danplayers[v.Dan], v) + } + this.lock.Unlock() + + if playerNum == 0 { + return + } + + group = make([]*MatchPlayer, 0) +locp: + for _, players := range danplayers { + if len(players) >= int(this.MatchNum) { + group = append(group, players[0:this.MatchNum]...) + break locp + } else { + for _, player := range players { + if player.Time >= this.Timeout { + group = append(group, players...) + break locp + } + } + } + } + if len(group) > 0 { + this.matchSucc(group) + } +} + +func (this *MPool) matchSucc(group []*MatchPlayer) { + var ( + Players map[string]*anypb.Any = make(map[string]*anypb.Any) + ) + this.lock.Lock() + for _, v := range group { + delete(this.Players, v.Uid) + } + this.lock.Unlock() + for _, v := range group { + Players[v.Uid] = v.Data + } + + go this.module.MatchNotice(&pb.SuccMatchNoticeReq{ + Poolname: this.Name, + Players: Players, + Missnum: this.MatchNum - int32(len(group)), + }) +} diff --git a/modules/matchpool/pools.go b/modules/matchpool/pools.go new file mode 100644 index 000000000..15fe585f6 --- /dev/null +++ b/modules/matchpool/pools.go @@ -0,0 +1,82 @@ +package matchpool + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/cron" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + "sync" +) + +type poolsComp struct { + modules.MCompGate + service core.IService + module *MatchPool + lock sync.RWMutex + pools map[string]*MPool +} + +func (this *poolsComp) 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.(*MatchPool) + this.service = service + return +} + +func (this *poolsComp) Start() (err error) { + err = this.MCompGate.Start() + if _, err = cron.AddFunc("*/1 * * * * ?", this.run); err != nil { + this.module.Errorf("cron.AddFunc err:%v", err) + } + return +} + +func (this *poolsComp) joinPools(req *pb.JoinMatchPoolReq) { + var ( + pool *MPool + ok bool + ) + this.lock.RLock() + pool, ok = this.pools[req.Poolname] + this.lock.RUnlock() + if !ok { + pool = &MPool{ + module: this.module, + Name: req.Poolname, + MatchNum: req.Matchnum, + Timeout: req.Timeout, + Players: make(map[string]*MatchPlayer), + } + this.lock.Lock() + this.pools[req.Poolname] = pool + this.lock.Unlock() + } + pool.join(req) +} + +func (this *poolsComp) cancelMatch(req *pb.CancelMatchReq) { + var ( + pool *MPool + ok bool + ) + this.lock.RLock() + pool, ok = this.pools[req.Poolname] + this.lock.RUnlock() + if ok { + pool.cancel(req.Uid) + } +} + +func (this *poolsComp) run() { + var ( + pools []*MPool = make([]*MPool, 0) + ) + this.lock.Lock() + for _, v := range this.pools { + pools = append(pools, v) + } + this.lock.Unlock() + for _, v := range pools { + go v.match(1) + } +} diff --git a/modules/parkour/ai.go b/modules/parkour/ai.go index 504f2c95c..41ce4a864 100644 --- a/modules/parkour/ai.go +++ b/modules/parkour/ai.go @@ -70,7 +70,7 @@ func (this *aiComp) createAi(battleid string, btype pb.RaceType, users []*pb.DBR if conf, err = this.module.configure.getgameBukashiAiDataByDan(int32(btype)+1, v.Dan+1); err != nil { return } - ais[i] = NewAI(battleid, v.Uid, conf) + ais[i] = NewAI(battleid, v.User.Uid, conf) } this.lock.Lock() diff --git a/modules/parkour/api_Info.go b/modules/parkour/api_Info.go index a0847e5bb..15abb0d91 100644 --- a/modules/parkour/api_Info.go +++ b/modules/parkour/api_Info.go @@ -89,14 +89,8 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ParkourInfoReq) (er update["weekintegral"] = 0 } - info.Lv = user.Lv - info.Name = user.Name - info.Sex = user.Gender - info.Skin = user.CurSkin - update["lv"] = user.Lv - update["name"] = user.Name - update["sex"] = user.Gender - update["skin"] = user.CurSkin + info.User = comm.GetUserBaseInfo(user) + update["user"] = info.User if err = this.module.parkourComp.Change(session.GetUserId(), update); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_DBError, @@ -106,36 +100,5 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ParkourInfoReq) (er return } session.SendMsg(string(this.module.GetType()), "info", &pb.ParkourInfoResp{Info: info}) - - // var ( - // isopen bool - // info *pb.DBParkour - // recommend []*pb.DBRaceMember - // err error - // ) - // if errdata = this.InfoCheck(session, req); errdata != nil { - // return - // } - // // isopen = this.module.configure.isopen() - // isopen = true - // if isopen { - // if info, err = this.module.parkourComp.queryinfo(session.GetUserId()); err != nil { - // errdata = &pb.ErrorData{ - // Code: pb.ErrorCode_DBError, - // Title: pb.ErrorCode_DBError.ToString(), - // Message: err.Error(), - // } - // return - // } - // if recommend, err = this.module.parkourComp.getrusers(session.GetUserId()); err != nil { - // errdata = &pb.ErrorData{ - // Code: pb.ErrorCode_DBError, - // Title: pb.ErrorCode_DBError.ToString(), - // Message: err.Error(), - // } - // return - // } - // } - // session.SendMsg(string(this.module.GetType()), "info", &pb.ParkourInfoResp{Isopen: isopen, Info: info, Recommend: recommend}) return } diff --git a/modules/parkour/api_racematch.go b/modules/parkour/api_racematch.go index a5dcc6b30..0c70fd296 100644 --- a/modules/parkour/api_racematch.go +++ b/modules/parkour/api_racematch.go @@ -43,7 +43,7 @@ func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMat return } // if team.Captainid == "" { //为组队情况 - team.Captainid = team.Uid + team.Captainid = team.User.Uid team.State = pb.RaceTeamState_teaming // team.Member = append(team.Member, &pb.DBRaceMember{ // Uid: team.Uid, @@ -58,11 +58,7 @@ func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMat // }) team.Member = []*pb.DBRaceMember{ { - Uid: team.Uid, - Name: team.Name, - Skin: team.Skin, - Sex: team.Sex, - Lv: team.Lv, + User: team.User, Dan: team.Dan, Mount: team.Mount, Property: team.Property, @@ -101,8 +97,8 @@ func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMat users = make([]string, len(team.Member)) for i, v := range team.Member { if !v.Isai { - users[i] = v.Uid - if err = this.module.parkourComp.Change(v.Uid, map[string]interface{}{ + users[i] = v.User.Uid + if err = this.module.parkourComp.Change(v.User.Uid, map[string]interface{}{ "state": pb.RaceTeamState_matching, }); err != nil { errdata = &pb.ErrorData{ diff --git a/modules/parkour/api_racematchcancel.go b/modules/parkour/api_racematchcancel.go index d41c4aae4..8f3640f5c 100644 --- a/modules/parkour/api_racematchcancel.go +++ b/modules/parkour/api_racematchcancel.go @@ -53,8 +53,8 @@ func (this *apiComp) RaceMatchCancel(session comm.IUserSession, req *pb.ParkourR users = make([]string, len(team.Member)) for i, v := range team.Member { if !v.Isai { - users[i] = v.Uid - if err = this.module.parkourComp.Change(v.Uid, map[string]interface{}{ + users[i] = v.User.Uid + if err = this.module.parkourComp.Change(v.User.Uid, map[string]interface{}{ "state": pb.RaceTeamState_matching, }); err != nil { errdata = &pb.ErrorData{ diff --git a/modules/parkour/api_ready.go b/modules/parkour/api_ready.go index dbcfe642a..9cd20ba9e 100644 --- a/modules/parkour/api_ready.go +++ b/modules/parkour/api_ready.go @@ -28,7 +28,7 @@ func (this *apiComp) Ready(session comm.IUserSession, req *pb.ParkourReadyReq) ( ok = false isready = true for _, v := range race.RedMember { - if v.Uid == session.GetUserId() { + if v.User.Uid == session.GetUserId() { v.Ready = true ok = true } else { @@ -38,7 +38,7 @@ func (this *apiComp) Ready(session comm.IUserSession, req *pb.ParkourReadyReq) ( } } for _, v := range race.BuleMember { - if v.Uid == session.GetUserId() { + if v.User.Uid == session.GetUserId() { v.Ready = true ok = true } else { diff --git a/modules/parkour/api_recoverhp.go b/modules/parkour/api_recoverhp.go index 424156cb8..58c2d2bb4 100644 --- a/modules/parkour/api_recoverhp.go +++ b/modules/parkour/api_recoverhp.go @@ -27,8 +27,8 @@ func (this *apiComp) RecoverHp(session comm.IUserSession, req *pb.ParkourRecover users = make([]string, 0) ok = false for _, v := range battle.RedMember { - users = append(users, v.Uid) - if v.Uid == session.GetUserId() { + users = append(users, v.User.Uid) + if v.User.Uid == session.GetUserId() { ok = true break } @@ -36,7 +36,7 @@ func (this *apiComp) RecoverHp(session comm.IUserSession, req *pb.ParkourRecover if !ok { users = users[:0] for _, v := range battle.BuleMember { - users = append(users, v.Uid) + users = append(users, v.User.Uid) } } //恢复hp diff --git a/modules/parkour/match.go b/modules/parkour/match.go new file mode 100644 index 000000000..52400ef88 --- /dev/null +++ b/modules/parkour/match.go @@ -0,0 +1,118 @@ +package parkour + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" + + "google.golang.org/protobuf/types/known/anypb" +) + +/* +匹配组件 +*/ +type matchComp struct { + modules.MCompMatch + service core.IService + module *Parkour +} + +//组件初始化接口 +func (this *matchComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.MCompMatch.Init(service, module, comp, options) + this.module = module.(*Parkour) + this.service = service + this.PoolName = "parkour" + return +} + +func (this *matchComp) Start() (err error) { + err = this.MCompMatch.Start() + return +} + +func (this *matchComp) MatchReq(player *pb.DBMatchPlayer) (err error) { + data, _ := anypb.New(player) + err = this.module.service.RpcCall( + context.Background(), + comm.Service_Mainte, + string(comm.RPC_JoinMatchPools), + &pb.JoinMatchPoolReq{ + Poolname: this.PoolName, + Uid: player.Suser.Uid, + Data: data, + Matchnum: 6, + Timeout: 10, + }, + &pb.JoinMatchPoolResp{}) + if err != nil { + this.module.Errorln(err) + return + } + return +} + +func (this *matchComp) MatchNotic(players []*pb.DBMatchPlayer) (errdata *pb.ErrorData) { + var ( + red []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 3) + bule []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 3) + ais []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0, 6) + dan int32 + leftnum int32 + err error + ) + for i, v := range players { + if i%2 == 0 { + red = append(red, &pb.DBRaceMember{ + User: v.Suser, + Dan: v.Dan, + Mlv: v.Mlv, + Mount: v.Mount, + Property: v.Property, + Currhp: v.Property[comm.Dhp], + }) + dan = v.Dan + } else { + bule = append(bule, &pb.DBRaceMember{ + User: v.Suser, + Dan: v.Dan, + Mlv: v.Mlv, + Mount: v.Mount, + Property: v.Property, + Currhp: v.Property[comm.Dhp], + }) + dan = v.Dan + } + } + leftnum = 6 - int32(len(players)) + if leftnum > 0 { + if ais, err = this.module.parkourComp.matcheAI(dan, leftnum); err != nil { + this.module.Error("matcheAI err!", log.Field{Key: "key", Value: err.Error()}) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Message: err.Error(), + } + return + } + + if len(red) < 3 { + red = append(red, ais[0:3-len(red)]...) + ais = ais[3-len(red):] + } + if len(bule) < 3 { + bule = append(bule, ais[0:3-len(bule)]...) + } + } + if err = this.module.createbattle(red, bule); err != nil { + this.module.Error("createbattle err!", log.Field{Key: "key", Value: err.Error()}) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_SystemError, + Message: err.Error(), + } + } + return +} diff --git a/modules/parkour/model_parkour.go b/modules/parkour/model_parkour.go index 18e36e1aa..141a52970 100644 --- a/modules/parkour/model_parkour.go +++ b/modules/parkour/model_parkour.go @@ -7,7 +7,6 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/mgo" - "go_dreamfactory/lego/utils/container/id" "go_dreamfactory/modules" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" @@ -67,7 +66,7 @@ func (this *ModelParkourComp) getrusers(uid string) (recommend []*pb.DBRaceMembe this.lock.RLock() users = make([]*Recommend, 0, len(this.users)) for _, v := range this.users { - if v.parkour.Uid != uid { + if v.parkour.User.Uid != uid { users = append(users, v) } } @@ -80,14 +79,11 @@ func (this *ModelParkourComp) getrusers(uid string) (recommend []*pb.DBRaceMembe r := rand.New(rand.NewSource(configure.Now().Unix())) for i, v := range r.Perm(num) { if users[v].member == nil { - if users[v].user, err = this.module.ModuleUser.GetUser(users[v].parkour.Uid); err != nil { + if users[v].user, err = this.module.ModuleUser.GetUser(users[v].parkour.User.Uid); err != nil { continue } users[v].member = &pb.DBRaceMember{ - Uid: users[v].user.Uid, - Name: users[v].user.Name, - Sex: users[v].user.Gender, - Lv: users[v].user.Lv, + User: users[v].member.User, } } recommend[i] = users[v].member @@ -111,11 +107,7 @@ func (this *ModelParkourComp) matcheAI(dan, num int32) (results []*pb.DBRaceMemb return } results[i] = &pb.DBRaceMember{ - Uid: fmt.Sprintf("ai_%s", id.NewXId()), - Name: v.Name, - Sex: v.Sex, - Skin: v.Showid, - Lv: v.Lvshow, + User: comm.GetRobotBaseInfo(v), Dan: dan, Mount: dragon.Dragonid, Mlv: dragon.Lv, @@ -169,14 +161,14 @@ func (this *ModelParkourComp) queryinfo(uid string) (result *pb.DBParkour, err e return } if err == mgo.MongodbNil { - //var tuser *pb.DBUser - if _, err = this.module.ModuleUser.GetUser(uid); err != nil { + var user *pb.DBUser + if user, err = this.module.ModuleUser.GetUser(uid); err != nil { err = fmt.Errorf("no found udata:%s", uid) return } result = &pb.DBParkour{ Id: primitive.NewObjectID().Hex(), - Uid: uid, + User: comm.GetUserBaseInfo(user), State: pb.RaceTeamState_resting, Invite: make([]*pb.DBRaceInvite, 0), Member: []*pb.DBRaceMember{}, @@ -203,14 +195,14 @@ func (this *ModelParkourComp) queryinfos(uids []string) (results []*pb.DBParkour } if len(onfound) > 0 { for _, v := range onfound { - - if _, err = this.module.ModuleUser.GetUser(v); err != nil { + var user *pb.DBUser + if user, err = this.module.ModuleUser.GetUser(v); err != nil { err = fmt.Errorf("no found udata:%s", v) return } temp := &pb.DBParkour{ Id: primitive.NewObjectID().Hex(), - Uid: v, + User: comm.GetUserBaseInfo(user), State: pb.RaceTeamState_resting, Invite: make([]*pb.DBRaceInvite, 0), Member: []*pb.DBRaceMember{}, diff --git a/modules/parkour/module.go b/modules/parkour/module.go index cb4007d6e..65cd26652 100644 --- a/modules/parkour/module.go +++ b/modules/parkour/module.go @@ -89,16 +89,6 @@ func (this *Parkour) OnInstallComp() { // 匹配 func (this *Parkour) match(team *pb.DBParkour, ais []*pb.DBRaceMember) (err error) { - err = this.service.RpcCall( - context.Background(), - comm.Service_Mainte, - string(comm.RPC_ParkourJoinMatch), - &pb.RPCParkourJoinMatchReq{Captainid: team.Captainid, Member: team.Member, Ais: ais}, - &pb.RPCParkourJoinMatchResp{}) - if err != nil { - this.Errorln(err) - return - } return } @@ -118,19 +108,18 @@ func (this *Parkour) cancelmatch(team *pb.DBParkour) (err error) { } // 匹配成功 创建战斗 -func (this *Parkour) createbattle(ctx context.Context, req *pb.RPCParkourMatchSuccReq, resp *pb.RPCParkourMatchSuccResp) (err error) { +func (this *Parkour) createbattle(red []*pb.DBRaceMember, bule []*pb.DBRaceMember) (err error) { var ( race *pb.DBRace battle *RaceItem sessions []comm.IUserSession = make([]comm.IUserSession, 0) ) - this.Debug("createbattle", log.Field{Key: "req", Value: req.String()}) - + this.Debug("createbattle", log.Field{Key: "red", Value: red}, log.Field{Key: "bule", Value: bule}) race = &pb.DBRace{ Id: primitive.NewObjectID().Hex(), ServicePath: fmt.Sprintf("%s/%s", this.service.GetType(), this.service.GetId()), - Redmember: req.Red, - Bulemember: req.Bule, + Redmember: red, + Bulemember: bule, } battle = &RaceItem{ Id: race.Id, @@ -138,33 +127,33 @@ func (this *Parkour) createbattle(ctx context.Context, req *pb.RPCParkourMatchSu overtimer: timewheel.Add(time.Minute*3, this.overtimer, race.Id), } - for _, v := range req.Red { + for _, v := range red { v.Currhp = v.Property[comm.Dhp] if !v.Isai { //非AI - session, online := this.GetUserSession(v.Uid) + session, online := this.GetUserSession(v.User.Uid) v.Isoff = !online if online { - battle.Session[v.Uid] = session + battle.Session[v.User.Uid] = session } } else { v.Ready = true } } - battle.RedMember = req.Red - for _, v := range req.Bule { + battle.RedMember = red + for _, v := range bule { v.Currhp = v.Property[comm.Dhp] if !v.Isai { //非AI - session, online := this.GetUserSession(v.Uid) + session, online := this.GetUserSession(v.User.Uid) v.Isoff = !online if online { - battle.Session[v.Uid] = session + battle.Session[v.User.Uid] = session } } else { v.Ready = true } } - battle.BuleMember = req.Bule + battle.BuleMember = bule for _, v := range battle.Session { sessions = append(sessions, v) @@ -241,7 +230,7 @@ func (this *Parkour) qte(id string, uid string, time float32, conf *cfg.GameBuzk if ok { ok = false for _, v := range battle.RedMember { - if v.Uid == uid { + if v.User.Uid == uid { ok = true v.Scores += conf.Value side = 1 @@ -251,7 +240,7 @@ func (this *Parkour) qte(id string, uid string, time float32, conf *cfg.GameBuzk } if !ok { for _, v := range battle.BuleMember { - if v.Uid == uid { + if v.User.Uid == uid { ok = true v.Scores += conf.Value side = 2 @@ -304,7 +293,7 @@ func (this *Parkour) shot(id string, uid string) { if ok { ok = false for _, v := range battle.RedMember { - if v.Uid == uid { + if v.User.Uid == uid { v.Scores += this.ModuleTools.GetGlobalConf().BuzkashiGoalscore ok = true side = 1 @@ -313,7 +302,7 @@ func (this *Parkour) shot(id string, uid string) { } if !ok { for _, v := range battle.BuleMember { - if v.Uid == uid { + if v.User.Uid == uid { v.Scores += this.ModuleTools.GetGlobalConf().BuzkashiGoalscore ok = true side = 2 @@ -364,7 +353,7 @@ func (this *Parkour) avoid(id string, uid string, distance float32, conf *cfg.Ga if ok { ok = false for _, v := range battle.RedMember { - if v.Uid == uid { + if v.User.Uid == uid { member = v ok = true winSide = 1 @@ -373,7 +362,7 @@ func (this *Parkour) avoid(id string, uid string, distance float32, conf *cfg.Ga } if !ok { for _, v := range battle.BuleMember { - if v.Uid == uid { + if v.User.Uid == uid { member = v ok = true winSide = 2 @@ -393,7 +382,7 @@ func (this *Parkour) avoid(id string, uid string, distance float32, conf *cfg.Ga if conf == nil { member.Currhp -= this.ModuleTools.GetGlobalConf().BuzkashiSpeedbumphp if member.Currhp <= 0 { - timewheel.Add(time.Second*time.Duration(this.ModuleTools.GetGlobalConf().BuzkashiResurrection), this.resurrectiontimer, battle.Id, member.Uid) + timewheel.Add(time.Second*time.Duration(this.ModuleTools.GetGlobalConf().BuzkashiResurrection), this.resurrectiontimer, battle.Id, member.User.Uid) } } else { member.Scores += conf.Value @@ -435,7 +424,7 @@ func (this *Parkour) recoverhp(id string, uid string, hp int32) { if ok { ok = false for _, v := range battle.RedMember { - if v.Uid == uid { + if v.User.Uid == uid { player = v v.Currhp += hp if v.Currhp > v.Property[comm.Dhp] { @@ -446,7 +435,7 @@ func (this *Parkour) recoverhp(id string, uid string, hp int32) { } } for _, v := range battle.BuleMember { - if v.Uid == uid { + if v.User.Uid == uid { player = v v.Currhp += hp if v.Currhp > v.Property[comm.Dhp] { @@ -518,7 +507,7 @@ func (this *Parkour) overtimer(task *timewheel.Task, args ...interface{}) { for _, v := range battle.RedMember { if !v.Isai { - if err = this.parkourComp.Change(v.Uid, map[string]interface{}{ + if err = this.parkourComp.Change(v.User.Uid, map[string]interface{}{ "captainid": "", "state": 0, "invite": []*pb.DBRaceInvite{}, @@ -531,7 +520,7 @@ func (this *Parkour) overtimer(task *timewheel.Task, args ...interface{}) { } for _, v := range battle.BuleMember { if !v.Isai { - if err = this.parkourComp.Change(v.Uid, map[string]interface{}{ + if err = this.parkourComp.Change(v.User.Uid, map[string]interface{}{ "captainid": "", "state": 0, "invite": []*pb.DBRaceInvite{}, @@ -569,13 +558,13 @@ func (this *Parkour) useroffline(uid, sessionid string) { if info.Captainid == uid { users = make([]string, 0) for _, v := range info.Member { - if v.Uid != uid && !v.Isai { - users = append(users, v.Uid) - if err = this.parkourComp.Change(v.Uid, map[string]interface{}{ + if v.User.Uid != uid && !v.Isai { + users = append(users, v.User.Uid) + if err = this.parkourComp.Change(v.User.Uid, map[string]interface{}{ "captainid": "", "state": 0, }); err != nil { - this.Error("用户离线! 解散队伍处理", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()}) + this.Error("用户离线! 解散队伍处理", log.Field{Key: "uid", Value: v.User.Uid}, log.Field{Key: "err", Value: err.Error()}) return } } @@ -653,13 +642,13 @@ func (this *Parkour) useroffline(uid, sessionid string) { } users = make([]string, 0) for _, v := range info.Member { - if v.Uid != uid && !v.Isai { - users = append(users, v.Uid) - if err = this.parkourComp.Change(v.Uid, map[string]interface{}{ + if v.User.Uid != uid && !v.Isai { + users = append(users, v.User.Uid) + if err = this.parkourComp.Change(v.User.Uid, map[string]interface{}{ "captainid": "", "state": 0, }); err != nil { - this.Error("用户离线! 解散队伍处理", log.Field{Key: "uid", Value: v.Uid}, log.Field{Key: "err", Value: err.Error()}) + this.Error("用户离线! 解散队伍处理", log.Field{Key: "uid", Value: v.User.Uid}, log.Field{Key: "err", Value: err.Error()}) return } } @@ -681,7 +670,7 @@ func (this *Parkour) useroffline(uid, sessionid string) { } for _, v := range result { for _, v1 := range v.Redmember { - if !v1.Isai && v1.Uid == uid { + if !v1.Isai && v1.User.Uid == uid { if lockpath == v.ServicePath { this.trusteeship(context.Background(), &pb.RPC_ParkourTrusteeshipReq{Battleid: v.Id, Uid: uid}, nil) return @@ -702,7 +691,7 @@ func (this *Parkour) useroffline(uid, sessionid string) { } } for _, v1 := range v.Bulemember { - if !v1.Isai && v1.Uid == uid { + if !v1.Isai && v1.User.Uid == uid { if lockpath == v.ServicePath { this.trusteeship(context.Background(), &pb.RPC_ParkourTrusteeshipReq{Battleid: v.Id, Uid: uid}, nil) return @@ -739,12 +728,12 @@ func (this *Parkour) trusteeship(ctx context.Context, req *pb.RPC_ParkourTrustee if ok { battle.lock.Lock() for _, v := range battle.BuleMember { - if v.Uid == v.Uid { + if v.User.Uid == v.User.Uid { v.Isoff = true } } for _, v := range battle.RedMember { - if v.Uid == v.Uid { + if v.User.Uid == v.User.Uid { v.Isoff = true } } @@ -774,14 +763,14 @@ func (this *Parkour) resurrectiontimer(task *timewheel.Task, args ...interface{} if ok { ok = false for _, v := range battle.RedMember { - if v.Uid == uid { + if v.User.Uid == uid { member = v ok = true } } if !ok { for _, v := range battle.BuleMember { - if v.Uid == uid { + if v.User.Uid == uid { member = v ok = true } diff --git a/modules/timer/module.go b/modules/timer/module.go index 518375678..9f6e1e622 100644 --- a/modules/timer/module.go +++ b/modules/timer/module.go @@ -26,10 +26,10 @@ type Timer struct { service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口 chat *ChatComp //俩天系统定时任务 //season *SeasonPagoda - forum *ForumComp - arena *ArenaComp - sociaty *SociatyComp - parkour *ParkourComp + forum *ForumComp + arena *ArenaComp + sociaty *SociatyComp + // parkour *ParkourComp caravan *CaravanRank activity *Activity stone *StoneComp @@ -69,7 +69,7 @@ func (this *Timer) OnInstallComp() { //this.season = this.RegisterComp(new(SeasonPagoda)).(*SeasonPagoda) this.arena = this.RegisterComp(new(ArenaComp)).(*ArenaComp) this.sociaty = this.RegisterComp(new(SociatyComp)).(*SociatyComp) - this.parkour = this.RegisterComp(new(ParkourComp)).(*ParkourComp) + // this.parkour = this.RegisterComp(new(ParkourComp)).(*ParkourComp) this.caravan = this.RegisterComp(new(CaravanRank)).(*CaravanRank) this.activity = this.RegisterComp(new(Activity)).(*Activity) this.stone = this.RegisterComp(new(StoneComp)).(*StoneComp) diff --git a/modules/timer/parkour.go b/modules/timer/parkour.go index 69efd5161..24b55086b 100644 --- a/modules/timer/parkour.go +++ b/modules/timer/parkour.go @@ -1,372 +1,372 @@ package timer -import ( - "context" - "go_dreamfactory/comm" - "go_dreamfactory/modules" - "go_dreamfactory/pb" - "go_dreamfactory/sys/db" - "sync" - "sync/atomic" - "time" +// import ( +// "context" +// "go_dreamfactory/comm" +// "go_dreamfactory/modules" +// "go_dreamfactory/pb" +// "go_dreamfactory/sys/db" +// "sync" +// "sync/atomic" +// "time" - "go_dreamfactory/lego/base" - "go_dreamfactory/lego/core" - "go_dreamfactory/lego/sys/cron" - "go_dreamfactory/lego/sys/log" +// "go_dreamfactory/lego/base" +// "go_dreamfactory/lego/core" +// "go_dreamfactory/lego/sys/cron" +// "go_dreamfactory/lego/sys/log" - "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/mongo/options" -) +// "go.mongodb.org/mongo-driver/bson" +// "go.mongodb.org/mongo-driver/mongo" +// "go.mongodb.org/mongo-driver/mongo/options" +// ) -type ParkourTeam struct { - member []*pb.DBRaceMember - ais []*pb.DBRaceMember -} +// type ParkourTeam struct { +// member []*pb.DBRaceMember +// ais []*pb.DBRaceMember +// } -/* -捕羊大赛 维护服务 -*/ -type ParkourComp struct { - modules.MCompConfigure - service base.IRPCXService - module *Timer - refresh time.Time //上一次刷新时间 - ulock sync.RWMutex - users []*pb.DBRaceMember //推荐用户信息 - tlock sync.RWMutex - teams map[string]*ParkourTeam - timerlock int32 - total int32 -} +// /* +// 捕羊大赛 维护服务 +// */ +// type ParkourComp struct { +// modules.MCompConfigure +// service base.IRPCXService +// module *Timer +// refresh time.Time //上一次刷新时间 +// ulock sync.RWMutex +// users []*pb.DBRaceMember //推荐用户信息 +// tlock sync.RWMutex +// teams map[string]*ParkourTeam +// timerlock int32 +// total int32 +// } -// 组件初始化接口 -func (this *ParkourComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { - this.MCompConfigure.Init(service, module, comp, options) - this.service = service.(base.IRPCXService) - this.module = module.(*Timer) - this.timerlock = 1 - this.teams = make(map[string]*ParkourTeam) - return -} +// // 组件初始化接口 +// func (this *ParkourComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { +// this.MCompConfigure.Init(service, module, comp, options) +// this.service = service.(base.IRPCXService) +// this.module = module.(*Timer) +// this.timerlock = 1 +// this.teams = make(map[string]*ParkourTeam) +// return +// } -// 自由跨服环境下开启此功能 -func (this *ParkourComp) Start() (err error) { - err = this.MCompConfigure.Start() - if db.IsCross() { - this.refreshlist() - this.service.RegisterFunctionName(string(comm.RPC_ParkourJoinMatch), this.join) - this.service.RegisterFunctionName(string(comm.RPC_ParkourCancelMatch), this.cancel) - if _, err = cron.AddFunc("*/10 * * * * ?", this.match); err != nil { - this.module.Errorf("cron.AddFunc err:%v", err) - } - if _, err = cron.AddFunc("1 1 * * * ?", this.refreshlist); err != nil { - this.module.Errorf("cron.AddFunc err:%v", err) - } - } - return -} +// // 自由跨服环境下开启此功能 +// func (this *ParkourComp) Start() (err error) { +// err = this.MCompConfigure.Start() +// if db.IsCross() { +// this.refreshlist() +// this.service.RegisterFunctionName(string(comm.RPC_ParkourJoinMatch), this.join) +// this.service.RegisterFunctionName(string(comm.RPC_ParkourCancelMatch), this.cancel) +// if _, err = cron.AddFunc("*/10 * * * * ?", this.match); err != nil { +// this.module.Errorf("cron.AddFunc err:%v", err) +// } +// if _, err = cron.AddFunc("1 1 * * * ?", this.refreshlist); err != nil { +// this.module.Errorf("cron.AddFunc err:%v", err) +// } +// } +// return +// } -// 刷新推荐列表 -func (this *ParkourComp) refreshlist() { - var ( - c *mongo.Cursor - conn *db.DBConn - err error - ) - if conn, err = db.Local(); err != nil { - return - } - if c, err = conn.Mgo.Find(core.SqlTable(comm.TableParkour), bson.M{}, options.Find().SetSort(bson.D{{"integral", -1}}).SetSkip(0).SetLimit(100)); err != nil { - this.module.Errorln(err) - return - } else { - result := make([]*pb.DBParkour, 0, c.RemainingBatchLength()) - for c.Next(context.Background()) { - tmp := &pb.DBParkour{} - if err = c.Decode(tmp); err != nil { - log.Errorln(err) - } else { - result = append(result, tmp) - } - } - this.ulock.Lock() - this.users = this.users[:0] - for _, v := range result { - this.users = append(this.users, &pb.DBRaceMember{ - Uid: v.Uid, - Name: v.Name, - Sex: v.Sex, - Skin: v.Skin, - Dan: v.Dan, - Lv: v.Lv, - Mount: v.Mount, - Mlv: v.Mlv, - Property: v.Property, - Currhp: v.Property[comm.Dhp], - Isai: true, - }) - } +// // 刷新推荐列表 +// func (this *ParkourComp) refreshlist() { +// var ( +// c *mongo.Cursor +// conn *db.DBConn +// err error +// ) +// if conn, err = db.Local(); err != nil { +// return +// } +// if c, err = conn.Mgo.Find(core.SqlTable(comm.TableParkour), bson.M{}, options.Find().SetSort(bson.D{{"integral", -1}}).SetSkip(0).SetLimit(100)); err != nil { +// this.module.Errorln(err) +// return +// } else { +// result := make([]*pb.DBParkour, 0, c.RemainingBatchLength()) +// for c.Next(context.Background()) { +// tmp := &pb.DBParkour{} +// if err = c.Decode(tmp); err != nil { +// log.Errorln(err) +// } else { +// result = append(result, tmp) +// } +// } +// this.ulock.Lock() +// this.users = this.users[:0] +// for _, v := range result { +// this.users = append(this.users, &pb.DBRaceMember{ +// Uid: v.Uid, +// Name: v.Name, +// Sex: v.Sex, +// Skin: v.Skin, +// Dan: v.Dan, +// Lv: v.Lv, +// Mount: v.Mount, +// Mlv: v.Mlv, +// Property: v.Property, +// Currhp: v.Property[comm.Dhp], +// Isai: true, +// }) +// } - this.ulock.Unlock() - } - return -} +// this.ulock.Unlock() +// } +// return +// } -// 加入匹配中 -func (this *ParkourComp) join(ctx context.Context, req *pb.RPCParkourJoinMatchReq, resp *pb.RPCParkourJoinMatchResp) (err error) { - this.tlock.Lock() - this.teams[req.Captainid] = &ParkourTeam{ - member: req.Member, - ais: req.Ais, - } - this.total += int32(len(req.Member)) - this.tlock.Unlock() - if this.total >= 6 && atomic.LoadInt32(&this.timerlock) == 1 { - go this.match() - } - return -} +// // 加入匹配中 +// func (this *ParkourComp) join(ctx context.Context, req *pb.RPCParkourJoinMatchReq, resp *pb.RPCParkourJoinMatchResp) (err error) { +// this.tlock.Lock() +// this.teams[req.Captainid] = &ParkourTeam{ +// member: req.Member, +// ais: req.Ais, +// } +// this.total += int32(len(req.Member)) +// this.tlock.Unlock() +// if this.total >= 6 && atomic.LoadInt32(&this.timerlock) == 1 { +// go this.match() +// } +// return +// } -// 加入匹配中 -func (this *ParkourComp) cancel(ctx context.Context, req *pb.RPCParkourCancelMatchReq, resp *pb.RPCParkourCancelMatchResp) (err error) { - this.tlock.Lock() - delete(this.teams, req.Captainid) - this.tlock.Unlock() - return -} +// // 加入匹配中 +// func (this *ParkourComp) cancel(ctx context.Context, req *pb.RPCParkourCancelMatchReq, resp *pb.RPCParkourCancelMatchResp) (err error) { +// this.tlock.Lock() +// delete(this.teams, req.Captainid) +// this.tlock.Unlock() +// return +// } -// 定时匹配处理 -func (this *ParkourComp) match() { - // this.module.Debug("执行一次匹配!") - if !atomic.CompareAndSwapInt32(&this.timerlock, 1, 2) { //正在执行,就不要在进来了 - return - } - // startime := time.Now() - defer func() { - atomic.StoreInt32(&this.timerlock, 1) //执行完毕释放 - // log.Debug("Parkour Match", - // log.Field{Key: "t", Value: time.Since(startime).Milliseconds()}, - // ) - }() +// // 定时匹配处理 +// func (this *ParkourComp) match() { +// // this.module.Debug("执行一次匹配!") +// if !atomic.CompareAndSwapInt32(&this.timerlock, 1, 2) { //正在执行,就不要在进来了 +// return +// } +// // startime := time.Now() +// defer func() { +// atomic.StoreInt32(&this.timerlock, 1) //执行完毕释放 +// // log.Debug("Parkour Match", +// // log.Field{Key: "t", Value: time.Since(startime).Milliseconds()}, +// // ) +// }() - // this.module.Errorf("捕羊大赛 定时匹配,%d", this.total) - if this.total == 0 { - return - } +// // this.module.Errorf("捕羊大赛 定时匹配,%d", this.total) +// if this.total == 0 { +// return +// } - var ( - ok bool - err error - users []*pb.DBRaceMember - teams1 []string = make([]string, 0) - teams2 []string = make([]string, 0) - teams3 []string = make([]string, 0) - left int32 = this.total - red []string = make([]string, 0) - rednum int = 0 - reduser []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0) - bule []string = make([]string, 0) - bulenum int = 0 - buleuser []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0) - aismap map[string]*pb.DBRaceMember = make(map[string]*pb.DBRaceMember) - ais []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0) - order bool = false - ) - this.tlock.Lock() - for k, v := range this.teams { - if len(v.member) == 1 { - teams1 = append(teams1, k) - } else if len(v.member) == 2 { - teams2 = append(teams2, k) - } else { - teams3 = append(teams3, k) - } - } - this.tlock.Unlock() +// var ( +// ok bool +// err error +// users []*pb.DBRaceMember +// teams1 []string = make([]string, 0) +// teams2 []string = make([]string, 0) +// teams3 []string = make([]string, 0) +// left int32 = this.total +// red []string = make([]string, 0) +// rednum int = 0 +// reduser []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0) +// bule []string = make([]string, 0) +// bulenum int = 0 +// buleuser []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0) +// aismap map[string]*pb.DBRaceMember = make(map[string]*pb.DBRaceMember) +// ais []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0) +// order bool = false +// ) +// this.tlock.Lock() +// for k, v := range this.teams { +// if len(v.member) == 1 { +// teams1 = append(teams1, k) +// } else if len(v.member) == 2 { +// teams2 = append(teams2, k) +// } else { +// teams3 = append(teams3, k) +// } +// } +// this.tlock.Unlock() - this.ulock.RLock() - users = make([]*pb.DBRaceMember, 0, len(this.users)) - for _, v1 := range this.users { - ok = false - for _, v := range this.teams { - for _, v2 := range v.member { - if v1.Uid == v2.Uid { - ok = true - } - } - } - if !ok { //过滤掉已存在的人员 - users = append(users, v1) - } - } - this.ulock.RUnlock() +// this.ulock.RLock() +// users = make([]*pb.DBRaceMember, 0, len(this.users)) +// for _, v1 := range this.users { +// ok = false +// for _, v := range this.teams { +// for _, v2 := range v.member { +// if v1.Uid == v2.Uid { +// ok = true +// } +// } +// } +// if !ok { //过滤掉已存在的人员 +// users = append(users, v1) +// } +// } +// this.ulock.RUnlock() - // if len(users)+int(this.total) < 6 { //人员不足 - // return - // } +// // if len(users)+int(this.total) < 6 { //人员不足 +// // return +// // } - var fn = func() { - if order { - //找红队 - if rednum <= 0 && len(teams3) > 0 { - red = append(red, teams3[0]) - teams3 = teams3[1:] - rednum = 3 - left -= 3 - } else if rednum <= 1 && len(teams2) > 0 { - red = append(red, teams2[0]) - teams2 = teams2[1:] - rednum = 2 - left -= 2 - } else if rednum <= 2 && len(teams1) > 0 { - red = append(red, teams1[0]) - teams1 = teams1[1:] - rednum = 1 - left -= 1 - } +// var fn = func() { +// if order { +// //找红队 +// if rednum <= 0 && len(teams3) > 0 { +// red = append(red, teams3[0]) +// teams3 = teams3[1:] +// rednum = 3 +// left -= 3 +// } else if rednum <= 1 && len(teams2) > 0 { +// red = append(red, teams2[0]) +// teams2 = teams2[1:] +// rednum = 2 +// left -= 2 +// } else if rednum <= 2 && len(teams1) > 0 { +// red = append(red, teams1[0]) +// teams1 = teams1[1:] +// rednum = 1 +// left -= 1 +// } - //找蓝队 - if bulenum <= 0 && len(teams3) > 0 { - bule = append(bule, teams3[0]) - teams3 = teams3[1:] - bulenum = 3 - left -= 3 - } else if bulenum <= 1 && len(teams2) > 0 { - bule = append(bule, teams2[0]) - teams2 = teams2[1:] - bulenum = 2 - left -= 2 - } else if bulenum <= 2 && len(teams1) > 0 { - bule = append(bule, teams1[0]) - teams1 = teams1[1:] - bulenum = 1 - left -= 1 - } - } else { - //找蓝队 - if bulenum <= 0 && len(teams3) > 0 { - bule = append(bule, teams3[0]) - teams3 = teams3[1:] - bulenum = 3 - left -= 3 - } else if bulenum <= 1 && len(teams2) > 0 { - bule = append(bule, teams2[0]) - teams2 = teams2[1:] - bulenum = 2 - left -= 2 - } else if bulenum <= 2 && len(teams1) > 0 { - bule = append(bule, teams1[0]) - teams1 = teams1[1:] - bulenum = 1 - left -= 1 - } - //找红队 - if rednum <= 0 && len(teams3) > 0 { - red = append(red, teams3[0]) - teams3 = teams3[1:] - rednum = 3 - left -= 3 - } else if rednum <= 1 && len(teams2) > 0 { - red = append(red, teams2[0]) - teams2 = teams2[1:] - rednum = 2 - left -= 2 - } else if rednum <= 2 && len(teams1) > 0 { - red = append(red, teams1[0]) - teams1 = teams1[1:] - rednum = 1 - left -= 1 - } +// //找蓝队 +// if bulenum <= 0 && len(teams3) > 0 { +// bule = append(bule, teams3[0]) +// teams3 = teams3[1:] +// bulenum = 3 +// left -= 3 +// } else if bulenum <= 1 && len(teams2) > 0 { +// bule = append(bule, teams2[0]) +// teams2 = teams2[1:] +// bulenum = 2 +// left -= 2 +// } else if bulenum <= 2 && len(teams1) > 0 { +// bule = append(bule, teams1[0]) +// teams1 = teams1[1:] +// bulenum = 1 +// left -= 1 +// } +// } else { +// //找蓝队 +// if bulenum <= 0 && len(teams3) > 0 { +// bule = append(bule, teams3[0]) +// teams3 = teams3[1:] +// bulenum = 3 +// left -= 3 +// } else if bulenum <= 1 && len(teams2) > 0 { +// bule = append(bule, teams2[0]) +// teams2 = teams2[1:] +// bulenum = 2 +// left -= 2 +// } else if bulenum <= 2 && len(teams1) > 0 { +// bule = append(bule, teams1[0]) +// teams1 = teams1[1:] +// bulenum = 1 +// left -= 1 +// } +// //找红队 +// if rednum <= 0 && len(teams3) > 0 { +// red = append(red, teams3[0]) +// teams3 = teams3[1:] +// rednum = 3 +// left -= 3 +// } else if rednum <= 1 && len(teams2) > 0 { +// red = append(red, teams2[0]) +// teams2 = teams2[1:] +// rednum = 2 +// left -= 2 +// } else if rednum <= 2 && len(teams1) > 0 { +// red = append(red, teams1[0]) +// teams1 = teams1[1:] +// rednum = 1 +// left -= 1 +// } - } - order = !order - } - fn() - if (rednum < 3 || bulenum < 3) && left > 0 { - _lt := left - fn() - if left < _lt { - fn() //做多执行三次即可 - } - } - this.tlock.RLock() - for _, v := range red { - reduser = append(reduser, this.teams[v].member...) - for _, ai := range this.teams[v].ais { - aismap[ai.Name] = ai - } - } - for _, v := range bule { - buleuser = append(buleuser, this.teams[v].member...) - for _, ai := range this.teams[v].ais { - aismap[ai.Name] = ai - } - } - for _, v := range aismap { - ais = append(ais, v) - } - this.tlock.RUnlock() +// } +// order = !order +// } +// fn() +// if (rednum < 3 || bulenum < 3) && left > 0 { +// _lt := left +// fn() +// if left < _lt { +// fn() //做多执行三次即可 +// } +// } +// this.tlock.RLock() +// for _, v := range red { +// reduser = append(reduser, this.teams[v].member...) +// for _, ai := range this.teams[v].ais { +// aismap[ai.Name] = ai +// } +// } +// for _, v := range bule { +// buleuser = append(buleuser, this.teams[v].member...) +// for _, ai := range this.teams[v].ais { +// aismap[ai.Name] = ai +// } +// } +// for _, v := range aismap { +// ais = append(ais, v) +// } +// this.tlock.RUnlock() - // if len(users)+rednum+bulenum < 6 { - // return - // } - n := len(reduser) - //补充人员 - if len(reduser) < 3 { - if len(users) > 3-n { - reduser = append(reduser, users[0:(3-n)]...) - users = users[(3 - n):] - } else { - reduser = append(reduser, ais[0:(3-n)]...) - ais = ais[(3 - n):] - } +// // if len(users)+rednum+bulenum < 6 { +// // return +// // } +// n := len(reduser) +// //补充人员 +// if len(reduser) < 3 { +// if len(users) > 3-n { +// reduser = append(reduser, users[0:(3-n)]...) +// users = users[(3 - n):] +// } else { +// reduser = append(reduser, ais[0:(3-n)]...) +// ais = ais[(3 - n):] +// } - } - n = len(buleuser) - if len(buleuser) < 3 { - if len(users) > 3-n { - buleuser = append(buleuser, users[0:(3-n)]...) - users = users[(3 - n):] - } else { - buleuser = append(buleuser, ais[0:(3-n)]...) - ais = ais[(3 - n):] - } - } +// } +// n = len(buleuser) +// if len(buleuser) < 3 { +// if len(users) > 3-n { +// buleuser = append(buleuser, users[0:(3-n)]...) +// users = users[(3 - n):] +// } else { +// buleuser = append(buleuser, ais[0:(3-n)]...) +// ais = ais[(3 - n):] +// } +// } - if err = this.service.RpcCall(context.Background(), - comm.Service_Worker, - string(comm.RPC_ParkourMatchSucc), - &pb.RPCParkourMatchSuccReq{Red: reduser, Bule: buleuser}, - &pb.RPCParkourMatchSuccResp{}, - ); err != nil { - this.module.Errorln(err) - return - } - this.tlock.Lock() - for _, v := range red { - delete(this.teams, v) - } - for _, v := range bule { - delete(this.teams, v) - } - this.total -= int32(rednum) - this.total -= int32(bulenum) - this.tlock.Unlock() -} +// if err = this.service.RpcCall(context.Background(), +// comm.Service_Worker, +// string(comm.RPC_ParkourMatchSucc), +// &pb.RPCParkourMatchSuccReq{Red: reduser, Bule: buleuser}, +// &pb.RPCParkourMatchSuccResp{}, +// ); err != nil { +// this.module.Errorln(err) +// return +// } +// this.tlock.Lock() +// for _, v := range red { +// delete(this.teams, v) +// } +// for _, v := range bule { +// delete(this.teams, v) +// } +// this.total -= int32(rednum) +// this.total -= int32(bulenum) +// this.tlock.Unlock() +// } -// 从远程库查询用户 -func (this *ParkourComp) getuser(uid string) (user *pb.DBUser, err error) { - var ( - model *db.DBModel - ) - if model, err = this.module.getDBModelByUid(uid, comm.TableUser); err != nil { - return - } - user = &pb.DBUser{} - if err = model.Get(uid, user); err != nil { - this.module.Errorln(err) - } - return -} +// // 从远程库查询用户 +// func (this *ParkourComp) getuser(uid string) (user *pb.DBUser, err error) { +// var ( +// model *db.DBModel +// ) +// if model, err = this.module.getDBModelByUid(uid, comm.TableUser); err != nil { +// return +// } +// user = &pb.DBUser{} +// if err = model.Get(uid, user); err != nil { +// this.module.Errorln(err) +// } +// return +// } diff --git a/pb/dcolor_db.pb.go b/pb/dcolor_db.pb.go index 8b4f52bbd..c5c21f167 100644 --- a/pb/dcolor_db.pb.go +++ b/pb/dcolor_db.pb.go @@ -465,11 +465,13 @@ type DBDColorRoom struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Rid string `protobuf:"bytes,1,opt,name=rid,proto3" json:"rid"` - Results []int32 `protobuf:"varint,2,rep,packed,name=results,proto3" json:"results"` - Red *DBDColorRoomPlayer `protobuf:"bytes,3,opt,name=red,proto3" json:"red"` - Blue *DBDColorRoomPlayer `protobuf:"bytes,4,opt,name=blue,proto3" json:"blue"` - Handles []*DBDColorResult `protobuf:"bytes,5,rep,name=handles,proto3" json:"handles"` + Rid string `protobuf:"bytes,1,opt,name=rid,proto3" json:"rid"` + Difficulty DBDColorDifficulty `protobuf:"varint,2,opt,name=difficulty,proto3,enum=DBDColorDifficulty" json:"difficulty"` + Repeat bool `protobuf:"varint,3,opt,name=Repeat,proto3" json:"Repeat"` + Results []int32 `protobuf:"varint,4,rep,packed,name=results,proto3" json:"results"` + Red *DBDColorRoomPlayer `protobuf:"bytes,5,opt,name=red,proto3" json:"red"` + Blue *DBDColorRoomPlayer `protobuf:"bytes,6,opt,name=blue,proto3" json:"blue"` + Handles []*DBDColorResult `protobuf:"bytes,7,rep,name=handles,proto3" json:"handles"` } func (x *DBDColorRoom) Reset() { @@ -511,6 +513,20 @@ func (x *DBDColorRoom) GetRid() string { return "" } +func (x *DBDColorRoom) GetDifficulty() DBDColorDifficulty { + if x != nil { + return x.Difficulty + } + return DBDColorDifficulty_Simple +} + +func (x *DBDColorRoom) GetRepeat() bool { + if x != nil { + return x.Repeat + } + return false +} + func (x *DBDColorRoom) GetResults() []int32 { if x != nil { return x.Results @@ -589,23 +605,28 @@ var file_dcolor_dcolor_db_proto_rawDesc = []byte{ 0x75, 0x6c, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x6c, 0x6c, 0x72, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x61, 0x6c, 0x6c, 0x72, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x61, 0x6c, 0x66, 0x70, 0x61, 0x69, 0x72, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x08, 0x68, 0x61, 0x6c, 0x66, 0x70, 0x61, 0x69, 0x72, 0x22, 0xb5, 0x01, 0x0a, + 0x28, 0x05, 0x52, 0x08, 0x68, 0x61, 0x6c, 0x66, 0x70, 0x61, 0x69, 0x72, 0x22, 0x82, 0x02, 0x0a, 0x0c, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x69, 0x64, 0x12, - 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, - 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x03, 0x72, 0x65, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, 0x6f, - 0x72, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x03, 0x72, 0x65, 0x64, - 0x12, 0x27, 0x0a, 0x04, 0x62, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x52, 0x04, 0x62, 0x6c, 0x75, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x68, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x44, - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x68, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x73, 0x2a, 0x3a, 0x0a, 0x12, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, - 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x69, - 0x6d, 0x70, 0x6c, 0x65, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, - 0x75, 0x6c, 0x74, 0x79, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x65, 0x6c, 0x6c, 0x10, 0x02, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x33, 0x0a, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x44, 0x69, + 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x52, 0x0a, 0x64, 0x69, 0x66, 0x66, 0x69, 0x63, + 0x75, 0x6c, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x12, 0x18, 0x0a, 0x07, + 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x25, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x6f, + 0x6f, 0x6d, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x03, 0x72, 0x65, 0x64, 0x12, 0x27, 0x0a, + 0x04, 0x62, 0x6c, 0x75, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x44, 0x42, + 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x6f, 0x6f, 0x6d, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x52, 0x04, 0x62, 0x6c, 0x75, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, + 0x6f, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, + 0x73, 0x2a, 0x3a, 0x0a, 0x12, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x44, 0x69, 0x66, + 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x69, 0x6d, 0x70, 0x6c, + 0x65, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x69, 0x66, 0x66, 0x69, 0x63, 0x75, 0x6c, 0x74, + 0x79, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x65, 0x6c, 0x6c, 0x10, 0x02, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -636,14 +657,15 @@ var file_dcolor_dcolor_db_proto_depIdxs = []int32{ 2, // 0: DBDColorQiecuoRecord.targets:type_name -> DBDColorQiecuoInvite 0, // 1: DBDColorQiecuoRecord.difficulty:type_name -> DBDColorDifficulty 7, // 2: DBDColorRoomPlayer.info:type_name -> BaseUserInfo - 4, // 3: DBDColorRoom.red:type_name -> DBDColorRoomPlayer - 4, // 4: DBDColorRoom.blue:type_name -> DBDColorRoomPlayer - 5, // 5: DBDColorRoom.handles:type_name -> DBDColorResult - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 0, // 3: DBDColorRoom.difficulty:type_name -> DBDColorDifficulty + 4, // 4: DBDColorRoom.red:type_name -> DBDColorRoomPlayer + 4, // 5: DBDColorRoom.blue:type_name -> DBDColorRoomPlayer + 5, // 6: DBDColorRoom.handles:type_name -> DBDColorResult + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_dcolor_dcolor_db_proto_init() } diff --git a/pb/dcolor_msg.pb.go b/pb/dcolor_msg.pb.go index 175574f80..14a4ebe7c 100644 --- a/pb/dcolor_msg.pb.go +++ b/pb/dcolor_msg.pb.go @@ -948,8 +948,9 @@ type DColorHandleReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Index int32 `protobuf:"varint,1,opt,name=index,proto3" json:"index"` - Results []int32 `protobuf:"varint,2,rep,packed,name=results,proto3" json:"results"` + Roomid string `protobuf:"bytes,1,opt,name=roomid,proto3" json:"roomid"` //战斗id + Index int32 `protobuf:"varint,2,opt,name=index,proto3" json:"index"` + Results []int32 `protobuf:"varint,3,rep,packed,name=results,proto3" json:"results"` } func (x *DColorHandleReq) Reset() { @@ -984,6 +985,13 @@ func (*DColorHandleReq) Descriptor() ([]byte, []int) { return file_dcolor_dcolor_msg_proto_rawDescGZIP(), []int{17} } +func (x *DColorHandleReq) GetRoomid() string { + if x != nil { + return x.Roomid + } + return "" +} + func (x *DColorHandleReq) GetIndex() int32 { if x != nil { return x.Index @@ -1043,8 +1051,9 @@ type DColorGameHandlePush struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` - Handle *DBDColorResult `protobuf:"bytes,2,opt,name=handle,proto3" json:"handle"` + Roomid string `protobuf:"bytes,1,opt,name=roomid,proto3" json:"roomid"` //战斗id + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` + Handle *DBDColorResult `protobuf:"bytes,3,opt,name=handle,proto3" json:"handle"` } func (x *DColorGameHandlePush) Reset() { @@ -1079,6 +1088,13 @@ func (*DColorGameHandlePush) Descriptor() ([]byte, []int) { return file_dcolor_dcolor_msg_proto_rawDescGZIP(), []int{19} } +func (x *DColorGameHandlePush) GetRoomid() string { + if x != nil { + return x.Roomid + } + return "" +} + func (x *DColorGameHandlePush) GetUid() string { if x != nil { return x.Uid @@ -1243,16 +1259,19 @@ var file_dcolor_dcolor_msg_proto_rawDesc = []byte{ 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x50, 0x75, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x04, 0x73, 0x69, 0x64, 0x65, 0x22, 0x41, 0x0a, 0x0f, 0x44, 0x43, 0x6f, 0x6c, - 0x6f, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x22, 0x12, 0x0a, 0x10, 0x44, - 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, - 0x51, 0x0a, 0x14, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, + 0x28, 0x05, 0x52, 0x04, 0x73, 0x69, 0x64, 0x65, 0x22, 0x59, 0x0a, 0x0f, 0x44, 0x43, 0x6f, 0x6c, + 0x6f, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x72, + 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x6f, 0x6f, + 0x6d, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, + 0x6c, 0x74, 0x73, 0x22, 0x12, 0x0a, 0x10, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x48, 0x61, 0x6e, + 0x64, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x69, 0x0a, 0x14, 0x44, 0x43, 0x6f, 0x6c, 0x6f, + 0x72, 0x47, 0x61, 0x6d, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, + 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x27, 0x0a, 0x06, 0x68, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x44, 0x43, + 0x64, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x44, 0x42, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x22, 0x74, 0x0a, 0x12, 0x44, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x69, 0x6e, 0x73, diff --git a/pb/matchpool_db.pb.go b/pb/matchpool_db.pb.go new file mode 100644 index 000000000..890f5311d --- /dev/null +++ b/pb/matchpool_db.pb.go @@ -0,0 +1,61 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: matchpool/matchpool_db.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" +) + +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) +) + +var File_matchpool_matchpool_db_proto protoreflect.FileDescriptor + +var file_matchpool_matchpool_db_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var file_matchpool_matchpool_db_proto_goTypes = []interface{}{} +var file_matchpool_matchpool_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_matchpool_matchpool_db_proto_init() } +func file_matchpool_matchpool_db_proto_init() { + if File_matchpool_matchpool_db_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_matchpool_matchpool_db_proto_rawDesc, + NumEnums: 0, + NumMessages: 0, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_matchpool_matchpool_db_proto_goTypes, + DependencyIndexes: file_matchpool_matchpool_db_proto_depIdxs, + }.Build() + File_matchpool_matchpool_db_proto = out.File + file_matchpool_matchpool_db_proto_rawDesc = nil + file_matchpool_matchpool_db_proto_goTypes = nil + file_matchpool_matchpool_db_proto_depIdxs = nil +} diff --git a/pb/matchpool_msg.pb.go b/pb/matchpool_msg.pb.go new file mode 100644 index 000000000..0227e648d --- /dev/null +++ b/pb/matchpool_msg.pb.go @@ -0,0 +1,520 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: matchpool/matchpool_msg.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + 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 JoinMatchPoolReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Poolname string `protobuf:"bytes,1,opt,name=poolname,proto3" json:"poolname"` + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` + Dan int32 `protobuf:"varint,3,opt,name=dan,proto3" json:"dan"` //段位 + Data *anypb.Any `protobuf:"bytes,4,opt,name=data,proto3" json:"data"` + Matchnum int32 `protobuf:"varint,5,opt,name=matchnum,proto3" json:"matchnum"` //匹配人数 + Timeout int32 `protobuf:"varint,6,opt,name=timeout,proto3" json:"timeout"` //秒级单位 +} + +func (x *JoinMatchPoolReq) Reset() { + *x = JoinMatchPoolReq{} + if protoimpl.UnsafeEnabled { + mi := &file_matchpool_matchpool_msg_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinMatchPoolReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinMatchPoolReq) ProtoMessage() {} + +func (x *JoinMatchPoolReq) ProtoReflect() protoreflect.Message { + mi := &file_matchpool_matchpool_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 JoinMatchPoolReq.ProtoReflect.Descriptor instead. +func (*JoinMatchPoolReq) Descriptor() ([]byte, []int) { + return file_matchpool_matchpool_msg_proto_rawDescGZIP(), []int{0} +} + +func (x *JoinMatchPoolReq) GetPoolname() string { + if x != nil { + return x.Poolname + } + return "" +} + +func (x *JoinMatchPoolReq) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *JoinMatchPoolReq) GetDan() int32 { + if x != nil { + return x.Dan + } + return 0 +} + +func (x *JoinMatchPoolReq) GetData() *anypb.Any { + if x != nil { + return x.Data + } + return nil +} + +func (x *JoinMatchPoolReq) GetMatchnum() int32 { + if x != nil { + return x.Matchnum + } + return 0 +} + +func (x *JoinMatchPoolReq) GetTimeout() int32 { + if x != nil { + return x.Timeout + } + return 0 +} + +type JoinMatchPoolResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *JoinMatchPoolResp) Reset() { + *x = JoinMatchPoolResp{} + if protoimpl.UnsafeEnabled { + mi := &file_matchpool_matchpool_msg_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *JoinMatchPoolResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinMatchPoolResp) ProtoMessage() {} + +func (x *JoinMatchPoolResp) ProtoReflect() protoreflect.Message { + mi := &file_matchpool_matchpool_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 JoinMatchPoolResp.ProtoReflect.Descriptor instead. +func (*JoinMatchPoolResp) Descriptor() ([]byte, []int) { + return file_matchpool_matchpool_msg_proto_rawDescGZIP(), []int{1} +} + +//取消匹配请求 +type CancelMatchReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Poolname string `protobuf:"bytes,1,opt,name=poolname,proto3" json:"poolname"` + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` +} + +func (x *CancelMatchReq) Reset() { + *x = CancelMatchReq{} + if protoimpl.UnsafeEnabled { + mi := &file_matchpool_matchpool_msg_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CancelMatchReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CancelMatchReq) ProtoMessage() {} + +func (x *CancelMatchReq) ProtoReflect() protoreflect.Message { + mi := &file_matchpool_matchpool_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 CancelMatchReq.ProtoReflect.Descriptor instead. +func (*CancelMatchReq) Descriptor() ([]byte, []int) { + return file_matchpool_matchpool_msg_proto_rawDescGZIP(), []int{2} +} + +func (x *CancelMatchReq) GetPoolname() string { + if x != nil { + return x.Poolname + } + return "" +} + +func (x *CancelMatchReq) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +type CancelMatchResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *CancelMatchResp) Reset() { + *x = CancelMatchResp{} + if protoimpl.UnsafeEnabled { + mi := &file_matchpool_matchpool_msg_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CancelMatchResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CancelMatchResp) ProtoMessage() {} + +func (x *CancelMatchResp) ProtoReflect() protoreflect.Message { + mi := &file_matchpool_matchpool_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 CancelMatchResp.ProtoReflect.Descriptor instead. +func (*CancelMatchResp) Descriptor() ([]byte, []int) { + return file_matchpool_matchpool_msg_proto_rawDescGZIP(), []int{3} +} + +//成功匹配通知请求 +type SuccMatchNoticeReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Poolname string `protobuf:"bytes,1,opt,name=poolname,proto3" json:"poolname"` //匹配池 + Players map[string]*anypb.Any `protobuf:"bytes,2,rep,name=players,proto3" json:"players" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` //匹配玩家 + Missnum int32 `protobuf:"varint,3,opt,name=missnum,proto3" json:"missnum"` //缺失人数 +} + +func (x *SuccMatchNoticeReq) Reset() { + *x = SuccMatchNoticeReq{} + if protoimpl.UnsafeEnabled { + mi := &file_matchpool_matchpool_msg_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SuccMatchNoticeReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SuccMatchNoticeReq) ProtoMessage() {} + +func (x *SuccMatchNoticeReq) ProtoReflect() protoreflect.Message { + mi := &file_matchpool_matchpool_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 SuccMatchNoticeReq.ProtoReflect.Descriptor instead. +func (*SuccMatchNoticeReq) Descriptor() ([]byte, []int) { + return file_matchpool_matchpool_msg_proto_rawDescGZIP(), []int{4} +} + +func (x *SuccMatchNoticeReq) GetPoolname() string { + if x != nil { + return x.Poolname + } + return "" +} + +func (x *SuccMatchNoticeReq) GetPlayers() map[string]*anypb.Any { + if x != nil { + return x.Players + } + return nil +} + +func (x *SuccMatchNoticeReq) GetMissnum() int32 { + if x != nil { + return x.Missnum + } + return 0 +} + +type SuccMatchNoticeResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SuccMatchNoticeResp) Reset() { + *x = SuccMatchNoticeResp{} + if protoimpl.UnsafeEnabled { + mi := &file_matchpool_matchpool_msg_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SuccMatchNoticeResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SuccMatchNoticeResp) ProtoMessage() {} + +func (x *SuccMatchNoticeResp) ProtoReflect() protoreflect.Message { + mi := &file_matchpool_matchpool_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 SuccMatchNoticeResp.ProtoReflect.Descriptor instead. +func (*SuccMatchNoticeResp) Descriptor() ([]byte, []int) { + return file_matchpool_matchpool_msg_proto_rawDescGZIP(), []int{5} +} + +var File_matchpool_matchpool_msg_proto protoreflect.FileDescriptor + +var file_matchpool_matchpool_msg_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x70, 0x6f, 0x6f, 0x6c, 0x2f, 0x6d, 0x61, 0x74, 0x63, + 0x68, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb2, 0x01, 0x0a, 0x10, 0x4a, + 0x6f, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x71, 0x12, + 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, + 0x03, 0x64, 0x61, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, + 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x41, 0x6e, 0x79, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x74, + 0x63, 0x68, 0x6e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x74, + 0x63, 0x68, 0x6e, 0x75, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, + 0x13, 0x0a, 0x11, 0x4a, 0x6f, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x6f, 0x6f, 0x6c, + 0x52, 0x65, 0x73, 0x70, 0x22, 0x3e, 0x0a, 0x0e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x75, 0x69, 0x64, 0x22, 0x11, 0x0a, 0x0f, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4d, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x22, 0xd8, 0x01, 0x0a, 0x12, 0x53, 0x75, 0x63, 0x63, + 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1a, + 0x0a, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x70, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x53, 0x75, + 0x63, 0x63, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, + 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x70, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x73, 0x73, 0x6e, 0x75, + 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x69, 0x73, 0x73, 0x6e, 0x75, 0x6d, + 0x1a, 0x50, 0x0a, 0x0c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, + 0x38, 0x01, 0x22, 0x15, 0x0a, 0x13, 0x53, 0x75, 0x63, 0x63, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4e, + 0x6f, 0x74, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_matchpool_matchpool_msg_proto_rawDescOnce sync.Once + file_matchpool_matchpool_msg_proto_rawDescData = file_matchpool_matchpool_msg_proto_rawDesc +) + +func file_matchpool_matchpool_msg_proto_rawDescGZIP() []byte { + file_matchpool_matchpool_msg_proto_rawDescOnce.Do(func() { + file_matchpool_matchpool_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_matchpool_matchpool_msg_proto_rawDescData) + }) + return file_matchpool_matchpool_msg_proto_rawDescData +} + +var file_matchpool_matchpool_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_matchpool_matchpool_msg_proto_goTypes = []interface{}{ + (*JoinMatchPoolReq)(nil), // 0: JoinMatchPoolReq + (*JoinMatchPoolResp)(nil), // 1: JoinMatchPoolResp + (*CancelMatchReq)(nil), // 2: CancelMatchReq + (*CancelMatchResp)(nil), // 3: CancelMatchResp + (*SuccMatchNoticeReq)(nil), // 4: SuccMatchNoticeReq + (*SuccMatchNoticeResp)(nil), // 5: SuccMatchNoticeResp + nil, // 6: SuccMatchNoticeReq.PlayersEntry + (*anypb.Any)(nil), // 7: google.protobuf.Any +} +var file_matchpool_matchpool_msg_proto_depIdxs = []int32{ + 7, // 0: JoinMatchPoolReq.data:type_name -> google.protobuf.Any + 6, // 1: SuccMatchNoticeReq.players:type_name -> SuccMatchNoticeReq.PlayersEntry + 7, // 2: SuccMatchNoticeReq.PlayersEntry.value:type_name -> google.protobuf.Any + 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_matchpool_matchpool_msg_proto_init() } +func file_matchpool_matchpool_msg_proto_init() { + if File_matchpool_matchpool_msg_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_matchpool_matchpool_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinMatchPoolReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_matchpool_matchpool_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*JoinMatchPoolResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_matchpool_matchpool_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CancelMatchReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_matchpool_matchpool_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CancelMatchResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_matchpool_matchpool_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SuccMatchNoticeReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_matchpool_matchpool_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SuccMatchNoticeResp); 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_matchpool_matchpool_msg_proto_rawDesc, + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_matchpool_matchpool_msg_proto_goTypes, + DependencyIndexes: file_matchpool_matchpool_msg_proto_depIdxs, + MessageInfos: file_matchpool_matchpool_msg_proto_msgTypes, + }.Build() + File_matchpool_matchpool_msg_proto = out.File + file_matchpool_matchpool_msg_proto_rawDesc = nil + file_matchpool_matchpool_msg_proto_goTypes = nil + file_matchpool_matchpool_msg_proto_depIdxs = nil +} diff --git a/pb/parkour_db.pb.go b/pb/parkour_db.pb.go index edf341e80..8a71f445d 100644 --- a/pb/parkour_db.pb.go +++ b/pb/parkour_db.pb.go @@ -125,23 +125,19 @@ type DBRaceMember struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //用户id - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` //用户名称 - Skin string `protobuf:"bytes,3,opt,name=skin,proto3" json:"skin"` //皮肤 - Sex int32 `protobuf:"varint,4,opt,name=sex,proto3" json:"sex"` //性别 - Dan int32 `protobuf:"varint,5,opt,name=dan,proto3" json:"dan"` //段位 - Lv int32 `protobuf:"varint,6,opt,name=lv,proto3" json:"lv"` //等级 - Mlv int32 `protobuf:"varint,7,opt,name=mlv,proto3" json:"mlv"` //坐骑等级 - Mount string `protobuf:"bytes,8,opt,name=mount,proto3" json:"mount"` //上阵坐骑 - Property map[string]int32 `protobuf:"bytes,9,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //坐骑属性 - Currhp int32 `protobuf:"varint,10,opt,name=currhp,proto3" json:"currhp"` //当前血量 - Ready bool `protobuf:"varint,12,opt,name=ready,proto3" json:"ready"` //是否准备 - Isai bool `protobuf:"varint,13,opt,name=isai,proto3" json:"isai"` //是否是ai - Isoff bool `protobuf:"varint,14,opt,name=isoff,proto3" json:"isoff"` //是否离线 - Scores int32 `protobuf:"varint,15,opt,name=scores,proto3" json:"scores"` //当前分数 - Energy int32 `protobuf:"varint,16,opt,name=energy,proto3" json:"energy"` //当前能量 - Dodge int32 `protobuf:"varint,17,opt,name=dodge,proto3" json:"dodge"` //闪避次数 - Shot int32 `protobuf:"varint,18,opt,name=shot,proto3" json:"shot"` //射门次数 + User *BaseUserInfo `protobuf:"bytes,1,opt,name=user,proto3" json:"user"` //发起者信息 + Dan int32 `protobuf:"varint,2,opt,name=dan,proto3" json:"dan"` //段位 + Mlv int32 `protobuf:"varint,3,opt,name=mlv,proto3" json:"mlv"` //坐骑等级 + Mount string `protobuf:"bytes,4,opt,name=mount,proto3" json:"mount"` //上阵坐骑 + Property map[string]int32 `protobuf:"bytes,5,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //坐骑属性 + Currhp int32 `protobuf:"varint,6,opt,name=currhp,proto3" json:"currhp"` //当前血量 + Ready bool `protobuf:"varint,7,opt,name=ready,proto3" json:"ready"` //是否准备 + Isai bool `protobuf:"varint,8,opt,name=isai,proto3" json:"isai"` //是否是ai + Isoff bool `protobuf:"varint,9,opt,name=isoff,proto3" json:"isoff"` //是否离线 + Scores int32 `protobuf:"varint,10,opt,name=scores,proto3" json:"scores"` //当前分数 + Energy int32 `protobuf:"varint,11,opt,name=energy,proto3" json:"energy"` //当前能量 + Dodge int32 `protobuf:"varint,12,opt,name=dodge,proto3" json:"dodge"` //闪避次数 + Shot int32 `protobuf:"varint,13,opt,name=shot,proto3" json:"shot"` //射门次数 } func (x *DBRaceMember) Reset() { @@ -176,32 +172,11 @@ func (*DBRaceMember) Descriptor() ([]byte, []int) { return file_parkour_parkour_db_proto_rawDescGZIP(), []int{0} } -func (x *DBRaceMember) GetUid() string { +func (x *DBRaceMember) GetUser() *BaseUserInfo { if x != nil { - return x.Uid + return x.User } - return "" -} - -func (x *DBRaceMember) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *DBRaceMember) GetSkin() string { - if x != nil { - return x.Skin - } - return "" -} - -func (x *DBRaceMember) GetSex() int32 { - if x != nil { - return x.Sex - } - return 0 + return nil } func (x *DBRaceMember) GetDan() int32 { @@ -211,13 +186,6 @@ func (x *DBRaceMember) GetDan() int32 { return 0 } -func (x *DBRaceMember) GetLv() int32 { - if x != nil { - return x.Lv - } - return 0 -} - func (x *DBRaceMember) GetMlv() int32 { if x != nil { return x.Mlv @@ -380,26 +348,22 @@ type DBParkour struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // 队伍id - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户id - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` //名字 - Lv int32 `protobuf:"varint,4,opt,name=lv,proto3" json:"lv"` //等级 - Sex int32 `protobuf:"varint,5,opt,name=sex,proto3" json:"sex"` //性别 - Skin string `protobuf:"bytes,6,opt,name=skin,proto3" json:"skin"` //时装 - Dan int32 `protobuf:"varint,7,opt,name=dan,proto3" json:"dan"` //段位 - Defmts string `protobuf:"bytes,8,opt,name=defmts,proto3" json:"defmts"` //默认坐骑 - Mlv int32 `protobuf:"varint,9,opt,name=mlv,proto3" json:"mlv"` //坐骑等级 - Mount string `protobuf:"bytes,10,opt,name=mount,proto3" json:"mount"` //上阵坐骑 - Property map[string]int32 `protobuf:"bytes,11,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //坐骑属性 - State RaceTeamState `protobuf:"varint,12,opt,name=state,proto3,enum=RaceTeamState" json:"state"` //队伍状态 - Currbattid string `protobuf:"bytes,13,opt,name=currbattid,proto3" json:"currbattid"` //当前战斗id - Integral int32 `protobuf:"varint,14,opt,name=integral,proto3" json:"integral"` //积分 - Captainid string `protobuf:"bytes,15,opt,name=captainid,proto3" json:"captainid"` //队长id 当前所在队伍 - Invite []*DBRaceInvite `protobuf:"bytes,16,rep,name=invite,proto3" json:"invite"` //邀请列表 - Member []*DBRaceMember `protobuf:"bytes,17,rep,name=member,proto3" json:"member"` //成员列表 - Weektime int64 `protobuf:"varint,18,opt,name=weektime,proto3" json:"weektime"` //周积分重置使用 - Weekreward map[int32]bool `protobuf:"bytes,19,rep,name=weekreward,proto3" json:"weekreward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //周长奖励领取 - Weekintegral int32 `protobuf:"varint,20,opt,name=weekintegral,proto3" json:"weekintegral"` //周积分 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // 比赛唯一id + User *BaseUserInfo `protobuf:"bytes,2,opt,name=user,proto3" json:"user"` //发起者信息 + Dan int32 `protobuf:"varint,3,opt,name=dan,proto3" json:"dan"` //段位 + Defmts string `protobuf:"bytes,4,opt,name=defmts,proto3" json:"defmts"` //默认坐骑 + Mlv int32 `protobuf:"varint,5,opt,name=mlv,proto3" json:"mlv"` //坐骑等级 + Mount string `protobuf:"bytes,6,opt,name=mount,proto3" json:"mount"` //上阵坐骑 + Property map[string]int32 `protobuf:"bytes,7,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //坐骑属性 + State RaceTeamState `protobuf:"varint,8,opt,name=state,proto3,enum=RaceTeamState" json:"state"` //队伍状态 + Currbattid string `protobuf:"bytes,9,opt,name=currbattid,proto3" json:"currbattid"` //当前战斗id + Integral int32 `protobuf:"varint,10,opt,name=integral,proto3" json:"integral"` //积分 + Captainid string `protobuf:"bytes,11,opt,name=captainid,proto3" json:"captainid"` //队长id 当前所在队伍 + Invite []*DBRaceInvite `protobuf:"bytes,12,rep,name=invite,proto3" json:"invite"` //邀请列表 + Member []*DBRaceMember `protobuf:"bytes,13,rep,name=member,proto3" json:"member"` //成员列表 + Weektime int64 `protobuf:"varint,14,opt,name=weektime,proto3" json:"weektime"` //周积分重置使用 + Weekreward map[int32]bool `protobuf:"bytes,15,rep,name=weekreward,proto3" json:"weekreward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //周长奖励领取 + Weekintegral int32 `protobuf:"varint,16,opt,name=weekintegral,proto3" json:"weekintegral"` //周积分 } func (x *DBParkour) Reset() { @@ -441,39 +405,11 @@ func (x *DBParkour) GetId() string { return "" } -func (x *DBParkour) GetUid() string { +func (x *DBParkour) GetUser() *BaseUserInfo { if x != nil { - return x.Uid + return x.User } - return "" -} - -func (x *DBParkour) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *DBParkour) GetLv() int32 { - if x != nil { - return x.Lv - } - return 0 -} - -func (x *DBParkour) GetSex() int32 { - if x != nil { - return x.Sex - } - return 0 -} - -func (x *DBParkour) GetSkin() string { - if x != nil { - return x.Skin - } - return "" + return nil } func (x *DBParkour) GetDan() int32 { @@ -686,119 +622,207 @@ func (x *DBRace) GetBulescores() int32 { return 0 } +//撇配用户数据 +type DBMatchPlayer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Suser *BaseUserInfo `protobuf:"bytes,1,opt,name=suser,proto3" json:"suser"` //发起者信息 + Dan int32 `protobuf:"varint,2,opt,name=dan,proto3" json:"dan"` //段位 + Mount string `protobuf:"bytes,3,opt,name=mount,proto3" json:"mount"` //上阵坐骑 + Property map[string]int32 `protobuf:"bytes,4,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //坐骑属性 + Mlv int32 `protobuf:"varint,5,opt,name=mlv,proto3" json:"mlv"` //坐骑等级 +} + +func (x *DBMatchPlayer) Reset() { + *x = DBMatchPlayer{} + if protoimpl.UnsafeEnabled { + mi := &file_parkour_parkour_db_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBMatchPlayer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBMatchPlayer) ProtoMessage() {} + +func (x *DBMatchPlayer) ProtoReflect() protoreflect.Message { + mi := &file_parkour_parkour_db_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 DBMatchPlayer.ProtoReflect.Descriptor instead. +func (*DBMatchPlayer) Descriptor() ([]byte, []int) { + return file_parkour_parkour_db_proto_rawDescGZIP(), []int{4} +} + +func (x *DBMatchPlayer) GetSuser() *BaseUserInfo { + if x != nil { + return x.Suser + } + return nil +} + +func (x *DBMatchPlayer) GetDan() int32 { + if x != nil { + return x.Dan + } + return 0 +} + +func (x *DBMatchPlayer) GetMount() string { + if x != nil { + return x.Mount + } + return "" +} + +func (x *DBMatchPlayer) GetProperty() map[string]int32 { + if x != nil { + return x.Property + } + return nil +} + +func (x *DBMatchPlayer) GetMlv() int32 { + if x != nil { + return x.Mlv + } + return 0 +} + var File_parkour_parkour_db_proto protoreflect.FileDescriptor var file_parkour_parkour_db_proto_rawDesc = []byte{ 0x0a, 0x18, 0x70, 0x61, 0x72, 0x6b, 0x6f, 0x75, 0x72, 0x2f, 0x70, 0x61, 0x72, 0x6b, 0x6f, 0x75, - 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcc, 0x03, 0x0a, 0x0c, 0x44, - 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6b, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x73, 0x6b, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x6c, 0x76, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6d, 0x6c, 0x76, 0x12, 0x14, 0x0a, 0x05, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x37, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x09, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, - 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x75, - 0x72, 0x72, 0x68, 0x70, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, 0x75, 0x72, 0x72, - 0x68, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x61, 0x69, - 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x61, 0x69, 0x12, 0x14, 0x0a, 0x05, - 0x69, 0x73, 0x6f, 0x66, 0x66, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x6f, - 0x66, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, - 0x65, 0x72, 0x67, 0x79, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, - 0x67, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x64, 0x67, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x64, 0x6f, 0x64, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x68, 0x6f, 0x74, - 0x18, 0x12, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x68, 0x6f, 0x74, 0x1a, 0x3b, 0x0a, 0x0d, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x76, 0x0a, 0x0c, 0x44, 0x42, 0x52, - 0x61, 0x63, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, - 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, - 0x64, 0x22, 0xc5, 0x05, 0x0a, 0x09, 0x44, 0x42, 0x50, 0x61, 0x72, 0x6b, 0x6f, 0x75, 0x72, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, - 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x6b, 0x69, 0x6e, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x6b, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x64, - 0x61, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x64, 0x65, 0x66, 0x6d, 0x74, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, - 0x65, 0x66, 0x6d, 0x74, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x6c, 0x76, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x03, 0x6d, 0x6c, 0x76, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, 0x0a, - 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x72, 0x6b, 0x6f, 0x75, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x75, 0x72, - 0x72, 0x62, 0x61, 0x74, 0x74, 0x69, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, - 0x75, 0x72, 0x72, 0x62, 0x61, 0x74, 0x74, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, - 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, - 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, - 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69, - 0x6e, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x18, 0x10, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x76, 0x69, - 0x74, 0x65, 0x52, 0x06, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x6d, 0x65, - 0x6d, 0x62, 0x65, 0x72, 0x18, 0x11, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x52, - 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x65, 0x65, 0x6b, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x12, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x77, 0x65, 0x65, 0x6b, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3a, 0x0a, - 0x0a, 0x77, 0x65, 0x65, 0x6b, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x13, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x72, 0x6b, 0x6f, 0x75, 0x72, 0x2e, 0x57, 0x65, - 0x65, 0x6b, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x77, - 0x65, 0x65, 0x6b, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x77, 0x65, 0x65, - 0x6b, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0c, 0x77, 0x65, 0x65, 0x6b, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x1a, 0x3b, 0x0a, - 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x1a, 0x3d, 0x0a, 0x0f, 0x57, 0x65, - 0x65, 0x6b, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xad, 0x02, 0x0a, 0x06, 0x44, 0x42, - 0x52, 0x61, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, - 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, - 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x74, 0x12, - 0x2b, 0x0a, 0x09, 0x72, 0x65, 0x64, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x06, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, - 0x72, 0x52, 0x09, 0x72, 0x65, 0x64, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, - 0x72, 0x65, 0x64, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x09, 0x72, 0x65, 0x64, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x0a, 0x62, 0x75, - 0x6c, 0x65, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x0a, 0x62, - 0x75, 0x6c, 0x65, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x75, 0x6c, - 0x65, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x62, - 0x75, 0x6c, 0x65, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x2a, 0x22, 0x0a, 0x08, 0x52, 0x61, 0x63, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61, 0x72, - 0x79, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x10, 0x01, 0x2a, 0x44, 0x0a, - 0x0d, 0x52, 0x61, 0x63, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, - 0x0a, 0x07, 0x72, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x74, - 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x6d, 0x61, 0x74, 0x63, - 0x68, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x72, 0x61, 0x63, 0x65, 0x69, 0x6e, - 0x67, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x93, 0x03, 0x0a, 0x0c, 0x44, 0x42, 0x52, 0x61, 0x63, + 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x10, 0x0a, 0x03, + 0x6d, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6d, 0x6c, 0x76, 0x12, 0x14, + 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, + 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, + 0x06, 0x63, 0x75, 0x72, 0x72, 0x68, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x63, + 0x75, 0x72, 0x72, 0x68, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x61, 0x64, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x69, + 0x73, 0x61, 0x69, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x61, 0x69, 0x12, + 0x14, 0x0a, 0x05, 0x69, 0x73, 0x6f, 0x66, 0x66, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x69, 0x73, 0x6f, 0x66, 0x66, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x16, 0x0a, + 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x65, + 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x6f, 0x64, 0x67, 0x65, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x64, 0x6f, 0x64, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, + 0x68, 0x6f, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x68, 0x6f, 0x74, 0x1a, + 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x76, 0x0a, 0x0c, + 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, + 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x78, 0x70, + 0x69, 0x72, 0x65, 0x64, 0x22, 0x8c, 0x05, 0x0a, 0x09, 0x44, 0x42, 0x50, 0x61, 0x72, 0x6b, 0x6f, + 0x75, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x21, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x6d, 0x74, + 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x66, 0x6d, 0x74, 0x73, 0x12, + 0x10, 0x0a, 0x03, 0x6d, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6d, 0x6c, + 0x76, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 0x79, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x44, 0x42, 0x50, 0x61, + 0x72, 0x6b, 0x6f, 0x75, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x24, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x52, + 0x61, 0x63, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x75, 0x72, 0x72, 0x62, 0x61, 0x74, 0x74, 0x69, + 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x72, 0x72, 0x62, 0x61, 0x74, + 0x74, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, + 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x64, 0x12, 0x25, 0x0a, + 0x06, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x52, 0x06, 0x69, 0x6e, + 0x76, 0x69, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0d, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x77, + 0x65, 0x65, 0x6b, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x77, + 0x65, 0x65, 0x6b, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x0a, 0x77, 0x65, 0x65, 0x6b, 0x72, + 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x44, 0x42, + 0x50, 0x61, 0x72, 0x6b, 0x6f, 0x75, 0x72, 0x2e, 0x57, 0x65, 0x65, 0x6b, 0x72, 0x65, 0x77, 0x61, + 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x77, 0x65, 0x65, 0x6b, 0x72, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x77, 0x65, 0x65, 0x6b, 0x69, 0x6e, 0x74, 0x65, 0x67, + 0x72, 0x61, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x77, 0x65, 0x65, 0x6b, 0x69, + 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 0x79, 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, 0x1a, 0x3d, 0x0a, 0x0f, 0x57, 0x65, 0x65, 0x6b, 0x72, 0x65, 0x77, 0x61, + 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0xad, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, + 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, + 0x12, 0x1f, 0x0a, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x09, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x72, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, + 0x6e, 0x6e, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, + 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x74, 0x12, 0x2b, 0x0a, 0x09, 0x72, 0x65, 0x64, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, + 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x09, 0x72, 0x65, 0x64, + 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x64, 0x73, 0x63, 0x6f, + 0x72, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x65, 0x64, 0x73, 0x63, + 0x6f, 0x72, 0x65, 0x73, 0x12, 0x2d, 0x0a, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x6d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, + 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x6d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x73, 0x63, 0x6f, 0x72, 0x65, + 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x62, 0x75, 0x6c, 0x65, 0x73, 0x63, 0x6f, + 0x72, 0x65, 0x73, 0x22, 0xe5, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x73, 0x75, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x14, 0x0a, 0x05, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x04, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x50, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x2e, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x03, + 0x6d, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6d, 0x6c, 0x76, 0x1a, 0x3b, + 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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, 0x2a, 0x22, 0x0a, 0x08, 0x52, + 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x69, 0x6e, + 0x61, 0x72, 0x79, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x10, 0x01, 0x2a, + 0x44, 0x0a, 0x0d, 0x52, 0x61, 0x63, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x0b, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x74, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x6d, 0x61, + 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x72, 0x61, 0x63, 0x65, + 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -814,33 +838,40 @@ func file_parkour_parkour_db_proto_rawDescGZIP() []byte { } var file_parkour_parkour_db_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_parkour_parkour_db_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_parkour_parkour_db_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_parkour_parkour_db_proto_goTypes = []interface{}{ - (RaceType)(0), // 0: RaceType - (RaceTeamState)(0), // 1: RaceTeamState - (*DBRaceMember)(nil), // 2: DBRaceMember - (*DBRaceInvite)(nil), // 3: DBRaceInvite - (*DBParkour)(nil), // 4: DBParkour - (*DBRace)(nil), // 5: DBRace - nil, // 6: DBRaceMember.PropertyEntry - nil, // 7: DBParkour.PropertyEntry - nil, // 8: DBParkour.WeekrewardEntry + (RaceType)(0), // 0: RaceType + (RaceTeamState)(0), // 1: RaceTeamState + (*DBRaceMember)(nil), // 2: DBRaceMember + (*DBRaceInvite)(nil), // 3: DBRaceInvite + (*DBParkour)(nil), // 4: DBParkour + (*DBRace)(nil), // 5: DBRace + (*DBMatchPlayer)(nil), // 6: DBMatchPlayer + nil, // 7: DBRaceMember.PropertyEntry + nil, // 8: DBParkour.PropertyEntry + nil, // 9: DBParkour.WeekrewardEntry + nil, // 10: DBMatchPlayer.PropertyEntry + (*BaseUserInfo)(nil), // 11: BaseUserInfo } var file_parkour_parkour_db_proto_depIdxs = []int32{ - 6, // 0: DBRaceMember.property:type_name -> DBRaceMember.PropertyEntry - 7, // 1: DBParkour.property:type_name -> DBParkour.PropertyEntry - 1, // 2: DBParkour.state:type_name -> RaceTeamState - 3, // 3: DBParkour.invite:type_name -> DBRaceInvite - 2, // 4: DBParkour.member:type_name -> DBRaceMember - 8, // 5: DBParkour.weekreward:type_name -> DBParkour.WeekrewardEntry - 0, // 6: DBRace.rtype:type_name -> RaceType - 2, // 7: DBRace.redmember:type_name -> DBRaceMember - 2, // 8: DBRace.bulemember:type_name -> DBRaceMember - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 11, // 0: DBRaceMember.user:type_name -> BaseUserInfo + 7, // 1: DBRaceMember.property:type_name -> DBRaceMember.PropertyEntry + 11, // 2: DBParkour.user:type_name -> BaseUserInfo + 8, // 3: DBParkour.property:type_name -> DBParkour.PropertyEntry + 1, // 4: DBParkour.state:type_name -> RaceTeamState + 3, // 5: DBParkour.invite:type_name -> DBRaceInvite + 2, // 6: DBParkour.member:type_name -> DBRaceMember + 9, // 7: DBParkour.weekreward:type_name -> DBParkour.WeekrewardEntry + 0, // 8: DBRace.rtype:type_name -> RaceType + 2, // 9: DBRace.redmember:type_name -> DBRaceMember + 2, // 10: DBRace.bulemember:type_name -> DBRaceMember + 11, // 11: DBMatchPlayer.suser:type_name -> BaseUserInfo + 10, // 12: DBMatchPlayer.property:type_name -> DBMatchPlayer.PropertyEntry + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_parkour_parkour_db_proto_init() } @@ -848,6 +879,7 @@ func file_parkour_parkour_db_proto_init() { if File_parkour_parkour_db_proto != nil { return } + file_comm_proto_init() if !protoimpl.UnsafeEnabled { file_parkour_parkour_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBRaceMember); i { @@ -897,6 +929,18 @@ func file_parkour_parkour_db_proto_init() { return nil } } + file_parkour_parkour_db_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBMatchPlayer); 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{ @@ -904,7 +948,7 @@ func file_parkour_parkour_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_parkour_parkour_db_proto_rawDesc, NumEnums: 2, - NumMessages: 7, + NumMessages: 9, NumExtensions: 0, NumServices: 0, }, diff --git a/services/comp_gateroute.go b/services/comp_gateroute.go index f8e54bb27..0c87075eb 100644 --- a/services/comp_gateroute.go +++ b/services/comp_gateroute.go @@ -8,7 +8,6 @@ import ( "go_dreamfactory/sys/configure" "go_dreamfactory/sys/db" "reflect" - "sync" "time" "go_dreamfactory/lego/core" @@ -52,7 +51,6 @@ type SCompGateRoute struct { cbase.ServiceCompBase options *CompOptions service comm.IService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口 - mrlock sync.RWMutex //msghandles 对象的锁 msghandles map[string]*msghandle //处理函数的管理对象 } @@ -73,7 +71,7 @@ func (this *SCompGateRoute) Init(service core.IService, comp core.IServiceComp, this.msghandles = make(map[string]*msghandle) return err -} // +} // 组件启动时注册rpc服务监听 func (this *SCompGateRoute) Start() (err error) { @@ -92,20 +90,16 @@ func (this *SCompGateRoute) Start() (err error) { // 业务模块注册用户消息处理路由 func (this *SCompGateRoute) RegisterRoute(methodName string, comp reflect.Value, msg reflect.Type, handele reflect.Method) { //log.Debugf("注册用户路由【%s】", methodName) - this.mrlock.RLock() _, ok := this.msghandles[methodName] - this.mrlock.RUnlock() if ok { log.Errorf("重复 注册网关消息【%s】", methodName) return } - this.mrlock.Lock() this.msghandles[methodName] = &msghandle{ rcvr: comp, msgType: msg, handle: handele, } - this.mrlock.Unlock() } // Rpc_GatewayRoute服务接口的接收函数 @@ -125,9 +119,7 @@ func (this *SCompGateRoute) ReceiveMsg(ctx context.Context, args *pb.AgentMessag // log.Field{Key: "args", Value: args.String()}, // ) reply.ServiceId = this.service.GetId() - this.mrlock.RLock() msghandle, ok := this.msghandles[method] - this.mrlock.RUnlock() if ok { session := this.service.GetUserSession() session.SetSession(args.Ip, args.UserSessionId, args.ServiceTag, args.GatewayServiceId, args.UserId) diff --git a/services/comp_match.go b/services/comp_match.go new file mode 100644 index 000000000..23c438b0f --- /dev/null +++ b/services/comp_match.go @@ -0,0 +1,81 @@ +package services + +import ( + "context" + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/core/cbase" + "go_dreamfactory/pb" + "reflect" + + "google.golang.org/protobuf/proto" +) + +/* + 服务网关组件 用于接收网关服务发送过来的消息 +*/ + +func NewMatchComp() comm.ISC_MatchComp { + comp := new(SCompMatch) + return comp +} + +// 服务网关组件 +type SCompMatch struct { + cbase.ServiceCompBase + options *CompOptions + service comm.IService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口 + msghandles map[string]*msghandle //处理函数的管理对象 +} + +// 设置服务组件名称 方便业务模块中获取此组件对象 +func (this *SCompMatch) GetName() core.S_Comps { + return comm.SC_ServiceMatchComp +} + +func (this *SCompMatch) NewOptions() (options core.ICompOptions) { + return new(CompOptions) +} + +// 组件初始化函数 +func (this *SCompMatch) Init(service core.IService, comp core.IServiceComp, options core.ICompOptions) (err error) { + err = this.ServiceCompBase.Init(service, comp, options) + this.options = options.(*CompOptions) + this.service = service.(comm.IService) + return err +} + +// 组件启动时注册rpc服务监听 +func (this *SCompMatch) Start() (err error) { + this.service.RegisterFunctionName(string(comm.RPC_SuccMatchNotice), this.SuccMatchNotice) //注册用户登录通知 + err = this.ServiceCompBase.Start() + return +} + +func (this *SCompMatch) RegisterMatchPool(poolName string, comp reflect.Value, msg reflect.Type, handle reflect.Method) { + this.msghandles[poolName] = &msghandle{ + rcvr: comp, + msgType: msg, + handle: handle, + } +} + +// RPC_NoticeUserClose 接收用户登录通知 +func (this *SCompMatch) SuccMatchNotice(ctx context.Context, args *pb.SuccMatchNoticeReq, reply *pb.SuccMatchNoticeResp) (err error) { + msghandle, ok := this.msghandles[args.Poolname] + if ok { + var ( + msg proto.Message + ) + newSlice := reflect.New(msghandle.msgType) + for _, v := range args.Players { + if msg, err = v.UnmarshalNew(); err != nil { + return + } + newSlice = reflect.Append(newSlice, reflect.ValueOf(msg)) + } + //执行处理流 + msghandle.handle.Func.Call([]reflect.Value{msghandle.rcvr, newSlice}) + } + return nil +} diff --git a/services/mainte/main.go b/services/mainte/main.go index 0599bb1fa..5778989da 100644 --- a/services/mainte/main.go +++ b/services/mainte/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "fmt" + "go_dreamfactory/modules/matchpool" "go_dreamfactory/modules/mgolog" "go_dreamfactory/modules/timer" "go_dreamfactory/modules/web" @@ -38,6 +39,7 @@ func main() { mgolog.NewModule(), web.NewModule(), timer.NewModule(), + matchpool.NewModule(), ) } diff --git a/services/worker/main.go b/services/worker/main.go index c5da3abef..23728b40b 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -102,6 +102,7 @@ func main() { ) s.OnInstallComp( //装备组件 services.NewGateRouteComp(), //此服务需要接受用户的消息 需要装备网关组件 + services.NewMatchComp(), //匹配管理组件 ) lego.Run(s, //运行模块 sys.NewModule(),