Beispiel #1
0
        // TODO: Maybe rework this method? It's doing check and rankup at the same time!
        /// <summary>
        /// Checks if the user is able to rank up, if yes, promote him to next rank
        /// </summary>
        /// <param name="user">User to check</param>
        /// <returns>Return bool if user got new rank up</returns>
        internal bool CheckUserRankUp(User user)
        {
            bool nullRank  = user.UserRank == null;
            Rank matchRank = RankList.Last(r => r.ExpRequired <= user.Experience);

            if (matchRank != user.UserRank)
            { // Gain new rank
                user.UserRank = matchRank;

                if (!nullRank) // Skip initiate null value (loading data from file)
                {
                    return(true);
                }
            }
            return(false);
        }