syntax = "proto3";

package protocol;

//message header definition
//uint16 		| uint16 | int32  | int32   |  package_len - 12 |
//package_len | msgid  | seq     | playerid |  payload          |

//package_len : 一个消息包的长度
//msgid: 消息的id
//seq:  请求消息的编号（同一个tcp链接建立之后，消息id从0开始，每次发送一个请求编号+1）
//playerid: 玩家的uid
//paylaod:  消息内容（protobuf打包序列化之后的二进制内容放到这里）


//消息id枚举定义

enum MSGID {
	MsgID_Min = 0;
	//server inner proto msgid
	MsgID_ConnClose_Notice = 10;

	//server inner proto end
	MsgID_Logon_Request = 10000;
	MsgID_Logon_Response = 10001;
	MsgID_CreateRoom_Request = 10002;
	MsgID_CreateRoom_Response = 10003;
	MsgID_CreateRoom_Notice = 10004;
	MsgID_DestroyRoom_Request = 10005;
	MsgID_DestroyRoom_Response = 10006;
	MsgID_DestroyRoom_Notice = 10007;
	MsgID_JoinRoom_Request = 10008;
	MsgID_JoinRoom_Response = 10009;
	MsgID_LeaveRoom_Request = 10010;
	MsgID_LeaveRoom_Response = 10011;
	MsgID_SitDown_Request = 10012;
	MsgID_SitDown_Response = 10013;
	MsgID_SitDown_Notice = 10014;
	MsgID_Standup_Request = 10015;
	MsgID_Standup_Response = 10016;
	MsgID_Standup_Notice = 10017;
	MsgID_Buyin_Request = 10018;
	MsgID_Buyin_Response = 10019;
	MsgID_Buyin_To_Owner_Notice = 10020;
	MsgID_Buyin_To_Applicant_Notice = 10021;
	MsgID_Answer_Buyin_Request = 10022;
	MsgID_Answer_Buyin_Response = 10023;
	MsgID_StartGame_Request = 10024;
	MsgID_StartGame_Response = 10025;
	MsgID_StartGame_Notice = 10026;
	MsgID_ResetGame_Notice = 10027;
	MsgID_Game_Post_Notice = 10028;
	MsgID_Game_Ante_Notice = 10029;
	MsgID_Game_ElectDealer_Notice = 10030;
	MsgID_Game_Blind_Notice = 10031;
	MsgID_Game_HoleCard_Notice = 10032;
	MsgID_PlayerActionTurn_Notice = 10033;
	MsgID_Action_Request = 10034;
	MsgID_Action_Response = 10035;
	MsgID_PlayerAction_Notice = 10036;
	MsgID_Game_RoundEnd_Notice = 10037;
	MsgID_CommunityCards_Notice = 10038;
	MsgID_Game_ShowCard_Notice = 10039;
	MsgID_Game_Insurance_Notice = 10040;
	MsgID_BuyInsurance_Request = 10041;
	MsgID_BuyInsurance_Response = 10042;
	MsgID_Game_Settlement_Notice = 10043;
	MsgID_Game_Snapshot_Notice = 10044;
	MsgID_Random_Seat_Notice = 10045;
	MsgID_Game_ShowDown_Notice = 10046;
	MsgID_Room_Situation_Request = 10047;
	MsgID_Room_Situation_Response = 10048;
	MsgID_Room_Situation_Notice = 10049;
	MsgID_SendCard_Fun_Request = 10050;
	MsgID_SendCard_Fun_Response = 10051;
	MsgID_SendCard_Fun_Notice = 10052;
	MsgID_SendChat_Request = 10053;
	MsgID_SendChat_Response = 10054;
	MsgID_SendChat_Notice = 10055;
	MsgID_StayPosition_Request = 10056;
	MsgID_StayPosition_Response = 10057;
	MsgID_StayPosition_Notice = 10058;
	MsgID_BackPosition_Request = 10059;
	MsgID_BackPosition_Response = 10060;
	MsgID_BackPosition_Notice = 10061;
	MsgID_ShowCard_Request = 10062;
	MsgID_ShowCard_Response = 10063;
	MsgID_ShowCard_Notice = 10064;
	MsgID_Login_Player_JoinRoom_Notice = 10065;
	MsgID_Waiting_OtherPlayer_Notice = 10066;
	MsgID_UpdateMoney_Request = 10067;
	MsgID_UpdateMoney_Response = 10068;
	MsgID_Buyin_Notice = 10069;
	MsgID_GameRecords_Notice = 10070;
	MsgID_ModifyBuyinLimit_Request = 10071; //请求增加带入上限
	MsgID_ModifyBuyinLimit_Response = 10072;
	MsgID_ModifyBuyinLimit_Notice = 10073;

	MsgID_BuyInsuranceResult_Notice = 10074;
	MsgID_InsuranceToomanyLeader_Notice = 10075;
	MsgID_InsuranceHitOuts_Notice = 10076;
	MsgID_InsuranceMissOuts_Notice = 10077;
	MsgID_NoNeedInsurance_Notice = 10078;

