Exemplo n.º 1
0
 def _getItemCurrencyAndPrice(self, currency):
     itemPrice = getItemBuyPrice(self.item, currency,
                                 self.itemsCache.items.shop)
     if itemPrice is None:
         itemPrice = self.item.buyPrices.itemPrice
         currency = itemPrice.getCurrency(byWeight=True)
     return (currency, itemPrice)
Exemplo n.º 2
0
 def _getItemCurrencyAndPrice(self, currency):
     """
     Determines the item price and currency based on alternative and original coast. Note that by default
     the method tries to determine the coast in credits. If the item price is not defined in credits (or the item
     can not be bought for credits right now), the method returns the coast in the original currency.
     
     :param currency: the preferred currency, Currency.CREDITS by default, see class constructor.
     
     :return: an instance of tuple(currency, ItemPrice)
     """
     itemPrice = getItemBuyPrice(self.item, currency,
                                 self.itemsCache.items.shop)
     if itemPrice is None:
         itemPrice = self.item.buyPrices.itemPrice
         currency = itemPrice.getCurrency(byWeight=True)
     return (currency, itemPrice)
Exemplo n.º 3
0
 def _request(self, callback):
     LOG_DEBUG(
         'Make server request to buy {} module(s) {} for currency {} (item price - {})'
         .format(self.count, self.item, self._currency, self._itemPrice))
     originalCurrency = self.item.buyPrices.itemPrice.getCurrency()
     goldForCredits = originalCurrency == Currency.GOLD and self._currency == Currency.CREDITS and getItemBuyPrice(
         self.item, self._currency, self.itemsCache.items.shop) is not None
     BigWorld.player().shop.buy(self.item.itemTypeID, self.item.nationID,
                                self.item.intCD, self.count,
                                int(goldForCredits),
                                lambda code: self._response(code, callback))
     return