Bug in BodyTable, Bodies with an ID over 1000 we not being properly read.

Using Enum.TryParse where applicable
This commit is contained in:
asayre 2012-01-02 14:21:20 +00:00
parent 26899493c0
commit b9f0138b08
5 changed files with 30 additions and 45 deletions

View file

@ -25,16 +25,15 @@ namespace Server.Commands
else
{
SkillName skill;
try
if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
{
skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true );
arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
}
catch
else
{
arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
return;
}
arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
}
}
@ -63,17 +62,15 @@ namespace Server.Commands
else
{
SkillName skill;
try
{
skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true );
}
catch
{
arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
return;
}
arg.Mobile.Target = new SkillTarget( skill );
if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
{
arg.Mobile.Target = new SkillTarget( skill );
}
else
{
arg.Mobile.SendMessage( "You have specified an invalid skill to get." );
}
}
}