Пример #1
0
        /// <summary>
        /// Gets the character associated with the id and checks
        /// if their specified statistic is higher than the given value.
        /// </summary>
        /// <param name="id">The id of the character to get.</param>
        /// <param name="statName">The name of the statistic to get.</param>
        /// <param name="minimum">Checks if the character's StatisticValue is greater than or equal to this value.</param>
        /// <returns>
        /// A result detailing if the operation was successful or why it failed.
        /// </returns>
        public async Task <IResult> CheckStatisticAsync(ulong id, string statName)
        {
            var character = await _charProvider.GetActiveCharacterAsync(id);

            if (character == null)
            {
                return(CharacterResult.CharacterNotFound());
            }

            var stat = await _statProvider.GetStatisticAsync(statName);

            if (stat == null)
            {
                return(StatisticResult.StatisticNotFound());
            }

            var statValue = character.GetStatistic(stat);

            if (statValue == null)
            {
                return(StatisticResult.StatisticNotFound());
            }

            return(StatisticResult.StatisticCheck(character.Name, stat.Name, statValue.Value));
        }