Server.Mobiles.BaseCreature.Teach C# (CSharp) Method

Teach() public method

public Teach ( SkillName skill, Mobile m, int maxPointsToLearn, bool doTeach ) : bool
skill SkillName
m Mobile
maxPointsToLearn int
doTeach bool
return bool
        public virtual bool Teach( SkillName skill, Mobile m, int maxPointsToLearn, bool doTeach )
        {
            int pointsToLearn = 0;
            TeachResult res = CheckTeachSkills( skill, m, maxPointsToLearn, ref pointsToLearn, doTeach );

            switch ( res )
            {
                case TeachResult.KnowsMoreThanMe:
                {
                    Say( 501508 ); // I cannot teach thee, for thou knowest more than I!
                    break;
                }
                case TeachResult.KnowsWhatIKnow:
                {
                    Say( 501509 ); // I cannot teach thee, for thou knowest all I can teach!
                    break;
                }
                case TeachResult.NotEnoughFreePoints:
                case TeachResult.SkillNotRaisable:
                {
                    // Make sure this skill is marked to raise. If you are near the skill cap (700 points) you may need to lose some points in another skill first.
                    m.SendLocalizedMessage( 501510, "", 0x22 );
                    break;
                }
                case TeachResult.Success:
                {
                    if ( doTeach )
                    {
                        Say( 501539 ); // Let me show thee something of how this is done.
                        m.SendLocalizedMessage( 501540 ); // Your skill level increases.

                        m_Teaching = (SkillName)(-1);

                        if ( m is PlayerMobile )
                            ((PlayerMobile)m).Learning = (SkillName)(-1);
                    }
                    else
                    {
                        // I will teach thee all I know, if paid the amount in full.  The price is:
                        Say( 1019077, AffixType.Append, String.Format( " {0}", pointsToLearn ), "" );
                        Say( 1043108 ); // For less I shall teach thee less.

                        m_Teaching = skill;

                        if ( m is PlayerMobile )
                            ((PlayerMobile)m).Learning = skill;
                    }

                    return true;
                }
            }

            return false;
        }
BaseCreature