Bug in BodyTable, Bodies with an ID over 1000 we not being properly read.
Using Enum.TryParse where applicable
This commit is contained in:
parent
26899493c0
commit
b9f0138b08
5 changed files with 30 additions and 45 deletions
|
|
@ -666,7 +666,8 @@ namespace Server.Accounting
|
|||
}
|
||||
}
|
||||
|
||||
m_AccessLevel = (AccessLevel)Enum.Parse( typeof( AccessLevel ), Utility.GetText( node["accessLevel"], "Player" ), true );
|
||||
Enum.TryParse( Utility.GetText( node["accessLevel"], "Player" ), true, out m_AccessLevel );
|
||||
|
||||
m_Flags = Utility.GetXMLInt32( Utility.GetText( node["flags"], "0" ), 0 );
|
||||
m_Created = Utility.GetXMLDateTime( Utility.GetText( node["created"], null ), DateTime.Now );
|
||||
m_LastLogin = Utility.GetXMLDateTime( Utility.GetText( node["lastLogin"], null ), DateTime.Now );
|
||||
|
|
|
|||
|
|
@ -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." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue