lots of little stuff, but mostly bank optimization, due to the weirdness of the calls
This commit is contained in:
parent
566de1c2cf
commit
f95101c201
29 changed files with 214 additions and 282 deletions
|
|
@ -76,8 +76,7 @@ namespace Server.Commands
|
|||
|
||||
Type type = ScriptCompiler.FindTypeByName( name );
|
||||
|
||||
if ( type == null )
|
||||
{
|
||||
if ( !IsEntity( type ) ) {
|
||||
from.SendMessage( "No type with that name was found." );
|
||||
return;
|
||||
}
|
||||
|
|
@ -239,7 +238,7 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
public static object Build( Mobile from, ConstructorInfo ctor, object[] values, string[,] props, PropertyInfo[] realProps, ref bool sendError )
|
||||
public static IEntity Build( Mobile from, ConstructorInfo ctor, object[] values, string[,] props, PropertyInfo[] realProps, ref bool sendError )
|
||||
{
|
||||
object built = ctor.Invoke( values );
|
||||
|
||||
|
|
@ -267,7 +266,7 @@ namespace Server.Commands
|
|||
sendError = false;
|
||||
}
|
||||
|
||||
return built;
|
||||
return (IEntity)built;
|
||||
}
|
||||
|
||||
public static int Build( Mobile from, Point3D start, Point3D end, ConstructorInfo ctor, object[] values, string[,] props, PropertyInfo[] realProps, List<Container> packs )
|
||||
|
|
@ -290,23 +289,16 @@ namespace Server.Commands
|
|||
{
|
||||
for ( int i = 0; i < packs.Count; ++i )
|
||||
{
|
||||
object built = Build( from, ctor, values, props, realProps, ref sendError );
|
||||
IEntity built = Build( from, ctor, values, props, realProps, ref sendError );
|
||||
|
||||
if( built is IEntity )
|
||||
sb.AppendFormat( "0x{0:X}; ", ((IEntity)built).Serial.Value );
|
||||
else
|
||||
continue;
|
||||
|
||||
if ( built is Item )
|
||||
{
|
||||
sb.AppendFormat( "0x{0:X}; ", built.Serial.Value );
|
||||
|
||||
if ( built is Item ) {
|
||||
Container pack = packs[i];
|
||||
|
||||
pack.DropItem( (Item)built );
|
||||
}
|
||||
else if ( built is Mobile )
|
||||
{
|
||||
else if ( built is Mobile ) {
|
||||
Mobile m = (Mobile)built;
|
||||
|
||||
m.MoveToWorld( new Point3D( start.X, start.Y, start.Z ), map );
|
||||
}
|
||||
}
|
||||
|
|
@ -317,23 +309,16 @@ namespace Server.Commands
|
|||
{
|
||||
for ( int y = start.Y; y <= end.Y; ++y )
|
||||
{
|
||||
object built = Build( from, ctor, values, props, realProps, ref sendError );
|
||||
IEntity built = Build( from, ctor, values, props, realProps, ref sendError );
|
||||
|
||||
if( built is IEntity )
|
||||
sb.AppendFormat( "0x{0:X}; ", ((IEntity)built).Serial.Value );
|
||||
else
|
||||
continue;
|
||||
sb.AppendFormat( "0x{0:X}; ", built.Serial.Value );
|
||||
|
||||
if ( built is Item )
|
||||
{
|
||||
if ( built is Item ) {
|
||||
Item item = (Item)built;
|
||||
|
||||
item.MoveToWorld( new Point3D( x, y, start.Z ), map );
|
||||
}
|
||||
else if ( built is Mobile )
|
||||
{
|
||||
else if ( built is Mobile ) {
|
||||
Mobile m = (Mobile)built;
|
||||
|
||||
m.MoveToWorld( new Point3D( x, y, start.Z ), map );
|
||||
}
|
||||
}
|
||||
|
|
@ -419,7 +404,8 @@ namespace Server.Commands
|
|||
else if ( p is Mobile )
|
||||
p = ((Mobile)p).Location;
|
||||
|
||||
Add.Invoke( from, new Point3D( p ), new Point3D( p ), m_Args );
|
||||
Point3D point = new Point3D( p );
|
||||
Add.Invoke( from, point, point, m_Args );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -529,6 +515,13 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private static Type m_EntityType = typeof( IEntity );
|
||||
|
||||
public static bool IsEntity( Type t )
|
||||
{
|
||||
return m_EntityType.IsAssignableFrom( t );
|
||||
}
|
||||
|
||||
private static Type m_ConstructableType = typeof( ConstructableAttribute );
|
||||
|
||||
public static bool IsConstructable( ConstructorInfo ctor )
|
||||
|
|
|
|||
|
|
@ -205,21 +205,14 @@ namespace Server.Commands
|
|||
{
|
||||
if ( okay )
|
||||
{
|
||||
ArrayList list = (ArrayList)state;
|
||||
List<IEntity> list = (List<IEntity>)state;
|
||||
|
||||
CommandLogging.WriteLine( from, "{0} {1} deleting {2} objects", from.AccessLevel, CommandLogging.Format( from ), list.Count );
|
||||
|
||||
NetState.Pause();
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if ( obj is Item )
|
||||
((Item)obj).Delete();
|
||||
else if ( obj is Mobile )
|
||||
((Mobile)obj).Delete();
|
||||
}
|
||||
list[i].Delete();
|
||||
|
||||
NetState.Resume();
|
||||
|
||||
|
|
@ -243,19 +236,15 @@ namespace Server.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
List<IEntity> list = new List<IEntity>();
|
||||
|
||||
foreach ( Item item in World.Items.Values )
|
||||
{
|
||||
if ( item.Map == map && item.Parent == null )
|
||||
list.Add( item );
|
||||
}
|
||||
|
||||
foreach ( Mobile m in World.Mobiles.Values )
|
||||
{
|
||||
if ( m.Map == map && !m.Player )
|
||||
list.Add( m );
|
||||
}
|
||||
|
||||
if ( list.Count > 0 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
|
@ -42,7 +42,7 @@ namespace Server.Commands
|
|||
|
||||
if ( File.Exists( cfg ) )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
List<SignEntry> list = new List<SignEntry>();
|
||||
from.SendMessage( "Generating signs, please wait." );
|
||||
|
||||
using ( StreamReader ip = new StreamReader( cfg ) )
|
||||
|
|
@ -71,7 +71,7 @@ namespace Server.Commands
|
|||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
SignEntry e = (SignEntry)list[i];
|
||||
SignEntry e = list[i];
|
||||
Map[] maps = null;
|
||||
|
||||
switch ( e.m_Map )
|
||||
|
|
@ -96,7 +96,7 @@ namespace Server.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private static Queue m_ToDelete = new Queue();
|
||||
private static Queue<Item> m_ToDelete = new Queue<Item>();
|
||||
|
||||
public static void Add_Static( int itemID, Point3D location, Map map, string name )
|
||||
{
|
||||
|
|
@ -111,7 +111,7 @@ namespace Server.Commands
|
|||
eable.Free();
|
||||
|
||||
while ( m_ToDelete.Count > 0 )
|
||||
((Item)m_ToDelete.Dequeue()).Delete();
|
||||
m_ToDelete.Dequeue().Delete();
|
||||
|
||||
Item sign;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
using Server.Multis;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Commands
|
||||
{
|
||||
|
|
@ -72,7 +72,7 @@ namespace Server.Commands
|
|||
bool multis = ( (type & WipeType.Multis) != 0 );
|
||||
bool items = ( (type & WipeType.Items) != 0 );
|
||||
|
||||
ArrayList toDelete = new ArrayList();
|
||||
List<IEntity> toDelete = new List<IEntity>();
|
||||
|
||||
Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ namespace Server.Commands
|
|||
else
|
||||
return;
|
||||
|
||||
foreach ( object obj in eable )
|
||||
foreach ( IEntity obj in eable )
|
||||
{
|
||||
if ( items && (obj is Item) && !((obj is BaseMulti) || (obj is HouseSign)) )
|
||||
toDelete.Add( obj );
|
||||
|
|
@ -100,12 +100,7 @@ namespace Server.Commands
|
|||
eable.Free();
|
||||
|
||||
for ( int i = 0; i < toDelete.Count; ++i )
|
||||
{
|
||||
if ( toDelete[i] is Item )
|
||||
((Item)toDelete[i]).Delete();
|
||||
else if ( toDelete[i] is Mobile )
|
||||
((Mobile)toDelete[i]).Delete();
|
||||
}
|
||||
toDelete[i].Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue