346 lines
12 KiB
Go
346 lines
12 KiB
Go
![]() |
package proto
|
|||
|
|
|||
|
const (
|
|||
|
NtfMaintainId = "NtfMaintainId" // 系统维护,解散房间
|
|||
|
|
|||
|
ReqMatchRoomId = "ReqMatchRoomId" // 匹配游戏
|
|||
|
RspMatchRoomId = "RspMatchRoomId"
|
|||
|
ReqCancelMatchRoomId = "ReqCancelMatchRoomId" // 取消匹配
|
|||
|
RspCancelMatchRoomId = "RspCancelMatchRoomId"
|
|||
|
|
|||
|
ReqEnterRoomId = "ReqEnterRoomId" // 进入房间
|
|||
|
RspEnterRoomId = "RspEnterRoomId"
|
|||
|
ReqLeaveRoomId = "ReqLeaveRoomId" // 离开房间
|
|||
|
RspLeaveRoomId = "RspLeaveRoomId"
|
|||
|
NtfLeaveRoomId = "NtfLeaveRoomId"
|
|||
|
NtfRoomInfoId = "NtfRoomInfoId" // 房间信息(包含底注,加注,第几回合等桌面数据)
|
|||
|
NtfPlayerInfoId = "NtfPlayerInfoId" // 玩家信息(有新玩家进入房间时,房间内玩家会收到该消息)
|
|||
|
NtfFakeLeaveId = "NtfFakeLeaveId" // 玩家假离开广播
|
|||
|
|
|||
|
ReqReadyGameId = "ReqReadyGameId" // 进入房间
|
|||
|
|
|||
|
NtfStartGameId = "NtfStartGameId" // 游戏开始
|
|||
|
NtfDealPokersId = "NtfDealCardsId" // 发牌
|
|||
|
NtfDecidingGameId = "NtfDecidingCardsId" // 决胜局提示
|
|||
|
|
|||
|
ReqEmoteId = "ReqEmoteId" // 玩家在发牌后,出牌前可以发暗号,其它时候只能发表情
|
|||
|
NtfEmoteId = "NtfEmoteId" // 广播表情
|
|||
|
|
|||
|
NtfPlayerActId = "NtfPlayerActId" // 通知玩家行动(包含叫分,投降)
|
|||
|
ReqPlayerActId = "ReqPlayerActId" // 玩家行动(包含叫分,投降)
|
|||
|
RspPlayerActId = "RspPlayerActId" //
|
|||
|
NtfTeammateActId = "NtfTeammateActId" // 同步队友操作
|
|||
|
NtfPlayerRspRaiseId = "NtfPlayerRspRaiseId" // 通知队伍回应玩家操作
|
|||
|
|
|||
|
ReqHostingId = "ReqHostingId" // 托管请求
|
|||
|
NtfHostingId = "NtfHostingId" // 通知托管变更
|
|||
|
|
|||
|
ReqPlayerOutPokerId = "ReqOutCardsActId" // 玩家出牌
|
|||
|
RspPlayerOutPokerId = "RspOutCardsActId" //
|
|||
|
NtfPlayerOutPokerId = "NtfPlayerOutPokerId" //
|
|||
|
|
|||
|
ReqSetDarkPokerId = "ReqSetDarkPokerId" // 设置暗牌
|
|||
|
RspSetDarkPokerId = "RspSetDarkPokerId" //
|
|||
|
|
|||
|
NtfRoundSettleId = "NtfRoundSettleId" // 一轮结束,结算本轮输赢(一局游戏三轮)
|
|||
|
NtfGameSettleId = "NtfGameSettleId" // 游戏结束,结算本局输赢
|
|||
|
NtfGameBigSettleId = "NtfGameBigSettleId" // 游戏结束,结算本局输赢
|
|||
|
|
|||
|
ReqShowPokerId = "ReqShowPokerId" // 游戏结束,展示手牌
|
|||
|
RspShowPokerId = "RspShowPokerId" //
|
|||
|
NtfShowPokerId = "NtfShowPokerId" // 展示玩家手牌
|
|||
|
|
|||
|
ReqReconnectId = "ReqReconnectId" // 重连
|
|||
|
RspReconnectId = "RspReconnectId"
|
|||
|
)
|
|||
|
|
|||
|
// 匹配
|
|||
|
type ReqMatchRoom struct {
|
|||
|
RoomType int `json:"r"` // 房间类型
|
|||
|
}
|
|||
|
|
|||
|
type RspMatchRoom struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
RoomType int `json:"rt"` // 房间类型
|
|||
|
Player *Player `json:"p"` // 玩家信息
|
|||
|
}
|
|||
|
|
|||
|
// 取消匹配
|
|||
|
type ReqCancelMatchRoom struct {
|
|||
|
RoomType int `json:"r"` // 房间类型
|
|||
|
}
|
|||
|
|
|||
|
type RspCancelMatchRoom struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
RoomType int `json:"rt"` // 房间类型
|
|||
|
}
|
|||
|
|
|||
|
type ReqEnterRoom struct {
|
|||
|
RoomId int `json:"r"` // 房间id
|
|||
|
}
|
|||
|
|
|||
|
type RspEnterRoom struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
RoomId int `json:"r"`
|
|||
|
PlayType int `json:"p"` // 玩法id
|
|||
|
RoomType int `json:"rt"` // 房间类型
|
|||
|
ClubId int `json:"cl"` // 俱乐部id
|
|||
|
GameInfo *ClubPlayGameInfo `json:"g"` // 玩法信息,只有俱乐部房间有该字段
|
|||
|
IsReentry int `json:"i"` // 是否重连 0:新进玩家 1:重连玩家
|
|||
|
}
|
|||
|
|
|||
|
type ReqLeaveRoom struct {
|
|||
|
RoomId int `json:"r"`
|
|||
|
}
|
|||
|
|
|||
|
type RspLeaveRoom struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
CurrentSeat int `json:"s"` // 当前行动的座位号
|
|||
|
RoomId int `json:"r"`
|
|||
|
}
|
|||
|
|
|||
|
type NtfLeaveRoom struct {
|
|||
|
CurrentSeat int `json:"s"` // 当前行动的座位号
|
|||
|
RoomId int `json:"r"`
|
|||
|
}
|
|||
|
|
|||
|
// 上下线广播
|
|||
|
type NtfFakeLeave struct {
|
|||
|
RoomId int `json:"r"`
|
|||
|
CurrentSeat int `json:"s"` // 假离开的座位号
|
|||
|
FakeLeave int `json:"f"` // 0:离线 1:在线
|
|||
|
}
|
|||
|
|
|||
|
// 用户数据
|
|||
|
type Player struct {
|
|||
|
UserId int64 `json:"u"` // 玩家id
|
|||
|
ClubId int `json:"cl"` // 俱乐部id
|
|||
|
Mnick string `json:"n"` // 玩家昵称
|
|||
|
HeadUrl string `json:"h"` // 头像
|
|||
|
IconId int `json:"i"` // 系统头像
|
|||
|
AvatarFrame int `json:"a"` // 边框
|
|||
|
Sex int `json:"s"` // 性别
|
|||
|
Coin int64 `json:"c"` // 金币
|
|||
|
TakeCoin int64 `json:"t"` // 携带金币
|
|||
|
Poker []int `json:"p"` // 玩家手牌
|
|||
|
Seat int `json:"se"` // 座位号(0-3)
|
|||
|
IsRed int `json:"is"` // 0:红队,1:绿队
|
|||
|
State int `json:"st"` // 0:离线 1:在线
|
|||
|
OutPoker int `json:"o"` // 最近出的一张牌
|
|||
|
ClubCoin int64 `json:"cc"` // 俱乐部币
|
|||
|
ClubTakeCoin int64 `json:"tc"` // 携带俱乐部币
|
|||
|
}
|
|||
|
|
|||
|
// 房间信息
|
|||
|
type NtfRoomInfo struct {
|
|||
|
RoomId int `json:"r"`
|
|||
|
RoomType int `json:"roo"` // 房间类型,策划room表的id
|
|||
|
ClubId int `json:"cl"` // 俱乐部id
|
|||
|
Blind int64 `json:"b"` // 游戏底注
|
|||
|
CuttingPoker int `json:"c"` // 切牌
|
|||
|
Point int `json:"a"` // point
|
|||
|
RedScore int `json:"re"` // 红队分数
|
|||
|
GreenScore int `json:"gr"` // 绿队分数
|
|||
|
RoundSettle []int `json:"ro"` // 输赢(0:红灯 1:绿灯 2:黄灯)
|
|||
|
State int `json:"s"` // 房间状态
|
|||
|
GameCount int `json:"g"` // 第几小局
|
|||
|
Star int `json:"st"` // 星星数,俱乐部房间不展示
|
|||
|
}
|
|||
|
|
|||
|
// 玩家信息
|
|||
|
type NtfPlayerInfo struct {
|
|||
|
Players []*Player `json:"p"` // 玩家信息
|
|||
|
}
|
|||
|
|
|||
|
// 准备按钮
|
|||
|
type ReqReadyGame struct {
|
|||
|
}
|
|||
|
|
|||
|
// 游戏开始
|
|||
|
type NtfGameStart struct {
|
|||
|
Time int64 `json:"t"` // 当前时间戳
|
|||
|
}
|
|||
|
|
|||
|
// 发牌
|
|||
|
type NtfDealPokers struct {
|
|||
|
Seat int `json:"s"` // 当前行动的座位号
|
|||
|
Time int64 `json:"t"` // 当前时间戳
|
|||
|
CuttingPoker int `json:"c"` // 切牌
|
|||
|
Poker [][]int `json:"p"` // 玩家手牌,二维数组,[座位号][3张手牌]
|
|||
|
Dealer int `json:"d"` // 庄家位置
|
|||
|
GameCount int `json:"g"` // 第几小局
|
|||
|
}
|
|||
|
|
|||
|
type SeatPoker struct {
|
|||
|
Seat int `json:"s"` // 座位号
|
|||
|
Poker []int `json:"p"` // 该玩家手牌
|
|||
|
}
|
|||
|
|
|||
|
// ReqHosting 托管请求
|
|||
|
type ReqHosting struct {
|
|||
|
Enable bool `json:"e"` // 开启/关闭托管
|
|||
|
}
|
|||
|
|
|||
|
// NtfHosting 通知托管状态变更
|
|||
|
type NtfHosting struct {
|
|||
|
Seat int `json:"s"` // 对应的座位号
|
|||
|
Enable bool `json:"e"` // 开启/关闭托管
|
|||
|
}
|
|||
|
|
|||
|
// 决胜局广播
|
|||
|
type NtfDecidingGame struct {
|
|||
|
//Seat int `json:"s"` // 当前行动的座位号
|
|||
|
TeamColor int `json:"t"` // 决胜方队伍颜色
|
|||
|
Poker []*SeatPoker `json:"p"` // 决胜方的明牌
|
|||
|
Countdown int `json:"c"` // 行动时间5秒
|
|||
|
CountdownEx int `json:"co"` // 额外的倒计时
|
|||
|
CanGiveUp int `json:"cg"` // 0:无弃牌按钮 1:有弃牌按钮
|
|||
|
CanAgree int `json:"ca"` // 0:无同意按钮 2:有同意按钮
|
|||
|
}
|
|||
|
|
|||
|
// 通知玩家进入操作回合,申请加注或放弃或出牌
|
|||
|
type NtfPlayerAct struct {
|
|||
|
RoomId int `json:"r"` // 当前房间id
|
|||
|
Seat int `json:"s"` // 当前行动的座位号
|
|||
|
Countdown int `json:"c"` // 行动时间5秒
|
|||
|
CountdownEx int `json:"co"` // 额外的倒计时
|
|||
|
CanCall int `json:"ca"` // 0:不能叫分只能出牌 30:truco3 60:truc6 90:truc9 120:truc12
|
|||
|
CanGiveUp int `json:"cg"` // 0:不能弃牌 1:可以弃牌
|
|||
|
}
|
|||
|
|
|||
|
type ReqPlayerAct struct {
|
|||
|
IsTruco bool `json:"i"` // 0:回应加注 1:主动truco
|
|||
|
Raise int `json:"r"` // 放弃:-1 同意:2 30:truco 60:同意并加注到p6或truc6 90:同意并加注到p9或truc9 120:同意并加注到p12或truc12
|
|||
|
}
|
|||
|
|
|||
|
// 同步队友操作
|
|||
|
type NtfTeammateAct struct {
|
|||
|
CurrentSeat int `json:"c"` // 当前行动的座位号
|
|||
|
Act int `json:"a"` // 同步队友操作 放弃:1 同意:2 30:truco 60:同意并加注到p6 90:同意并加注到p9 120:同意并加注到p12
|
|||
|
}
|
|||
|
|
|||
|
type RspPlayerAct struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
CurrentSeat int `json:"cu"` // 当前行动的座位号
|
|||
|
NotOptSeat int `json:"no"` // 还没有做出回应的座位号(2v2),默认值为-1
|
|||
|
IsTruco int `json:"i"` // 0:回应加注 1:主动truco 2:主动投降
|
|||
|
Raise int `json:"r"` // 放弃:1 同意:2 30:truco 60:同意并加注到p6 90:同意并加注到p9 120:同意并加注到p12
|
|||
|
Point int `json:"p"` // 当前point
|
|||
|
Star int `json:"s"` // 星星数,非俱乐部房间展示
|
|||
|
}
|
|||
|
|
|||
|
// 通知玩家回应加注
|
|||
|
type NtfPlayerRspRaise struct {
|
|||
|
TeamColor int `json:"t"` // [0]:红队操作 [1]:绿队操作
|
|||
|
|
|||
|
Countdown int `json:"c"` // 行动时间5秒
|
|||
|
CountdownEx int `json:"co"` // 额外的倒计时
|
|||
|
Enemy int `json:"e"` // 敌方最近操作(放弃1,同意2,加注3)
|
|||
|
Ally []int `json:"a"` // 重连高亮显示队友操作,(0:不能加分只能同意或放弃 60:同意并加注到p6 90:同意并加注到p9 120:同意并加注到p12)
|
|||
|
CanRaise int `json:"ca"` // 0:不能加分只能同意或放弃 60:同意并加注到p6 90:同意并加注到p9 120:同意并加注到p12
|
|||
|
}
|
|||
|
|
|||
|
// NtfRoundSettle 每轮小结算
|
|||
|
type NtfRoundSettle struct {
|
|||
|
Settle int `json:"s"` // 输赢(0:红灯 1:绿灯 2:黄灯)
|
|||
|
MaxSeat []int `json:"m"` // 该轮最大牌玩家
|
|||
|
}
|
|||
|
|
|||
|
// NtfGameSettle 一局结算
|
|||
|
type NtfGameSettle struct {
|
|||
|
Settle []int `json:"s"` // [0]:红队得分 [1]:绿队得分
|
|||
|
NextGame int `json:"n"` // 是否有下一局 0:没有下一局 1:有下一局
|
|||
|
}
|
|||
|
|
|||
|
type TeamMember struct {
|
|||
|
Seat int `json:"s"` // 座位号
|
|||
|
WinCoin int64 `json:"w"` // 净胜分
|
|||
|
Color int `json:"c"` // 本玩家所在队伍 0:红队 1:绿队
|
|||
|
Fee int64 `json:"f"` // 服务费
|
|||
|
}
|
|||
|
|
|||
|
type NtfGameBigSettle struct {
|
|||
|
Team []*TeamMember `json:"t"` // 本队净胜分
|
|||
|
Seat int `json:"st"` // 本玩家座位号,回放专用 [2024-11-01新增]
|
|||
|
Color int `json:"c"` // 本玩家所在队伍 0:红队 1:绿队
|
|||
|
Star int `json:"sta"` // 星星数
|
|||
|
Blind int64 `json:"b"` // 底注 [2024-12-09新增]
|
|||
|
Points [2]int `json:"p"` // 队伍分数 0:红队 1:绿队
|
|||
|
Rate int `json:"r"` // 服务费比例
|
|||
|
Win int `json:"w"` // 输赢标记 0:输 1:赢
|
|||
|
}
|
|||
|
|
|||
|
type ReqPlayerOutPoker struct {
|
|||
|
Poker int `json:"p"` // 出牌, 加注时该值为0
|
|||
|
}
|
|||
|
|
|||
|
// 出牌错误时回传给玩家
|
|||
|
type RspPlayerOutPoker struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
Poker []int `json:"p"` // 手牌
|
|||
|
OutPoker int `json:"o"` // 最近出的牌
|
|||
|
}
|
|||
|
|
|||
|
// 出牌成功广播给大家
|
|||
|
type NtfPlayerOutPoker struct {
|
|||
|
CurrentSeat int `json:"cu"` // 当前行动的座位号
|
|||
|
Poker int `json:"p"` // 出牌, 加注时该值为0
|
|||
|
}
|
|||
|
|
|||
|
// 设置暗牌或者恢复成明牌
|
|||
|
type ReqSetDarkPoker struct {
|
|||
|
Poker int `json:"p"` // 要设置的牌
|
|||
|
}
|
|||
|
|
|||
|
type RspSetDarkPoker struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
Poker int `json:"p"` // 设置成功后的牌
|
|||
|
}
|
|||
|
|
|||
|
// 游戏结束申请展示手牌
|
|||
|
type ReqShowPoker struct {
|
|||
|
}
|
|||
|
|
|||
|
type RspShowPoker struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
}
|
|||
|
|
|||
|
// 展示手牌广播
|
|||
|
type NtfShowPoker struct {
|
|||
|
CurrentSeat int `json:"c"` // 当前行动的座位号
|
|||
|
Poker []int `json:"p"` // 剩余手牌
|
|||
|
}
|
|||
|
|
|||
|
// ReqReconnect 断线重连
|
|||
|
type ReqReconnect struct {
|
|||
|
RoomId int `json:"r"` // 房间id
|
|||
|
}
|
|||
|
|
|||
|
// RspReconnect 断线重连
|
|||
|
type RspReconnect struct {
|
|||
|
Code ErrorCode `json:"c"` // 房间已结束:12
|
|||
|
RoomInfo *NtfRoomInfo `json:"s"` // 桌面数据
|
|||
|
Players []*Player `json:"p"` // 玩家数据
|
|||
|
Dealer int `json:"d"` // 庄家位置
|
|||
|
}
|
|||
|
|
|||
|
type NtfMaintain struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
}
|
|||
|
|
|||
|
// 玩家在发牌后,出牌前可以发暗号,其它时候只能发表情
|
|||
|
type ReqEmote struct {
|
|||
|
EmoteId int `json:"e"`
|
|||
|
DestSeat int `json:"d"` // 目标座位,暗号等无目标的表情,该值为-1
|
|||
|
}
|
|||
|
|
|||
|
type NtfEmote struct {
|
|||
|
Code ErrorCode `json:"c"`
|
|||
|
EmoteId int `json:"e"`
|
|||
|
Seat int `json:"s"` // 发表情的座位号
|
|||
|
DestSeat int `json:"d"` // 目标座位,暗号等无目标的表情,该值为-1
|
|||
|
ResType int `json:"r"` // 消耗资源类型 1000:金币 1001:钻石
|
|||
|
CostValue int64 `json:"cv"` // 消耗资源数量
|
|||
|
ResVal int64 `json:"v"` // 剩余资源数量
|
|||
|
}
|