def doHeartBeat(self): if self._state == self.STATE_IDLE: return FTTimer(1, self.doHeartBeat) if len(self.users) == 0: return if ftlog.is_debug(): ftlog.debug("<<", self.baseLogStr(), caller=self) # ftlog.debug("|first user, enter time, now, wait_time:", self.users.keys()[0], self.users[self.users.keys()[0]], time.time(), self.wait_time) if self._state == self.STATE_LOOP: if len(self.users) >= self.n_start: self._tryStartNewTable(self.n_start) return if time.time() - self.users[self.users.keys() [0]]["enterTime"] < self.wait_time: return if len(self.users) >= self.minTriggerLen: self._tryStartNewTable(self.minTriggerLen) return if TYPlayer.isRobot(self.users.keys()[0]): return if len(self.room._roomUsers) < self.n_start: self.notifyRobot()
def enterFriendTable(userId, gameId, clientId, ftId): """进入自建桌""" if ftlog.is_debug(): ftlog.debug('hall_friend_table.enterFriendTable userId:', userId, ' pluginId:', gameId, ' clientId:', clientId, ' ftId:', ftId) pluginId = queryFriendTable(ftId) if not pluginId: TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip('该房间不存在')) return if TYPlayer.isRobot(userId): isValidPluginId = True else: isValidPluginId = False from hall.entity import hallgamelist2 template = hallgamelist2.getUITemplate(gameId, userId, clientId) for version in template.versionList: if pluginId == version.game.gameId: isValidPluginId = True break if not isValidPluginId: TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip('该安装包不支持此房间号所对应的玩法')) return ftlog.info('hall_friend_table.enterFriendTable userId:', userId, ' lead to pluginId:', pluginId) pluginId = int(pluginId) TYGame(pluginId).enterFriendTable(userId, gameId, clientId, ftId)
def doHeartBeat(self): if self._state == self.STATE_IDLE: return FTTimer(1, self.doHeartBeat) if len(self.users) == 0: return if ftlog.is_debug(): ftlog.debug("<<", self.baseLogStr(), caller=self) # ftlog.debug("|first user, enter time, now, wait_time:", self.users.keys()[0], self.users[self.users.keys()[0]], time.time(), self.wait_time) if self._state == self.STATE_LOOP: if len(self.users) >= self.n_start: self._tryStartNewTable(self.n_start) return if time.time() - self.users[self.users.keys()[0]]["enterTime"] < self.wait_time: return if len(self.users) >= self.minTriggerLen: self._tryStartNewTable(self.minTriggerLen) return if TYPlayer.isRobot(self.users.keys()[0]): return if len(self.room._roomUsers) < self.n_start: self.notifyRobot()
def initUser(self, isNextBuyin, isUsingScore, randomIndex=0): ''' 从redis里获取并初始化player数据, 远程操作 ''' ret = super(DizhuPlayerHeroMatch, self).initUser(isNextBuyin, isUsingScore) if TYPlayer.isRobot(self.userId): from dizhu.wx_resource import wx_resource wx_resource.initRobotSetting() wxUserInfo = wx_resource.getRobot(randomIndex) self.datas['sex'] = wxUserInfo['sex'] self.datas['name'] = wxUserInfo['name'] self.datas['purl'] = wxUserInfo['purl'] self.clientId = 'robot_3.7_-hall6-robot' return ret
def doFirstCallDizhu(self, player): ''' 延迟发送, 触发第一个叫地主的玩家 ''' ftlog.debug('doFirstCallDizhu...') if self.table.status.state != DizhuState.TABLE_STATE_CALLING: ftlog.warn('ERROR !!, doFirstCallDizhu table.status=', self.table.status, player) return for seat in self.table.seats: if TYPlayer.isRobot(seat.userId): seat.isRobot = 1 self._doNextCall(0)
def sendChuPaiNextRes(self, seatId, opTime): super(DizhuMillionHeroMatchSender, self).sendChuPaiNextRes(seatId, opTime) # 收到next命令cancel所有的seatOpTimer self.table.cancelAllSeatOpTimers() # 机器人出牌,延时2秒 player = self.table.players[seatId - 1] if TYPlayer.isRobot(player.userId): params = { 'seatId': seatId, 'userId': player.userId, 'ccrc': self.table.status.cardCrc } self.table.seatOpTimers[seatId - 1].setup(random.randint(2, 4), 'AI_OUTCARD_TIMEUP', params)
def sendTuoGuanRes(self, seatId): robots = [] for seat in self.table.seats: if TYPlayer.isRobot(seat.userId): continue robots.append(seat.isRobot) mo = self.createMsgPackRes('table_call', 'rb') mo.setResult('robots', robots) mo.setResult('seatId', seatId) ccount = len(self.table.seats[seatId - 1].cards) if ccount > 2: mo.setResult('tuoguantip', "我托管,我包赔!有钱就是这么任性!!") self.sendToAllTableUser(mo)
def _checkIfForceRobot(self, player, tuoGuanType): ''' 每次超时均检查是否需要强制进入托管状态 ''' if TYPlayer.isRobot(player.userId): return seat = self.table.seats[player.seatIndex] if tuoGuanType == DizhuPlayer.TUGUAN_TYPE_USERACT: # 用户出牌 seat.timeOutCount = 0 elif tuoGuanType == DizhuPlayer.TUGUAN_TYPE_TIMEOUT: # 正常操作超时 seat.timeOutCount = seat.timeOutCount + 1 ftlog.debug('_checkIfForceRobot->userId=', player.userId, 'seat.timeOutCount=', seat.timeOutCount, 'die=', self.table.runConfig.robotTimes) if seat.timeOutCount >= self.table.runConfig.robotTimes: self._doTuoGuan(player, True)
def doTableGameStartGT(roomId, tableId, roundId, dizhuUserId, baseCardType, roomMutil, basebet, basemulti, userIds): # 触发游戏开始的事件, 在此事件监听中处理用户的winrate以及其他任务或属性的调整和设定 # 更新宝箱的状态 tbinfos = {} datas = {'tbinfos': tbinfos} for userId in userIds: if TYPlayer.isRobot(userId): continue try: tbinfo = _doTableGameStartUT1(userId, roomId, tableId, dizhuUserId, baseCardType, roomMutil, basebet, basemulti) tbinfos.update(tbinfo) except: ftlog.error('table_winlose.doTableGameStartGT userId=', userId, 'roomId=', roomId, 'tableId=', tableId) return datas
def doLeave(self, userId, msg): ftlog.hinfo("doLeave |userId, msg:", userId, msg, caller=self) reason = msg.getParam("reason", TYRoom.LEAVE_ROOM_REASON_ACTIVE) assert isinstance(reason, int) needSendRes = msg.getParam("needSendRes", True) assert isinstance(needSendRes, bool) clientRoomId = msg.getParam("clientRoomId", self.roomId) assert isinstance(clientRoomId, int) if not self._leave(userId, reason, needSendRes): reason = TYRoom.LEAVE_ROOM_REASON_FORBIT TYPluginCenter.event( TYPluginUtils.updateMsg(cmd='EV_LEAVE_ROOM', params=TYPluginUtils.mkdict( userId=userId, roomId=self.roomId, reason=reason)), self.gameId) msgRes = MsgPack() if not pokerconf.isOpenMoreTable(sessiondata.getClientId(userId)): msgRes.setCmd("room_leave") else: msgRes.setCmd("room") msgRes.setResult("action", "leave") msgRes.setResult("reason", reason) msgRes.setResult("gameId", self.gameId) msgRes.setResult( "roomId", clientRoomId) # 处理结果返回给客户端时,部分游戏(例如德州、三顺)需要判断返回的roomId是否与本地一致 msgRes.setResult("userId", userId) if needSendRes or TYPlayer.isRobot(userId): # 需要通知机器人stop router.sendToUser(msgRes, userId)
def _do_room__leave(self, msg): userId = msg.getParam('userId') reason = msg.getParam('reason', TYRoom.LEAVE_ROOM_REASON_ACTIVE) needSendRes = msg.getParam('needSendRes', True) clientRoomId = msg.getParam('clientRoomId', self.roomId) # 兼容老客户端 bigRoomId = gdata.getBigRoomId(clientRoomId) if clientRoomId == bigRoomId: clientRoomId = self._choiceTableRoom(userId) if not self.leaveRoom(userId, clientRoomId, reason): reason = TYRoom.LEAVE_ROOM_REASON_FORBIT mp = MsgPack() mp.setCmd('room_leave') mp.setResult('reason', reason) mp.setResult('gameId', self.gameId) mp.setResult( 'roomId', clientRoomId) # 处理结果返回给客户端时,部分游戏(例如德州、三顺)需要判断返回的roomId是否与本地一致 mp.setResult('userId', userId) if needSendRes or TYPlayer.isRobot(userId): # 需要通知机器人stop router.sendToUser(mp, userId)
def doInitTableUserData(userId, bigRoomId, tableId, isNextBuyin, buyinchip, isMatch=False): clientId = sessiondata.getClientId(userId) isSupportBuyin = dizhuconf.isSupportBuyin(clientId) exp, suaddress, susex, suname, sucoin, charm = userdata.getAttrs( userId, ['exp', 'address', 'sex', 'name', 'coin', 'charm']) sugold, slevel, swinrate, winchips, starid, winstreak = gamedata.getGameAttrs( userId, DIZHU_GAMEID, ['gold', 'level', 'winrate', 'winchips', 'starid', 'winstreak']) ftlog.debug('isSupportBuyin=', isSupportBuyin, 'userdata->', suaddress, susex, suname, sucoin, exp, charm) ftlog.debug('gamedata->', sugold, slevel, swinrate, winchips, starid) swinrate = strutil.loads(swinrate, ignoreException=True, execptionValue={ 'pt': 0, 'wt': 0 }) suchip = userchip.getChip(userId) buyin_tip = '' if not isSupportBuyin or isMatch: buyinMark = 0 buyin_chip = suchip else: buyinMark = 1 buyin_chip = userchip.getTableChip(userId, DIZHU_GAMEID, tableId) buyinconf = dizhuconf.getBuyInConf() if buyin_chip == buyinchip: if isNextBuyin: buyin_tip = buyinconf.get('tip_auto', '') else: buyin_tip = buyinconf.get('tip', '').format(BUYIN_CHIP=buyinchip) else: if suchip <= 0: if isNextBuyin: buyin_tip = buyinconf.get('tip_auto_all_next', '') else: buyin_tip = buyinconf.get('tip_auto_all', '') suchip = buyin_chip tbplaytimes, tbplaycount = treasurebox.getTreasureBoxState( userId, bigRoomId) try: if TYPlayer.isRobot(userId): supic, isBeauty = '', False else: supic, isBeauty = halluser.getUserHeadUrl(userId, clientId) except: supic, isBeauty = '', False slevel = _recoverUserAttr(slevel, int, 0) datas = {} datas['uid'] = userId datas['address'] = _recoverUserAttr(suaddress, unicode, '') datas['sex'] = _recoverUserAttr(susex, int, 0) datas['name'] = _recoverUserAttr(suname, unicode, '') datas['coin'] = _recoverUserAttr(sucoin, int, 0) datas['headUrl'] = '' datas['purl'] = supic datas['isBeauty'] = isBeauty datas['chip'] = suchip datas['buyinMark'] = buyinMark datas['buyinChip'] = buyin_chip datas['buyinTip'] = buyin_tip datas['exp'] = _recoverUserAttr(exp, int, 0) datas['gold'] = _recoverUserAttr(sugold, int, 0) datas['vipzuan'] = [] datas['tbc'] = tbplaycount datas['tbt'] = tbplaytimes datas['level'] = slevel datas['wins'] = swinrate.get('wt', 0) datas['plays'] = swinrate.get('pt', 0) datas['winchips'] = _recoverUserAttr(winchips, int, 0) datas['nextexp'] = dizhuaccount.getGameUserNextExp(slevel) datas['title'] = dizhuaccount.getGameUserTitle(slevel) datas['medals'] = _buildUserMedals() datas['skillScoreInfo'] = skillscore.score_info(userId) datas['charm'] = 0 if charm == None else _recoverUserAttr(charm, int, 0) datas['vipInfo'] = hallvip.userVipSystem.getVipInfo(userId) datas['starid'] = 0 if starid == None else _recoverUserAttr(starid, int, 0) datas['winstreak'] = 0 if winstreak == None else _recoverUserAttr( winstreak, int, 0) datas['gameClientVer'] = SessionDizhuVersion.getVersionNumber(userId) # TODO 查询用户增值位 datas['wearedItems'] = [] userBag = hallitem.itemSystem.loadUserAssets(userId).getUserBag() timestamp = pktimestamp.getCurrentTimestamp() memberCardItem = userBag.getItemByKindId(hallitem.ITEM_MEMBER_NEW_KIND_ID) datas[ 'memberExpires'] = memberCardItem.expiresTime if memberCardItem else 0 item = userBag.getItemByKindId(hallitem.ITEM_CARD_NOTE_KIND_ID) cardNoteCount = 0 if item and not item.isDied(timestamp): cardNoteCount = max(1, item.balance(timestamp)) ftlog.debug('DizhuPlayer->userId=', userId, 'isSupportBuyin=', isSupportBuyin, 'cardNoteCount=', cardNoteCount, 'clientId=', clientId, 'data=', datas) return isSupportBuyin, cardNoteCount, clientId, datas
def _doNext(self, isFirst): ftlog.debug('_doNext-->isFirst=', isFirst, 'self.table.status.nowOper=', self.table.status.nowOper) # 查找下一个出牌的玩家座位ID if isFirst == 0: # 非第一次出牌, 查找 nsid = self._findNextPlayerSeatId() else: # 第一次, 出牌, 固定为地主出牌 self.table.status.nowOper = self.table.status.diZhu nsid = self.table.status.nowOper if nsid <= 0: ftlog.warn('doNext can not found next player...') return ftlog.debug('_doNext-->isFirst=', isFirst, 'nsid=', nsid) # 出牌的简单的crc校验码处理 self.table.status.cardCrc += 1 self.table.status.nowOper = nsid # 出牌计时器处理 tuoGuanType = DizhuPlayer.TUGUAN_TYPE_USERACT autocard = 0 seat = self.table.seats[nsid - 1] opTime = self.table.runConfig.optimeFirst if isFirst else self.table.runConfig.optime opTime -= self.opTimePunishMatch(seat) if (seat.isRobot == 1) and TYPlayer.isHuman(seat.userId): # 如果是托管状态, 那么最短时间超时, 由超时处理中,处理是否出牌 tuoGuanType = DizhuPlayer.TUGUAN_TYPE_ALREADY_TUOGUAN latetime = self.table.runConfig.optimeAlreadyTuoGuan ftlog.debug('autocard 1...') autocard = 1 else: # 正常出牌超时控制 tuoGuanType = DizhuPlayer.TUGUAN_TYPE_TIMEOUT latetime = opTime # 只剩一张牌时,自动出牌 if len(seat.cards) == 1: tuoGuanType = DizhuPlayer.TUGUAN_TYPE_SYS_FAST_CARD latetime = self.table.runConfig.optimeOnlyOneCard ftlog.debug('autocard 2...') autocard = 1 # 如果上家出的是火箭, 那么自动不出牌 if nsid in self._doubleKingNoCard: tuoGuanType = DizhuPlayer.TUGUAN_TYPE_SYS_FAST_CARD latetime = self.table.runConfig.optimeDoubleKing ftlog.debug('autocard 3...') autocard = 1 del self._doubleKingNoCard[nsid] params = { 'tuoGuanType': tuoGuanType, 'seatId': nsid, 'userId': seat.userId, 'ccrc': self.table.status.cardCrc } ftlog.debug('params:', params, ' latetime:', latetime, ' autocard:', autocard) if autocard or (not TYPlayer.isRobot(seat.userId)): # 真实玩家启动出牌超时计时器 self.table.tableTimer.setup(latetime, 'CL_TIMEUP', params) # 牌局记录器处理 self.table.gameRound.next(nsid - 1, 0, opTime) if autocard: # 自动出牌, 不发送next消息 return # 发送下一个出牌的消息至客户端 self.sender.sendChuPaiNextRes(nsid, opTime)
def doChuPai(self, player, cards, mcrc, tuoGuanType): ftlog.debug('doChuPai tid=', self.table.tableId, 'the mcrc=', mcrc, 'ccrc=', self.table.status.cardCrc, 'cards=', cards, 'mcrc=', mcrc, 'tuoGuanType=', tuoGuanType) if not player or self.table.status.state != DizhuState.TABLE_STATE_PLAYING: ftlog.warn('ERROR !!, doChuPai table.status=', self.table.status, player) return # 清理超时的次数 seat = self.table.seats[player.seatIndex] #seat.robotCardCount = 0 # 首先校验出牌的CRC if mcrc >= 0 and mcrc != self.table.status.cardCrc: ftlog.warn('doChuPai the ccrc error ! mcrc=', mcrc, 'ccrc=', self.table.status.cardCrc) self.sender.sendTableInfoRes(player.userId, player.clientId, 0) return # 托管出牌处理 ftlog.debug("doChuPai userId=", player.userId, "card=", cards, "tuoGuanType=", tuoGuanType) if tuoGuanType != DizhuPlayer.TUGUAN_TYPE_USERACT: cards = self.punish.doRobotAutoCard(player.seatId, tuoGuanType) # 出牌数据校验 canOutCard, cards = self._doChuPaiVerifyCard(player.seatId, cards) ftlog.debug('doChuPai tid=', self.table.tableId, 'canOutCard=', canOutCard, 'cards=', cards) if not canOutCard: ftlog.warn('ERROR cardOp verifyCard error') return if not cards and self.table.status.topSeatId == player.seatId: ftlog.warn( 'ERROR GameTable->doChuPai the top seat must chupai, but cards is none !' ) return precard = seat.cards[:] # 出牌牌型校验 validCards = self.card.validateCards(cards, None) delayNextStep = False if cards: if not validCards: ftlog.warn('ERROR GameTable->doChuPai the cards is invalid!', 'tableId=', self.table.tableId, 'seat=', (player.userId, player.seatId), 'cards=', cards) return # 如果是管牌,并且(牌型不对或者牌型管不住TOPCARD)则忽略出牌 if (self.table.status.topSeatId != 0 and self.table.status.topSeatId != player.seatId and (not validCards or not self._isGreaterThan( validCards, self.table.status.topCardList))): ftlog.warn('doChuPai seatId=', player.seatId, 'cards=', cards, 'topseat=', self.table.status.topSeatId, 'topcards=', self.table.status.topCardList, 'validCards=', validCards) cards = [] validCards = None if cards: if validCards: if validCards.isHuoJian(): # 火箭, 倍数翻倍 delayNextStep = True self.table.status.bomb += 1 seat.couponCard[0] += 1 elif validCards.isZhaDan(): # 炸弹, 倍数翻倍 delayNextStep = True self.table.status.bomb += 1 seat.couponCard[1] += 1 elif validCards.isFeiJiDai1() or validCards.isFeiJiDai2(): # 飞机 seat.couponCard[2] += 1 # 出牌处理 self._outCard(player, seat, cards) # 如果出的是火箭, 那么记录另外两个玩家的ID, 需要进行快速不出牌处理 if self.card.isDoubleKing(cards): for x in xrange(len(self.table.seats)): if x != player.seatIndex: self._doubleKingNoCard[x + 1] = 1 # 记录最后出牌的信息 seat.outCardCount += 1 self.table.status.topValidCard = validCards self.table.status.topCardList = cards self.table.status.topSeatId = player.seatId # 清除当前的计时器 ftlog.debug('doChuPai tid=', self.table.tableId, 'seat.cards=', seat.cards, 'topSeatId=', player.seatId, 'outCards=', cards) self.table.tableTimer.cancel() # 刷新上一次出牌 seat.lastOutCards = seat.outCards seat.outCards = cards # 发送出牌的响应消息 self.sender.sendChuPaiRes(player.seatId, player.userId, cards, precard, tuoGuanType) # 牌局记录器处理 self.table.gameRound.outCard(player.seatIndex, cards[:], self.calcCurTotalMulti()) # BI日志汇报 if TYPlayer.isRobot(player.userId): player.clientId = 'robot_3.7_-hall6-robot' bireport.reportCardEvent('TABLE_CARD', player.userId, self.table.gameId, self.table.roomId, self.table.tableId, self.table.gameRound.number, 0, 0, 0, cards, player.clientId, 0, 0) if delayNextStep: interval = dizhuconf.getPublic().get('bombNextDelay', 0) if interval > 0: FTTasklet.getCurrentFTTasklet().sleepNb(interval) self.nextStep(player)
def sendTableInfoRes(self, userId, clientId, isrobot): ''' 给牌桌上的人发送tableInfo ''' if TYPlayer.isRobot(userId): return ftlog.debug('userId', userId, "|clientId", clientId, 'isrobot=', isrobot, caller=self) tableInfo = self.table._match_table_info if not tableInfo: ftlog.error('DizhuArenaSender.sendTableInfoRes NoMatchTableInfo', 'userId=', userId, 'clientId=', clientId, 'isrobot=', isrobot) return player = self.table.getPlayer(userId) if not player: ftlog.error('DizhuArenaSender.sendTableInfoRes NoPlayer', 'userId=', userId, 'clientId=', clientId, 'isrobot=', isrobot) return baseinfo = self.table.buildBasicInfo(False, userId, clientId) mo = self.createMsgPackRes("table_info") playMode = self.table.gamePlay.getPlayMode() isMatch = self.table.isMatch mo.setResult('isrobot', isrobot) mo.setResult('playMode', playMode) roomLevel = gdata.roomIdDefineMap()[self.table.roomId].configure.get( 'roomLevel', 1) mo.setResult('roomLevel', roomLevel) roomName = self.table.room.roomConf['name'] if self.table.room else '' mo.setResult('roomName', roomName) mo.setResult('isMatch', isMatch) mo.setResult('notShowRank', 1) mo.setResult('info', baseinfo['info']) mo.setResult('config', baseinfo['config']) mo.setResult('stat', self.buildStatusInfoDict(player)) mo.setResult('myCardNote', self.buildCardNote(player.seatIndex)) if self.table.gameRound: mo.setResult('roundId', self.table.gameRound.roundId) if self.table._complain_open: clientIdVer = sessiondata.getClientIdVer(userId) clientIdLimit = dizhuconf.getAllComplainInfo().get( "clientIdLimit", 3.72) if clientIdVer >= clientIdLimit: mo.setResult('complain', self.table._complain) for i in xrange(len(self.table.seats)): seat = self.table.seats[i] oseat = self.buildSeatInfo(player, seat) seatuid = seat.userId if seatuid: seatPlayer = self.table.players[i] oseat.update(seatPlayer.datas) oseat['cardNote'] = seatPlayer.getCardNoteCount() seatPlayer.cleanDataAfterFirstUserInfo() else: oseat['uid'] = 0 mo.setResult('seat' + str(i + 1), oseat) tmpobsr = [] for _, obuser in self.table.observers.items(): if obuser: tmpobsr.append((obuser.userId, obuser.name)) mo.setResult('obsr', tmpobsr) mo.setResult('betpoolClose', 1) if player and player.getCardNoteCount() < 1: tableConf = self.table.room.roomConf.get( 'tableConf') if self.table.room else None cardNoteChip = tableConf.get('cardNoteChip', 0) cardNoteDiamod = tableConf.get('cardNoteDiamond', 0) cardNote = dizhuconf.getCardNoteTips(userId, player.datas.get('chip', 0), clientId, cardNoteChip, cardNoteDiamod) if cardNote: mo.setResult('cardNote', cardNote) # 发送消息至客户端 router.sendToUser(mo, userId)
def _doMatchQuickStart(self): ''' 牌桌开始 初始化牌桌玩家 如果是机器人,根据需求初始化机器人信息 ''' robots = [1, 2] tableInfo = self._match_table_info userInfos = tableInfo['users'] userIds = [] userSeatList = [] for i, userInfo in enumerate(userInfos): if userInfo['type'] == 'robot': userInfo['userId'] = robots.pop() this_seat = self.seats[i] userIds.append(userInfo['userId']) this_seat.userId = userInfo['userId'] this_seat.state = TYSeat.SEAT_STATE_WAIT this_seat.call123 = -1 userSeatList.append((userInfo['userId'], i + 1)) # 初始化用户数据 from dizhu.wx_resource import wx_resource wx_resource.initRobotSetting() robotCount = wx_resource.getRobotCount() robotRange = range(0, robotCount) robots = random.sample(robotRange, 3) for x in xrange(len(self.players)): self.players[x].initUser(0, 1, robots[x]) for userId, seatId in userSeatList: if TYPlayer.isRobot(userId): continue onlinedata.addOnlineLoc(userId, self.roomId, self.tableId, seatId) if ftlog.is_debug(): ftlog.debug("|locList:", onlinedata.getOnlineLocList(userId), caller=self) # 做一个延迟 delayConf = dizhuconf.getPublic().get('matchAnimationDelay', '') inter = delayConf.get('waitToNextMatch', 3) FTTasklet.getCurrentFTTasklet().sleepNb(inter) for x in xrange(len(self.seats)): this_seat = self.seats[x] if TYPlayer.isHuman(this_seat.userId): mq = MsgPack() mq.setCmd('quick_start') mq.setResult('userId', this_seat.userId) mq.setResult('gameId', self.gameId) mq.setResult('roomId', self.roomId) mq.setResult('tableId', self.tableId) mq.setResult('seatId', x + 1) mq.setResult('isOK', True) # 发送用户的quick_start router.sendToUser(mq, this_seat.userId) # 发送table_info self.gamePlay.sender.sendTableInfoResAll() delay = self._playAnimation(userInfos) if delay > 0: FTTasklet.getCurrentFTTasklet().sleepNb(delay) for x in xrange(len(self.players)): self.gamePlay.doReady(self.players[x], False) self._sendRanks(userInfos)