- Fixed 'or' operator for object conditionals.
- Fixed train context menu occasionally showing the train option as available when it shouldn't be. - Fixed a crash in the documentation generator. - Added 3 new command implementors, serving as aliases for various Area usages: Range, Screen and Facet - Fixed house placement allowing placed houses to intersect other house regions.
This commit is contained in:
parent
72c4dc6018
commit
2c829d38ed
12 changed files with 174 additions and 62 deletions
|
|
@ -2421,10 +2421,11 @@ namespace Server.Commands
|
||||||
if( type.IsGenericType )
|
if( type.IsGenericType )
|
||||||
{
|
{
|
||||||
int index = type.Name.IndexOf( '`' );
|
int index = type.Name.IndexOf( '`' );
|
||||||
string rootType = type.Name.Substring( 0, index );
|
|
||||||
|
|
||||||
if( index > 0 )
|
if( index > 0 )
|
||||||
{
|
{
|
||||||
|
string rootType = type.Name.Substring( 0, index );
|
||||||
|
|
||||||
StringBuilder nameBuilder = new StringBuilder( rootType );
|
StringBuilder nameBuilder = new StringBuilder( rootType );
|
||||||
StringBuilder fnamBuilder = new StringBuilder( "docs/types/" + Docs.SanitizeType( rootType ) );
|
StringBuilder fnamBuilder = new StringBuilder( "docs/types/" + Docs.SanitizeType( rootType ) );
|
||||||
StringBuilder linkBuilder;
|
StringBuilder linkBuilder;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,18 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Server;
|
using Server;
|
||||||
using Server.Targeting;
|
|
||||||
|
|
||||||
namespace Server.Commands.Generic
|
namespace Server.Commands.Generic
|
||||||
{
|
{
|
||||||
public class AreaCommandImplementor : BaseCommandImplementor
|
public class AreaCommandImplementor : BaseCommandImplementor
|
||||||
{
|
{
|
||||||
|
private static AreaCommandImplementor m_Instance;
|
||||||
|
|
||||||
|
public static AreaCommandImplementor Instance
|
||||||
|
{
|
||||||
|
get { return m_Instance; }
|
||||||
|
}
|
||||||
|
|
||||||
public AreaCommandImplementor()
|
public AreaCommandImplementor()
|
||||||
{
|
{
|
||||||
Accessors = new string[]{ "Area", "Group" };
|
Accessors = new string[]{ "Area", "Group" };
|
||||||
|
|
@ -15,6 +21,8 @@ namespace Server.Commands.Generic
|
||||||
AccessLevel = AccessLevel.GameMaster;
|
AccessLevel = AccessLevel.GameMaster;
|
||||||
Usage = "Area <command> [condition]";
|
Usage = "Area <command> [condition]";
|
||||||
Description = "Invokes the command on all appropriate objects in a targeted area. Optional condition arguments can further restrict the set of objects.";
|
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 )
|
public override void Process( Mobile from, BaseCommand command, string[] args )
|
||||||
|
|
@ -72,57 +80,5 @@ namespace Server.Commands.Generic
|
||||||
from.SendMessage( ex.Message );
|
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -40,6 +40,9 @@ namespace Server.Commands.Generic
|
||||||
Register( new AreaCommandImplementor() );
|
Register( new AreaCommandImplementor() );
|
||||||
Register( new SelfCommandImplementor() );
|
Register( new SelfCommandImplementor() );
|
||||||
Register( new ContainedCommandImplementor() );
|
Register( new ContainedCommandImplementor() );
|
||||||
|
Register( new RangeCommandImplementor() );
|
||||||
|
Register( new ScreenCommandImplementor() );
|
||||||
|
Register( new FacetCommandImplementor() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private string[] m_Accessors;
|
private string[] m_Accessors;
|
||||||
|
|
|
||||||
|
|
@ -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 <command> [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 } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ namespace Server.Commands.Generic
|
||||||
}
|
}
|
||||||
else if ( Insensitive.Equals( cur, "or" ) || cur == "||" )
|
else if ( Insensitive.Equals( cur, "or" ) || cur == "||" )
|
||||||
{
|
{
|
||||||
if ( conditions.Count > 1 )
|
if ( current.Count > 1 )
|
||||||
{
|
{
|
||||||
conditions.Add( current.ToArray() );
|
conditions.Add( current.ToArray() );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 <range> <command> [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 } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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 <command> [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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3196,12 +3196,12 @@ namespace Server.Mobiles
|
||||||
|
|
||||||
if ( skill != null && theirSkill != null && skill.Base >= 60.0 && CheckTeach( skill.SkillName, from ) )
|
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 )
|
if ( toTeach > 420 )
|
||||||
toTeach = 42.0;
|
toTeach = 420;
|
||||||
|
|
||||||
list.Add( new TeachEntry( (SkillName)i, this, from, ( toTeach > theirSkill.Base ) ) );
|
list.Add( new TeachEntry( (SkillName)i, this, from, ( toTeach > theirSkill.BaseFixedPoint ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace Server.Multis.Deeds
|
||||||
m_Deed.OnPlacement( from, p );
|
m_Deed.OnPlacement( from, p );
|
||||||
else if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
|
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.
|
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.
|
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 ) ) )
|
else if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) )
|
||||||
from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here.
|
from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here.
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ namespace Server.Multis
|
||||||
if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
|
if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
|
||||||
return HousePlacementResult.BadRegionTemp;
|
return HousePlacementResult.BadRegionTemp;
|
||||||
|
|
||||||
if ( reg.IsPartOf( typeof( TreasureRegion ) ) )
|
if ( reg.IsPartOf( typeof( TreasureRegion ) ) || reg.IsPartOf( typeof( HouseRegion ) ) )
|
||||||
return HousePlacementResult.BadRegionHidden;
|
return HousePlacementResult.BadRegionHidden;
|
||||||
|
|
||||||
if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) )
|
if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) )
|
||||||
|
|
|
||||||
|
|
@ -250,7 +250,7 @@ namespace Server.Items
|
||||||
m_Placed = m_Entry.OnPlacement( from, p );
|
m_Placed = m_Entry.OnPlacement( from, p );
|
||||||
else if ( reg.IsPartOf( typeof( TempNoHousingRegion ) ) )
|
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.
|
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.
|
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 ) ) )
|
else if ( reg.IsPartOf( typeof( HouseRaffleRegion ) ) )
|
||||||
from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here.
|
from.SendLocalizedMessage( 1150493 ); // You must have a deed for this plot of land in order to build here.
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,11 @@ namespace Server.Regions
|
||||||
this.GoLocation = new Point3D( house.X + ban.X, house.Y + ban.Y, house.Z + ban.Z );
|
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 )
|
private static Rectangle3D[] GetArea( BaseHouse house )
|
||||||
{
|
{
|
||||||
int x = house.X;
|
int x = house.X;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue