예제 #1
0
 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))
예제 #2
0
파일: todotask.py 프로젝트: zhaozw/mjserver
def sendFriendInviteTodotask(userId, invite_uid, gameId, play_mode, roomId, tableId, info_str, purl):
    """ 推送牌桌好友邀请的todotask
    * 版本 3.732 之后,改为麻将自己的todotask
    """
    todotask = TodoTaskQuickStart(gameId, roomId, tableId)
    todotask.setParam('play_mode', play_mode)
    client_ver = sessiondata.getClientIdVer(userId)

    if client_ver < 3.732:
        show_info_ = TodoTaskShowInfo(info_str, True)
        show_info_.setSubCmd(todotask)
        msg = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, show_info_)
        router.sendToUser(msg, userId)
    else:
        task = {
                'action':       'pop_wnd_invite',
                'params':       {
                                 'tasks':       [todotask.toDict()],
                                 'invite_uid':   invite_uid,
                                 'purl':         purl,
                                 'info_str':     info_str
                                 }
                }
        mo = MsgPack()
        mo.setCmd('majiang_todotasks')
        mo.setResult('gameId', gameId)
        mo.setResult('userId', userId)
        mo.setResult('tasks', [task])
        router.sendToUser(mo, userId)
예제 #3
0
 def _sendTodoTaskJumpHighRoom(cls, userId, playMode, clientId):
     # todo fix the pop wnd to ddz's
     if not playMode in dizhuconf.PLAYMODE_ALLSET:
         playMode = dizhuconf.PLAYMODE_DEFAULT
     chosenRoomId, _ = cls._chooseRoom(userId, DIZHU_GAMEID, playMode)
     if chosenRoomId:
         quick_start_ = TodoTaskQuickStart(DIZHU_GAMEID, chosenRoomId)
         info_str_ = dizhuconf.getQuickStartErrorMsg(
             TYRoom.ENTER_ROOM_REASON_GREATER_MAX)
         show_info_ = TodoTaskShowInfo(info_str_, True)
         show_info_.setSubCmd(quick_start_)
         try:
             if cls._useSelfPopWnd(userId):
                 todoTaskObj = TodoTaskHelper.encodeTodoTasks(quick_start_)
                 Alert.sendNormalAlert2Button(DIZHU_GAMEID, userId, '提示',
                                              info_str_, todoTaskObj[0],
                                              '确定', None, '取消')
                 return
         except:
             ftlog.error('_sendTodoTaskJumpHighRoom error userId = ',
                         userId, ' clientId = ', clientId, 'playMode = ',
                         playMode)
         msg = TodoTaskHelper.makeTodoTaskMsg(DIZHU_GAMEID, userId,
                                              show_info_)
         router.sendToUser(msg, userId)
     else:
         cls._sendTodoTaskToUser(userId,
                                 TYRoom.ENTER_ROOM_REASON_GREATER_ALL)
예제 #4
0
 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))
예제 #5
0
파일: todotask.py 프로젝트: zhaozw/mjserver
def sendFriendInviteTodotask(userId, invite_uid, gameId, play_mode, roomId,
                             tableId, info_str, purl):
    """ 推送牌桌好友邀请的todotask
    * 版本 3.732 之后,改为麻将自己的todotask
    """
    todotask = TodoTaskQuickStart(gameId, roomId, tableId)
    todotask.setParam('play_mode', play_mode)
    client_ver = sessiondata.getClientIdVer(userId)

    if client_ver < 3.732:
        show_info_ = TodoTaskShowInfo(info_str, True)
        show_info_.setSubCmd(todotask)
        msg = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, show_info_)
        router.sendToUser(msg, userId)
    else:
        task = {
            'action': 'pop_wnd_invite',
            'params': {
                'tasks': [todotask.toDict()],
                'invite_uid': invite_uid,
                'purl': purl,
                'info_str': info_str
            }
        }
        mo = MsgPack()
        mo.setCmd('majiang_todotasks')
        mo.setResult('gameId', gameId)
        mo.setResult('userId', userId)
        mo.setResult('tasks', [task])
        router.sendToUser(mo, userId)
