package com.backfire.socket;

public class SocketCommand {

	public static final short RET_SUCCESS = 1;
	public static final short RET_FAIL = 1;

	public static final short CLI_LOGIN_OUT_REQ = 1001;
	public static final short SVR_LOGIN_OUT_RPY = 2001;

	public static final short CLI_AUTH_REQ = 1002; // 认证请求
	public static final short SVR_AUTH_RPY = 2002; // 认证回应

	public static final short CLI_REBIND_REQ = 1003; // 断线重连请求
	public static final short SVR_REBIND_RPY = 2003; // 断线重连回应

	public static final short CLI_USER_SIT_REQ = 1004; // 玩家坐下/站起请求
	public static final short SVR_USER_SIT_RPY = 2004; // 玩家坐下/站起回应

	public static final short CLI_PLAYER_READY = 1005; // 玩家准备请求
	public static final short SVR_PLAYER_READY_RPY = 2005; // 玩家准备回应
	public static final short BROAD_PLAYERINFO_RPY = 2006; // 房间内玩家信息广播

	public static final short BROAD_HAND_CARD = 2007; // 手牌信息广播
	public static final short CLI_QIANGDIZHU_REQ = 1008; // 抢地主请求
	public static final short SVR_QIANGDIZHU_RPY = 2008; // 抢地主回应

	public static final short BROAD_GAME_START = 2009; // 游戏开始命令
	public static final short CLI_USER_PLAY_ACTION_REQ = 1010; // 玩家动作请求
	public static final short SVR_USER_PLAY_ACTION_RPY = 2010; // 玩家动作回应
	public static final short BROAD_USER_PLAYER_ACTION = 2011; // 对手动作回应
	public static final short BROAD_GAME_OVER = 2012; // 牌局结束回应

	public static final short CLI_PLAYER_DEPOSIT_REQ = 1013; // 托管请求
	public static final short SVR_PLAYER_DEPOSIT_RPY = 2013; // 托管回应

	public static final short BROAD_CAST_LAIZI = 2014; // 广播癞子牌

	public static final short CLI_CREATE_ROOM_REQ = 1015; // 创建房间请求
	public static final short AVR_CREATE_ROOM_RPY = 2015; // 创建房间请求回应
	public static final short CLI_DESTROY_ROOM_REQ = 1016; // 房间销毁请求
	public static final short SVR_DESTROY_ROOM_RPY = 2016; // 房间销毁请求回应
	public static final short CLI_PRIVATE_ROOM_STATUS_REQ = 1017; // 私人房间状态请求
	public static final short SVR_PRIVATE_ROOM_STATUS_RPY = 2017; // 私人房间状态回应

	public static final short CLI_CHAT_REQ = 1018;// 聊天请求
	public static final short SVR_CHAT_RPY = 2018;// 聊天回应

	public static final short CLI_HEART_BEAT_REQ = 1111; // 心跳请求
	public static final short SVR_HEART_BEAT_RPY = 2111; // 心跳回应

	public static final short SERVER_CHECK_SUM = 2;
	public static final short SERVER_SUBPACKET_VER = 1;

	public static final short CONBROKEN_INTERVAL = 10; // 发心跳包间隔时间(秒)
	public static final short DETECT_CONN_TIME = 30; // 提示网络中断(心跳包超时时间)(秒)

	// for debug
	public static String toString(int cmd) {
		switch (cmd) {

		case CLI_LOGIN_OUT_REQ:
			return "CLI_LOGIN_OUT_REQ";
		case SVR_LOGIN_OUT_RPY:
			return "SVR_LOGIN_OUT_RPY";
		case CLI_AUTH_REQ:
			return "CLI_AUTH_REQ";
		case SVR_AUTH_RPY:
			return "SVR_AUTH_RPY";
		case CLI_REBIND_REQ:
			return "CLI_REBIND_REQ";
		case SVR_REBIND_RPY:
			return "SVR_REBIND_RPY";
		case CLI_USER_SIT_REQ:
			return "CLI_USER_SIT_REQ";
		case SVR_USER_SIT_RPY:
			return "SVR_USER_SIT_RPY";
		case CLI_PLAYER_READY:
			return "CLI_PLAYER_READY";
		case SVR_PLAYER_READY_RPY:
			return "SVR_PLAYER_READY_RPY";
		case BROAD_PLAYERINFO_RPY:
			return "BROAD_PLAYERINFO_RPY";

		case BROAD_HAND_CARD:
			return "BROAD_HAND_CARD";
		case CLI_QIANGDIZHU_REQ:
			return "CLI_QIANGDIZHU_REQ";
		case SVR_QIANGDIZHU_RPY:
			return "SVR_QIANGDIZHU_RPY";
		case BROAD_GAME_START:
			return "BROAD_GAME_START";
		case CLI_USER_PLAY_ACTION_REQ:
			return "CLI_USER_PLAY_ACTION_REQ";
		case SVR_USER_PLAY_ACTION_RPY:
			return "SVR_USER_PLAY_ACTION_RPY";
		case BROAD_USER_PLAYER_ACTION:
			return "BROAD_USER_PLAYER_ACTION";
		case BROAD_GAME_OVER:
			return "BROAD_GAME_OVER";
		case CLI_PLAYER_DEPOSIT_REQ:
			return "CLI_PLAYER_DEPOSIT_REQ";
		case SVR_PLAYER_DEPOSIT_RPY:
			return "SVR_PLAYER_DEPOSIT_RPY";
		case BROAD_CAST_LAIZI:
			return "BROAD_CAST_LAIZI";
		default:
			return Integer.toHexString(cmd);
		}
	}
}
