示例#1
0
def updateTreasureBoxStart(gameId, userId, bigRoomId):
    tbconfigers = getTreasureBoxConf(gameId, bigRoomId)
    tbcontinuesecodes = -1
    tbplaycount = 1
    if tbconfigers:
        tbplaycount = tbconfigers['playCount']
        tbcontinuesecodes = tbconfigers['continueSeconds']
    tbplaytimes, tblasttime, data = getUserTbInfo(gameId, userId, bigRoomId)
    ctime = int(time.time())
    if abs(ctime - tblasttime) > tbcontinuesecodes:
        tbplaytimes = 0

    dizhuver = SessionDizhuVersion.getVersionNumber(userId)
    if dizhuver >= 5.10 and tbplaytimes >= tbplaycount:
        tbplaytimes = 0

    tbroomid = bigRoomId
    tblasttime = ctime
    tbplaytimes += 1
    data['tbroomid'] = tbroomid
    data['tbplaytimes'] = min(tbplaytimes, tbplaycount)
    data['tblasttime'] = tblasttime
    _setTbData(gameId, userId, data)
    data['tbplaycount'] = tbplaycount
    if ftlog.is_debug():
        ftlog.debug('treasurebox.updateTreasureBoxStart', 'gameId=', gameId,
                    'userId=', userId, 'bigRoomId=', bigRoomId, 'data=', data)
    return data
示例#2
0
    def _handleEnterRoomException(cls, e, userId, gameId, roomId, mixId=None):
        ''' 进入房间失败处理函数 '''
        if isinstance(e, (EnterRoomLessMinKickOutCoinException, EnterRoomLessMinCoinException, EnterRoomLessMinQuickStartCoinException)):
            #@TODO 要删掉
            dizhuVersion = SessionDizhuVersion.getVersionNumber(userId)
            if not dizhuVersion or dizhuVersion < 5.08:
                desc = '金币不足'
                note = '金币不足'
                todotask = TodoTaskLessBuyOrder(desc, None, note, None)
                TodoTaskHelper.sendTodoTask(gameId, userId, todotask)

            bigRoomId = gdata.getBigRoomId(roomId)
            clientId = sessiondata.getClientId(userId)
            if roomId != bigRoomId:  # 点继续
                ctrlRoomId = gdata.roomIdDefineMap()[roomId].parentId or roomId
                queryRoomId = ctrlRoomId
            else:
                queryRoomId = cls._getQueryRoomId(userId, bigRoomId)
            roomConfig = cls._getRoomConfigure(queryRoomId, mixId)
            if roomConfig.get('kickOutBurialId'):
                shareLeftCount = getShareLeftCountByBurialId(gameId, userId, clientId, roomConfig.get('kickOutBurialId'))
                sharePoint = getSharePointByBurialId(gameId, userId, clientId, roomConfig.get('kickOutBurialId'))
                if shareLeftCount:
                    items = sharePoint.reward.content.getItems() if sharePoint.reward else []
                    cls._sendToUserQuickStartRes(userId, gameId, roomId, e.errorCode, e.message,
                                                 burialId=roomConfig.get('kickOutBurialId'), reward=hallitem.buildItemInfoList(items))
                    return
            if isinstance(e, EnterRoomLessMinKickOutCoinException):
                todoTask = makeTodoTaskluckBuyOrLessBuyChip(gameId, userId, clientId, roomConfig.get('roomId') or bigRoomId, minCoin=roomConfig.get('minCoin'))
            else:
                todoTask = makeTodoTaskluckBuyOrLessBuyChip(gameId, userId, clientId, roomConfig.get('roomId') or bigRoomId, minCoin=roomConfig.get('minCoin'), priority='lessbuychip')
            if todoTask:
                cls._sendToUserQuickStartRes(userId, gameId, roomId, e.errorCode, e.message, todoTask=todoTask.toDict())
                return

        # @TODO 要删掉
        dizhuVersion = SessionDizhuVersion.getVersionNumber(userId)
        if not dizhuVersion or dizhuVersion < 5.08:
            todotask = TodoTaskShowInfo(e.message)
            TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
        cls._sendToUserQuickStartRes(userId, gameId, roomId, e.errorCode, e.message)
示例#3
0
def oldUserSetSkin(event):
    global _setUserSkin
    if _setUserSkin:
        return
    conf = configure.getGameJson(6, 'table.skin', {},
                                 configure.DEFAULT_CLIENT_ID)
    if conf:
        olderConf = conf.get('changeOldUserSkin', {})
        olderSwitch = olderConf.get('switch', 0)
        changeUserSkinMinVer = olderConf.get('changeUserSkinMinVer', 0)
        if olderConf and olderSwitch:
            _setUserSkin = True
            skin3d = olderConf.get('skin3d', {})
            if skin3d:
                skinId = skin3d.get('skinId')
                userIdList = skin3d.get('userIdList', [])
                for userId in userIdList:
                    model = loadMySkin(userId)
                    userDizhuClientVer = SessionDizhuVersion.getVersionNumber(
                        userId)
                    if userDizhuClientVer >= changeUserSkinMinVer:
                        model.curSkin = skinId
                        saveMySkin(model)
                ftlog.info('oldUserSetSkin userIdList=', userIdList, 'skinId=',
                           skinId)

            skin2d = olderConf.get('skin2d', {})
            if skin2d:
                skinId = skin2d.get('skinId')
                userIdList = skin2d.get('userIdList', [])
                for userId in userIdList:
                    model = loadMySkin(userId)
                    userDizhuClientVer = SessionDizhuVersion.getVersionNumber(
                        userId)
                    if userDizhuClientVer >= changeUserSkinMinVer:
                        model.curSkin = skinId
                        saveMySkin(model)

                ftlog.info('oldUserSetSkin userIdList=', userIdList, 'skinId=',
                           skinId)
示例#4
0
 def _queryMatchSignin(cls, userId, bigRoomId, mixId, clientId):
     ''' 报名比赛 '''
     mo = MsgPack()
     mo.setCmd('m_signin')
     mo.setParam('gameId', DIZHU_GAMEID)
     mo.setParam('roomId', bigRoomId)
     mo.setParam('userId', userId)
     mo.setParam('clientId', clientId)
     dizhuVersion = SessionDizhuVersion.getVersionNumber(userId)
     mo.setParam('version', dizhuVersion)
     mo.setParam('feeIndex', 0)
     if mixId:
         mo.setParam('signinParams', {'mixId': mixId})
     router.queryRoomServer(mo, bigRoomId)  # ut向gr,相当于用户点报名传给gr