	MsgID_Snapshot_Request = 10079; 
	MsgID_Snapshot_Response = 10080;
	
	MsgID_Buyout_Request = 10081;
	MsgID_Buyout_Response = 10082;
	MsgID_Buyout_Notice = 10083;
	MsgID_RealStart_Notice = 10084;
	MsgID_AddActionTime_Notice = 10085;
	MsgID_NotSupport_Insurance_Notice = 10086;

	MsgID_HeartBeat_Request = 10087;
	MsgID_HeartBeat_Response = 10088;
	
	MsgID_InteractiveExpression_Request = 10089;
	MsgID_InteractiveExpression_Response = 10090;
	MsgID_InteractiveExpression_Notice = 10091;
	
	MsgID_AddInsuranceTime_Request = 10092;
	MsgID_AddInsuranceTime_Response = 10093;
	MsgID_AddInsuranceTime_Notice = 10094;
	
	MsgID_AddRoomTime_Request = 10095;
	MsgID_AddRoomTime_Response = 10096;
	MsgID_AddRoomTime_Notice = 10097;
	
	MsgID_ProhibitSitdown_Request = 10098;
	MsgID_ProhibitSitdown_Response = 10099;
	MsgID_ProhibitSitdown_Notice = 10100;
	
	MsgID_ForceStandup_Request = 10101;
	MsgID_ForceStandup_Response = 10102;
	MsgID_ForceStandup_Notice = 10103;
	
	MsgID_PauseGame_Request = 10104;
	MsgID_PauseGame_Response = 10105;
	MsgID_PauseGame_Notice = 10106;
	
	MsgID_InitiativeDestroyRoom_Notice = 10107;
	
	MsgID_CheckOutAndLeave_Request = 10108;
	MsgID_CheckOutAndLeave_Response = 10109;
	MsgID_CheckOutAndLeave_Notice = 10110;
	
	MsgID_DefaultFold_Request = 10111;
	MsgID_DefaultFold_Response = 10112;
	
	MsgID_OwnerSetBuyinLimit_Request = 10113;
	MsgID_OwnerSetBuyinLimit_Response = 10114;
	MsgID_OwnerSetBuyinLimit_Notice = 10115;
	
	MsgID_PlayerBuyinsInfo_Request = 10116;
	MsgID_PlayerBuyinsInfo_Response = 10117;
	MsgID_PlayerBuyinsInfo_Notice = 10118;
	
	MsgID_GameActionTurn_Request = 10119;
	MsgID_GameActionTurn_Response = 10120;
	
	MsgID_PhotoVerify_Request = 10121;
	MsgID_PhotoVerify_Response = 10122;
	MsgID_PhotoVerify_Notice = 10123;
	
	MsgID_UploadVerifyPhotoSucc_Request = 10124;
	MsgID_UploadVerifyPhotoSucc_Response = 10125;
	MsgID_UploadVerifyPhotoSucc_Notice = 10126;

	MsgID_GlobalMessage_Notice = 10127;
	MsgID_FairGame_Notice = 10128;
	
	MsgID_CheckAllianceRoomPriviledge_Request = 10129;
	MsgID_CheckAllianceRoomPriviledge_Response = 10130;
	
	MsgID_ForceShowCard_Request = 10131;
	MsgID_ForceShowCard_Response = 10132;
	MsgID_ForceShowCard_Notice = 10133;
	
	MsgID_AddRommExTimeLeft_Notice = 10134;		//房间剩余延时次数通知
	MsgID_AddRoomTimeCount_Request = 10135;     //请求当前房间剩余延时次数
    MsgID_AddRoomTimeCount_response = 10136;    //请求当前房间剩余延时次数响应
}

message PositionInfo{
	float longtitude = 1; //经度
	float latitude  = 2; //纬度
	string ip = 3; //ip addr
}

message PlayerInfo{
	uint32 playerid = 1;
	int32 seatid = 2;
	string name = 3;
	string headurl = 4;
	string marks = 5;
	int32  gender = 6;
	int64 stake = 7;
	string last_voice = 8; //总是保存玩家发过的最后一条chat消息voice类型的内容
	ActionType last_action = 9;
	bool in_game = 10;
	bool inStay = 12; //是否处于保位离桌
	int32 left_stay_time = 13; //如果是保位离桌状态，就是剩余的保位离桌时间
	int64 round_bet = 14; //玩家的本回合下注总数; 比如当前是turn 我下了2次注 一次200 一次raise到800 这个值就是1000 也就是还在桌面上 没有进入pot的金额
	repeated CardItem cards = 15;  //如果入局了 并且是发送目标 就有这个数据  就是说 如果我是断线重连进来的 我已经入局了并且有手牌 那么就有这个值 或者是针对showdown阶段已经show牌的玩家，包括主动show牌的玩家，就是说底牌可见的就有这个数据
	PositionInfo position = 16; //位置信息	
}


//消息体定义

//logon
message RequestLogon {
  string version = 1;
  string token = 2;
  PositionInfo position = 3;
  string device_info = 4;
}

message ResponseLogon {
  int32 error = 1; // 0: success; 1:version not match; 2:uid not-exist; 3:token-failure 
}

