Browse Source

game start with 3 texas types

master
tangmingyou 4 years ago
parent
commit
0ab7666786
  1. 5
      api/operation.go
  2. 467
      api/poker.pb.go
  3. 22
      api/poker.proto
  4. 880
      api/proto.js
  5. 5
      internal/game/game.go
  6. 20
      internal/game/player.go
  7. 59
      internal/game/table.go
  8. 177
      internal/service/table.go

5
api/operation.go

@ -47,12 +47,11 @@ var protoInstances = []proto.Message{
&ResDismissGameTable{},
&ReqGameStart{},
&ResBigBlindChip{},
&ResSmallBlindChip{},
&ReqPlaceBetChip{},
&ReqBetWeakHand{},
&ReqBetDiscard{},
&ResNoticePlayerLine{},
}
var (

467
api/poker.pb.go

@ -644,8 +644,10 @@ type ReqCreateTable struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Players int32 `protobuf:"varint,1,opt,name=players,proto3" json:"players,omitempty"`
Robots int32 `protobuf:"varint,2,opt,name=robots,proto3" json:"robots,omitempty"`
Players int32 `protobuf:"varint,1,opt,name=players,proto3" json:"players,omitempty"`
Robots int32 `protobuf:"varint,2,opt,name=robots,proto3" json:"robots,omitempty"`
TexasType int32 `protobuf:"varint,3,opt,name=texasType,proto3" json:"texasType,omitempty"` // 游戏类型
BigBlind int32 `protobuf:"varint,4,opt,name=bigBlind,proto3" json:"bigBlind,omitempty"` // 大盲注额
}
func (x *ReqCreateTable) Reset() {
@ -694,6 +696,20 @@ func (x *ReqCreateTable) GetRobots() int32 {
return 0
}
func (x *ReqCreateTable) GetTexasType() int32 {
if x != nil {
return x.TexasType
}
return 0
}
func (x *ReqCreateTable) GetBigBlind() int32 {
if x != nil {
return x.BigBlind
}
return 0
}
type ResCreateTable struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -1249,15 +1265,16 @@ type TablePlayer struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Robot bool `protobuf:"varint,1,opt,name=robot,proto3" json:"robot,omitempty"` // 是否机器人
Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"`
Chip int32 `protobuf:"varint,5,opt,name=chip,proto3" json:"chip,omitempty"` // 筹码
Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` // 玩家状态: 1待准备开始,2已准备开始,已开始(3等待其他玩家动作,4待大盲注,5待小盲注,6待跟注,7已弃)
LastStatus int32 `protobuf:"varint,7,opt,name=lastStatus,proto3" json:"lastStatus,omitempty"` // TODO 删, 前端通过消息监听获取下注金额信息
Master bool `protobuf:"varint,8,opt,name=master,proto3" json:"master,omitempty"` // 是否房主`
HandCard []*Card `protobuf:"bytes,15,rep,name=handCard,proto3" json:"handCard,omitempty"` // 手牌
Robot bool `protobuf:"varint,1,opt,name=robot,proto3" json:"robot,omitempty"` // 是否机器人
Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
Avatar string `protobuf:"bytes,4,opt,name=avatar,proto3" json:"avatar,omitempty"`
Chip int32 `protobuf:"varint,5,opt,name=chip,proto3" json:"chip,omitempty"` // 筹码
Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` // 玩家状态: 1待准备开始,2已准备开始,已开始(3等待其他玩家动作,4待大盲注,5待小盲注,6待跟注,7已弃)
LastStatus int32 `protobuf:"varint,7,opt,name=lastStatus,proto3" json:"lastStatus,omitempty"` // TODO 删, 前端通过消息监听获取下注金额信息
Master bool `protobuf:"varint,8,opt,name=master,proto3" json:"master,omitempty"` // 是否房主`
BetRole *BetRole `protobuf:"bytes,14,opt,name=betRole,proto3" json:"betRole,omitempty"` // 下注时规则限制
HandCard []*Card `protobuf:"bytes,15,rep,name=handCard,proto3" json:"handCard,omitempty"` // 手牌
}
func (x *TablePlayer) Reset() {
@ -1348,6 +1365,13 @@ func (x *TablePlayer) GetMaster() bool {
return false
}
func (x *TablePlayer) GetBetRole() *BetRole {
if x != nil {
return x.BetRole
}
return nil
}
func (x *TablePlayer) GetHandCard() []*Card {
if x != nil {
return x.HandCard
@ -1410,15 +1434,18 @@ func (x *Card) GetSuit() string {
return ""
}
// 开始游戏
type ReqGameStart struct {
// player status in (4,6) 跟注时规则
type BetRole struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
MinChip int32 `protobuf:"varint,1,opt,name=minChip,proto3" json:"minChip,omitempty"` // 最低下注额:小盲注加注(按惯例至少2倍与大盲注)
MaxChip int32 `protobuf:"varint,2,opt,name=maxChip,proto3" json:"maxChip,omitempty"` // 最高下注额:
}
func (x *ReqGameStart) Reset() {
*x = ReqGameStart{}
func (x *BetRole) Reset() {
*x = BetRole{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1426,13 +1453,13 @@ func (x *ReqGameStart) Reset() {
}
}
func (x *ReqGameStart) String() string {
func (x *BetRole) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReqGameStart) ProtoMessage() {}
func (*BetRole) ProtoMessage() {}
func (x *ReqGameStart) ProtoReflect() protoreflect.Message {
func (x *BetRole) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[25]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1444,85 +1471,49 @@ func (x *ReqGameStart) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use ReqGameStart.ProtoReflect.Descriptor instead.
func (*ReqGameStart) Descriptor() ([]byte, []int) {
// Deprecated: Use BetRole.ProtoReflect.Descriptor instead.
func (*BetRole) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{25}
}
// 扣除大盲注
type ResBigBlindChip struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Chip int32 `protobuf:"varint,1,opt,name=chip,proto3" json:"chip,omitempty"`
}
func (x *ResBigBlindChip) Reset() {
*x = ResBigBlindChip{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResBigBlindChip) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResBigBlindChip) ProtoMessage() {}
func (x *ResBigBlindChip) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[26]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
func (x *BetRole) GetMinChip() int32 {
if x != nil {
return x.MinChip
}
return mi.MessageOf(x)
}
// Deprecated: Use ResBigBlindChip.ProtoReflect.Descriptor instead.
func (*ResBigBlindChip) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{26}
return 0
}
func (x *ResBigBlindChip) GetChip() int32 {
func (x *BetRole) GetMaxChip() int32 {
if x != nil {
return x.Chip
return x.MaxChip
}
return 0
}
// 扣除小盲注消息, 然后发牌
type ResSmallBlindChip struct {
// 开始游戏
type ReqGameStart struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Chip int32 `protobuf:"varint,1,opt,name=chip,proto3" json:"chip,omitempty"`
}
func (x *ResSmallBlindChip) Reset() {
*x = ResSmallBlindChip{}
func (x *ReqGameStart) Reset() {
*x = ReqGameStart{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[27]
mi := &file_poker_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResSmallBlindChip) String() string {
func (x *ReqGameStart) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResSmallBlindChip) ProtoMessage() {}
func (*ReqGameStart) ProtoMessage() {}
func (x *ResSmallBlindChip) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[27]
func (x *ReqGameStart) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[26]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1533,16 +1524,9 @@ func (x *ResSmallBlindChip) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use ResSmallBlindChip.ProtoReflect.Descriptor instead.
func (*ResSmallBlindChip) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{27}
}
func (x *ResSmallBlindChip) GetChip() int32 {
if x != nil {
return x.Chip
}
return 0
// Deprecated: Use ReqGameStart.ProtoReflect.Descriptor instead.
func (*ReqGameStart) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{26}
}
// 解散房间
@ -1555,7 +1539,7 @@ type ReqDismissGameTable struct {
func (x *ReqDismissGameTable) Reset() {
*x = ReqDismissGameTable{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[28]
mi := &file_poker_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1568,7 +1552,7 @@ func (x *ReqDismissGameTable) String() string {
func (*ReqDismissGameTable) ProtoMessage() {}
func (x *ReqDismissGameTable) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[28]
mi := &file_poker_proto_msgTypes[27]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1581,7 +1565,7 @@ func (x *ReqDismissGameTable) ProtoReflect() protoreflect.Message {
// Deprecated: Use ReqDismissGameTable.ProtoReflect.Descriptor instead.
func (*ReqDismissGameTable) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{28}
return file_poker_proto_rawDescGZIP(), []int{27}
}
type ResDismissGameTable struct {
@ -1593,7 +1577,7 @@ type ResDismissGameTable struct {
func (x *ResDismissGameTable) Reset() {
*x = ResDismissGameTable{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[29]
mi := &file_poker_proto_msgTypes[28]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1606,7 +1590,7 @@ func (x *ResDismissGameTable) String() string {
func (*ResDismissGameTable) ProtoMessage() {}
func (x *ResDismissGameTable) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[29]
mi := &file_poker_proto_msgTypes[28]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1619,7 +1603,7 @@ func (x *ResDismissGameTable) ProtoReflect() protoreflect.Message {
// Deprecated: Use ResDismissGameTable.ProtoReflect.Descriptor instead.
func (*ResDismissGameTable) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{29}
return file_poker_proto_rawDescGZIP(), []int{28}
}
// 下注
@ -1628,13 +1612,14 @@ type ReqPlaceBetChip struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Chip int32 `protobuf:"varint,1,opt,name=chip,proto3" json:"chip,omitempty"`
BetChip int32 `protobuf:"varint,1,opt,name=betChip,proto3" json:"betChip,omitempty"` // 跟注/加注金额
AllIn bool `protobuf:"varint,2,opt,name=allIn,proto3" json:"allIn,omitempty"` // 是否 allIn
}
func (x *ReqPlaceBetChip) Reset() {
*x = ReqPlaceBetChip{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[30]
mi := &file_poker_proto_msgTypes[29]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1647,7 +1632,7 @@ func (x *ReqPlaceBetChip) String() string {
func (*ReqPlaceBetChip) ProtoMessage() {}
func (x *ReqPlaceBetChip) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[30]
mi := &file_poker_proto_msgTypes[29]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1660,16 +1645,23 @@ func (x *ReqPlaceBetChip) ProtoReflect() protoreflect.Message {
// Deprecated: Use ReqPlaceBetChip.ProtoReflect.Descriptor instead.
func (*ReqPlaceBetChip) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{30}
return file_poker_proto_rawDescGZIP(), []int{29}
}
func (x *ReqPlaceBetChip) GetChip() int32 {
func (x *ReqPlaceBetChip) GetBetChip() int32 {
if x != nil {
return x.Chip
return x.BetChip
}
return 0
}
func (x *ReqPlaceBetChip) GetAllIn() bool {
if x != nil {
return x.AllIn
}
return false
}
// 让牌
type ReqBetWeakHand struct {
state protoimpl.MessageState
@ -1680,7 +1672,7 @@ type ReqBetWeakHand struct {
func (x *ReqBetWeakHand) Reset() {
*x = ReqBetWeakHand{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[31]
mi := &file_poker_proto_msgTypes[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1693,7 +1685,7 @@ func (x *ReqBetWeakHand) String() string {
func (*ReqBetWeakHand) ProtoMessage() {}
func (x *ReqBetWeakHand) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[31]
mi := &file_poker_proto_msgTypes[30]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1706,7 +1698,7 @@ func (x *ReqBetWeakHand) ProtoReflect() protoreflect.Message {
// Deprecated: Use ReqBetWeakHand.ProtoReflect.Descriptor instead.
func (*ReqBetWeakHand) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{31}
return file_poker_proto_rawDescGZIP(), []int{30}
}
// 弃牌
@ -1719,7 +1711,7 @@ type ReqBetDiscard struct {
func (x *ReqBetDiscard) Reset() {
*x = ReqBetDiscard{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[32]
mi := &file_poker_proto_msgTypes[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -1732,7 +1724,7 @@ func (x *ReqBetDiscard) String() string {
func (*ReqBetDiscard) ProtoMessage() {}
func (x *ReqBetDiscard) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[32]
mi := &file_poker_proto_msgTypes[31]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -1745,9 +1737,81 @@ func (x *ReqBetDiscard) ProtoReflect() protoreflect.Message {
// Deprecated: Use ReqBetDiscard.ProtoReflect.Descriptor instead.
func (*ReqBetDiscard) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{31}
}
// 通知玩家某个其他玩家动作
type ResNoticePlayerLine struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
PlayerId int64 `protobuf:"varint,1,opt,name=playerId,proto3" json:"playerId,omitempty"`
Line1 string `protobuf:"bytes,11,opt,name=line1,proto3" json:"line1,omitempty"`
Line2 string `protobuf:"bytes,12,opt,name=line2,proto3" json:"line2,omitempty"`
Line3 string `protobuf:"bytes,13,opt,name=line3,proto3" json:"line3,omitempty"`
}
func (x *ResNoticePlayerLine) Reset() {
*x = ResNoticePlayerLine{}
if protoimpl.UnsafeEnabled {
mi := &file_poker_proto_msgTypes[32]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResNoticePlayerLine) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResNoticePlayerLine) ProtoMessage() {}
func (x *ResNoticePlayerLine) ProtoReflect() protoreflect.Message {
mi := &file_poker_proto_msgTypes[32]
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 ResNoticePlayerLine.ProtoReflect.Descriptor instead.
func (*ResNoticePlayerLine) Descriptor() ([]byte, []int) {
return file_poker_proto_rawDescGZIP(), []int{32}
}
func (x *ResNoticePlayerLine) GetPlayerId() int64 {
if x != nil {
return x.PlayerId
}
return 0
}
func (x *ResNoticePlayerLine) GetLine1() string {
if x != nil {
return x.Line1
}
return ""
}
func (x *ResNoticePlayerLine) GetLine2() string {
if x != nil {
return x.Line2
}
return ""
}
func (x *ResNoticePlayerLine) GetLine3() string {
if x != nil {
return x.Line3
}
return ""
}
var File_poker_proto protoreflect.FileDescriptor
var file_poker_proto_rawDesc = []byte{
@ -1795,85 +1859,99 @@ var file_poker_proto_rawDesc = []byte{
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65,
0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65,
0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x42, 0x0a,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x7c, 0x0a,
0x0e, 0x52, 0x65, 0x71, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12,
0x18, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x6f, 0x62,
0x6f, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x72, 0x6f, 0x62, 0x6f, 0x74,
0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x52, 0x65, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61,
0x62, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x22, 0x28, 0x0a,
0x0c, 0x52, 0x65, 0x71, 0x4a, 0x6f, 0x69, 0x6e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x18, 0x0a,
0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x65, 0x78, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03,
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x74, 0x65, 0x78, 0x61, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x62, 0x69, 0x67, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
0x05, 0x52, 0x08, 0x62, 0x69, 0x67, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x22, 0x2a, 0x0a, 0x0e, 0x52,
0x65, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x4c, 0x65,
0x61, 0x76, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x52,
0x65, 0x61, 0x64, 0x79, 0x53, 0x74, 0x61, 0x72, 0x74, 0x22, 0x10, 0x0a, 0x0e, 0x52, 0x65, 0x71,
0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x22, 0x2d, 0x0a, 0x0f, 0x52,
0x65, 0x71, 0x4b, 0x69, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1a,
0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x22, 0x11, 0x0a, 0x0f, 0x52, 0x65,
0x73, 0x4b, 0x69, 0x63, 0x6b, 0x4f, 0x75, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x3b, 0x0a,
0x0d, 0x52, 0x65, 0x71, 0x47, 0x61, 0x6d, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16,
0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x68, 0x69, 0x70, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x68, 0x69, 0x70, 0x22, 0x0f, 0x0a, 0x0d, 0x52, 0x65,
0x73, 0x47, 0x61, 0x6d, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52,
0x65, 0x71, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x75, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x22, 0xd2, 0x02, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x75, 0x6c, 0x6c,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x18,
0x0a, 0x07, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x07, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x61, 0x6d, 0x65,
0x53, 0x74, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x67, 0x61, 0x6d,
0x65, 0x53, 0x74, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x68, 0x69, 0x70, 0x18, 0x04,
0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x68, 0x69, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x6f,
0x75, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
0x72, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x67, 0x42, 0x6c, 0x69,
0x6e, 0x64, 0x50, 0x6f, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x69, 0x67,
0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x6f, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x6d, 0x61, 0x6c,
0x6c, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x6f, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0d, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x6f, 0x73, 0x12, 0x29,
0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, 0x61, 0x72, 0x64, 0x18, 0x0e, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x52, 0x0a, 0x70,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x43, 0x61, 0x72, 0x64, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x6c, 0x61,
0x79, 0x65, 0x72, 0x73, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x07, 0x70, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x73, 0x22, 0xf2, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x50,
0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75,
0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75,
0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61,
0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12,
0x12, 0x0a, 0x04, 0x63, 0x68, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63,
0x68, 0x69, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20,
0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6c,
0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0a, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d,
0x61, 0x73, 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6d, 0x61, 0x73,
0x74, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x08, 0x68, 0x61, 0x6e, 0x64, 0x43, 0x61, 0x72, 0x64, 0x18,
0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x61, 0x72, 0x64,
0x52, 0x08, 0x68, 0x61, 0x6e, 0x64, 0x43, 0x61, 0x72, 0x64, 0x22, 0x2c, 0x0a, 0x04, 0x43, 0x61,
0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x64, 0x6f, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x75, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x73, 0x75, 0x69, 0x74, 0x22, 0x0e, 0x0a, 0x0c, 0x52, 0x65, 0x71, 0x47,
0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x22, 0x25, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x42,
0x69, 0x67, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x43, 0x68, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63,
0x68, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x68, 0x69, 0x70, 0x22,
0x27, 0x0a, 0x11, 0x52, 0x65, 0x73, 0x53, 0x6d, 0x61, 0x6c, 0x6c, 0x42, 0x6c, 0x69, 0x6e, 0x64,
0x43, 0x68, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x68, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x63, 0x68, 0x69, 0x70, 0x22, 0x15, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x44,
0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x22,
0x15, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x47, 0x61, 0x6d,
0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x25, 0x0a, 0x0f, 0x52, 0x65, 0x71, 0x50, 0x6c, 0x61,
0x63, 0x65, 0x42, 0x65, 0x74, 0x43, 0x68, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x68, 0x69,
0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x68, 0x69, 0x70, 0x22, 0x10, 0x0a,
0x0e, 0x52, 0x65, 0x71, 0x42, 0x65, 0x74, 0x57, 0x65, 0x61, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x22,
0x0f, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x42, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64,
0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x22, 0x28, 0x0a, 0x0c, 0x52, 0x65, 0x71, 0x4a, 0x6f,
0x69, 0x6e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x62, 0x6c, 0x65,
0x4e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e,
0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x54, 0x61, 0x62,
0x6c, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x52, 0x65, 0x61, 0x64, 0x79, 0x53, 0x74,
0x61, 0x72, 0x74, 0x22, 0x10, 0x0a, 0x0e, 0x52, 0x65, 0x71, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c,
0x52, 0x65, 0x61, 0x64, 0x79, 0x22, 0x2d, 0x0a, 0x0f, 0x52, 0x65, 0x71, 0x4b, 0x69, 0x63, 0x6b,
0x4f, 0x75, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x49, 0x64, 0x22, 0x11, 0x0a, 0x0f, 0x52, 0x65, 0x73, 0x4b, 0x69, 0x63, 0x6b, 0x4f,
0x75, 0x74, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x3b, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x47, 0x61,
0x6d, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x12, 0x0a, 0x04, 0x63, 0x68, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
0x63, 0x68, 0x69, 0x70, 0x22, 0x0f, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x47, 0x61, 0x6d, 0x65, 0x41,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x71, 0x47, 0x61, 0x6d, 0x65,
0x46, 0x75, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xd2, 0x02, 0x0a, 0x11, 0x52,
0x65, 0x73, 0x47, 0x61, 0x6d, 0x65, 0x46, 0x75, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
0x52, 0x06, 0x69, 0x6e, 0x47, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x62, 0x6c,
0x65, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x62, 0x6c, 0x65,
0x4e, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x67, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x67, 0x65, 0x18,
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x67, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x67, 0x65,
0x12, 0x12, 0x0a, 0x04, 0x63, 0x68, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04,
0x63, 0x68, 0x69, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x54,
0x69, 0x6d, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64,
0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64,
0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x67, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x6f, 0x73, 0x18,
0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x69, 0x67, 0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50,
0x6f, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x42, 0x6c, 0x69, 0x6e, 0x64,
0x50, 0x6f, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x73, 0x6d, 0x61, 0x6c, 0x6c,
0x42, 0x6c, 0x69, 0x6e, 0x64, 0x50, 0x6f, 0x73, 0x12, 0x29, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c,
0x69, 0x63, 0x43, 0x61, 0x72, 0x64, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x61,
0x70, 0x69, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x52, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x43,
0x61, 0x72, 0x64, 0x12, 0x2a, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x0f,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65,
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x22,
0x9a, 0x02, 0x0a, 0x0b, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12,
0x14, 0x0a, 0x05, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05,
0x72, 0x6f, 0x62, 0x6f, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x68, 0x69,
0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x68, 0x69, 0x70, 0x12, 0x16, 0x0a,
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x18,
0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x12, 0x26, 0x0a,
0x07, 0x62, 0x65, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x65, 0x74, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x07, 0x62, 0x65,
0x74, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x25, 0x0a, 0x08, 0x68, 0x61, 0x6e, 0x64, 0x43, 0x61, 0x72,
0x64, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x61,
0x72, 0x64, 0x52, 0x08, 0x68, 0x61, 0x6e, 0x64, 0x43, 0x61, 0x72, 0x64, 0x22, 0x2c, 0x0a, 0x04,
0x43, 0x61, 0x72, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x03, 0x64, 0x6f, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x75, 0x69, 0x74, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x73, 0x75, 0x69, 0x74, 0x22, 0x3d, 0x0a, 0x07, 0x42, 0x65,
0x74, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x43, 0x68, 0x69, 0x70,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x43, 0x68, 0x69, 0x70, 0x12,
0x18, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x43, 0x68, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x6d, 0x61, 0x78, 0x43, 0x68, 0x69, 0x70, 0x22, 0x0e, 0x0a, 0x0c, 0x52, 0x65, 0x71,
0x47, 0x61, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x52, 0x65, 0x71,
0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65,
0x22, 0x15, 0x0a, 0x13, 0x52, 0x65, 0x73, 0x44, 0x69, 0x73, 0x6d, 0x69, 0x73, 0x73, 0x47, 0x61,
0x6d, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x41, 0x0a, 0x0f, 0x52, 0x65, 0x71, 0x50, 0x6c,
0x61, 0x63, 0x65, 0x42, 0x65, 0x74, 0x43, 0x68, 0x69, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x65,
0x74, 0x43, 0x68, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x62, 0x65, 0x74,
0x43, 0x68, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x18, 0x02, 0x20,
0x01, 0x28, 0x08, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x49, 0x6e, 0x22, 0x10, 0x0a, 0x0e, 0x52, 0x65,
0x71, 0x42, 0x65, 0x74, 0x57, 0x65, 0x61, 0x6b, 0x48, 0x61, 0x6e, 0x64, 0x22, 0x0f, 0x0a, 0x0d,
0x52, 0x65, 0x71, 0x42, 0x65, 0x74, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x22, 0x73, 0x0a,
0x13, 0x52, 0x65, 0x73, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x4c, 0x69, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64,
0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x65, 0x31, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x6c, 0x69, 0x6e, 0x65, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x65, 0x32, 0x18,
0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x65, 0x32, 0x12, 0x14, 0x0a, 0x05,
0x6c, 0x69, 0x6e, 0x65, 0x33, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x69, 0x6e,
0x65, 0x33, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1915,26 +1993,27 @@ var file_poker_proto_goTypes = []interface{}{
(*ResGameFullStatus)(nil), // 22: api.ResGameFullStatus
(*TablePlayer)(nil), // 23: api.TablePlayer
(*Card)(nil), // 24: api.Card
(*ReqGameStart)(nil), // 25: api.ReqGameStart
(*ResBigBlindChip)(nil), // 26: api.ResBigBlindChip
(*ResSmallBlindChip)(nil), // 27: api.ResSmallBlindChip
(*ReqDismissGameTable)(nil), // 28: api.ReqDismissGameTable
(*ResDismissGameTable)(nil), // 29: api.ResDismissGameTable
(*ReqPlaceBetChip)(nil), // 30: api.ReqPlaceBetChip
(*ReqBetWeakHand)(nil), // 31: api.ReqBetWeakHand
(*ReqBetDiscard)(nil), // 32: api.ReqBetDiscard
(*BetRole)(nil), // 25: api.BetRole
(*ReqGameStart)(nil), // 26: api.ReqGameStart
(*ReqDismissGameTable)(nil), // 27: api.ReqDismissGameTable
(*ResDismissGameTable)(nil), // 28: api.ResDismissGameTable
(*ReqPlaceBetChip)(nil), // 29: api.ReqPlaceBetChip
(*ReqBetWeakHand)(nil), // 30: api.ReqBetWeakHand
(*ReqBetDiscard)(nil), // 31: api.ReqBetDiscard
(*ResNoticePlayerLine)(nil), // 32: api.ResNoticePlayerLine
}
var file_poker_proto_depIdxs = []int32{
9, // 0: api.ResLobbyView.tables:type_name -> api.LobbyTable
10, // 1: api.LobbyTable.players:type_name -> api.LobbyPlayer
24, // 2: api.ResGameFullStatus.publicCard:type_name -> api.Card
23, // 3: api.ResGameFullStatus.players:type_name -> api.TablePlayer
24, // 4: api.TablePlayer.handCard:type_name -> api.Card
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
25, // 4: api.TablePlayer.betRole:type_name -> api.BetRole
24, // 5: api.TablePlayer.handCard:type_name -> api.Card
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
}
func init() { file_poker_proto_init() }
@ -2244,7 +2323,7 @@ func file_poker_proto_init() {
}
}
file_poker_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReqGameStart); i {
switch v := v.(*BetRole); i {
case 0:
return &v.state
case 1:
@ -2256,7 +2335,7 @@ func file_poker_proto_init() {
}
}
file_poker_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResBigBlindChip); i {
switch v := v.(*ReqGameStart); i {
case 0:
return &v.state
case 1:
@ -2268,7 +2347,7 @@ func file_poker_proto_init() {
}
}
file_poker_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResSmallBlindChip); i {
switch v := v.(*ReqDismissGameTable); i {
case 0:
return &v.state
case 1:
@ -2280,7 +2359,7 @@ func file_poker_proto_init() {
}
}
file_poker_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReqDismissGameTable); i {
switch v := v.(*ResDismissGameTable); i {
case 0:
return &v.state
case 1:
@ -2292,7 +2371,7 @@ func file_poker_proto_init() {
}
}
file_poker_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResDismissGameTable); i {
switch v := v.(*ReqPlaceBetChip); i {
case 0:
return &v.state
case 1:
@ -2304,7 +2383,7 @@ func file_poker_proto_init() {
}
}
file_poker_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReqPlaceBetChip); i {
switch v := v.(*ReqBetWeakHand); i {
case 0:
return &v.state
case 1:
@ -2316,7 +2395,7 @@ func file_poker_proto_init() {
}
}
file_poker_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReqBetWeakHand); i {
switch v := v.(*ReqBetDiscard); i {
case 0:
return &v.state
case 1:
@ -2328,7 +2407,7 @@ func file_poker_proto_init() {
}
}
file_poker_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReqBetDiscard); i {
switch v := v.(*ResNoticePlayerLine); i {
case 0:
return &v.state
case 1:

22
api/poker.proto

@ -75,6 +75,8 @@ message LobbyPlayer {
message ReqCreateTable {
int32 players = 1;
int32 robots = 2;
int32 texasType = 3; //
int32 bigBlind = 4; //
}
message ResCreateTable {
@ -169,16 +171,6 @@ message ReqGameStart {
}
//
message ResBigBlindChip {
int32 chip = 1;
}
// ,
message ResSmallBlindChip {
int32 chip = 1;
}
//
message ReqDismissGameTable {
}
@ -189,6 +181,7 @@ message ResDismissGameTable {
message ReqPlaceBetChip {
int32 betChip = 1; // /
bool allIn = 2; // allIn
}
//
@ -200,3 +193,12 @@ message ReqBetWeakHand {
message ReqBetDiscard {
}
//
message ResNoticePlayerLine {
int64 playerId = 1;
string line1 = 11;
string line2 = 12;
string line3 = 13;
}

880
api/proto.js

File diff suppressed because it is too large Load Diff

5
internal/game/game.go

@ -5,11 +5,6 @@ import (
"sync"
)
const (
BigBlindChip int32 = 2 // 大盲注金额
SmallBlinds int32 = BigBlindChip / 2 // 小盲注金额
)
// Dealer 发牌员, 有打乱的一副牌
type Dealer struct {
// 一副牌

20
internal/game/player.go

@ -7,14 +7,18 @@ import (
// Player 游戏玩家
type Player struct {
Id int64
Username string
Avatar string
Cards [2]*Card // 手牌
Chip int32 // 玩家筹码
RoundChip int32 // 该回合已下注筹码
Status int32 // 状态: 1待准备开始,2已准备开始,3等待其他玩家动作,4第一回合小盲注跟注, [5待大盲注,5待小盲注,] 6待跟注,7已弃牌
LastStatus int32 // 变化前一个状态
Id int64
Username string
Avatar string
Cards [2]*Card // 手牌
Chip int32 // 玩家筹码
RoundChip int32 // 该回合已下注筹码
Status int32 // 状态: 1待准备开始,2已准备开始,3等待其他玩家动作,4第一回合小盲注跟注, [5待大盲注,5待小盲注,] 6待跟注,7已弃牌
LastStatus int32 // 变化前一个状态
BetOpts []int32 // status=[4,6]时下注可操作按钮: 1跟注,2加注(-[0]+),3All-In,4弃牌,5过牌
BetMin int32 // 最低下注额
BetMax int32 // 最高下注额 -1不限
RoundBetTimes int32 // 当前回合下注次数
GameTable *Table // 当前牌桌
ProtoWriter letter.ProtoWriter

59
internal/game/table.go

@ -2,6 +2,7 @@ package game
import (
"errors"
"github.com/golang/protobuf/proto"
"sync"
"texas-poker-bk/api"
"texas-poker-bk/tool/collect"
@ -18,20 +19,36 @@ type Table struct {
Dealer *Dealer // 发牌员
PublicCards [5]*Card // 公共牌
PlayerNum int32 // 玩家数
RobotNum int32 // 机器人数
Players []*Player // 玩家
Robots []*Robot
BigBlindPos int // 大盲注位
SmallBlindPos int // 小盲注位
BigBlindChip int32 // 大盲注金额
TexasType int32 // 德州扑克类型: (1限注德州扑克:你只能增加与大盲注相同的投注额; 2底池限制德州扑克:你只能增加当时台面最大额的投注额(已经完成所有投注); 3无限制德州扑克:你可在手持额度下,增加任何额度的投注额,如果你投入所有筹码,就是“全押”)
PlayerNum int32 // 玩家数
RobotNum int32 // 机器人数
Players []*Player // 玩家
Robots []*Robot
BigBlindPos int // 大盲注位
SmallBlindPos int // 小盲注位
BigBlindChip int32 // 大盲注金额
SmallBlindChip int32 // 大盲注金额
TexasType int32 // 德州扑克类型: (1限注德州扑克:你只能增加与大盲注相同的投注额; 2底池限制德州扑克:你只能增加当时台面最大额的投注额(已经完成所有投注); 3无限制德州扑克:你可在手持额度下,增加任何额度的投注额,如果你投入所有筹码,就是“全押”)
LimitInAmount int32 // 最低入场金额
LastPosBetChip int32 // 上家下注金额
PlayersLock *sync.Mutex
ChipLock *sync.Mutex // 桌面筹码更新锁
// TODO game logs7
}
// Init 初始化桌面
func (t *Table) Init() {
t.PlayersLock = &sync.Mutex{}
t.ChipLock = &sync.Mutex{}
t.PublicCards = [5]*Card{nil, nil, nil, nil, nil}
t.Dealer = NewDealer()
t.RoundTimes = 0
t.Stage = 1
t.BigBlindPos = 0
t.SmallBlindPos = 0
}
func (t *Table) PlayerCount() int32 {
var count int32 = 0
for _, p := range t.Players {
@ -42,7 +59,7 @@ func (t *Table) PlayerCount() int32 {
return count
}
func (t *Table) NextPosPlayer(current int) int {
func (t *Table) NextPlayerPos(current int) int {
for i := current + 1; i < len(t.Players); i++ {
if t.Players[i] == nil {
continue
@ -57,14 +74,14 @@ func (t *Table) NextPosPlayer(current int) int {
return 0
}
func (t *Table) FindPlayerPos(player *Player) int32 {
for i, p := range t.Players {
if p != nil && p.Id == player.Id {
return int32(i)
}
}
return -1
}
//func (t *Table) FindPlayerPos(player *Player) int32 {
// for i, p := range t.Players {
// if p != nil && p.Id == player.Id {
// return int32(i)
// }
// }
// return -1
//}
func (t *Table) JoinPlayer(player *Player) error {
t.PlayersLock.Lock()
@ -151,6 +168,14 @@ func (t *Table) NoticeGameFullStatus() {
}
}
func (t *Table) NoticeAllPlayer(message proto.Message) {
for _, player := range t.Players {
if player != nil && player.ProtoWriter != nil {
player.ProtoWriter.Write(message)
}
}
}
// NoticeGamePlayerCall TODO 发送(下注信息、下注人、下一位下注人)到牌桌所有用户
//func (t *Table) NoticeGamePlayerCall() {
//

177
internal/service/table.go

@ -4,7 +4,6 @@ import (
"fmt"
"github.com/golang/protobuf/proto"
"sort"
"sync"
"texas-poker-bk/api"
"texas-poker-bk/internal/game"
"texas-poker-bk/internal/service/store"
@ -12,50 +11,62 @@ import (
"texas-poker-bk/tool/collect"
)
// HandleReqCreateTable 创建桌面 TODO 当前在房间则不可创建房间了
// HandleReqCreateTable 创建桌面
func HandleReqCreateTable(account *session.NetAccount, msg *api.ReqCreateTable) (proto.Message, error) {
account.Lock.Lock()
defer account.Lock.Unlock()
if account.Player != nil {
return &api.ResFail{Msg: fmt.Sprintf("您当前在#%d牌桌中", account.Player.GameTable.TableNo)}, nil
}
// 人数,机器人数
playerNum := msg.Players
robotNum := msg.Robots
if playerNum+robotNum <= 0 {
return &api.ResFail{Msg: "至少添加一个玩家或机器人"}, nil
}
if !collect.In(msg.TexasType, 1, 2, 3) {
return &api.ResFail{Msg: fmt.Sprintf("未知游戏类型%d", msg.TexasType)}, nil
}
if msg.BigBlind < 2 || msg.BigBlind > 200 || msg.BigBlind%2 == 1 {
return &api.ResFail{Msg: "大盲注金额需在2-200之间,且为偶数"}, nil
}
if account.GetBalance() < msg.BigBlind*100 {
return &api.ResFail{Msg: fmt.Sprintf("余额小于入场金额[%d]", msg.BigBlind*100)}, nil
}
// 初始化一个牌桌
table := &game.Table{
TableNo: store.TableNo.Add(1),
MasterId: account.Id,
RoundTimes: 0,
Stage: 1,
Dealer: game.NewDealer(),
PublicCards: [5]*game.Card{nil, nil, nil, nil, nil}, //&game.Card{Dot: 0, Suit: 3}, &game.Card{Dot: 1, Suit: 3}
TableNo: store.TableNo.Add(1),
MasterId: account.Id,
PlayerNum: playerNum + 1,
RobotNum: robotNum,
Players: make([]*game.Player, playerNum+1),
Robots: make([]*game.Robot, robotNum),
BigBlindPos: 0,
SmallBlindPos: 0,
PlayersLock: &sync.Mutex{},
ChipLock: &sync.Mutex{},
PlayerNum: playerNum + 1,
RobotNum: robotNum,
Players: make([]*game.Player, playerNum+1),
Robots: make([]*game.Robot, robotNum),
BigBlindChip: msg.BigBlind,
SmallBlindChip: msg.BigBlind / 2,
LimitInAmount: msg.BigBlind * 100,
TexasType: msg.TexasType,
}
table.Init()
// 房主 [0]
// 扣除DB账户余额
account.DecrementBalance(table.LimitInAmount)
owner := &game.Player{
Id: account.Id,
Username: account.UserName,
Avatar: account.Avatar,
Status: 1,
LastStatus: 0,
Chip: 500,
Chip: table.LimitInAmount,
Cards: [2]*game.Card{},
GameTable: table,
ProtoWriter: account.Client,
}
owner.Init()
// 扣除DB账户余额 TODO 账户金额限制
account.DecrementBalance(500)
account.Player = owner // 挂载 player 到 account 上
// 挂载 player 到 account 上
account.Player = owner
table.Players[0] = owner
for i := 0; i < int(robotNum); i++ {
@ -120,8 +131,6 @@ func HandleReqJoinTable(account *session.NetAccount, msg *api.ReqJoinTable) (pro
if account.Player != nil {
return &api.ResFail{Msg: fmt.Sprintf("当前已加入#%d牌桌", account.Player.GameTable.TableNo)}, nil
}
// account -> player
// TODO 账户余额限制
table := store.LobbyTables[msg.TableNo]
table.ChipLock.Lock()
@ -132,13 +141,18 @@ func HandleReqJoinTable(account *session.NetAccount, msg *api.ReqJoinTable) (pro
if table.Stage != 1 {
return &api.ResFail{Msg: "牌桌正在进行中"}, nil
}
// 账户余额限制
if account.GetBalance() < table.LimitInAmount {
return &api.ResFail{Msg: fmt.Sprintf("余额小于入场金额[%d]", table.LimitInAmount)}, nil
}
player := &game.Player{
Id: account.Id,
Username: account.UserName,
Avatar: account.Avatar,
Status: 1,
LastStatus: 0,
Chip: 500,
Chip: 0,
Cards: [2]*game.Card{nil, nil},
GameTable: table,
ProtoWriter: account.Client,
@ -149,7 +163,8 @@ func HandleReqJoinTable(account *session.NetAccount, msg *api.ReqJoinTable) (pro
return nil, err
}
// 从账户扣除进入牌桌的金额
account.DecrementBalance(500)
account.DecrementBalance(table.LimitInAmount)
player.Chip = table.LimitInAmount
account.Player = player
// 通知其他玩家
@ -275,6 +290,7 @@ func HandleReqCancelReady(player *game.Player, msg *api.ReqCancelReady) (proto.M
return &api.ResSuccess{}, nil
}
// HandleReqDismissGameTable 解散牌桌
func HandleReqDismissGameTable(player *game.Player, msg *api.ReqDismissGameTable) (proto.Message, error) {
player.GameTable.ChipLock.Lock()
defer player.GameTable.ChipLock.Unlock()
@ -299,6 +315,7 @@ func HandleReqDismissGameTable(player *game.Player, msg *api.ReqDismissGameTable
return &api.ResDismissGameTable{}, nil
}
// HandleReqGameStart 游戏开始,初始化,扣除大小盲注,每个玩家发2张牌
func HandleReqGameStart(player *game.Player, msg *api.ReqGameStart) (proto.Message, error) {
player.GameTable.ChipLock.Lock()
defer player.GameTable.ChipLock.Unlock()
@ -326,24 +343,43 @@ func HandleReqGameStart(player *game.Player, msg *api.ReqGameStart) (proto.Messa
// 游戏状态开始
table.Stage = 2
// 盲注位
// 盲注位
if table.RoundTimes == 0 {
table.BigBlindPos = 0
// 第一轮由庄家左手边第一个作为小盲注
table.SmallBlindPos = table.NextPlayerPos(0)
} else {
table.BigBlindPos = table.NextPosPlayer(table.BigBlindPos)
table.SmallBlindPos = table.NextPlayerPos(table.SmallBlindPos)
}
// 盲注位
table.SmallBlindPos = table.NextPosPlayer(table.BigBlindPos)
// 盲注位
table.BigBlindPos = table.NextPlayerPos(table.SmallBlindPos)
// 回合数+1
table.RoundTimes++
// 扣除大小盲注金额
table.Players[table.BigBlindPos].Chip -= game.BigBlindChip
table.Players[table.SmallBlindPos].Chip -= game.SmallBlinds
table.Chip += game.BigBlindChip + game.SmallBlinds
table.Players[table.BigBlindPos].ProtoWriter.Write(&api.ResBigBlindChip{Chip: game.BigBlindChip})
table.Players[table.SmallBlindPos].ProtoWriter.Write(&api.ResSmallBlindChip{Chip: game.SmallBlinds})
table.Players[table.SmallBlindPos].Chip -= table.SmallBlindChip
table.Players[table.BigBlindPos].Chip -= table.BigBlindChip
table.Chip += table.BigBlindChip + table.SmallBlindChip
// 回合下注次数
table.Players[table.BigBlindPos].RoundBetTimes++
// table.Players[table.SmallBlindPos].RoundBetTimes++
// 初始上次下注金额为大盲注
table.LastPosBetChip = table.BigBlindChip
msgSmallBlind := &api.ResNoticePlayerLine{
PlayerId: table.Players[table.SmallBlindPos].Id,
Line1: fmt.Sprintf("+%d", table.SmallBlindChip),
Line2: "小盲注",
}
msgBigBlind := &api.ResNoticePlayerLine{
PlayerId: table.Players[table.BigBlindPos].Id,
Line1: fmt.Sprintf("+%d", table.BigBlindChip),
Line2: "大盲注",
}
table.NoticeAllPlayer(msgSmallBlind)
table.NoticeAllPlayer(msgBigBlind)
//table.Players[table.BigBlindPos].ProtoWriter.Write(&api.ResBigBlindChip{Chip: game.BigBlindChip})
//table.Players[table.SmallBlindPos].ProtoWriter.Write(&api.ResSmallBlindChip{Chip: game.SmallBlinds})
// 开始发牌(手牌,公共牌)
table.Dealer.Init() // 初始化发牌员
@ -358,16 +394,59 @@ func HandleReqGameStart(player *game.Player, msg *api.ReqGameStart) (proto.Messa
p.SetStatus(3)
}
// 发3张公共牌
for i := 0; i < 5; i++ {
if i < 3 {
table.PublicCards[i] = table.Dealer.Deal()
continue
//for i := 0; i < 5; i++ {
// if i < 3 {
// table.PublicCards[i] = table.Dealer.Deal()
// continue
// }
// // 第4,5张牌置空
// table.PublicCards[i] = nil
//}
// 待大盲注位下一位玩家下注
optPos := table.NextPlayerPos(table.BigBlindPos)
optPlayer := table.Players[optPos]
optPlayer.SetStatus(4)
optPlayer.BetOpts = []int32{1, 2, 4}
optPlayer.BetMax = table.BigBlindChip
// 游戏类型处理最大下注额
switch table.TexasType {
case 2: // 底池限注
optPlayer.BetMax = table.Chip + table.LastPosBetChip*2
case 3: // 无限注
optPlayer.BetOpts = append(optPlayer.BetOpts, 3) // 可 all in
optPlayer.BetMax = -1
case 1: // 限注
fallthrough
default:
// 第1,2回合跟注加注需和大盲注相同, 3,4回合两倍
optPlayer.BetMax = table.BigBlindChip * 2
}
// 根据玩家类型计算最小下注额,最大下注额
switch optPos {
case table.SmallBlindPos:
optPlayer.BetMin = table.BigBlindChip - table.SmallBlindChip
if table.TexasType != 3 {
optPlayer.BetMax = optPlayer.BetMax - optPlayer.BetMin
}
case table.BigBlindPos:
optPlayer.BetMin = 0
optPlayer.BetOpts = append(optPlayer.BetOpts, 5)
if table.TexasType != 3 {
optPlayer.BetMax = optPlayer.BetMax - table.BigBlindChip
}
default:
optPlayer.BetMin = table.BigBlindChip
}
// 其他玩家暂不可操作
for pos, p := range table.Players {
if p != nil && pos != optPos {
p.Status = 3
p.BetOpts = make([]int32, 0)
p.BetMin = 0
p.BetMax = 0
}
// 第4,5张牌置空
table.PublicCards[i] = nil
}
// 待小盲注位玩家下注
table.Players[table.SmallBlindPos].SetStatus(4)
// 广播牌桌状态
table.NoticeGameFullStatus()
@ -393,11 +472,11 @@ func HandleReqPlaceBetChip(player *game.Player, msg *api.ReqPlaceBetChip) (proto
}
switch player.Status {
case 4: // 小盲注下注,下注金额最小大盲注1半,
if msg.Chip < player.GameTable.BigBlindChip/2 {
if msg.BetChip < player.GameTable.BigBlindChip/2 {
return &api.ResFail{Msg: fmt.Sprintf("您当前最小下注金额%d", player.GameTable.BigBlindChip/2)}, nil
}
case 6: // 轮流下注,下注金额最小大盲注
if msg.Chip < player.GameTable.BigBlindChip {
if msg.BetChip < player.GameTable.BigBlindChip {
return &api.ResFail{Msg: fmt.Sprintf("您当前最小下注金额%d", player.GameTable.BigBlindChip)}, nil
}
default:
@ -424,17 +503,17 @@ func HandleReqPlaceBetChip(player *game.Player, msg *api.ReqPlaceBetChip) (proto
if player.GameTable.TexasType == 3 {
// 无限制可All In
allIn = msg.Chip == maxBetChip
allIn = msg.BetChip == maxBetChip
} else if player.Status == 4 {
// 最大金额减去小盲注金额
maxBetChip -= player.GameTable.BigBlindChip / 2
}
if msg.Chip > maxBetChip {
if msg.BetChip > maxBetChip {
return &api.ResFail{Msg: fmt.Sprintf("您当前最大下注金额%d", maxBetChip)}, nil
}
player.Chip -= msg.Chip
player.Chip -= msg.BetChip
return nil, nil
}

Loading…
Cancel
Save