def sendSmilesResOk(self, fromseat, member, toseat, price, smilie, self_charm, other_charm, tip, rcount=1):
    mo = self.createMsgPackRes('table_call', 'smilies')
    mo.setResult('fromseat', fromseat)
    mo.setResult('member', member)
    mo.setResult('toseat', toseat)
    mo.setResult('price', price)
    mo.setResult('smilies', smilie)
    mo.setResult('from_charm', self_charm)
    mo.setResult('to_charm', other_charm)
    mo.setResult('tip', tip)
    mo.setResult('count', rcount) # 新版本客户端才支持发送次数
    
    allplayers = []
    allplayers.extend(self.table.players)
    allplayers.extend(self.table.observers)
    oldclient_uids = [] # 使用老版本的uid
    newclient_uids = [] # 使用新版本的uid
    
    for p in allplayers :
        if p.userId <= 0 :
            continue
        dizhuver = SessionDizhuVersion.getVersionNumber(p.userId)
        if dizhuver >= 3.775:
            newclient_uids.append(int(p.userId))
        else:
            oldclient_uids.append(int(p.userId))
            
    ftlog.debug('sendSmilesResOk',
                'smilie=', smilie,
                'rcount=', rcount,
                'oldclient_uids=', oldclient_uids,
                'newclient_uids=', newclient_uids)

    # 新版本只发送一次协议
    for uid in newclient_uids:
        if uid <= 0:
            continue
        router.sendToUser(mo.pack(), uid)
    
    # 老版本发送多次协议,且将砖头转换为鸡蛋
    # 小游戏不存在兼容的问题
    for uid in oldclient_uids:
        if uid <= 0:
            continue
        for _ in xrange(rcount):
#                 if smilie == 'brick':
#                     mo.setResult('smilies', 'egg')
            router.sendToUser(mo.pack(), uid)
            TimingMessageSender.pushMessagePack(uid, mo.pack())
示例#6
0
def _fillUpdateUserScore(event):
    from poker.entity.dao import gamedata
    winStreak = gamedata.getGameAttrInt(event.userId, DIZHU_GAMEID,
                                        'winstreak')
    bigRoomId = gdata.getBigRoomId(event.roomId)

    if not _scoreRankConf:
        return False

    if ftlog.is_debug():
        ftlog.debug('_fillUpdateUserScore userId=', event.userId, 'bigRoomId=',
                    bigRoomId, '_scoreRankConf=', _scoreRankConf, 'closed=',
                    _scoreRankConf.closed)

    if _scoreRankConf.closed:
        return False

    clientVer = SessionDizhuVersion.getVersionNumber(event.userId)
    if clientVer < _scoreRankConf.minVer:
        if ftlog.is_debug():
            ftlog.debug('_fillUpdateUserScore version too low. userId=',
                        event.userId, 'clientVer=', clientVer, 'minVer=',
                        _scoreRankConf.minVer)
        return False

    if ftlog.is_debug():
        ftlog.debug('_fillUpdateUserScore userId=', event.userId, 'clientVer=',
                    clientVer)

    rankingDefine = _scoreRankConf.rankDefineForRoomId(bigRoomId)
    if not rankingDefine:
        if ftlog.is_debug():
            ftlog.debug('_fillUpdateUserScore NoRankingForRoom userId=',
                        event.userId, 'roomId=', event.roomId, 'chipDelta=',
                        event.winlose.deltaChip, 'winStreak=', winStreak)
        return False

    timestamp = pktimestamp.getCurrentTimestamp()
    if rankingDefine.isOutOfTime(timestamp):
        if ftlog.is_debug():
            ftlog.debug('_fillUpdateUserScore outOfTime userId=', event.userId,
                        'roomId=', event.roomId, 'curTimeStamp=', timestamp)
        return False

    updateUserScore(event.userId, bigRoomId, event.winlose.deltaChip,
                    winStreak)
示例#7
0
def _processUserPlayCount(event):
    """
    增加玩次数
    """
    if ftlog.is_debug():
        ftlog.debug('dizhu_red_envelope_bomb._processUserPlayCount',
                    'mixConfRoomId=', event.mixConfRoomId, 'userId=',
                    event.userId, 'roomId=', event.roomId, 'tableId=',
                    event.tableId)
    bigRoomId = int(
        event.mixConfRoomId) if event.mixConfRoomId else gdata.getBigRoomId(
            event.roomId)
    if not _redEnvelopeBomb.isActive(bigRoomId,
                                     pktimestamp.getCurrentTimestamp()):
        return
    version = SessionDizhuVersion.getVersionNumber(event.userId)
    if version < _redEnvelopeBomb.conf.minVersion:
        return
    increaseUserPlayCount(_redEnvelopeBomb.conf.issueNum, event.userId,
                          bigRoomId, pktimestamp.getCurrentTimestamp())
def canMatchDiscount(userId, bigRoomId, itemId):
    """判断是否可以在折扣"""

    # 判断用户此ItemId下的折扣次数
    roomDiscountConf = getRoomDiscountConf(bigRoomId)
    dizhuVersion = SessionDizhuVersion.getVersionNumber(userId)
    if not roomDiscountConf or dizhuVersion < roomDiscountConf.get('minVersion', 0):
        return False, None, 0

    disConf = roomDiscountConf.get(itemId, {})
    disCount = getUserMatchDiscountCount(userId, bigRoomId, itemId)
    for oroomid in disConf.get('actOn', []):
        disCount += getUserMatchDiscountCount(userId, oroomid, itemId)
    if disConf.get('count', -1) > 0 and disCount < disConf.get('count', -1):
        if ftlog.is_debug():
            ftlog.debug('match_signin_discount.canMatchDiscount',
                        'userId=', userId,
                        'bigRoomId=', bigRoomId,
                        'disCount=', disCount,
                        'disConf=', disConf)
        return True, disConf, disConf.get('count', -1) - disCount
    return False, None, 0
示例#9
0
def newOrOldSkinTest(userId, model):
    conf = configure.getGameJson(6, 'table.skin', {},
                                 configure.DEFAULT_CLIENT_ID)
    if conf:
        olderConf = conf.get('changeOldUserSkin', {})
        if olderConf:
            olderSwitch = olderConf.get('switch', 0)
            changeUserSkinMinVer = olderConf.get('changeUserSkinMinVer', 0)
            userDizhuClientVer = SessionDizhuVersion.getVersionNumber(userId)
            if olderSwitch and userDizhuClientVer >= changeUserSkinMinVer:
                skin3d = olderConf.get('skin3d', {})
                skinId = skin3d.get('skinId')
                userIdList = skin3d.get('userIdList', [])
                if userId in userIdList:
                    model.curSkin = skinId
                    return model
                skin2d = olderConf.get('skin2d', {})
                skinId = skin2d.get('skinId')
                userIdList = skin2d.get('userIdList', [])
                if userId in userIdList:
                    model.curSkin = skinId
                    return model
    return model
示例#10
0
 def getGameSessionVersion(self, userId):
     '''
     获取用户所在Game插件版本
     '''
     return SessionDizhuVersion.getVersionNumber(userId) or 0
示例#11
0
def _quickStart(cls, msg, userId, gameId, roomId, tableId, playMode, clientId):
    '''UT server中处理来自客户端的quick_start请求
            Args:
                msg
                    cmd : quick_start
                    if roomId == 0:
                        表示快速开始,服务器为玩家选择房间,然后将请求转给GR

                    if roomId > 0 and tableId == 0 :
                        表示玩家选择了房间,将请求转给GR

                    if roomId > 0 and tableId == roomId * 10000 :
                        表示玩家在队列里断线重连,将请求转给GR

                    if roomId > 0 and tableId > 0:
                        if onlineSeatId > 0:
                            表示玩家在牌桌里断线重连,将请求转给GT
                        else:
                            表示玩家选择了桌子,将请求转给GR
            '''
    assert isinstance(userId, int) and userId > 0
    assert isinstance(roomId, int) and roomId >= 0
    assert isinstance(tableId, int) and tableId >= 0

    mixId = msg.getParam('mixId', '')
    _, version, _ = strutil.parseClientId(clientId)
    if ftlog.is_debug():
        ftlog.debug("DizhuQuickStart._quickStart: clientId=", clientId,
                    "userId=", userId, "roomId=", roomId, "tableId=",
                    tableId, "mixId=", mixId, "version=", version, "type:",
                    type(version), "playMode=", playMode)

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

    if ftlog.is_debug():
        ftlog.debug("DizhuQuickStart << |clientId:",
                    clientId,
                    "mixId:",
                    mixId,
                    "|userId, roomId, tableId:",
                    userId,
                    roomId,
                    tableId,
                    "|gameId, playMode:",
                    gameId,
                    playMode,
                    caller=cls)

    bigRoomId = gdata.getBigRoomId(roomId)
    if ftlog.is_debug():
        ftlog.debug('DizhuQuickStart bigRoomId:', bigRoomId)
    if bigRoomId == 0:
        cls._onEnterRoomFailed(msg, ENTER_ROOM_REASON_ROOM_ID_ERROR, userId,
                               clientId, roomId)
        return

    if strutil.getGameIdFromBigRoomId(bigRoomId) != gameId:
        cls._onEnterRoomFailed(msg, ENTER_ROOM_REASON_ROOM_ID_ERROR, userId,
                               clientId, roomId)
        return

    if tableId == 0:  # 玩家只选择了房间
        if roomId != bigRoomId:
            ctrlRoomId = gdata.roomIdDefineMap()[roomId].parentId or roomId
            queryRoomId = roomId
        else:
            ctrRoomIds = gdata.bigRoomidsMap()[bigRoomId]
            ctrlRoomId = ctrRoomIds[userId % len(ctrRoomIds)]
            queryRoomId = ctrlRoomId

        buyin = msg.getParam("buyin", 0)  # 兼容 pc
        innerTable = msg.getParam("innerTable", 0)  # innerTable 区分不同版本弹窗

        if ftlog.is_debug():
            ftlog.debug('DizhuQuickStart._quickStart', 'buyin=', buyin,
                        'innerTable=', innerTable, 'mixId=', mixId)

        if buyin:
            innerTable = 1

        roomdef = gdata.roomIdDefineMap()[ctrlRoomId]
        roomConf = roomdef.configure

        # 免费场重起maxCoin配置
        maxCoin = roomConf.get('maxCoin', 0)
        userChip = userchip.getChip(userId)
        if maxCoin > 0 and userChip >= maxCoin and innerTable == 0:
            cls._onEnterRoomFailed(msg, ENTER_ROOM_REASON_GREATER_MAX, userId,
                                   clientId, roomId)
            return
        # 混房的话从大到小选择一个mixId
        if roomConf.get('isMix') and not mixId:
            _, _, mixId = cls._chooseRoom(userId, [ctrlRoomId])
            if mixId:
                msg.setParam('mixId', mixId)
            else:
                msg.setParam('mixId', roomConf.get('mixConf')[0].get('mixId'))
                if innerTable == 0:
                    cls._onEnterRoomFailed(msg, ENTER_ROOM_REASON_LESS_MIN,
                                           userId, clientId, roomId)
                else:
                    mixConf = cls.getMixConf(
                        roomConf,
                        roomConf.get('mixConf')[0].get('mixId'))
                    new_table_remote.processLoseRoundOver(
                        DIZHU_GAMEID,
                        userId,
                        clientId,
                        mixConf.get('roomId'),
                        minCoin=mixConf.get('minCoin'))
                return
        reasonType, reason = cls._canQuickEnterRoom(userId, ctrlRoomId,
                                                    innerTable, mixId)
        if reason == ENTER_ROOM_REASON_OK:
            TYRoomMixin.queryRoomQuickStartReq(msg, queryRoomId,
                                               0)  # 请求转给GR或GT
        else:
            if reasonType == ENTER_ROOM_REASON_TYPE_NORMAL:
                if reason == ENTER_ROOM_REASON_NOT_OPEN and innerTable == 1:
                    if ftlog.is_debug():
                        ftlog.debug(
                            'DizhuQuickStart._quickStart not open userId=',
                            userId, 'roomId=', ctrlRoomId, 'msg=', msg,
                            'playmode=', playMode)
                    # 直接踢出房间
                    mp = MsgPack()
                    mp.setCmd('room')
                    mp.setParam('action', 'leave')
                    mp.setParam('reason', TYRoom.LEAVE_ROOM_REASON_ACTIVE)
                    mp.setParam('gameId', gameId)
                    mp.setParam('roomId', roomId)
                    mp.setParam('userId', userId)
                    router.sendRoomServer(mp, roomId)
                    return

                if reason == ENTER_ROOM_REASON_LESS_MIN or reason == ENTER_ROOM_REASON_GREATER_MAX:
                    if innerTable == 1:
                        ctrRoomIds = gdata.bigRoomidsMap()[bigRoomId]
                        ctrlRoomId = ctrRoomIds[userId % len(ctrRoomIds)]
                        if roomdef.configure.get('isMix', 0):
                            continueLuckyGift = cls.getMixConf(
                                roomdef.configure,
                                mixId).get('continueLuckyGift', 0)
                            continueLuckyVer = cls.getMixConf(
                                roomdef.configure,
                                mixId).get('continueLuckyVer', 0)
                        else:
                            continueLuckyGift = roomdef.configure.get(
                                'continueLuckyGift', 0)
                            continueLuckyVer = roomdef.configure.get(
                                'continueLuckyVer', 0)
                        dizhuVersion = SessionDizhuVersion.getVersionNumber(
                            userId)
                        if continueLuckyGift and dizhuVersion >= continueLuckyVer:
                            # 发送转运礼包
                            if ftlog.is_debug():
                                ftlog.debug(
                                    'DizhuQuickStart._quickStart _less_min userId=',
                                    userId, 'roomId=', ctrlRoomId, 'msg=', msg,
                                    'playmode=', playMode,
                                    'continueLuckyGift=', continueLuckyGift,
                                    'continueLuckyVer=', continueLuckyVer,
                                    'dizhuVersion=', dizhuVersion)
                            if mixId and roomConf.get('isMix'):
                                mixConf = cls.getMixConf(roomConf, mixId)
                                new_table_remote.processLoseRoundOver(
                                    DIZHU_GAMEID,
                                    userId,
                                    clientId,
                                    mixConf.get('roomId'),
                                    minCoin=mixConf.get('minCoin'))
                            else:
                                new_table_remote.processLoseRoundOver(
                                    DIZHU_GAMEID, userId, clientId, roomId)
                        else:
                            roomDef = gdata.roomIdDefineMap()[ctrlRoomId]
                            playMode = roomDef.configure.get('playMode', None)
                            if ftlog.is_debug():
                                ftlog.debug(
                                    'DizhuQuickStart._quickStart _less_min userId=',
                                    userId, 'roomId=', ctrlRoomId, 'msg=', msg,
                                    'playmode=', playMode)
                            msgpack = MsgPack()
                            msgpack.setCmd("quick_start")
                            msgpack.setParam("userId", userId)
                            msgpack.setParam("gameId", gameId)
                            msgpack.setParam("clientId", clientId)
                            msgpack.setParam("innerTable", 1)
                            msgpack.setParam("apiver",
                                             msg.getParam("apiver", 3.7))
                            cls.onCmdQuickStart(msgpack, userId, gameId, 0, 0,
                                                playMode, clientId)
                            if ftlog.is_debug():
                                ftlog.debug(
                                    'DizhuQuickStart._quickStart reenter_less_min userId=',
                                    userId, 'roomId=', ctrlRoomId, 'msgpack=',
                                    msgpack.pack())
                    else:
                        cls._onEnterRoomFailed(msg, reason, userId, clientId,
                                               roomId)
                else:
                    cls._onEnterRoomFailed(msg, reason, userId, clientId,
                                           roomId)
            else:
                cls._sendTodoTaskToUserWithTip(userId, reason)
        return

    if tableId == roomId * 10000:  # 玩家在队列里断线重连
        TYRoomMixin.queryRoomQuickStartReq(msg, roomId, tableId)  # 请求转给GR
        return

    onlineSeat = onlinedata.getOnlineLocSeatId(userId, roomId, tableId)

    if onlineSeat:
        # 牌桌里坐着的玩家断线重连,请求转给GT
        # TYRoomMixin.querySitReq(userId, roomId, tableId, clientId) # GT人多时会有超时异常
        TYRoomMixin.sendSitReq(userId, roomId, tableId, clientId)
    else:  # 玩家选择了桌子,
        shadowRoomId = tableId / 10000
        ctrRoomId = gdata.roomIdDefineMap()[shadowRoomId].parentId
        TYRoomMixin.queryRoomQuickStartReq(msg,
                                           ctrRoomId,
                                           tableId,
                                           shadowRoomId=shadowRoomId)  # 请求转给GR
    return
