Example #1
0
def sendBuyDiamondTodoTask(userId, gameId, clientId, pay_order):
    """ 幸运大抽奖,钻石购买
    @param         pay_order        挑选商品模板
    """
    if not TYPlayer.isHuman(userId):
        return

    product, _ = hallstore.findProductByPayOrder(gameId, userId, clientId,
                                                 pay_order)
    if not product:
        ftlog.error('userId =', userId, 'clientId =', clientId, 'pay_order =',
                    pay_order, 'can not find suitable product!')
        return
    try:
        product = product.clone()
    except:
        product = strutil.cloneData(product)
    desc = u'您的钻石不够哦~\n现在' + unicode(product.price) + u'元立得' + unicode(
        product.priceDiamond) + u'钻石!'
    product.content.desc = str(product.priceDiamond) + '钻石'
    client_ver = sessiondata.getClientIdVer(userId)
    if client_ver < 3.74:  # 客户端bug,小于3.74的版本转换一下
        product.priceDiamond = product.price
    todotasks = TodoTaskOrderShow.makeByProduct(desc, '', product)
    TodoTaskHelper.sendTodoTask(gameId, userId, todotasks)
Example #2
0
def triggleFiveStarRateIfNeed(userId, clientId, timestamp, desc):
    clientConf = hallconf.getFiveStarClientConf(clientId)
    if clientConf.get('disable', 0):
        if ftlog.is_debug():
            ftlog.debug('fivestarrate.triggleFiveStarRateIfNeed userId=',
                        userId, 'clientId=', clientId, 'timestamp=', timestamp,
                        'desc=', desc, 'clientConf=', clientConf)
        return False, None

    ver, channelName = _parseClientId(clientId)
    channel = _channels.get(channelName)
    if ftlog.is_debug():
        ftlog.debug('fivestarrate.triggleFiveStarRateIfNeed userId=', userId,
                    'clientId=', clientId, 'timestamp=', timestamp, 'desc=',
                    desc, 'channelName=', channelName, 'channel=', channel)

    if channel:
        fsRate = _loadFiveStarRate(userId, channel)
        if _canPopFiveStarRate(userId, ver, fsRate, timestamp):
            if 'appendDesc' in channel and _canSendPrize(channel):
                desc += "\n" + channel['appendDesc']
            todotask = TodoTaskPopFiveStarWnd(desc, channel['rateUrl'])
            TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, todotask)
            fsRate.popTime = timestamp
            _saveFiveStarRate(userId, fsRate)
            ftlog.debug('fivestarrate.triggleFiveStarRateIfNeed userId=',
                        userId, 'clientId=', clientId, 'timestamp=', timestamp,
                        'desc=', desc, 'channelName=', channelName, 'channel=',
                        channel, 'rateUrl=', channel['rateUrl'])
            return True, todotask
    return False, None
Example #3
0
 def _sendTodoTaskJumpHighRoom(cls, userId, playMode, clientId):
     # todo fix the pop wnd to ddz's
     if not playMode in dizhuconf.PLAYMODE_ALLSET:
         playMode = dizhuconf.PLAYMODE_DEFAULT
     chosenRoomId, _ = cls._chooseRoom(userId, DIZHU_GAMEID, playMode)
     if chosenRoomId:
         quick_start_ = TodoTaskQuickStart(DIZHU_GAMEID, chosenRoomId)
         info_str_ = dizhuconf.getQuickStartErrorMsg(
             TYRoom.ENTER_ROOM_REASON_GREATER_MAX)
         show_info_ = TodoTaskShowInfo(info_str_, True)
         show_info_.setSubCmd(quick_start_)
         try:
             if cls._useSelfPopWnd(userId):
                 todoTaskObj = TodoTaskHelper.encodeTodoTasks(quick_start_)
                 Alert.sendNormalAlert2Button(DIZHU_GAMEID, userId, '提示',
                                              info_str_, todoTaskObj[0],
                                              '确定', None, '取消')
                 return
         except:
             ftlog.error('_sendTodoTaskJumpHighRoom error userId = ',
                         userId, ' clientId = ', clientId, 'playMode = ',
                         playMode)
         msg = TodoTaskHelper.makeTodoTaskMsg(DIZHU_GAMEID, userId,
                                              show_info_)
         router.sendToUser(msg, userId)
     else:
         cls._sendTodoTaskToUser(userId,
                                 TYRoom.ENTER_ROOM_REASON_GREATER_ALL)
Example #4
0
    def buildFlipCardResponse(cls, gameId, userId, roomId, flipIndex,
                              flippedCardList, benefitsSend, userBenefits):
        assert (flipIndex >= 0 and flipIndex <= len(flippedCardList))
        flippedCard = flippedCardList[flipIndex]
        mo = MsgPack()
        mo.setCmd('flip_card_luck')
        mo.setResult('action', 'flip')
        mo.setResult('index', flipIndex)
        mo.setResult('userId', userId)
        mo.setResult('gameId', gameId)

        mo.setResult('cards', cls.encodeFlippedCardList(flippedCardList, flipIndex))
        mo.setResult('desc', cls.getFlippedCardDesc(flippedCard))

        if isinstance(flippedCard, FlippedCardProduct):
            payOrder = TodoTaskPayOrder(flippedCard.product)
            mo.setResult('sub_action', payOrder.toDict())
            mo.setResult('sub_text', hallflipcardluck.getString('product.subText', '立即购买'))

            if benefitsSend:
                mo.setResult('sub_action_ext',
                             TodoTaskHelper.makeTodoTaskBenefitsInfo(benefitsSend, userBenefits).toDict())
            else:
                mo.setResult('sub_action_ext', TodoTaskNoop().toDict())
            mo.setResult('sub_text_ext', hallflipcardluck.getString('product.subTextExt', '取消'))
        elif isinstance(flippedCard, FlippedCardAsset):
            if benefitsSend:
                mo.setResult('sub_action', TodoTaskHelper.makeTodoTaskBenefitsInfo(benefitsSend, userBenefits).toDict())
            else:
                mo.setResult('sub_action', TodoTaskNoop().toStr())
            mo.setResult('sub_text', hallflipcardluck.getString('item.subText', '确定'))
        return mo
Example #5
0
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 encodePromote(cls, gameId, userId, clientId, promote):
     try:
         todotasks = TodoTaskHelper.makeTodoTasksByFactory(
             gameId, userId, clientId, promote.promotion.todotasks)
         tempRedPoint = False
         timestamp = pktimestamp.getCurrentTimestamp()
         ftlog.debug('promote.promotion.redPoint =',
                     promote.promotion.redPoint)
         for d in promote.promotion.redPoint:
             if d:
                 tempRedPoint = d.check(HALL_GAMEID, userId, clientId,
                                        timestamp)
         ret = {
             'id': promote.promotion.promotionId,
             'loc': promote.position.pos,
             'name': promote.promotion.displayName,
             'url': promote.promotion.url,
             'defaultRes': promote.promotion.defaultRes,
             'animate': promote.promotion.animate,
             'redPoint': tempRedPoint,
             'tasks': TodoTaskHelper.encodeTodoTasks(todotasks)
         }
         if promote.stopTime != -1:
             ret['endtime'] = datetime.fromtimestamp(
                 promote.stopTime).strftime('%Y-%m-%d %H:%M:%S')
         return ret
     except:
         ftlog.error('PromotionHelper.encodePromote gameId=', gameId,
                     'userId=', userId, 'clientId=', clientId,
                     'promotionId=', promote.promotion.promotionId)
         return None
Example #7
0
def sendShareForWXRedEnvelope(userId, record, item):
    try:
        action = item.itemKind.findActionByName('exchange')
        from hall.entity.hallitem import TYItemActionExchange
        if isinstance(
                action,
                TYItemActionExchange) and action.isWechatRedPack():  # 微信红包
            from poker.util import strutil
            from poker.entity.dao import sessiondata
            clientId = sessiondata.getClientId(userId)
            _, cVer, _ = strutil.parseClientId(clientId)
            if cVer >= 3.90:
                from hall.entity import hallshare
                gameId = strutil.getGameIdFromHallClientId(clientId)
                shareId = hallshare.getShareId('wxRedEnvelope', userId, gameId)
                share = hallshare.findShare(shareId)
                if share:
                    todotask = share.buildTodotask(HALL_GAMEID, userId,
                                                   'wxRedEnvelope')
                    if todotask:
                        from hall.entity.todotask import TodoTaskHelper
                        TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
    except:
        ftlog.error('sendShareForWXRedEnvelope', 'userId=', userId,
                    'exchangeId=', record.exchangeId, 'itemId=', item.itemId,
                    'itemKindId=', item.kindId)