예제 #6
0
파일: httpgame.py 프로젝트: zhaozw/hall37
    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])
예제 #7
0
    def onCmdQuickStart1(cls, msg, userId, gameId, roomId, tableId, playMode,
                         clientId):
        '''
        拦截父类处理的选择房间逻辑,先于父类处理,若选择成功,则不进行父类的选择房间处理逻辑,否则正常走父类的处理逻辑
        '''

        if not pokerconf.isOpenMoreTable(clientId):
            ok, loc = cls.checkUserLoc(userId, gameId, roomId, tableId,
                                       clientId)
            if not ok:
                # 弹框
                tipsPlaying = dizhuconf.getPublicConf('tips.playing',
                                                      '您正在其它房间对局,是否回去?')
                showInfo = TodoTaskShowInfo(tipsPlaying)
                showInfo.setSubCmd(
                    TodoTaskQuickStart(loc[0], loc[1], loc[2], loc[3]))
                TodoTaskHelper.sendTodoTask(gameId, userId, showInfo)
                ftlog.debug('DizhuQuickStartV4_0.onCmdQuickStart Fail userId=',
                            userId, 'roomId=', roomId, 'tableId=', tableId,
                            'clientId=', clientId, 'loc=', loc)
                return
            if loc:
                tableId = loc[2]

        _, version, _ = strutil.parseClientId(clientId)
        ftlog.debug("DizhuQuickStartV4_0.onCmdQuickStart: clientId=", clientId,
                    "userId=", userId, "roomId=", roomId,
                    "tableId=", tableId, "version=", version, "type:",
                    type(version), "playMode=", playMode)

        # 地主会优先去匹配比赛的房间,客户端是3.76及更高版本才支持
        if (playMode == None or playMode == "match" or playMode
                == "straightMatch") and roomId == 0 and gameId == 6 and (
                    version >= 3.76 or
                    (version >= 3.73
                     and not (clientId in _DIZHU_QMATCH_V3_73_IGNORE))):
            chose_roomid, ok = cls._chooseDizhuMatchRoom(
                userId, gameId, playMode)
            ftlog.debug(
                "DizhuQuickStartV4_0._chooseDizhuMatchRoom:chosen|room_id=",
                chose_roomid, "userId=", userId, "ok=", ok)
            if ok:
                bigroomid = gdata.getBigRoomId(chose_roomid)
                ftlog.debug(
                    "DizhuQuickStartV4_0._chooseDizhuMatchRoom: userId=",
                    userId, "roomId=", chose_roomid)
                cls.notifyQuickGotoDizhuMatch(gameId, userId, bigroomid)
                return

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

        super(DizhuQuickStartV4_0,
              cls).onCmdQuickStart(msg, userId, gameId, roomId, tableId,
                                   playMode, clientId)
        return
예제 #8
0
 def _doChangeNameCheck(self, userId, clientId):
     canRename, desc = hallrename.checkRename(HALL_GAMEID, userId)
     if canRename:
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskRename(desc))
     else:
         info = TodoTaskShowInfo(desc, 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)
예제 #9
0
 def _doChangeNameCheck(self, userId, clientId):
     canRename, desc = hallrename.checkRename(HALL_GAMEID, userId)
     if canRename:
         return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskRename(desc))
     else:
         info = TodoTaskShowInfo(desc, 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)
