Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into meixiongfeng
This commit is contained in:
commit
b05316b3c3
@ -247,6 +247,8 @@ const (
|
|||||||
TableParkour = "parkour"
|
TableParkour = "parkour"
|
||||||
///捕羊大赛 队伍表
|
///捕羊大赛 队伍表
|
||||||
TableParkourTeam = "parkourteam"
|
TableParkourTeam = "parkourteam"
|
||||||
|
///捕羊大赛 匹配表
|
||||||
|
TableParkourMatch = "parkourmatch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RPC服务接口定义处
|
// RPC服务接口定义处
|
||||||
@ -304,6 +306,10 @@ const ( //Rpc
|
|||||||
|
|
||||||
// RPC 通知来了邮件
|
// RPC 通知来了邮件
|
||||||
Rpc_Mail core.Rpc_Key = "Rpc_Mail"
|
Rpc_Mail core.Rpc_Key = "Rpc_Mail"
|
||||||
|
|
||||||
|
//捕羊大赛加入匹配请求
|
||||||
|
RPC_ParkourJoinMatch core.Rpc_Key = "RPC_ParkourJoinMatch"
|
||||||
|
RPC_ParkourMatchSucc core.Rpc_Key = "RPC_ParkourMatchSucc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 事件类型定义处
|
// 事件类型定义处
|
||||||
|
@ -3,6 +3,8 @@ package parkour
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
//参数校验
|
//参数校验
|
||||||
@ -15,6 +17,7 @@ func (this *apiComp) Invite(session comm.IUserSession, req *pb.ParkourInviteReq)
|
|||||||
var (
|
var (
|
||||||
tean *pb.DBRaceTeam
|
tean *pb.DBRaceTeam
|
||||||
tuser *pb.DBUser
|
tuser *pb.DBUser
|
||||||
|
ok bool
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if code = this.InviteCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.InviteCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
@ -35,11 +38,28 @@ func (this *apiComp) Invite(session comm.IUserSession, req *pb.ParkourInviteReq)
|
|||||||
}
|
}
|
||||||
//目标是否在线
|
//目标是否在线
|
||||||
if !this.module.ModuleUser.IsOnline(req.Uid) {
|
if !this.module.ModuleUser.IsOnline(req.Uid) {
|
||||||
tean.Member = append(tean.Member, &pb.DBMember{Uid: tean.Uid, Name: tuser.Name, Isai: true})
|
tean.Member = append(tean.Member, &pb.DBRaceMember{Uid: tuser.Uid, Name: tuser.Name, Isai: true})
|
||||||
} else {
|
} else {
|
||||||
|
ok = false
|
||||||
|
for _, v := range tean.Invite {
|
||||||
|
if v.Uid == req.Uid {
|
||||||
|
v.Expired = configure.Now().Add(time.Second * 10).Unix()
|
||||||
|
ok = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !ok {
|
||||||
|
tean.Invite = append(tean.Invite, &pb.DBRaceInvite{Uid: tuser.Uid, Name: tuser.Name})
|
||||||
|
}
|
||||||
this.module.SendMsgToUser(string(this.module.GetType()), "invitenotice",
|
this.module.SendMsgToUser(string(this.module.GetType()), "invitenotice",
|
||||||
&pb.ParkourInviteNoticePush{Team: tean, State: 1}, req.Uid)
|
&pb.ParkourInviteNoticePush{Team: tean, State: 1}, req.Uid)
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.module.GetType()), "invite", &pb.ParkourInviteResp{Issucc: true})
|
if err = this.module.teamComp.Change(session.GetUserId(), map[string]interface{}{
|
||||||
|
"invite": tean.Invite,
|
||||||
|
"member": tean.Member,
|
||||||
|
}); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
session.SendMsg(string(this.module.GetType()), "invite", &pb.ParkourInviteResp{Issucc: true, Team: tean})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
70
modules/parkour/api_invitehandle.go
Normal file
70
modules/parkour/api_invitehandle.go
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package parkour
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
//参数校验
|
||||||
|
func (this *apiComp) InviteHandleCheck(session comm.IUserSession, req *pb.ParkourInviteHandleReq) (code pb.ErrorCode) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///邀请组队
|
||||||
|
func (this *apiComp) InviteHandle(session comm.IUserSession, req *pb.ParkourInviteHandleReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
tean *pb.DBRaceTeam
|
||||||
|
invite *pb.DBRaceInvite
|
||||||
|
member *pb.DBRaceMember
|
||||||
|
users []string
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if code = this.InviteHandleCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if tean, err = this.module.teamComp.queryteam(req.Captainid); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(tean.Member) > 3 {
|
||||||
|
code = pb.ErrorCode_ParkourMemberFull
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if req.State == 1 {
|
||||||
|
ok = false
|
||||||
|
for _, v := range tean.Invite {
|
||||||
|
if v.Uid == session.GetUserId() && configure.Now().Before(time.Unix(v.Expired, 0)) { //邀请未过期
|
||||||
|
invite = v
|
||||||
|
ok = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !ok {
|
||||||
|
code = pb.ErrorCode_ParkourInviteOverdue
|
||||||
|
}
|
||||||
|
users = make([]string, len(tean.Member))
|
||||||
|
for i, v := range tean.Member {
|
||||||
|
users[i] = v.Uid
|
||||||
|
}
|
||||||
|
member = &pb.DBRaceMember{Uid: invite.Uid, Name: invite.Name}
|
||||||
|
tean.Member = append(tean.Member, member)
|
||||||
|
if err = this.module.teamComp.Change(tean.Captainid, map[string]interface{}{
|
||||||
|
"member": tean.Member,
|
||||||
|
}); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.module.SendMsgToUsers(string(this.module.GetType()), "teamjoinnotice",
|
||||||
|
&pb.ParkourTeamJoinNoticePush{Member: member}, users...)
|
||||||
|
this.module.SendMsgToUsers(string(this.module.GetType()), "teamchanage",
|
||||||
|
&pb.ParkourTeamChanagePush{Team: tean}, users...)
|
||||||
|
} else {
|
||||||
|
this.module.SendMsgToUser(string(this.module.GetType()), "invitenotice",
|
||||||
|
&pb.ParkourInviteNoticePush{Team: tean, State: 3}, tean.Captainid)
|
||||||
|
}
|
||||||
|
|
||||||
|
session.SendMsg(string(this.module.GetType()), "invite", &pb.ParkourInviteHandleResp{IsSucc: true})
|
||||||
|
return
|
||||||
|
}
|
57
modules/parkour/api_quitteam.go
Normal file
57
modules/parkour/api_quitteam.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package parkour
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
//参数校验
|
||||||
|
func (this *apiComp) QuitTeamCheck(session comm.IUserSession, req *pb.ParkourQuitTeamReq) (code pb.ErrorCode) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///退出队伍
|
||||||
|
func (this *apiComp) QuitTeam(session comm.IUserSession, req *pb.ParkourQuitTeamReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
tean *pb.DBRaceTeam
|
||||||
|
member *pb.DBRaceMember
|
||||||
|
users []string
|
||||||
|
ok bool
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if code = this.QuitTeamCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if tean, err = this.module.teamComp.queryteam(req.Captainid); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for i, v := range tean.Member {
|
||||||
|
if v.Uid == session.GetUserId() {
|
||||||
|
tean.Member = append(tean.Member[0:i], tean.Member[i+1:]...)
|
||||||
|
member = v
|
||||||
|
ok = true
|
||||||
|
} else {
|
||||||
|
users = append(users, v.Uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !ok {
|
||||||
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = this.module.teamComp.Change(req.Captainid, map[string]interface{}{
|
||||||
|
"member": tean.Member,
|
||||||
|
}); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.module.SendMsgToUsers(string(this.module.GetType()), "teamquitnotice",
|
||||||
|
&pb.ParkourTeamQuitNoticePush{Member: member}, users...)
|
||||||
|
|
||||||
|
this.module.SendMsgToUsers(string(this.module.GetType()), "teamchanage",
|
||||||
|
&pb.ParkourTeamChanagePush{Team: tean}, users...)
|
||||||
|
|
||||||
|
session.SendMsg(string(this.module.GetType()), "quitteam", &pb.ParkourQuitTeamResp{})
|
||||||
|
return
|
||||||
|
}
|
32
modules/parkour/api_racematch.go
Normal file
32
modules/parkour/api_racematch.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package parkour
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
//参数校验
|
||||||
|
func (this *apiComp) RaceMatchCheck(session comm.IUserSession, req *pb.ParkourRaceMatchReq) (code pb.ErrorCode) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///匹配请求
|
||||||
|
func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMatchReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
team *pb.DBRaceTeam
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if code = this.RaceMatchCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if team, err = this.module.teamComp.queryteam(session.GetUserId()); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = this.module.matchComp.addteam(team); err != nil {
|
||||||
|
code = pb.ErrorCode_DBError
|
||||||
|
return
|
||||||
|
}
|
||||||
|
session.SendMsg(string(this.module.GetType()), "racematch", &pb.ParkourRaceMatchResp{})
|
||||||
|
return
|
||||||
|
}
|
15
modules/parkour/core.go
Normal file
15
modules/parkour/core.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package parkour
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
///捕羊大赛对象
|
||||||
|
type RaceItem struct {
|
||||||
|
Id string //战斗id
|
||||||
|
RedMember []*pb.DBRaceMember //红方成员
|
||||||
|
RedSession []comm.IUserSession //红方会话
|
||||||
|
BuleMember []*pb.DBRaceMember //蓝方成员
|
||||||
|
BuleSession []comm.IUserSession //蓝方会话
|
||||||
|
}
|
36
modules/parkour/model_match.go
Normal file
36
modules/parkour/model_match.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package parkour
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
///竞速数据模块
|
||||||
|
type ModelMatchComp struct {
|
||||||
|
modules.MCompModel
|
||||||
|
module *Parkour
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口 只是用redis 层
|
||||||
|
func (this *ModelMatchComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
||||||
|
this.TableName = comm.TableParkourMatch
|
||||||
|
this.MCompModel.Init(service, module, comp, opt)
|
||||||
|
this.module = module.(*Parkour)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
///添加匹配队伍
|
||||||
|
func (this *ModelMatchComp) addteam(team *pb.DBRaceTeam) (err error) {
|
||||||
|
// var (
|
||||||
|
// teams []*pb.DBRaceTeam = make([]*pb.DBRaceTeam, 0)
|
||||||
|
// )
|
||||||
|
// if err = this.GetQueues(this.TableName, 1000, &teams); err == redis.RedisNil {
|
||||||
|
// if outkey, err = this.AddQueues(this.TableName, 1000, data); err != nil {
|
||||||
|
// this.module.Errorf("err:%v", err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
return
|
||||||
|
}
|
@ -4,6 +4,8 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
@ -26,3 +28,11 @@ func (this *ModelParkourComp) Init(service core.IService, module core.IModule, c
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//记录战斗信息
|
||||||
|
func (this *ModelParkourComp) addrace(race *pb.DBRace) (err error) {
|
||||||
|
if err = this.AddList("", race.Id, race, db.SetDBMgoLog(false)); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -44,9 +44,11 @@ func (this *ModelTeamComp) queryteam(uid string) (result *pb.DBRaceTeam, err err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
result = &pb.DBRaceTeam{
|
result = &pb.DBRaceTeam{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: uid,
|
Captainid: uid,
|
||||||
Member: []*pb.DBMember{{Uid: tuser.Uid, Name: tuser.Name}},
|
State: pb.RaceTeamState_teaming,
|
||||||
|
Invite: make([]*pb.DBRaceInvite, 0),
|
||||||
|
Member: []*pb.DBRaceMember{{Uid: tuser.Uid, Name: tuser.Name}},
|
||||||
}
|
}
|
||||||
if err = this.Add(uid, result); err != nil {
|
if err = this.Add(uid, result); err != nil {
|
||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
@ -56,3 +58,37 @@ func (this *ModelTeamComp) queryteam(uid string) (result *pb.DBRaceTeam, err err
|
|||||||
err = nil
|
err = nil
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *ModelTeamComp) queryteams(uids []string) (results []*pb.DBRaceTeam, err error) {
|
||||||
|
results = make([]*pb.DBRaceTeam, 0)
|
||||||
|
var (
|
||||||
|
onfound []string
|
||||||
|
newdata map[string]interface{} = make(map[string]interface{})
|
||||||
|
)
|
||||||
|
if onfound, err = this.Gets(uids, &results); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(onfound) > 0 {
|
||||||
|
for _, v := range onfound {
|
||||||
|
var tuser *pb.DBUser
|
||||||
|
if tuser = this.module.ModuleUser.GetUser(v); tuser == nil {
|
||||||
|
err = fmt.Errorf("no found udata:%s", v)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
temp := &pb.DBRaceTeam{
|
||||||
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
Captainid: v,
|
||||||
|
State: pb.RaceTeamState_teaming,
|
||||||
|
Invite: make([]*pb.DBRaceInvite, 0),
|
||||||
|
Member: []*pb.DBRaceMember{{Uid: tuser.Uid, Name: tuser.Name}},
|
||||||
|
}
|
||||||
|
newdata[v] = temp
|
||||||
|
}
|
||||||
|
if err = this.Adds(newdata); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -1,10 +1,17 @@
|
|||||||
package parkour
|
package parkour
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -23,7 +30,10 @@ type Parkour struct {
|
|||||||
api *apiComp
|
api *apiComp
|
||||||
configure *configureComp
|
configure *configureComp
|
||||||
teamComp *ModelTeamComp
|
teamComp *ModelTeamComp
|
||||||
|
matchComp *ModelMatchComp
|
||||||
parkourComp *ModelParkourComp
|
parkourComp *ModelParkourComp
|
||||||
|
lock sync.RWMutex
|
||||||
|
battles map[string]*RaceItem
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块名
|
//模块名
|
||||||
@ -35,12 +45,13 @@ func (this *Parkour) GetType() core.M_Modules {
|
|||||||
func (this *Parkour) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
func (this *Parkour) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleBase.Init(service, module, options)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
this.service = service.(base.IRPCXService)
|
this.service = service.(base.IRPCXService)
|
||||||
|
this.battles = map[string]*RaceItem{}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Parkour) Start() (err error) {
|
func (this *Parkour) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
err = this.ModuleBase.Start()
|
||||||
|
this.service.RegisterFunctionName(string(comm.RPC_ParkourMatchSucc), this.createbattle)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,5 +61,69 @@ func (this *Parkour) OnInstallComp() {
|
|||||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
this.teamComp = this.RegisterComp(new(ModelTeamComp)).(*ModelTeamComp)
|
this.teamComp = this.RegisterComp(new(ModelTeamComp)).(*ModelTeamComp)
|
||||||
|
this.matchComp = this.RegisterComp(new(ModelMatchComp)).(*ModelMatchComp)
|
||||||
this.parkourComp = this.RegisterComp(new(ModelParkourComp)).(*ModelParkourComp)
|
this.parkourComp = this.RegisterComp(new(ModelParkourComp)).(*ModelParkourComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//匹配成功 创建战斗
|
||||||
|
func (this *Parkour) createbattle(ctx context.Context, req *pb.RPCParkourMatchSuccReq, resp *pb.RPCParkourMatchSuccResp) (err error) {
|
||||||
|
var (
|
||||||
|
race *pb.DBRace
|
||||||
|
battle *RaceItem
|
||||||
|
sessions []comm.IUserSession = make([]comm.IUserSession, 0)
|
||||||
|
teams []*pb.DBRaceTeam
|
||||||
|
users []string = make([]string, 0)
|
||||||
|
)
|
||||||
|
this.Debug("createbattle", log.Field{Key: "req", Value: req.String()})
|
||||||
|
|
||||||
|
race = &pb.DBRace{
|
||||||
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
ServicePath: fmt.Sprintf("%s/%s", this.service.GetType(), this.service.GetId()),
|
||||||
|
Redmember: req.Red,
|
||||||
|
Bulemember: req.Bule,
|
||||||
|
}
|
||||||
|
battle = &RaceItem{
|
||||||
|
Id: race.Id,
|
||||||
|
RedSession: make([]comm.IUserSession, 0),
|
||||||
|
BuleSession: make([]comm.IUserSession, 0),
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range req.Red {
|
||||||
|
users = append(users, v.Uid)
|
||||||
|
session, online := this.GetUserSession(v.Uid)
|
||||||
|
v.Isoff = !online
|
||||||
|
if online {
|
||||||
|
battle.RedSession = append(battle.RedSession, session)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
battle.RedMember = req.Red
|
||||||
|
for _, v := range req.Bule {
|
||||||
|
users = append(users, v.Uid)
|
||||||
|
session, online := this.GetUserSession(v.Uid)
|
||||||
|
v.Isoff = !online
|
||||||
|
if online {
|
||||||
|
battle.BuleSession = append(battle.BuleSession, session)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
battle.BuleMember = req.Bule
|
||||||
|
if teams, err = this.teamComp.queryteams(users); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range teams {
|
||||||
|
v.State = pb.RaceTeamState_raceing
|
||||||
|
}
|
||||||
|
if err = this.parkourComp.addrace(race); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.lock.Lock()
|
||||||
|
this.battles[race.Id] = battle
|
||||||
|
this.lock.Unlock()
|
||||||
|
if err = this.SendMsgToSession(string(comm.ModulePvp), "racematchsucc", &pb.ParkourRaceMatchSuccPush{
|
||||||
|
Race: race,
|
||||||
|
}, sessions...); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
141
modules/timer/parkour.go
Normal file
141
modules/timer/parkour.go
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
package timer
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go_dreamfactory/lego/base"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/cron"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
捕羊大赛 维护服务
|
||||||
|
*/
|
||||||
|
type ParkourComp struct {
|
||||||
|
modules.MCompConfigure
|
||||||
|
service base.IRPCXService
|
||||||
|
module *Timer
|
||||||
|
lock sync.RWMutex
|
||||||
|
teams map[string][]*pb.DBRaceMember
|
||||||
|
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.teams = make(map[string][]*pb.DBRaceMember)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//自由跨服环境下开启此功能
|
||||||
|
func (this *ParkourComp) Start() (err error) {
|
||||||
|
err = this.MCompConfigure.Start()
|
||||||
|
if db.IsCross() {
|
||||||
|
this.service.RegisterFunctionName(string(comm.RPC_ParkourJoinMatch), this.join)
|
||||||
|
if _, err = cron.AddFunc("0 59 23 ? * SAT", this.timer); err != nil {
|
||||||
|
this.module.Errorf("cron.AddFunc err:%v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//加入匹配中
|
||||||
|
func (this *ParkourComp) join(ctx context.Context, req *pb.RPCParkourJoinMatchReq, resp *pb.RPCParkourJoinMatchResp) (err error) {
|
||||||
|
this.lock.Lock()
|
||||||
|
defer this.lock.Unlock()
|
||||||
|
this.teams[req.Captainid] = req.Member
|
||||||
|
this.total += int32(len(req.Member))
|
||||||
|
if this.total >= 6 {
|
||||||
|
var (
|
||||||
|
teams1 []string = make([]string, 0)
|
||||||
|
teams2 []string = make([]string, 0)
|
||||||
|
teams3 []string = make([]string, 0)
|
||||||
|
red []string = make([]string, 0)
|
||||||
|
reduser []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0)
|
||||||
|
bule []string = make([]string, 0)
|
||||||
|
buleuser []*pb.DBRaceMember = make([]*pb.DBRaceMember, 0)
|
||||||
|
)
|
||||||
|
for k, v := range this.teams {
|
||||||
|
if len(v) == 1 {
|
||||||
|
teams1 = append(teams1, k)
|
||||||
|
} else if len(v) == 2 {
|
||||||
|
teams2 = append(teams2, k)
|
||||||
|
} else {
|
||||||
|
teams3 = append(teams3, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//找红队
|
||||||
|
if len(teams3) > 0 {
|
||||||
|
red = append(red, teams3[0])
|
||||||
|
teams3 = teams3[1:]
|
||||||
|
} else if len(teams2) > 0 && len(teams1) > 0 {
|
||||||
|
red = append(red, teams2[0], teams1[0])
|
||||||
|
teams2 = teams2[1:]
|
||||||
|
teams1 = teams1[1:]
|
||||||
|
} else if len(teams1) >= 3 {
|
||||||
|
red = append(red, teams1[0], teams1[1], teams1[2])
|
||||||
|
teams1 = teams1[3:]
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(red) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//找蓝队
|
||||||
|
if len(teams3) > 0 {
|
||||||
|
bule = append(bule, teams3[0])
|
||||||
|
teams3 = teams3[1:]
|
||||||
|
} else if len(teams2) > 0 && len(teams1) > 0 {
|
||||||
|
bule = append(bule, teams2[0], teams1[0])
|
||||||
|
teams2 = teams2[1:]
|
||||||
|
teams1 = teams1[1:]
|
||||||
|
} else if len(teams1) >= 3 {
|
||||||
|
bule = append(bule, teams1[0], teams1[1], teams1[2])
|
||||||
|
teams1 = teams1[3:]
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(bule) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range red {
|
||||||
|
reduser = append(reduser, this.teams[v]...)
|
||||||
|
}
|
||||||
|
for _, v := range bule {
|
||||||
|
buleuser = append(reduser, this.teams[v]...)
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx, _ := context.WithTimeout(context.Background(), time.Second*2)
|
||||||
|
if err = this.service.RpcCall(ctx,
|
||||||
|
comm.Service_Worker,
|
||||||
|
string(comm.RPC_ParkourMatchSucc),
|
||||||
|
&pb.RPCParkourMatchSuccReq{Red: reduser, Bule: buleuser},
|
||||||
|
&pb.RPCParkourMatchSuccResp{},
|
||||||
|
); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, v := range red {
|
||||||
|
delete(this.teams, v)
|
||||||
|
}
|
||||||
|
for _, v := range bule {
|
||||||
|
delete(this.teams, v)
|
||||||
|
}
|
||||||
|
this.total -= 6
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//定时匹配处理
|
||||||
|
func (this *ParkourComp) timer() {
|
||||||
|
|
||||||
|
}
|
@ -364,6 +364,9 @@ const (
|
|||||||
ErrorCode_PracticePillarMaxLv ErrorCode = 4304 //木桩已到满级
|
ErrorCode_PracticePillarMaxLv ErrorCode = 4304 //木桩已到满级
|
||||||
ErrorCode_PracticeYouQiecuoing ErrorCode = 4305 //你有切磋未完成
|
ErrorCode_PracticeYouQiecuoing ErrorCode = 4305 //你有切磋未完成
|
||||||
ErrorCode_PracticeTargetQiecuoing ErrorCode = 4306 //目标正在切磋中
|
ErrorCode_PracticeTargetQiecuoing ErrorCode = 4306 //目标正在切磋中
|
||||||
|
//parkour
|
||||||
|
ErrorCode_ParkourMemberFull ErrorCode = 4401 //队伍成员已满
|
||||||
|
ErrorCode_ParkourInviteOverdue ErrorCode = 4402 //邀请已过期
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enum value maps for ErrorCode.
|
// Enum value maps for ErrorCode.
|
||||||
@ -676,6 +679,8 @@ var (
|
|||||||
4304: "PracticePillarMaxLv",
|
4304: "PracticePillarMaxLv",
|
||||||
4305: "PracticeYouQiecuoing",
|
4305: "PracticeYouQiecuoing",
|
||||||
4306: "PracticeTargetQiecuoing",
|
4306: "PracticeTargetQiecuoing",
|
||||||
|
4401: "ParkourMemberFull",
|
||||||
|
4402: "ParkourInviteOverdue",
|
||||||
}
|
}
|
||||||
ErrorCode_value = map[string]int32{
|
ErrorCode_value = map[string]int32{
|
||||||
"Success": 0,
|
"Success": 0,
|
||||||
@ -985,6 +990,8 @@ var (
|
|||||||
"PracticePillarMaxLv": 4304,
|
"PracticePillarMaxLv": 4304,
|
||||||
"PracticeYouQiecuoing": 4305,
|
"PracticeYouQiecuoing": 4305,
|
||||||
"PracticeTargetQiecuoing": 4306,
|
"PracticeTargetQiecuoing": 4306,
|
||||||
|
"ParkourMemberFull": 4401,
|
||||||
|
"ParkourInviteOverdue": 4402,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1019,7 +1026,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_errorcode_proto_rawDesc = []byte{
|
var file_errorcode_proto_rawDesc = []byte{
|
||||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x2a, 0xf5, 0x37, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
0x6f, 0x2a, 0xa8, 0x38, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10,
|
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10,
|
||||||
0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
||||||
0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76,
|
0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76,
|
||||||
@ -1466,8 +1473,11 @@ var file_errorcode_proto_rawDesc = []byte{
|
|||||||
0x12, 0x19, 0x0a, 0x14, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x59, 0x6f, 0x75, 0x51,
|
0x12, 0x19, 0x0a, 0x14, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x59, 0x6f, 0x75, 0x51,
|
||||||
0x69, 0x65, 0x63, 0x75, 0x6f, 0x69, 0x6e, 0x67, 0x10, 0xd1, 0x21, 0x12, 0x1c, 0x0a, 0x17, 0x50,
|
0x69, 0x65, 0x63, 0x75, 0x6f, 0x69, 0x6e, 0x67, 0x10, 0xd1, 0x21, 0x12, 0x1c, 0x0a, 0x17, 0x50,
|
||||||
0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x51, 0x69, 0x65,
|
0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x51, 0x69, 0x65,
|
||||||
0x63, 0x75, 0x6f, 0x69, 0x6e, 0x67, 0x10, 0xd2, 0x21, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
0x63, 0x75, 0x6f, 0x69, 0x6e, 0x67, 0x10, 0xd2, 0x21, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x61, 0x72,
|
||||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6b, 0x6f, 0x75, 0x72, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0xb1,
|
||||||
|
0x22, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x61, 0x72, 0x6b, 0x6f, 0x75, 0x72, 0x49, 0x6e, 0x76, 0x69,
|
||||||
|
0x74, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x64, 0x75, 0x65, 0x10, 0xb2, 0x22, 0x42, 0x06, 0x5a, 0x04,
|
||||||
|
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -66,6 +66,56 @@ func (RaceType) EnumDescriptor() ([]byte, []int) {
|
|||||||
return file_parkour_parkour_db_proto_rawDescGZIP(), []int{0}
|
return file_parkour_parkour_db_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//队伍状态
|
||||||
|
type RaceTeamState int32
|
||||||
|
|
||||||
|
const (
|
||||||
|
RaceTeamState_teaming RaceTeamState = 0 //组队中
|
||||||
|
RaceTeamState_matching RaceTeamState = 1 //匹配中
|
||||||
|
RaceTeamState_raceing RaceTeamState = 2 //比赛中
|
||||||
|
)
|
||||||
|
|
||||||
|
// Enum value maps for RaceTeamState.
|
||||||
|
var (
|
||||||
|
RaceTeamState_name = map[int32]string{
|
||||||
|
0: "teaming",
|
||||||
|
1: "matching",
|
||||||
|
2: "raceing",
|
||||||
|
}
|
||||||
|
RaceTeamState_value = map[string]int32{
|
||||||
|
"teaming": 0,
|
||||||
|
"matching": 1,
|
||||||
|
"raceing": 2,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (x RaceTeamState) Enum() *RaceTeamState {
|
||||||
|
p := new(RaceTeamState)
|
||||||
|
*p = x
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x RaceTeamState) String() string {
|
||||||
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (RaceTeamState) Descriptor() protoreflect.EnumDescriptor {
|
||||||
|
return file_parkour_parkour_db_proto_enumTypes[1].Descriptor()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (RaceTeamState) Type() protoreflect.EnumType {
|
||||||
|
return &file_parkour_parkour_db_proto_enumTypes[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x RaceTeamState) Number() protoreflect.EnumNumber {
|
||||||
|
return protoreflect.EnumNumber(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RaceTeamState.Descriptor instead.
|
||||||
|
func (RaceTeamState) EnumDescriptor() ([]byte, []int) {
|
||||||
|
return file_parkour_parkour_db_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
//坐骑
|
//坐骑
|
||||||
type DBMounts struct {
|
type DBMounts struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
@ -286,10 +336,11 @@ type DBRaceTeam struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // 队伍id
|
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
|
State RaceTeamState `protobuf:"varint,2,opt,name=state,proto3,enum=RaceTeamState" json:"state"` //队伍状态
|
||||||
Invite []*DBRaceInvite `protobuf:"bytes,3,rep,name=invite,proto3" json:"invite"` //邀请列表
|
Captainid string `protobuf:"bytes,3,opt,name=captainid,proto3" json:"captainid"` //队长id
|
||||||
Member []*DBRaceMember `protobuf:"bytes,4,rep,name=member,proto3" json:"member"` //成员列表
|
Invite []*DBRaceInvite `protobuf:"bytes,4,rep,name=invite,proto3" json:"invite"` //邀请列表
|
||||||
|
Member []*DBRaceMember `protobuf:"bytes,5,rep,name=member,proto3" json:"member"` //成员列表
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBRaceTeam) Reset() {
|
func (x *DBRaceTeam) Reset() {
|
||||||
@ -331,9 +382,16 @@ func (x *DBRaceTeam) GetId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBRaceTeam) GetUid() string {
|
func (x *DBRaceTeam) GetState() RaceTeamState {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Uid
|
return x.State
|
||||||
|
}
|
||||||
|
return RaceTeamState_teaming
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DBRaceTeam) GetCaptainid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Captainid
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -358,12 +416,13 @@ type DBRace struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // 比赛唯一id
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // 比赛唯一id
|
||||||
Rtype RaceType `protobuf:"varint,2,opt,name=rtype,proto3,enum=RaceType" json:"rtype"` //比赛类型
|
ServicePath string `protobuf:"bytes,2,opt,name=servicePath,proto3" json:"servicePath"` //比赛所在服务
|
||||||
Trackid int32 `protobuf:"varint,3,opt,name=trackid,proto3" json:"trackid"` //赛道id
|
Rtype RaceType `protobuf:"varint,3,opt,name=rtype,proto3,enum=RaceType" json:"rtype"` //比赛类型
|
||||||
Innermost int32 `protobuf:"varint,4,opt,name=innermost,proto3" json:"innermost"` //里程数
|
Trackid int32 `protobuf:"varint,4,opt,name=trackid,proto3" json:"trackid"` //赛道id
|
||||||
Redteam *DBRaceTeam `protobuf:"bytes,5,opt,name=redteam,proto3" json:"redteam"` //红方队伍
|
Innermost int32 `protobuf:"varint,5,opt,name=innermost,proto3" json:"innermost"` //里程数
|
||||||
Buleteam *DBRaceTeam `protobuf:"bytes,6,opt,name=buleteam,proto3" json:"buleteam"` //蓝方队伍
|
Redmember []*DBRaceMember `protobuf:"bytes,6,rep,name=redmember,proto3" json:"redmember"` //红方队伍
|
||||||
|
Bulemember []*DBRaceMember `protobuf:"bytes,7,rep,name=bulemember,proto3" json:"bulemember"` //蓝方队伍
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBRace) Reset() {
|
func (x *DBRace) Reset() {
|
||||||
@ -405,6 +464,13 @@ func (x *DBRace) GetId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *DBRace) GetServicePath() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ServicePath
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *DBRace) GetRtype() RaceType {
|
func (x *DBRace) GetRtype() RaceType {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Rtype
|
return x.Rtype
|
||||||
@ -426,16 +492,16 @@ func (x *DBRace) GetInnermost() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBRace) GetRedteam() *DBRaceTeam {
|
func (x *DBRace) GetRedmember() []*DBRaceMember {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Redteam
|
return x.Redmember
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBRace) GetBuleteam() *DBRaceTeam {
|
func (x *DBRace) GetBulemember() []*DBRaceMember {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Buleteam
|
return x.Bulemember
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -463,30 +529,40 @@ var file_parkour_parkour_db_proto_rawDesc = []byte{
|
|||||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
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, 0x18,
|
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18,
|
||||||
0x0a, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
|
0x0a, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x22, 0x7c, 0x0a, 0x0a, 0x44, 0x42, 0x52, 0x61,
|
0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x22, 0xae, 0x01, 0x0a, 0x0a, 0x44, 0x42, 0x52,
|
||||||
0x63, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
0x61, 0x63, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||||
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20,
|
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x24, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x69, 0x6e, 0x76, 0x69,
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x54, 0x65, 0x61,
|
||||||
0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63,
|
0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1c, 0x0a,
|
||||||
0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x52, 0x06, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x12,
|
0x09, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x25, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
0x52, 0x09, 0x63, 0x61, 0x70, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x06, 0x69,
|
||||||
0x0d, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x06,
|
0x6e, 0x76, 0x69, 0x74, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42,
|
||||||
0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xc1, 0x01, 0x0a, 0x06, 0x44, 0x42, 0x52, 0x61, 0x63,
|
0x52, 0x61, 0x63, 0x65, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x52, 0x06, 0x69, 0x6e, 0x76, 0x69,
|
||||||
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
|
0x74, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x03,
|
||||||
0x64, 0x12, 0x1f, 0x0a, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e,
|
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65,
|
||||||
0x32, 0x09, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x72, 0x74, 0x79,
|
0x72, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x22, 0xef, 0x01, 0x0a, 0x06, 0x44, 0x42,
|
||||||
0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x64, 0x18, 0x03, 0x20,
|
0x52, 0x61, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09,
|
0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50,
|
||||||
0x69, 0x6e, 0x6e, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69,
|
||||||
0x09, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x07, 0x72, 0x65,
|
0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x18,
|
||||||
0x64, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42,
|
0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65,
|
||||||
0x52, 0x61, 0x63, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x52, 0x07, 0x72, 0x65, 0x64, 0x74, 0x65, 0x61,
|
0x52, 0x05, 0x72, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b,
|
||||||
0x6d, 0x12, 0x27, 0x0a, 0x08, 0x62, 0x75, 0x6c, 0x65, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x06, 0x20,
|
0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x69,
|
||||||
0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x54, 0x65, 0x61, 0x6d,
|
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x74, 0x18, 0x05,
|
||||||
0x52, 0x08, 0x62, 0x75, 0x6c, 0x65, 0x74, 0x65, 0x61, 0x6d, 0x2a, 0x22, 0x0a, 0x08, 0x52, 0x61,
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x6d, 0x6f, 0x73, 0x74, 0x12,
|
||||||
0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x69, 0x6e, 0x61,
|
0x2b, 0x0a, 0x09, 0x72, 0x65, 0x64, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x06, 0x20, 0x03,
|
||||||
0x72, 0x79, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x70, 0x72, 0x6f, 0x70, 0x10, 0x01, 0x42, 0x06,
|
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x52, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x6d, 0x62, 0x65,
|
||||||
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x72, 0x52, 0x09, 0x72, 0x65, 0x64, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2d, 0x0a, 0x0a,
|
||||||
|
0x62, 0x75, 0x6c, 0x65, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, 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, 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,
|
||||||
|
0x37, 0x0a, 0x0d, 0x52, 0x61, 0x63, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||||
|
0x12, 0x0b, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x0c, 0x0a,
|
||||||
|
0x08, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x72,
|
||||||
|
0x61, 0x63, 0x65, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -501,28 +577,30 @@ func file_parkour_parkour_db_proto_rawDescGZIP() []byte {
|
|||||||
return file_parkour_parkour_db_proto_rawDescData
|
return file_parkour_parkour_db_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_parkour_parkour_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
var file_parkour_parkour_db_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||||
var file_parkour_parkour_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
var file_parkour_parkour_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||||
var file_parkour_parkour_db_proto_goTypes = []interface{}{
|
var file_parkour_parkour_db_proto_goTypes = []interface{}{
|
||||||
(RaceType)(0), // 0: RaceType
|
(RaceType)(0), // 0: RaceType
|
||||||
(*DBMounts)(nil), // 1: DBMounts
|
(RaceTeamState)(0), // 1: RaceTeamState
|
||||||
(*DBRaceMember)(nil), // 2: DBRaceMember
|
(*DBMounts)(nil), // 2: DBMounts
|
||||||
(*DBRaceInvite)(nil), // 3: DBRaceInvite
|
(*DBRaceMember)(nil), // 3: DBRaceMember
|
||||||
(*DBRaceTeam)(nil), // 4: DBRaceTeam
|
(*DBRaceInvite)(nil), // 4: DBRaceInvite
|
||||||
(*DBRace)(nil), // 5: DBRace
|
(*DBRaceTeam)(nil), // 5: DBRaceTeam
|
||||||
|
(*DBRace)(nil), // 6: DBRace
|
||||||
}
|
}
|
||||||
var file_parkour_parkour_db_proto_depIdxs = []int32{
|
var file_parkour_parkour_db_proto_depIdxs = []int32{
|
||||||
1, // 0: DBRaceMember.mount:type_name -> DBMounts
|
2, // 0: DBRaceMember.mount:type_name -> DBMounts
|
||||||
3, // 1: DBRaceTeam.invite:type_name -> DBRaceInvite
|
1, // 1: DBRaceTeam.state:type_name -> RaceTeamState
|
||||||
2, // 2: DBRaceTeam.member:type_name -> DBRaceMember
|
4, // 2: DBRaceTeam.invite:type_name -> DBRaceInvite
|
||||||
0, // 3: DBRace.rtype:type_name -> RaceType
|
3, // 3: DBRaceTeam.member:type_name -> DBRaceMember
|
||||||
4, // 4: DBRace.redteam:type_name -> DBRaceTeam
|
0, // 4: DBRace.rtype:type_name -> RaceType
|
||||||
4, // 5: DBRace.buleteam:type_name -> DBRaceTeam
|
3, // 5: DBRace.redmember:type_name -> DBRaceMember
|
||||||
6, // [6:6] is the sub-list for method output_type
|
3, // 6: DBRace.bulemember:type_name -> DBRaceMember
|
||||||
6, // [6:6] is the sub-list for method input_type
|
7, // [7:7] is the sub-list for method output_type
|
||||||
6, // [6:6] is the sub-list for extension type_name
|
7, // [7:7] is the sub-list for method input_type
|
||||||
6, // [6:6] is the sub-list for extension extendee
|
7, // [7:7] is the sub-list for extension type_name
|
||||||
0, // [0:6] is the sub-list for field 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_parkour_parkour_db_proto_init() }
|
func init() { file_parkour_parkour_db_proto_init() }
|
||||||
@ -597,7 +675,7 @@ func file_parkour_parkour_db_proto_init() {
|
|||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_parkour_parkour_db_proto_rawDesc,
|
RawDescriptor: file_parkour_parkour_db_proto_rawDesc,
|
||||||
NumEnums: 1,
|
NumEnums: 2,
|
||||||
NumMessages: 5,
|
NumMessages: 5,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
|
1104
pb/parkour_msg.pb.go
1104
pb/parkour_msg.pb.go
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user