invertika_game.Game.Character.receiveExperience C# (CSharp) Method

receiveExperience() public method

public receiveExperience ( int skill, int experience, int optimalLevel ) : void
skill int
experience int
optimalLevel int
return void
        void receiveExperience(int skill, int experience, int optimalLevel)
        {
            //// reduce experience when skill is over optimal level
            //int levelOverOptimum = levelForExp(getExperience(skill)) - optimalLevel;
            //if (optimalLevel && levelOverOptimum > 0)
            //{
            //    experience *= EXP_LEVEL_FLEXIBILITY
            //                  / (levelOverOptimum + EXP_LEVEL_FLEXIBILITY);
            //}

            //// Add exp
            //int oldExp = mExperience[skill];
            //long int newExp = mExperience[skill] + experience;
            //if (newExp < 0)
            //    newExp = 0; // Avoid integer underflow/negative exp.

            //// Check the skill cap
            //long int maxSkillCap = Configuration::getValue("game_maxSkillCap", INT_MAX);
            //assert(maxSkillCap <= INT_MAX);  // Avoid integer overflow.
            //if (newExp > maxSkillCap)
            //{
            //    newExp = maxSkillCap;
            //    if (oldExp != maxSkillCap)
            //    {
            //        LOG_INFO("Player hit the skill cap");
            //        // TODO: Send a message to player letting them know they hit the cap
            //        // or not?
            //    }
            //}
            //mExperience[skill] = newExp;
            //mModifiedExperience.insert(skill);

            //// Inform account server
            //if (newExp != oldExp)
            //    accountHandler.updateExperience(getDatabaseID(), skill, newExp);

            //// Check for skill levelup
            //if (Character::levelForExp(newExp) >= Character::levelForExp(oldExp))
            //    updateDerivedAttributes(skill);

            //mRecalculateLevel = true;
        }