コード例 #1
0
ファイル: item_handler.py プロジェクト: luningcowboy/tuyoo
 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)
コード例 #2
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)
コード例 #3
0
ファイル: item_handler.py プロジェクト: luningcowboy/tuyoo
 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)
コード例 #4
0
ファイル: lottery.py プロジェクト: luningcowboy/tuyoo
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)
コード例 #5
0
def toShop():
    result = {}
    ret = TodoTaskShowInfo('您的钻石不足,请去商城购买', True)
    ret.setSubCmd(TodoTaskGotoShop('diamond'))
    result['todotask'] = ret.toDict()
    return result
コード例 #6
0
ファイル: inviter_shop.py プロジェクト: luningcowboy/tuyoo
def _goto_shop(userId):
    """让客户端转到商城界面"""
    toStoreTodotask = TodoTaskGotoShop('inviter_shop')
    TodoTaskHelper.sendTodoTask(HALL_GAMEID, userId, toStoreTodotask)
コード例 #7
0
ファイル: ft_handler.py プロジェクト: luningcowboy/tuyoo
 def doFTBuyCard(self, userId, gameId, clientId, count):
     TodoTaskHelper.sendTodoTask(gameId, userId, TodoTaskGotoShop('coupon'))