当前位置: 首页>>代码示例>>Python>>正文


Python todotask.TodoTaskHelper类代码示例

本文整理汇总了Python中hall.entity.todotask.TodoTaskHelper的典型用法代码示例。如果您正苦于以下问题:Python TodoTaskHelper类的具体用法?Python TodoTaskHelper怎么用?Python TodoTaskHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TodoTaskHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sendBenefits

    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)
开发者ID:zhaozw,项目名称:hall37,代码行数:31,代码来源:hallbenefits.py

示例2: buildFlipCardResponse

    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
开发者ID:zhaozw,项目名称:hall37,代码行数:32,代码来源:flipcardluck_handler.py

示例3: _doChangeNameTry

 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))
开发者ID:zhaozw,项目名称:hall37,代码行数:27,代码来源:account_handler.py

示例4: enterFriendTable

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)
开发者ID:zhaozw,项目名称:hall37,代码行数:29,代码来源:hall_friend_table.py

示例5: encodePromote

 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
开发者ID:zhaozw,项目名称:hall37,代码行数:28,代码来源:promotion_loc_handler.py

示例6: processInvitees

 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('您的好友当前不在线')
开发者ID:zhaozw,项目名称:hall37,代码行数:32,代码来源:friend_handler.py

示例7: doGetTaskReward

    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)
开发者ID:zhaozw,项目名称:hall37,代码行数:29,代码来源:neituiguang_new_handler.py

示例8: on_praise_friend

    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])
开发者ID:zhaozw,项目名称:hall37,代码行数:58,代码来源:httpgame.py

示例9: doAssistanceGet

 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)
开发者ID:zhaozw,项目名称:hall37,代码行数:9,代码来源:vip_handler.py

示例10: onUserVipLevelUp

 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)
开发者ID:zhaozw,项目名称:hall37,代码行数:9,代码来源:vip_handler.py

示例11: doBuyProduct

 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))
开发者ID:zhaozw,项目名称:hall37,代码行数:9,代码来源:store_handler.py

示例12: onRoomCreateCustomTable

    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})
开发者ID:zhaozw,项目名称:hall37,代码行数:56,代码来源:custom_room_plugin.py

示例13: on_ready_invite_friend

 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])
开发者ID:zhaozw,项目名称:hall37,代码行数:10,代码来源:httpgame.py

示例14: doGameGetMemberReward

 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('恭喜您领取了今天的会员福利'))
开发者ID:zhaozw,项目名称:hall37,代码行数:10,代码来源:game_handler.py

示例15: sendTodoTaskResponse

 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)
开发者ID:zhaozw,项目名称:hall37,代码行数:11,代码来源:util_helper.py


注:本文中的hall.entity.todotask.TodoTaskHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。