//create room

message RoomParams{
	int32 owner_type 					= 1; //区分普通牌具/俱乐部牌局/定制俱乐部牌局
	int32 game_mode 					= 2; //区分普通牌局/比赛/其它游戏类型
	int32 player_count_max 			= 3; //牌桌最大人数
	int32 rule_blind_enum 				= 4; //牌局限定大小盲注对应id
	int32 rule_buyin_min_enum 			= 5; //局限定最小带入对应id
	int32 rule_buyin_fold 				= 6; //牌局限定最大带入对于最小带入的倍数
	int32 rule_time_limit 				= 7; //牌局时长对应8个时长类型
	int32 rule_switch_buyin_control	= 8; //带入控制功能开关
	int32 rule_switch_insurance 		= 9; //保险功能开关
	int32 rule_switch_anti_cheat 		= 10;//防作弊相关功能开关
	int32 rule_switch_force_straddle 	= 11;//强制straddle功能开关
	int32 rule_switch_random_seat 		= 12;//随机入座功能开关
	int64 rule_ante_amount 			= 13;//ante金额
	string game_name 					= 14;//房间名字
	uint32 club_id 						= 15; //创建房间所属的俱乐部id
	bool is_associated_jackpot          = 16; //是否关联jackpot
	bool is_allin_allfold               = 17; //是否是allin allfold
	repeated uint32 alliance_ids         = 18; //联盟id集合
	string owner_clubname 				= 19;//房间所属俱乐部
	uint32 CreaterId = 20;				     //创建房间的玩家ID   
	bool short_game_double_ante			= 21; //短牌模式是否开启Dealer2倍Ante
	bool short_fullhouse_flush_straight_three = 22; //短牌模式开启和长牌同样比牌顺序
	bool is_opened_drawback             = 23; //是否打开撤码功能
	int32 drawback_hold_times 			= 24; //撤出记分牌保留的倍数（为保证整数客户端*10，所以服务器计算时/10）
	int32 drawback_times 				= 25; //撤出记分牌倍数（为保证整数客户端*10，所以服务器计算时/10）
	bool choose_outs 				    = 26; //是否可选outs
	bool muck_switch 				    = 27; //埋牌开关
	bool anti_simulator 			    = 28; //禁止模拟器开关
	bool force_showcard 			    = 29; //强制秀牌开关
	bool unlimit_force_showcard 	= 30; //无限强制秀牌开关
}

message RequestCreateRoom{
	RoomParams param = 1;
}

message ResponseCreateRoom{
	int32 error = 1; //todo: 
}

message NoticeCreateRoom{
	int32 roomid = 1;
}

message RequestDestroyRoom{
	int32 roomid = 1;
}

message ResponseDestroyRoom{
	int32 error = 1;
}

message PlayerSettlement{
	string player_name = 1;
	string player_head = 2;
	int64 player_buyin = 3; //玩家总带入
	int32 player_hand_count = 4; //玩家总共玩了几手牌
	int64 player_settle = 5; //玩家总输赢（当前stake-之前stake)
	uint32 playerid = 6;
}

message CardItem{
	int32 number = 1;
	int32 suit = 2;
}

message HandRecord{
	string player_name 	= 1;
	string player_head = 2;
	int32 player_betting_round_bet = 3; //本局下注的所有筹码总数
	repeated CardItem cards = 4; //手牌
	int64 win_bet = 5; //输赢的筹码数
	bool bought_insurance = 6; //本局是否买过保险
	bool is_fold = 7; //是否弃牌
	bool is_show_card = 8;
	int32 show_card_ids = 9;
	uint32 playerid = 10;
	int64 insurance_bet_amount = 11; //一手牌的投保金额
	int64 insurance_winbet = 12; //一手牌赢的筹码数
	int64 jack_winbet = 13; //一手牌赢的jackpot筹码数
	int64 drawin = 14; //一手牌赢的drawin
	int64 award2_club_fund = 15;
	uint32 last_buyin_clubid = 16;
	bool is_muck = 17; //是否自动埋牌
	bool shot_force = 18; //强制带回击中保险
	bool is_active_show = 19; //主动show
	bool is_force_show = 20; //强制show
}

message GameRecord{
	repeated CardItem public_cards = 1;
	repeated HandRecord records = 2;
	int64 total_pot = 3; //本局总的pot金额
	int64 insurance_winbet = 4; //本局保险输赢（系统角度，系统赔付1000，即-1000）
	int64 insurance_bet = 5; //表示这一手的投保额
	int64 insurance_amount = 6; //表示这一手的保险赔付额
}

message NoticeDestroyRoom{
	int32 roomid = 1;
	uint32 room_create_time = 2; //房间创建时间戳
	int32 room_time_limit = 3;  //设定的游戏时长（秒数）
	string room_owner_name = 4;
	int32 room_rule_blind_enum = 5; //小盲的筹码数
	int32 room_game_hand = 6; 	//本房间总共进行了多少游戏手数
	int64 room_max_pot = 7;    //本房间牌局里面，最大一个pot的金额
	int64 room_total_buyin = 8; //所有人的有效带入总和
	repeated PlayerSettlement settlements = 9;
	uint64 room_uuid = 10; 
	string room_name = 11;
	
}

