private static void ChangeSkill( Mobile from, string name, double value )
{
SkillName index;
if( !Enum.TryParse( name, true, out index ) || (int)index > 51 || (int)index > 48 )
{
from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
return;
}
Skill skill = from.Skills[index];
if ( skill != null )
{
if ( value < 0 || value > skill.Cap )
{
from.SendMessage( String.Format( "Your skill in {0} is capped at {1:F1}.", skill.Info.Name, skill.Cap ) );
}
else
{
int newFixedPoint = (int)(value * 10.0);
int oldFixedPoint = skill.BaseFixedPoint;
if ( ((skill.Owner.Total - oldFixedPoint) + newFixedPoint) > skill.Owner.Cap )
{
from.SendMessage( "You can not exceed the skill cap. Try setting another skill lower first." );
}
else
{
skill.BaseFixedPoint = newFixedPoint;
}
}
}
else
{
from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
}
}