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


Python TodoTaskHelper.encodeTodoTasks方法代码示例

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


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

示例1: encodePromote

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
 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,代码行数:30,代码来源:promotion_loc_handler.py

示例2: enterFriendTable

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
    def enterFriendTable(self, userId, gameId, clientId, ftId):
        """进入自建桌,插件实现具体功能"""
        if ftlog.is_debug():
            ftlog.debug('MAJIANG enterFriendTable userId:', userId
                        , ' gameId:', gameId
                        , ' clientId:', clientId
                        , ' ftId:', ftId)

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

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

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

        todotask = TodoTaskEnterGameNew(GAMEID, config)
        mo = MsgPack()
        mo.setCmd('todo_tasks')
        mo.setResult('gameId', gameId)
        mo.setResult('pluginId', GAMEID)
        mo.setResult('userId', userId)
        mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
        router.sendToUser(mo, userId)
开发者ID:zhaozw,项目名称:hall37,代码行数:37,代码来源:game.py

示例3: buildUpLevelTodoTasks

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
 def buildUpLevelTodoTasks(cls, gameId, userVip, clientId):
     deltaExp = userVip.deltaExpToNextLevel()
     if deltaExp > 0:
         payOrder = strutil.cloneData(hallvip.vipSystem.getLevelUpPayOrder())
         payOrder['priceDiamond'] = {'count': deltaExp, 'minCount': 0, 'maxCount': -1}
         product, _ = hallstore.findProductByPayOrder(gameId, userVip.userId, clientId, payOrder)
         if product:
             return TodoTaskHelper.encodeTodoTasks(TodoTaskPayOrder(product))
     return []
开发者ID:zhaozw,项目名称:hall37,代码行数:11,代码来源:vip_handler.py

示例4: encodeAds

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
 def encodeAds(cls, gameId, userId, clientId, ads):
     ret = {
         'id': ads.adsId,
         'clickable': ads.clickable,
         'pic': ads.pic
     }
     if ads.clickable and ads.todotasks:
         todotasks = []
         for todotaskFac in ads.todotasks:
             todotask = todotaskFac.newTodoTask(gameId, userId, clientId)
             if todotask:
                 todotasks.append(todotask)
         if todotasks:
             ret['tasks'] = TodoTaskHelper.encodeTodoTasks(todotasks)
     return ret
开发者ID:zhaozw,项目名称:hall37,代码行数:17,代码来源:ads_handler.py

示例5: doJoinCreateTable

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
    def doJoinCreateTable(self, userId, gameId, clientId, roomId0, tableId0, playMode):
        """用户加入自建牌桌
        """
        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
            ftlog.warn('create_table error, user in table')
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                "type": "quickstart",
                "pluginParams": {
                    "roomId": lroomId,
                    "tableId": ltableId,
                    "seatId": lseatId
                }
            }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        else:
            msg = runcmd.getMsgPack()
            createTableNo = msg.getParam('createTableNo', 0)
            if not createTableNo:
                return
            tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(createTableNo)
            if not tableId0 or not roomId0:
                sendPopTipMsg(userId, "找不到您输入的房间号")
                return
            msg = runcmd.getMsgPack()
            msg.setParam("shadowRoomId", roomId0)
            msg.setParam("roomId", roomId0)
            msg.setParam("tableId", tableId0)
            msg.setCmdAction("room", "join_create_table")
            router.sendRoomServer(msg, roomId0)

            if router.isQuery():
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
开发者ID:zhaozw,项目名称:hall37,代码行数:46,代码来源:game_handler.py

示例6: queryExitRemind

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
def queryExitRemind(gameId, userId, clientId):
    exitSDK = queryExitSDK(gameId, userId, clientId)
    if ftlog.is_debug():
        ftlog.debug('queryExitRemind exitSDK:', exitSDK)

    gameIdInClientId = strutil.getGameIdFromHallClientId(clientId)
    if ftlog.is_debug():
        ftlog.debug('hall_exit_remind.queryExitRemind gameIdInClientId', gameIdInClientId)

    strGameId = str(gameIdInClientId)
    if strGameId not in hall_exit_remind._ordersMap:
        if ftlog.is_debug():
            ftlog.debug('hall_exit_remind.queryExitRemind no this game exit remind config....')
        return

    orders = hall_exit_remind._ordersMap[strGameId]
    if ftlog.is_debug():
        ftlog.debug('hall_exit_remind.queryExitRemind orders:', orders)

    for order in orders:
        if ftlog.is_debug():
            ftlog.debug('hall_exit_remind.queryExitRemind order:', order)

        conds = UserConditionRegister.decodeList(order.get('conditions', []))
        if ftlog.is_debug():
            ftlog.debug('hall_exit_remind.queryExitRemind conds:', conds)

        bCondsOK = False
        if len(conds) == 0:
            bCondsOK = True

        for cond in conds:
            if cond.check(HALL_GAMEID, userId, clientId, pktimestamp.getCurrentTimestamp()):
                if ftlog.is_debug():
                    ftlog.debug('hall_exit_remind.queryExitRemind cond ok: ', cond)
                bCondsOK = True
                break

        if bCondsOK:
            todotasksDict = order.get('todotasks', [])
            todotasks = TodoTaskRegister.decodeList(todotasksDict)
            if ftlog.is_debug():
                ftlog.debug('hall_exit_remind.queryExitRemind todotasks:', todotasks)

            todos = TodoTaskHelper.makeTodoTasksByFactory(HALL_GAMEID, userId, clientId, todotasks)
            tasks = TodoTaskHelper.encodeTodoTasks(todos)
            if ftlog.is_debug():
                ftlog.debug('hall_exit_remind.queryExitRemind build tasks ok: ', tasks)

            mo = MsgPack()
            mo.setCmd('game')
            mo.setResult('action', 'get_exit_remind')
            mo.setResult('gameId', gameId)
            mo.setResult('userId', userId)
            mo.setResult('button', order.get('button', ''))
            mo.setResult('tips', order.get('tips', ''))
            mo.setResult('tasks', tasks)
            mo.setResult('exitSDK', exitSDK)
            router.sendToUser(mo, userId)

            if ftlog.is_debug():
                ftlog.debug('hall_exit_remind.queryExitRemind userId:', userId, ' clientId:', clientId, ' msg:', mo)

            return