def _changeUserBehaviourInfo(userId, ret, behaviourConf):
    try:
        reward = behaviourConf.get('reward') if behaviourConf else None
        if not reward:
            return
        ret['type'] = BEHAVIOUR_TYPE_REWARDED
        daobase.executeUserCmd(userId, 'HSET',
                               'userBehaviour:6:' + str(userId), 'info',
                               strutil.dumps(ret))

        mailStr = behaviourConf.get('mail', '幸运女神的眷顾使你获得了奖励')
        contentItems = TYContentItem.decodeList(reward)
        assetList = dizhu_util.sendRewardItems(userId, contentItems, mailStr,
                                               'USER_BEHAVIOUR_REWARD', userId)
        datachangenotify.sendDataChangeNotify(DIZHU_GAMEID, userId, mailStr)

        # 发奖弹窗
        rewardsList = []
        for assetItemTuple in assetList:
            assetItem = assetItemTuple[0]
            reward = {}
            reward['name'] = assetItem.displayName
            reward['pic'] = assetItem.pic
            reward['count'] = assetItemTuple[1]
            rewardsList.append(reward)

        reward_task = TodoTaskShowRewards(rewardsList)
        TodoTaskHelper.sendTodoTask(DIZHU_GAMEID, userId, reward_task)

        ftlog.info('userBehaviour.sendReward userId=', userId, 'reward=',
                   [(atp[0].kindId, atp[1]) for atp in assetList])

    except Exception, e:
        ftlog.warn('_changeUserBehaviourInfo userId=', userId, 'ret=', ret,
                   'err=', e)
Example #9
0
 def encodePromote(cls, gameId, userId, clientId, promote):
     try:
         todotasks = TodoTaskHelper.makeTodoTasksByFactory(gameId, userId, clientId, promote.promotion.todotasks)
         tempRedPoint = False
         timestamp = pktimestamp.getCurrentTimestamp()
         ftlog.debug('promote.promotion.redPoint =', promote.promotion.redPoint)
         for d in promote.promotion.redPoint:
             if d:
                 tempRedPoint = d.check(HALL_GAMEID, userId, clientId, timestamp)
         ret = {
             'id': promote.promotion.promotionId,
             'loc': promote.position.pos,
             'name': promote.promotion.displayName,
             'url': promote.promotion.url,
             'defaultRes': promote.promotion.defaultRes,
             'animate': promote.promotion.animate,
             'redPoint': tempRedPoint,
             'tasks': TodoTaskHelper.encodeTodoTasks(todotasks)
         }
         if promote.stopTime != -1:
             ret['endtime'] = datetime.fromtimestamp(promote.stopTime).strftime('%Y-%m-%d %H:%M:%S')
         return ret
     except:
         ftlog.error('PromotionHelper.encodePromote gameId=', gameId,
                     'userId=', userId,
                     'clientId=', clientId,
                     'promotionId=', promote.promotion.promotionId)
         return None
Example #10
0
    def recommendProductIfCan(self, gameId, userId):
        # 没有配置推荐商品,则不推荐
        payOrder = Tool.dictGet(self._clientConf, 'config.server.payOrder')
        if not payOrder:
            return False

        clientId = sessiondata.getClientId(userId)
        product, _ = hallstore.findProductByPayOrder(gameId, userId, clientId,
                                                     payOrder)
        ftlog.debug('FunAct.recommendProductIfCan:', 'userId=', userId,
                    'product=', product)
        # 没有在货架中找到商品
        if not product:
            return False

        translateMap = {
            'product.displayName': product.displayName,
            'product.price': product.price,
            'count': payOrder.get('contains', {}).get('count', 0)
        }
        desc = Tool.dictGet(self._clientConf, 'config.server.lessBuyChipDesc')
        note = Tool.dictGet(self._clientConf, 'config.server.lessBuyChipNote')
        desc = strutil.replaceParams(desc, translateMap)
        note = strutil.replaceParams(note, translateMap)
        todotask = TodoTaskLessBuyOrder(desc, None, note, product)
        TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
        return True
Example #11
0
 def processInvitees(self, enterParam, note, invitees, userId, gameId):
     '''
     邀请好友牌桌游戏
     invitees - 被邀请者
     '''
     if not invitees:
         return
     uds = userdata.getAttrs(userId, ['name'])
     # 检查是否在线
     for invitee in invitees:
         # invitee - 被邀请者
         state = onlinedata.getOnlineState(invitee)
         if state:
             # 在线,则进行下一步操作
             ids = userdata.getAttrs(invitee, ['name'])
             _, clientVer, _, _ = sessiondata.getClientIdInfo(invitee)
             if clientVer < 3.77:
                 # 版本号小于3.77,则提示升级
                 TodoTaskHelper.sendTodoTask(gameId, invitee,
                                             TodoTaskPopTip(note + ' 请升级至新版本与好友 ' + uds[0] + ' 一起玩耍!'))
                 TodoTaskHelper.sendTodoTask(gameId, userId,
                                             TodoTaskPopTip('您的好友 ' + ids[0] + ' 版本较低,提醒他升级到最新版本一起玩耍吧!'))
             else:
                 # 判断是否在同一牌桌上
                 if self.isInSameTable(userId, invitee):
                     TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskPopTip('您的好友 ' + ids[0] + ' 正在跟您一起游戏呢'))
                 else:
                     # 版本号大于3.77,则发送邀请
                     TodoTaskHelper.sendTodoTask(gameId, invitee, TodoTaskInviteToGame(userId, note, enterParam))
         else:
             TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskPopTip('您的好友当前不在线'))
             ftlog.debug('您的好友当前不在线')
Example #12
0
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)
Example #13
0
    def _onEnterRoomFailed(cls,
                           msg,
                           checkResult,
                           userId,
                           gameId,
                           clientId,
                           roomId=0):
        '''进入房间失败回调函数'''
        ftlog.warn("|userId, reason, roomId:",
                   userId,
                   checkResult,
                   roomId,
                   caller=cls)  # 调用最小房间金币不够充值提醒的todotask
        if not roomId:
            roomId = msg.getParam('candidateRoomId', 0)
        if checkResult == TYRoom.ENTER_ROOM_REASON_LESS_MIN or checkResult == 104:
            from hall.entity import hallproductselector
            product, _ = hallproductselector.selectLessbuyProduct(
                gameId, userId, clientId, roomId)
            if product:
                from hall.entity.todotask import TodoTaskOrderShow
                todotask = TodoTaskOrderShow.makeByProduct(
                    "金币不够啦,买一个超值礼包吧!", "", product)
                if todotask:
                    TodoTaskHelper.sendTodoTask(gameId, userId, todotask)

        mo = MsgPack()
        mo.setCmd('quick_start')
        mo.setResult('gameId', gameId)
        mo.setResult('userId', userId)
        mo.setError(checkResult, '进入房间失败,请稍后重试')
        router.sendToUser(mo, userId)
Example #14
0
    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)
Example #15
0
    def sendBenefits(self, gameId, userId, timestamp=None):
        '''
        发放救济金
        @return: isSend(True/False), TYUserBenefits
        '''
        if timestamp is None:
            timestamp = pktimestamp.getCurrentTimestamp()
        chip = pkuserchip.getUserChipAll(userId)
        if chip < self._minChip:
            # 用户金币低于指定数目时,发放救济金
            userBenefits = self.loadUserBenefits(gameId, userId, timestamp)
            if not userBenefits.hasLeftTimes():  # 没有剩余次数,弹分享引导
                oldtime = gamedata.getGameAttr(userId, HALL_GAMEID, 'relief_share_date')
                if not oldtime or datetime.fromtimestamp(oldtime).date() < datetime.fromtimestamp(timestamp).date():
                    # 每天最多弹一次
                    gamedata.setGameAttr(userId, HALL_GAMEID, 'relief_share_date', timestamp)
                    shareId = hallshare.getShareId('Relieffund', userId, gameId)
                    share = hallshare.findShare(shareId)
                    if share:
                        task = share.buildTodotask(gameId, userId, 'Relieffund')
                        TodoTaskHelper.sendTodoTask(gameId, userId, task)
                return False, userBenefits

            # 发放救济金
            userBenefits.times += 1
            self._benefitsDao.saveUserBenefitsData(userId, TYUserBenefitsData(userBenefits.times, timestamp))
            self._sendBenefits(gameId, userBenefits)
            # 通知用户金币刷新
            datachangenotify.sendDataChangeNotify(gameId, userId, ['udata'])
            return True, userBenefits
        return False, self.loadUserBenefits(gameId, userId, timestamp)
Example #16
0
 def _doChangeNameTry(self, userId, clientId, newName):
     #         renameConf = hallconf.getClientRenameConf(clientId)
     #         if (renameConf
     #             and not renameConf.get('containsSensitive', 1)
     #             and keywords.isContains(newName)):
     #             info = TodoTaskShowInfo(hallrename.stringRenameContainsSensitive)
     #             return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
     code, info = hallrename.tryRename(HALL_GAMEID, userId, newName)
     if ftlog.is_debug():
         ftlog.debug('hallrename._doChangeNameTry->', code, info)
     if code == -3:
         # name not changed !!
         pass
     elif code == -2:
         # 没有改名卡
         info = TodoTaskShowInfo(hallrename.stringRenameCardRequired, True)
         if hallrename.payOrder:
             product, _ = hallstore.findProductByPayOrder(HALL_GAMEID, userId, clientId, hallrename.payOrder)
             if product:
                 info.setSubCmd(TodoTaskPayOrder(product))
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
     elif code == 0:
         # 改名成功
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip(hallrename.stringRenameSuccessed))
     else:
         # SDK改名失败
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip(info))
Example #17
0
def getClientCustomMenuSetting(gameId, userId, clientId, menus):
    ''' 获取自定义菜单设置
    '''
    settings = {}
    
    for menu in menus:
        if menu in _menuCustomMap:
            ms = {}
            # 图片
            ms['picUrl'] = _menuCustomMap[menu].get('picUrl', '')
            # 行为
            todotasks = []
            for todotaskDict in _menuCustomMap[menu].get('todotasks', []):
                todotask = TodoTaskRegister.decodeFromDict(todotaskDict)
                todotasks.append(todotask)
                
            todotasks = TodoTaskHelper.makeTodoTasksByFactory(gameId, userId, clientId, todotasks)
            ms['tasks'] = TodoTaskHelper.encodeTodoTasks(todotasks)
            
            settings[menu] = ms
            
    if ftlog.is_debug():
        ftlog.debug('hallmenulist.getClientCustomMenuSetting settings=', settings)
        
    return settings
    
Example #18
0
    def doGetTaskReward(self, gameId, userId, taskId):
        '''
        获取活动奖励
        '''
        try:
            timestamp = pktimestamp.getCurrentTimestamp()
            taskModel = neituiguangtask.newUserTaskSystem.loadTaskModel(
                userId, timestamp)
            task = taskModel.userTaskUnit.findTask(taskId)
            if not task:
                raise TYBizException(-1, '未知的任务:%s' % (taskId))
            expiresTime = self.calcTaskExpires(userId)
            if timestamp >= expiresTime:
                raise TYBizException(-1, '任务已经过期')
            if not userdata.getAttr(userId, 'bindMobile'):
                conf = neituiguang.getConf()
                TodoTaskHelper.sendTodoTask(
                    gameId, userId, TodoTaskBindPhone(conf.pleaseBindPhone,
                                                      ''))
                return
            assetList = neituiguangtask.newUserTaskSystem.getTaskReward(
                task, timestamp, 'PROMOTE_TASK', taskId)
            router.sendToUser(self.buildTaskInfoResponse(userId), userId)

            rewardStr = TYAssetUtils.buildContentsString(assetList)
            mo = MsgPack()
            mo.setCmd('promote_info')
            mo.setResult('action', 'get_task_reward')
            mo.setResult('code', 0)
            mo.setResult('info', '恭喜您获得了%s' % rewardStr)
            router.sendToUser(mo, userId)
        except TYBizException, e:
            router.sendToUser(
                self.makeErrorResponse('get_task_reward', e.errorCode,
                                       e.message), userId)
Example #19
0
 def _doChangeNameTry(self, userId, clientId, newName):
     #         renameConf = hallconf.getClientRenameConf(clientId)
     #         if (renameConf
     #             and not renameConf.get('containsSensitive', 1)
     #             and keywords.isContains(newName)):
     #             info = TodoTaskShowInfo(hallrename.stringRenameContainsSensitive)
     #             return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
     code, info = hallrename.tryRename(HALL_GAMEID, userId, newName)
     if ftlog.is_debug():
         ftlog.debug('hallrename._doChangeNameTry->', code, info)
     if code == -3:
         # name not changed !!
         pass
     elif code == -2:
         # 没有改名卡
         info = TodoTaskShowInfo(hallrename.stringRenameCardRequired, True)
         if hallrename.payOrder:
             product, _ = hallstore.findProductByPayOrder(
                 HALL_GAMEID, userId, clientId, hallrename.payOrder)
             if product:
                 info.setSubCmd(TodoTaskPayOrder(product))
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
     elif code == 0:
         # 改名成功
         return TodoTaskHelper.sendTodoTask(
             HALL_GAMEID, userId,
             TodoTaskPopTip(hallrename.stringRenameSuccessed))
     else:
         # SDK改名失败
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId,
                                            TodoTaskPopTip(info))
Example #20
0
 def doCheckout(self, gameId, userId, clientId, freeItemId):
     """
     {
         "cmd": "game",
         "params": {
             "action": "free_checkout",
             "userId": 10856,
             "gameId": 9999,
             "freeItemId": 1
         }
     }
     """
     if freeItemId == FREEITEMID_NEWCHECKIN:
         from hall.entity.newcheckin import clientReqCheckin
         clientReqCheckin(userId,clientId,gameId)
         return
     timestamp = pktimestamp.getCurrentTimestamp()
     freeList = hallfree.getFree(gameId, userId, clientId, timestamp)
     free = FreeHelper.getFreeById(freeList, freeItemId)
     if free:
         curState = FreeHelper.getCurStateOfFreeItem(gameId, userId, clientId, free, timestamp)
         if curState:
             todotasks = TodoTaskHelper.makeTodoTasksByFactory(gameId, userId, clientId, curState.todotaskList)
             if todotasks:
                 TodoTaskHelper.sendTodoTask(gameId, userId, todotasks)
Example #21
0
    def doGetTaskReward(self, gameId, userId, taskId):
        '''
        获取活动奖励
        '''
        try:
            timestamp = pktimestamp.getCurrentTimestamp()
            taskModel = neituiguangtask.newUserTaskSystem.loadTaskModel(userId, timestamp)
            task = taskModel.userTaskUnit.findTask(taskId)
            if not task:
                raise TYBizException(-1, '未知的任务:%s' % (taskId))
            expiresTime = self.calcTaskExpires(userId)
            if timestamp >= expiresTime:
                raise TYBizException(-1, '任务已经过期')
            if not userdata.getAttr(userId, 'bindMobile'):
                conf = neituiguang.getConf()
                TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskBindPhone(conf.pleaseBindPhone, ''))
                return
            assetList = neituiguangtask.newUserTaskSystem.getTaskReward(task, timestamp, 'PROMOTE_TASK', taskId)
            router.sendToUser(self.buildTaskInfoResponse(userId), userId)

            rewardStr = TYAssetUtils.buildContentsString(assetList)
            mo = MsgPack()
            mo.setCmd('promote_info')
            mo.setResult('action', 'get_task_reward')
            mo.setResult('code', 0)
            mo.setResult('info', '恭喜您获得了%s' % rewardStr)
            router.sendToUser(mo, userId)
        except TYBizException, e:
            router.sendToUser(self.makeErrorResponse('get_task_reward', e.errorCode, e.message), userId)
Example #22
0
    def _doSit(self, msg, userId, seatId, clientId, checkGameStart=True):

        selectedRoomOptions = msg.getParam("selectedRoomOptions")
        ftId = msg.getParam("ftId")
        if ftlog.is_debug():
            ftlog.debug(self._baseLogStr("<<", userId),
                        "|selectedRoomOptions, ftId, self.cMaxSeatNum:",
                        selectedRoomOptions,
                        ftId,
                        self.cMaxSeatNum,
                        caller=self)

        if selectedRoomOptions:
            self._refreshCustomConf(selectedRoomOptions)
            self.firstPlayerId = userId  # 房主
            self.ftId = ftId  # 6位自建号
            self.createTime = int(time.time())
            ftlog.info(self._baseLogStr("_doSit <<", userId),
                       "|selectedRoomOptions, ftId, self.cMaxSeatNum:",
                       selectedRoomOptions,
                       ftId,
                       self.cMaxSeatNum,
                       caller=self)

        result = super(DiFangCustomTable, self)._doSit(msg, userId, seatId,
                                                       clientId)

        if result["reason"] == TYRoom.ENTER_ROOM_REASON_TABLE_FULL:
            tip = u"您好, 牌桌已满。"
            TodoTaskHelper.sendTodoTask(self.gameId, userId,
                                        TodoTaskShowInfo(tip, True))
            return result

        if result["reason"] != TYRoom.ENTER_ROOM_REASON_OK:
            return result

        # 坐下成功, 人满后检查开桌
        if ftlog.is_debug():
            ftlog.debug(self._baseLogStr(">>", userId),
                        "|self.playersNum, self.cMaxSeatNum:",
                        self.playersNum,
                        self.cMaxSeatNum,
                        caller=self)

        if selectedRoomOptions:
            for _ in range(self.cMaxSeatNum - self.playersNum):
                self.sendRobotNotifyCallUp(None)

        if self.gamePlay.isWaitingState(
        ) and checkGameStart and self.playersNum == self.cMaxSeatNum:
            func = functools.partial(self.gamePlay.doActionCheckStartGame)
            msgPackParams = {"seatId": result["seatId"] - 1}
            self.callLaterFunc(0,
                               func,
                               userId,
                               timer=None,
                               msgPackParams=msgPackParams)  # 需要异步锁桌子

        return result
