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

@ -122,17 +122,7 @@ namespace Server.Misc
{
SkillName index;
try
{
index = (SkillName)Enum.Parse( typeof( SkillName ), name, true );
}
catch
{
from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
return;
}
if ( ( !Core.SE && (int)index > 51 ) || ( !Core.AOS && (int)index > 48 ) )
if( !Enum.TryParse( name, true, out index ) || (!Core.SE && (int)index > 51) || (!Core.AOS && (int)index > 48) )
{
from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
return;