예제 #10
0
    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)

        CLIENT_VER = 4.57
        _, clientVer, _ = strutil.parseClientId(clientId)

        if ftlog.is_debug():
            ftlog.debug("_doChangeNameTry clientVer", userId, clientId, newName, code, info, clientVer)

        reInfo = ""
        if code == -3 :
            reInfo = "昵称没有变化"
        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 :
            reInfo = "昵称修改成功"
            # 改名成功
            if clientVer < CLIENT_VER:
                if ftlog.is_debug():
                    ftlog.debug("_doChangeNameTry ok", userId, clientId, newName, code, info, clientVer)
                return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip(hallrename.stringRenameSuccessed))
        else:
            #reInfo = "修改昵称失败,请重试"
            reInfo = info
            # SDK改名失败
            if clientVer < CLIENT_VER:
                if ftlog.is_debug():
                    ftlog.debug("_doChangeNameTry fail", userId, clientId, newName, code, info, clientVer)
                return TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, TodoTaskPopTip(info))
                    
        mo = MsgPack()
        mo.setCmd('change_name')
        mo.setResult('action', 'try')
        mo.setResult('userId', userId)
        mo.setResult('code', code)
        mo.setResult('reInfo', reInfo)
        router.sendToUser(mo, userId)
        if ftlog.is_debug():
            ftlog.debug("_doChangeNameTry result",userId, clientId, newName, code, reInfo)
예제 #11
0
 def handleItemBindingsException(self, itemId, gameId, userId, clientId, e):
     showInfo = TodoTaskShowInfo(e.message)
     payOrder = e.itemBindings.getParam('payOrder')
     if payOrder:
         product, shelves = hallstore.findProductByPayOrder(gameId, userId, clientId, payOrder)
         if product:
             showInfo.setSubCmd(TodoTaskGotoShop(shelves.name))
     else:
         todotask = e.itemBindings.getParam('todotask')
         if todotask:
             todotask = TodoTaskRegister.decodeFromDict(todotask).newTodoTask(gameId, userId, clientId)
             TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
             return
     TodoTaskHelper.sendTodoTask(gameId, userId, showInfo)
예제 #12
0
 def handleItemActionConditionException(self, itemId, gameId, userId, clientId, e):
     showInfo = TodoTaskShowInfo(e.message)
     payOrder = e.condition.getParam('payOrder')
     if payOrder:
         product, shelves = hallstore.findProductByPayOrder(gameId, userId, clientId, payOrder)
         if product:
             showInfo.setSubCmd(TodoTaskGotoShop(shelves.name))
     else:
         todotask = e.condition.getParam('todotask')
         if todotask:
             factory = hallpopwnd.decodeTodotaskFactoryByDict(todotask)
             if factory:
                 todotask = factory.newTodoTask(gameId, userId, clientId)
                 TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
                 return
     TodoTaskHelper.sendTodoTask(gameId, userId, showInfo)
예제 #13
0
 def handleItemBindingsException(self, itemId, gameId, userId, clientId, e):
     showInfo = TodoTaskShowInfo(e.message)
     payOrder = e.itemBindings.getParam('payOrder')
     if payOrder:
         product, shelves = hallstore.findProductByPayOrder(
             gameId, userId, clientId, payOrder)
         if product:
             showInfo.setSubCmd(TodoTaskGotoShop(shelves.name))
     else:
         todotask = e.itemBindings.getParam('todotask')
         if todotask:
             todotask = TodoTaskRegister.decodeFromDict(
                 todotask).newTodoTask(gameId, userId, clientId)
             TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
             return
     TodoTaskHelper.sendTodoTask(gameId, userId, showInfo)
예제 #14
0
파일: todotask.py 프로젝트: zhaozw/hall37
def sendFriendInviteEnterGameTodotask(userId, gameId, play_mode, roomId, tableId, info_str):
    """ 构造从大厅主界面进桌子的todotask
    """
    enter_param = {
        'type': 'quickstart',
        'pluginParams': {
            'play_mode': play_mode,
            'roomId': roomId,
            'tableId': tableId,
            'gameType': 9  # TODO: 写死了9,因为目前只有贵宾桌使用到了这个功能
        }
    }
    todotask = TodoTaskEnterGameNew(gameId, enter_param)
    show_info_ = TodoTaskShowInfo(info_str, True)
    show_info_.setSubCmd(todotask)
    msg = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, show_info_)
    router.sendToUser(msg, userId)
