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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -23,10 +23,7 @@ namespace Server.ContextMenus
|
|||
}
|
||||
else
|
||||
{
|
||||
BankBox box = this.Owner.From.BankBox;
|
||||
|
||||
if ( box != null )
|
||||
box.Open();
|
||||
this.Owner.From.BankBox.Open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,9 @@ namespace Server.Engines.Plants
|
|||
|
||||
if ( owner.Backpack != null && IsChildOf( owner.Backpack ) )
|
||||
return true;
|
||||
if ( owner.BankBox != null && IsChildOf( owner.BankBox ) )
|
||||
|
||||
BankBox bank = owner.FindBankNoCreate();
|
||||
if ( bank != null && IsChildOf( bank ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -317,7 +319,7 @@ namespace Server.Engines.Plants
|
|||
public bool IsUsableBy( Mobile from )
|
||||
{
|
||||
Item root = RootParent as Item;
|
||||
return IsChildOf( from.Backpack ) || IsChildOf( from.BankBox ) || IsLockedDown && IsAccessibleTo( from ) || root != null && root.IsSecure && root.IsAccessibleTo( from );
|
||||
return IsChildOf( from.Backpack ) || IsChildOf( from.FindBankNoCreate() ) || IsLockedDown && IsAccessibleTo( from ) || root != null && root.IsSecure && root.IsAccessibleTo( from );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
|
|
|
|||
|
|
@ -400,9 +400,11 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
}
|
||||
|
||||
if ( from.BankBox != null )
|
||||
BankBox bank = from.FindBankNoCreate();
|
||||
|
||||
if ( bank != null )
|
||||
{
|
||||
Item[] plants = from.BankBox.FindItemsByType( typeof( PlantItem ) );
|
||||
Item[] plants = bank.FindItemsByType( typeof( PlantItem ) );
|
||||
|
||||
foreach ( PlantItem plant in plants )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -147,7 +147,9 @@ namespace Server.Engines.Quests.Collector
|
|||
|
||||
if ( obj != null && !obj.Completed )
|
||||
{
|
||||
if ( player.BankBox != null && player.BankBox.ConsumeTotal( typeof( Gold ), 10 ) )
|
||||
BankBox bank = player.FindBankNoCreate();
|
||||
|
||||
if ( bank != null && bank.ConsumeTotal( typeof( Gold ), 10 ) )
|
||||
{
|
||||
obj.Complete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,10 +131,7 @@ namespace Server.Engines.Quests.Doom
|
|||
|
||||
if ( obj != null && obj.CurProgress > 0 )
|
||||
{
|
||||
BankBox box = From.BankBox;
|
||||
|
||||
if ( box != null )
|
||||
box.DropItem( new DaemonBone( obj.CurProgress ) );
|
||||
From.BankBox.DropItem( new DaemonBone( obj.CurProgress ) );
|
||||
|
||||
From.SendLocalizedMessage( 1050030 ); // The Daemon bones that you have thus far given to Victoria have been returned to you.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
|
|
@ -16,7 +16,7 @@ namespace Server.Mobiles
|
|||
private TimeSpan m_MinDelay;
|
||||
private TimeSpan m_MaxDelay;
|
||||
private List<string> m_CreaturesName;
|
||||
private ArrayList m_Creatures;
|
||||
private List<IEntity> m_Creatures;
|
||||
private DateTime m_End;
|
||||
private InternalTimer m_Timer;
|
||||
private bool m_Running;
|
||||
|
|
@ -188,7 +188,7 @@ namespace Server.Mobiles
|
|||
m_Team = team;
|
||||
m_HomeRange = homeRange;
|
||||
m_CreaturesName = creaturesName;
|
||||
m_Creatures = new ArrayList();
|
||||
m_Creatures = new List<IEntity>();
|
||||
DoTimer( TimeSpan.FromSeconds( 1 ) );
|
||||
}
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ namespace Server.Mobiles
|
|||
list.Add( 1060661, "speed\t{0} to {1}", m_MinDelay, m_MaxDelay ); // ~1_val~: ~2_val~
|
||||
|
||||
for ( int i = 0; i < 2 && i < m_CreaturesName.Count; ++i )
|
||||
list.Add( 1060662 + i, "{0}\t{1}", m_CreaturesName[i], CountCreatures( (string)m_CreaturesName[i] ) );
|
||||
list.Add( 1060662 + i, "{0}\t{1}", m_CreaturesName[i], CountCreatures( m_CreaturesName[i] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -267,11 +267,11 @@ namespace Server.Mobiles
|
|||
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
{
|
||||
object o = m_Creatures[i];
|
||||
IEntity e = m_Creatures[i];
|
||||
|
||||
if ( o is Item )
|
||||
if ( e is Item )
|
||||
{
|
||||
Item item = (Item)o;
|
||||
Item item = (Item)e;
|
||||
|
||||
if ( item.Deleted || item.Parent != null )
|
||||
{
|
||||
|
|
@ -280,9 +280,9 @@ namespace Server.Mobiles
|
|||
removed = true;
|
||||
}
|
||||
}
|
||||
else if ( o is Mobile )
|
||||
else if ( e is Mobile )
|
||||
{
|
||||
Mobile m = (Mobile)o;
|
||||
Mobile m = (Mobile)e;
|
||||
|
||||
if ( m.Deleted )
|
||||
{
|
||||
|
|
@ -292,7 +292,8 @@ namespace Server.Mobiles
|
|||
}
|
||||
else if ( m is BaseCreature )
|
||||
{
|
||||
if ( ((BaseCreature)m).Controlled || ((BaseCreature)m).IsStabled )
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
if ( bc.Controlled || bc.IsStabled )
|
||||
{
|
||||
m_Creatures.RemoveAt( i );
|
||||
--i;
|
||||
|
|
@ -353,7 +354,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
for ( int i = 0; i < m_CreaturesName.Count; i++ )
|
||||
{
|
||||
if ( (string)m_CreaturesName[i] == creatureName )
|
||||
if ( m_CreaturesName[i] == creatureName )
|
||||
{
|
||||
Spawn( i );
|
||||
break;
|
||||
|
|
@ -373,7 +374,7 @@ namespace Server.Mobiles
|
|||
if ( m_Creatures.Count >= m_Count )
|
||||
return;
|
||||
|
||||
Type type = SpawnerType.GetType( (string)m_CreaturesName[index] );
|
||||
Type type = SpawnerType.GetType( m_CreaturesName[index] );
|
||||
|
||||
if ( type != null )
|
||||
{
|
||||
|
|
@ -525,19 +526,12 @@ namespace Server.Mobiles
|
|||
{
|
||||
Defrag();
|
||||
|
||||
creatureName = creatureName.ToLower();
|
||||
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
{
|
||||
object o = m_Creatures[i];
|
||||
IEntity e = m_Creatures[i];
|
||||
|
||||
if ( Insensitive.Equals( creatureName, o.GetType().Name ) )
|
||||
{
|
||||
if ( o is Item )
|
||||
((Item)o).Delete();
|
||||
else if ( o is Mobile )
|
||||
((Mobile)o).Delete();
|
||||
}
|
||||
if ( Insensitive.Equals( creatureName, e.GetType().Name ) )
|
||||
e.Delete();
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
|
|
@ -548,14 +542,7 @@ namespace Server.Mobiles
|
|||
Defrag();
|
||||
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
{
|
||||
object o = m_Creatures[i];
|
||||
|
||||
if ( o is Item )
|
||||
((Item)o).Delete();
|
||||
else if ( o is Mobile )
|
||||
((Mobile)o).Delete();
|
||||
}
|
||||
m_Creatures[i].Delete();
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
|
@ -566,17 +553,17 @@ namespace Server.Mobiles
|
|||
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
{
|
||||
object o = m_Creatures[i];
|
||||
IEntity e = m_Creatures[i];
|
||||
|
||||
if ( o is Mobile )
|
||||
if ( e is Mobile )
|
||||
{
|
||||
Mobile m = (Mobile)o;
|
||||
Mobile m = (Mobile)e;
|
||||
|
||||
m.MoveToWorld( Location, Map );
|
||||
}
|
||||
else if ( o is Item )
|
||||
else if ( e is Item )
|
||||
{
|
||||
Item item = (Item)o;
|
||||
Item item = (Item)e;
|
||||
|
||||
item.MoveToWorld( Location, Map );
|
||||
}
|
||||
|
|
@ -622,12 +609,12 @@ namespace Server.Mobiles
|
|||
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
{
|
||||
object o = m_Creatures[i];
|
||||
IEntity e = m_Creatures[i];
|
||||
|
||||
if ( o is Item )
|
||||
writer.Write( (Item)o );
|
||||
else if ( o is Mobile )
|
||||
writer.Write( (Mobile)o );
|
||||
if ( e is Item )
|
||||
writer.Write( (Item)e );
|
||||
else if ( e is Mobile )
|
||||
writer.Write( (Mobile)e );
|
||||
else
|
||||
writer.Write( Serial.MinusOne );
|
||||
}
|
||||
|
|
@ -699,7 +686,7 @@ namespace Server.Mobiles
|
|||
|
||||
int count = reader.ReadInt();
|
||||
|
||||
m_Creatures = new ArrayList( count );
|
||||
m_Creatures = new List<IEntity>( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ namespace Server.Gumps
|
|||
{
|
||||
BankBox box = m_Mobile.BankBox;
|
||||
|
||||
if ( box != null && box.TryDropItem( m_Mobile, toGive, false ) )
|
||||
if ( box.TryDropItem( m_Mobile, toGive, false ) )
|
||||
{
|
||||
if ( toGive is BankCheck )
|
||||
m_Mobile.SendLocalizedMessage( 1060397, ((BankCheck)toGive).Worth.ToString() ); // ~1_AMOUNT~ gold has been deposited into your bank box.
|
||||
|
|
|
|||
|
|
@ -66,8 +66,10 @@ namespace Server.Gumps
|
|||
if ( from.Backpack != null )
|
||||
totalGold += from.Backpack.GetAmount( typeof( Gold ) );
|
||||
|
||||
if ( from.BankBox != null )
|
||||
totalGold += from.BankBox.GetAmount( typeof( Gold ) );
|
||||
BankBox bank = from.FindBankNoCreate();
|
||||
|
||||
if ( bank != null )
|
||||
totalGold += bank.GetAmount( typeof( Gold ) );
|
||||
|
||||
if ( totalGold < m_VI.Price )
|
||||
{
|
||||
|
|
@ -83,9 +85,9 @@ namespace Server.Gumps
|
|||
|
||||
if ( from.Backpack != null )
|
||||
leftPrice -= from.Backpack.ConsumeUpTo( typeof( Gold ), leftPrice );
|
||||
|
||||
if ( leftPrice > 0 && from.BankBox != null )
|
||||
from.BankBox.ConsumeUpTo( typeof( Gold ), leftPrice );
|
||||
|
||||
if ( leftPrice > 0 && bank != null )
|
||||
bank.ConsumeUpTo( typeof( Gold ), leftPrice );
|
||||
|
||||
m_Vendor.HoldGold += m_VI.Price;
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace Server.Gumps
|
|||
inventory.Items.RemoveAt( i );
|
||||
givenToBackpack += 1 + item.TotalItems;
|
||||
}
|
||||
else if ( from.BankBox != null && from.BankBox.TryDropItem( from, item, false ) )
|
||||
else if ( from.BankBox.TryDropItem( from, item, false ) )
|
||||
{
|
||||
inventory.Items.RemoveAt( i );
|
||||
givenToBankBox += 1 + item.TotalItems;
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ namespace Server.Items
|
|||
{
|
||||
int number;
|
||||
|
||||
BankBox box = from.BankBox;
|
||||
BankBox box = from.FindBankNoCreate();
|
||||
|
||||
if ( m_Commodity != null )
|
||||
{
|
||||
|
|
@ -169,7 +169,7 @@ namespace Server.Items
|
|||
}
|
||||
else if ( targeted is Item )
|
||||
{
|
||||
BankBox box = from.BankBox;
|
||||
BankBox box = from.FindBankNoCreate();
|
||||
|
||||
if ( box != null && m_Deed.IsChildOf( box ) && ((Item)targeted).IsChildOf( box ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
BankBox box = from.BankBox;
|
||||
BankBox box = from.FindBankNoCreate();
|
||||
|
||||
if ( box != null && IsChildOf( box ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ namespace Server.Items
|
|||
|
||||
writer.Write( count );
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
KeyValuePair<Item, Point3D> kvp = list[i];
|
||||
Item item = kvp.Key;
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage( 1062089 ); // You cannot use that here.
|
||||
}
|
||||
else if ( from.BankBox == null || !from.BankBox.TryDropItem( from, item, false ) )
|
||||
else if ( !from.BankBox.TryDropItem( from, item, false ) )
|
||||
{
|
||||
MessageHelper.SendLocalizedMessageTo( m_Bag, from, 1054110, 0x59 ); // Your bank box is full.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,9 +62,6 @@ namespace Server.Misc
|
|||
{
|
||||
BankBox bank = m.BankBox;
|
||||
|
||||
if ( bank == null )
|
||||
return;
|
||||
|
||||
// The new AOS bankboxes don't have powerscrolls, they are automatically 'applied':
|
||||
|
||||
for ( int i = 0; i < PowerScroll.Skills.Length; ++i )
|
||||
|
|
@ -431,107 +428,104 @@ namespace Server.Misc
|
|||
|
||||
BankBox bank = m.BankBox;
|
||||
|
||||
if ( bank != null )
|
||||
{
|
||||
bank.DropItem( new BankCheck( 1000000 ) );
|
||||
bank.DropItem( new BankCheck( 1000000 ) );
|
||||
|
||||
// Full spellbook
|
||||
Spellbook book = new Spellbook();
|
||||
// Full spellbook
|
||||
Spellbook book = new Spellbook();
|
||||
|
||||
book.Content = ulong.MaxValue;
|
||||
book.Content = ulong.MaxValue;
|
||||
|
||||
bank.DropItem( book );
|
||||
bank.DropItem( book );
|
||||
|
||||
Bag bag = new Bag();
|
||||
Bag bag = new Bag();
|
||||
|
||||
for ( int i = 0; i < 5; ++i )
|
||||
bag.DropItem( new Moonstone( MoonstoneType.Felucca ) );
|
||||
for ( int i = 0; i < 5; ++i )
|
||||
bag.DropItem( new Moonstone( MoonstoneType.Felucca ) );
|
||||
|
||||
// Felucca moonstones
|
||||
bank.DropItem( bag );
|
||||
// Felucca moonstones
|
||||
bank.DropItem( bag );
|
||||
|
||||
bag = new Bag();
|
||||
bag = new Bag();
|
||||
|
||||
for ( int i = 0; i < 5; ++i )
|
||||
bag.DropItem( new Moonstone( MoonstoneType.Trammel ) );
|
||||
for ( int i = 0; i < 5; ++i )
|
||||
bag.DropItem( new Moonstone( MoonstoneType.Trammel ) );
|
||||
|
||||
// Trammel moonstones
|
||||
bank.DropItem( bag );
|
||||
// Trammel moonstones
|
||||
bank.DropItem( bag );
|
||||
|
||||
// Treasure maps
|
||||
bank.DropItem( new TreasureMap( 1, Map.Trammel ) );
|
||||
bank.DropItem( new TreasureMap( 2, Map.Trammel ) );
|
||||
bank.DropItem( new TreasureMap( 3, Map.Trammel ) );
|
||||
bank.DropItem( new TreasureMap( 4, Map.Trammel ) );
|
||||
bank.DropItem( new TreasureMap( 5, Map.Trammel ) );
|
||||
// Treasure maps
|
||||
bank.DropItem( new TreasureMap( 1, Map.Trammel ) );
|
||||
bank.DropItem( new TreasureMap( 2, Map.Trammel ) );
|
||||
bank.DropItem( new TreasureMap( 3, Map.Trammel ) );
|
||||
bank.DropItem( new TreasureMap( 4, Map.Trammel ) );
|
||||
bank.DropItem( new TreasureMap( 5, Map.Trammel ) );
|
||||
|
||||
// Bag containing 50 of each reagent
|
||||
bank.DropItem( new BagOfReagents( 50 ) );
|
||||
// Bag containing 50 of each reagent
|
||||
bank.DropItem( new BagOfReagents( 50 ) );
|
||||
|
||||
// Craft tools
|
||||
bank.DropItem( MakeNewbie( new Scissors() ) );
|
||||
bank.DropItem( MakeNewbie( new SewingKit( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new SmithHammer( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new FletcherTools( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new DovetailSaw( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new MortarPestle( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new ScribesPen( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new TinkerTools( 1000 ) ) );
|
||||
// Craft tools
|
||||
bank.DropItem( MakeNewbie( new Scissors() ) );
|
||||
bank.DropItem( MakeNewbie( new SewingKit( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new SmithHammer( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new FletcherTools( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new DovetailSaw( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new MortarPestle( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new ScribesPen( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new TinkerTools( 1000 ) ) );
|
||||
|
||||
// A few dye tubs
|
||||
bank.DropItem( new Dyes() );
|
||||
bank.DropItem( new DyeTub() );
|
||||
bank.DropItem( new DyeTub() );
|
||||
bank.DropItem( new BlackDyeTub() );
|
||||
// A few dye tubs
|
||||
bank.DropItem( new Dyes() );
|
||||
bank.DropItem( new DyeTub() );
|
||||
bank.DropItem( new DyeTub() );
|
||||
bank.DropItem( new BlackDyeTub() );
|
||||
|
||||
DyeTub darkRedTub = new DyeTub();
|
||||
DyeTub darkRedTub = new DyeTub();
|
||||
|
||||
darkRedTub.DyedHue = 0x485;
|
||||
darkRedTub.Redyable = false;
|
||||
darkRedTub.DyedHue = 0x485;
|
||||
darkRedTub.Redyable = false;
|
||||
|
||||
bank.DropItem( darkRedTub );
|
||||
bank.DropItem( darkRedTub );
|
||||
|
||||
// Some food
|
||||
bank.DropItem( MakeNewbie( new Apple( 1000 ) ) );
|
||||
// Some food
|
||||
bank.DropItem( MakeNewbie( new Apple( 1000 ) ) );
|
||||
|
||||
// Resources
|
||||
bank.DropItem( MakeNewbie( new Feather( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new BoltOfCloth( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new BlankScroll( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Hides( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Bandage( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Bottle( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Log( 1000 ) ) );
|
||||
// Resources
|
||||
bank.DropItem( MakeNewbie( new Feather( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new BoltOfCloth( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new BlankScroll( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Hides( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Bandage( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Bottle( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Log( 1000 ) ) );
|
||||
|
||||
bank.DropItem( MakeNewbie( new IronIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new DullCopperIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new ShadowIronIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new CopperIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new BronzeIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new GoldIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new AgapiteIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new VeriteIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new ValoriteIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new IronIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new DullCopperIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new ShadowIronIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new CopperIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new BronzeIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new GoldIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new AgapiteIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new VeriteIngot( 5000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new ValoriteIngot( 5000 ) ) );
|
||||
|
||||
// Reagents
|
||||
bank.DropItem( MakeNewbie( new BlackPearl( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Bloodmoss( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Garlic( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Ginseng( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new MandrakeRoot( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Nightshade( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new SulfurousAsh( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new SpidersSilk( 1000 ) ) );
|
||||
// Reagents
|
||||
bank.DropItem( MakeNewbie( new BlackPearl( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Bloodmoss( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Garlic( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Ginseng( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new MandrakeRoot( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new Nightshade( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new SulfurousAsh( 1000 ) ) );
|
||||
bank.DropItem( MakeNewbie( new SpidersSilk( 1000 ) ) );
|
||||
|
||||
// Some extra starting gold
|
||||
bank.DropItem( MakeNewbie( new Gold( 9000 ) ) );
|
||||
// Some extra starting gold
|
||||
bank.DropItem( MakeNewbie( new Gold( 9000 ) ) );
|
||||
|
||||
// 5 blank recall runes
|
||||
for ( int i = 0; i < 5; ++i )
|
||||
bank.DropItem( MakeNewbie( new RecallRune() ) );
|
||||
// 5 blank recall runes
|
||||
for ( int i = 0; i < 5; ++i )
|
||||
bank.DropItem( MakeNewbie( new RecallRune() ) );
|
||||
|
||||
AddPowerScrolls( bank );
|
||||
}
|
||||
AddPowerScrolls( bank );
|
||||
}
|
||||
|
||||
private static void AddPowerScrolls( BankBox bank )
|
||||
|
|
@ -690,7 +684,7 @@ namespace Server.Misc
|
|||
if( TestCenter.Enabled )
|
||||
FillBankbox( newChar );
|
||||
|
||||
if ( young && newChar.BankBox != null )
|
||||
if ( young )
|
||||
{
|
||||
NewPlayerTicket ticket = new NewPlayerTicket();
|
||||
ticket.Owner = newChar;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
int balance = 0;
|
||||
|
||||
Container bank = from.BankBox;
|
||||
Container bank = from.FindBankNoCreate();
|
||||
|
||||
if ( bank != null )
|
||||
{
|
||||
|
|
@ -100,7 +100,7 @@ namespace Server.Mobiles
|
|||
|
||||
public static bool Deposit( Mobile from, int amount )
|
||||
{
|
||||
BankBox box = from.BankBox;
|
||||
BankBox box = from.FindBankNoCreate();
|
||||
if ( box == null )
|
||||
return false;
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ namespace Server.Mobiles
|
|||
|
||||
public static int DepositUpTo( Mobile from, int amount )
|
||||
{
|
||||
BankBox box = from.BankBox;
|
||||
BankBox box = from.FindBankNoCreate();
|
||||
if ( box == null )
|
||||
return 0;
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else if ( amount > 0 )
|
||||
{
|
||||
BankBox box = e.Mobile.BankBox;
|
||||
BankBox box = e.Mobile.FindBankNoCreate();
|
||||
|
||||
if ( box == null || !box.ConsumeTotal( typeof( Gold ), amount ) )
|
||||
{
|
||||
|
|
@ -292,12 +292,12 @@ namespace Server.Mobiles
|
|||
break;
|
||||
}
|
||||
|
||||
BankBox box = e.Mobile.BankBox;
|
||||
BankBox box = e.Mobile.FindBankNoCreate();
|
||||
|
||||
if ( box != null )
|
||||
{
|
||||
this.Say( 1042759, box.TotalGold.ToString() ); // Thy current bank balance is ~1_AMOUNT~ gold.
|
||||
}
|
||||
else
|
||||
this.Say( 1042759, "0" ); // Thy current bank balance is ~1_AMOUNT~ gold.
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -311,10 +311,7 @@ namespace Server.Mobiles
|
|||
break;
|
||||
}
|
||||
|
||||
BankBox box = e.Mobile.BankBox;
|
||||
|
||||
if ( box != null )
|
||||
box.Open();
|
||||
e.Mobile.BankBox.Open();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -357,7 +354,7 @@ namespace Server.Mobiles
|
|||
|
||||
BankBox box = e.Mobile.BankBox;
|
||||
|
||||
if ( box == null || !box.TryDropItem( e.Mobile, check, false ) )
|
||||
if ( !box.TryDropItem( e.Mobile, check, false ) )
|
||||
{
|
||||
this.Say( 500386 ); // There's not enough room in your bankbox for the check!
|
||||
check.Delete();
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ namespace Server.Mobiles
|
|||
|
||||
Gold gold = new Gold( 500, 1000 );
|
||||
|
||||
if ( cont == null || !cont.TryDropItem( escorter, gold, false ) )
|
||||
if ( !cont.TryDropItem( escorter, gold, false ) )
|
||||
gold.MoveToWorld( escorter.Location, escorter.Map );
|
||||
|
||||
StopFollow();
|
||||
|
|
|
|||
|
|
@ -974,7 +974,7 @@ namespace Server.Mobiles
|
|||
|
||||
if ( !bought && totalCost >= 2000 )
|
||||
{
|
||||
cont = buyer.BankBox;
|
||||
cont = buyer.FindBankNoCreate();
|
||||
if ( cont != null && cont.ConsumeTotal( typeof( Gold ), totalCost ) )
|
||||
{
|
||||
bought = true;
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else
|
||||
{
|
||||
Container bank = from.BankBox;
|
||||
Container bank = from.FindBankNoCreate();
|
||||
|
||||
if ( bank != null && bank.ConsumeTotal( typeof( Gold ), 30 ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1322,7 +1322,7 @@ namespace Server.Multis
|
|||
|
||||
BankBox box = m.BankBox;
|
||||
|
||||
if ( box == null || !box.TryDropItem( m, bankKey, false ) )
|
||||
if ( !box.TryDropItem( m, bankKey, false ) )
|
||||
bankKey.Delete();
|
||||
|
||||
m.AddToBackpack( packKey );
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ namespace Server.Multis
|
|||
|
||||
BankBox box = m.BankBox;
|
||||
|
||||
if ( box == null || !box.TryDropItem( m, bankKey, false ) )
|
||||
if ( !box.TryDropItem( m, bankKey, false ) )
|
||||
bankKey.Delete();
|
||||
else
|
||||
m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 502484 ); // A ship's key is now in my safety deposit box.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue