示例#1
0
    def notifyMatchCancelled(self, signer, reason):
        """
        通知用户比赛由于reason取消了
        """
        try:
            ftlog.info('PokerMatchPlayerNotifier.notifyMatchCancelled',
                       'userId=', signer.userId, 'reason=', reason)
            userId = signer.userId
            # TODO 确认用户已经上线
            player = self.room.matchArea.findPlayer(userId)
            if player and player.isQuit:
                return

            self.notifyMatchSignsUpdate(userId)

            msg = MsgPack()
            msg.setCmd('match')
            msg.setResult('action', 'cancel')
            msg.setResult('gameId', self.room.gameId)
            msg.setResult('roomId', self.room.bigRoomId)
            msg.setResult('reason', reason)
            msg.setResult('info', MatchFinishReason.toString(reason))
            tyrpcconn.sendToUser(msg, userId)

        except:
            ftlog.error('PokerMatchPlayerNotifier.notifyMatchCancelled',
                        'userId=', signer.userId, 'instId=', signer.instId,
                        'reason=', reason)
示例#2
0
 def endCLientGame(self, msg):
     if _DEBUG:
         debug("In synClientInfo @@@ msg = ", msg)
     mi = self.checker1.check(msg)
     if mi.error:
         ftlog.error('endCLientGame the msg params error !', mi.error)
     else:
         #todo 1: add loc 2:客户端上行的第一条end_game消息作为判断依据,对双方结算
         room = tyglobal.rooms()[mi.roomId]
         if room.maptable.has_key(mi.tableId):
             table = room.maptable.pop(mi.tableId)
             for userid in table.playersInfo.keys():
                 mo = MsgPack()
                 mo.setCmd('end_game')
                 mo.setResult('result', 'ok')
                 mo.setResult('gameResult', msg.getParamStr('gameResult'))
                 if _DEBUG:
                     debug("OUT endCLientGame  @@@ table_info = ", msg)
                 tyrpcconn.sendToUser(userid, mo)
         else:
             pass
             # mo = MsgPack()
             # mo.setCmd('end_game')
             # mo.setResult('result', 'has finished')
             # mo.setResult('msg', msg)
             # if _DEBUG:
             #     debug("OUT endCLientGame  @@@ table_info = ", msg)
             # tyrpcconn.sendToUser(mi.userid, mo)
     return 1
示例#3
0
    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', self.winnerId)
                mo.setResult('userId_a', self.loserId)
                mo.setResult('userId_b', self.winnerId)
                mo.setResult('table_msgId', table.tableMsgId)
                if _DEBUG:
                    debug("OUT quitCLientGame  @@@ winnerId = ", winnerId)
                tyrpcconn.sendToUser(winnerId, mo)
                tyrpcconn.sendToUser(loserId, mo)
            else:
                pass
        return 1
示例#4
0
 def get_chat_record(self, msg):
     """
     获取所有的聊天记录.
     """
     debug("ChatListSrv : get_chat_record : msg = ", msg)
     user_id = msg.getParamInt('userId')
     target_user_ids = msg.getParam('targetUserIds')
     resp = MsgPack()
     resp.setCmd('chat')
     resp.setResult('action', 'chat_record')
     mi = self.user_checker.check(msg)
     if mi.error:
         ftlog.warn('get_chat_record param error', user_id, target_user_ids,
                    mi.error)
         resp.setResult('status', "error")
         resp.setError(1, mi.error)
     else:
         try:
             records = self.service.batch_record_list(
                 user_id, target_user_ids)
             debug("ChatListSrv get_chat_record", records)
             resp.setResult('records', records)
             resp.setResult('status', "ok")
         except TYBizException, e:
             resp.setResult('status', "error")
             resp.setError(e.errorCode, e.message)
示例#5
0
    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)