message RequestJoinRoom{
	int32 roomid = 1;
}

message ResponseJoinRoom{
	int32 error = 1;
	int32 roomid = 2;
}

message RequestLeaveRoom{
	int32 roomid = 1;
}

message ResponseLeaveRoom{
	int32 error = 1;
}

message RequestSitDown{
	int32 roomid = 1;
	int32 seatid = 2;
	PositionInfo position = 3; //位置信息	
}

message ResponseSitDown{
	int32 error = 1;
	uint32 playerid = 2;  //和谁冲突了
	string playername = 3;
}

message NoticeSitDown{
	int32 roomid = 1;
	PlayerInfo player = 2;
}

message RequestStandup{
	int32 roomid = 1;
}

message ResponseStandup{
	int32 error = 1;
}

message NoticeStandup{
	int32 roomid = 1;
	uint32 target_uid = 2;
	int32 seatid = 3;
}


message RequestBuyin{
	int32 roomid = 1;
	int64 amount = 2; //带入金额
	uint32 ownerid = 3;//负责审批的id
	uint32 clubid = 4; //俱乐部id
	uint32 allianceid = 5; //联盟id 联盟牌局：联盟id 非联盟牌局：-1
}

message ResponseBuyin{
	int32 error = 1;
	uint32 playerid = 2; //
	string playername = 3;
}

message BuyinPlayerInfo{
	uint32 playerid = 1;
	int64 amount = 2; //带入金额上限
	string playername = 3;
	string playerhead = 4;
	int32 requestid = 5;
	uint32 timestamp = 6;
	uint32 last_clubid = 8;
	repeated AllianceInfo allianceInfos = 9;
}

message AllianceInfo{
	uint32 alliance_id = 1;
	string alliance_name = 2;
}

message NoticeBuyinToOwner{
	int32 roomid = 1;
	repeated BuyinPlayerInfo buyins = 2;
	string room_name = 3;
	uint32 last_club2allianceid = 4; //联盟(最近一次俱乐部成员向牌局买入的联盟id)
}

message NoticeBuyinToApplicant{
	int32 roomid  = 1;
	int64 amount_limit = 2; //还可以带入的金额
	bool result = 3; //true : ok-to-buyin; false--reject(timeout/reject..etc)
	int64 self_buyin_limit = 4;
	int64 self_buyin = 5;
	int64 self_stake = 6;
	uint64 bank_chips = 7; //身上剩余总筹码
	string room_name = 8;
	uint32 allianceid = 9; //联盟id 联盟牌局：联盟id 非联盟牌局：-1
}

message RequestAnswerBuyin{
	int32 roomid = 1;
	int32 requestid = 2;
	int64 amount = 3;
	bool  result = 4; //true : ok-to-buyin; false--reject
	uint32 alliance_id = 5; 
	uint32 club_id = 6;
}

message ResponseAnswerBuyin{
	int32 error = 1;
	int32 requestid = 2;
	uint32 playerid = 3;
	int64 amount = 4;
	int32 roomid = 5;
	bool  result = 6; //true : ok-to-buyin; false--reject
}

message RequestStartGame{
	int32 roomid = 1;	
}

message ResponseStartGame{
	int32 error = 1;
}

message NoticeStartGame{
	int32 roomid = 1;
}

//重置牌桌
message NoticeResetGame{
	int32 roomid = 1;
	string gameid = 2; //uuid from CF
	repeated PlayerInfo players = 3;//table player
}

message NoticeRandomSeat{
	int32 roomid = 1;
	repeated PlayerInfo players = 2;
}

message PotInfo{
	int32 potid = 1;
	int64 amount = 2;
}

//post
message NoticeGamePost{
	int32 roomid = 1;
	int32 seatid = 2;  	//post玩家座位号
	int64 amount = 3;   //post金额
}

//ante
message NoticeGameAnte{
	int32 roomid = 1;
	repeated int32 seat_list = 2;
	repeated int32 amount_list = 3;
}

//elect dealer
message NoticeGameElectDealer{
	int32 roomid = 1;
	int32 dealer_seatid = 2;
	int32 sb_seateid = 3;
	int32 bb_seatid = 4;
}

//下盲注
message NoticeGameBlind{
	int32 roomid = 1;
	int64 sb_amount = 2;
	int64 bb_amount = 3;
	repeated int32 straddle_seat_list = 5;   //straddle座位列表
	repeated int32 straddle_amount_list = 6; //straddle金额列表
	repeated int32 post_seat_list = 7; //Post座位列表
	int32 sb_seatid = 8; 
	int32 bb_seatid = 9;
	int32 dealer_seatid = 10;
}

//发底牌
message NoticeGameHolecard{
	int32 roomid = 1;
	repeated int32 seat_list = 2;
	repeated CardItem holdcards = 3;
}

