示例#1
0
 def __init__(self, intCompactDescr, proxy=None, isBoughtForAltPrice=False):
     """
     Ctr.
     
     :param intCompactDescr: item's int compact descriptor
     :param proxy: instance of ItemsRequester
     :param isBoughtForAltPrice: indicates whether the item has been bought for credits(alt price)
     """
     GUIItem.__init__(self, proxy)
     HasIntCD.__init__(self, intCompactDescr)
     self._isBoughtForAltPrice = isBoughtForAltPrice
     self._rentInfo = RentalInfoProvider()
     self._restoreInfo = None
     self._personalDiscountPrice = None
     if proxy is not None and proxy.inventory.isSynced(
     ) and proxy.stats.isSynced() and proxy.shop.isSynced():
         self._mayConsumeWalletResources = proxy.stats.mayConsumeWalletResources
         defaultPrice = proxy.shop.defaults.getItemPrice(self.intCD)
         if defaultPrice is None:
             defaultPrice = MONEY_UNDEFINED
         buyPrice, self._isHidden = proxy.shop.getItem(self.intCD)
         if buyPrice is None:
             buyPrice = MONEY_UNDEFINED
         altPrice = self._getAltPrice(buyPrice, proxy.shop)
         defaultAltPrice = self._getAltPrice(defaultPrice,
                                             proxy.shop.defaults)
         self._buyPrices = ItemPrices(
             itemPrice=ItemPrice(price=buyPrice, defPrice=defaultPrice),
             itemAltPrice=ItemPrice(price=altPrice,
                                    defPrice=defaultAltPrice))
         defaultSellPrice = Money.makeFromMoneyTuple(
             BigWorld.player().shop.getSellPrice(
                 defaultPrice,
                 proxy.shop.defaults.sellPriceModifiers(intCompactDescr),
                 self.itemTypeID))
         sellPrice = Money.makeFromMoneyTuple(
             BigWorld.player().shop.getSellPrice(
                 buyPrice, proxy.shop.sellPriceModifiers(intCompactDescr),
                 self.itemTypeID))
         self._sellPrices = ItemPrices(itemPrice=ItemPrice(
             price=sellPrice, defPrice=defaultSellPrice),
                                       itemAltPrice=ITEM_PRICE_EMPTY)
         self._inventoryCount = proxy.inventory.getItems(
             self.itemTypeID, self.intCD)
         if self._inventoryCount is None:
             self._inventoryCount = 0
         self._isUnlocked = self.intCD in proxy.stats.unlocks
         self._isInitiallyUnlocked = self.intCD in proxy.stats.initialUnlocks
         self._fullyConfigured = True
     else:
         self._buyPrices = ITEM_PRICES_EMPTY
         self._sellPrices = ITEM_PRICES_EMPTY
         self._isHidden = False
         self._inventoryCount = 0
         self._isUnlocked = False
         self._mayConsumeWalletResources = False
         self._isInitiallyUnlocked = False
         self._fullyConfigured = False
     return
 def __init__(self,
              intCompactDescr,
              proxy=None,
              isBoughtForAltPrice=False,
              strCD=None):
     super(FittingItem, self).__init__(intCD=HasIntCD(intCompactDescr),
                                       strCD=strCD)
     self._isBoughtForAltPrice = isBoughtForAltPrice
     self._rentInfo = RentalInfoProvider(None, None, None, None, None, None)
     self._restoreInfo = None
     self._personalDiscountPrice = None
     self._descriptor = self._getDescriptor()
     if proxy is not None and proxy.inventory.isSynced(
     ) and proxy.stats.isSynced() and proxy.shop.isSynced():
         self._mayConsumeWalletResources = proxy.stats.mayConsumeWalletResources
         defaultPrice = proxy.shop.defaults.getItemPrice(self.intCD)
         if defaultPrice is None:
             defaultPrice = MONEY_UNDEFINED
         buyPrice, self._isHidden = proxy.shop.getItem(self.intCD)
         if buyPrice is None:
             buyPrice = MONEY_UNDEFINED
         altPrice = self._getAltPrice(buyPrice, proxy.shop)
         defaultAltPrice = self._getAltPrice(defaultPrice,
                                             proxy.shop.defaults)
         self._buyPrices = ItemPrices(
             itemPrice=ItemPrice(price=buyPrice, defPrice=defaultPrice),
             itemAltPrice=ItemPrice(price=altPrice,
                                    defPrice=defaultAltPrice))
         defaultSellPrice = Money.makeFromMoneyTuple(
             BigWorld.player().shop.getSellPrice(
                 defaultPrice,
                 proxy.shop.defaults.sellPriceModifiers(intCompactDescr),
                 self.itemTypeID))
         sellPrice = Money.makeFromMoneyTuple(
             BigWorld.player().shop.getSellPrice(
                 buyPrice, proxy.shop.sellPriceModifiers(intCompactDescr),
                 self.itemTypeID))
         self._sellPrices = ItemPrices(itemPrice=ItemPrice(
             price=sellPrice, defPrice=defaultSellPrice),
                                       itemAltPrice=ITEM_PRICE_EMPTY)
         self._inventoryCount = proxy.inventory.getItems(
             self.itemTypeID, self.intCD)
         if self._inventoryCount is None:
             self._inventoryCount = 0
         self._isUnlocked = self.intCD in proxy.stats.unlocks
         self._isInitiallyUnlocked = self.intCD in proxy.stats.initialUnlocks
         self._fullyConfigured = True
     else:
         self._buyPrices = ITEM_PRICES_EMPTY
         self._sellPrices = ITEM_PRICES_EMPTY
         self._isHidden = False
         self._inventoryCount = 0
         self._isUnlocked = False
         self._mayConsumeWalletResources = False
         self._isInitiallyUnlocked = False
         self._fullyConfigured = False
     return