示例#12
0
def _processUserOutCardBomb(event):
    """
    用户扔出炸弹的处理函数
    """
    try:
        currentTimeStamp = pktimestamp.getCurrentTimestamp()
        if not _redEnvelopeBomb.isActive(event.bigRoomId, currentTimeStamp):
            if ftlog.is_debug():
                ftlog.debug('dizhu_red_envelope_bomb._processUserOutCardBomb',
                            'mixConfRoomId=', event.mixConfRoomId,
                            'bigRoomId=', event.bigRoomId, 'tableId=',
                            event.tableId, 'userId=', event.userId, 'userIds=',
                            event.userIds, 'isActive=', False)
            return

        # 以天为单位每天发送有上限
        dailyCountLimit = _redEnvelopeBomb.conf.dailyCountLimit
        sendDailyTotalCount = getDailyRedEnvelope(
            _redEnvelopeBomb.conf.issueNum, currentTimeStamp)
        if sendDailyTotalCount >= dailyCountLimit:
            if ftlog.is_debug():
                ftlog.debug('dizhu_red_envelope_bomb._processUserOutCardBomb',
                            'roomId=', event.roomId, 'mixConfRoomId=',
                            event.mixConfRoomId, 'tableId=', event.tableId,
                            'userId=', event.userId, 'userIds=', event.userIds,
                            'sendDailyTotalCount=', sendDailyTotalCount,
                            'dailyCountLimit=', dailyCountLimit)
            return

        # 牌桌炸弹奖励
        roomRewardDict, isDouble = _redEnvelopeBomb.getTableBombReward(
            event.bigRoomId, currentTimeStamp)
        if roomRewardDict:
            userPoint = _redEnvelopeBomb._rollUserPoint(
                event.userIds, event.bigRoomId, currentTimeStamp)
            userPoint.sort(key=lambda x: x[1])  # roll点从小到大排序
            totalPoints = sum([up[1] for up in userPoint])
            if not totalPoints:
                return

            baseTotalCount = int(roomRewardDict['count'])
            # 红包
            if roomRewardDict['type'] == 'redEnvelope' and isDouble:
                # roll 点 按比例分
                totalCount = baseTotalCount * 1.0
                rewardList = []
                for up in userPoint:

                    # 过滤版本
                    version = SessionDizhuVersion.getVersionNumber(up[0])
                    if version < _redEnvelopeBomb.conf.minVersion:
                        sendCount = int(round(
                            totalCount * up[1] / totalPoints)) or 1
                        if sendCount and _redEnvelopeBomb.conf.reportLocalLog == 1:
                            roomRewardDict['count'] = sendCount
                            assetKind = hallitem.itemSystem.findAssetKind(
                                roomRewardDict['itemId'])
                            displayRate = assetKind.displayRate
                            rewardInfo = {
                                'name': assetKind.displayName,
                                'count': roomRewardDict['count'],
                                'pic': assetKind.pic,
                                'itemId': roomRewardDict['itemId'],
                                'desc': roomRewardDict.get('desc', ''),
                                'type': roomRewardDict['type'],
                                'displayRate': displayRate
                            }
                            ftlog.info(
                                'dizhu_red_envelope_bomb._processUserOutCardBomb userReward',
                                'userId=', up[0], 'mixConfRoomId=',
                                event.mixConfRoomId, 'bigRoomId=',
                                event.bigRoomId, 'tableId=', event.tableId,
                                'version=', version, 'rewardInfo=', rewardInfo)
                        continue

                    sendCount = int(round(
                        totalCount * up[1] / totalPoints)) or 1
                    if sendCount:
                        roomRewardDict['count'] = sendCount
                        assetKind = hallitem.itemSystem.findAssetKind(
                            roomRewardDict['itemId'])
                        displayRate = assetKind.displayRate
                        rewardInfo = {
                            'name': assetKind.displayName,
                            'count': roomRewardDict['count'],
                            'pic': assetKind.pic,
                            'itemId': roomRewardDict['itemId'],
                            'desc': roomRewardDict.get('desc', ''),
                            'type': roomRewardDict['type'],
                            'displayRate': displayRate
                        }

                        if _redEnvelopeBomb.conf.reportLocalLog == 1:
                            ftlog.info(
                                'dizhu_red_envelope_bomb._processUserOutCardBomb userReward',
                                'userId=', up[0], 'mixConfRoomId=',
                                event.mixConfRoomId, 'bigRoomId=',
                                event.bigRoomId, 'tableId=', event.tableId,
                                'version=', version, 'rewardInfo=', rewardInfo)

                        rewardList.append({
                            'userId': up[0],
                            'seatId': up[2],
                            'reward': rewardInfo
                        })
                        _redEnvelopeBomb.addRewardToUser(up[0], roomRewardDict)
                        saveDailyRedEnvelope(_redEnvelopeBomb.conf.issueNum,
                                             currentTimeStamp,
                                             roomRewardDict['count'])
                        saveUserRedEnvelope(_redEnvelopeBomb.conf.issueNum,
                                            up[0], roomRewardDict['count'],
                                            currentTimeStamp)
                        # 发送led
                        if roomRewardDict[
                                'count'] > _redEnvelopeBomb.conf.ledCount:
                            userName = userdata.getAttrs(up[0], ['name'])[0]
                            roomName = event.roomName
                            disCount = roomRewardDict[
                                'count'] * 1.0 / displayRate
                            disCount = int(disCount) if disCount.is_integer(
                            ) else round(disCount, 2)
                            LedUtil.sendLed(
                                _mk_red_envelope_rich_text(
                                    userName, roomName, disCount), 'global')

                        # 发送大厅红包券事件
                        TGHall.getEventBus().publishEvent(
                            UserReceivedCouponEvent(
                                HALL_GAMEID, up[0], roomRewardDict['count'],
                                hall_red_packet_const.RP_SOURCE_RP_BOMB))

                    # 修改用户连续,不连续得奖记录
                    saveRollLoseStreak(_redEnvelopeBomb.conf.issueNum, up[0],
                                       0)
                    if ftlog.is_debug():
                        ftlog.debug(
                            'dizhu_red_envelope_bomb._processUserOutCardBomb',
                            'roomId=', event.roomId, 'bigRoomId=',
                            event.bigRoomId, 'tableId=', event.tableId,
                            'userPoint=', up, 'roomRewardDict=',
                            roomRewardDict)
                if rewardList:
                    _redEnvelopeBomb.sendRewardToUsers(event.userIds,
                                                       rewardList)
            else:
                winUser = userPoint[-1]
                version = SessionDizhuVersion.getVersionNumber(winUser[0])
                # 发奖
                assetKind = hallitem.itemSystem.findAssetKind(
                    roomRewardDict['itemId'])
                displayRate = assetKind.displayRate
                rewardInfo = {
                    'name': assetKind.displayName,
                    'count': roomRewardDict['count'],
                    'pic': assetKind.pic,
                    'itemId': roomRewardDict['itemId'],
                    'desc': roomRewardDict.get('desc', ''),
                    'type': roomRewardDict['type'],
                    'displayRate': displayRate
                }
                if _redEnvelopeBomb.conf.reportLocalLog == 1:
                    ftlog.info(
                        'dizhu_red_envelope_bomb._processUserOutCardBomb userReward',
                        'userId=', winUser[0], 'mixConfRoomId=',
                        event.mixConfRoomId, 'bigRoomId=', event.bigRoomId,
                        'tableId=', event.tableId, 'version=', version,
                        'rewardInfo=', rewardInfo)

                # 过滤版本
                if version < _redEnvelopeBomb.conf.minVersion:
                    return

                rewardList = [{
                    'userId': winUser[0],
                    'seatId': winUser[2],
                    'reward': rewardInfo
                }]
                _redEnvelopeBomb.addRewardToUser(winUser[0], roomRewardDict)
                _redEnvelopeBomb.sendRewardToUsers(event.userIds, rewardList)
                if roomRewardDict['type'] == 'redEnvelope':
                    saveDailyRedEnvelope(_redEnvelopeBomb.conf.issueNum,
                                         currentTimeStamp,
                                         roomRewardDict['count'])
                    saveUserRedEnvelope(_redEnvelopeBomb.conf.issueNum,
                                        winUser[0], roomRewardDict['count'],
                                        currentTimeStamp)
                    # 发送led
                    if roomRewardDict['count'] > _redEnvelopeBomb.conf.ledCount:
                        disCount = roomRewardDict['count'] * 1.0 / displayRate
                        disCount = int(disCount) if disCount.is_integer(
                        ) else round(disCount, 2)
                        userName = userdata.getAttrs(winUser[0], ['name'])[0]
                        roomName = event.roomName
                        LedUtil.sendLed(
                            _mk_red_envelope_rich_text(userName, roomName,
                                                       disCount), 'global')

                    # 发送大厅红包券事件
                    TGHall.getEventBus().publishEvent(
                        UserReceivedCouponEvent(
                            HALL_GAMEID, winUser[0], roomRewardDict['count'],
                            hall_red_packet_const.RP_SOURCE_RP_BOMB))

                    if ftlog.is_debug():
                        ftlog.debug(
                            'dizhu_red_envelope_bomb._processUserOutCardBomb',
                            'roomId=', event.roomId, 'bigRoomId=',
                            event.bigRoomId, 'tableId=', event.tableId,
                            'userPoint=', userPoint[-1], 'roomRewardDict=',
                            roomRewardDict)
                # 修改用户连续,不连续得奖记录
                saveRollLoseStreak(_redEnvelopeBomb.conf.issueNum, winUser[0],
                                   0)
                loseUserIds = [u[0] for u in userPoint[:-1]]
                for uid in loseUserIds:
                    loseCount = getRollLoseStreak(
                        _redEnvelopeBomb.conf.issueNum, uid)
                    saveRollLoseStreak(_redEnvelopeBomb.conf.issueNum, uid,
                                       loseCount + 1)
    except Exception, e:
        ftlog.error('dizhu_red_envelope_bomb._processUserOutCardBomb',
                    'roomId=', event.roomId, 'bigRoomId=', event.bigRoomId,
                    'tableId=', event.tableId, 'err=', e.message)
示例#13
0
def doInitTableUserData(userId,
                        bigRoomId,
                        tableId,
                        isNextBuyin,
                        buyinchip,
                        isMatch=False):
    clientId = sessiondata.getClientId(userId)
    isSupportBuyin = dizhuconf.isSupportBuyin(clientId)
    exp, suaddress, susex, suname, sucoin, charm = userdata.getAttrs(
        userId, ['exp', 'address', 'sex', 'name', 'coin', 'charm'])
    sugold, slevel, swinrate, winchips, starid, winstreak = gamedata.getGameAttrs(
        userId, DIZHU_GAMEID,
        ['gold', 'level', 'winrate', 'winchips', 'starid', 'winstreak'])
    ftlog.debug('isSupportBuyin=', isSupportBuyin, 'userdata->', suaddress,
                susex, suname, sucoin, exp, charm)
    ftlog.debug('gamedata->', sugold, slevel, swinrate, winchips, starid)

    swinrate = strutil.loads(swinrate,
                             ignoreException=True,
                             execptionValue={
                                 'pt': 0,
                                 'wt': 0
                             })
    suchip = userchip.getChip(userId)
    buyin_tip = ''
    if not isSupportBuyin or isMatch:
        buyinMark = 0
        buyin_chip = suchip
    else:
        buyinMark = 1
        buyin_chip = userchip.getTableChip(userId, DIZHU_GAMEID, tableId)
        buyinconf = dizhuconf.getBuyInConf()
        if buyin_chip == buyinchip:
            if isNextBuyin:
                buyin_tip = buyinconf.get('tip_auto', '')
            else:
                buyin_tip = buyinconf.get('tip',
                                          '').format(BUYIN_CHIP=buyinchip)
        else:
            if suchip <= 0:
                if isNextBuyin:
                    buyin_tip = buyinconf.get('tip_auto_all_next', '')
                else:
                    buyin_tip = buyinconf.get('tip_auto_all', '')
        suchip = buyin_chip

    tbplaytimes, tbplaycount = treasurebox.getTreasureBoxState(
        userId, bigRoomId)
    try:
        if TYPlayer.isRobot(userId):
            supic, isBeauty = '', False
        else:
            supic, isBeauty = halluser.getUserHeadUrl(userId, clientId)
    except:
        supic, isBeauty = '', False

    slevel = _recoverUserAttr(slevel, int, 0)
    datas = {}
    datas['uid'] = userId
    datas['address'] = _recoverUserAttr(suaddress, unicode, '')
    datas['sex'] = _recoverUserAttr(susex, int, 0)
    datas['name'] = _recoverUserAttr(suname, unicode, '')
    datas['coin'] = _recoverUserAttr(sucoin, int, 0)
    datas['headUrl'] = ''
    datas['purl'] = supic
    datas['isBeauty'] = isBeauty
    datas['chip'] = suchip
    datas['buyinMark'] = buyinMark
    datas['buyinChip'] = buyin_chip
    datas['buyinTip'] = buyin_tip
    datas['exp'] = _recoverUserAttr(exp, int, 0)
    datas['gold'] = _recoverUserAttr(sugold, int, 0)
    datas['vipzuan'] = []
    datas['tbc'] = tbplaycount
    datas['tbt'] = tbplaytimes
    datas['level'] = slevel
    datas['wins'] = swinrate.get('wt', 0)
    datas['plays'] = swinrate.get('pt', 0)
    datas['winchips'] = _recoverUserAttr(winchips, int, 0)
    datas['nextexp'] = dizhuaccount.getGameUserNextExp(slevel)
    datas['title'] = dizhuaccount.getGameUserTitle(slevel)
    datas['medals'] = _buildUserMedals()
    datas['skillScoreInfo'] = skillscore.score_info(userId)
    datas['charm'] = 0 if charm == None else _recoverUserAttr(charm, int, 0)
    datas['vipInfo'] = hallvip.userVipSystem.getVipInfo(userId)
    datas['starid'] = 0 if starid == None else _recoverUserAttr(starid, int, 0)
    datas['winstreak'] = 0 if winstreak == None else _recoverUserAttr(
        winstreak, int, 0)
    datas['gameClientVer'] = SessionDizhuVersion.getVersionNumber(userId)
    # TODO 查询用户增值位
    datas['wearedItems'] = []
    userBag = hallitem.itemSystem.loadUserAssets(userId).getUserBag()
    timestamp = pktimestamp.getCurrentTimestamp()
    memberCardItem = userBag.getItemByKindId(hallitem.ITEM_MEMBER_NEW_KIND_ID)
    datas[
        'memberExpires'] = memberCardItem.expiresTime if memberCardItem else 0
    item = userBag.getItemByKindId(hallitem.ITEM_CARD_NOTE_KIND_ID)
    cardNoteCount = 0
    if item and not item.isDied(timestamp):
        cardNoteCount = max(1, item.balance(timestamp))
    ftlog.debug('DizhuPlayer->userId=', userId, 'isSupportBuyin=',
                isSupportBuyin, 'cardNoteCount=', cardNoteCount, 'clientId=',
                clientId, 'data=', datas)
    return isSupportBuyin, cardNoteCount, clientId, datas