Example #23
0
 def enterFriendTable(self, userId, gameId, clientId, ftId):
     todotask = TodoTaskEnterGameNew(DIZHU_GAMEID, {
                                                     'type':'game',
                                                     'pluginParams':{
                                                         'gameType':9, 'ftId':ftId, 'action':'enter'
                                                     }
                                     })
     TodoTaskHelper.sendTodoTask(DIZHU_GAMEID, userId, todotask)
Example #24
0
def sendWinBuyTodotask(userId, clientId, bigRoomId):
    from hall.entity import hallpopwnd
    from hall.entity.todotask import TodoTaskHelper
    todotask = hallpopwnd.makeTodoTaskWinBuy(DIZHU_GAMEID, userId, clientId,
                                             bigRoomId)
    if todotask:
        todotask.setParam('delay', 3)
        TodoTaskHelper.sendTodoTask(DIZHU_GAMEID, userId, todotask)
Example #25
0
 def _doItemActionUnsupportedExchange(self, gameId, userId, clientId,
                                      itemId, params):
     todotaskD = self.UNSUPPORTED_TODOTASK_PC if self._isNotPCorMAC(
         clientId) else self.UNSUPPORTED_TODOTASK
     todotaskFac = TodoTaskRegister.decodeFromDict(todotaskD)
     if todotaskFac:
         todotask = todotaskFac.newTodoTask(gameId, userId, clientId)
         TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
Example #26
0
    def on_praise_friend(cls, gameId, uid, clientId, mo):
        code = mo.getResult('code', 0)
        # vip = mo.getResult('vip')
        if code == 0:
            friend_uid = int(mo.getResult('friend_uid'))
            nick_name = mo.getResult('nick_name')
            friend_nick_name = mo.getResult('friend_nick_name')
            my_add_charm = mo.getResult('my_add_charm')
            friend_add_charm = mo.getResult('friend_add_charm')
            my_charm = mo.getResult('my_charm')
            friend_charm = mo.getResult('friend_charm')

            msg1 = '给"' + friend_nick_name + '"点赞获得' + str(my_add_charm) + '个魅力值'
            msg2 = '"' + nick_name + '"给您点赞获得' + str(friend_add_charm) + '个魅力值'
            from poker.entity.biz.message import message
            message.send(gameId, message.MESSAGE_TYPE_SYSTEM, int(uid), msg1)
            message.send(gameId, message.MESSAGE_TYPE_SYSTEM, int(friend_uid), msg2)
            ftlog.debug('on praise friend.... ' + msg1)
            ftlog.debug('on praise friend.... ' + msg2)

            datachangenotify.sendDataChangeNotify(gameId, uid, 'charm')

            from hall.entity.hallranking import rankingSystem, TYRankingInputTypes
            timestamp = pktimestamp.getCurrentTimestamp()
            rankingSystem.setUserByInputType(gameId, TYRankingInputTypes.CHARM,
                                             uid, my_charm, timestamp)
            rankingSystem.setUserByInputType(gameId, TYRankingInputTypes.CHARM,
                                             friend_uid, friend_charm, timestamp)
            # 历史获赞次数
            history_praised_num = gamedata.incrGameAttr(friend_uid, gameId, 'history_praised_num', 1)
            mo.setResult('friend_history_praised_num', history_praised_num)

        if code != 2:
            return

        from hall.entity.todotask import TodoTaskPayOrder, TodoTaskShowInfo
        from hall.entity.todotask import TodoTaskHelper
        from hall.entity import hallvip, hallitem

        user_vip = hallvip.userVipSystem.getUserVip(uid)
        delta_exp = user_vip.deltaExpToNextLevel()

        product, _ = hallstore.findProductByContains(gameId, uid, clientId,
                                                     ['coin'], None,
                                                     hallitem.ASSET_CHIP_KIND_ID,
                                                     delta_exp * 1000)

        pay_order = TodoTaskPayOrder(product)
        if user_vip == 0:
            msg = '点赞次数已达今日上限,开通VIP可提高点赞次数上限获得更多福利哦~'
            btnTxt = '开通VIP'
        else:
            msg = '点赞次数已达今日上限,升级VIP等级可提高点赞次数上限获得更多福利哦~'
            btnTxt = '升级VIP'
        dialog_task = TodoTaskShowInfo(msg, True)
        dialog_task.setSubCmd(pay_order)
        dialog_task.setSubText(btnTxt)
        TodoTaskHelper.sendTodoTask(gameId, uid, [dialog_task])
Example #27
0
 def doAssistanceGet(self, gameId, userId):
     try:
         _consumeCount, finalCount, sendChip = hallvip.userVipSystem.gainAssistance(gameId, userId)
         if sendChip > 0:
             datachangenotify.sendDataChangeNotify(gameId, userId, 'udata')
         todotask = TodoTaskGoldRain(VipHelper.buildGotAssistanceDesc(finalCount, sendChip))
         TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
     except TYAssistanceChipTooMuchException, e:
         ftlog.warn('ERROR, doAssistanceGet', gameId, userId, e.chip, e.upperChipLimit, e.errorCode, e.message)
Example #28
0
    def sendRewards(self, userId, gameId, clientId):
        bSend = True

        for cond in self.conditions:
            if not cond.check(gameId, userId, clientId,
                              pktimestamp.getCurrentTimestamp()):
                bSend = False

        if bSend:
            from hall.entity import hallitem
            userAssets = hallitem.itemSystem.loadUserAssets(userId)
            assetList = userAssets.sendContent(
                gameId, self.items, 1, True, pktimestamp.getCurrentTimestamp(),
                'LOGIN_REWARD', 0)

            if assetList:
                if ftlog.is_debug():
                    ftlog.debug('hall_login_reward.sendReward gameId=', gameId,
                                'userId=', userId, 'rewards=',
                                [(atup[0].kindId, atup[1])
                                 for atup in assetList])
                # 记录登录奖励获取时间
                gamedata.setGameAttr(userId, HALL_GAMEID, 'login_reward',
                                     pktimestamp.getCurrentTimestamp())
                # 通知更新
                changedDataNames = TYAssetUtils.getChangeDataNames(assetList)
                datachangenotify.sendDataChangeNotify(gameId, userId,
                                                      changedDataNames)
                pkmessage.send(gameId, pkmessage.MESSAGE_TYPE_SYSTEM, userId,
                               self.mail)
                from poker.util import strutil
                _, cVer, _ = strutil.parseClientId(clientId)
                if cVer < 3.90:
                    TodoTaskHelper.sendTodoTask(
                        gameId, userId, TodoTaskShowInfo(self.mail, True))
                else:
                    rewardsList = []
                    for assetItemTuple in assetList:
                        '''
                        0 - assetItem
                        1 - count
                        2 - final
                        '''
                        assetItem = assetItemTuple[0]
                        reward = {}
                        reward['name'] = assetItem.displayName
                        reward['pic'] = assetItem.pic
                        reward['count'] = assetItemTuple[1]
                        rewardsList.append(reward)

                    if ftlog.is_debug():
                        ftlog.debug(
                            'hall_login_reward.TodoTaskShowRewards rewardsList: ',
                            rewardsList)

                    TodoTaskHelper.sendTodoTask(
                        gameId, userId, TodoTaskShowRewards(rewardsList))