示例#3
0
 def __init__(self, boosterID, boosterDescription, proxy):
     super(Booster, self).__init__(boosterID, boosterDescription, proxy)
     buyPrice, defaultPrice, altPrice, defaultAltPrice, self.isHidden = proxy.getBoosterPriceData(boosterID)
     buyPrice = ItemPrice(price=buyPrice, defPrice=defaultPrice)
     if altPrice is not None:
         altPrice = ItemPrice(price=altPrice, defPrice=defaultAltPrice)
     else:
         altPrice = ITEM_PRICE_EMPTY
     self.__buyPrices = ItemPrices(itemPrice=buyPrice, itemAltPrice=altPrice)
     self.__sellPrices = ITEM_PRICES_EMPTY
     self.__activeBoostersValues = proxy.getActiveBoostersTypes()
     return
示例#4
0
 def __buildPrice(self):
     if not self._stateProvider:
         return
     else:
         priceData = self._stateProvider.getBoosterPriceData(self.boosterID)
         buyPrice, defaultPrice, altPrice, defaultAltPrice = priceData
         buyPrice = ItemPrice(price=buyPrice, defPrice=defaultPrice)
         if altPrice is not None:
             altPrice = ItemPrice(price=altPrice, defPrice=defaultAltPrice)
         else:
             altPrice = ITEM_PRICE_EMPTY
         self.__buyPrices = ItemPrices(itemPrice=buyPrice,
                                       itemAltPrice=altPrice)
         return
示例#5
0
 def __init__(self, boosterID, boosterDescription, proxy):
     super(Booster, self).__init__(boosterID, boosterDescription, proxy)
     if not boosterDescription.variety == GOODIE_VARIETY.BOOSTER:
         raise AssertionError
         buyPrice, defaultPrice, altPrice, defaultAltPrice, self.isHidden = proxy.getBoosterPriceData(
             boosterID)
         buyPrice = ItemPrice(price=buyPrice, defPrice=defaultPrice)
         altPrice = altPrice is not None and ItemPrice(
             price=altPrice, defPrice=defaultAltPrice)
     else:
         altPrice = ITEM_PRICE_EMPTY
     self.__buyPrices = ItemPrices(itemPrice=buyPrice,
                                   itemAltPrice=altPrice)
     self.__sellPrices = ITEM_PRICES_EMPTY
     self.__activeBoostersValues = proxy.getActiveBoostersTypes()
     return
示例#6
0
 def _getItemPrices(self, item):
     return ItemPrices(ItemPrice(item.restorePrice, item.restorePrice))
示例#7
0
 def _getItemPrices(self, item):
     if item.isRestorePossible():
         return ItemPrices(ItemPrice(item.restorePrice, item.restorePrice))
     return super(ShopVehicleTab, self)._getItemPrices(item)