示例#6
0
    def doHappyBagList(self, msg):
        if _DEBUG:
            debug('doHappyBagList IN->', msg)

        mi = hallchecker.CHECK_BASE.check(msg)
        mo = MsgPack()
        mo.setCmd('happybag5')
        mo.setResult('action', 'list')

        if mi.error:
            mo.setError(1, mi.error)
        else:
            userTaskUnit = self.loadUserTaskUnit(mi.userId, mi.clientId)
            taskList = _ui.encodeUserTaskList(userTaskUnit)
            mo.setResult('tasks', taskList)

        tyrpcconn.sendToUser(mi.userId, mo)

        # 记录BI统计,仅为数据统计
        if not mi.error:
            flg = pluginCross.hallday1st.getHappyBagFlg(mi.userId)
            if flg == 0:
                pluginCross.hallday1st.setHappyBagFlg(mi.userId)
                tybireport.reportGameSimpleEvent('HAPPY_BAG_TASK_LIST',
                                                 mi.userId, mi.gameId,
                                                 mi.clientId)

        if _DEBUG:
            debug('doHappyBagList OUT', mo)
        return 1
示例#7
0
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)
示例#8
0
    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
示例#9
0
    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)
示例#10
0
    def _notifyMatchWait(self, player, riseWait=0):
        msg = MsgPack()
        msg.setCmd('match')
        msg.setResult('action', 'wait')
        msg.setResult('gameId', self.room.gameId)
        msg.setResult('roomId', self.room.bigRoomId)
        msg.setResult('tableId', player.group.matchConf.tableId)
        msg.setResult('riseWait', riseWait)
        msg.setResult('cardCount', player.cardCount)
        msg.setResult(
            'loseScore', player.group.matchRules.loseScore
            if player.group.stageConf.rulesConf.TYPE_ID
            == StageMatchRulesConfASS.TYPE_ID else 0)
        msg.setResult('mname', getMatchName(self.room, player))
        steps = []
        for i, stageConf in enumerate(player.group.matchConf.stages):
            isCurrent = True if i == player.group.stageIndex else False
            if stageConf.userCountPerGroup != 0:
                des = '每组%s人晋级' % (stageConf.riseUserCount)
            else:
                des = '%s人晋级' % (stageConf.riseUserCount)
            stepInfo = {'des': des}
            if isCurrent:
                stepInfo['isCurrent'] = 1
            stepInfo['name'] = stageConf.name
            steps.append(stepInfo)

        msg.setResult('steps', steps)
        ftlog.info('PokerMatchPlayerNotifier._notifyMatchWait', 'msg=',
                   msg.pack())
        tyrpcconn.sendToUser(msg, player.userId)
示例#11
0
 def _notifyMatchRank(self, player):
     msg = MsgPack()
     msg.setCmd('match')
     msg.setResult('action', 'rank')
     msg.setResult('gameId', self.room.gameId)
     msg.setResult('roomId', self.room.bigRoomId)
     ranktops = []
     # 首位添加自己的排名信息
     ranktops.append({
         'userId': player.userId,
         'name': player.userName,
         'score': player.score,
         'rank': player.rank
     })
     # 添加TOP10信息
     for i, p in enumerate(player.group.rankList[0:10]):
         ranktops.append({
             'userId': p.userId,
             'name': p.userName,
             'score': p.score,
             'rank': i + 1
         })
     # TODO 自己在Top10中需要处理
     msg.setResult('mranks', ranktops)
     tyrpcconn.sendToUser(msg, player.userId)
示例#12
0
 def synClientInfo(self, msg):
     if _DEBUG:
         debug("In synClientInfo @@@ msg = ", msg)
     mi = self.checker1.check(msg)
     if mi.error:
         ftlog.error('synClientInfo the msg params error !', mi.error)
     else:
         room = tyglobal.rooms()[mi.roomId]
         table = room.maptable[mi.tableId]
         if _DEBUG:
             ftlog.debug("IN synClientInfo @@ synClientInfo =",
                         table.playersInfo.keys())
         userId_b = 0
         for userid in table.playersInfo.keys():
             if userid != mi.userId:
                 mo = MsgPack()
                 mo.setCmd('syn_info')
                 mo.setResult('gdata', msg.getParamStr('gdata'))
                 if _DEBUG:
                     debug("OUT synClientInfo  @@@ table_info = ", msg)
                 tyrpcconn.sendToUser(userid, mo)
                 userId_b = userid
         if table._timer == None:
             table._timer = MiniMatchProcess(7, mi.userId, userId_b,
                                             mi.roomId, mi.tableId)
         table._timer.stop()
         table._timer.start()
     return 1
示例#13
0
    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)
示例#14
0
 def answer_again_game(self, msg):
     """
     再来一局应答.
     :param msg: userId,targetUserId,miniGameId
     :return: msgId,ok
     """
     debug("ChatGameSrv answer_again_game", msg)
     user_id = msg.getParamInt('userId')
     target_user_id = msg.getParamInt('targetUserId')
     msg_id = msg.getParamStr('msgId')
     code = msg.getParamStr('code')
     resp = MsgPack()
     resp.setCmd('chat')
     resp.setResult('action', 'answer_again_game')
     try:
         self.clean_channel(user_id,target_user_id)
         info = self.service.get_record(msg_id)
         if info:
             game_message = GameChatMessage.load_info(info)
             game_message.code = code
             self.service.save_record(user_id, target_user_id, msg_id, game_message)
             ftcore.runOnceDelay(0.1, self.__do_answer_again_game_message, user_id, target_user_id, code, msg_id)
             push_game_message(user_id, target_user_id, msg_id, game_message)
             resp.setResult('msgId', msg_id)
             resp.setResult('userId', user_id)
             resp.setResult('targetUserId', target_user_id)
             resp.setResult('status', 'ok')
         else:
             resp.setResult('status', 'error msgId')
     except TYBizException, e:
         resp.setResult('status', 'error')
         resp.setError(e.errorCode, e.message)
示例#15
0
def doCasualMatchGameVSPlayer():
    for gameId in gameIdList:
        while DaoCasualGameMatch.getMatchGameQueueLength(gameId) >= 2:
            player_A_userId, player_B_userId = DaoCasualGameMatch.getMatchGameQueueUsers(
                gameId)
            if _DEBUG:
                debug("doCasualMatchGameVSPlayer @@@@ gameid = ", gameId,
                      "player_A_userId", player_A_userId, "player_B_userId",
                      player_B_userId)
            rpcproxy = getRpcProxy(gameId, RPC_CALL_SAFE, RPC_TARGET_MOD_ONE)
            rpcproxy.srvutil.doMatchCasualGamePlayers(player_A_userId,
                                                      player_B_userId)

            mo = MsgPack()
            mo.setCmd('match_result')
            mo.setResult('gameId', gameId)
            mo.setResult('other_userId', player_B_userId)
            mo.setResult('result', 'match success')
            tyrpcconn.sendToUser(player_A_userId, mo)

            mo = MsgPack()
            mo.setCmd('match_result')
            mo.setResult('gameId', gameId)
            mo.setResult('other_userId', player_A_userId)
            mo.setResult('result', 'match success')
            tyrpcconn.sendToUser(player_B_userId, mo)
示例#16
0
文件: share.py 项目: zhaozw/freetime5
    def doWeiXinShare(self, msg):
        '''
        客户端通知服务器,完成了一次微信分享
        '''
        mi = hallchecker.CHECK_BASE.check(msg)
        if _DEBUG:
            debug('doWeiXinShare IN->', mi)

        mo = MsgPack()
        mo.setCmd('share5')
        mo.setResult('action', 'weixin')

        if mi.error:
            mo.setError(1, mi.error)
        else:
            event = tygame.WeiXinSharedEvent(mi.userId, mi.gameId)
            typlugin.syncTrigerEvent(event)
            mo.setResult('ok', 1)

        if mi.hasUserId:
            tyrpcconn.sendToUser(mi.userId, mo)

        if _DEBUG:
            debug('doWeiXinShare OUT')
        return 1
示例#17
0
文件: store.py 项目: zhaozw/freetime5
    def doStoreQueryUi(self, msg):
        '''
        查询商城界面列表配置信息
        '''
        mo = MsgPack()
        mo.setCmd('store5')
        mo.setResult('action', 'ui')

        mi = hallchecker.CHECK_BASE.check(msg)
        if mi.error:
            mo.setError(1, mi.error)
        else:
            filteredList = self.storeSystem.getShelvesListByClientId(
                mi.clientId)
            tabs = []
            for shelf in filteredList:
                tabs.append({
                    'name': shelf.name,
                    'displayName': shelf.displayName,
                    'items': shelf.productIdList
                })
            mo.setResult('tabs', tabs)

        tyrpcconn.sendToUser(mi.userId, mo)
        return 1
