Beispiel #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
Beispiel #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
 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 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
 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))
 def convert(price):
     newPrice = price.copy()
     if price['isPremium']:
         newPrice['gold'] = getPriceWithDiscount(
             price['gold'], goody.resource)
     return newPrice
Beispiel #9
0
 def convert(price):
     newPrice = price.copy()
     if price['isPremium']:
         newPrice[Currency.GOLD] = getPriceWithDiscount(
             price[Currency.GOLD], goody.resource)
     return newPrice
Beispiel #10
0
 def convert(price):
     newPrice = price.copy()
     if price['isPremium']:
         newPrice['gold'] = getPriceWithDiscount(price['gold'], goody.resource)
     return newPrice
Beispiel #11
0
 def convert(price):
     newPrice = price.copy()
     if price["isPremium"]:
         newPrice["gold"] = getPriceWithDiscount(price["gold"], goody.resource)
     return newPrice