示例#1
0
def makeTodoTaskluckBuyOrLessBuyChip(gameId, userId, clientId, bigRoomId, **kwargs):
    ''' 获取转运礼包,此时是 todotask 对象, 发送给客户端时需要转换为字典,即 todotask.toDict() '''
    from hall.entity.hallpopwnd import makeTodoTaskLuckBuy, makeTodoTaskLessbuyChip
    priority = kwargs.get('priority', 'luckBuy')
    todoTask = None
    if priority == 'luckBuy':
        luckBuyOrLessBuyChip = makeTodoTaskLuckBuy(gameId, userId, clientId, bigRoomId)
        if not luckBuyOrLessBuyChip:
            luckBuyOrLessBuyChip = makeTodoTaskLessbuyChip(gameId, userId, clientId, bigRoomId, **kwargs)
        if luckBuyOrLessBuyChip:
            todoTask = luckBuyOrLessBuyChip
    else:
        luckBuyOrLessBuyChip = makeTodoTaskLessbuyChip(gameId, userId, clientId, bigRoomId, **kwargs)
        if not luckBuyOrLessBuyChip:
            luckBuyOrLessBuyChip = makeTodoTaskLuckBuy(gameId, userId, clientId, bigRoomId)
        if luckBuyOrLessBuyChip:
            todoTask = luckBuyOrLessBuyChip
    return todoTask
示例#2
0
def processLoseRoundOver(gameId, userId, clientId, roomId, **kwargs):
    # 踢出房间的幸运大礼包
    minCoin = kwargs.get('minCoin', 0)
    luckBuyOrLessBuyChip = makeTodoTaskLuckBuy(gameId, userId, clientId,
                                               roomId)
    if not luckBuyOrLessBuyChip:
        luckBuyOrLessBuyChip = makeTodoTaskLessbuyChip(gameId,
                                                       userId,
                                                       clientId,
                                                       roomId,
                                                       minCoin=minCoin)

    if not luckBuyOrLessBuyChip:
        return
    todotasks = [luckBuyOrLessBuyChip]
    return TodoTaskHelper.sendTodoTask(gameId, userId, todotasks)
示例#3
0
 def _sendTodoTaskBuyChip(cls, userId, roomId, clientId, mixId):
     if ftlog.is_debug():
         ftlog.debug('DizhuQuickStart._sendTodoTaskBuyChip',
                     'userId=', userId,
                     'roomId=', roomId,
                     'clientId=', clientId,
                     'mixId=', mixId)
     bigRoomId = gdata.getBigRoomId(roomId)
     ctrRoomId = bigRoomId * 10000 + 1000
     roomConfig = gdata.roomIdDefineMap()[ctrRoomId].configure
     mixConfRoomId = cls.getMixConf(roomConfig, mixId).get('roomId', 0)
     if roomConfig.get('isMix', 0) and mixConfRoomId:
         roomId = mixConfRoomId
     todotask = hallpopwnd.makeTodoTaskLessbuyChip(DIZHU_GAMEID, userId, clientId, roomId, minCoin=cls.getMixConf(roomConfig, mixId).get('minCoin', None))
     if todotask:
         TodoTaskHelper.sendTodoTask(DIZHU_GAMEID, userId, todotask)
示例#4
0
def processLoseOutRoomV3_77(gameId,
                            userId,
                            clientId,
                            roomId,
                            showMemberTry=False):
    if ftlog.is_debug():
        ftlog.debug('table_remote.processLoseOutRoomV3_77 gameId=', gameId,
                    'userId=', userId, 'clientId=', clientId, 'roomId=',
                    roomId)

    timestamp = pktimestamp.getCurrentTimestamp()
    remainDays, _memberBonus = hallitem.getMemberInfo(userId, timestamp)

    memberTry = None
    luckBuyOrLessBuyChip = makeTodoTaskLuckBuy(gameId, userId, clientId,
                                               roomId)
    if not luckBuyOrLessBuyChip:
        luckBuyOrLessBuyChip = makeTodoTaskLessbuyChip(gameId, userId,
                                                       clientId, roomId)

    # 冲过值的或者新用户不弹试用会员
    isNewUser = UserConditionRegisterDay(0, 0).check(gameId, userId, clientId,
                                                     timestamp)
    if ftlog.is_debug():
        ftlog.debug('table_remote.processLoseOutRoomV3_77 gameId=', gameId,
                    'userId=', userId, 'clientId=', clientId, 'roomId=',
                    roomId, 'remainDays=', remainDays, 'payCount=',
                    pkuserdata.getAttr(userId,
                                       'payCount'), 'isNewUser='******'payCount') <= 0 and not isNewUser:
        memberTry = makeTodoTaskByTemplate(gameId, userId, clientId,
                                           'memberTry')
        if memberTry and luckBuyOrLessBuyChip:
            memberTry.setCloseCmd(luckBuyOrLessBuyChip)
    else:
        ftlog.debug('Not show member popwnd')

    datachangenotify.sendDataChangeNotify(gameId, userId, 'chip')
    todotask = memberTry or luckBuyOrLessBuyChip
    if todotask:
        TodoTaskHelper.sendTodoTask(gameId, userId, todotask)

    # 发送救济金气泡提示
    sendUserBenefitsIfNeed(gameId, userId, roomId, timestamp)
    # benefitsSend, userBenefits = hallbenefits.benefitsSystem.sendBenefits(gameId, userId, timestamp)
    # if benefitsSend:
    #     message = [
    #         [{"type":"ttf","font":"ArialMT","text":"送您%s金币救急,"%(userBenefits.sendChip),"color":16777215}],
    #         [{"type":"ttf","font":"ArialMT","text":"继续努力吧!","color":16777215}],
    #         [{"type":"ttf","font":"ArialMT","text":"(今天第","color":16777215},
    #          {"type":"ttf","font":"ArialMT","text":userBenefits.times,"color":65280},
    #          {"type":"ttf","font":"ArialMT","text":"次,共%s次)"%(userBenefits.totalMaxTimes),"color":16777215}]
    #     ]
    #     mo = MsgPack()
    #     mo.setCmd('table_call')
    #     mo.setResult('gameId', gameId)
    #     mo.setResult('userId', userId)
    #     mo.setResult('action', 'benefits')
    #     mo.setResult('message', json.dumps(message))
    #     router.sendToUser(mo, userId)
    return None
示例#5
0
 def _sendTodoTaskBuyChip(cls, userId, roomId, clientId):
     todotask = hallpopwnd.makeTodoTaskLessbuyChip(DIZHU_GAMEID, userId,
                                                   clientId, roomId)
     if todotask:
         TodoTaskHelper.sendTodoTask(DIZHU_GAMEID, userId, todotask)