开发者ID:zhaozw,项目名称:hall37,代码行数:66,代码来源:hotfix_hall_exit_remind.py

示例7: _buildToDictImpl

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
 def _buildToDictImpl(self, gameId, userId, clientId, d):
     todotasks = TodoTaskHelper.makeTodoTasksByFactory(gameId, userId, clientId, self.todotasks)
     d['tasks'] = TodoTaskHelper.encodeTodoTasks(todotasks)
     d['params'] = self.params
开发者ID:zhaozw,项目名称:hall37,代码行数:6,代码来源:hallgamelist2.py

示例8: doCreateTable

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
    def doCreateTable(self, userId, gameId, clientId, roomId0, tableId0, playMode):
        """
        房主创建牌桌
        """
        if not playMode:
            ftlog.error('game_handler, cat not create table without playMode...')

        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
            ftlog.warn('create_table error, user in table', lgameId, lroomId, ltableId, lseatId)
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                "type": "quickstart",
                "pluginParams": {
                    "roomId": lroomId,
                    "tableId": ltableId,
                    "seatId": lseatId
                }
            }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        elif self._canEnterGame(userId, gameId):
            # 保存建桌时间戳
            gamedata.setGameAttr(userId, gameId, 'createTableTime', pktimestamp.getCurrentTimestamp())

            msg = runcmd.getMsgPack()
            itemParams = msg.getParam("itemParams")
            # cardCount为总局数
            if "cardCount" in itemParams:
                cardCountId = itemParams.get('cardCount', 0)
                cardCountConfig = majiang_conf.getCreateTableConfig(gameId, playMode, 'cardCount', cardCountId)
                fangka_count = cardCountConfig.get('fangka_count', 1)
                ftlog.debug('MajiangCreateTable.create_table fangka_count:', fangka_count)

                playerCount = 4
                playerTypeId = itemParams.get('playerType', 1)
                if playerTypeId:
                    playerTypeConfig = majiang_conf.getCreateTableConfig(gameId, playMode, 'playerType', playerTypeId)
                    playerCount = playerTypeConfig.get('count', 4)
                    ftlog.debug('MajiangCreateTable.create_table playerCount:', playerCount)

                msg.setParam('isCreateTable', 1)  # 标记创建的桌子是 自建桌
                from poker.entity.game.rooms.room import TYRoom
                roomId, checkResult = MajiangCreateTable._chooseCreateRoom(userId, gameId, playMode, playerCount)
                ftlog.debug('MajiangCreateTable._chooseCreateRoom roomId:', roomId, ' checkResult:', checkResult)

                if checkResult == TYRoom.ENTER_ROOM_REASON_OK:
                    msg = runcmd.getMsgPack()
                    msg.setCmdAction("room", "create_table")
                    msg.setParam("roomId", roomId)
                    msg.setParam("itemParams", itemParams)
                    msg.setParam('needFangka', fangka_count)
                    ftlog.debug('MajiangCreateTable._chooseCreateRoom send message to room:', msg)

                    router.sendRoomServer(msg, roomId)
                else:
                    sendPopTipMsg(userId, "暂时无法创建请稍后重试")
            else:
                sendPopTipMsg(userId, "暂时无法创建请稍后重试")

            if router.isQuery():
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
        else:
            ftlog.info('majiang2 game_handler, ignore enter game request...')
开发者ID:zhaozw,项目名称:hall37,代码行数:75,代码来源:game_handler.py

示例9: doCreateTable

# 需要导入模块: from hall.entity.todotask import TodoTaskHelper [as 别名]
# 或者: from hall.entity.todotask.TodoTaskHelper import encodeTodoTasks [as 别名]
    def doCreateTable(self, userId, gameId, clientId, roomId0, tableId0, playMode, hasRobot = 0):
        
        #临时硬编码,解决91晃晃提审问题
        if gameId==791 and playMode=="queshou-lianjiang" and clientId=="IOS_3.901_weixin.appStore,weixinPay.0-hall791.queshou.iostsljmj":
            hasRobot=1
	if gameId == 790 and playMode == 'luosihu-luosihuts' and clientId=="IOS_3.901_weixin.appStore,weixinPay.0-hall790.laodao.iostsxjmj":
	    hasRobot=1
        """房主创建牌桌"""
        if not playMode:
            ftlog.error('game_handler, cat not create table without playMode...')
        
        loc = onlinedata.checkUserLoc(userId, clientId, gameId)
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = strutil.parseInts(lgameId, lroomId, ltableId, lseatId)
        if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >=0:
            ftlog.warn('create_table error, user in table',lgameId, lroomId, ltableId, lseatId)
            sendPopTipMsg(userId, "请稍候,正在进桌...")
            config = {
                      "type":"quickstart",
                      "pluginParams": {
                          "roomId": lroomId,
                          "tableId": ltableId,
                          "seatId": lseatId
                          }
                      }
            todotask = TodoTaskEnterGameNew(lgameId, config)
            mo = MsgPack()
            mo.setCmd('todo_tasks')
            mo.setResult('gameId', gameId)
            mo.setResult('pluginId', lgameId)
            mo.setResult('userId', userId)
            mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
            router.sendToUser(mo, userId)
        elif self._canEnterGame(userId, gameId):
            # 保存建桌时间戳
            gamedata.setGameAttr(userId, gameId, 'createTableTime', pktimestamp.getCurrentTimestamp())
            
            msg = runcmd.getMsgPack()
            itemParams = msg.getParam("itemParams")
            
            playerCount = 4
            playerTypeId = itemParams.get(MFTDefine.PLAYER_TYPE, 1)
            playerTypeConfig = majiang_conf.getCreateTableConfig(gameId, playMode, MFTDefine.PLAYER_TYPE, playerTypeId)
            if not playerTypeConfig:
                sendPopTipMsg(userId, '人数配置有误,请稍后重试')
                return
            
            playerCount = playerTypeConfig.get('count', 4)
            ftlog.debug('MajiangCreateTable.create_table playerCount:', playerCount)
            cardCountKey = playerTypeConfig.get(MFTDefine.CARD_COUNT, MFTDefine.CARD_COUNT)

            cardCountId = itemParams.get(cardCountKey, 0)
            cardCountConfig = majiang_conf.getCreateTableConfig(gameId, playMode, cardCountKey, cardCountId)
            if not cardCountConfig:
                sendPopTipMsg(userId, '房卡配置有误,请稍后重试')
                return
            
            if hasRobot == 1 and 'hasRobot' in cardCountConfig:
                cardCountConfig = cardCountConfig.get('hasRobot', {})
                ftlog.debug('MajiangCreateTable.create_table hasRobot == 1:')
            fangka_count = cardCountConfig.get('fangka_count', 1)
            ftlog.debug('MajiangCreateTable.create_table fangka_count:', fangka_count
                        , ' cardCountConfig:', cardCountConfig)
            
            msg.setParam('isCreateTable', 1) #标记创建的桌子是 自建桌
            from poker.entity.game.rooms.room import TYRoom
            '''
            根据五个因素筛选合适的房间
            1)gameId         游戏ID
            2)playMode       游戏玩法
            3)playerCount    玩家个数
            4)hasRobot       是否有机器人
            5)itemId         房卡道具
            '''
            itemId = hall_fangka.queryFangKaItem(gameId, userId, clientId)
            if itemId:
                ftlog.debug('MajiangCreateTable._chooseCreateRoom fangKa itemId:', itemId)
            roomId, checkResult = MajiangCreateTable._chooseCreateRoom(userId, gameId, playMode, playerCount, hasRobot, itemId)
            ftlog.debug('MajiangCreateTable._chooseCreateRoom roomId:', roomId, ' checkResult:', checkResult)

            if checkResult==TYRoom.ENTER_ROOM_REASON_OK:
                msg = runcmd.getMsgPack()
                msg.setCmdAction("room", "create_table")
                msg.setParam("roomId", roomId)
                msg.setParam("itemParams", itemParams)
                msg.setParam('needFangka', fangka_count)
                ftlog.debug('MajiangCreateTable._chooseCreateRoom send message to room:', msg)

                router.sendRoomServer(msg, roomId)
            else:
                sendPopTipMsg(userId, "暂时无法创建请稍后重试")
                
            if router.isQuery() :
                mo = runcmd.newOkMsgPack(1)
                router.responseQurery(mo, '', str(userId))
        else:
            ftlog.info('majiang2 game_handler, ignore enter game request...')
开发者ID:zhaozw,项目名称:mjserver,代码行数:99,代码来源:game_handler.py


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