package com.backfire.socket.socketProto;

option java_package = "com.backfire.socket.socketProto";
option java_outer_classname = "Doudizhu"; 

/********************
 * 房间协议
 *******************/
 
//	1.5	 认证请求
message AuthReq
{
	optional	uint64 uid			= 1;	//用户id
	optional	string key			= 2;	//用户session key
}

//  1.6  认证回应
 message AuthRpy
{
	optional	uint32 ret			= 1;	//返回值，1成功，2失败
	optional	uint32 retcode		= 2;	//错误码，成功0
	optional    string retmsg       = 3;    //错误信息,扩展用
}

message LoginoutReq
{
	optional 	uint32 cmd			=1;
}

//3 游戏模块
message Ready
{
	optional    uint32  isready     = 1;     //是否准备,如果不想在这个房间,可以发送这条指令,也可直接退出
	optional    uint32  handcardAnimMS  = 2; //发牌的动画时间(毫秒)
}

message ReadyReply
{
    optional    uint32  ret         = 1;     //
    optional    uint32  retcode     = 2;     //
    optional    string  retmsg      = 3;     //
    repeated    uint32  seats       = 4;     //哪些位置已经准备,这个的做法再商量
}
//  3.1 房间内座位上玩家信息
message PlayerInfo
{
    optional    uint32  seatId      = 1;     //座位ID
    optional    uint64  uid         = 2;     //用户ID
    optional    string  uName       = 3;     //用户名称
    optional    string  icon        = 4;     //用户头像
    optional    uint64  money       = 5;     //用户金币数
    optional    uint32  level       = 6;     //用户等级
    optional    uint32  sex         = 7;     //用户性别
	repeated	uint32  items		= 8;	 //用户道具
	optional	uint32	gameCount	= 9;	 //游戏场数
	optional	uint32	winCount	= 10;	 //胜利场数
	optional	uint32	dropCount	= 11;	 //掉线次数
	optional	uint32	runCount	= 12;	 //逃跑次数
	optional    uint64  lottery     = 13;    //彩券数目
	optional    string  sign        = 14;    //用户签名
}

//  3.2 广播房间内打牌人信息（通过座位）
message BroadcastPlayerInfo
{
    repeated    PlayerInfo  seatList    = 1;
}

message RebindReq
{
    optional  	uint64  uid         = 1;
    optional	string	session		= 2;
}

//重连
message RebindRpy
{
    optional    uint32		ret         = 1;
    optional    uint32		retcode     = 2;
    optional    string		retmsg      = 3;
	optional	GameStart	gamestart	= 4;
	optional	QiangdizhuRpy			qdzRpy = 5;
	optional	BroadcastPlayerAction	playerAction = 6;
	optional	BroadcastPlayerInfo		playerinfo = 7;
	optional	HandCard	handcard	= 8;
	optional	uint32		seatid		= 9;
	repeated	uint32		playerCardsRemain = 10;	
	repeated	PlayerDepositRpy deposited = 11;	
	optional	uint32		roomType	= 12;
	repeated	BroadcastLaiziCard laizi = 13;
	optional    SeatRpy seatInfo    = 14;    //斗地主座位信息
}

//  3.3 用户坐下站起
message SeatReq
{
    optional    uint64	uid         = 1;     //用户ID
    optional    uint32  seatId      = 2;     //座位ID
    optional    uint32  action      = 3;     //动作，1坐下，2站起
    optional    uint32  autoready   = 4;     //1自动准备 2不自动准备
    optional	uint32  roomid      = 5;     //房间ID
}

//  3.4 坐下站起状态返回
message SeatRpy
{
    optional    uint32  ret         = 1;     //返回值，1成功，2失败
    optional    uint32  retCode     = 2;     //错误码
    optional    string  retMsg      = 3;     //用户提示信息
	optional    uint32  seatid      = 4;     //玩家的座位
	optional    uint32  action      = 5;     //玩家的动作
	optional	uint32  basepoint   = 6;     //底分
	optional	uint32  readytimeout= 7;	 //准备超时
	optional	uint32	awardRoom   = 8;     //大奖赛场 1是大奖赛，0为其他
	optional	uint32	laiziFlag   = 9;     //是否癞子场，0是普通场，1是普通癞子，2是超级癞子
	optional	string	roomName    = 10;     //场次名称
}
//  3.5 牌局开始
message GameStart
{
    optional    uint32  gameNum     = 1;     //房间内第N局牌次
    optional    uint32  bet         = 2;     //底注
    repeated    CardInfo commcard   = 3;     //三张公牌
    optional    uint32  dizhu       = 4;     //地主位置
    optional    uint32  timeout     = 5;     //出牌超时
}

//  3.6 抢地主
message QiangdizhuReq
{
    optional    uint32  ratio       = 1;    //抢地主,抢倍率
    optional    uint32  giveup      = 2;    //放弃
}

