def create_sport_room(msg_dict, session):
    table = TableMgr().create(msg_dict.get("room_id"), msg_dict.get("room_uuid"),
                              "", 0, 0, 0, msg_dict.get("kwargs"), [])
    table.sport_id = msg_dict.get("sport_id")
    players = msg_dict.get("players", [])
    player_tokens = {}
    for p in players:
        player_id = p.get("id")
        info_dict = {"nick": p.get("nick", ""), "icon": p.get("icon", ""), "sex": 1, "game_count": 0, "reg_time": ""}
        info = json.dumps(info_dict, ensure_ascii=False)
        player = Player(player_id, info, None, table)
        from base.state_base.player.init import InitState
        player.machine.trigger(InitState())
        table.lookon_player_dict[player_id] = player
        player.match_score = p.get("score", 0)
        player.is_wait = True
        player.ready()

        token = str(uuid4())
        redis.set("token:{0}".format(player_id), token)
        player_tokens[player_id] = token

    table.dumps()
    table.set_timer("start_10", 10)

    # 发送给Center Server 创建成功的消息
    msg_back = dict()
    msg_back["cmd"] = CG_CREATE_SPORT_ROOM
    msg_back["room_id"] = msg_dict.get("room_id")
    msg_back["state"] = 1
    msg_back["host"] = options.host
    msg_back["port"] = options.server_port
    msg_back["sport_id"] = msg_dict.get("sport_id")
    msg_back["player_tokens"] = player_tokens
    session.send_message(msg_back)  # 发送到游戏服务器
    def enter_room(self, player_id, info, session):
        newinfo = info.replace("\\'", "")
        newinfo = newinfo.replace('\\"', "")
        newinfo = newinfo.replace('\\n', "")
        newinfo = newinfo.replace('\\t', "")
        if not self.owner_info and player_id == self.owner:
            self.owner_info = newinfo
        msg_dict = dict()
        msg_dict["room_id"] = self.room_id
        msg_dict["owner"] = self.owner
        msg_dict["owner_info"] = self.owner_info
        msg_dict["room_state"] = table_state_code_map[self.state]
        msg_dict["round"] = self.cur_round
        msg_dict["rounds"] = self.conf.rounds
        msg_dict["is_admin"] = (player_id in self.guild_admins)

        # if len(self.player_dict.keys()) + len(self.lookon_player_dict.keys()) >= self.chairs + 10:
        # if len(self.player_dict.keys()) >= self.chairs:
        #     msg_dict["code"] = 2
        #     send(ENTER_ROOM, msg_dict, session)
        #     self.logger.warn("room {0} is full, player {1} enter failed".format(self.room_id, player_id))
        #     return

        player = Player(player_id, newinfo, session, self)
        from base.match_mgr import MatchMgr
        MatchMgr().player_enter(player)
        from base.state_base.player.init import InitState
        player.machine.trigger(InitState())
        player.is_wait = True
        self.lookon_player_dict[player_id] = player
        SessionMgr().register(player, session)

        msg_dict["code"] = 0
        msg_dict["kwargs"] = self.kwargs
        msg_dict["rest_cards"] = self.cards_total
        msg_dict["state"] = player_state_code_map[player.state]
        msg_dict["player"] = list()
        msg_dict["dealer"] = self.dealer_seat
        msg_dict["player_status"] = player_state_code_map["InitState"]
        for k, v in self.seat_dict.items():
            p = dict()
            p["seat"] = k
            p["player"] = v.uuid
            p["info"] = v.info
            p["state"] = player_state_code_map[v.state]
            p["is_online"] = v.is_online
            p["score"] = v.get_total_score()
            p["pledge"] = v.round.pledge
            p["loot_dealer"] = v.round.loot_dealer
            p["is_wait"] = v.is_wait
            p["niu_type"] = v.round.niu_type

            if v.session is not None:
                p["ip"] = v.session.address[0]
            msg_dict["player"].append(p)

            p["cards_in_hand"] = list()
            count = len(v.round.cards_in_hand)
            if v.state == "ShowCardState":
                p["cardsign_in_hand"] = list()
                cards_hand = copy.deepcopy(v.round.cards_in_hand)
                cardsign_in_hand = show_card_type2(v.round.cards_in_hand,
                                                   v.round.niu_type)
                for w in cardsign_in_hand:
                    p["cardsign_in_hand"].append(w)
                for c in cards_hand:
                    p["cards_in_hand"].append(c)
            else:
                for _ in v.round.cards_in_hand:
                    p["cards_in_hand"].append(0)

        send(ENTER_ROOM, msg_dict, session)
        '''
        msg_dict = dict()
        msg_dict["player"] = player_id
        msg_dict["info"] = player.info
        msg_dict["seat"] = player.seat
        msg_dict["dealer"] = self.dealer_seat  # 庄家位置
        msg_dict["state"] = player_state_code_map[player.state]
        msg_dict["is_online"] = player.is_online
        msg_dict["score"] = player.room.score
        msg_dict["pledge"] = player.round.pledge
        msg_dict["loot_dealer"] = player.round.loot_dealer
        msg_dict["is_wait"] = player.is_wait
        msg_dict["ip"] = player.session.address[0]

        for i in self.player_dict.values():
            if i.uuid == player_id:
                continue
            send(ENTER_ROOM_OTHER, msg_dict, i.session)
       '''
        self.dumps()

        self.logger.info("player {0} enter room".format(player_id))