示例#14
0
def fillScoreRankListInfo(roomId, userId, delta):
    conf = getConf()
    if not conf or conf.closed:
        return None

    bigRoomId = gdata.getBigRoomId(roomId)
    rankConf = conf.rankDefineForRoomId(bigRoomId)
    if not rankConf:
        return None

    clientVer = SessionDizhuVersion.getVersionNumber(userId)
    if clientVer < conf.minVer or rankConf.switch != 1:
        return None

    if rankConf.isOutOfTime():
        return {"open": 0, "info": rankConf.tips}

    issueNum = calcIssueNum()
    userData = loadOrCreateUserData(userId, rankConf.rankId, issueNum)

    # vip积分加成
    vipLevel = hallvip.userVipSystem.getUserVip(userId).vipLevel
    vipScoreUp = rankConf.findVipPlusRate(int(
        vipLevel.level)) if delta > 0 else 0

    # 连胜加成
    winStreak = gamedata.getGameAttrInt(userId, DIZHU_GAMEID, 'winstreak')
    winsPlus = rankConf.winsPlusRate if winStreak > 1 else 0

    # 月卡加成
    monthCardPlus = 0
    if rankConf.monthCardItem and UserBag.isHaveAssets(
            userId, rankConf.monthCardItem) and delta > 0:
        monthCardPlus = rankConf.monthCardPlus

    # 荣耀月卡加成
    honorCardPlus = 0
    if rankConf.honorCardItem and UserBag.isHaveAssets(
            userId, rankConf.honorCardItem) and delta > 0:
        honorCardPlus = rankConf.honorCardPlus

    # 金币转换积分的比例
    exchangeRate = rankConf.exchangeRate
    # 胜场积分缩减 后台结算后胜场加1,前端结算积分后胜场已加1,前端展示时取未加1的显示
    decayRate = 1
    todayPlayCount = userData.todayPlayCount - 1 if userData.todayPlayCount > 0 else 0
    if rankConf.playCounts and rankConf.playCountsDecayRate:
        decayRate = rankConf.playCountsDecayRate if todayPlayCount >= rankConf.playCounts else 1

    # 积分结果四舍五入
    scoreUp = (1 + vipScoreUp + winsPlus + monthCardPlus +
               honorCardPlus) if delta > 0 else 1
    score = int(round(delta * decayRate * exchangeRate * scoreUp))

    rate = [{
        "key": "VIP",
        "value": vipScoreUp
    }, {
        "key": "月卡",
        "value": monthCardPlus
    }, {
        "key": "连胜",
        "value": winsPlus
    }, {
        "key": "荣耀月卡",
        "value": honorCardPlus
    }]
    d = {
        "open": 1,
        "rankId": rankConf.rankId,
        "delta": score,
        "rate": rate,
        "info": rankConf.tips
    }

    if ftlog.is_debug():
        ftlog.debug('fillScoreRankListInfo roomId=', roomId, 'rankId=',
                    rankConf.rankId, 'exchangeRate=', exchangeRate,
                    'todayPlayCountDecayRate=', decayRate, 'honorCardPlus=',
                    honorCardPlus, 'sst.delta=', delta, 'global.winStreak=',
                    winStreak, 'todayPlayCount=', userData.todayPlayCount,
                    'rate=', rate, 'd=', d)
    return d
