protocol.go
2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package protocol
type MessageHeader struct {
PackageLen uint16
MsgID uint16
Seq uint32
PlayerID uint32
RoomID uint32
}
/////////////////////手牌回放信息////////////////////////
type ReplayRoomInfo struct{
GameType string `json:"type"`
Mode uint32 `json:"mode"`
Blind uint32 `json:"blind"`
Ante uint32 `json:"ante"`
PlayerCount uint32 `json:"players_count"`
DoubleAnte bool `json:"double_ante"`
}
type ReplayTableInfo struct{
DealerSeat int `json:"dealer_seat"`
SBSeat int `json:"sb_seat"`
BBSeat int `json:"bb_seat"`
StraddleSeat int `json:"straddle_seat"`
PostSeats []uint32 `json:"post_seats"`
ShowDownSeats []uint32 `json:"showdown_seats"`
}
type SeatInfo struct{
SeatNo uint32 `json:"seat_no"`
UID uint32
Name string `json:"name"`
Head string `json:"head_url"`
Stake uint32 `json:"stake"`
HoleCards [] *CardItem `json:"holecards"`
SeatLabel string `json:"label"`
IsMuck bool `json:"is_muck"`
}
type ReplaySeatsInfo struct{
Seats []*SeatInfo `json:"seats_info"`
}
type ReplayPotInfo struct{
PotID uint32 `json:"pot_id"`
Amount uint32 `json:"amount"`
}
type EndRoundInfo struct{
Pots []*ReplayPotInfo `json:"pots_info"`
}
func (e *EndRoundInfo)Reset(){
e.Pots = e.Pots[:0]
}
type ActionInfo struct{
Seq uint32 `json:"seq"`
SeatNo uint32 `json:"seat_no"`
ActionType uint32 `json:"action_type"`
Amount uint32 `json:"amount"`
}
type SettleInfo struct{
SeatNo uint32 `json:"win_seat_no"`
WinAmount int32 `json:"win_amount"`
}
type ReplayRoundsInfo struct{
AnteRound bool `json:"ante_round"`
EndAnteRound EndRoundInfo `json:"end_ante_round"`
BlindRound bool `json:"blind_round"`
Preflop []*ActionInfo `json:"preflop"`
EndPreflopRound EndRoundInfo `json:"end_preflop_round"`
FlopCommunityCards []*CardItem `json:"flop_community_cards"`
Flop []*ActionInfo `json:"flop"`
EndFlopRound EndRoundInfo `json:"end_flop_round"`
TurnCommunityCard *CardItem `json:"turn_community_card"`
Turn []*ActionInfo `json:"turn"`
EndTurnRound EndRoundInfo `json:"end_turn_round"`
RiverCommunityCard *CardItem `json:"river_community_card"`
River []*ActionInfo `json:"river"`
EndRiverRound EndRoundInfo `json:"end_river_round"`
Settles []*SettleInfo `json:"settlement_round"`
}
func (r *ReplayRoundsInfo)Reset(){
r.EndAnteRound.Reset()
r.EndPreflopRound.Reset()
r.EndFlopRound.Reset()
r.EndTurnRound.Reset()
r.EndRiverRound.Reset()
r.Preflop = r.Preflop[:0]
r.Flop = r.Flop[:0]
r.Turn = r.Turn[:0]
r.River = r.River[:0]
r.TurnCommunityCard = nil
r.RiverCommunityCard = nil
r.FlopCommunityCards = r.FlopCommunityCards[:0]
r.Settles = r.Settles[:0]
}
type HandReplayInfo struct{
RoomInfo *ReplayRoomInfo
TableInfo *ReplayTableInfo
SeatsInfo *ReplaySeatsInfo
RoundsInfo *ReplayRoundsInfo
}
func (h *HandReplayInfo) Init(){
h.RoomInfo = new(ReplayRoomInfo)
h.TableInfo = new(ReplayTableInfo)
h.SeatsInfo = new(ReplaySeatsInfo)
h.RoundsInfo = new(ReplayRoundsInfo)
}