diff --git a/Scripts/Commands/Docs.cs b/Scripts/Commands/Docs.cs index 4efc9e157..3f54dc089 100644 --- a/Scripts/Commands/Docs.cs +++ b/Scripts/Commands/Docs.cs @@ -2421,10 +2421,11 @@ namespace Server.Commands if( type.IsGenericType ) { int index = type.Name.IndexOf( '`' ); - string rootType = type.Name.Substring( 0, index ); if( index > 0 ) { + string rootType = type.Name.Substring( 0, index ); + StringBuilder nameBuilder = new StringBuilder( rootType ); StringBuilder fnamBuilder = new StringBuilder( "docs/types/" + Docs.SanitizeType( rootType ) ); StringBuilder linkBuilder; diff --git a/Scripts/Commands/Generic/Implementors/AreaCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/AreaCommandImplementor.cs index 47a48a371..4913b13a6 100644 --- a/Scripts/Commands/Generic/Implementors/AreaCommandImplementor.cs +++ b/Scripts/Commands/Generic/Implementors/AreaCommandImplementor.cs @@ -1,12 +1,18 @@ using System; using System.Collections; using Server; -using Server.Targeting; namespace Server.Commands.Generic { public class AreaCommandImplementor : BaseCommandImplementor { + private static AreaCommandImplementor m_Instance; + + public static AreaCommandImplementor Instance + { + get { return m_Instance; } + } + public AreaCommandImplementor() { Accessors = new string[]{ "Area", "Group" }; @@ -15,6 +21,8 @@ namespace Server.Commands.Generic AccessLevel = AccessLevel.GameMaster; Usage = "Area [condition]"; Description = "Invokes the command on all appropriate objects in a targeted area. Optional condition arguments can further restrict the set of objects."; + + m_Instance = this; } public override void Process( Mobile from, BaseCommand command, string[] args ) @@ -72,57 +80,5 @@ namespace Server.Commands.Generic from.SendMessage( ex.Message ); } } - - public void OnTarget( Mobile from, object targeted, object state ) - { - try - { - object[] states = (object[])state; - BaseCommand command = (BaseCommand)states[0]; - string[] args = (string[])states[1]; - - switch ( command.ObjectTypes ) - { - case ObjectTypes.Both: - { - if ( !(targeted is Item) && !(targeted is Mobile) ) - { - from.SendMessage( "This command does not work on that." ); - return; - } - - break; - } - case ObjectTypes.Items: - { - if ( !(targeted is Item) ) - { - from.SendMessage( "This command only works on items." ); - return; - } - - break; - } - case ObjectTypes.Mobiles: - { - if ( !(targeted is Mobile) ) - { - from.SendMessage( "This command only works on mobiles." ); - return; - } - - break; - } - } - - RunCommand( from, targeted, command, args ); - - from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, new TargetStateCallback( OnTarget ), new object[]{ command, args } ); - } - catch ( Exception ex ) - { - from.SendMessage( ex.Message ); - } - } } } \ No newline at end of file diff --git a/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs index 113f859c5..057d0cabd 100644 --- a/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs +++ b/Scripts/Commands/Generic/Implementors/BaseCommandImplementor.cs @@ -40,6 +40,9 @@ namespace Server.Commands.Generic Register( new AreaCommandImplementor() ); Register( new SelfCommandImplementor() ); Register( new ContainedCommandImplementor() ); + Register( new RangeCommandImplementor() ); + Register( new ScreenCommandImplementor() ); + Register( new FacetCommandImplementor() ); } private string[] m_Accessors; diff --git a/Scripts/Commands/Generic/Implementors/FacetCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/FacetCommandImplementor.cs new file mode 100644 index 000000000..3c0194f27 --- /dev/null +++ b/Scripts/Commands/Generic/Implementors/FacetCommandImplementor.cs @@ -0,0 +1,33 @@ +using System; +using Server; + +namespace Server.Commands.Generic +{ + public class FacetCommandImplementor : BaseCommandImplementor + { + public FacetCommandImplementor() + { + Accessors = new string[]{ "Facet" }; + SupportRequirement = CommandSupport.Area; + SupportsConditionals = true; + AccessLevel = AccessLevel.GameMaster; + Usage = "Facet [condition]"; + Description = "Invokes the command on all appropriate objects within your facet's map bounds. Optional condition arguments can further restrict the set of objects."; + } + + public override void Process( Mobile from, BaseCommand command, string[] args ) + { + AreaCommandImplementor impl = AreaCommandImplementor.Instance; + + if ( impl == null ) + return; + + Map map = from.Map; + + if ( map == null || map == Map.Internal ) + return; + + impl.OnTarget( from, map, Point3D.Zero, new Point3D( map.Width - 1, map.Height - 1, 0 ), new object[] { command, args } ); + } + } +} diff --git a/Scripts/Commands/Generic/Implementors/ObjectConditional.cs b/Scripts/Commands/Generic/Implementors/ObjectConditional.cs index 6a0959e1f..e6eb928f2 100644 --- a/Scripts/Commands/Generic/Implementors/ObjectConditional.cs +++ b/Scripts/Commands/Generic/Implementors/ObjectConditional.cs @@ -135,7 +135,7 @@ namespace Server.Commands.Generic } else if ( Insensitive.Equals( cur, "or" ) || cur == "||" ) { - if ( conditions.Count > 1 ) + if ( current.Count > 1 ) { conditions.Add( current.ToArray() ); diff --git a/Scripts/Commands/Generic/Implementors/RangeCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/RangeCommandImplementor.cs new file mode 100644 index 000000000..92b4e8382 --- /dev/null +++ b/Scripts/Commands/Generic/Implementors/RangeCommandImplementor.cs @@ -0,0 +1,86 @@ +using System; +using Server; + +namespace Server.Commands.Generic +{ + public class RangeCommandImplementor : BaseCommandImplementor + { + private static RangeCommandImplementor m_Instance; + + public static RangeCommandImplementor Instance + { + get { return m_Instance; } + } + + public RangeCommandImplementor() + { + Accessors = new string[]{ "Range" }; + SupportRequirement = CommandSupport.Area; + SupportsConditionals = true; + AccessLevel = AccessLevel.GameMaster; + Usage = "Range [condition]"; + Description = "Invokes the command on all appropriate objects within a specified range of you. Optional condition arguments can further restrict the set of objects."; + + m_Instance = this; + } + + public override void Execute( CommandEventArgs e ) + { + if ( e.Length >= 2 ) + { + int range = e.GetInt32( 0 ); + + if ( range < 0 ) + { + e.Mobile.SendMessage( "The range must not be negative." ); + } + else + { + BaseCommand command = null; + Commands.TryGetValue( e.GetString( 1 ), out command ); + + if ( command == null ) + { + e.Mobile.SendMessage( "That is either an invalid command name or one that does not support this modifier." ); + } + else if ( e.Mobile.AccessLevel < command.AccessLevel ) + { + e.Mobile.SendMessage( "You do not have access to that command." ); + } + else + { + string[] oldArgs = e.Arguments; + string[] args = new string[oldArgs.Length - 2]; + + for ( int i = 0; i < args.Length; ++i ) + args[i] = oldArgs[i + 2]; + + Process( range, e.Mobile, command, args ); + } + } + } + else + { + e.Mobile.SendMessage( "You must supply a range and a command name." ); + } + } + + public void Process( int range, Mobile from, BaseCommand command, string[] args ) + { + AreaCommandImplementor impl = AreaCommandImplementor.Instance; + + if ( impl == null ) + return; + + Map map = from.Map; + + if ( map == null || map == Map.Internal ) + return; + + Point3D start = new Point3D( from.X - range, from.Y - range, from.Z ); + Point3D end = new Point3D( from.X + range, from.Y + range, from.Z ); + + impl.OnTarget( from, map, start, end, new object[] { command, args } ); + } + } +} diff --git a/Scripts/Commands/Generic/Implementors/ScreenCommandImplementor.cs b/Scripts/Commands/Generic/Implementors/ScreenCommandImplementor.cs new file mode 100644 index 000000000..d90ef9600 --- /dev/null +++ b/Scripts/Commands/Generic/Implementors/ScreenCommandImplementor.cs @@ -0,0 +1,28 @@ +using System; +using Server; + +namespace Server.Commands.Generic +{ + public class ScreenCommandImplementor : BaseCommandImplementor + { + public ScreenCommandImplementor() + { + Accessors = new string[]{ "Screen" }; + SupportRequirement = CommandSupport.Area; + SupportsConditionals = true; + AccessLevel = AccessLevel.GameMaster; + Usage = "Screen [condition]"; + Description = "Invokes the command on all appropriate objects in your screen. Optional condition arguments can further restrict the set of objects."; + } + + public override void Process( Mobile from, BaseCommand command, string[] args ) + { + RangeCommandImplementor impl = RangeCommandImplementor.Instance; + + if ( impl == null ) + return; + + impl.Process( 18, from, command, args ); + } + } +} diff --git a/Scripts/Mobiles/BaseCreature.cs b/Scripts/Mobiles/BaseCreature.cs index 3e1dc37bd..95de92752 100644 --- a/Scripts/Mobiles/BaseCreature.cs +++ b/Scripts/Mobiles/BaseCreature.cs @@ -3196,12 +3196,12 @@ namespace Server.Mobiles if ( skill != null && theirSkill != null && skill.Base >= 60.0 && CheckTeach( skill.SkillName, from ) ) { - double toTeach = skill.Base / 3.0; + int toTeach = skill.BaseFixedPoint / 3; - if ( toTeach > 42.0 ) - toTeach = 42.0; + if ( toTeach > 420 ) + toTeach = 420; - list.Add( new TeachEntry( (SkillName)i, this, from, ( toTeach > theirSkill.Base ) ) ); + list.Add( new TeachEntry( (SkillName)i, this, from, ( toTeach > theirSkill.BaseFixedPoint ) ) ); } } } diff --git a/Scripts/Multis/Deeds.cs b/Scripts/Multis/Deeds.cs index a5f2a5ef9..4082f3ce2 100644 --- a/Scripts/Multis/Deeds.cs +++ b/Scripts/Multis/Deeds.cs @@ -34,7 +34,7 @@ namespace Server.Multis.Deeds m_Deed.OnPlacement( from, p ); else if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) ) from.SendLocalizedMessage( 501270 ); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time. - else if ( reg.IsPartOf( typeof( TreasureRegion ) ) ) + else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( HouseRegion ) ) ) from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain. else if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) ) from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here. diff --git a/Scripts/Multis/HousePlacement.cs b/Scripts/Multis/HousePlacement.cs index 74c4f343b..81fce03bc 100644 --- a/Scripts/Multis/HousePlacement.cs +++ b/Scripts/Multis/HousePlacement.cs @@ -112,7 +112,7 @@ namespace Server.Multis if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) ) return HousePlacementResult.BadRegionTemp; - if ( reg.IsPartOf( typeof( TreasureRegion ) ) ) + if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( HouseRegion ) ) ) return HousePlacementResult.BadRegionHidden; if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) ) diff --git a/Scripts/Multis/HousePlacementTool.cs b/Scripts/Multis/HousePlacementTool.cs index 9fddf058a..94337fdbb 100644 --- a/Scripts/Multis/HousePlacementTool.cs +++ b/Scripts/Multis/HousePlacementTool.cs @@ -250,7 +250,7 @@ namespace Server.Items m_Placed = m_Entry.OnPlacement( from, p ); else if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) ) from.SendLocalizedMessage( 501270 ); // Lord British has decreed a 'no build' period, thus you cannot build this house at this time. - else if ( reg.IsPartOf( typeof( TreasureRegion ) ) ) + else if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( HouseRegion ) ) ) from.SendLocalizedMessage( 1043287 ); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain. else if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) ) from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here. diff --git a/Scripts/Regions/HouseRegion.cs b/Scripts/Regions/HouseRegion.cs index c44289374..27a9a7d1b 100644 --- a/Scripts/Regions/HouseRegion.cs +++ b/Scripts/Regions/HouseRegion.cs @@ -38,6 +38,11 @@ namespace Server.Regions this.GoLocation = new Point3D( house.X + ban.X, house.Y + ban.Y, house.Z + ban.Z ); } + public override bool AllowHousing( Mobile from, Point3D p ) + { + return false; + } + private static Rectangle3D[] GetArea( BaseHouse house ) { int x = house.X;