示例#15
0
 def _useSelfPopWnd(cls, userId):
     dizhuVersion = SessionDizhuVersion.getVersionNumber(userId)
     return dizhuVersion >= 3.812
示例#16
0
    def _sendStageReward(self, result):
        # 各个阶段发阶段奖励
        rewardList = []
        stageRewards = self.room.roomConf['matchConf'].get('stageRewards', {})
        for sst in result.seatStatements:
            userId = sst.seat.userId

            stageindex = self.table.matchTableInfo.get('step', {}).get(
                'stageIndex', 0) + 1
            stageReward = stageRewards.get(str(self.table.room.bigmatchId),
                                           {}).get(str(stageindex), [])

            currStageReward = []
            try:
                sstIsDizhu = 'dizhu' if sst.isDizhu else 'nongmin'
                for rewardIndex in range(len(stageReward)):
                    currStageReward.append({
                        "count":
                        stageReward[rewardIndex].get('count',
                                                     {}).get(sstIsDizhu, 0),
                        "itemId":
                        stageReward[rewardIndex]['itemId']
                    })
            except Exception, e:
                ftlog.warn('group.stageRewards.info userId=', userId, 'err=',
                           e)

            deltaScore = sst.delta if not sst.seat.isGiveup else -9999999
            clientVer = SessionDizhuVersion.getVersionNumber(userId)

            if ftlog.is_debug():
                ftlog.debug('group.stageRewards.info userId=', userId,
                            'index=', stageindex, 'score=', deltaScore, 'ver=',
                            clientVer, 'reward=', currStageReward,
                            'stageRewardTotal=',
                            sst.seat.player.stageRewardTotal)

            if not currStageReward or deltaScore < 0 or clientVer < 3.90:
                rewardList.append(None)
                continue

            contentItems = TYContentItem.decodeList(currStageReward)
            assetList = dizhu_util.sendRewardItems(userId, contentItems, '',
                                                   'DIZHU_STAGE_REWARD', 0)
            clientAssetList = []
            for atp in assetList:
                clientAsset = {
                    "name": atp[0].displayName,
                    "itemId": atp[0].kindId,
                    "count": atp[1]
                }
                clientAssetList.append(clientAsset)
                sst.seat.player.stageRewardTotal += atp[1]
            rewardList.append(clientAssetList)

            ftlog.info('group.stageRewards.info userId=', userId,
                       'deltaScore=', deltaScore, 'stageRewardTotal=',
                       sst.seat.player.stageRewardTotal, 'index=', stageindex,
                       'assetList=', [(atp[0].kindId, atp[1])
                                      for atp in assetList], 'seatId=',
                       sst.seat.seatId)