Example #29
0
 def onUserVipLevelUp(self, event):
     if ftlog.is_debug():
         ftlog.debug('VipHandlerImpl.onUserVipLevelUp userId=', event.userId,
                     'gameId=', event.gameId,
                     'oldLevel=', event.oldVipLevel.level,
                     'newLevel=', event.userVip.vipLevel.level)
     todotask = TodoTaskVipLevelUp(VipHelper.buildVipInfo(event.userVip),
                                   self.buildVipLevelUpDesc(event.userId, event.oldVipLevel, event.userVip))
     TodoTaskHelper.sendTodoTask(event.gameId, event.userId, todotask)
Example #30
0
 def doBuyProduct(self, gameId, userId, prodId):
     try:
         clientId = sessiondata.getClientId(userId)
         orderId = self._makeOrderId(gameId, userId, prodId)
         orderDeliveryResult = hallstore.exchangeProduct(gameId, userId, clientId, orderId, prodId, 1)
         mo = StoreHelper.makeProductDeliveryResponse(userId, orderDeliveryResult)
         router.sendToUser(mo, userId)
     except TYBizException, e:
         TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(e.message))
Example #31
0
    def onRoomCreateCustomTable(self, gameId, msg):
        '''在GR处理自建桌逻辑
        '''
        if ftlog.is_debug():
            ftlog.debug("<< |msg", msg, caller=self)

        userId = msg.getParam("userId")
        selectedRoomOptions = msg.getParam("selectedRoomOptions")
        if not selectedRoomOptions:
            return
        customConfVer = msg.getParam("customConfVer")
        if customConfVer != difangConf.getCustomRoomConf(gameId, 'ver'):
            ftlog.warn("onRoomCreateCustomTable confVer error! |msg:", msg, caller=self)
            return
        gameRoundN = selectedRoomOptions.get("gameRoundN")
        if not gameRoundN:
            return
        roomId = msg.getParam("roomId")
        room = gdata.rooms()[roomId]
        clientId = msg.getParam("clientId")

        needRoomCardN = difangConf.getCustomRoomConf(gameId, 'roomCardNCost').get(str(gameRoundN), -1)
        if needRoomCardN == -1:
            tips = difangConf.getCustomRoomConf(difangConf.GAME_ID, 'err_tips')
            tip = tips[self.CREATE_CUSTOM_TABLE_ERR_NO_NOT_ALLOW]
            TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(tip, True))
            ftlog.warn("onRoomCreateCustomTable get needRoomCardN error! |msg:", msg, caller=self)
            self.sendGameCreateCustomTableRes(0, userId)
            return

        if ftlog.is_debug():
            ftlog.debug("|userId, gameId, customConfVer, gameRoundN, needRoomCardN:",
                        userId, gameId, customConfVer, gameRoundN, needRoomCardN, caller=self)

        if needRoomCardN > 0 and not self.isCardEnough(gameId, userId, needRoomCardN, clientId):
            tips = difangConf.getCustomRoomConf(difangConf.GAME_ID, 'err_tips')
            tip = tips[self.CREATE_CUSTOM_TABLE_ERR_NO_NOT_ENOUGH]
            TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(tip, True))
            self.sendGameCreateCustomTableRes(0, userId)
            return

        tableId = room.getIdleTableId()
        if not tableId:
            ftlog.error("there are no idle tables!", "|userId, roomId:", userId, room.roomId)
            return

        ftId = self.assignFriendTableId(gameId, tableId)

        ftlog.info("onRoomCreateCustomTable |userId, tableId, ftId:", userId, tableId, ftId, caller=self)
        self.sendGameCreateCustomTableRes(ftId, userId)
        gamedata.setGameAttr(userId, gameId, "selectedRoomOptions", json.dumps(selectedRoomOptions))
        gamedata.setGameAttr(userId, gameId, "customConfVer", customConfVer)

        shadowRoomId = tableId / 10000
        room.querySitReq(userId, shadowRoomId, tableId, clientId,
                         extParams={"selectedRoomOptions": selectedRoomOptions, "ftId": ftId})
Example #32
0
    def doGetInviteReward(self, gameId, userId, inviteeId, clientId):
        """
        获取推荐人奖励
        作为上线奖励
        """
        if (not inviteeId) or (inviteeId <= 0):
            TodoTaskHelper.sendTodoTask(gameId, userId,
                                        TodoTaskShowInfo('请输入推荐人ID', True))
            return

        try:
            timestamp = pktimestamp.getCurrentTimestamp()
            status = hall_simple_invite.loadStatus(userId, timestamp)
            inviteeInvitation = status.findInvitee(inviteeId)
            if not inviteeInvitation:
                TodoTaskHelper.sendTodoTask(
                    gameId, userId, TodoTaskShowInfo('没有推荐此人,请重新领取', True))
                return

            if inviteeInvitation.inviterState == Invitation.STATE_REWARDED:
                TodoTaskHelper.sendTodoTask(gameId, userId,
                                            TodoTaskShowInfo('已经领取推荐奖励', True))
                return

            if hall_simple_invite.getGameCount(inviteeId, clientId) == 0:
                TodoTaskHelper.sendTodoTask(gameId, userId,
                                            TodoTaskShowInfo('玩家还未进行游戏', True))
                return

            inviteeInvitation.inviterState = Invitation.STATE_REWARDED
            hall_simple_invite.saveStatus(status)
            ftlog.info('doGetInviteReward userId=', status.userId, 'invitee=',
                       inviteeId)

            conf = hall_simple_invite.getSimpleInviteConf(
                userId, gameId, clientId)
            mo = MsgPack()
            mo.setCmd('invite_info')
            mo.setResult('action', 'get_invite_reward')
            mo.setResult('gameId', gameId)
            count = self.getTotalReward(status)
            if conf.inviteRewardItem:
                mo.setResult('totalReward',
                             count * conf.inviteRewardItem.count)
                self.addUserItemByKindId(userId, gameId, clientId,
                                         conf.inviteRewardItem.assetKindId,
                                         conf.inviteRewardItem.count)

            userInfo = {}
            userInfo['userId'] = inviteeId
            userInfo['rewardState'] = inviteeInvitation.inviterState
            mo.setResult('updateInfo', userInfo)
            router.sendToUser(mo, userId)
        except TYBizException, e:
            TodoTaskHelper.sendTodoTask(gameId, userId,
                                        TodoTaskShowInfo(e.message, True))
Example #33
0
    def onCmdQuickStart1(cls, msg, userId, gameId, roomId, tableId, playMode,
                         clientId):
        '''
        拦截父类处理的选择房间逻辑,先于父类处理,若选择成功,则不进行父类的选择房间处理逻辑,否则正常走父类的处理逻辑
        '''

        if not pokerconf.isOpenMoreTable(clientId):
            ok, loc = cls.checkUserLoc(userId, gameId, roomId, tableId,
                                       clientId)
            if not ok:
                # 弹框
                tipsPlaying = dizhuconf.getPublicConf('tips.playing',
                                                      '您正在其它房间对局,是否回去?')
                showInfo = TodoTaskShowInfo(tipsPlaying)
                showInfo.setSubCmd(
                    TodoTaskQuickStart(loc[0], loc[1], loc[2], loc[3]))
                TodoTaskHelper.sendTodoTask(gameId, userId, showInfo)
                ftlog.debug('DizhuQuickStartV4_0.onCmdQuickStart Fail userId=',
                            userId, 'roomId=', roomId, 'tableId=', tableId,
                            'clientId=', clientId, 'loc=', loc)
                return
            if loc:
                tableId = loc[2]

        _, version, _ = strutil.parseClientId(clientId)
        ftlog.debug("DizhuQuickStartV4_0.onCmdQuickStart: clientId=", clientId,
                    "userId=", userId, "roomId=", roomId,
                    "tableId=", tableId, "version=", version, "type:",
                    type(version), "playMode=", playMode)

        # 地主会优先去匹配比赛的房间,客户端是3.76及更高版本才支持
        if (playMode == None or playMode == "match" or playMode
                == "straightMatch") and roomId == 0 and gameId == 6 and (
                    version >= 3.76 or
                    (version >= 3.73
                     and not (clientId in _DIZHU_QMATCH_V3_73_IGNORE))):
            chose_roomid, ok = cls._chooseDizhuMatchRoom(
                userId, gameId, playMode)
            ftlog.debug(
                "DizhuQuickStartV4_0._chooseDizhuMatchRoom:chosen|room_id=",
                chose_roomid, "userId=", userId, "ok=", ok)
            if ok:
                bigroomid = gdata.getBigRoomId(chose_roomid)
                ftlog.debug(
                    "DizhuQuickStartV4_0._chooseDizhuMatchRoom: userId=",
                    userId, "roomId=", chose_roomid)
                cls.notifyQuickGotoDizhuMatch(gameId, userId, bigroomid)
                return

        if playMode == "match":
            playMode = dizhuconf.PLAYMODE_123

        super(DizhuQuickStartV4_0,
              cls).onCmdQuickStart(msg, userId, gameId, roomId, tableId,
                                   playMode, clientId)
        return