enum ActionType {
	Enum_Action_Null 			= 0;
	Enum_Action_Check 			= 1;
	Enum_Action_Fold  			= 2;
	Enum_Action_Call  			= 3;
	Enum_Action_Bet   			= 4;
	Enum_Action_Raise 			= 5;
	Enum_Action_Allin 			= 6;
	Enum_Action_CallMuck 		= 7;
	Enum_Action_AddActionTime 	= 8;
	Enum_Action_SendCard_Common = 9;
	Enum_Action_Send_HoleCards 	= 10;
	Enum_Action_Straddle 		= 11;
	Enum_Action_Post 			= 12;
}

//通知房间内所有人轮到某个玩家进行操作
message NoticePlayerActionTurn{
	int32 roomid = 1;
	int32 curr_action_seat_id = 2;
	int32 curr_action_uid = 3;
	int32 action_time  = 4; //本次操作允许时间
	int32 minimum_bet = 5; //最小下注额度
	int32 last_action_seatid = 6; //上个动作人的座位号
	int32 last_action_uid = 7;  //上个动作人的uid
	bool is_greatest_bet  = 8; //代表上一个玩家是否时有效加注，每个新回合初始为true 
	int32 ActionSeq = 9;
	repeated PlayerInfo players = 10;//当前入座了的完整的玩家结构最多9个 
	repeated PotInfo pots = 11; //当前牌局的Pot信息结构
	int64 last_bet_amount = 12;
	int64 carr_action_seat_roundbet = 13;
	bool default_fold = 14; //是否选择了自动看或弃牌
	int32 call_amount = 15;
	int64 max_round_bet = 16;
	int64 last_valid_raise_amount = 17; //上一次有效加注差额
}

message RequestAction{
	int32 roomid = 1;
	ActionType action = 2;
	int64 amount = 3; //bet & raise
	int32 ActionSeq = 4;
	string token = 5;
}

message ResponseAction{
	int32 error = 1;
}

//广播玩家做出的动作
message NoticePlayerAction{
	int32 roomid = 1;
	int32 last_action_seat_id = 2;
	ActionType action_type = 3;
	int64 amount = 4;
	repeated PotInfo pots = 5;
	bool default_fold = 6;
	int32 ActionSeq = 7;
}

//通知房间内所有人该轮下注回合结束
message NoticeGameRoundEnd{
	int32 roomid = 1;
	repeated PotInfo pots = 2;
	repeated CardItem public_card = 3; //当前牌局的公共牌信息，有几张发几张
}

enum BettingRoundType {
	Enum_BettingRound_Preflop 	= 0;
	Enum_BettingRound_Flop 		= 1;
	Enum_BettingRound_Turn 		= 2;
	Enum_BettingRound_River 	= 3;
}

//发公共牌
message NoticeCommunityCards{
	int32 roomid = 1;
	repeated CardItem cards = 2; //3张;1张; 1张;
	BettingRoundType betting_round = 3;
}

message ShowCardsSeatInfo {
	int32 show_seat_id = 1;
	repeated CardItem cards = 2; //手牌	
}
//show牌阶段
message NoticeGameShowCard{
	int32 roomid = 1;
	repeated ShowCardsSeatInfo show_seats = 2;
}

message OutItem{
	int32 outs_id  = 1;
	CardItem card = 2;
	bool is_tie = 3;
}

message PlayerSeatInfo{
	int32 seatid = 1;
	string playername = 2;
	int32 outs_count = 3;
	repeated CardItem holecards = 4; 
	int64 total_investment = 5;//该玩家在本手游戏中总共下注的金额 相当于是每一轮round_bet的总和
}

//需要购买保险通知
message NoticeGameInsurance{
	int32 roomid = 1;
	repeated PlayerSeatInfo player_seats = 2;
	repeated OutItem outs  = 3;
	int64 pot_amount = 4;
	int64 buy_amount = 5; //上一轮buyer_uid投保额
	int32 buyer_seatid = 6;
	int32 buyer_uid = 7;
	int64 total_pot_amount = 8;// 所有底池金额的总和 不管有没有参与或领先的
	int32 action_seq = 9; //server下发actionseq
	int64 inv_amount = 10; //数据是购买保险者在当前所购买保险的这个底池中所投入的金额
	int64 total_inv_amount = 11; //数据是购买保险者在本手游戏中所投入的金额总数

	int64 total_pot = 12; //数据是本手游戏所有pot的总额

	int32 count_time = 13; //数据是倒计时剩余时间
	int64 limit_amount = 14; //至少需要买多少钱的保险
	repeated CardItem public_cards = 15; //公共牌
}

//购买保险请求
message RequestBuyInsurance{
	int32 roomid = 1;
	int64 amount = 2; //购买保险具体金额, 当amount字段为0时则是客户端选择不买保险
	repeated int32 outs_id = 3; //选中的outs id列表
	int32 action_seq = 4; //购买时，从下发通知中原值返回
	bool is_buy = 5; //买保险=true；不买=false
}

message ResponseBuyInsurance{
	int32 error = 1; //成功发1，不管够不够买保险都要广播房间里所有人NoticeBuyInsuranceResult
}

message WinPotInfo{
	int32 potid = 1; //赢的potid
	int64 amount = 2; //这个pot里面赢了多少钱
}

