revert forced 4.0 migration -- many users are still dependent on 2.0

This commit is contained in:
mark 2012-03-07 13:47:33 +00:00
parent 7b48ebb7e6
commit 4bcde77cc2
13 changed files with 531 additions and 46 deletions

View file

@ -665,9 +665,11 @@ namespace Server.Accounting
break;
}
}
#if Framework_4_0
Enum.TryParse( Utility.GetText( node["accessLevel"], "Player" ), true, out m_AccessLevel );
#else
m_AccessLevel = (AccessLevel)Enum.Parse( typeof( AccessLevel ), Utility.GetText( node["accessLevel"], "Player" ), true );
#endif
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 );

View file

@ -25,7 +25,7 @@ namespace Server.Commands
else
{
SkillName skill;
#if Framework_4_0
if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
{
arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
@ -34,6 +34,18 @@ namespace Server.Commands
{
arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
}
#else
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, arg.GetDouble( 1 ) );
#endif
}
}
@ -62,7 +74,7 @@ namespace Server.Commands
else
{
SkillName skill;
#if Framework_4_0
if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
{
arg.Mobile.Target = new SkillTarget( skill );
@ -71,6 +83,19 @@ namespace Server.Commands
{
arg.Mobile.SendMessage( "You have specified an invalid skill to get." );
}
#else
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 );
#endif
}
}

View file

@ -121,13 +121,29 @@ namespace Server.Misc
private static void ChangeSkill( Mobile from, string name, double value )
{
SkillName index;
#if Framework_4_0
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;
}
#else
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 ) )
{
from.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
return;
}
#endif
Skill skill = from.Skills[index];
if ( skill != null )