diff --git a/modules/entertainment/api_match.go b/modules/entertainment/api_match.go index 321f128a6..db42bc668 100644 --- a/modules/entertainment/api_match.go +++ b/modules/entertainment/api_match.go @@ -3,11 +3,16 @@ package entertainment import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "strconv" ) //参数校验 func (this *apiComp) MatchCheck(session comm.IUserSession, req *pb.EntertainMatchReq) (errdata *pb.ErrorData) { + if req.Idcard == "" { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + } + } return } @@ -17,28 +22,39 @@ func (this *apiComp) Match(session comm.IUserSession, req *pb.EntertainMatchReq) var ( bMatch bool s2 comm.IUserSession - //bAI bool // 是否是机器人 + p1 *pb.PlayerData // 玩家1 + p2 *pb.PlayerData // 玩家2 ) if users, err := this.module.ModuleUser.UserOnlineList(); err == nil { if len(users) > 0 { bMatch = true s2, bMatch = this.module.GetUserSession(users[0].Uid) + p2 = &pb.PlayerData{ + Uid: s2.GetUserId(), + Name: "", + Score: 0, + Ps: 0, + Cardid: req.Idcard, + } } else { // 测试用 if robots, err := this.module.ModuleTools.RandRobotConfig(1); err == nil { - s2, bMatch = this.module.GetUserSession(strconv.Itoa(int(robots[0].Robotid))) + if len(robots) > 0 { + p2 = &pb.PlayerData{ + Uid: "999", // AI uid 暂定 + Name: robots[0].Name, + Score: 0, + Ps: 0, + Cardid: "27000001", // 机器人临时数据 + } + } } - //bAI = true + } - this.module.gameMgr.CreateRoom(session, s2) + this.module.gameMgr.CreateRoom(session, s2, p1, p2) } session.SendMsg(string(this.module.GetType()), "match", &pb.EntertainMatchResp{ - Maych: bMatch, - Player: &pb.PlayerData{ - Uid: s2.GetUserId(), - Name: "", - Score: 0, - Ps: 0, - }, + Maych: bMatch, + Player: p2, }) return } diff --git a/modules/entertainment/gamemgr.go b/modules/entertainment/gamemgr.go index 3f7efccbf..642575f47 100644 --- a/modules/entertainment/gamemgr.go +++ b/modules/entertainment/gamemgr.go @@ -28,9 +28,9 @@ func (this *gameMgrComp) Init(service core.IService, module core.IModule, comp c return } -func (this *gameMgrComp) CreateRoom(s1 comm.IUserSession, s2 comm.IUserSession) { +func (this *gameMgrComp) CreateRoom(s1 comm.IUserSession, s2 comm.IUserSession, p1 *pb.PlayerData, p2 *pb.PlayerData) { room := new(Room) //初始化房间 - room.InitRoom(this.module, s1, s2) + room.InitRoom(this.module, s1, s2, p1, p2) this.lock.Lock() this.rooms[room.Id] = room diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index cd537d30b..4c215dff8 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -2,56 +2,72 @@ package entertainment import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/timewheel" "go_dreamfactory/modules" "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" + "time" "go.mongodb.org/mongo-driver/bson/primitive" "google.golang.org/protobuf/proto" ) const ( - MaxPs = 2 // 最大体力 + MaxPs = 2 // 最大体力 + MaxRound = 7 // 最大回合数 ) //游戏房间 type Room struct { modules.ModuleBase - Id string // 房间id - s1 comm.IUserSession - s2 comm.IUserSession - player1 *pb.PlayerData // 玩家1 - player2 *pb.PlayerData // 玩家2 - chessboard *MapData - module *Entertainment - power string // 谁的权限 - round int32 // 轮数 + Id string // 房间id + szSession []comm.IUserSession + player1 *pb.PlayerData // 玩家1 + player2 *pb.PlayerData // 玩家2 + chessboard *MapData + module *Entertainment + power string // 谁的权限 + round int32 // 轮数 + operatetimer *timewheel.Task //操作倒计时定时器 } -func (this *Room) InitRoom(module *Entertainment, s1 comm.IUserSession, s2 comm.IUserSession) *Room { +func (this *Room) operateTimeOut(task *timewheel.Task, args ...interface{}) { + if this.operatetimer != nil { + timewheel.Remove(this.operatetimer) + } + if this.player1.Uid == this.power { // 给玩家2 + this.power = this.player2.Uid + this.player2.Ps = MaxPs // 恢复体力 + } else { // 权限给1号玩家 + this.power = this.player1.Uid + this.player1.Ps = MaxPs // 恢复体力 + } + this.round++ // 回合+1 + if this.round > MaxRound*2 { // 游戏结束 + this.GameOver() + } + this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut) // 开启新的定时器 + this.module.Debugf("超时%d", configure.Now().Unix()) +} + +func (this *Room) InitRoom(module *Entertainment, s1 comm.IUserSession, s2 comm.IUserSession, p1 *pb.PlayerData, p2 *pb.PlayerData) *Room { this.chessboard = new(MapData) this.chessboard.InitMap() // 初始化棋盘 defer this.StartGame() + this.szSession = append(this.szSession, s1) + if p2.Uid != "" { // 是否是机器人 + this.szSession = append(this.szSession, s2) + } + this.operatetimer = timewheel.Add(time.Second*8, this.operateTimeOut) return &Room{ ModuleBase: modules.ModuleBase{}, Id: primitive.NewObjectID().Hex(), - s1: s1, - s2: s2, - player1: &pb.PlayerData{ - Uid: s1.GetUserId(), - Name: "", - Score: 0, - Ps: MaxPs, - }, - player2: &pb.PlayerData{ - Uid: s2.GetUserId(), - Name: "", - Score: 0, - Ps: MaxPs, - }, + player1: p1, + player2: p2, chessboard: this.chessboard, module: module, - power: s1.GetUserId(), // 默认1号玩家先 + power: s1.GetUserId(), round: 1, } } @@ -64,11 +80,16 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr ) var szMap []*pb.MapData req := msg.(*pb.EntertainOperatorReq) - //权限校验 - if this.power == this.player1.Uid { + + if session.GetUserId() != this.power { // 校验是不是你的权限 + return + } + + if this.power == this.player1.Uid { //权限校验 this.player1.Ps-- if this.player1.Ps <= 0 { // 权限给下一个人 this.power = this.player2.Uid + this.round++ } this.player2.Ps = MaxPs } else if this.power == this.player2.Uid { @@ -97,7 +118,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr }) } // 操作消息返回 - this.s1.SendMsg(string(this.module.GetType()), "operator", &pb.EntertainOperatorResp{ + session.SendMsg(string(this.module.GetType()), "operator", &pb.EntertainOperatorResp{ Success: true, }) @@ -107,7 +128,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr Power: this.power, Score: curScore, Round: this.round, - }, []comm.IUserSession{this.s1, this.s2}...); err != nil { + }, this.szSession...); err != nil { this.Errorln(err) } } @@ -133,8 +154,23 @@ func (this *Room) StartGame() (errdata *pb.ErrorData) { }, Power: this.power, Round: this.round, - }, []comm.IUserSession{this.s1, this.s2}...); err != nil { + }, this.szSession...); err != nil { this.Errorln(err) } return } + +// 游戏结束 +func (this *Room) GameOver() (errdata *pb.ErrorData) { + + this.SendMsgToSession(string(this.module.GetType()), "gameover", &pb.EntertainGameOverPush{ + User1: this.player1, + User2: this.player2, + Mpadata: &pb.MapData{ + Data: this.chessboard.Data, + }, + Power: "", + Round: this.round, + }) + return +} diff --git a/modules/entertainment/xxl_test.go b/modules/entertainment/xxl_test.go index e9b5d1163..84898375f 100644 --- a/modules/entertainment/xxl_test.go +++ b/modules/entertainment/xxl_test.go @@ -69,6 +69,10 @@ func NewService(ops ...rpcx.Option) core.IService { func Test_Main(t *testing.T) { + m := new(entertainment.MapData) + m.InitMap() + + m.SwapGirde(0, 1) flag.Parse() s := NewService( rpcx.SetConfPath(*conf), diff --git a/modules/entertainment/xxlmap.go b/modules/entertainment/xxlmap.go index 50d868f58..22d46b1f4 100644 --- a/modules/entertainment/xxlmap.go +++ b/modules/entertainment/xxlmap.go @@ -93,7 +93,7 @@ func (this *MapData) InitMap() { } } } - + // 测试地图数据 sz2 := []int32{ 5, 1, 3, 5, 1, 5, 2, 3, 1, 5, 4, 2, 4, 4, @@ -126,28 +126,26 @@ func (this *MapData) SwapGirde(i, j int32) bool { return bSwap } // 校验是不是挨着的 - if g1.X-1 == g2.X { + if g1.X-1 == g2.X || g1.X+1 == g2.X || g1.Y+1 == g2.Y || g1.Y-1 == g2.Y { bSwap = true + // 更新地图数据 + tmp = &pb.GirdeData{ + X: g1.X, + Y: g1.Y, + Id: g1.Id, + Itype: g1.Itype, + Cid: g1.Cid, + Score: g1.Score, + } + this.Data[i] = g2 + this.Data[j] = tmp + if !this.CheckSwape() { // 交换后不能消除 + this.Data[i] = tmp + this.Data[j] = g2 + bSwap = false + } } - if g1.X+1 == g2.X { - bSwap = true - } - if g1.Y+1 == g2.Y { - bSwap = true - } - if g1.Y-1 == g2.Y { - bSwap = true - } - // 更新地图数据 - tmp = &pb.GirdeData{ - X: g1.X, - Y: g1.Y, - Id: g1.Id, - Itype: g1.Itype, - } - this.Data[i] = g2 - this.Data[j] = tmp - //this.Debugf() + return bSwap } @@ -314,6 +312,35 @@ func (this *MapData) Check3X() (bEliminate bool, score int32) { return } +func (this *MapData) CheckSwape() (bEliminate bool) { + + for i := 0; i < Width; i++ { + for j := 0; j < Height; j++ { + key := int32(i*10 + j) + iType := this.GetKeyType(key) + if iType == 0 { + continue + } + if j+2 < Height { + i1 := this.Data[int32((i+1)*10+j)] + i2 := this.Data[int32((i+2)*10+j)] + if i1.Itype == i2.Itype && i1.Itype == iType { + return true + } + } + if i+2 < Width { + i1 := this.Data[int32(i*10+j+1)] + i2 := this.Data[int32(i*10+j+2)] + if i1.Itype == i2.Itype && i1.Itype == iType { + return true + } + } + } + } + + return +} + // 校验地图可消除的 判断各组上面2个和右边两个是否三个相等 func (this *MapData) CheckMap() (bEliminate bool, score int32) { if bRet, s := this.Check5X(); !bRet { @@ -365,3 +392,39 @@ func (this *MapData) DropGirde() { //this.Debugf() return } + +// func (this *MapData) AiOperator() bool { +// var ( +// bSwap bool // 能否交换 +// tmp *pb.GirdeData +// ) +// g1 := this.GetKeyData(i) +// g2 := this.GetKeyData(j) +// if g1 == nil || g2 == nil { +// return bSwap +// } +// // 校验是不是挨着的 +// if g1.X-1 == g2.X { +// bSwap = true +// } +// if g1.X+1 == g2.X { +// bSwap = true +// } +// if g1.Y+1 == g2.Y { +// bSwap = true +// } +// if g1.Y-1 == g2.Y { +// bSwap = true +// } +// // 更新地图数据 +// tmp = &pb.GirdeData{ +// X: g1.X, +// Y: g1.Y, +// Id: g1.Id, +// Itype: g1.Itype, +// } +// this.Data[i] = g2 +// this.Data[j] = tmp +// //this.Debugf() +// return bSwap +// } diff --git a/pb/entertain_db.pb.go b/pb/entertain_db.pb.go index a14a81b08..1281c8f6a 100644 --- a/pb/entertain_db.pb.go +++ b/pb/entertain_db.pb.go @@ -161,10 +161,11 @@ type PlayerData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` // 昵称 - Score int32 `protobuf:"varint,3,opt,name=score,proto3" json:"score"` // 积分 - Ps int32 `protobuf:"varint,4,opt,name=ps,proto3" json:"ps"` // 体力 + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` // 昵称 + Score int32 `protobuf:"varint,3,opt,name=score,proto3" json:"score"` // 积分 + Ps int32 `protobuf:"varint,4,opt,name=ps,proto3" json:"ps"` // 体力 + Cardid string `protobuf:"bytes,5,opt,name=cardid,proto3" json:"cardid"` // 出战的英雄卡 } func (x *PlayerData) Reset() { @@ -227,6 +228,13 @@ func (x *PlayerData) GetPs() int32 { return 0 } +func (x *PlayerData) GetCardid() string { + if x != nil { + return x.Cardid + } + return "" +} + var File_entertain_entertain_db_proto protoreflect.FileDescriptor var file_entertain_entertain_db_proto_rawDesc = []byte{ @@ -246,14 +254,15 @@ var file_entertain_entertain_db_proto_rawDesc = []byte{ 0x14, 0x0a, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x58, 0x0a, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x70, 0x0a, 0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 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, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x70, 0x73, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x02, 0x70, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x28, 0x05, 0x52, 0x02, 0x70, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/entertain_msg.pb.go b/pb/entertain_msg.pb.go index 84073185a..5b5217bdb 100644 --- a/pb/entertain_msg.pb.go +++ b/pb/entertain_msg.pb.go @@ -25,6 +25,8 @@ type EntertainMatchReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Idcard string `protobuf:"bytes,1,opt,name=idcard,proto3" json:"idcard"` //出战的英雄卡 } func (x *EntertainMatchReq) Reset() { @@ -59,6 +61,13 @@ func (*EntertainMatchReq) Descriptor() ([]byte, []int) { return file_entertain_entertain_msg_proto_rawDescGZIP(), []int{0} } +func (x *EntertainMatchReq) GetIdcard() string { + if x != nil { + return x.Idcard + } + return "" +} + // 匹配结果 type EntertainMatchResp struct { state protoimpl.MessageState @@ -473,56 +482,57 @@ var file_entertain_entertain_msg_proto_rawDesc = []byte{ 0x0a, 0x1d, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x2f, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x2f, 0x65, 0x6e, 0x74, 0x65, 0x72, - 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x13, 0x0a, + 0x74, 0x61, 0x69, 0x6e, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x11, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, - 0x65, 0x71, 0x22, 0x4f, 0x0a, 0x12, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4d, - 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x79, 0x63, - 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x61, 0x79, 0x63, 0x68, 0x12, 0x23, - 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, - 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x06, 0x70, 0x6c, 0x61, - 0x79, 0x65, 0x72, 0x22, 0xae, 0x01, 0x0a, 0x16, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, - 0x6e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x47, 0x61, 0x6d, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, - 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, - 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, - 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, - 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, - 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, - 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x76, 0x0a, 0x14, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, - 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 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, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, - 0x72, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, - 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x69, 0x64, 0x22, 0x31, 0x0a, 0x15, - 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, - 0x80, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x73, 0x74, 0x50, 0x75, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x07, - 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x64, 0x63, 0x61, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x63, 0x61, 0x72, 0x64, 0x22, 0x4f, 0x0a, 0x12, 0x45, 0x6e, + 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x79, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x05, 0x6d, 0x61, 0x79, 0x63, 0x68, 0x12, 0x23, 0x0a, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, + 0x61, 0x74, 0x61, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x22, 0xae, 0x01, 0x0a, 0x16, + 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x47, 0x61, + 0x6d, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, + 0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, + 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, - 0x6e, 0x64, 0x22, 0xad, 0x01, 0x0a, 0x15, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, - 0x47, 0x61, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, - 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, - 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, - 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, - 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, - 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, - 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, - 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, - 0x6e, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x76, 0x0a, 0x14, + 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, + 0x72, 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, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x63, 0x75, 0x72, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x69, 0x64, 0x22, 0x31, 0x0a, 0x15, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, + 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, + 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x80, 0x01, 0x0a, 0x18, 0x45, 0x6e, 0x74, 0x65, + 0x72, 0x74, 0x61, 0x69, 0x6e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x52, 0x73, 0x74, + 0x50, 0x75, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, + 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, + 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, + 0x63, 0x6f, 0x72, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0xad, 0x01, 0x0a, 0x15, 0x45, + 0x6e, 0x74, 0x65, 0x72, 0x74, 0x61, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x4f, 0x76, 0x65, 0x72, + 0x50, 0x75, 0x73, 0x68, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, + 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x31, 0x12, 0x21, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, + 0x61, 0x74, 0x61, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x32, 0x12, 0x22, 0x0a, 0x07, 0x6d, 0x70, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x4d, 0x61, + 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x6d, 0x70, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, + 0x0a, 0x05, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, + 0x6f, 0x77, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/services/worker/main.go b/services/worker/main.go index 91e3ce9ad..2deb7b44e 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -20,6 +20,7 @@ import ( "go_dreamfactory/modules/dispatch" "go_dreamfactory/modules/dragon" "go_dreamfactory/modules/enchant" + "go_dreamfactory/modules/entertainment" "go_dreamfactory/modules/equipment" "go_dreamfactory/modules/forum" "go_dreamfactory/modules/friend" @@ -165,7 +166,7 @@ func main() { venture.NewModule(), achieve.NewModule(), jielong.NewModule(), - //entertainment.NewModule(), + entertainment.NewModule(), ) }