예제 #15
0
파일: todotask.py 프로젝트: zhaozw/mjserver
def sendFriendInviteEnterGameTodotask(userId, gameId, play_mode, roomId, tableId, info_str):
    """ 构造从大厅主界面进桌子的todotask
    """
    enter_param = {
                 'type':         'quickstart',
                 'pluginParams': {
                     'play_mode':       play_mode,
                     'roomId':          roomId,
                     'tableId':         tableId,
                     'gameType':        9   # TODO: 写死了9,因为目前只有贵宾桌使用到了这个功能
                 }
            }
    todotask = TodoTaskEnterGameNew(gameId, enter_param)
    show_info_ = TodoTaskShowInfo(info_str, True)
    show_info_.setSubCmd(todotask)
    msg = TodoTaskHelper.makeTodoTaskMsg(gameId, userId, show_info_)
    router.sendToUser(msg, userId)
예제 #16
0
    def doQuickBuyGetInfo(self, gameId, userId):
        clientId = sessiondata.getClientId(userId)
        toStoreTodotask = TodoTaskGotoShop('coin')
        if hallstore.storeSystem.isCloseLastBuy(clientId):
            TodoTaskHelper.sendTodoTask(gameId, userId, toStoreTodotask)
            return

        lastBuyProduct, _lastBuyClientId = hallstore.storeSystem.getLastBuyProduct(
            gameId, userId)
        if (not lastBuyProduct or not lastBuyProduct.recordLastBuy
                or not hallstore.storeSystem.canBuyProduct(
                    gameId, userId, clientId, lastBuyProduct, 1)):
            if hallstore.storeSystem.lastBuyConf.payOrder:
                product, _ = hallstore.findProductByPayOrder(
                    gameId, userId, clientId,
                    hallstore.storeSystem.lastBuyConf.payOrder)
                if product:
                    payOrderTodoTask = TodoTaskPayOrder(product)
                    desc = strutil.replaceParams(
                        hallstore.storeSystem.lastBuyConf.desc2, {
                            'product.displayName': product.displayName,
                            'product.price': product.price
                        })
                    popInfoTodoTask = TodoTaskShowInfo(desc, True)
                    popInfoTodoTask.setSubCmd(payOrderTodoTask)
                    TodoTaskHelper.sendTodoTask(gameId, userId,
                                                popInfoTodoTask)
                    return
            TodoTaskHelper.sendTodoTask(gameId, userId, toStoreTodotask)
            return

        payOrderTodoTask = TodoTaskPayOrder(lastBuyProduct)
        desc = strutil.replaceParams(
            hallstore.storeSystem.lastBuyConf.desc, {
                'product.displayName': lastBuyProduct.displayName,
                'product.price': lastBuyProduct.price
            })
        popInfoTodoTask = TodoTaskShowInfo(desc, True)
        popInfoTodoTask.setSubCmd(payOrderTodoTask)
        popInfoTodoTask.setSubText(hallstore.storeSystem.lastBuyConf.subText)

        popInfoTodoTask.setSubCmdExt(toStoreTodotask)
        popInfoTodoTask.setSubTextExt(
            hallstore.storeSystem.lastBuyConf.subTextExt)
        TodoTaskHelper.sendTodoTask(gameId, userId, popInfoTodoTask)
예제 #17
0
 def handleItemActionConditionException(self, itemId, gameId, userId,
                                        clientId, e):
     showInfo = TodoTaskShowInfo(e.message)
     payOrder = e.condition.getParam('payOrder')
     if payOrder:
         product, shelves = hallstore.findProductByPayOrder(
             gameId, userId, clientId, payOrder)
         if product:
             showInfo.setSubCmd(TodoTaskGotoShop(shelves.name))
     else:
         todotask = e.condition.getParam('todotask')
         if todotask:
             factory = hallpopwnd.decodeTodotaskFactoryByDict(todotask)
             if factory:
                 todotask = factory.newTodoTask(gameId, userId, clientId)
                 TodoTaskHelper.sendTodoTask(gameId, userId, todotask)
                 return
     TodoTaskHelper.sendTodoTask(gameId, userId, showInfo)
예제 #18
0
def handleLotteryRequest(userId, gameId, clientId, msg):
    action = msg.getParam('action')
    ftlog.debug('handleLotteryRequest action=', action, 'userId=', userId,
                'gameId=', gameId, 'clientId=', clientId)
    if action == 'lottery_card':
        #减少抽奖卡,抽奖
        timestamp = pktimestamp.getCurrentTimestamp()
        userAssets = hallitem.itemSystem.loadUserAssets(userId)
        _, consumeCount, _final = userAssets.consumeAsset(
            gameId, hallitem.ASSET_ITEM_LOTTERY_CARD_ID, 1, timestamp,
            'HALL_LOTTERY', 0)
        if consumeCount < 1:
            #金币抽奖
            result = {}
            result["type"] = "chip"
            result["coinNum"] = 1000
            return result
        datachangenotify.sendDataChangeNotify(gameId, userId, 'item')
        result = {}
        result = doLottery(gameId, clientId, userId)
        if result:
            userAssets = hallitem.itemSystem.loadUserAssets(userId)
            timestamp = pktimestamp.getCurrentTimestamp()
            result["card"] = userAssets.balance(
                gameId, hallitem.ASSET_ITEM_LOTTERY_CARD_ID, timestamp)
        return result
    elif action == 'lottery_chip':
        #减少金币,抽奖
        chipNow = userchip.getChip(userId)
        if chipNow < 20000:
            #去商城
            ret = TodoTaskShowInfo('您的金币不足两万,请去商城购买', True)
            ret.setSubCmd(TodoTaskGotoShop('coin'))
            result = {}
            result["todotask"] = ret.toDict()
            return result
        else:
            #金币抽
            coinDel = -1000
            userchip.incrChip(userId, gameId, coinDel,
                              daoconst.CHIP_NOT_ENOUGH_OP_MODE_CLEAR_ZERO,
                              'HALL_LOTTERY', 0, clientId)
            datachangenotify.sendDataChangeNotify(gameId, userId, 'chip')
            return doLottery(gameId, clientId, userId)
예제 #19
0
 def __init__(self, title, imgUrl, payOrder=None, confirm=0, confirmDesc=None, subText=None):
     super(TodoTaskFirstRecharge, self).__init__('pop_first_recharge')
     self.setParam('title', title)
     self.setParam('imgUrl', imgUrl)
     if subText:
         self.setParam('subText', subText)
         self.setParam('sub_action_text', subText)
     if payOrder:
         subCmd = payOrder
         if isinstance(payOrder, TYProduct):
             subCmd = TodoTaskPayOrder(payOrder)
         if confirm:
             confirmDesc = confirmDesc or ''
             if confirmDesc:
                 confirmDesc = strutil.replaceParams(confirmDesc, {
                                                         'product.displayName':subCmd.getParam('name', ''),
                                                         'product.price':subCmd.getParam('price', '')
                                                     })
             info = TodoTaskShowInfo(confirmDesc, True)
             info.setSubCmd(subCmd)
             subCmd = info
         self.setSubCmd(subCmd)
예제 #20
0
    def doQuickBuyGetInfo(self, gameId, userId):
        clientId = sessiondata.getClientId(userId)
        toStoreTodotask = TodoTaskGotoShop('coin')
        if hallstore.storeSystem.isCloseLastBuy(clientId):
            TodoTaskHelper.sendTodoTask(gameId, userId, toStoreTodotask)
            return

        lastBuyProduct, _lastBuyClientId = hallstore.storeSystem.getLastBuyProduct(gameId, userId)
        if (not lastBuyProduct
            or not lastBuyProduct.recordLastBuy
            or not hallstore.storeSystem.canBuyProduct(gameId, userId, clientId, lastBuyProduct, 1)):
            if hallstore.storeSystem.lastBuyConf.payOrder:
                product, _ = hallstore.findProductByPayOrder(gameId, userId, clientId,
                                                             hallstore.storeSystem.lastBuyConf.payOrder)
                if product:
                    payOrderTodoTask = TodoTaskPayOrder(product)
                    desc = strutil.replaceParams(hallstore.storeSystem.lastBuyConf.desc2,
                                                 {'product.displayName': product.displayName,
                                                  'product.price': product.price})
                    popInfoTodoTask = TodoTaskShowInfo(desc, True)
                    popInfoTodoTask.setSubCmd(payOrderTodoTask)
                    TodoTaskHelper.sendTodoTask(gameId, userId, popInfoTodoTask)
                    return
            TodoTaskHelper.sendTodoTask(gameId, userId, toStoreTodotask)
            return

        payOrderTodoTask = TodoTaskPayOrder(lastBuyProduct)
        desc = strutil.replaceParams(hallstore.storeSystem.lastBuyConf.desc,
                                     {'product.displayName': lastBuyProduct.displayName,
                                      'product.price': lastBuyProduct.price})
        popInfoTodoTask = TodoTaskShowInfo(desc, True)
        popInfoTodoTask.setSubCmd(payOrderTodoTask)
        popInfoTodoTask.setSubText(hallstore.storeSystem.lastBuyConf.subText)

        popInfoTodoTask.setSubCmdExt(toStoreTodotask)
        popInfoTodoTask.setSubTextExt(hallstore.storeSystem.lastBuyConf.subTextExt)
        TodoTaskHelper.sendTodoTask(gameId, userId, popInfoTodoTask)
예제 #21
0
 def _sendTodoTaskJumpHighRoom(cls, userId, playMode, clientId, **kwargs):
     if not playMode in dizhuconf.PLAYMODE_ALLSET:
         playMode = dizhuconf.PLAYMODE_DEFAULT
     ctrlRoomIds, _ = cls._getQuickStartRoomList(userId, playMode, rankId=kwargs.get('rankId', '-1'))  # 快开列表
     chosenRoomId, reason, mixId = cls._chooseRoom(userId, ctrlRoomIds, rankId=kwargs.get('rankId', '-1'))
     if chosenRoomId and reason == ENTER_ROOM_REASON_OK:
         quick_start_ = TodoTaskQuickStart(DIZHU_GAMEID, chosenRoomId)
         quick_start_.setParam('mixId', mixId)
         info_str_ = dizhuconf.getQuickStartErrorMsg(ENTER_ROOM_REASON_GREATER_MAX)
         show_info_ = TodoTaskShowInfo(info_str_, True)
         show_info_.setSubCmd(quick_start_)
         try:
             if cls._useSelfPopWnd(userId):
                 todoTaskObj = TodoTaskHelper.encodeTodoTasks(quick_start_)
                 Alert.sendNormalAlert2Button(DIZHU_GAMEID, userId, '提示', info_str_, todoTaskObj[0], '确定', None, '取消')
                 return
         except:
             ftlog.error('DizhuQuickStart _sendTodoTaskJumpHighRoom error userId = ', userId,
                         ' clientId = ', clientId,
                         'playMode = ', playMode)
         msg = TodoTaskHelper.makeTodoTaskMsg(DIZHU_GAMEID, userId, show_info_)
         router.sendToUser(msg, userId)
     else:
         cls._sendTodoTaskToUser(userId, ENTER_ROOM_REASON_GREATER_ALL)
예제 #22
0
    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])
예제 #23
0
def toShop():
    result = {}
    ret = TodoTaskShowInfo('您的钻石不足,请去商城购买', True)
    ret.setSubCmd(TodoTaskGotoShop('diamond'))
    result['todotask'] = ret.toDict()
    return result
예제 #24
0
def toShop():
    result = {}
    ret = TodoTaskShowInfo('您的钻石不足,请去商城购买', True)
    ret.setSubCmd(TodoTaskGotoShop('diamond'))
    result['todotask'] = ret.toDict()
    return result