message PlayerSettleInfo{
	int32 seatid = 1;
	uint32 playerid = 2;
	int64 amount = 3;
	bool  is_steal_blind = 4;
	repeated WinPotInfo pots = 5;
	int64 total_investment = 6;//该玩家在本手游戏中总共下注的金额 相当于是每一轮round_bet的总和 ResetGame时重置为0
}

//结算信息通知
message NoticeGameSettlement {
	int32 roomid = 1;
	repeated PlayerSettleInfo winners = 2;
	repeated PotInfo pots = 3;
	uint64 gameuuid = 4;
}

message RoomStates {
	bool isBegin = 1; //是否已经开始游戏
	bool isWaiting = 2; //是否在由于人数不足在等待开局
	bool isPause = 3; //是否暂停了游戏
	bool isMute = 4; //是否静音 如果静音 chat消息中voice类型的消息会发送失败
}
message TableStates{
	repeated PlayerInfo players = 1;//当前入座了的完整的玩家结构最多9个 
	repeated PotInfo pots = 2; //当前牌局的Pot信息结构 如果是结算阶段已经结算过的pot不发所以最好结算完就删掉该pot
	repeated CardItem public_card = 3; //当前牌局的公共牌信息，有几张发几张
	int32 curr_action_player_seatid = 4;  //当前操作者的座位号 没有就-1
	int32 curr_action_left_time = 5;  //当前操作者剩余的操作时间 没有就-1
	int32 curr_dealer_seatid = 6;  //当前dealer位置
	int32 curr_bb_seatid = 7;  //当前小盲位置
	int32 curr_sb_seatid = 8;  //当前大盲位置
	int32 curr_straddle_seatid = 9;  //当前straddle位置如果有的话
	int64 bb_amount = 10; //大盲注金额
	int64 sb_amount = 11; //小盲注金额
}

message clubInfo{
	uint32 club_id = 1;
	uint32 creater_id = 2;
	string club_name = 3;
}

message NoticeGameSnapshot{
	int32 roomid = 1;
	uint32 room_owner_id = 2; //创建者id
	RoomParams params = 3; //房间参数
	int64 self_buyin_limit = 4; //我在本房间的带入上限  初始为0
	int64 self_buyin = 5; //我在本房间的总共已经带入过的金额 不是stake 初始为0
	int64 self_stake = 6; //我我在该房间中剩余的stake
	RoomStates rstate = 7; //
	repeated BuyinPlayerInfo buyins = 8; //房间消息结构体 针对那些还未超时并且房主未处理的申请，在进入房间的时候发一遍
	TableStates tstate = 9;
	int32 room_create_time = 10; //房间创建时间
	int32 room_start_time = 11; //点击开始时间
	repeated uint64 game_uuids = 12;
	repeated uint32 prohibit_sitdown_list = 13;
	uint32 last_buyin_clubid = 14;
	uint32 last_buyin_ownerid = 15;
	repeated clubInfo clubInfos = 16; 
	repeated PlayerBuyinInfo buyin_infos = 17;
	int32 autoaddactiontime_count = 18; //自动补时次数
	int32 actiontime_count = 19; //自己当前的add action time次数
	repeated uint32 club_createrids = 20;
	int64 total_buyout = 21; //自己的总带出
	uint32 last_buyin_allianceid = 22;
}

message PlayerShowDownInfo{
	int32 seatid = 1;
	uint32 playerid = 2;
	repeated CardItem cards = 3; //手牌
}

message NoticeGameShowDown{
	int32 roomid = 1;
	repeated PlayerShowDownInfo shows = 2;
	repeated uint32 muck_list = 3;
}

message RequestRoomSituation{
	int32 roomid = 1;
}
message ResponseRoomSituation{
	int32 error = 1;
}
message PlayerBuyinInfo{
	string playername = 1;
	uint32 playerid =  2;
	int64 total_buyin = 3;
	int64 curr_record = 4;
	int64 buyin_limit = 5; //已批准的带入上限
}
message NoticeRoomStituation{
	int32 roomid = 1;
	repeated PlayerBuyinInfo buyin_player_list = 2;
	repeated PlayerInfo observer_list = 3;
	int64 insurance_winbet = 4; //本局保险输赢（系统角度，系统赔付1000，即-1000）
	int32 left_time = 5; //房间剩余秒数 
	int32 room_start_time = 6; //点击开始时间
	repeated uint32 bystander_list = 7; //旁观者列表（不包含已退出房间的）
	int64 jackpot_winbet = 8; //本局jackpot输赢（系统角度，系统赔付1000，即-1000）
	repeated uint32 check_out_list = 9; //结算离桌的玩家列表
}

message RequestSendCardFun{
	int32 roomid = 1;
}
message ResponseSendCardFun{
	int32 error = 1;
}
message NoticeRoomCardFun{
	int32 roomid = 1;
	int32 round_state = 2;
	string player_name = 3;
	repeated CardItem cards = 4;
	int32 next_price = 5;
	uint32 player_id = 6;
}

enum ChatType {
	Enum_Emoji 			= 0;
	Enum_Voice 			= 1;
}

