Example #1
0
        public SpellEntryModel([JetBrains.Annotations.NotNull] string spellName, SpellClassType spellType, bool isDefault, int castTime, int spellEffectIdOne, int spellIconId)
        {
            if (string.IsNullOrWhiteSpace(spellName))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(spellName));
            }
            if (spellEffectIdOne < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(spellEffectIdOne));
            }
            if (castTime < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(castTime));
            }
            if (!Enum.IsDefined(typeof(SpellClassType), spellType))
            {
                throw new InvalidEnumArgumentException(nameof(spellType), (int)spellType, typeof(SpellClassType));
            }
            if (spellIconId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(spellIconId));
            }

            SpellName        = spellName;
            SpellType        = spellType;
            this.isDefault   = isDefault;
            CastTime         = castTime;
            SpellEffectIdOne = spellEffectIdOne;
            SpellIconId      = spellIconId;
        }
Example #2
0
        public SpellDefinitionDataModel(int spellId, string spellName, SpellClassType spellType, int castTime, int spellEffectIdOne, int spellIconId)
        {
            if (spellId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(spellId));
            }
            if (spellEffectIdOne < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(spellEffectIdOne));
            }
            if (castTime < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(castTime));
            }
            if (!Enum.IsDefined(typeof(SpellClassType), spellType))
            {
                throw new InvalidEnumArgumentException(nameof(spellType), (int)spellType, typeof(SpellClassType));
            }
            if (spellIconId <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(spellIconId));
            }

            SpellId          = spellId;
            SpellName        = spellName;
            SpellType        = spellType;
            CastTime         = castTime;
            SpellEffectIdOne = spellEffectIdOne;
            SpellIconId      = spellIconId;
        }