Пример #1
0
    def getTodoTasksAfterLogin(self, userId, gameId, clientId, isdayfirst):
        '''
        获取登录后的todotasks列表
        '''
        from hall.entity import hallitem, hallstartchip, hallpopwnd
        # 每日登录奖励,以前在各个游戏,现在移到大厅
        ret = []
        # 3.7以前9999没有todotask
        _, clientVer, _ = strutil.parseClientId(clientId)
        if clientVer < 3.7:
            return ret

        if hallstartchip.needSendStartChip(userId, gameId):
            # 需要弹启动资金领取弹框
            assetKind = hallitem.itemSystem.findAssetKind(
                hallitem.ASSET_ITEM_NEWER_GIFT_KIND_ID)
            pic = assetKind.pic if assetKind else ''
            if ftlog.is_debug():
                ftlog.debug('TGHall.getTodoTasksAfterLogin userId=', userId,
                            'gameId=', gameId, 'clientId=', clientId,
                            'isDayFirst=', isdayfirst, 'assetKind=', assetKind)
            ret.append(
                TodoTaskIssueStartChip(hallstartchip.newuser_startchip, 0, pic,
                                       ''))

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

        nsloginTodotaskList = hallpopwnd.makeTodoTaskNsloginReward(
            gameId, userId, clientId, remainDays, memberBonus, isdayfirst)

        if ftlog.is_debug():
            ftlog.debug('TGHall.getTodoTasksAfterLogin gameId=', gameId,
                        'userId=', userId, 'clientId=', clientId,
                        'nsloginTodotaskList=', nsloginTodotaskList)

        if nsloginTodotaskList:
            ret.extend(nsloginTodotaskList)

        # ios 提示更新
        iosUpgrade = hallpopwnd.makeTodoTaskByTemplate(gameId, userId,
                                                       clientId, 'iosUpgrade')
        if iosUpgrade:
            ret.append(iosUpgrade)

        return ret
Пример #2
0
    def getTodoTasksAfterLogin(self, userId, gameId, clientId, isdayfirst):
        '''
        获取登录后的todotasks列表
        '''
        from hall.entity import hallitem, hallstartchip, hallpopwnd
        # 每日登录奖励,以前在各个游戏,现在移到大厅
        ret = []
        # 3.7以前9999没有todotask
        _, clientVer, _ = strutil.parseClientId(clientId)
        if clientVer < 3.7:
            return ret

        if hallstartchip.needSendStartChip(userId, gameId):
            # 需要弹启动资金领取弹框
            assetKind = hallitem.itemSystem.findAssetKind(hallitem.ASSET_ITEM_NEWER_GIFT_KIND_ID)
            pic = assetKind.pic if assetKind else ''
            if ftlog.is_debug():
                ftlog.debug('TGHall.getTodoTasksAfterLogin userId=', userId,
                            'gameId=', gameId,
                            'clientId=', clientId,
                            'isDayFirst=', isdayfirst,
                            'assetKind=', assetKind)
            ret.append(TodoTaskIssueStartChip(hallstartchip.newuser_startchip, 0, pic, ''))

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

        nsloginTodotaskList = hallpopwnd.makeTodoTaskNsloginReward(gameId, userId, clientId, remainDays, memberBonus,
                                                                   isdayfirst)

        if ftlog.is_debug():
            ftlog.debug('TGHall.getTodoTasksAfterLogin gameId=', gameId,
                        'userId=', userId,
                        'clientId=', clientId,
                        'nsloginTodotaskList=', nsloginTodotaskList)

        if nsloginTodotaskList:
            ret.extend(nsloginTodotaskList)

        # ios 提示更新
        iosUpgrade = hallpopwnd.makeTodoTaskByTemplate(gameId, userId, clientId, 'iosUpgrade')
        if iosUpgrade:
            ret.append(iosUpgrade)

        return ret
Пример #3
0
def makeTodoTaskNsloginReward(gameId, userId, clientId, remainDays,
                              memberBonus, isdayfirst):
    timestamp = pktimestamp.getCurrentTimestamp()
    from hall.entity import halldailycheckin
    from poker.entity.dao import gamedata
    _, clientVer, _ = strutil.parseClientId(clientId)
    checkinVer = gamedata.getGameAttrInt(userId, gameId, 'checkinVer')
    ret = []
    todotask = None
    if clientVer < 3.76:
        if checkinVer != 1:
            states = halldailycheckin.dailyCheckin.getStates(
                gameId, userId, timestamp)
            if not TodoTaskHelper.canGainReward(states):
                if ftlog.is_debug():
                    ftlog.debug('hallpopwnd.makeTodoTaskNsloginReward gameId=',
                                gameId, 'userId=', userId, 'clientId=',
                                clientId, 'states=', states, 'err=',
                                'CannotGainReward')
            else:
                todotask = TodoTaskNsloginReward(
                    TodoTaskHelper.translateDailyCheckinStates(states))
                todotask.setMemberInfo(remainDays > 0, remainDays, memberBonus)
        nextTodotask = makeTodoTaskByTemplate(gameId, userId, clientId,
                                              'memberBuy2')
        #获取玩家会员信息
        memberInfo = hallitem.getMemberInfo(userId, timestamp)
        remainDays = memberInfo[0]
        # 如果已经是会员,或者没有配会员商品,则改为特惠商品
        if remainDays > 0 or not nextTodotask:
            nextTodotask = makeTodoTaskByTemplate(gameId, userId, clientId,
                                                  'recommendBuy')
        if todotask and nextTodotask:
            todotask.setParam('sub_action_click', nextTodotask)
        if todotask:
            ret.append(todotask)
        elif nextTodotask:
            ret.append(nextTodotask)
    else:
        #3.76的处理流程

        startFlow = hallconf.getStartFlowConf()
        gen = TodoTasksGeneratorRegister.decodeFromDict(startFlow)
        todotasks = gen.makeTodoTasks(gameId,
                                      userId,
                                      clientId,
                                      timestamp,
                                      isDayFirstLogin=isdayfirst)
        ftlog.info('makeTodoTaskNsloginReward todotasks =', todotasks,
                   'userId =', userId, 'gameId =', gameId, 'clientId =',
                   clientId, 'remainDays =', remainDays, 'isdayfirst =',
                   isdayfirst, 'memberBonus =', memberBonus)
        if todotasks:
            ret.extend(todotasks)
        else:
            tempPay = makeTodoTaskByTemplate(gameId, userId, clientId,
                                             'recommendBuy')
            if tempPay:
                ret.append(tempPay)
            else:
                tempObj = makeTodoTaskByTemplate(gameId, userId, clientId,
                                                 'activity')
                if tempObj:
                    ret.append(tempObj)
    if ftlog.is_debug():
        ftlog.debug('hallpopwnd.makeTodoTaskNsloginReward gameId=', gameId,
                    'userId=', userId, 'clientId=', clientId, 'ret=', ret)
    return ret
Пример #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 getTodoTasksAfterLogin(self, userId, gameId, clientId, isdayfirst):
        '''
        获取登录后的todotasks列表
        '''
        from hall.entity import hallitem, hallstartchip, hallpopwnd
        # 每日登录奖励,以前在各个游戏,现在移到大厅
        ret = []
        # 3.7以前9999没有todotask; 新大厅v4.56 9999走新的弹窗系统;
        _, clientVer, _ = strutil.parseClientId(clientId)
        if clientVer < 3.7 or clientVer >= 4.56:
            return ret

        if clientVer < client_ver_judge.client_ver_397:
            if hallstartchip.AlreadySendStartChip(userId, gameId) == False:
                # 需要弹启动资金领取弹框
                assetKind = hallitem.itemSystem.findAssetKind(
                    hallitem.ASSET_ITEM_NEWER_GIFT_KIND_ID)
                pic = assetKind.pic if assetKind else ''
                if ftlog.is_debug():
                    ftlog.debug('TGHall.getTodoTasksAfterLogin userId=',
                                userId, 'gameId=', gameId, 'clientId=',
                                clientId, 'isDayFirst=', isdayfirst,
                                'assetKind=', assetKind)
                ret.append(
                    TodoTaskIssueStartChip(
                        hallstartchip.getCanGivestartChip(
                            userId, gameId, clientId), 0, pic, ""))
        else:
            if hallstartchip.AlreadySendStartChip(userId, gameId) == False:
                #没有领取过启动资金
                initItems = hallitem._getInitItemsByClientId(userId, clientId)
                if (hallstartchip.newuser_startchip <= 0) and (len(initItems)
                                                               == 0):
                    #既不发启动资金,也没有配置新手礼包
                    pass
                else:
                    pic = ""
                    displayName = ""
                    assetKind = None
                    for itemKind, _ in initItems:
                        pic = itemKind.pic if itemKind else ''
                        displayName = itemKind.displayName if itemKind else ''
                        assetKind = assetKind
                    if ftlog.is_debug():
                        ftlog.debug('TGHall.getTodoTasksAfterLogin userId=',
                                    userId, 'gameId=', gameId, 'clientId=',
                                    clientId, 'isDayFirst=', isdayfirst,
                                    'assetKind=', assetKind)
                    ret.append(
                        TodoTaskIssueStartChip(hallstartchip.newuser_startchip,
                                               0, pic, displayName))

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

        nsloginTodotaskList = hallpopwnd.makeTodoTaskNsloginReward(
            gameId, userId, clientId, remainDays, memberBonus, isdayfirst)

        if ftlog.is_debug():
            ftlog.debug('TGHall.getTodoTasksAfterLogin gameId=', gameId,
                        'userId=', userId, 'clientId=', clientId,
                        'nsloginTodotaskList=', nsloginTodotaskList)

        if nsloginTodotaskList:
            ret.extend(nsloginTodotaskList)

        # ios 提示更新
        iosUpgrade = hallpopwnd.makeTodoTaskByTemplate(gameId, userId,
                                                       clientId, 'iosUpgrade')
        if iosUpgrade:
            ret.append(iosUpgrade)

        return ret
Пример #6
0
    def getTodoTasksAfterLogin(self, userId, gameId, clientId, isdayfirst):
        '''
        获取登录后的todotasks列表
        '''
        from dizhu.entity import dizhuflipcard
        
        _, clientVer, _ = strutil.parseClientId(clientId)
        
        ftlog.debug('TGDizhu.getTodoTasksAfterLogin userId=', userId,
                    'gameId=', gameId,
                    'clientId=', clientId,
                    'isdayfirst=', isdayfirst)

        if clientVer >= 3.7:
            return

        ret = []
        timestamp = pktimestamp.getCurrentTimestamp()

        #连续登录奖励
        todotask = TodoTaskHelper.makeTodoTaskNsloginReward(gameId, userId, clientId)
        if todotask:
            ret.append(todotask)

        status = dizhuflipcard.flipCard.loadStatus(userId, timestamp)
        todotask = TodoTaskFlipCard(status.nslogin, False,
                                    dizhuflipcard.encodePaddings(status.paddings),
                                    status.getRemFlipCount(),
                                    dizhuflipcard.encodeFlipCardMap(status.itemMap))
        ret.append(todotask)


        #ios 提示更新
        iosUpgrade = hallpopwnd.makeTodoTaskByTemplate(gameId, userId, clientId, 'iosUpgrade')
        if iosUpgrade:
            ret.append(iosUpgrade)
        else:
            ftlog.debug('iosUpgrade not find')


        # 特殊弹框
        todotask = dizhutodotask.makeBeforeActivityTodoTasks(gameId, userId, clientId)
        if todotask:
            ret.append(todotask)

        #活动数据
        if not self._needSendStartChip(gameId, userId, clientId):
            conf = dizhuconf.getPopActivityTemplate(clientId)
            if conf:
                todotask = dizhutodotask.makeTodoTaskPopActivity(gameId, userId, clientId, conf)
                if todotask:
                    ret.append(todotask)

        #退出框
        ret.append(TodoTaskExit(1))

        if ftlog.is_debug():
            ftlog.debug('TGDizhu.getTodoTasksAfterLogin userId=', userId,
                        'gameId=', gameId,
                        'clientId=', clientId,
                        'isdayfirst=', isdayfirst,
                        'ret=', [t.getAction() for t in ret])
        return ret