message RequestSendChat{
	int32 roomid = 1;
	ChatType ctype = 2;
	string content = 3;
}

message ResponseSendChat{
	int32 error = 1;
}

message NoticeSendChat{
	int32 roomid = 1;
	ChatType ctype = 2; 
	string content = 3;
	uint32 playerid = 4;
	int32 seatid   = 5;
}

message RequestStayPosition{
	int32 roomid = 1;
}

message ResponseStayPosition{
	int32 error = 1;
}

message NoticePlayerStay{
	int32 roomid = 1;
	repeated PlayerInfo players = 2;
}

message RequestBackPosition{
	int32 roomid = 1;
}

message ResponseBackPosition{
	int32 error = 1;
}

message NoticeBackPosition{
	int32 roomid = 1;
	PlayerInfo player = 2;
}

message RequestShowCard{
	int32 roomid = 1;
	int32 cards = 2; //0，1表示第一张和第二张 
	bool is_show = 3; //表示show或者不show 
}

message ResponseShowCard{
	int32 error = 1;
}

message PlayerShowInfo{
	int32 playerid = 1;
	int32 seatid =  2;
	repeated CardItem cards = 3;
}

message NoticePlayerShow{
	int32 roomid = 1;
	repeated int32 show_card_id = 2;
	repeated PlayerShowInfo players = 3;
}

message NoticeLoginPlayerJoinRoom{
	int32 roomid = 1;
	bool anti_simulator = 2;
}

message NoticeWaitingOtherPlayer{
	int32 roomid = 1;
}

message RequestUpdateMoney{
	int64 money = 1;
}
message ResponseUpdateMoney{
	int32 error = 1;
}

//处理完带入请求后（无论成功失败），发送给请求者
message NoticeBuyin{
	int64 self_buyin_limit = 1; //我在本房间的带入上限  初始为0
	int64 self_buyin = 2; //我在本房间的总共已经带入过的金额 不是stake 初始为0
	int64 self_stake = 3; //我在本房间剩余的stake
	int64 bank_chips = 4; //我剩余的筹码（总共的）
	int64 self_buyout =5; //剩余buyout总数
	int32 roomid = 6;
}

message NoticeGameRecords{
	int32 roomid = 1;  
	repeated GameRecord records = 2; // 返回所请求的手牌纪录
}

//请求增加带入上限
message RequestModifyBuyinLimit{
	int64 buyin_limit = 1; //单次增加的上限值
	uint32 last_buyin_clubid = 2;
	uint32 last_buyin_ownerid = 3;
	string last_buyin_clubname = 4;
}

message ResponseModifyBuyinLimit{
	int32 error = 1;
	int32 roomid = 2;
	uint32 playerid = 3;  //和谁冲突了
	string playername = 4; //和谁冲突了
}

message NoticeModifyBuyinLimit{
	int64 buyin_limit = 1; //修改后的带入上限
	int64 buyin_now = 2; //当前已经带入的筹码
	int32 roomid = 3;
}

//通知保险购买结果
message NoticeBuyInsuranceResult{
	int32 room_id = 1;  
	string player_name = 2; //购买保险者的名称
	bool result = 3; //是否购买了保险
	int64 insure_amount = 4; //投保额
}

//最大池多个领先者，无法购买保险
message NoticeInsuranceToomanyLeader{
	int32 room_id = 1;  
}

//击中outs赔付
message NoticeInsuranceHitOuts{
	int32 room_id = 1;  
	string player_name = 2; //购买保险者的名称
	uint32 playerid = 3;
	int64 insure_amount = 4; //投保额
	CardItem card = 5; //击中的outs 结构 card_suit  card_num
	int64 payment = 6; //赔付额  需要立刻加到stake里
}

//未击中outs
message NoticeInsuranceMissOuts{
	int32 room_id = 1;  
	uint32 playerid = 2;
	int64 insure_amount = 3; //投保额
}

message NoticeNoNeedInsurance{
	int32 room_id = 1;
}

//
message RequestSnapshot{
	int32 roomid = 1; 
	string token = 2;
}

message ResponseSnapshot{
	int32 error = 1;
}

message RequestBuyout{
	int32 roomid = 1;
	int64 buyout_gold = 2;
}

message ResponseBuyout{
	int32 error = 1;  
}

message NoticeBuyout{
	int32 roomid = 1;
	int64 buyout_gold = 2;
	int64 remain_gold = 3;
	uint32 seat_no = 4;
	int64 total_buyout = 5;
}

message NoticeRealStart{
	int32 roomid = 1;
	int32 starttime = 2;
}

message NoticeAddActionTime{
	int32 roomid = 1;
	int32 action_seatid = 2;
	int32 rest_action_time = 3;
}
message NoticeNotSupportInsurance{
	int32 roomid = 1;
}

message RequestHeartBeat{
	uint32 uid = 1;
	PositionInfo position = 2; //位置信息	
}

message ResponseHeartBeat{
	uint32 uid = 1;  
}

message RequestInteractiveExpression{
	int32 roomid = 1;
	string content = 2;
}