示例#18
0
文件: store.py 项目: zhaozw/freetime5
    def doConsumeTransactionHttp(self, request):
        """
        购买流程之一:client请求sdk,sdk调用游戏服,游戏服检查商品有效性并存储订单信息
        成功返回:标准MsgPack,需要result中有相同的prodOrderId
        """
        ftlog.info('doConsumeTransactionHttp IN->', request.getDict())

        mo = MsgPack()
        mo.setCmd('buy_prod5')

        mi = self.checkTransactionStart.check(request)
        if mi.error:
            mo.setError(1, str(mi.error))
        else:
            try:
                rfc = hallRpcOne.hallstore.doConsumeTransaction(
                    mi.userId, mi.appId, mi.realGameId, mi.clientId,
                    mi.prodOrderId, mi.prodId, mi.prodCount)
                if rfc.getException():
                    mo.setError(2, str(rfc.getException()))
                else:
                    result = rfc.getResult()
                    if result != 'ok':
                        mo.setError(3, str(result))
                    else:
                        mo.setResult('appId', mi.appId)
                        mo.setResult('userId', mi.userId)
                        mo.setResult('prodId', mi.prodId)
                        mo.setResult('prodCount', mi.prodCount)
                        mo.setResult('prodOrderId', mi.prodOrderId)
            except Exception, e:
                ftlog.error()
                mo.setError(4, str(e))
示例#19
0
 def getExchangeHistory(self, msg):
     mo = MsgPack()
     mo.setCmd('exchange5')
     mo.setResult('action', 'history')
     mi = hallchecker.CHECK_BASE.check(msg)
     if mi.error:
         mo.setError(1, mi.error)
     else:
         orders = []
         exchangeIds = _dao.getReordKeys(mi.userId)
         exchangeIds.sort(reverse=True)
         for exchangeId in exchangeIds:
             order = _dao.loadRecord(mi.userId, exchangeId)
             orders.append([
                 exchangeId,  # 兑换ID
                 fttime.formatTimeSecond(
                     datetime.fromtimestamp(order.createTime)),  # 兑换时间
                 order.state,  # 兑换状态
                 order.params[
                     'type'],  # 兑换类型 0-手机充值卡 1-手工兑换 2-比赛等线下邀请函、门票等 3-京东卡 4-未使用 5-微信红包 6-京东实物 99-金币
                 order.params['displayName'],  # 兑换物品名称
                 order.params['uName'],  # 昵称
                 order.params['phone'],  # 电话
                 order.params.get('jdAddres',
                                  []),  # 京东收货地址数组 [1级,2级,3级,4级,输入地址]
                 order.extOrderId,  # 京东实物交易单号
                 order.extCardId,  # 京东卡卡号
                 order.extCardPwd,  # 京东卡卡密
             ])
         mo.setResult('userId', mi.userId)
         mo.setResult('orders', orders)
     tyrpcconn.sendToUser(mi.userId, mo)
     return 1
示例#20
0
 def sendTableClothRes(cls, gameId, userId, tableType, tableTheme=None):
     mpTableClothRes = MsgPack()
     mpTableClothRes.setCmd('table_cloth')
     mpTableClothRes.setResult('userId', userId)
     mpTableClothRes.setResult('gameId', gameId)
     mpTableClothRes.setResult('tableType', tableType)
     mpTableClothRes.setResult('tableTheme', tableTheme)
     tyrpcconn.sendToUser(userId, mpTableClothRes)
示例#21
0
 def _notifyStageStart(self, player):
     mo = MsgPack()
     mo.setCmd('match')
     mo.setResult('action', 'rise')
     mo.setResult('gameId', self.room.gameId)
     mo.setResult('roomId', self.room.bigRoomId)
     mo.setResult('stageIndex', player.group.stageIndex)
     tyrpcconn.sendToUser(mo, player.userId)
示例#22
0
 def sendChangeBetsConfReq(cls, shadowRoomId, betsConf):
     mpReq = MsgPack()
     mpReq.setCmd("room")
     mpReq.setParam("action", "change_betsConf")
     mpReq.setParam("roomId", shadowRoomId)
     mpReq.setParam("betsConf", betsConf)
     gameRpcRoomOne.srvtable.doChangeBetsConf(shadowRoomId, mpReq.getDict(),
                                              0)
示例#23
0
 def __do_again_game_message(self, user_id, target_user_id, message_id):
     resp = MsgPack()
     resp.setCmd('chat')
     resp.setResult('action', 'again_game_push')
     resp.setResult('userId', user_id)
     resp.setResult('targetUserId', target_user_id)
     resp.setResult('msgId', message_id)
     tyrpcconn.sendToUser(target_user_id, resp)
