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