//  3.7 抢地主返回
message QiangdizhuRpy
{
    optional    uint32  ret         = 1;    //
    optional    uint32  retcode     = 2;    //
    optional    string  retmsg      = 3;    //
    optional    uint32  ratio       = 4;    //返回当前倍率
    optional    uint32  seatid      = 5;    //当前抢地主玩家位置
    optional    uint32  timeout     = 6;    //抢地主倒计时时间
	optional	uint32  callCount	= 7;	//当前是第几次抢
}

//  3.8 单张牌信息
message CardInfo
{
    optional    uint32 cardFace     = 1; //牌点,癞子模式时是癞子替用的牌 3-15，其中11:J 12:Q 13:K 14:A 15:2
    optional    uint32 cardSuit     = 2; //花色 1方块，2黑葵，3红心，4黑桃
	optional	uint32 laiziFace	= 3; //癞子的原始牌点 0:不是癞子牌 3-15:与cardFace相同
}
//  3.9 发玩家手牌
message HandCard
{
    repeated    CardInfo    handCardList = 1;    //用户手牌
}
//  3.10 玩家动作（出牌，pass，发表情等）
message PlayerPlayActionReq
{
    optional    uint64  uid             = 1;     //用户ID
    optional    uint32  action          = 2;     //动作
    repeated    CardInfo  pushCardList  = 3;     //出牌列表
    optional    uint32  emotionId       = 4;     //表情ID
}

//  3.11 返回玩家动作结果
message PlayerPlayActionRpy
{
    optional    uint32  ret         = 1;     //返回值，1成功，2失败
    optional    uint32  retCode     = 2;     //错误码，待定
    optional    string  retMsg      = 3;     //用户提示，不能打此牌型; 超时（待定）
}

//  3.12 对手的动作（出牌，pass，表情等）
message BroadcastPlayerAction
{
    optional    uint64  uid					= 1;     //用户id
	optional    uint32  seatid				= 2;	 //出牌玩家seat
    optional    uint32  action				= 3;     //动作，1pass，2打牌，3发表情
    repeated    CardInfo  pushCardList		= 4;     //对手出牌内容
    optional    uint32  emotionId			= 5;     //表情ID
	optional    uint64  nextuid				= 6;     //下一个出牌玩家uid
	optional    uint32  nextseatid			= 7;     //下一个出牌玩家seatid
	optional    uint32  pointratio			= 8;     //当前倍率
	optional	uint32	cardType			= 9;	 //牌型
	optional	uint32	highcard			= 10;	 //主牌型的最大牌
}

message ChatReq{
     optional     uint64     uId         	= 1;     //用户uid
     required     uint32     seatId        	= 2;     //用户seatid座位
     optional     uint32     roomId         = 3;     //房间
     optional     string     chatMsg     	= 4;     //聊天信息
     optional     uint32     faceId      	= 5;     //表情id
}

message BroadcastChat{
     required     uint32     seatId          = 1;    //座位id
     optional     string     chatMsg         = 2;    //聊天信息
     optional     uint32     faceId          = 3;    //表情id
     optional     uint32     roomId          = 4;    //table ID
}

//  3.13 牌局结束
message GameOver
{
	optional    uint32  winSide			= 1;	 //胜利方 1地主 2农民
    repeated    GameResult  result		= 2;     //赢得金钱 1-3座位排列
}

message GameResult
{
    optional    uint32  seatid      = 1;     //用户座位号
    optional    uint64  winMoney    = 2;     //赢得金钱
    optional    uint32  winRatio    = 3;     //翻倍数 按座位
	optional    uint32	bombs	    = 4;	 //炸弹数 按座位
	repeated	CardInfo seatCards  = 5;	 //座位上剩余牌
	optional	uint32	spring		= 6;	 //春天 按座位
	optional	uint32	reward		= 7;	 //活动奖励 按座位
	optional	uint64	money		= 8;	 //用户的钱数
	optional    uint64  lottery     = 9;     //用户剩余彩券数
    optional    uint64  winLottery  = 10;    //用户赢彩券数
}

//广播新增的癞子牌
message BroadcastLaiziCard
{
	optional	CardInfo	laizicard = 1;	//癞子牌
	optional	uint32		seatid	  = 2;	//小癞子的玩家座位
}
//托管请求
message PlayerDepositReq
{
	optional	uint32	isdeposited			= 1;	//1托管, 2取消托管
}

//托管回应
message PlayerDepositRpy
{
	optional	uint32	seatid				= 1;	//托管座位
	optional	uint64	uid					= 2;	//托管uid
	optional    uint32  isdeposited			= 3;	//1托管, 2取消托管
	optional    uint32  ret                 = 4;
    optional    uint32  retcode             = 5;
    optional    string  retmsg              = 6;
}
