示例#1
0
        /// <summary>
        /// Adds a number to players experience
        /// </summary>
        /// <param name="exp">The ammount of experience to add</param>
        public void Add(short exp)
        {
            if (p.CheckEXPGain(exp))
            {
                return;
            }

            short oldLevel = _Level;

            for (int i = 0; i < exp; i++)
            {
                _Experience++;
                _LevelExp++;
                if (_Experience >= NeededExp)
                {
                    _LevelExp = 0;
                    _Level++;
                }
            }

            if (_Level > oldLevel)
            {
                p.SendMessage("Congratulations! You are now level " + _Level);                    // The reward is annoying as hell!
            }
            p.SendExperience(Bar, _Level, _Experience);
        }