Esempio n. 1
0
 def update(self, price, balance):
     super(PostProgressionResearchBottomContent, self).update()
     mayConsume = PurchaseProvider.mayConsume(balance, price).result
     with self._viewModel.transaction() as viewModel:
         viewModel.getPrice().clear()
         BuyPriceModelBuilder.fillPriceModel(viewModel, convertPrice(mayConsume, balance, price), balance=balance)
         viewModel.getPrice().invalidate()
         viewModel.setIsDisabled(not mayConsume)
Esempio n. 2
0
    def updateDealPanelPrice(cls, items, dealPanelModel):
        prices = {cls._IN_STORAGE: 0, cls._MONEY: MONEY_UNDEFINED}
        for item in items:
            cls.addItem(item, prices)

        dealPanelModel.setTotalItemsInStorage(prices[cls._IN_STORAGE])
        dealPanelModel.getPrice().clear()
        buyMoney = prices[cls._MONEY]
        BuyPriceModelBuilder.fillPriceModel(dealPanelModel, buyMoney)
        dealPanelModel.getPrice().invalidate()
        cls._updateDisabled(prices, dealPanelModel)
 def update(self):
     super(PriceBottomContent, self).update()
     with self._viewModel.transaction() as model:
         price = model.getPrice()
         defPrice = model.getDefPrice()
         price.clear()
         defPrice.clear()
         if self.__price:
             BuyPriceModelBuilder.fillPriceModel(priceModel=model, price=self.__price, defPrice=self.__defPrice)
         isEnabled = not self.__price.isDefined() or canBuyWithGoldExchange(self.__price, self.__itemsCache.items.stats.money, self.__itemsCache.items.shop.exchangeRate)
         model.setIsDisabled(not isEnabled)
Esempio n. 4
0
 def getCofirmedItemViewModel(self):
     itemModel = ConfirmedItemModel()
     itemModel.setName(self.getName())
     itemModel.setImageSource(self.getImageSource())
     itemModel.setHighlightType(self.getHighlightsType())
     itemModel.setOverlayType(self.getOverlayType())
     itemModel.setCanUseDemountKit(self.canUseDemountKit())
     itemModel.setLevel(self.getLevel())
     price = self.getRemovalPrice()
     if price:
         BuyPriceModelBuilder.fillPriceModelByItemPrice(
             itemModel.demountPrice, price)
     return itemModel
Esempio n. 5
0
    def updateSlot(self, model, item, ctx):
        super(ShellProvider, self).updateSlot(model, item, ctx)
        buyPrice = item.getBuyPrice()
        if model.getIntCD() != item.intCD:
            model.setType(item.type)
            model.setName(item.userName)
            model.setIntCD(item.intCD)
            model.setItemTypeID(item.itemTypeID)
            model.setImageName(item.descriptor.iconName)
            BuyPriceModelBuilder.clearPriceModel(model.price)
            BuyPriceModelBuilder.fillPriceModelByItemPrice(
                model.price, buyPrice)
            self._fillSpecification(model, item)
        vehicle = self._getVehicle()
        inTankCount = 0
        for shell in vehicle.shells.setupLayouts:
            if shell == item:
                inTankCount = max(inTankCount, shell.count)

        boughtCount = item.inventoryCount + inTankCount
        buyCount = max(item.count - boughtCount, 0)
        model.setCount(item.count)
        shellsSetupLayouts = vehicle.shells.setupLayouts
        inTankCount = max(
            item.count, shellsSetupLayouts.ammoLoadedInOtherSetups(item.intCD))
        model.setItemsInStorage(max(boughtCount - inTankCount, 0))
        if vehicle.isSetupSwitchActive(TankSetupGroupsId.EQUIPMENT_AND_SHELLS):
            model.setItemsInVehicle(inTankCount)
        else:
            model.setItemsInVehicle(-1)
        model.setBuyCount(buyCount)
        BuyPriceModelBuilder.clearPriceModel(model.totalPrice)
        if buyCount:
            BuyPriceModelBuilder.fillPriceModelByItemPrice(
                model.totalPrice, buyPrice * buyCount)
    def updateSlot(self, model, item, ctx):
        super(ShellProvider, self).updateSlot(model, item, ctx)
        if model.getIntCD() != item.intCD:
            model.setType(item.type)
            model.setName(item.userName)
            model.setIntCD(item.intCD)
            model.setItemTypeID(item.itemTypeID)
            model.setImageName(item.type)
            BuyPriceModelBuilder.clearPriceModel(model.price)
            BuyPriceModelBuilder.fillPriceModelByItemPrice(
                model.price, item.getBuyPrice())
            self._fillSpecification(model, item)
        inTankCount = 0
        for shell in self._getVehicle().shells.installed:
            if shell == item:
                inTankCount += shell.count

        model.setCount(item.count)
        model.setItemsInStorage(item.inventoryCount + inTankCount)
Esempio n. 7
0
 def _fillBuyPrice(self, model, item):
     if not item.isHidden:
         BuyPriceModelBuilder.clearPriceModel(model.price)
         BuyPriceModelBuilder.fillPriceModelByItemPrice(
             model.price, item.getBuyPrice())