Ejemplo n.º 1
0
 def __getPriceWithDiscount(price, resourceData):
     resourceType, _, _ = resourceData
     if resourceType == GOODIE_RESOURCE_TYPE.CREDITS:
         return Money(
             credits=getPriceWithDiscount(price.credits, resourceData))
     return Money(
         gold=getPriceWithDiscount(price.gold, resourceData)
     ) if resourceType == GOODIE_RESOURCE_TYPE.GOLD else MONEY_UNDEFINED
Ejemplo n.º 2
0
 def __getPriceWithDiscount(price, resourceData):
     """
     Translates goodie value into the final price in Money
     """
     resourceType, _, _ = resourceData
     if resourceType == GOODIE_RESOURCE_TYPE.CREDITS:
         return Money(credits=getPriceWithDiscount(price.credits, resourceData))
     if resourceType == GOODIE_RESOURCE_TYPE.GOLD:
         return Money(gold=getPriceWithDiscount(price.gold, resourceData))
     return MONEY_UNDEFINED
Ejemplo n.º 3
0
 def freeXPConversionWithDiscount(self):
     goody = self.bestGoody(self.personalXPExchangeDiscounts)
     rate = self.freeXPConversion
     if goody:
         return (getPriceWithDiscount(rate[0], goody.resource), rate[1])
     else:
         return rate
Ejemplo n.º 4
0
 def freeXPConversionWithDiscount(self):
     goody = self.bestGoody(self.personalXPExchangeDiscounts)
     rate = self.freeXPConversion
     if goody:
         return (getPriceWithDiscount(rate[0], goody.resource), rate[1])
     else:
         return rate
 def getVehicleSlotsPrice(self, currentSlotsCount):
     price = super(ShopRequester, self).getVehicleSlotsPrice(currentSlotsCount)
     slotGoodies = self.personalSlotDiscounts
     if slotGoodies:
         bestGoody = self.bestGoody(slotGoodies)
         return getPriceWithDiscount(price, bestGoody.resource)
     return price
Ejemplo n.º 6
0
 def getVehicleSlotsPrice(self, currentSlotsCount):
     price = super(ShopRequester, self).getVehicleSlotsPrice(currentSlotsCount)
     slotGoodies = self.personalSlotDiscounts
     if slotGoodies:
         bestGoody = self.bestGoody(slotGoodies)
         return getPriceWithDiscount(price, bestGoody.resource)
     else:
         return price
 def getVehicleSlotsItemPrice(self, currentSlotsCount):
     defPrice = self.defaults.getVehicleSlotsPrice(currentSlotsCount)
     price = self.getVehicleSlotsPrice(currentSlotsCount)
     slotGoodies = self.personalSlotDiscounts
     if slotGoodies:
         bestGoody = self.bestGoody(slotGoodies)
         price = getPriceWithDiscount(price, bestGoody.resource)
     return ItemPrice(price=Money.makeFrom(Currency.GOLD, price), defPrice=Money.makeFrom(Currency.GOLD, defPrice))
Ejemplo n.º 8
0
 def convert(price):
     newPrice = price.copy()
     if price['isPremium']:
         newPrice['gold'] = getPriceWithDiscount(
             price['gold'], goody.resource)
     return newPrice
Ejemplo n.º 9
0
 def convert(price):
     newPrice = price.copy()
     if price['isPremium']:
         newPrice[Currency.GOLD] = getPriceWithDiscount(
             price[Currency.GOLD], goody.resource)
     return newPrice
Ejemplo n.º 10
0
 def convert(price):
     newPrice = price.copy()
     if price['isPremium']:
         newPrice['gold'] = getPriceWithDiscount(price['gold'], goody.resource)
     return newPrice
Ejemplo n.º 11
0
 def convert(price):
     newPrice = price.copy()
     if price["isPremium"]:
         newPrice["gold"] = getPriceWithDiscount(price["gold"], goody.resource)
     return newPrice