예제 #1
0
파일: room.py 프로젝트: luningcowboy/tuyoo
 def doRoomQuickStart(self, roomId, userId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     if isinstance(room, DizhuRoom):
         room.handleMsg(msg)
     else:
         msg = runcmd.getMsgPack()
         room.doQuickStart(msg)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
예제 #2
0
파일: room.py 프로젝트: luningcowboy/tuyoo
 def doRoomMatchWinLose(self, roomId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     if isinstance(room, DizhuRoom):
         room.handleMsg(msg)
     else:
         room.doWinlose(msg)
예제 #3
0
파일: room.py 프로젝트: luningcowboy/tuyoo
 def doRoomDes(self, roomId, userId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     if isinstance(room, DizhuRoom):
         room.handleMsg(msg)
     else:
         room.doGetDescription(userId)
예제 #4
0
 def doActivityExchangeOld(self, gameId, userId, clientId, activityId, action):
     msg = runcmd.getMsgPack()
     ftlog.debug('doActivityExchangeOld msg=', msg)
     result = activity.activitySystem.handleActivityRequest(userId, gameId, clientId, msg)
     mo = ActivityTcpHelper.getOldResponseMsg(result, gameId, userId, activityId, action)
     ftlog.debug('doActivityExchangeOld res=', mo)
     router.sendToUser(mo, userId)
예제 #5
0
    def doDuobaoProduct(self):
        '''
        一元夺宝商品
        '''
        if ftlog.is_debug():
            ftlog.debug('doDuobaoProduct enter')
        msg = runcmd.getMsgPack()
        gameId = msg.getParam("gameId")
        userId = msg.getParam("userId")

        from hall.entity import hall1yuanduobao
        productList = hall1yuanduobao.duobaoProduct(userId)

        msg = MsgPack()
        msg.setCmd('hall_duobao')
        msg.setResult('action', 'duobao_product')
        msg.setResult('gameId', gameId)
        msg.setResult('userId', userId)
        msg.setResult('productList', productList)
        router.sendToUser(msg, userId)

        if ftlog.is_debug():
            ftlog.debug('doDuobaoProduct',
                        'userId=', userId,
                        'productList=', productList)
예제 #6
0
파일: room.py 프로젝트: luningcowboy/tuyoo
 def doMatchSave(self, userId, gameId, roomId, matchId):
     '''
     保存比赛进度
     '''
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     gdata.rooms()[roomId].doMatchSave(userId, gameId, roomId, matchId, msg)
예제 #7
0
    def doDuobaoBet(self):
        '''
        一元夺宝下注
        '''
        msg = runcmd.getMsgPack()
        gameId = msg.getParam("gameId")
        userId = msg.getParam("userId")
        duobaoId = msg.getParam("duobaoId")
        issue = msg.getParam("issue")
        num = msg.getParam("num")

        ec = 0
        info = '投注成功'
        luckyCodeList = []
        myBetCount = 0
        totalBetCount = 0
        coupon = 0

        try:
            from hall.entity import hall1yuanduobao
            luckyCodeList, myBetCount, totalBetCount, coupon = hall1yuanduobao.duobaoBet(userId, duobaoId, issue, num)
        except TYBizException, e:
            ec = e.errorCode
            info = e.message

            ftlog.info('doDuobaoBet failer',
                       'userId=', userId,
                       'duobaoId=', duobaoId,
                       'issue=', issue,
                       'num=', num,
                       'ec=', ec,
                       'info=', info)
예제 #8
0
    def doDuobaoHistory(self):
        '''
        一元夺宝往期得主
        '''
        msg = runcmd.getMsgPack()
        gameId = msg.getParam("gameId")
        userId = msg.getParam("userId")
        duobaoId = msg.getParam("duobaoId")
        pageId = msg.getParam("pageId")

        ec = 0
        info = '查询成功'
        historyList = []

        try:
            from hall.entity import hall1yuanduobao
            historyList = hall1yuanduobao.duobaoHistory(userId, duobaoId, pageId)
        except TYBizException, e:
            ec = e.errorCode
            info = e.message

            ftlog.info('doDuobaoHistory failer',
                       'userId=', userId,
                       'duobaoId=', duobaoId,
                       'pageId=', pageId,
                       'ec=', ec,
                       'info=', info)
예제 #9
0
    def doDuobaoMyRecord(self):
        '''
        一元夺宝查询我的夺宝记录
        '''
        msg = runcmd.getMsgPack()
        gameId = msg.getParam("gameId")
        userId = msg.getParam("userId")
        pageId = msg.getParam("pageId")

        recordList = []
        totalLength = 0
        ec = 0
        info = '查询成功'
        try:
            from hall.entity import hall1yuanduobao
            recordList, totalLength = hall1yuanduobao.duobaoMyRecord(userId, pageId)
        except TYBizException, e:
            ec = e.errorCode
            info = e.message

            ftlog.info('doDuobaoMyRecord failer',
                       'userId=', userId,
                       'pageId=', pageId,
                       'ec=', ec,
                       'info=', info)
예제 #10
0
파일: room.py 프로젝트: luningcowboy/tuyoo
 def doRoomLeave(self, roomId, userId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     if isinstance(room, DizhuRoom):
         room.handleMsg(msg)
     else:
         room.doLeave(userId, msg)
예제 #11
0
 def doExchange(self, gameId, userId):
     try:
         msg = runcmd.getMsgPack()
         couponId = msg.getParam('id')
         phone = msg.getParam('phone')
         if not phone:
             phone = msg.getParam('phoneNumber')
         if not phone:
             pp = msg.getParam('params', {})
             if isinstance(pp, dict):
                 phone = pp.get('phoneNumber')
         if not phone:
             if ftlog.is_debug():
                 ftlog.debug('ExchangeHandler.doExchange gameId=', gameId,
                             'userId=', userId, 'couponId=', couponId,
                             'phone=', phone)
             raise TYBizException(-1, 'Please input phone number')
         _trueDelta, final = self._getCouponService().exchangeCouponItem(
             userId, couponId, phone=phone)
         mo = MsgPack()
         mo.setCmd('exchange')
         mo.setResult('action', 'exchange')
         mo.setResult('id', couponId)
         mo.setResult('info', '兑换请求处理成功')
         mo.setResult('quan_left', final)
         router.sendToUser(mo, userId)
     except TYBizException, e:
         mo = MsgPack()
         mo.setCmd('exchange')
         mo.setError(e.errorCode, e.message)
         router.sendToUser(mo, userId)
예제 #12
0
파일: table.py 프로젝트: luningcowboy/tuyoo
 def doReplaySave(self, userId, roomId, tableId, roundId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     if isinstance(table, DizhuTableCtrl):
         return table.proto.handleMsg(msg)
     else:
         mo = MsgPack()
         mo.setCmd('table')
         mo.setResult('action', 'replay_save')
         try:
             gameRound, savedUserIds = table.findGameRound(roundId)
             if gameRound and gameRound.findSeatByUserId(userId):
                 if not gameRound.gameOverTimestamp:
                     raise TYBizException(-1, '牌局还没结束')
                 if userId in savedUserIds:
                     raise TYBizException(-1, '牌局已经保存')
                 replay_service.saveVideo(userId, gameRound)
                 savedUserIds.add(userId)
             else:
                 raise TYBizException(-1, '没有找到该牌局')
         except TYBizException, e:
             mo.setResult('code', e.errorCode)
             mo.setResult('info', e.message)
         router.sendToUser(mo, userId)
         return mo
예제 #13
0
파일: room.py 프로젝트: zhaozw/hall37
 def doRoomMatchList(self, roomId, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     page = msg.getParam("page", 0)
     num = msg.getParam("number", 0)
     tag = msg.getParam("tag", "all")
     gdata.rooms()[roomId].doGetMatchList(userId, page, num, tag)
예제 #14
0
    def doDuobaoReward(self):
        '''
        一元夺宝领奖
        '''
        msg = runcmd.getMsgPack()
        gameId = msg.getParam("gameId")
        userId = msg.getParam("userId")
        duobaoId = msg.getParam("duobaoId")
        issue = msg.getParam("issue")

        ec = 0
        info = '领取成功'
        reward = {}

        try:
            from hall.entity import hall1yuanduobao
            reward = hall1yuanduobao.duobaoReward(userId, duobaoId, issue)
        except TYBizException, e:
            ec = e.errorCode
            info = e.message

            ftlog.info('doubaoReward failer',
                       'userId=', userId,
                       'duobaoId=', duobaoId,
                       'issue=', issue,
                       'ec=', ec,
                       'info=', info)
예제 #15
0
 def doExchange(self, gameId, userId):
     try:
         msg = runcmd.getMsgPack()
         couponId = msg.getParam('id')
         phone = msg.getParam('phone')
         if not phone:
             phone = msg.getParam('phoneNumber')
         if not phone:
             pp = msg.getParam('params', {})
             if isinstance(pp, dict):
                 phone = pp.get('phoneNumber')
         if not phone:
             if ftlog.is_debug():
                 ftlog.debug('ExchangeHandler.doExchange gameId=', gameId,
                             'userId=', userId,
                             'couponId=', couponId,
                             'phone=', phone)
             raise TYBizException(-1, 'Please input phone number')
         _trueDelta, final = self._getCouponService().exchangeCouponItem(userId, couponId, phone=phone)
         mo = MsgPack()
         mo.setCmd('exchange')
         mo.setResult('action', 'exchange')
         mo.setResult('id', couponId)
         mo.setResult('info', '兑换请求处理成功')
         mo.setResult('quan_left', final)
         router.sendToUser(mo, userId)
     except TYBizException, e:
         mo = MsgPack()
         mo.setCmd('exchange')
         mo.setError(e.errorCode, e.message)
         router.sendToUser(mo, userId)
예제 #16
0
    def doSportlotteryBet(self):
        '''体育竞猜下注'''
        if ftlog.is_debug():
            ftlog.debug('doSportlotteryBet enter')
        msg = runcmd.getMsgPack()
        gameId = msg.getParam("gameId")
        clientId = msg.getParam("clientId")
        userId = msg.getParam('userId')
        date = msg.getParam('date')
        matchId = msg.getParam('uuid')
        party = msg.getParam('party')  # 1主胜  2 平  3客胜
        coin = msg.getParam('coin')
        type = msg.getParam('type')  # 1足球 0篮球

        ec = 0
        info = '投注成功'
        userChip = 0

        try:

            userChip = hallsportlottery.sportlotteryBet(
                gameId, clientId, userId, date, matchId, party, coin)

            self.doSportDetail(userId, date, matchId, type, gameId)
        except TYBizException, e:
            ec = e.errorCode
            info = e.message

            ftlog.info('doSportlotteryBet failer', 'userId=', userId, 'date=',
                       date, 'matchId=', matchId, 'party=', party, 'coin=',
                       coin, 'ec=', ec, 'info=', info)
예제 #17
0
 def doRoomMatchList(self, roomId, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     page = msg.getParam("page", 0)
     num = msg.getParam("number", 0)
     tag = msg.getParam("tag", "all")
     gdata.rooms()[roomId].doGetMatchList(userId, page, num, tag)
예제 #18
0
파일: quick.py 프로젝트: luningcowboy/tuyoo
 def doRoomQuickStart(self, roomId, tableId0, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     gdata.rooms()[roomId].doQuickStart(msg)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
예제 #19
0
파일: room.py 프로젝트: zhaozw/hall37
 def doRoomQuickStart(self, roomId, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     gdata.rooms()[roomId].doQuickStart(msg)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
예제 #20
0
파일: match.py 프로젝트: luningcowboy/tuyoo
    def _handleSigninFeeNotEnoughException(cls, room, ex, uid, mo):
        payOrder = ex.fee.getParam('payOrder')

        clientId = sessiondata.getClientId(uid)
        clientOs, _clientVer, _ = strutil.parseClientId(clientId)
        msg = runcmd.getMsgPack()
        ddzver = msg.getParam('ddzver', 0) if msg else 0

        ftlog.debug("groupmatch._handleSigninFeeNotEnoughException", "userId", uid, "_clientVer=", _clientVer)
        if ddzver >= 3.772:
            cls._handleSigninFeeNotEnoughException_V3_772(room, ex, uid, mo)
            return

        if payOrder:
            clientOs = clientOs.lower()
            product, _shelves = hallstore.findProductByPayOrder(room.gameId, uid, clientId, payOrder)
            if product:
                buyType = ''
                btnTxt = ''
                if ex.fee.assetKindId == hallitem.ASSET_CHIP_KIND_ID and clientOs == 'winpc':
                    user_diamond = userdata.getAttrInt(uid, 'diamond')
                    if user_diamond >= int(product.priceDiamond):
                        buyType = 'consume'
                        btnTxt = '兑换'
                    else:
                        buyType = 'charge'
                        btnTxt = '去充值'
                orderShow = TodoTaskOrderShow.makeByProduct(ex.fee.failure, '', product, buyType)
                orderShow.setParam('sub_action_btn_text', btnTxt)
                mo = TodoTaskHelper.makeTodoTaskMsg(room.gameId, uid, orderShow)
                router.sendToUser(mo, uid)
                return True
        mo = TodoTaskHelper.makeTodoTaskMsg(room.gameId, uid, TodoTaskShowInfo(ex.fee.failure))
        router.sendToUser(mo, uid)
예제 #21
0
    def doJoinCreateTable(self, userId, gameId, clientId, roomId0, tableId0,
                          playMode):
        """用户加入自建牌桌
        """
        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(
            lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
            ftlog.warn('create_table error, user in table')
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                "type": "quickstart",
                "pluginParams": {
                    "roomId": lroomId,
                    "tableId": ltableId,
                    "seatId": lseatId
                }
            }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        else:
            msg = runcmd.getMsgPack()
            createTableNo = msg.getParam('createTableNo', 0)
            if not createTableNo:
                return
            tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(
                createTableNo)
            if not tableId0 or not roomId0:
                sendPopTipMsg(userId, "找不到您输入的房间号")
                return
            msg = runcmd.getMsgPack()
            msg.setParam("shadowRoomId", roomId0)
            msg.setParam("roomId", roomId0)
            msg.setParam("tableId", tableId0)
            msg.setCmdAction("room", "join_create_table")
            router.sendRoomServer(msg, roomId0)

            if router.isQuery():
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
예제 #22
0
파일: table.py 프로젝트: luningcowboy/tuyoo
 def doTableTreasureBox(self, userId, roomId, tableId, seatId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     if isinstance(table, DizhuTableCtrl):
         table.proto.handleMsg(msg)
     else:
         table.doTableTreasureBox(userId, seatId)
예제 #23
0
파일: room.py 프로젝트: zhaozw/hall37
 def doRoomReturnQueue(self, roomId, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     gdata.rooms()[roomId].doReturnQueue(userId)
     mo = MsgPack()
     mo.setCmd('room')
     mo.setResult('action', 'return_queue')
     router.responseQurery(mo)
예제 #24
0
 def doGetDuobaoProductList(self):
     """
     获取夺宝产品列表
     @return:
     """
     msg = runcmd.getMsgPack()
     userId = msg.getParam("userId")
     DuobaoUTServerHelper.handle_get_product_list(userId)
예제 #25
0
파일: table.py 프로젝트: zhaozw/hall37
 def doTableSit(self, userId, roomId, tableId, seatId0, clientId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     table.doSit(msg, userId, seatId0, clientId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
예제 #26
0
파일: table.py 프로젝트: luningcowboy/tuyoo
 def doTableLeave(self, userId, roomId, tableId, clientId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     table.doLeave(msg, userId, clientId)
     if router.isQuery() :
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
예제 #27
0
 def doDeliveryProduct(self, gameId, realGameId, userId, orderId, prodId,
                       chargeType, chargeMap, consumeMap):
     msg = runcmd.getMsgPack()
     isSub = msg.getParam('isSub', 0)
     orderPlatformId = msg.getParam('orderPlatformId', '')
     return self.deliveryProduct(gameId, realGameId, userId, orderId,
                                 prodId, chargeType, chargeMap, consumeMap,
                                 isSub, orderPlatformId)
예제 #28
0
 def doHallNoticeReward(self, userId, gameId, clientId):
     ftlog.debug("doHallNoticeReward:", userId, gameId, clientId)
     from hall.entity.newpopwnd import noticeReward
     from poker.protocol import runcmd
     msg = runcmd.getMsgPack()
     noticeReward(userId, gameId, clientId, msg)
     if ftlog.is_debug():
         ftlog.debug("hall_notice_reward:", userId, gameId, clientId)
예제 #29
0
 def doRoomReturnQueue(self, roomId, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     gdata.rooms()[roomId].doReturnQueue(userId)
     mo = MsgPack()
     mo.setCmd('room')
     mo.setResult('action', 'return_queue')
     router.responseQurery(mo)
예제 #30
0
파일: room.py 프로젝트: zhaozw/hall37
 def doRoomLeaveMatch(self, roomId, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     tableId = msg.getParam("tableId", 0)
     gdata.rooms()[roomId].doLeaveMatch(userId, tableId)
     mo = MsgPack()
     mo.setCmd('room')
     mo.setResult('action', 'leave_match')
     router.responseQurery(mo)
예제 #31
0
 def doActivityFanfanle(self, gameId, userId, clientId, activityId, action):
     msg = runcmd.getMsgPack()
     ftlog.debug('doActivityFanfanle msg=', msg)
     result = activity.activitySystem.handleActivityRequest(
         userId, gameId, clientId, msg)
     mo = ActivityTcpHelper.getOldResponseMsg(result, gameId, userId,
                                              activityId, action)
     ftlog.debug('doActivityFanfanle res=', mo)
     router.sendToUser(mo, userId)
예제 #32
0
 def doExchangeAuditResult(self, userId, exchangeId, result):
     try:
         msg = runcmd.getMsgPack()
         ftlog.debug('doExchangeAuditResult msg=', msg)
         from hall.entity import hallexchange
         hallexchange.handleExchangeAuditResult(userId, exchangeId, result)
     except:
         ftlog.error('HallExchangeHandler.doExchangeAuditResult userId=',
                     userId, 'exchangeId=', exchangeId, 'result=', result)
예제 #33
0
 def doGetDaysRewardMonth(self, gameId, userId, clientId):
     msg = runcmd.getMsgPack()
     days = msg.getParam('days')
     try:
         mo = MsgPack()
         MonthCheckinStatus = monthcheckin.getDaysReward(
             userId, days, gameId)
         mo.setCmd('month_checkin')
         if not MonthCheckinStatus:
             mo.setResult('userId', userId)
             mo.setResult('tip', 'maybe is script')
             ftlog.info('maybe is script userId =', userId)
             router.sendToUser(mo, userId)
             return
         mo.setResult('action', 'getDaysReward')
         mo.setResult('checkinDateList', [
             d.strftime('%Y%m%d')
             for d in MonthCheckinStatus.checkinDateList
         ])
         daysRewards = []
         for days, rewardContent in enumerate(monthcheckin.getConf().get(
                 'daysRewards', [])):
             reward = rewardContent.get('reward')
             monthRange = monthcheckin.getMonthRange()
             if rewardContent.get('days') < monthRange:
                 monthRange = rewardContent.get('days')
             daysRewards.append({
                 'days':
                 monthRange,
                 'desc':
                 reward.get('desc'),
                 'picUrl':
                 reward.get('picUrl'),
                 'state':
                 self.calcDaysRewardState(MonthCheckinStatus, monthRange)
             })
             ftlog.debug('doGetDaysRewardMonth daysRewards monthRange =',
                         monthRange)
         mo.setResult('daysRewards', daysRewards)
         mo.setResult('supplementCheckinDateList', [
             d.strftime('%Y%m%d')
             for d in MonthCheckinStatus.supplementCheckinDateList
         ])
         mo.setResult('rewardDaysList', MonthCheckinStatus.rewardDaysList)
         ftlog.debug('doGetDaysRewardMonth userId =', userId, 'gameId =',
                     gameId, 'clientId =', clientId, 'daysRewards =',
                     daysRewards)
         router.sendToUser(mo, userId)
         datachangenotify.sendDataChangeNotify(gameId, userId,
                                               ['free', 'promotion_loc'])
     except MonthCheckinException, e:
         mo = MsgPack()
         mo.setCmd('month_checkin')
         mo.setResult('action', 'getDaysReward')
         mo.setError(e.errorCode, e.message)
         router.sendToUser(mo, userId)
         ftlog.warn('doGetDaysRewardMonth ' + str(e))
예제 #34
0
파일: match.py 프로젝트: luningcowboy/tuyoo
 def _handleSigninException(cls, room, ex, uid, mo):
     msg = runcmd.getMsgPack()
     ddzver = msg.getParam('ddzver', 0) if msg else 0
     if ddzver < 3.772:
         infoTodotask = TodoTaskShowInfo(ex.message)
         mo = TodoTaskHelper.makeTodoTaskMsg(room.gameId, uid, infoTodotask)
         router.sendToUser(mo, uid)
     else:
         cls.sendDizhuFailureMsg(room.gameId, uid, '报名失败', ex.message, None)
예제 #35
0
 def doRoomLeaveMatch(self, roomId, userId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     tableId = msg.getParam("tableId", 0)
     gdata.rooms()[roomId].doLeaveMatch(userId, tableId)
     mo = MsgPack()
     mo.setCmd('room')
     mo.setResult('action', 'leave_match')
     router.responseQurery(mo)
예제 #36
0
파일: table.py 프로젝트: luningcowboy/tuyoo
 def doTableChat(self, userId, roomId, tableId, seatId, isFace, voiceIdx,
                 chatMsg):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     if isinstance(table, DizhuTableCtrl):
         table.proto.handleMsg(msg)
     else:
         table.doTableChat(userId, seatId, isFace, voiceIdx, chatMsg)
예제 #37
0
 def _handleSigninException(self, ex, userId, mp):
     msg = runcmd.getMsgPack()
     ddzver = msg.getParam('ddzver', 0) if msg else 0
     if ddzver < 3.772:
         infoTodotask = TodoTaskShowInfo(ex.message)
         mp = TodoTaskHelper.makeTodoTaskMsg(self.gameId, userId, infoTodotask)
         router.sendToUser(mp, userId)
     else:
         self.sendDizhuFailureMsg(self.gameId, userId, '报名失败', ex.message, None)
예제 #38
0
    def doJoinCreateTable(self, userId, gameId, clientId, roomId0, tableId0, playMode):
        """用户加入自建牌桌
        """
        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
            ftlog.warn('create_table error, user in table')
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                "type": "quickstart",
                "pluginParams": {
                    "roomId": lroomId,
                    "tableId": ltableId,
                    "seatId": lseatId
                }
            }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        else:
            msg = runcmd.getMsgPack()
            createTableNo = msg.getParam('createTableNo', 0)
            if not createTableNo:
                return
            tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(createTableNo)
            if not tableId0 or not roomId0:
                sendPopTipMsg(userId, "找不到您输入的房间号")
                return
            msg = runcmd.getMsgPack()
            msg.setParam("shadowRoomId", roomId0)
            msg.setParam("roomId", roomId0)
            msg.setParam("tableId", tableId0)
            msg.setCmdAction("room", "join_create_table")
            router.sendRoomServer(msg, roomId0)

            if router.isQuery():
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
예제 #39
0
 def doActivityDdzFundCheck(self, gameId, userId, clientId, activityId, action):
     '''
     地主基金活动协议
     '''
     msg = runcmd.getMsgPack()
     ftlog.debug('doActivityDdzFundCheck msg=', msg)
     result = activity.activitySystem.handleActivityRequest(userId, gameId, clientId, msg)
     mo = ActivityTcpHelper.getOldResponseMsg(result, gameId, userId, activityId, action)
     ftlog.debug('doActivityDdzFundCheck res=', mo)
     router.sendToUser(mo, userId)
예제 #40
0
파일: table.py 프로젝트: zhaozw/hall37
 def doRoomGetPlayingTableList(self, roomId):
     msg = runcmd.getMsgPack()
     ftlog.debug('msg=', msg, caller=self)
     result = gdata.rooms()[roomId].doGetPlayingTableList()
     if router.isQuery():
         mo = MsgPack()
         mo.setCmd("room")
         mo.setResult("action", "playingTableList")
         mo.updateResult(result)
         router.responseQurery(mo)
예제 #41
0
파일: room.py 프로젝트: zhaozw/hall37
    def doRoomSigIn(self, roomId, userId, signinParams):
        msg = runcmd.getMsgPack()
        if ftlog.is_debug():
            ftlog.debug('msg=', msg, 'mode=', gdata.mode(),
                        caller=self)
        if not signinParams and gdata.enableTestHtml():
            room = gdata.rooms()[roomId]
            signinParams = gamedata.getGameAttrJson(userId, room.gameId, 'test.signinParams')

        gdata.rooms()[roomId].doSignin(userId, signinParams)
예제 #42
0
 def doExchangeAuditResult(self, userId, exchangeId, result):
     try:
         msg = runcmd.getMsgPack()
         ftlog.debug('doExchangeAuditResult msg=', msg)
         from hall.entity import hallexchange
         hallexchange.handleExchangeAuditResult(userId, exchangeId, result)
     except:
         ftlog.error('HallExchangeHandler.doExchangeAuditResult userId=', userId,
                     'exchangeId=', exchangeId,
                     'result=', result)
예제 #43
0
파일: room.py 프로젝트: zhaozw/hall37
 def doJoinCreateTable(self, userId, gameId, roomId):
     """加入自建桌
     """
     msg = runcmd.getMsgPack()
     ftlog.debug('RoomTcpHandler.doJoinCreateTable msg=', userId,
                 gameId, roomId, msg, caller=self)
     room = gdata.rooms()[roomId]
     self._doJoinCreateTable(room, msg)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
예제 #44
0
 def doActivityListOld(self, gameId, userId, clientId):
     msg = runcmd.getMsgPack()
     ftlog.debug('doActivityListOld msg=', msg)
     activityList = activity.activitySystem.getActivityList(gameId, userId, clientId)
     mo = MsgPack()
     mo.setCmd('activity_list')
     mo.setResult("gameId", gameId)
     mo.setResult("userId", userId)
     mo.setResult("list", activityList)
     ftlog.debug("doActivityList, mo=", mo)
     router.sendToUser(mo, userId)
예제 #45
0
파일: table.py 프로젝트: zhaozw/hall37
 def doTableCall(self, userId, roomId, tableId, clientId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     action = msg.getParam('action')
     seatId = msg.getParam('seatId', -1)  # 旁观时没有seatId参数
     assert isinstance(seatId, int)
     table.doTableCall(msg, userId, seatId, action, clientId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
예제 #46
0
파일: room.py 프로젝트: zhaozw/hall37
 def getRoomOnlineInfoDetails(self, roomId):
     msg = runcmd.getMsgPack()
     cp = gdata.curProcess.cpu_percent()
     datas = {'cpu': cp}
     if roomId in gdata.rooms():
         room = gdata.rooms()[roomId]
         ucount, pcount, users = room.getRoomOnlineInfoDetail()
         datas[roomId] = [ucount, pcount, users]
     else:
         datas[roomId] = 'not on this server'
     msg.setResult('datas', datas)
     return msg
예제 #47
0
파일: table.py 프로젝트: zhaozw/hall37
 def doTableStandUp(self, userId, roomId, tableId, seatId, clientId):
     '''
     此命令一定是由客户端发送的命令, 如果是内部控制命令,那么需要进行区分命令,不能混合调用
     主要是为了避免站起的原因混乱,
     '''
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     table.doStandUp(msg, userId, roomId, tableId, seatId, TableStandUpEvent.REASON_USER_CLICK_BUTTON, clientId)
     if router.isQuery():
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, str(tableId), str(userId))
예제 #48
0
 def doActivity5ExchangeItemList(self, gameId, userId, clientId):
     msg = runcmd.getMsgPack()
     ftlog.debug('doActivity5ExchangeItemList msg=', msg)
     exchangeList = _doActivity5ExchangeItemList(gameId, userId, clientId)
     mo = MsgPack()
     mo.setCmd('act')
     mo.setResult("gameId", gameId)
     mo.setResult("userId", userId)
     mo.setResult("action", "exchange_item_list")
     mo.updateResult(exchangeList)
     ftlog.debug("doActivity5ExchangeItemList, mo=", mo)
     router.sendToUser(mo, userId)
예제 #49
0
 def doActivity5PrizeMsgList(self, gameId, userId, clientId):
     msg = runcmd.getMsgPack()
     ftlog.debug('doActivity5PrizeMsgList msg=', msg)
     prizeList = _doActivity5PrizeMsgList(gameId, userId, clientId)
     mo = MsgPack()
     mo.setCmd('act')
     mo.setResult("gameId", gameId)
     mo.setResult("userId", userId)
     mo.setResult("action", "prize_msg_list")
     mo.setResult("list", prizeList)
     ftlog.debug("doActivity5PrizeMsgList, mo=", mo)
     router.sendToUser(mo, userId)
예제 #50
0
파일: table.py 프로젝트: zhaozw/hall37
 def doTableManage(self, roomId, tableId):
     msg = runcmd.getMsgPack()
     room = gdata.rooms()[roomId]
     table = room.maptable[tableId]
     action = msg.getParam('action')
     result = table.doTableManage(msg, action)
     if router.isQuery():
         mo = MsgPack()
         mo.setCmd('table_manage')
         mo.setResult('action', action)
         mo.updateResult(result)
         router.responseQurery(mo)
예제 #51
0
파일: room.py 프로젝트: zhaozw/hall37
 def signinNextMatch(self, gameId, userId):
     """报名下一场比赛
     """
     msg = runcmd.getMsgPack()
     roomId = msg.getParam('room_id', 0)
     ctlRoomIds = [bigRoomId * 10000 + 1000 for bigRoomId in gdata.gameIdBigRoomidsMap()[gameId]]
     if roomId in ctlRoomIds:
         room = gdata.rooms()[roomId]
         if room:
             signinParams = gamedata.getGameAttrJson(userId, room.gameId, 'test.signinParams')
             room.doSignin(userId, signinParams)
         else:
             ftlog.info('=======signinNextMatch==Trace==', roomId, userId)
예제 #52
0
    def getMenuList(self, gameId, userId, clientId):
        msg = runcmd.getMsgPack()
        ftlog.debug('getMenuList msg=', msg)
        menuList = hallmenulist.getClientMenuList(clientId)
        menu_settings = hallmenulist.getClientCustomMenuSetting(gameId, userId, clientId, menuList)

        mo = MsgPack()
        mo.setCmd('menu_list')
        mo.setResult("gameId", gameId)
        mo.setResult("userId", userId)
        mo.setResult("menus", menuList)
        mo.setResult("menu_settings", menu_settings)
        router.sendToUser(mo, userId)
예제 #53
0
파일: room.py 프로젝트: zhaozw/hall37
    def doCreateTable(self, userId, gameId, roomId):
        """自建桌创建
            1.通过roomId得到房间对象
            2.得到合适的tableId,然后sit
        """
        ftlog.info("<< doCreateTable | userId, clientId, roomId, msg:", userId, gameId, roomId)

        msg = runcmd.getMsgPack()
        room = gdata.rooms()[roomId]
        self._doCreateTable(room, msg, gameId)
        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo, '', str(userId))
예제 #54
0
    def doFriendCall(self, gameId, userId):
        ftlog.debug('doFriendCall...')

        cmd = runcmd.getMsgPack()
        # router.sendToUser(mo, userId)
        # clientId = runcmd.getClientId(cmd)
        action = cmd.getParam('action')

        if action == 'invite_to_game':
            # 邀请好友牌桌游戏
            enterParams = cmd.getParam('enterParams')
            note = cmd.getParam('note')
            invitees = cmd.getParam('invitees')
            self.processInvitees(enterParams, note, invitees, userId, gameId)
            return
        elif action == 'answer_to_invite':
            # 对好友邀请的应答
            inviter = cmd.getParam('inviter')
            answer = cmd.getParam('answer')
            self.processInviteAnswser(inviter, answer, userId, gameId)
            return
        elif action in ['get_friends_rank', 'get_friend_tip_info', 'praise_friend']:
            from hall.entity import hallvip
            try:
                vip = hallvip.userVipSystem.getUserVip(userId).vipLevel.level
            except:
                vip = 0
            cmd.setParam('vip', vip)
        elif action == 'add_friend':
            if self._isObserver(userId):
                show_info_task = TodoTaskShowInfo("对不起,旁观时不能加好友哦~")
                TodoTaskHelper.sendTodoTask(gameId, userId, show_info_task)
                return

        # if not clientId:
        #     clientId = sessiondata.getClientId(userId)
        params = cmd._ht['params']
        tcp_params = strutil.cloneData(params)
        del tcp_params['authorCode']

        del params['action']
        del params['gameId']
        params['appId'] = gameId
        # params['from_tcp'] = 1

        import json
        params['tcp_params'] = json.dumps(tcp_params)

        url = self.action_urls[action]
        ftlog.debug('handleFriendCall post', url, params)
        sdkclient._requestSdk(url, params, needresponse=False)
예제 #55
0
파일: room.py 프로젝트: zhaozw/hall37
 def doMatchState(self, userId, gameId, roomId):
     msg = runcmd.getMsgPack()
     match_id = msg.getParam("match_id")
     if match_id:  # 老比赛,由于前端新比赛也会发此消息,但没有match_id导致的问题,这里处理下
         state = gdata.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)
         router.sendToUser(msg, userId)
예제 #56
0
파일: room.py 프로젝트: zhaozw/hall37
    def doHandleCommonRoomCmdAction(self, userId, gameId, roomId, clientId):
        room = gdata.rooms()[roomId]
        msg = runcmd.getMsgPack()
        params = msg.getKey('params')
        params.update({'room': room})

        if ftlog.is_debug():
            ftlog.debug("<< |userId, gameId, roomId, clientId, msg:", userId, gameId, roomId, clientId, msg,
                        caller=self)

        TYPluginCenter.event(msg, gameId)

        if router.isQuery():
            mo = runcmd.newOkMsgPack(1)
            router.responseQurery(mo)
예제 #57
0
 def doGetCreateTableRecord(self, userId, gameId, clientId):
     """全量请求牌桌记录
     """
     msg = runcmd.getMsgPack()
     startRecordIndex = msg.getParam('startRecordIndex', None)
     if not startRecordIndex:
         startRecordIndex = 0
     endRecordIndex = msg.getParam('endRecordIndex', None)
     if not endRecordIndex:
         endRecordIndex = 19
         
     MJCreateTableRecord.sendAllRecordToUser(userId, gameId, startRecordIndex, endRecordIndex)
     if router.isQuery() :
         mo = runcmd.newOkMsgPack(1)
         router.responseQurery(mo, '', str(userId))
예제 #58
0
    def doGetSoldierForUser(self, userId, gameId, clientId):
        '''
        客户端点击事件
        获取用户的历史小兵信息
        '''
        msg = runcmd.getMsgPack()
        issue = msg.getParam('issue')
        if ftlog.is_debug():
            ftlog.debug('doGetSoldierForUser.userId:', userId
                        , ' gameId:', gameId
                        , ' clientId:', clientId
                        , ' issue:', issue)

        result, _, _ = hallroulette.doGetSoldierIdForUser(userId, gameId, clientId, issue)
        mo = rouletteHelper.makeRouletteQueryResponse(gameId, userId, clientId, 'issue_user', result)
        router.sendToUser(mo, userId)
예제 #59
0
파일: table.py 프로젝트: zhaozw/hall37
    def doHandleCommonRoomCmdAction(self, gameId, roomId, userId, clientId):
        msg = runcmd.getMsgPack()
        room = gdata.rooms()[roomId]
        tableId = msg.getParam("tableId")
        if tableId:
            table = room.maptable[tableId]
        else:
            table = None

        params = msg.getKey('params')
        params.update({'room': room, 'table': table})

        if ftlog.is_debug():
            ftlog.debug("<< |userId, gameId, roomId, tableId, clientId, msg:", userId, gameId, roomId, clientId, msg,
                        caller=self)

        TYPluginCenter.event(msg, gameId)
예제 #60
0
파일: room.py 프로젝트: zhaozw/hall37
    def doRoomGM(self, roomId):
        msg = runcmd.getMsgPack()
        if ftlog.is_debug():
            ftlog.info('doRoomGM msg=', msg, caller=self)
        room = gdata.rooms()[roomId]

        result = {}
        params = msg.getKey('params')
        params.update({'room': room})

        evmsg = TYPluginUtils.updateMsg(cmd='EV_ROOM_GM', params=params,
                                        result=result)
        TYPluginCenter.event(evmsg, room.gameId)

        if router.isQuery():
            mo = TYPluginUtils.updateMsg(cmd='room', result=result)
            router.responseQurery(mo)