Example #34
0
 def on_ready_invite_friend(cls, gameId, uid, clientId, mo):
     from hall.entity.todotask import TodoTaskHelper
     code = mo.getResult('code', 0)
     if code != 1:
         return
     from hall.entity.todotask import TodoTaskBindPhoneFriend
     info_ = '请绑定手机,成为正式账号即可与朋友一起玩!'
     task = TodoTaskBindPhoneFriend(info_, 0)
     task.setSubText('绑定手机')
     TodoTaskHelper.sendTodoTask(gameId, uid, [task])
Example #35
0
 def doGameGetMemberReward(self, userId, gameId, clientId):
     userAssets = hallitem.itemSystem.loadUserAssets(userId)
     userBag = userAssets.getUserBag()
     memberCardItem = userBag.getItemByKindId(hallitem.ITEM_MEMBER_NEW_KIND_ID)
     timestamp = pktimestamp.getCurrentTimestamp()
     if memberCardItem and memberCardItem.canCheckin(timestamp):
         checkinAction = memberCardItem.itemKind.findActionByName('checkin')
         checkinAction.doAction(gameId, userAssets, memberCardItem, timestamp, {})
         datachangenotify.sendDataChangeNotify(gameId, userId, 'free')
         TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskGoldRain('恭喜您领取了今天的会员福利'))
Example #36
0
 def on_ready_invite_friend(cls, gameId, uid, clientId, mo):
     from hall.entity.todotask import TodoTaskHelper
     code = mo.getResult('code', 0)
     if code != 1:
         return
     from hall.entity.todotask import TodoTaskBindPhoneFriend
     info_ = '请绑定手机,成为正式账号即可与朋友一起玩!'
     task = TodoTaskBindPhoneFriend(info_, 0)
     task.setSubText('绑定手机')
     TodoTaskHelper.sendTodoTask(gameId, uid, [task])
Example #37
0
 def throwEmoji(self, userId, seatId, toSeatId, emojiId, count=1):
     seatFrom = self.checkSeatAndPlayer(seatId, userId)
     seatTo = self.checkSeat(toSeatId)
     try:
         self._throwEmoji(seatFrom, seatTo, emojiId, count)
     except ChipNotEnoughException:
         TodoTaskHelper.sendTodoTask(self.table.gameId, userId,
                                     TodoTaskPopTip('背包剩余金币不足无法使用互动表情'))
     except TYBizException, e:
         self.proto.sendSmilesResError(userId, e.message)
Example #38
0
def notifyUserGameWillShutDown(userId, clientId, isNeedPopShutDownGameWnd):
    #过期不弹窗
    nowStamp = int(time.time())
    if nowStamp >= 1524326400:
        return
    if not isNeedPopShutDownGameWnd:
        return
    from hall.entity.todotask import TodoTaskHelper
    from hall.entity.todotask import TodoTaskShowInfo
    TodoTaskHelper.sendTodoTask(9999, userId, TodoTaskShowInfo('因运营需要,4月19日起暂停发财扑克(含天地麻将)等功能模块,恢复时间请关注官网,感谢理解!', True))
Example #39
0
def doUserStandUp(userId, roomId, tableId, clientId, reason):
    _, clientVer, _ = strutil.parseClientId(clientId)
    ftlog.debug('table_remote.doUserStandUp userId=', userId, 'roomId=',
                roomId, 'tableId=', tableId, 'clientId=', clientId, 'reason=',
                reason, 'clientVer=', clientVer)
    if reason not in (TableStandUpEvent.REASON_GAME_OVER, ):
        return 0

    chipCount = userchip.getChip(userId)
    roomConf = gdata.getRoomConfigure(roomId) or {'minCoin': 0, 'maxCoin': -1}
    if chipCount < roomConf['minCoin']:
        reason = TableStandUpEvent.REASON_CHIP_NOT_ENOUGHT
        if clientVer >= 3.77:  # 新版救济金弹气泡支持
            processLoseOutRoomV3_77(DIZHU_GAMEID,
                                    userId,
                                    clientId,
                                    roomId,
                                    showMemberTry=False)
        elif clientVer >= 3.7:
            hallpopwnd.processLoseOutRoomV3_7(DIZHU_GAMEID,
                                              userId,
                                              clientId,
                                              roomId,
                                              showMemberTry=False)
        elif clientVer == 3.502:
            processLoseOutRoom(DIZHU_GAMEID, userId, clientId, roomId)
        elif clientVer >= 3.0:
            timestamp = pktimestamp.getCurrentTimestamp()
            benefitsSend, userBenefits = hallbenefits.benefitsSystem.sendBenefits(
                DIZHU_GAMEID, userId, timestamp)
            ftlog.debug('benefitsSend, userBenefits =', benefitsSend,
                        userBenefits)
            zhuanyun = hallpopwnd.makeTodoTaskZhuanyun(DIZHU_GAMEID, userId,
                                                       clientId, benefitsSend,
                                                       userBenefits, roomId)
            if zhuanyun:
                TodoTaskHelper.sendTodoTask(DIZHU_GAMEID, userId, zhuanyun)
            else:
                ttask = TodoTaskHelper.makeBenefitsTodoTask(
                    DIZHU_GAMEID, userId, clientId, benefitsSend, userBenefits)
                if ttask:
                    TodoTaskHelper.sendTodoTask(DIZHU_GAMEID, userId, ttask)
            datachangenotify.sendDataChangeNotify(DIZHU_GAMEID, userId, 'chip')
        else:
            benefitsSend, userBenefits = hallbenefits.benefitsSystem.sendBenefits(
                DIZHU_GAMEID, userId, pktimestamp.getCurrentTimestamp())
            ftlog.debug('benefitsSend, userBenefits =', benefitsSend,
                        userBenefits)
    elif (roomConf['maxCoin'] != -1 and chipCount > roomConf['maxCoin']):
        pass
        # reason = TableStandUpEvent.REASON_CHIP_TOO_MUCH
        # from dizhu.gametable.quick_start import DizhuQuickStartV4_0
        # DizhuQuickStartV4_0._sendTodoTaskJumpHighRoom(userId, roomConf['playMode'], clientId)
    return 1
Example #40
0
 def _doChangeNameCheck(self, userId, clientId):
     canRename, desc = hallrename.checkRename(HALL_GAMEID, userId)
     if canRename:
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskRename(desc))
     else:
         info = TodoTaskShowInfo(desc, True)
         if hallrename.payOrder:
             product, _ = hallstore.findProductByPayOrder(HALL_GAMEID, userId, clientId, hallrename.payOrder)
             if product:
                 info.setSubCmd(TodoTaskPayOrder(product))
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
Example #41
0
 def _doChangeNameCheck(self, userId, clientId):
     canRename, desc = hallrename.checkRename(HALL_GAMEID, userId)
     if canRename:
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskRename(desc))
     else:
         info = TodoTaskShowInfo(desc, True)
         if hallrename.payOrder:
             product, _ = hallstore.findProductByPayOrder(HALL_GAMEID, userId, clientId, hallrename.payOrder)
             if product:
                 info.setSubCmd(TodoTaskPayOrder(product))
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, info)
Example #42
0
 def sendTodoTaskResponse(self, userId, gameId, clientId, isdayfirst):
     '''
     发送当前用户的TODOtask列表消息
     '''
     ftlog.debug('UtilHelper.sendTodoTaskResponse userId=', userId,
                 'gameId=', gameId,
                 'clientId=', clientId,
                 'isdayfirst=', isdayfirst)
     todotasks = TYGame(gameId).getTodoTasksAfterLogin(userId, gameId, clientId, isdayfirst)
     if todotasks:
         TodoTaskHelper.sendTodoTask(gameId, userId, todotasks)
Example #43
0
 def sendTodoTaskResponse(self, userId, gameId, clientId, isdayfirst):
     '''
     发送当前用户的TODOtask列表消息
     '''
     ftlog.debug('UtilHelper.sendTodoTaskResponse userId=', userId,
                 'gameId=', gameId, 'clientId=', clientId, 'isdayfirst=',
                 isdayfirst)
     todotasks = TYGame(gameId).getTodoTasksAfterLogin(
         userId, gameId, clientId, isdayfirst)
     if todotasks:
         TodoTaskHelper.sendTodoTask(gameId, userId, todotasks)
Example #44
0
 def onUserVipLevelUp(self, event):
     if ftlog.is_debug():
         ftlog.debug('VipHandlerImpl.onUserVipLevelUp userId=',
                     event.userId, 'gameId=', event.gameId, 'oldLevel=',
                     event.oldVipLevel.level, 'newLevel=',
                     event.userVip.vipLevel.level)
     todotask = TodoTaskVipLevelUp(
         VipHelper.buildVipInfo(event.userVip),
         self.buildVipLevelUpDesc(event.userId, event.oldVipLevel,
                                  event.userVip))
     TodoTaskHelper.sendTodoTask(event.gameId, event.userId, todotask)
Example #45
0
 def handleException(self, itemId, gameId, userId, clientId, e):
     if ftlog.is_debug():
         ftlog.debug('ItemTcpHandler.handleException itemId=', itemId,
                     'gameId=', gameId,
                     'userId=', userId,
                     'clientId=', clientId,
                     'e=', e)
     if isinstance(e, TYItemActionConditionNotEnoughException):
         self.handleItemActionConditionException(itemId, gameId, userId, clientId, e)
     elif isinstance(e, TYItemBindingsException):
         self.handleItemBindingsException(itemId, gameId, userId, clientId, e)
     else:
         TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(e.message))
Example #46
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)
Example #47
0
 def handleItemBindingsException(self, itemId, gameId, userId, clientId, e):
     showInfo = TodoTaskShowInfo(e.message)
     payOrder = e.itemBindings.getParam('payOrder')
     if payOrder:
         product, shelves = hallstore.findProductByPayOrder(gameId, userId, clientId, payOrder)
         if product:
             showInfo.setSubCmd(TodoTaskGotoShop(shelves.name))
     else:
         todotask = e.itemBindings.getParam('todotask')
         if todotask:
             todotask = TodoTaskRegister.decodeFromDict(todotask).newTodoTask(gameId, userId, clientId)
             TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
             return
     TodoTaskHelper.sendTodoTask(gameId, userId, showInfo)
Example #48
0
    def processInviteAnswser(self, inviter, answer, userId, gameId):
        '''
        对邀请游戏的应答
        userId - 当前用户
        inviter - 邀请者
        向邀请者发送回应
        '''
        uds = userdata.getAttrs(userId, ['name'])
        response = ''
        if answer:
            response = '您的好友 ' + uds[0] + ' 同意了您的游戏邀请'
        else:
            response = '您的好友 ' + uds[0] + ' 拒绝了您的游戏邀请'

        TodoTaskHelper.sendTodoTask(gameId, inviter, TodoTaskPopTip(response))
Example #49
0
def makeTodoTaskZhuanyun_(gameId, userId, clientId, benefitsSend, userBenefits, roomId):
    from hall.entity import hallproductselector
    if ftlog.is_debug():
        ftlog.debug('hallpopwnd.makeTodoTaskZhuanyun gameId=', gameId,
                    'userId=', userId,
                    'clientId=', clientId,
                    'benefitsSend=', benefitsSend,
                    'userBenefits=', userBenefits.__dict__,
                    'roomId=', roomId)
    clientOs, _clientVer, _ = strutil.parseClientId(clientId)
    clientOs = clientOs.lower()

    if clientOs != 'winpc':
        return TodoTaskHelper.makeZhuanyunTodoTaskNew(gameId, userId, clientId,
                                                      benefitsSend, userBenefits, roomId)

    product, _ = hallproductselector.selectLessbuyProduct(gameId, userId, clientId, roomId)
    if not product:
        return None

    user_diamond = pkuserdata.getAttr(userId, 'diamond')
    if user_diamond >= int(product.priceDiamond):
        chip = product.getMinFixedAssetCount(hallitem.ASSET_CHIP_KIND_ID)
        show_str = u'运气不好,来个转运礼包!%s元得%s万金币。' % (product.price, chip)
        buy_type = 'consume'
        btn_txt = u'兑换'
    else:
        show_str = u'运气不好~,买点金币战个痛快吧!'
        buy_type = 'charge'
        btn_txt = u'去充值'
    orderShow = TodoTaskOrderShow.makeByProduct(show_str, '', product, buy_type)
    orderShow.setParam('sub_action_btn_text', btn_txt)
    return orderShow
Example #50
0
def queryFangKaBuyInfo(gameId, userId, clientId):
    templateName = hallconf.getFangKaBuyInfoCliengConf(clientId)
    if templateName:
        ret = _fbTemplateMap.get(templateName, None)
        if not ret:
            return

        # 执行todotask
        ftlog.debug('hall_fangka_buy_info.queryFangKaBuyInfo gameId=', gameId,
                    'userId=', userId,
                    'clientId=', clientId,
                    'templateName=', templateName,
                    'tasks=', ret.todotasks)
        todotasks = TodoTaskRegister.decodeList(ret.todotasks)
        tasks = TodoTaskHelper.makeTodoTasksByFactory(gameId, userId, clientId, todotasks)
        TodoTaskHelper.sendTodoTask(gameId, userId, tasks)
Example #51
0
 def handleItemActionConditionException(self, itemId, gameId, userId, clientId, e):
     showInfo = TodoTaskShowInfo(e.message)
     payOrder = e.condition.getParam('payOrder')
     if payOrder:
         product, shelves = hallstore.findProductByPayOrder(gameId, userId, clientId, payOrder)
         if product:
             showInfo.setSubCmd(TodoTaskGotoShop(shelves.name))
     else:
         todotask = e.condition.getParam('todotask')
         if todotask:
             factory = hallpopwnd.decodeTodotaskFactoryByDict(todotask)
             if factory:
                 todotask = factory.newTodoTask(gameId, userId, clientId)
                 TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
                 return
     TodoTaskHelper.sendTodoTask(gameId, userId, showInfo)
Example #52
0
def sendFriendInviteTodotask(userId, invite_uid, gameId, play_mode, roomId, tableId, info_str, purl):
    """ 推送牌桌好友邀请的todotask
    * 版本 3.732 之后,改为麻将自己的todotask
    """
    todotask = TodoTaskQuickStart(gameId, roomId, tableId)
    todotask.setParam('play_mode', play_mode)
    client_ver = sessiondata.getClientIdVer(userId)

    if client_ver < 3.732:
        show_info_ = TodoTaskShowInfo(info_str, True)
        show_info_.setSubCmd(todotask)
        msg = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, show_info_)
        router.sendToUser(msg, userId)
    else:
        task = {
                'action':       'pop_wnd_invite',
                'params':       {
                                 'tasks':       [todotask.toDict()],
                                 'invite_uid':   invite_uid,
                                 'purl':         purl,
                                 'info_str':     info_str
                                 }
                }
        mo = MsgPack()
        mo.setCmd('majiang_todotasks')
        mo.setResult('gameId', gameId)
        mo.setResult('userId', userId)
        mo.setResult('tasks', [task])
        router.sendToUser(mo, userId)
Example #53
0
    def _doNewVipGift(cls, gameId, userId, level):
        try:
            userVip, _giftStates, gotVipGiftResult = hallvip.userVipSystem.gainUserVipGift(gameId, userId, level)
            ftlog.debug('VipTcpHandler._doNewVipGift userId=', userId,
                        'gameId=', gameId,
                        'giftVipLevel=', gotVipGiftResult.vipGiftState.vipLevel.level)
            giftInfo = VipHelper.buildGiftInfo(userVip, gotVipGiftResult.vipGiftState)
            getGiftTodoTask = TodoTaskVipGotGift(gotVipGiftResult.vipGiftState.vipLevel.level,
                                                 gotVipGiftResult.vipGiftState.vipLevel.vipExp,
                                                 gotVipGiftResult.vipGiftState.vipLevel.name,
                                                 gotVipGiftResult.vipGiftState.vipLevel.desc,
                                                 giftInfo)

            todotasks = [getGiftTodoTask]
            needGoldRain = TYAssetUtils.getAssetCount(gotVipGiftResult.giftItemList, hallitem.ASSET_CHIP_KIND_ID) > 0
            if needGoldRain:
                todotasks.append(TodoTaskGoldRain(VipHelper.buildGotGiftDesc(gotVipGiftResult)))
            else:
                todotasks.append(TodoTaskPopTip(VipHelper.buildGotGiftDesc(gotVipGiftResult)))

            mo = TodoTaskHelper.sendTodoTask(gameId, userId, todotasks)
            # 通知客户端变化
            if gotVipGiftResult.giftItemList:
                datachangenotify.sendDataChangeNotify(gameId, userId,
                                                      TYAssetUtils.getChangeDataNames(gotVipGiftResult.giftItemList))
            return mo
        except TYBizException, e:
            return cls.sendErrorResponse(userId, 'newvip', e.errorCode, e.message)
