示例#1
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)
示例#2
0
    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'}