Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the OfferServiceModel class.
 /// </summary>
 /// <param name="amount">The total price</param>
 /// <param name="count">The default count of offered services. For
 /// services whose pricing unit is 'Person' it will be based on the
 /// adults and children specified, otherwise 1.</param>
 /// <param name="pricingMode">Whether the service price is included in
 /// or added to the base rate. Possible values include: 'Included',
 /// 'Additional'</param>
 /// <param name="service">The service</param>
 /// <param name="serviceDate">The date this service is
 /// delivered</param>
 public OfferServiceModel(AmountModel amount, int count, PricingMode pricingMode, EmbeddedServiceModel service, System.DateTime serviceDate)
 {
     Amount      = amount;
     Count       = count;
     PricingMode = pricingMode;
     Service     = service;
     ServiceDate = serviceDate;
     CustomInit();
 }
 /// <summary>
 /// Initializes a new instance of the ReservationStayOfferServiceModel
 /// class.
 /// </summary>
 /// <param name="amount">The total price</param>
 /// <param name="bookedAsExtra">Whether this service is already booked
 /// as extra</param>
 /// <param name="count">The default count of offered services. For
 /// services whose pricing unit is 'Person' it will be based on the
 /// adults and children specified, otherwise 1.</param>
 /// <param name="pricingMode">Whether the service price is included in
 /// or added to the base rate. Possible values include: 'Included',
 /// 'Additional'</param>
 /// <param name="service">The service</param>
 /// <param name="serviceDate">The date this service is
 /// delivered</param>
 public ReservationStayOfferServiceModel(AmountModel amount, bool bookedAsExtra, int count, PricingMode pricingMode, EmbeddedServiceModel service, System.DateTime serviceDate)
 {
     Amount        = amount;
     BookedAsExtra = bookedAsExtra;
     Count         = count;
     PricingMode   = pricingMode;
     Service       = service;
     ServiceDate   = serviceDate;
     CustomInit();
 }
Exemplo n.º 3
0
        internal static string ToSerializedValue(this PricingMode value)
        {
            switch (value)
            {
            case PricingMode.Included:
                return("Included");

            case PricingMode.Additional:
                return("Additional");
            }
            return(null);
        }
Exemplo n.º 4
0
        public float GetPriceMod(PricingMode pricingMode)
        {
            switch (pricingMode)
            {
            case PricingMode.lowest:
                return(this.LowestPrice);

            case PricingMode.highest:
                return(this.HighestPrice);

            case PricingMode.rawavg:
                return(this.RawAveragePrice);

            default:
                return(this.LowestPrice);
            }
        }
Exemplo n.º 5
0
        public RuleSetBuilder AddPoorDropRoutine(string tier, float comparer, float weight = 2.0f, bool redemptionLag = true, float redemptionWeight = 1.5f, PricingMode pricingMode = PricingMode.lowest)
        {
            // Low value drops tend to have a high noise amplitude on Poe.ninja/the actual economy.
            // Items marked as a "PoorItem", need to climb a certain threshold to leave the low item tier
            this.AddRule($"{tier} (PoorItem)", tier,
                         new Func <string, bool>((string s) =>
            {
                var price = this.Item.GetPriceMod(pricingMode);
                return(price < (comparer * weight) && this.Item.HasAspect("PoorDropAspect") && !this.Item.HasAspect("EarlyLeagueInterestAspect") && !this.Item.HasAspect("PreventHidingAspect"));
            }));

            this.AddRule($"{tier} (FailedRedemption)", tier,
                         new Func <string, bool>((string s) =>
            {
                if (this.Item.HasAspect("EarlyLeagueInterestAspect") || this.Item.HasAspect("PreventHidingAspect"))
                {
                    return(false);
                }

                if (this.GetTierOfItem(s).Contains(tier))
                {
                    var price = this.Item.GetPriceMod(pricingMode);
                    return(price < comparer * redemptionWeight);
                }

                return(false);
            }));

            this.AddRule(tier, tier,
                         new Func <string, bool>((string s) =>
            {
                if (this.Item.HasAspect("EarlyLeagueInterestAspect") || this.Item.HasAspect("PreventHidingAspect"))
                {
                    return(false);
                }

                var price = this.Item.GetPriceMod(pricingMode);
                return(price < comparer);
            }));

            return(this);
        }
        private static List <PricingEverydayPriceListGroup> GetEverydayPriceListGroups(PricingMode mode)
        {
            var result = new List <PricingEverydayPriceListGroup>();

            for (int groupIndex = 1; groupIndex <= 2; groupIndex++)
            {
                PricingEverydayPriceListGroup group = null;
                bool isLinkedGroup = (groupIndex > 1);
                int  key           = mode.KeyPriceListGroupKey;
                int  linkedKey     = mode.LinkedPriceListGroupKey;

                if (isLinkedGroup)
                {
                    group = new PricingEverydayPriceListGroup {
                        Name = "Price List Group " + groupIndex, Sort = (short)groupIndex, Key = key
                    };
                    var priceLists = GetEverydayPriceLists(isLinkedGroup);
                    group.PriceLists = new ReactiveList <PricingEverydayPriceList>(priceLists);
                    result.Add(group);
                }
                else if (linkedKey > 0 && linkedKey != key)
                {
                    group = new PricingEverydayPriceListGroup {
                        Name = "Price List Group " + groupIndex, Sort = (short)groupIndex, Key = linkedKey
                    };
                    var priceLists = GetEverydayPriceLists(isLinkedGroup);
                    group.PriceLists = new ReactiveList <PricingEverydayPriceList>(priceLists);
                    result.Add(group);
                }
            }

            return(result);
        }