samba/proto/cacheta.go

218 lines
7.5 KiB
Go
Raw Permalink Normal View History

2025-06-04 09:51:39 +08:00
package proto
const (
NtfCachetaRoomInfoId = "NtfCachetaRoomInfoId" // 房间信息(包含底注,加注,第几回合等桌面数据)
NtfCachetaPlayerInfoId = "NtfCachetaPlayerInfoId" // 玩家信息(有新玩家进入房间时,房间内玩家会收到该消息)
NtfStartCachetaGameId = "NtfStartCachetaGameId" // 游戏开始
NtfDealCachetaPokersId = "NtfDealCachetaCardsId" // 发牌
NtfPlayerCachetaActId = "NtfPlayerCachetaActId" // 通知玩家行动
ReqCachetaPickPokerId = "ReqCachetaPickPokerId" // 玩家出牌
RspCachetaPickPokerId = "RspCachetaPickPokerId" //
NtfCachetaPickPokerId = "NtfCachetaPickPokerId" //
ReqCachetaOutPokerId = "ReqCachetaOutPokerId" // 玩家出牌
RspCachetaOutPokerId = "RspCachetaOutPokerId" //
NtfCachetaOutPokerId = "NtfCachetaOutPokerId" //
ReqCachetaTidyPokerId = "ReqCachetaTidyPokerId" // 整理手牌
RspCachetaTidyPokerId = "RspCachetaTidyPokerId"
//NtfCachetaCutLineId = "NtfCachetaCutLineId" // 插队广播
NtfCachetaTingHuId = "NtfCachetaTingHuId" // 听牌,系统自动提示
ReqCachetaHuId = "ReqCachetaHuId" // 申请胡牌
NtfCachetaHuId = "NtfCachetaHuId" // 胡牌广播
NtfCachetaGameSettleId = "NtfCachetaGameSettleId" // 游戏结束,结算本局输赢
ReqCachetaReconnectId = "ReqCachetaReconnectId" // 重连
RspCachetaReconnectId = "RspCachetaReconnectId"
)
// 用户数据
type CachetaPlayer 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 CachetaHandPoker `json:"p"` // 玩家手牌
Seat int `json:"se"` // 座位号(0-3)
ClubCoin int64 `json:"cc"` // 俱乐部币
ClubTakeCoin int64 `json:"tc"` // 携带俱乐部币
State int `json:"st"` // 0:离线 1:在线
Point int `json:"po"` // 当前分数
}
// 房间信息
type NtfCachetaRoomInfo struct {
RoomId int `json:"r"`
RoomType int `json:"roo"` // 房间类型策划room表的id
ClubId int `json:"cl"` // 俱乐部id
Blind int64 `json:"b"` // 游戏底注
CuttingPoker int `json:"c"` // 切牌
WildPoker []int `json:"w"` // 万能牌
PickPokerNum int `json:"p"` // 摸牌区剩余牌数量
OutPokers []int `json:"o"` // 弃牌区牌堆
State int `json:"s"` // 房间状态
GameCount int `json:"g"` // 第几小局
}
// 玩家信息
type NtfCachetaPlayerInfo struct {
Players []*CachetaPlayer `json:"p"` // 玩家信息
}
// 游戏开始
type NtfStartCachetaGame struct {
Time int64 `json:"t"` // 当前时间戳
}
// 发牌
type NtfDealCachetaPokers struct {
Seat int `json:"s"` // 当前行动的座位号
Time int64 `json:"t"` // 当前时间戳
CuttingPoker int `json:"c"` // 切牌
DropPoker int `json:"dr"` // 弃牌区第一张弃牌
PickPokerNum int `json:"pi"` // 摸牌区数据
WildPoker []int `json:"w"` // 两张万能牌
Poker []*CachetaHandPoker `json:"p"` // 玩家手牌,二维数组,[座位号][9张手牌]
Dealer int `json:"d"` // 庄家位置
GameCount int `json:"g"` // 第几小局
}
// 通知玩家进入操作回合,摸牌或者胡牌或者出牌
type NtfPlayerCachetaAct struct {
RoomId int `json:"r"` // 当前房间id
Seat int `json:"s"` // 当前行动的座位号
Countdown int `json:"c"` // 行动时间5秒
CountdownEx int `json:"co"` // 额外的倒计时
Type int `json:"t"` // 1:胡牌或者摸牌 2:出牌
CanWin int `json:"w"` // 0:不能胡牌 1:可以胡牌
}
type ReqCachetaPickPoker struct {
IsDrop int `json:"i"` // 0:摸牌区摸牌 1:弃牌区摸牌
}
// 摸牌
type RspCachetaPickPoker struct {
Code ErrorCode `json:"c"`
Poker int `json:"p"` // 摸牌
IsDrop int `json:"i"` // 0:摸牌区摸牌 1:弃牌区摸牌
DropPoker int `json:"d"` // 弃牌区更新牌
IsTurnOver int `json:"is"` // 0:无需处理 1:将弃牌区翻转给摸牌区
}
// 摸牌广播
type NtfCachetaPickPoker struct {
CurrentSeat int `json:"cu"` // 当前行动的座位号
PickPokerNum int `json:"p"` // 摸牌区剩余牌数量
IsTurnOver int `json:"i"` // 0:无需处理 1:将弃牌区翻转给摸牌区
IsDrop int `json:"is"` // 0:摸牌区摸牌 1:弃牌区摸牌
DropPoker int `json:"d"` // 弃牌区更新
Poker int `json:"po"` // 正常游戏中为0日志中为摸的牌
PickPokers []int `json:"pp"` // 翻转过后的摸牌堆 未翻转时该字段为空
}
type ReqCachetaOutPoker struct {
Poker int `json:"p"` // 出牌
}
// 出牌错误时回传给玩家
type RspCachetaOutPoker struct {
Code ErrorCode `json:"c"`
Poker int `json:"p"` // 出牌
}
// 出牌成功广播给大家
type NtfCachetaOutPoker struct {
CurrentSeat int `json:"cu"` // 当前行动的座位号
Poker int `json:"p"` // 出牌
}
// 玩家主动整理手牌
type ReqCachetaTidyPoker struct {
HandPoker CachetaHandPoker `json:"h"` // 同步手牌
}
type RspCachetaTidyPoker struct {
Code ErrorCode `json:"c"`
HandPoker CachetaHandPoker `json:"h"` // 重置手牌
}
//// 插队广播
//type NtfCachetaCutLine struct {
// Countdown int `json:"c"` // 行动时间5秒
// CountdownEx int `json:"co"` // 额外的倒计时
// Seat int `json:"s"` // 可以插队的玩家的座位号
//}
// 听牌
type NtfCachetaTingHu struct {
Seat int `json:"s"` // 听牌玩家的座位号
}
// 胡牌
type ReqCachetaHu struct {
DropPoker int `json:"d"` // 从弃牌区摸一张胡
}
// 胡牌
type RspCachetaHu struct {
Code ErrorCode `json:"c"`
}
// 胡牌
type NtfCachetaHu struct {
Code ErrorCode `json:"c"` // 0:胡牌成功 非0:诈胡
Seat int `json:"s"` // 胡牌玩家座位
}
type GroupPoker struct {
Pokers []int `json:"p"` // 组牌
}
// 手牌
type CachetaHandPoker struct {
Groups []*GroupPoker `json:"g"` // 组牌
Pokers []int `json:"p"` // 散牌
}
// 座位结算
type SeatSettle struct {
Seat int `json:"s"` // 座位号
AddPoint int `json:"ap"` // 小局加分
SumPoint int `json:"sp"` // 剩余分数为0则退出
AddScore int64 `json:"as"` // 大局结算时,输赢金币或俱乐部币
SumScore int64 `json:"ss"` // 大局结算时,显示玩家总金币
HandPoker CachetaHandPoker `json:"h"` // 大局结算时,显示玩家总金币
}
// NtfGameSettle 一局结算
type NtfCachetaGameSettle struct {
SeatSettle []*SeatSettle `json:"s"` // 座位玩家结算
NextGame int `json:"n"` // 是否有下一局 0:没有下一局 1:有下一局
}
// ReqReconnect 断线重连
type ReqCachetaReconnect struct {
RoomId int `json:"r"` // 房间id
}
// RspReconnect 断线重连
type RspCachetaReconnect struct {
Code ErrorCode `json:"c"` // 房间已结束:12
RoomInfo *NtfCachetaRoomInfo `json:"s"` // 桌面数据
Players []*CachetaPlayer `json:"p"` // 玩家数据
Dealer int `json:"d"` // 庄家位置
}