public void SetDiscount(GetDiscountForOfferEvent e, PremiumGoodsNode good, [JoinBy(typeof(SpecialOfferGroupComponent))] Optional <SingleNode <DiscountComponent> > personalOffer) { e.Discount = 0f; if (personalOffer.IsPresent()) { e.Discount = personalOffer.Get().component.DiscountCoeff; } }
private void FillPack(PremiumPackComponent pack, PremiumGoodsNode packNode, int count) { GetDiscountForOfferEvent eventInstance = new GetDiscountForOfferEvent(); base.ScheduleEvent(eventInstance, packNode); pack.DaysText = packNode.countableItemsPack.Pack.First <KeyValuePair <long, int> >().Value.ToString(); pack.DaysDescription = packNode.specialOfferContentLocalization.Description; pack.Price = $"{(1f - eventInstance.Discount) * packNode.goodsPrice.Price:0.00} {packNode.goodsPrice.Currency}"; pack.Discount = eventInstance.Discount; pack.HasXCrystals = this.IsGoodsWithCrystals(packNode); pack.LearnMoreIndex = count; pack.GoodsEntity = packNode.Entity; }