syntax = "proto3"; package api; option go_package = "./api;api"; /* * v1.0.0 * protocol * doc: https://protobuf.dev/programming-guides/proto3 */ message ProtoWrap { int32 ver = 1; // version int32 op = 2; // option/action int32 seq = 3; // sequence bool success = 4; // 请求是否成功 bytes body = 7; // proto bytes } message Ping { uint64 timeMs = 1; // 毫秒时间戳 } message Pong { uint64 timeMs = 1; // 毫秒时间戳 } // 成功消息 message ResSuccess { int32 code = 1; } // 失败响应 message ResFail { int32 code = 1; string msg = 3; // 失败消息 } message ReqIdentity { string token = 1; } message ResIdentity { int64 id = 3; string username = 4; string avatar = 5; } // 大厅消息 ============= begin message ReqLobbyView { } message ResLobbyView { repeated LobbyTable tables = 3; } message LobbyTable { int32 tableNo = 1; // 游戏编号 int32 playerNum = 2; // 限定玩家数量 int32 robotNum = 3; // 限定机器人数量 repeated LobbyPlayer players = 4; // 当前玩家机器人列表 } message LobbyPlayer { bool robot = 1; // 是否机器人 int64 id = 2; string username = 3; string avatar = 4; } // 大厅消息 ============= end // 创建桌面 ============= begin message ReqCreateTable { int32 players = 1; int32 robots = 2; int32 texasType = 3; // 游戏类型 int32 bigBlind = 4; // 大盲注额 } message ResCreateTable { int32 tableNo = 1; } // 创建桌面 ============= end // 加入游戏 ============= begin message ReqJoinTable { int32 tableNo = 1; } // 离开房间 message ReqLeaveTable { } // 玩家准备开始 message ReqReadyStart { } // 取消准备 message ReqCancelReady { } // 房主踢人 message ReqKickOutTable { int64 playerId = 1; } // 被踢人接受消息 message ResKickOutTable { } message ReqGameAction { int32 action = 1; // 4下大盲注,5下小盲注,6跟注,7弃牌 int32 chip = 2; // 押注金额 } message ResGameAction { } // 查询玩家当前游戏状态 message ReqGameFullStatus { } message ResGameFullStatus { // 玩家当前游戏状态: 断线,重新登录.... bool inGame = 1; // 游戏是否进行中 int32 tableNo = 2; // 所在桌面编号 int32 gameStage = 3; // 游戏阶段? int32 chip = 4; // 牌桌筹码 int64 playerId = 6; // 当前玩家id int32 bigBlindPos = 7; // 大盲注位 int32 smallBlindPos = 8; // 小盲注位 // int64 masterId = 9; repeated Card publicCard = 14; // 公共牌 repeated TablePlayer players = 15; } message TablePlayer { bool robot = 1; // 是否机器人 int64 id = 2; string username = 3; string avatar = 4; int32 chip = 5; // 筹码 int32 status = 6; // 玩家状态: 1待准备开始,2已准备开始,已开始(3等待其他玩家动作,4待大盲注,5待小盲注,6待跟注,7已弃) int32 lastStatus = 7; // TODO 删, 前端通过消息监听获取下注金额信息 bool master = 8; // 是否房主 int32 roundBetTimes = 11; // 该局下注次数 int32 totalBetChip = 13; // 该局牌已下注筹码 BetRole betRole = 14; // 下注时规则限制 repeated Card handCard = 15; // 手牌 } message Card { int32 dot = 1; // 点数 string suit = 2; // 花色, protobuf默认值0, string类型区分空白牌 } // player status in (4,6) 跟注时规则 message BetRole { int32 betMin = 1; // 最低下注额 int32 betMax = 2; // 最高下注额 repeated int32 betOpts = 13; // status=[4,6]时下注可操作按钮: 1跟注,2加注(-[0]+),3All-In,4弃牌,5过牌 } // 加入游戏 ============= end // 开始游戏 message ReqGameStart { } // 解散房间 message ReqDismissGameTable { } message ResDismissGameTable { } // 下注 message ReqBetting { int32 betType = 1; // 1跟注,2加注或跟注(-[0]+),3All-In,4弃牌,5过牌 int32 betChip = 2; // 跟注/加注金额 } // 通知玩家某个其他玩家动作 message ResNoticePlayerLine { int64 playerId = 1; string line1 = 11; string line2 = 12; string line3 = 13; } message ResGameEndSettle { ResGameFullStatus game = 11; } // 玩家输赢筹码通知 message ResCalcWinnerChip { map playersWinChip = 9; } // 回合数变化时响应消息,前端等发牌动画结束后放开操作 message ResGameNextRound { int32 round = 1; }