示例#24
0
def testcase1():
    from chat.plugins.srvchat.srvchat import ChatSrv

    manager = ChatSrv()
    manager.initPluginBefore()
    #check_friend=0后需要创建通道
    msg = MsgPack()
    msg.setCmd('chat')
    msg.setAction('create_channel')
    msg.setParam('userId', 10000)
    msg.setParam('targetUserId', 10002)
    msg.setParam('gameId', 9993)
    manager.create_channel(msg)
    msg = MsgPack()
    msg.setCmd('chat')
    msg.setAction('create_channel')
    msg.setParam('userId', 10002)
    msg.setParam('targetUserId', 10000)
    msg.setParam('gameId', 9993)
    manager.create_channel(msg)

    # 聊天
    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":"hello"}')
    manager.talk_message(msg)

    # 游戏邀请消息
    msg = MsgPack()
    msg.setCmd('chat')
    msg.setAction('send_message')
    msg.setParam('userId', 10000)
    msg.setParam('targetUserId', 10002)
    msg.setParam('gameId', 9993)
    msg.setParam('msgType', 2)
    msg.setParam('sn', 1)
    msg.setParam('content', '{"miniGameId":"6033","code":"invite"}')
    # manager.talk_message(msg)

    # 应答游戏消息
    msg = MsgPack()
    msg.setCmd('chat')
    msg.setAction('send_message')
    msg.setParam('userId', 10000)
    msg.setParam('targetUserId', 10001)
    msg.setParam('gameId', 9993)
    msg.setParam('msgType', 3)
    msg.setParam('sn', 1)
    # msg.setParam('content', '{"msgId":"6033","code":"accept"}')
    msg.setParam('content',
                 '{"msgId":"10000-10002-1521538908717","code":"refuse"}')
    manager.talk_message(msg)
示例#25
0
文件: _user.py 项目: zhaozw/freetime5
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)
示例#26
0
 def createMsgPackRequest(self, cmd, action=None):
     mp = MsgPack()
     mp.setCmd(cmd)
     if action:
         mp.setParam('action', action)
     mp.setParam('gameId', self.table.gameId)
     mp.setParam('roomId', self.table.roomId)
     mp.setParam('tableId', self.table.tableId)
     return mp
示例#27
0
 def curTimestemp(self, gameId, userId):
     msg = MsgPack()
     msg.setCmd('user')
     msg.setResult('action', 'mj_timestamp')
     msg.setResult('gameId', gameId)
     msg.setResult('userId', userId)
     current_ts = int(time.time())
     msg.setResult('current_ts', current_ts)
     tyrpcconn.sendToUser(userId, msg)
示例#28
0
 def sendTableCallObserveReq(cls, userId, shadowRoomId, tableId, clientId):
     mpReq = MsgPack()
     mpReq.setCmd("table_call")
     mpReq.setParam("action", "observe")
     mpReq.setParam("userId", userId)
     mpReq.setParam("roomId", shadowRoomId)
     mpReq.setParam("tableId", tableId)
     mpReq.setParam("clientId", clientId)
     gameRpcRoomOne.srvtable.doTableCallObserve(shadowRoomId,
                                                mpReq.getDict(), 0)
示例#29
0
 def queryRoomGetPlayingTableListReq(cls, shadowRoomId, **kwargs):
     msg = MsgPack()
     msg.setCmd("room")
     msg.setParam("action", "playingTableList")
     msg.setParam("roomId", shadowRoomId)
     for key in kwargs:
         msg.setParam(key, kwargs[key])
     rfc = gameRpcRoomOne.srvtable.getPlayingTableList(
         shadowRoomId, msg.getDict())
     return rfc.getResult()
示例#30
0
 def makeSitReq(cls, userId, shadowRoomId, tableId, clientId):
     mpSitReq = MsgPack()
     mpSitReq.setCmd("table")
     mpSitReq.setParam("action", "sit")
     mpSitReq.setParam("userId", userId)
     mpSitReq.setParam("roomId", shadowRoomId)
     mpSitReq.setParam("tableId", tableId)
     mpSitReq.setParam("clientId", clientId)
     mpSitReq.setParam("gameId", tyconfig.getRoomGameId(shadowRoomId))
     return mpSitReq