Example #54
0
    def enterFriendTable(self, userId, gameId, clientId, ftId):
        """进入自建桌,插件实现具体功能"""
        if ftlog.is_debug():
            ftlog.debug('MAJIANG enterFriendTable userId:', userId
                        , ' gameId:', gameId
                        , ' clientId:', clientId
                        , ' ftId:', ftId)

        tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(ftId)
        if ftlog.is_debug():
            ftlog.debug('MAJIANG enterFriendTable ftId:', ftId
                        , ' roomId:', roomId0
                        , ' tableId:', tableId0)

        if not tableId0 or not roomId0:
            from difang.majiang2.entity.util import sendPopTipMsg
            sendPopTipMsg(userId, '您要进入的朋友场房间不存在,请核对房间号')
            return

        config = {
            "type": "game",
            "pluginParams": {
                "gameType": 11,
                "ftId": ftId
            }
        }

        todotask = TodoTaskEnterGameNew(GAMEID, config)
        mo = MsgPack()
        mo.setCmd('todo_tasks')
        mo.setResult('gameId', gameId)
        mo.setResult('pluginId', GAMEID)
        mo.setResult('userId', userId)
        mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
        router.sendToUser(mo, userId)
Example #55
0
    def doGetInviteReward(self, gameId, userId, inviteeId, clientId):
        """
        获取推荐人奖励
        作为上线奖励
        """
        if (not inviteeId) or (inviteeId <= 0):
            TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo('请输入推荐人ID', True))
            return

        try:
            timestamp = pktimestamp.getCurrentTimestamp()
            status = hall_simple_invite.loadStatus(userId, timestamp)
            inviteeInvitation = status.findInvitee(inviteeId)
            if not inviteeInvitation:
                TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo('没有推荐此人,请重新领取', True))
                return

            if inviteeInvitation.inviterState == Invitation.STATE_REWARDED:
                TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo('已经领取推荐奖励', True))
                return

            if hall_simple_invite.getGameCount(inviteeId, clientId) == 0:
                TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo('玩家还未进行游戏', True))
                return

            inviteeInvitation.inviterState = Invitation.STATE_REWARDED
            hall_simple_invite.saveStatus(status)
            ftlog.info('doGetInviteReward userId=', status.userId, 'invitee=', inviteeId)

            conf = hall_simple_invite.getSimpleInviteConf(userId, gameId, clientId)
            mo = MsgPack()
            mo.setCmd('invite_info')
            mo.setResult('action', 'get_invite_reward')
            mo.setResult('gameId', gameId)
            count = self.getTotalReward(status)
            if conf.inviteRewardItem:
                mo.setResult('totalReward', count * conf.inviteRewardItem.count)
                self.addUserItemByKindId(userId, gameId, clientId, conf.inviteRewardItem.assetKindId,
                                         conf.inviteRewardItem.count)

            userInfo = {}
            userInfo['userId'] = inviteeId
            userInfo['rewardState'] = inviteeInvitation.inviterState
            mo.setResult('updateInfo', userInfo)
            router.sendToUser(mo, userId)
        except TYBizException, e:
            TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskShowInfo(e.message, True))
Example #56
0
    def doPutMessage(self, gameId, fromUid, toUid, mtype, msg, ismgr, scope, clientIds):
        button = runhttp.getParamStr('button', None)
        button = strutil.loads(button, ignoreException=True)
        data = None
        mo = MsgPack()

        if mtype == 0 and len(msg) > 0 and toUid > 0 and gameId >= 0:
            # 发送私人消息
            # 必须参数 
            # 1)msg - 消息
            # 2)toUid - 接收消息的userId
            # 3)gameId
            data = pkmessage.sendPrivate(gameId, toUid, fromUid, msg, button)
        elif mtype == 1 and len(msg) > 0 and gameId >= 0:
            # 发送站内消息到全体用户
            # 必选参数
            # msg - 消息
            # gameId
            data = pkmessage.sendGlobal(gameId, msg, button)
        elif mtype == 2 and gameId > 0 and len(msg) > 0:
            # 发送LED
            # TODO 当前Game服务为4,5,6号 , 每个服务都发送
            mo.setCmd('send_led')
            mo.setParam('msg', msg)
            mo.setParam('gameId', gameId)
            mo.setParam('ismgr', 1)
            router.sendToAll(mo, gdata.SRV_TYPE_UTIL)
            data = True
        elif mtype == 3 and gameId > 0 and toUid > 0 and len(msg) > 0:
            # 封装popwnd
            # 必选参数
            # gameId
            # toUid 接收弹窗的userId
            # msg 弹窗消息内容
            task = TodoTaskShowInfo(msg, True)
            mo = TodoTaskHelper.makeTodoTaskMsg(gameId, toUid, task)
            # 将消息发送给此人
            router.sendToUser(mo, toUid)
            data = True
        elif mtype == 4 and gameId > 0 and len(msg) > 0 and len(scope) > 0:
            mo.setCmd('send_led')
            mo.setParam('msg', msg)
            ftlog.info('send_led new msg=', msg)
            mo.setParam('gameId', gameId)
            ftlog.info('send_led new gameId=', gameId)
            mo.setParam('ismgr', ismgr)
            ftlog.info('send_led new ismgr=', ismgr)
            mo.setParam('scope', scope)
            ftlog.info('send_led new scope=', scope)
            mo.setParam('clientIds', clientIds)
            ftlog.info('send_led new clientIds=', clientIds)
            router.sendToAll(mo, gdata.SRV_TYPE_UTIL)
            data = True

        if data == None:
            mo.setError(1, 'params error')
        else:
            mo.setResult('ok', 'true')
        return mo
Example #57
0
 def buildUpLevelTodoTasks(cls, gameId, userVip, clientId):
     deltaExp = userVip.deltaExpToNextLevel()
     if deltaExp > 0:
         payOrder = strutil.cloneData(hallvip.vipSystem.getLevelUpPayOrder())
         payOrder['priceDiamond'] = {'count': deltaExp, 'minCount': 0, 'maxCount': -1}
         product, _ = hallstore.findProductByPayOrder(gameId, userVip.userId, clientId, payOrder)
         if product:
             return TodoTaskHelper.encodeTodoTasks(TodoTaskPayOrder(product))
     return []
Example #58
0
    def _doSit(self, msg, userId, seatId, clientId, checkGameStart=True):

        selectedRoomOptions = msg.getParam("selectedRoomOptions")
        ftId = msg.getParam("ftId")
        if ftlog.is_debug():
            ftlog.debug(self._baseLogStr("<<", userId),
                        "|selectedRoomOptions, ftId, self.cMaxSeatNum:",
                        selectedRoomOptions, ftId, self.cMaxSeatNum, caller=self)

        if selectedRoomOptions:
            self._refreshCustomConf(selectedRoomOptions)
            self.firstPlayerId = userId  # 房主
            self.ftId = ftId  # 6位自建号
            self.createTime = int(time.time())
            ftlog.info(self._baseLogStr("_doSit <<", userId),
                       "|selectedRoomOptions, ftId, self.cMaxSeatNum:",
                       selectedRoomOptions, ftId, self.cMaxSeatNum, caller=self)

        result = super(DiFangCustomTable, self)._doSit(msg, userId, seatId, clientId)

        if result["reason"] == TYRoom.ENTER_ROOM_REASON_TABLE_FULL:
            tip = u"您好, 牌桌已满。"
            TodoTaskHelper.sendTodoTask(self.gameId, userId, TodoTaskShowInfo(tip, True))
            return result

        if result["reason"] != TYRoom.ENTER_ROOM_REASON_OK:
            return result

        # 坐下成功, 人满后检查开桌
        if ftlog.is_debug():
            ftlog.debug(self._baseLogStr(">>", userId),
                        "|self.playersNum, self.cMaxSeatNum:",
                        self.playersNum, self.cMaxSeatNum, caller=self)

        if selectedRoomOptions:
            for _ in range(self.cMaxSeatNum - self.playersNum):
                self.sendRobotNotifyCallUp(None)

        if self.gamePlay.isWaitingState() and checkGameStart and self.playersNum == self.cMaxSeatNum:
            func = functools.partial(self.gamePlay.doActionCheckStartGame)
            msgPackParams = {"seatId": result["seatId"] - 1}
            self.callLaterFunc(0, func, userId, timer=None, msgPackParams=msgPackParams)  # 需要异步锁桌子

        return result