示例#17
0
 def check(self, gameId, userId, clientId, timestamp, **kwargs):
     clientVer = SessionDizhuVersion.getVersionNumber(userId)
     return (self.minVersion is None or clientVer >= self.minVersion) \
         and (self.maxVersion is None or clientVer < self.maxVersion)
示例#18
0
    def handleEvent(cls, event):
        try:
            winlose = event.winlose
            if not winlose.isWin:
                # 失败不弹出
                return
            if event.skillLevelUp:
                # 升段不弹出
                return

            clientGiftVer = SessionDizhuVersion.getVersionNumber(event.userId)
            if clientGiftVer >= 3.824:
                # 新礼包过滤老礼包
                from poker.entity.configure import gdata
                roomConf = gdata.getRoomConfigure(event.roomId)
                newTypeOfGift = roomConf.get('newTypeOfGift', 0) if roomConf else None
                if ftlog.is_debug():
                    ftlog.debug('ChargeLead handleEvent', 'roomId=', event.roomId,
                                'clientVer=', clientGiftVer, 'newTypeOfGift=', newTypeOfGift,
                                'roomConf=', roomConf, 'newTypeOfGift=', newTypeOfGift)
                if newTypeOfGift:
                    return

            winstreak = gamedata.getGameAttr(event.userId, event.gameId, 'winstreak') or 0

            # 纪录连胜日志, 方便以后线上查询
            ftlog.debug('[<ChargeLead>UserTableWinloseEvent|isWin=True]Dizhu',
                       'gameId=', event.gameId,
                       'userId=', event.userId,
                       'roomId=', event.roomId,
                       'slam=', winlose.slam,
                       'chunTian=', winlose.chunTian,
                       'skillLevelUp=', event.skillLevelUp,
                       'mixConfRoomId=', event.mixConfRoomId,
                       'winstreak=', winstreak)
            
            clientId = sessiondata.getClientId(event.userId)
            _, clientVer, _ = strutil.parseClientId(clientId)

            # 当玩家取得3的倍数连胜时或达成春天、大满贯(及以上倍数)取胜时弹出高手礼包
            if winstreak % 3 == 0 or winlose.slam or winlose.chunTian:
                if ftlog.is_debug():
                    ftlog.debug('ChargeLead.handleEvent gameId=', event.gameId,
                                'userId=', event.userId,
                                'roomId=', event.roomId,
                                'winstreak=', winstreak,
                                'mixConfRoomId=', event.mixConfRoomId,
                                'clientId=', clientId)

                if clientVer >= 3.7:
                    todotask = hallpopwnd.makeTodoTaskWinBuy(event.gameId, event.userId, clientId, event.mixConfRoomId or event.roomId)
                    if todotask:
                        todotask.setParam('delay', 3)
                        TodoTaskHelper.sendTodoTask(event.gameId, event.userId, todotask)
                else:
                    product, _ = hallproductselector.selectWinleadProduct(event.gameId, event.userId, clientId, event.mixConfRoomId or event.roomId)
                    if not product:
                        ftlog.warn('ChargeLead.handleEvent NotFoundProduct gameId=', event.gameId,
                                   'userId=', event.userId,
                                   'roomId=', event.roomId,
                                   'winstreak=', winstreak,
                                   'mixConfRoomId=', event.mixConfRoomId,
                                   'clientId=', clientId)
                        return
                    cls.sendChargeLeadToDoTask(event.gameId, event.userId, product)
        except:
            ftlog.exception()
示例#19
0
    def _rollUserPoint(self, userIds, bigRoomId, timestamp):
        """ roll点策略 """
        userRoll = []
        basePoint = self.conf.rollAdditionPoints.get('rollBasePoint', 100)
        for userId, seatId in userIds:
            # 版本过滤
            version = SessionDizhuVersion.getVersionNumber(userId)
            if version < self.conf.minVersion:
                userRoll.append([userId, random.randint(1, basePoint), seatId])
                continue

            # 是否新用户
            clientId = sessiondata.getClientId(userId)
            isNewUser = hallusercond.UserConditionRegisterDay(-1, 1).check(
                DIZHU_GAMEID, userId, clientId, timestamp)
            # vip 等级
            vipLevel = int(
                hallvip.userVipSystem.getUserVip(userId).vipLevel.level)
            # 查找用户是否黑脸白脸, 优先级最高
            loseStreak = getRollLoseStreak(self.conf.issueNum, userId)
            point = basePoint
            if loseStreak:
                point += self.conf.rollAdditionPoints.get('badLuck',
                                                          10) * loseStreak
                saveRollLoseStreak(self.conf.issueNum, userId, -1)
            if isNewUser:
                point += self.conf.rollAdditionPoints.get('newUser', 10)
            if vipLevel >= 0:
                point += self.conf.rollAdditionPoints.get('vip', {}).get(
                    'vip%s' % vipLevel, 0)

            # 判断用户是否到达每日最大领取限额, 如果达到roll点为0
            userCurrentCount, _ = getDailyUserRedEnvelope(
                self.conf.issueNum, userId, timestamp)
            userCountLimit = self.conf.userDailyCountLimit.get(
                'vip%s' % vipLevel, -1)
            if userCurrentCount >= userCountLimit > 0:
                point = 0

            # 是否超过房间局数上限, 如果达到roll点为0
            pt = getUserPlayCount(self.conf.issueNum, userId, bigRoomId,
                                  timestamp)
            ptLimit = self.conf.dailyPlayCountLimit.get(str(bigRoomId))
            if pt and ptLimit and pt > ptLimit:
                point = 0

            roll = [
                userId,
                random.randint(1, point) if point >= 1 else 0, seatId
            ]
            userRoll.append(roll)
            if ftlog.is_debug():
                ftlog.debug('dizhu_red_envelope_bomb._rollUserPoint',
                            'userId=', userId, 'vipLevel=', vipLevel,
                            'basePoint=', basePoint, 'isNewUser='******'loseStreak=', loseStreak, 'bigRoomId=', bigRoomId,
                            'point=', point, 'userCurrentCount=',
                            userCurrentCount, 'userCountLimit=',
                            userCountLimit, 'pt=', pt, 'ptLmit=', ptLimit,
                            'userRoll=', roll)
        return userRoll