Esempio n. 1
0
        public static ItemTooltipFoodNutrition Create(IProtoItemFood item)
        {
            var data = new FoodNutritionValueData();

            data.Add(item, count: 1);
            return(new ItemTooltipFoodNutrition()
            {
                DataContext = data
            });
        }
        public static uint SharedCalculateFreshnessMaxValue(IProtoItemFood protoItemFood)
        {
            var freshnessDuration = protoItemFood.FreshnessDuration;
            var freshnessMaxValue = FreshnessFractionsPerSecond * (ulong)freshnessDuration.TotalSeconds;

            if (freshnessMaxValue > uint.MaxValue)
            {
                throw new Exception(
                          $"Freshness duration exceeded max value of {TimeSpan.FromSeconds(uint.MaxValue / (double)FreshnessFractionsPerSecond)}."
                          + $" Provided value is {freshnessDuration}");
            }

            return((uint)freshnessMaxValue);
        }
Esempio n. 3
0
 public ProtoItemFoodViewModel([NotNull] IProtoItemFood food) : base(food)
 {
 }
 public void ServerOnItemUsed(IProtoItemFood protoItemFood)
 {
     Api.ValidateIsServer();
     AddIfNotContains(protoItemFood, this.ListFood);
 }
Esempio n. 5
0
 public void Add(IProtoItemFood protoItemFood, double count)
 {
     this.FoodRestore    += protoItemFood.FoodRestore * count;
     this.StaminaRestore += protoItemFood.StaminaRestore * count;
     this.WaterRestore   += protoItemFood.WaterRestore * count;
 }