message ResponseInteractiveExpression{
	int32 error = 1;
}

message NoticeInteractiveExpression{
	int32 roomid = 1;
	string content = 2;
	uint32 playerid = 3;
	int32 seatid   = 4;
}

message RequestAddInsuranceTime{
	int32 roomid = 1;
	int32 action_seq = 2;
}

message ResponseAddInsuranceTime{
	int32 error = 1;
}

message NoticeAddInsuranceTime{
	int32 roomid = 1;
	uint32 playerid = 2;
	int32 action_seatid = 3;
	int32 rest_insurance_time = 4;
}

message RequestAddRoomTime{
	int32 roomid = 1;
}

message ResponseAddRoomTime{
	int32 error = 1;
}

message NoticeAddRoomTime{
	int32 roomid = 1;
	uint32 playerid = 2;
}

message RequestProhibitSitdown{
	int32 roomid = 1;
	uint32 targetid = 2;
	bool isProhibitSitdown = 3;
}

message ResponseProhibitSitdown{
	int32 error = 1;
}

message NoticeProhibitSitdown{
	int32 roomid = 1;
	uint32 playerid = 2;
	string playername = 3;
	bool isProhibitSitdown = 4;
	repeated uint32 prohibit_sitdown_list = 5;
}

message RequestForceStandup{
	int32 roomid = 1;
	uint32 targetid = 2;
}

message ResponseForceStandup{
	int32 error = 1;
}

message NoticeForceStandup{
	int32 roomid = 1;
	uint32 playerid = 2;
	string playername = 3;
}

message RequestPauseGame{
	int32 roomid = 1;
	bool isPause = 2;
}

message ResponsePauseGame{
	int32 error = 1;
}

message NoticePauseGame{
	int32 roomid = 1;
	bool isPause = 2;
}

message NoticeInitiativeDestroyRoom{
	int32 roomid = 1;
	string roomname = 2;
}

message RequestCheckOutAndLeave{
	int32 roomid = 1;
}

message ResponseCheckOutAndLeave{
	int32 error = 1;
}

message NoticeCheckOutAndLeave{
	int32 roomid = 1;
	int32 targetid = 2;
	string name = 3;
}

message RequestDefaultFold{
	int32 roomid = 1;
}

message ResponseDefaultFold{
	int32 error = 1;
}

message RequestOwnerSetBuyinLimit{
	int32 roomid = 1;
	uint32 targetid = 2;
	int64 limit_amount = 3;
}

message ResponseOwnerSetBuyinLimit{
	int32 error = 1;
}

message NoticeOwnerSetBuyinLimit{
	int32 roomid = 1;
	int32 targetid = 2;
	int64 limit_amount = 3;
}

message RequestPlayerBuyinsInfo{
	int32 roomid = 1;
}

message ResponsePlayerBuyinsInfo{
	int32 error = 1;
}

message NoticePlayerBuyinsInfo{
	int32 roomid = 1;
	repeated PlayerBuyinInfo buyin_infos = 2;
}

message RequestGameActionTurn{
	int32 roomid = 1;
	string token = 2;
}

message ResponseGameActionTurn{
	int32 error = 1;
}

message RequestPhotoVerify{
	int32 roomid = 1;
	int32 targetid = 2;
}

message ResponsePhotoVerify{
	int32 error = 1;
}

message NoticePhotoVerify{
	int32 roomid = 1;
	uint32 ownerid = 2;
	int32 targetid = 3;
}

message RequestUploadVerifyPhotoSucc{
	int32 roomid = 1;
	string url = 2;
}

message ResponseUploadVerifyPhotoSucc{
	int32 error = 1;
}

message NoticeUploadVerifyPhotoSucc{
	int32 roomid = 1;
	int32 targetid = 2;
	string url = 3;
}

//全服跑马灯通知
message NoticeGlobalMessage{
	int32 repeat_count = 1; //重复播放次数
	string msg = 2;
}

message NoticeFairGame{
	uint32 playerid = 1;   //被站起玩家id
	string playername = 2; //被站起玩家昵称
	uint32 playerid2 = 3;  //playerid和谁冲突了
	string playername2 = 4;  //
	bool ip = 5;  //ip问题
	bool gps = 6; //gps问题
	int32 roomid = 7;  //
	string roomname = 8;
}

message RequestCheckAllianceRoomPriviledge{
	uint32 playerid = 1;   //被站起玩家id
}

message ResponseCheckAllianceRoomPriviledge{
	int32 error = 1;
}

message RequestForceShowCard{
	int32 roomid = 1;
}

message ResponseForceShowCard{
	int32 error = 1;
}

message NoticeForceShowCard{
	int32 roomid = 1;
	uint32 playerid = 2; //请求者id
	string playername = 3; //请求者名字
	repeated ShowCardsSeatInfo show_seats = 4;
}

message NoticeAddRoomTimeLeft{
	int32 roomid = 1;
	int32 leftcount =2;		//剩余可以延时次数
}

message RequestAddRoomTimeCount{
    int32   roomid = 1;
}

message ResponseAddRoomTimeCount{
    int32 error = 1;
}

