Пример #1
0
 // overload operator +
 public static Pools operator +(Pools a, Pools b)
 {
     return(new Pools()
     {
         HitPoints = NullableMath.Add(a?.HitPoints, b?.HitPoints),
         Stamina = NullableMath.Add(a?.Stamina, b?.Stamina),
         Energy = NullableMath.Add(a?.Energy, b?.Energy)
     });
 }
Пример #2
0
 // overload operator /
 public static Pools operator /(Pools a, float?b)
 {
     return(new Pools()
     {
         HitPoints = NullableMath.Divide(a?.HitPoints, b),
         Stamina = NullableMath.Divide(a?.Stamina, b),
         Energy = NullableMath.Divide(a?.Energy, b)
     });
 }
Пример #3
0
 // overload operator *
 public static Pools operator *(Pools a, int?b)
 {
     return(new Pools()
     {
         HitPoints = NullableMath.Multiply(a?.HitPoints, b),
         Stamina = NullableMath.Multiply(a?.Stamina, b),
         Energy = NullableMath.Multiply(a?.Energy, b)
     });
 }
Пример #4
0
 // overload operator +
 public static Qualities operator +(Qualities a, Qualities b)
 {
     return(new Qualities()
     {
         CriticalHit = NullableMath.Add(a?.CriticalHit, b?.CriticalHit),
         CriticalDamage = NullableMath.Add(a?.CriticalDamage, b?.CriticalDamage),
         AttackRating = NullableMath.Add(a?.AttackRating, b?.AttackRating),
         ArmorRating = NullableMath.Add(a?.ArmorRating, b?.ArmorRating),
     });
 }
Пример #5
0
 // overload operator /
 public static Qualities operator /(Qualities a, float?b)
 {
     return(new Qualities()
     {
         CriticalHit = NullableMath.Divide(a?.CriticalHit, b),
         CriticalDamage = NullableMath.Divide(a?.CriticalDamage, b),
         AttackRating = NullableMath.Divide(a?.AttackRating, b),
         ArmorRating = NullableMath.Divide(a?.ArmorRating, b),
     });
 }
Пример #6
0
 // overload operator *
 public static Qualities operator *(Qualities a, int?b)
 {
     return(new Qualities()
     {
         CriticalHit = NullableMath.Multiply(a?.CriticalHit, b),
         CriticalDamage = NullableMath.Multiply(a?.CriticalDamage, b),
         AttackRating = NullableMath.Multiply(a?.AttackRating, b),
         ArmorRating = NullableMath.Multiply(a?.ArmorRating, b)
     });
 }
Пример #7
0
 // overload operator +
 public static Attributes operator +(Attributes a, Attributes b)
 {
     return(new Attributes()
     {
         Might = NullableMath.Add(a?.Might, b?.Might),
         Finesse = NullableMath.Add(a?.Finesse, b?.Finesse),
         Will = NullableMath.Add(a?.Will, b?.Will),
         Intellect = NullableMath.Add(a?.Intellect, b?.Intellect),
         Spirit = NullableMath.Add(a?.Spirit, b?.Spirit),
         Essence = NullableMath.Add(a?.Essence, b?.Essence)
     });
 }
Пример #8
0
 // overload operator /
 public static Attributes operator /(Attributes a, float?b)
 {
     return(new Attributes()
     {
         Might = NullableMath.Divide(a?.Might, b),
         Finesse = NullableMath.Divide(a?.Finesse, b),
         Will = NullableMath.Divide(a?.Will, b),
         Intellect = NullableMath.Divide(a?.Intellect, b),
         Spirit = NullableMath.Divide(a?.Spirit, b),
         Essence = NullableMath.Divide(a?.Essence, b)
     });
 }
Пример #9
0
        public static CurrencyList GetCurrencyList(String currency)
        {
            var     list   = GetCurrencyList();
            decimal?factor = null;
            var     rate   = list.Rates.SingleOrDefault(a => a.ISOCode == currency);

            if (rate != null)
            {
                factor = rate.Rate;
            }
            return(new CurrencyList
            {
                Date = list.Date,
                Rates = list.Rates.Select(a => new CurrencyRate
                {
                    Currency = a.Currency,
                    Rate = NullableMath.Round(a.Rate / factor, 6),
                    ISOCode = a.ISOCode
                }).ToList()
            });
        }