def _sendUserQueryCardInfo(userId, gameId, intClientId, apiVersion, is_verify, ret_msg): mo = MsgPack() mo.setCmd('user_cardInfo') mo.setKey('apiVersion', apiVersion) mo.setResult('intClientId', intClientId) mo.setResult('gameId', gameId) mo.setResult('userId', userId) mo.setResult('is_verify', is_verify) mo.setResult('ret_msg', ret_msg) tyrpcconn.sendToUser(userId, mo)
def doAction(self, gameId, clientId, userAssets, item, timestamp, params): assert (isinstance(item, TYExchangeItem)) if item.isDied(timestamp): if item.itemKind.units.isTiming(): return items.TYItemActionResult(None, None, -30, '道具已经过期', None) else: return items.TYItemActionResult(None, None, -31, '道具数量不足', None) if item.state != TYExchangeItem.STATE_NORMAL: return items.TYItemActionResult(None, None, -32, '道具审核中', None) wechat_red_pack = self.isWechatRedPack() # 微信红包,无需手机号、地址 msg = MsgPack() msg.setKey('apiVersion', 5.0) msg.setCmdAction('exchange5', 'exchange') msg.updateParam(self.auditParams) msg.setParam( 'phone', str( params.get('phoneNumber' ) if not wechat_red_pack else '11111111111')) msg.setParam('uName', params.get('uName', '')) msg.setParam('bindPhone', params.get('bindPhone', '')) msg.setParam('phoneNumber', params.get('phoneNumber', '')) msg.setParam('uAddres', params.get('uAddres', '')) msg.setParam('gameId', gameId) msg.setParam('itemId', item.itemId) msg.setParam('userId', userAssets.userId) msg.setParam('extabName', '_item_') msg.setParam('clientId', clientId) msg.setParam('wxappid', hallconf.getWeiXinAppId(userAssets.userId, clientId)) msg.setParam('proviceId', params.get('proviceId', '')) msg.setParam('cityId', params.get('cityId', '')) msg.setParam('countyId', params.get('countyId', '')) msg.setParam('townId', params.get('townId', '')) msg.setParam('proviceName', params.get('proviceName', '')) msg.setParam('cityName', params.get('cityName', '')) msg.setParam('countyName', params.get('countyName', '')) msg.setParam('townName', params.get('townName', '')) ftlog.info('TYItemActionExchange->doAction', msg) exchangeId, errMsg = pluginCross.hallexchange.doExchangeRequest( userAssets.userId, msg) if not exchangeId or errMsg: return items.TYItemActionResult(None, None, -33, errMsg, None) # 兑换开始,成功,转换道具状态 item.state = TYExchangeItem.STATE_AUDIT item.original = 0 userAssets.getUserBag().updateItem(item, timestamp) replaceParams = {'item': item.itemKind.displayName} _mail, message, _changed = _action._handleMailAndMessageAndChanged( gameId, userAssets, self, None, replaceParams) # TGHall.getEventBus().publishEventent(TYItemExchangeEvent(gameId, userAssets.userId, item)) return TYItemActionExchangeResult(self, item, message, exchangeId)
def doGameLeave(userId, clientId): if _DEBUG: debug('doGameLeave->', userId, clientId) mo = MsgPack() mo.setCmd('game') mo.setResult('action', 'leave') mo.setResult('gameId', tyglobal.gameId()) mo.setResult('userId', userId) mo.setResult('ok', 1) tyrpcconn.sendToUser(userId, mo)
def _do_match__giveup(self, msg): userId = msg.getParam('userId') ftlog.info('StageMatchRoomMixin._do_match__giveup roomId=', self.roomId, 'userId=', userId) player = self.matchArea.findPlayer(userId) if player and not player.isQuit: player.isQuit = True unlockUserForMatch(userId, self.roomId, self.conf.tableId) resp = MsgPack() resp.setCmd('match') resp.setResult('action', 'giveup') resp.setResult('roomId', self.bigRoomId) resp.setResult('gameId', self.gameId) resp.setResult('userId', userId) resp.setResult('ok', 1) if player.table: # 玩家还在牌桌上 try: self.matchArea.tableController.playerGiveUp( player.table.roomId, player.table.tableId, userId) except TYBizException, e: resp.setResult('ok', 0) resp.setError(e.errorCode, e.message) tyrpcconn.sendToUser(resp, userId) return 1
def _sendQuickStartRes(self, gameId, userId, reason, roomId=0, tableId=0, info=""): mp = MsgPack() mp.setCmd('quick_start') mp.setResult('info', info) mp.setResult('userId', userId) mp.setResult('gameId', gameId) mp.setResult('roomId', roomId) mp.setResult('tableId', tableId) mp.setResult('reason', reason) tyrpcconn.sendToUser(mp, userId)
def saveUtilMatchInfo(userId_A, userId_B): global match_count match_count += 1 util_match_map[match_count] = {userId_A: 0, userId_B: 0} mo = MsgPack() mo.setCmd('bind_game') mo.setResult('gameId', tyglobal.gameId()) mo.setResult('match_count', match_count) time_seed = fttime.getCurrentTimestamp() mo.setResult('time_seed', time_seed) table_Info = {} for userId in [userId_A, userId_B]: name, purl, sex, addr, citycode = _rpc_user_info.getUserBaseInfo( userId) table_Info[userId] = (name, purl, sex, addr, citycode) mo.setResult('table_info', table_Info) tyrpcconn.sendToUser(userId_A, mo) tyrpcconn.sendToUser(userId_B, mo)
def _do_match__signout(self, msg): """ 比赛退赛协议监听器. """ userId = msg.getParam('userId') ftlog.info('StageMatchRoomMixin._do_match__signout roomId=', self.roomId, 'userId=', userId) resp = MsgPack() resp.setCmd('match') resp.setResult('action', 'signout') resp.setResult('roomId', self.bigRoomId) resp.setResult('userId', userId) resp.setResult('gameId', self.gameId) try: self.matchArea.signout(userId) resp.setResult('ok', 1) PokerMatchReport.reportMatchEvent('MATCH_SIGN_OUT', userId, self.gameId, self.matchId, 0, 0, 0) except TYBizException, e: resp.setResult('ok', 0) resp.setError(e.errorCode, e.message)
def _doMatchState(self, userId, gameId, roomId, match_id): ''' 获取比赛状态 ''' if match_id: # 老比赛,由于前端新比赛也会发此消息,但没有match_id导致的问题,这里处理下 state = tyglobal.rooms()[roomId].getMatchState( userId, gameId, match_id) current_ts = int(time.time()) msg = MsgPack() msg.setCmd('match_state') msg.setResult('gameId', gameId) msg.setResult('userId', userId) msg.setResult('state', state) msg.setResult('match_id', match_id) msg.setResult('current_ts', current_ts) tyrpcconn.sendToUser(userId, msg)
def setRedPointRead(self, msg): ''' 客户端通知:某一个项目已经被看过了,消除对应的小红点标记 ''' if _DEBUG: debug('HallPluginRedPoint.setRedPointRead IN', msg) mi = self.checkRead.check(msg) mo = MsgPack() mo.setCmd('redpoint5') mo.setResult('action', 'read') if mi.error: mo.setError(1, mi.error) else: # 设置已读数据 changed = self.redPointSys.readPoint(mi.userId, mi.moduleId, mi.itemId) if changed: self._sendRedPointNotify(mi.userId) mo.setResult('moduleId', mi.moduleId) mo.setResult('itemId', mi.itemId) if mi.hasUserId: tyrpcconn.sendToUser(mi.userId, mo) if _DEBUG: debug('HallPluginRedPoint.setRedPointRead OUT') return 1
def createMsgPackRes(self, cmd, action=None): mp = MsgPack() mp.setCmd(cmd) if action: mp.setResult('action', action) mp.setResult('gameId', self.table.gameId) mp.setResult( 'roomId', self.table.roomId) # table/table_call等发给GT的协议必须使用shadowRommId进行路由 mp.setResult('tableId', self.table.tableId) return mp
def sendNotifyMsg(cls, gameId, uid, showTime, content): """ { "cmd": "notifyMsg", "result": { "showTime": 0.5, "content": [{ "color": "RRGGBB", "text": "bababababa" }, { "color": "RRGGBB", "text": "bababababa" }] } } """ msg_content = [ dict(zip(("color", "text"), segment)) for segment in content ] message = MsgPack() message.setCmd('notifyMsg') message.setResult("userId", uid) message.setResult("gameId", gameId) message.setResult("showTime", showTime) message.setResult("content", msg_content) tyrpcconn.sendToUser(uid, message)
def _sendGameDataResponse(userId, gameId, intClientId, apiVersion): ''' 仅发送game_data命令, USER的大厅游戏数据至客户端 ''' gdatas = pluginCross.halldata.getUserDataDict(userId, GAMEATTS) gdatas['vipInfo'] = pluginCross.hallvip.getVipInfo(userId) mo = MsgPack() mo.setCmd('game_data5') mo.setKey('apiVersion', apiVersion) mo.setResult('intClientId', intClientId) mo.setResult('gameId', gameId) mo.setResult('userId', userId) mo.setResult('gdata', gdatas) tyrpcconn.sendToUser(userId, mo) return gdatas[UserKeys.ATT_CHIP], gdatas[UserKeys.ATT_COUPON]
def _sendUserInfoResponse(userId, gameId, intClientId, apiVersion): ''' 仅发送user_info命令, USER的主账户信息和游戏账户信息至客户端 ''' udatas = pluginCross.halldata.getUserDataDict(userId, USERATTS) mo = MsgPack() mo.setCmd('user_info5') mo.setKey('apiVersion', apiVersion) mo.setResult('intClientId', intClientId) mo.setResult('gameId', gameId) mo.setResult('userId', userId) mo.setResult('udata', udatas) tyrpcconn.sendToUser(userId, mo)
def _sendSetUserInfoResponse(userId, gameId, intClientId, apiVersion, retCode): mo = MsgPack() mo.setCmd('user5') mo.setKey('apiVersion', apiVersion) mo.setResult('action', 'setinfo') if retCode == 0: mo.setResult('ok', 1) else: mo.setError(1, '设置失败') tyrpcconn.sendToUser(userId, mo) if retCode == 0: _sendUserInfoResponse(userId, gameId, intClientId, apiVersion)
def quitCLientGame(self, msg): if _DEBUG: debug("In quitCLientGame @@@ msg = ", msg) mi = self.checker1.check(msg) if mi.error: ftlog.error('quitCLientGame the msg params error !', mi.error) else: room = tyglobal.rooms()[mi.roomId] loserId = 0 winnerId =0 if room.maptable.has_key(mi.tableId): table = room.maptable.pop(mi.tableId) for userid in table.playersInfo.keys(): if userid == mi.userId: loserId = userid else: winnerId = userid mo = MsgPack() mo.setCmd('table/quit_game') mo.setResult('winnerId', winnerId) mo.setResult('loserId', loserId) mo.setResult('result', 'win') if _DEBUG: debug("OUT quitCLientGame @@@ winnerId = ", winnerId) tyrpcconn.sendToUser(winnerId, mo) mo = MsgPack() mo.setCmd('table/quit_game') mo.setResult('winnerId', winnerId) mo.setResult('loserId', loserId) mo.setResult('result', 'lose') if _DEBUG: debug("OUT quitCLientGame @@@ loserId = ", loserId) tyrpcconn.sendToUser(loserId, mo) else: pass return 1
def _sendMatchDataResponse(userId, gameId, intClientId, apiVersion): """ 仅发送match_data命令, USER的我的比赛数据至客户端 """ mo = MsgPack() mo.setCmd('match_data5') mo.setResult('action', 'list') mo.setKey('apiVersion', apiVersion) mo.setResult('intClientId', intClientId) mo.setResult('gameId', gameId) mo.setResult('userId', userId) match_history_list = _dao.loadHistoryRecord(userId) match_sigin_list = _dao.loadSiginRecord(userId) if _DEBUG: if len(match_history_list) == 0: match_history_list = [{ "gameId": 6, "roomList": [6666, 6888] }, { "gameId": 701, "roomList": [701230, 701250] }] debug('_sendMatchDataResponse OUT match_history_list=', match_history_list, 'match_sigin_list=', match_sigin_list) mock_match_list = { "historyList": match_history_list, "signinList": match_sigin_list } mo.setResult('matchData', mock_match_list) if _DEBUG: debug('_sendMatchDataResponse OUT userId=', userId, 'Msg=', mo) tyrpcconn.sendToUser(userId, mo)
def _onTimeout(self, lostUserId): if _DEBUG: debug("In MiniMatchProcess @@@@ onTimeOut, lostUserId = ", lostUserId) room = tyglobal.rooms()[self._roomId] if room.maptable.has_key(self.tableId): room.maptable.pop(self.tableId) if lostUserId == self.userId_a: self.winnerId = self.userId_b mo = MsgPack() mo.setCmd('game_finish_result') mo.setResult('result', 'other player lost internet') mo.setResult('winnerId', self.winnerId) if _DEBUG: debug("OUT game_finish_result @@@ winnerId = ", self.winnerId) tyrpcconn.sendToUser(self.winnerId, mo) else: self.winnerId = self.userId_a mo = MsgPack() mo.setCmd('game_finish_result') mo.setResult('result', 'other player lost internet') mo.setResult('winnerId', self.winnerId) if _DEBUG: debug("OUT game_finish_result @@@ self.winnerId = ", self.winnerId) tyrpcconn.sendToUser(self.winnerId, mo)
def getItemDetailInfo(cls, gameId, clientId, userId, itemId): mo = MsgPack() mo.setCmd('item5') mo.setResult('action', 'info') mo.setResult('gameId', gameId) mo.setResult('userId', userId) mo.setResult('itemId', itemId) try: userBag = itemsys.itemSystem.loadUserAssets(userId).getUserBag() item = userBag.findItem(itemId) if not item: mo.setError(1, '道具不存在') else: timestamp = fttime.getCurrentTimestamp() if item.itemKind.visibleInBag and item.visibleInBag(timestamp): itemInfo = cls.encodeUserItem(gameId, clientId, userBag, item, timestamp) mo.setResult('itemInfo', itemInfo) else: mo.setError(1, '道具被隐藏') except: ftlog.error() mo.setError(2, '道具信息获取失败') return mo
def _do_match__signin(self, msg): """ 比赛报名协议监听器. 调用赛区进行报名,成功返回roomId,userId;失败返回ec信息 :param msg: tcp消息 """ userId = msg.getParam('userId') feeIndex = msg.getParam('fee', 0) signinParams = msg.getParam('signinParams', {}) ftlog.info('StageMatchRoomMixin._do_match__signin roomId=', self.roomId, 'userId=', userId) # if not signinParams and tyglobal.enableTestHtml(): # signinParams = gamedata.getGameAttrJson(userId, self.gameId, 'test.signinParams') resp = MsgPack() resp.setCmd('match') resp.setResult('action', 'signin') resp.setResult('roomId', self.bigRoomId) resp.setResult('userId', userId) resp.setResult('gameId', self.gameId) try: self.matchArea.signin(userId, feeIndex, signinParams) resp.setResult('ok', 1) PokerMatchReport.reportMatchEvent('MATCH_SIGN_UP', userId, self.gameId, self.matchId, 0, 0, 0) except TYBizException, e: ftlog.info('StageMatchRoomMixin._do_match__signin Exception=', e) resp.setResult('ok', 0) resp.setError(e.errorCode, e.message)
def makeItemListResponse(cls, gameId, clientId, userId, kindGameId): timestamp = fttime.getCurrentTimestamp() userBag = itemsys.itemSystem.loadUserAssets(userId).getUserBag() itemList = userBag.getAllItem() items = [] for item in itemList: if kindGameId == 0 or item.itemKind.gameId == kindGameId: if item.itemKind.visibleInBag and item.visibleInBag(timestamp): items.append([ item.itemId, item.kindId, max(1, item.remaining), item.expiresTime ]) cls.resetHallItemRed(userId) mo = MsgPack() mo.setCmd('item5') mo.setResult('action', 'list') mo.setResult('gameId', gameId) mo.setResult('userId', userId) mo.setResult('kindGameId', kindGameId) mo.setResult('items', items) return mo
def _do_match__leave(self, msg): """ 比赛离开协议监听器. 离开比赛 """ userId = msg.getParam('userId') ftlog.info('StageMatchRoomMixin._do_match__leave roomId=', self.roomId, 'userId=', userId) resp = MsgPack() resp.setCmd('match') resp.setResult('action', 'leave') resp.setResult('roomId', self.bigRoomId) resp.setResult('gameId', self.gameId) resp.setResult('userId', userId) try: self.matchArea.leave(userId) resp.setResult('ok', 1) except TYBizException, e: resp.setResult('ok', 0) resp.setError(e.errorCode, e.message)
def _onTimeout(self, lostUserId): if _DEBUG: debug("In MiniMatchProcess @@@@ onTimeOut, lostUserId = ", lostUserId) room = tyglobal.rooms()[self._roomId] if room.maptable.has_key(self.tableId): table = room.maptable.pop(self.tableId) self.table_msgId = table.tableMsgId if lostUserId == self.userId_a: self.winnerId = self.userId_b mo = MsgPack() mo.setCmd('end_game') mo.setResult('winnerId', self.winnerId) mo.setResult('userId_a', self.userId_a) mo.setResult('userId_b', self.userId_b) mo.setResult('table_msgId', self.table_msgId) if _DEBUG: debug("OUT end_game @@@ winnerId = ", self.winnerId) tyrpcconn.sendToUser(self.winnerId, mo) rpcproxy = getRpcProxy(9993, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE) rpcproxy.srvgame.doReportGameResult(mo, tyglobal.gameId()) else: self.winnerId = self.userId_a mo = MsgPack() mo.setCmd('end_game') mo.setResult('winnerId', self.winnerId) mo.setResult('userId_a', self.userId_a) mo.setResult('userId_b', self.userId_b) mo.setResult('table_msgId', self.table_msgId) if _DEBUG: debug("OUT end_game @@@ self.winnerId = ", self.winnerId) tyrpcconn.sendToUser(self.winnerId, mo) rpcproxy = getRpcProxy(9993, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE) rpcproxy.srvgame.doReportGameResult(mo, tyglobal.gameId())
def _sendDesc(self, userId): resp = MsgPack() resp.setCmd('match') resp.setResult('action', 'desc') resp.setResult('roomId', self.bigRoomId) resp.setResult('gameId', self.gameId) resp.setResult('userId', userId) signinCount = self.matchArea.getTotalSignerCount() # 房间实时报名人数 resp.setResult('signinCount', signinCount) matchDef = _buildMatchDesc(self.conf) resp.updateResult(matchDef) # 比赛配置 record = MatchRecordDaoRedis.loadRecord(self.gameId, userId, self.bigRoomId) if record: ret = MatchRecordDaoRedis.loadHistory(self.gameId, userId, self.bigRoomId) # ret = [ {"time":_["time"],"desc":"第%s名,获得%s" % (_["rank"],_["desc"]),"rank":_["rank"],"info":_["desc"] } # for _ in ret] ret = map( lambda _: { "time": _["time"], "desc": "第%s名" % (_["rank"], ), "rank": _["rank"], "info": _["desc"] } if _["desc"] == "" else { "time": _["time"], "desc": "第%s名,获得%s" % (_["rank"], _["desc"]), "rank": _["rank"], "info": _["desc"] }, ret) histories = { "crownCount": record.crownCount, "playCount": record.playCount, "bestRank": record.bestRank, "bestRankDate": record.bestRankDate, "records": ret } else: histories = { "crownCount": 0, "playCount": 0, "bestRank": 0, "bestRankDate": 0, "records": [] } resp.setResult('histories', histories) tyrpcconn.sendToUser(resp, userId)
def test_http_chat2(self, request): debug("ChatHttp : test_http_chat2 : request = ", request) word = request.getParamStr('word', '') msg = MsgPack() msg.setCmd('chat') msg.setAction('send_message') msg.setParam('userId', 10000) msg.setParam('gameId', 9993) msg.setParam('msgType', 0) msg.setParam('targetUserId', 10002) msg.setParam('sn', 1) msg.setParam('content', '{"text":"' + word + '"}') gameRpcUtilOne.srvchat.http_test_talk_message(10000, msg.pack()) return {request.path: 'ok'}
def doExchangeExchange(self, request): mo = MsgPack() mi = self.checkExchange.check(request) if mi.error: mo.setError(1, mi.error) else: clientId = tysessiondata.getClientId(mi.userId) msg = MsgPack() msg.setKey('apiVersion', 5.0) msg.setCmdAction('exchange5', 'exchange') msg.setParam('phone', request.getParamStr('phone')) msg.setParam('uName', request.getParamStr('uName')) msg.setParam('uAddres', request.getParamStr('uAddres')) msg.setParam('gameId', tyglobal.gameId()) msg.setParam('itemId', mi.itemId) msg.setParam('userId', mi.userId) msg.setParam('extabName', request.getParamStr('extabName')) msg.setParam('clientId', clientId) msg.setParam('wxappid', hallconf.getWeiXinAppId(mi.userId, clientId)) msg.setParam('proviceId', request.getParamStr('proviceId')) msg.setParam('cityId', request.getParamStr('cityId')) msg.setParam('countyId', request.getParamStr('countyId')) msg.setParam('townId', request.getParamStr('townId')) msg.setParam('proviceName', request.getParamStr('proviceName')) msg.setParam('cityName', request.getParamStr('cityName')) msg.setParam('countyName', request.getParamStr('countyName')) msg.setParam('townName', request.getParamStr('townName')) msg = msg.getDict() try: ret = hallRpcOne.hallexchange.doExchangeRequest(mi.userId, msg) datas = ret.getResult() if datas: exchangeId, errMsg = datas[0], datas[1] if exchangeId: mo.setResult('exchangeId', exchangeId) mo.setResult('info', errMsg) else: mo.setError(1, errMsg) else: mo.setError(1, 'doExchangeRequest return is None') except Exception, e: mo.setError(1, str(e))
def notifyMsg(userId, gameId, roomId, data, historyWinStreaks, isHistoryMax, firstGetCoupon, config, winOrLoser): ''' 通知客户端 ''' mp = MsgPack() mp.setCmd('game') mp.setResult('action', 'winStreakTask') mp.setResult('gameId', gameId) mp.setResult('roomId', roomId) mp.setResult('userId', userId) mp.setResult(WIN_COUNT, data[WIN_COUNT]) mp.setResult(WIN_MAX_COUNT, historyWinStreaks) mp.setResult('isHistoryMax', isHistoryMax) mp.setResult('firstGetCoupon', firstGetCoupon) mp.setResult(FIRSTBLOOD, data[FIRSTBLOOD]) mp.setResult('winStreaks', winOrLoser) mp.setResult('userTileInfo', data[USER_TILE_INFO]) mp.setResult('desc', config.get(WIN_TASKS, None)) tyrpcconn.sendToUser(userId, mp)
def doHappyBagGetReward(self, msg): if _DEBUG: debug('doHappyBagGetReward IN->', msg) mi = self.checkerGet.check(msg) mo = MsgPack() mo.setCmd('happybag5') mo.setResult('action', 'getreward') if mi.error: mo.setError(1, mi.error) else: code, rewardDict = self._doGetReward(mi.userId, mi.taskId, mi.itemId, mi.clientId) mo.setResult('userId', mi.userId) mo.setResult('taskId', mi.taskId) mo.setResult('code', code) mo.setResult('todotasks', rewardDict) tyrpcconn.sendToUser(mi.userId, mo) if _DEBUG: debug('doHappyBagGetReward OUT', mo) return 1
def createNewTable(userId_A, userId_B): for roomId, roomIns in tyglobal.rooms().items(): if _DEBUG: debug("In createNewTable @@@@ roomId = ", roomId, " roomIns = ", roomIns, " userId_A = ", userId_A, " userId_B = ", userId_B) global tableId if not roomIns.maptable: baseid = roomId * 10000 + 1 tableId = baseid if tableId >= roomId * 10000 + 9999: tableId = roomId * 10000 + 1 tableId += 1 tblIns = TYTable(roomIns, tableId) roomIns.maptable[tableId] = tblIns table_Info = {} for userId in [userId_A, userId_B]: name, purl, sex, addr, citycode = _rpc_user_info.getUserBaseInfo( userId) table_Info[userId] = (name, purl, sex, addr, citycode) tblIns.playersInfo = table_Info time_seed = fttime.getCurrentTimestamp() mo = MsgPack() mo.setCmd('start_game') mo.setResult('gameId', tyglobal.gameId()) mo.setResult('roomId', tblIns.roomId) mo.setResult('tableId', tblIns.tableId) mo.setResult('seatId', 1) mo.setResult('time_seed', time_seed) mo.setResult('table_info', table_Info) if _DEBUG: debug("OUT createNewTable @@@ table_info = ", table_Info) tyrpcconn.sendToUser(userId_A, mo) mo = MsgPack() mo.setCmd('start_game') mo.setResult('gameId', tyglobal.gameId()) mo.setResult('roomId', tblIns.roomId) mo.setResult('tableId', tblIns.tableId) mo.setResult('seatId', 2) mo.setResult('time_seed', time_seed) mo.setResult('table_info', table_Info) if _DEBUG: debug("OUT createNewTable @@@ table_info = ", table_Info) tyrpcconn.sendToUser(userId_B, mo) break
def doGameTimestemp(userId): if _DEBUG: debug('doGameTimestemp->', userId) mo = MsgPack() mo.setCmd('user') mo.setResult('action', 'mj_timestamp') mo.setResult('gameId', tyglobal.gameId()) mo.setResult('userId', userId) mo.setResult('current_ts', fttime.getCurrentTimestamp()) tyrpcconn.sendToUser(userId, mo)
def _sendUserGotoTable(userId, gameId, intClientId, apiVersion, locInfoList): mo = MsgPack() mo.setCmd('goto_table5') mo.setKey('apiVersion', apiVersion) mo.setResult('intClientId', intClientId) mo.setResult('gameId', gameId) mo.setResult('userId', userId) mo.setResult('locs', locInfoList) tyrpcconn.sendToUser(userId, mo)