From 455fa28f48df4e80ebb76fcf1adf60a20a850ed8 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 28 Dec 2006 19:32:01 +0000 Subject: [PATCH] Lots of little stuff.. Generics Misc tweaks/fixes --- Scripts/Commands/Add.cs | 12 +- Scripts/Commands/ConvertPlayers.cs | 3 +- Scripts/Commands/Generic/Commands/Commands.cs | 2 +- Scripts/Commands/Handlers.cs | 4 - Scripts/Engines/Chat/Channel.cs | 28 ++--- Scripts/Gumps/Go/GoGump.cs | 111 +----------------- Scripts/Gumps/VendorInventoryGump.cs | 2 +- Scripts/Items/Addons/BaseAddon.cs | 50 ++++---- Scripts/Items/Addons/BaseAddonDeed.cs | 8 +- Scripts/Mobiles/Vendors/VendorInventory.cs | 12 +- Scripts/Multis/ComponentVerification.cs | 6 +- Scripts/Multis/HouseFoundation.cs | 51 ++++---- Scripts/Multis/HousePlacement.cs | 15 +-- Scripts/Multis/HousePlacementTool.cs | 2 +- Server/Race.cs | 10 +- Server/Timer.cs | 2 +- 16 files changed, 99 insertions(+), 219 deletions(-) diff --git a/Scripts/Commands/Add.cs b/Scripts/Commands/Add.cs index 67fbb6622..b98d2e18f 100644 --- a/Scripts/Commands/Add.cs +++ b/Scripts/Commands/Add.cs @@ -1,7 +1,7 @@ using System; -using System.Text; +using System.Collections.Generic; using System.Reflection; -using System.Collections; +using System.Text; using Server; using Server.Items; using Server.Network; @@ -25,7 +25,7 @@ namespace Server.Commands Invoke( from, start, end, args, null ); } - public static void Invoke( Mobile from, Point3D start, Point3D end, string[] args, ArrayList packs ) + public static void Invoke( Mobile from, Point3D start, Point3D end, string[] args, List packs ) { StringBuilder sb = new StringBuilder(); @@ -108,7 +108,7 @@ namespace Server.Commands Array.Copy( old, 1, args, 0, args.Length ); } - public static int BuildObjects( Mobile from, Type type, Point3D start, Point3D end, string[] args, string[,] props, ArrayList packs ) + public static int BuildObjects( Mobile from, Type type, Point3D start, Point3D end, string[] args, string[,] props, List packs ) { Utility.FixPoints( ref start, ref end ); @@ -270,7 +270,7 @@ namespace Server.Commands return built; } - public static int Build( Mobile from, Point3D start, Point3D end, ConstructorInfo ctor, object[] values, string[,] props, PropertyInfo[] realProps, ArrayList packs ) + public static int Build( Mobile from, Point3D start, Point3D end, ConstructorInfo ctor, object[] values, string[,] props, PropertyInfo[] realProps, List packs ) { try { @@ -299,7 +299,7 @@ namespace Server.Commands if ( built is Item ) { - Container pack = (Container)packs[i]; + Container pack = packs[i]; pack.DropItem( (Item)built ); } diff --git a/Scripts/Commands/ConvertPlayers.cs b/Scripts/Commands/ConvertPlayers.cs index b4af37e76..e38efdec1 100644 --- a/Scripts/Commands/ConvertPlayers.cs +++ b/Scripts/Commands/ConvertPlayers.cs @@ -1,5 +1,4 @@ using System; -using System.Collections; using System.Collections.Generic; using System.Reflection; using Server; @@ -19,7 +18,7 @@ namespace Server.Commands public static void Convert_OnCommand( CommandEventArgs e ) { e.Mobile.SendMessage( "Converting all players to PlayerMobile. You will be disconnected. Please Restart the server after the world has finished saving." ); - ArrayList mobs = new ArrayList( World.Mobiles.Values ); + List mobs = new List( World.Mobiles.Values ); int count = 0; foreach ( Mobile m in mobs ) diff --git a/Scripts/Commands/Generic/Commands/Commands.cs b/Scripts/Commands/Generic/Commands/Commands.cs index e47a57acb..2e2bf9358 100644 --- a/Scripts/Commands/Generic/Commands/Commands.cs +++ b/Scripts/Commands/Generic/Commands/Commands.cs @@ -368,7 +368,7 @@ namespace Server.Commands.Generic if ( e.Arguments.Length == 0 ) return; - ArrayList packs = new ArrayList( list.Count ); + List packs = new List( list.Count ); for ( int i = 0; i < list.Count; ++i ) { diff --git a/Scripts/Commands/Handlers.cs b/Scripts/Commands/Handlers.cs index 1a0b0a511..88b79f332 100644 --- a/Scripts/Commands/Handlers.cs +++ b/Scripts/Commands/Handlers.cs @@ -1125,10 +1125,6 @@ namespace Server.Commands return; } - if ( GoGump.MoveToLocation( from, e.ArgString ) ) - return; - - if ( e.Length == 1 ) { try diff --git a/Scripts/Engines/Chat/Channel.cs b/Scripts/Engines/Chat/Channel.cs index cd3b2d366..4c9e42982 100644 --- a/Scripts/Engines/Chat/Channel.cs +++ b/Scripts/Engines/Chat/Channel.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server; namespace Server.Engines.Chat @@ -8,7 +8,7 @@ namespace Server.Engines.Chat { private string m_Name; private string m_Password; - private ArrayList m_Users, m_Banned, m_Moderators, m_Voices; + private List m_Users, m_Banned, m_Moderators, m_Voices; private bool m_VoiceRestricted; private bool m_AlwaysAvailable; @@ -16,10 +16,10 @@ namespace Server.Engines.Chat { m_Name = name; - m_Users = new ArrayList(); - m_Banned = new ArrayList(); - m_Moderators = new ArrayList(); - m_Voices = new ArrayList(); + m_Users = new List(); + m_Banned = new List(); + m_Moderators = new List(); + m_Voices = new List(); } public Channel( string name, string password ) : this( name ) @@ -381,7 +381,7 @@ namespace Server.Engines.Chat { for ( int i = 0; i < m_Users.Count; ++i ) { - ChatUser user = (ChatUser)m_Users[i]; + ChatUser user = m_Users[i]; if ( user == initiator ) continue; @@ -397,7 +397,7 @@ namespace Server.Engines.Chat { for ( int i = 0; i < m_Users.Count; ++i ) { - ChatUser user = (ChatUser)m_Users[i]; + ChatUser user = m_Users[i]; if ( user.IsIgnored( from ) ) continue; @@ -438,7 +438,7 @@ namespace Server.Engines.Chat { for ( int i = 0; i < m_Users.Count; ++i ) { - ChatUser user = (ChatUser)m_Users[i]; + ChatUser user = m_Users[i]; if ( user == initiator ) continue; @@ -454,15 +454,15 @@ namespace Server.Engines.Chat { for ( int i = 0; i < m_Users.Count; ++i ) { - ChatUser user = (ChatUser)m_Users[i]; + ChatUser user = m_Users[i]; ChatSystem.SendCommandTo( to.Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username ); } } - private static ArrayList m_Channels = new ArrayList(); + private static List m_Channels = new List(); - public static ArrayList Channels + public static List Channels { get { @@ -474,7 +474,7 @@ namespace Server.Engines.Chat { for ( int i = 0; i < m_Channels.Count; ++i ) { - Channel channel = (Channel)m_Channels[i]; + Channel channel = m_Channels[i]; if ( !channel.IsBanned( user ) ) ChatSystem.SendCommandTo( user.Mobile, ChatCommand.AddChannel, channel.Name, "0" ); @@ -526,7 +526,7 @@ namespace Server.Engines.Chat { for ( int i = 0; i < m_Channels.Count; ++i ) { - Channel channel = (Channel)m_Channels[i]; + Channel channel = m_Channels[i]; if ( channel.m_Name == name ) return channel; diff --git a/Scripts/Gumps/Go/GoGump.cs b/Scripts/Gumps/Go/GoGump.cs index 26a5ef34d..47041243d 100644 --- a/Scripts/Gumps/Go/GoGump.cs +++ b/Scripts/Gumps/Go/GoGump.cs @@ -1,8 +1,7 @@ using System; -using System.Collections; using Server; -using Server.Network; using Server.Gumps; +using Server.Network; namespace Server.Gumps { @@ -246,113 +245,5 @@ namespace Server.Gumps } } } - - public static bool MoveToLocation( Mobile m, string text ) - { - string[] args = text.Split( '.' ); - - if ( args.Length == 0 ) - return false; - - for ( int i = 0; i < args.Length; ++i ) - args[i].Trim(); - - ArrayList trees = new ArrayList(); - - // The mobile's map is to be checked first. - if ( m.Map == Map.Ilshenar ) - trees.Add( Ilshenar ); - else if ( m.Map == Map.Felucca ) - trees.Add( Felucca ); - else if ( m.Map == Map.Trammel ) - trees.Add( Trammel ); - else if ( m.Map == Map.Malas ) - trees.Add( Malas ); - else - trees.Add( Tokuno ); - - // The other maps follow. - if ( !trees.Contains( Trammel ) ) - trees.Add( Trammel ); - - if ( !trees.Contains( Felucca ) ) - trees.Add( Felucca ); - - if ( !trees.Contains( Ilshenar ) ) - trees.Add( Ilshenar ); - - if ( !trees.Contains( Malas ) ) - trees.Add( Malas ); - - if ( !trees.Contains( Tokuno ) ) - trees.Add( Tokuno ); - - LocationTree tree; - - for ( int i = 0; i < trees.Count; ++i ) - { - tree = (LocationTree)trees[i]; - - // If a specific tree was requested, it's the only one we need to parse. - if ( Insensitive.Equals( args[0], tree.Map.Name ) ) - { - if ( args.Length < 2 ) - return false; - - return ParseNode( tree.Root, args, 1, m, tree.Map ); - } - } - - for ( int i = 0; i < trees.Count; ++i ) - { - tree = (LocationTree)trees[i]; - - // Parse all trees. - if ( ParseNode( tree.Root, args, 0, m, tree.Map ) ) - return true; - } - - return false; - } - - public static bool ParseNode( ParentNode node, string[] args, int argsIndex, Mobile m, Map map ) - { - if ( args[argsIndex].Length == 0 ) - return false; - - for ( int i = 0; i < node.Children.Length; ++i ) - { - object child = node.Children[i]; - - if ( child is ParentNode ) - { - if ( Insensitive.Equals( ((ParentNode)child).Name, args[argsIndex] ) ) - { - if ( (argsIndex + 1) >= args.Length ) - return false; - - if ( args[argsIndex + 1].Length == 0 ) - return false; - - return ParseNode( (ParentNode)child, args, argsIndex + 1, m, map ); - } - else - { - if ( ParseNode( (ParentNode)child, args, argsIndex, m, map ) ) - return true; - } - } - else if ( child is ChildNode ) - { - if ( Insensitive.Equals( ((ChildNode)child).Name, args[argsIndex] ) ) - { - m.MoveToWorld( ((ChildNode)child).Location, map ); - return true; - } - } - } - - return false; - } } } \ No newline at end of file diff --git a/Scripts/Gumps/VendorInventoryGump.cs b/Scripts/Gumps/VendorInventoryGump.cs index 6db321db3..5659b0dfb 100644 --- a/Scripts/Gumps/VendorInventoryGump.cs +++ b/Scripts/Gumps/VendorInventoryGump.cs @@ -75,7 +75,7 @@ namespace Server.Gumps int givenToBankBox = 0; for ( int i = inventory.Items.Count - 1; i >= 0; i-- ) { - Item item = (Item) inventory.Items[i]; + Item item = inventory.Items[i]; if ( item.Deleted ) { diff --git a/Scripts/Items/Addons/BaseAddon.cs b/Scripts/Items/Addons/BaseAddon.cs index a4458b2d1..0c45004dd 100644 --- a/Scripts/Items/Addons/BaseAddon.cs +++ b/Scripts/Items/Addons/BaseAddon.cs @@ -109,12 +109,10 @@ namespace Server.Items public bool CouldFit( IPoint3D p, Map map ) { - List houses = null; - - return ( CouldFit( p, map, null, ref houses ) == AddonFitResult.Valid ); + return ( CouldFit( p, map, null, null ) == AddonFitResult.Valid ); } - public AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref List houses ) + public AddonFitResult CouldFit( IPoint3D p, Map map, Mobile from, ref BaseHouse house ) { if ( Deleted ) return AddonFitResult.Blocked; @@ -125,7 +123,7 @@ namespace Server.Items if ( !map.CanFit( p3D.X, p3D.Y, p3D.Z, c.ItemData.Height, false, true, ( c.Z == 0 ) ) ) return AddonFitResult.Blocked; - else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref houses ) ) + else if ( !CheckHouse( from, p3D, map, c.ItemData.Height, ref house ) ) return AddonFitResult.NotInHouse; if ( c.NeedsWall ) @@ -137,44 +135,38 @@ namespace Server.Items } } - foreach ( BaseHouse house in houses ) + ArrayList doors = house.Doors; + + for ( int i = 0; i < doors.Count; ++i ) { - ArrayList doors = house.Doors; + BaseDoor door = doors[i] as BaseDoor; - for ( int i = 0; i < doors.Count; ++i ) + if ( door != null && door.Open ) + return AddonFitResult.DoorsNotClosed; + + Point3D doorLoc = door.GetWorldLocation(); + int doorHeight = door.ItemData.CalcHeight; + + foreach ( AddonComponent c in m_Components ) { - BaseDoor door = doors[i] as BaseDoor; - - if ( door != null && door.Open ) - return AddonFitResult.DoorsNotClosed; - - Point3D doorLoc = door.GetWorldLocation(); - int doorHeight = door.ItemData.CalcHeight; - - foreach ( AddonComponent c in m_Components ) - { - Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); - int addonHeight = c.ItemData.CalcHeight; - - if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) ) - return AddonFitResult.DoorTooClose; - } + Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z ); + int addonHeight = c.ItemData.CalcHeight; + + if ( Utility.InRange( doorLoc, addonLoc, 1 ) && (addonLoc.Z == doorLoc.Z || ((addonLoc.Z + addonHeight) > doorLoc.Z && (doorLoc.Z + doorHeight) > addonLoc.Z)) ) + return AddonFitResult.DoorTooClose; } } return AddonFitResult.Valid; } - public static bool CheckHouse( Mobile from, Point3D p, Map map, int height, ref List list ) + public static bool CheckHouse( Mobile from, Point3D p, Map map, int height, ref BaseHouse house ) { - BaseHouse house = BaseHouse.FindHouseAt( p, map, height ); + house = BaseHouse.FindHouseAt( p, map, height ); if ( from == null || house == null || !house.IsOwner( from ) ) return false; - if ( !list.Contains( house ) ) - list.Add( house ); - return true; } diff --git a/Scripts/Items/Addons/BaseAddonDeed.cs b/Scripts/Items/Addons/BaseAddonDeed.cs index d32bb5847..bc938cbd2 100644 --- a/Scripts/Items/Addons/BaseAddonDeed.cs +++ b/Scripts/Items/Addons/BaseAddonDeed.cs @@ -73,9 +73,9 @@ namespace Server.Items Server.Spells.SpellHelper.GetSurfaceTop( ref p ); - List houses = new List(); + List house; - AddonFitResult res = addon.CouldFit( p, map, from, ref houses ); + AddonFitResult res = addon.CouldFit( p, map, from, ref house ); if ( res == AddonFitResult.Valid ) addon.MoveToWorld( new Point3D( p ), map ); @@ -93,9 +93,7 @@ namespace Server.Items if ( res == AddonFitResult.Valid ) { m_Deed.Delete(); - - foreach ( BaseHouse h in houses ) - h.Addons.Add( addon ); + house.Addons.Add( addon ); } else { diff --git a/Scripts/Mobiles/Vendors/VendorInventory.cs b/Scripts/Mobiles/Vendors/VendorInventory.cs index 9bf000ef6..92f39cdd8 100644 --- a/Scripts/Mobiles/Vendors/VendorInventory.cs +++ b/Scripts/Mobiles/Vendors/VendorInventory.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server; using Server.Multis; @@ -14,7 +14,7 @@ namespace Server.Mobiles private string m_ShopName; private Mobile m_Owner; - private ArrayList m_Items; + private List m_Items; private int m_Gold; private DateTime m_ExpireTime; @@ -27,7 +27,7 @@ namespace Server.Mobiles m_VendorName = vendorName; m_ShopName = shopName; - m_Items = new ArrayList(); + m_Items = new List(); m_ExpireTime = DateTime.Now + GracePeriod; m_ExpireTimer = new ExpireTimer( this, GracePeriod ); @@ -58,7 +58,7 @@ namespace Server.Mobiles set{ m_Owner = value; } } - public ArrayList Items + public List Items { get{ return m_Items; } } @@ -104,7 +104,7 @@ namespace Server.Mobiles writer.Write( (string) m_VendorName ); writer.Write( (string) m_ShopName ); - writer.WriteItemList( m_Items, true ); + writer.Write( m_Items, true ); writer.Write( (int) m_Gold ); writer.WriteDeltaTime( m_ExpireTime ); @@ -120,7 +120,7 @@ namespace Server.Mobiles m_VendorName = reader.ReadString(); m_ShopName = reader.ReadString(); - m_Items = reader.ReadItemList(); + m_Items = reader.ReadStrongItemList(); m_Gold = reader.ReadInt(); m_ExpireTime = reader.ReadDeltaTime(); diff --git a/Scripts/Multis/ComponentVerification.cs b/Scripts/Multis/ComponentVerification.cs index 58fd6e987..5c398a20d 100644 --- a/Scripts/Multis/ComponentVerification.cs +++ b/Scripts/Multis/ComponentVerification.cs @@ -1,6 +1,6 @@ using System; +using System.Collections.Generic; using System.IO; -using System.Collections; namespace Server.Multis { @@ -142,7 +142,7 @@ namespace Server.Multis for ( int i = 0; i < m_Columns.Length; ++i ) m_Columns[i] = new ColumnInfo( i, types[i], names[i] ); - ArrayList records = new ArrayList(); + List records = new List(); string[] values; @@ -172,7 +172,7 @@ namespace Server.Multis records.Add( new DataRecord( this, data ) ); } - m_Records = (DataRecord[]) records.ToArray( typeof( DataRecord ) ); + m_Records = records.ToArray(); } } diff --git a/Scripts/Multis/HouseFoundation.cs b/Scripts/Multis/HouseFoundation.cs index 60d4def95..649d759ca 100644 --- a/Scripts/Multis/HouseFoundation.cs +++ b/Scripts/Multis/HouseFoundation.cs @@ -1,14 +1,14 @@ using System; +using System.Collections.Generic; using System.IO; using System.Threading; -using System.Collections; using Server; +using Server.Commands; using Server.Gumps; using Server.Items; using Server.Mobiles; using Server.Network; using Server.Targeting; -using Server.Commands; namespace Server.Multis { @@ -32,13 +32,13 @@ namespace Server.Multis private Item m_Signpost; // Item supporting the hanger. private int m_SignpostGraphic; // ItemID number of the chosen signpost. private int m_LastRevision; // Latest revision number. - private ArrayList m_Fixtures; // List of fixtures (teleporters and doors) associated with this house. + private List m_Fixtures; // List of fixtures (teleporters and doors) associated with this house. private FoundationType m_Type; // Graphic type of this foundation. private Mobile m_Customizer; // Who is currently customizing this -or- null if not customizing. public FoundationType Type { get { return m_Type; } set { m_Type = value; } } public int LastRevision { get { return m_LastRevision; } set { m_LastRevision = value; } } - public ArrayList Fixtures { get { return m_Fixtures; } } + public List Fixtures { get { return m_Fixtures; } } public Item SignHanger { get { return m_SignHanger; } } public Item Signpost { get { return m_Signpost; } } public int SignpostGraphic { get { return m_SignpostGraphic; } set { m_SignpostGraphic = value; } } @@ -126,7 +126,7 @@ namespace Server.Multis for( int i = 0; i < m_Fixtures.Count; ++i ) { - Item item = (Item)m_Fixtures[i]; + Item item = m_Fixtures[i]; if( item != null ) item.Delete(); @@ -154,7 +154,7 @@ namespace Server.Multis for( int i = 0; i < m_Fixtures.Count; ++i ) { - Item item = (Item)m_Fixtures[i]; + Item item = m_Fixtures[i]; if( Doors.Contains( item ) ) continue; @@ -177,7 +177,7 @@ namespace Server.Multis return; for( int i = 0; i < m_Fixtures.Count; ++i ) - ((Item)m_Fixtures[i]).Map = this.Map; + m_Fixtures[i].Map = this.Map; } public void ClearFixtures( Mobile from ) @@ -189,7 +189,7 @@ namespace Server.Multis for( int i = 0; i < m_Fixtures.Count; ++i ) { - ((Item)m_Fixtures[i]).Delete(); + m_Fixtures[i].Delete(); Doors.Remove( m_Fixtures[i] ); } @@ -199,7 +199,7 @@ namespace Server.Multis public void AddFixtures( Mobile from, MultiTileEntry[] list ) { if( m_Fixtures == null ) - m_Fixtures = new ArrayList(); + m_Fixtures = new List(); uint keyValue = 0; @@ -367,7 +367,7 @@ namespace Server.Multis for( int i = 0; i < m_Fixtures.Count; ++i ) { - Item fixture = (Item)m_Fixtures[i]; + Item fixture = m_Fixtures[i]; if( fixture is HouseTeleporter ) { @@ -575,7 +575,7 @@ namespace Server.Multis { m_SignpostGraphic = 9; - m_Fixtures = new ArrayList(); + m_Fixtures = new List(); int x = Components.Min.X; int y = Components.Height - 1 - Components.Center.Y; @@ -647,7 +647,7 @@ namespace Server.Multis writer.Write( m_SignHanger ); writer.Write( (int)m_LastRevision ); - writer.WriteItemList( m_Fixtures, true ); + writer.Write( m_Fixtures, true ); CurrentState.Serialize( writer ); DesignState.Serialize( writer ); @@ -702,7 +702,7 @@ namespace Server.Multis m_SignpostGraphic = 9; m_LastRevision = reader.ReadInt(); - m_Fixtures = reader.ReadItemList(); + m_Fixtures = reader.ReadStrongItemList(); m_Current = new DesignState( this, reader ); m_Design = new DesignState( this, reader ); @@ -1957,16 +1957,19 @@ namespace Server.Multis m_Level = 1; } - private static Hashtable m_Table = new Hashtable(); + private static Dictionary m_Table = new Dictionary(); - public static Hashtable Table { get { return m_Table; } } + public static Dictionary Table { get { return m_Table; } } public static DesignContext Find( Mobile from ) { if( from == null ) return null; - return (DesignContext)m_Table[from]; + DesignContext d; + m_Table.TryGetValue( from, out d ); + + return d; } public static bool Check( Mobile m ) @@ -1989,7 +1992,7 @@ namespace Server.Multis m_Table[from] = c; - if( from is PlayerMobile ) + if ( from is PlayerMobile ) ((PlayerMobile)from).DesignContext = c; foundation.Customizer = from; @@ -2002,11 +2005,11 @@ namespace Server.Multis if( state == null ) return; - ArrayList fixtures = foundation.Fixtures; + List fixtures = foundation.Fixtures; for( int i = 0; fixtures != null && i < fixtures.Count; ++i ) { - Item item = (Item)fixtures[i]; + Item item = fixtures[i]; state.Send( item.RemovePacket ); } @@ -2017,10 +2020,10 @@ namespace Server.Multis public static void Remove( Mobile from ) { - if( from == null ) - return; + DesignContext context = Find( from ); - DesignContext context = (DesignContext)m_Table[from]; + if ( context == null ) + return; m_Table.Remove( from ); @@ -2037,11 +2040,11 @@ namespace Server.Multis if( state == null ) return; - ArrayList fixtures = context.Foundation.Fixtures; + List fixtures = context.Foundation.Fixtures; for( int i = 0; fixtures != null && i < fixtures.Count; ++i ) { - Item item = (Item)fixtures[i]; + Item item = fixtures[i]; item.SendInfoTo( state ); } diff --git a/Scripts/Multis/HousePlacement.cs b/Scripts/Multis/HousePlacement.cs index c8b834541..0259888df 100644 --- a/Scripts/Multis/HousePlacement.cs +++ b/Scripts/Multis/HousePlacement.cs @@ -73,10 +73,11 @@ namespace Server.Multis Point3D start = new Point3D( center.X + mcl.Min.X, center.Y + mcl.Min.Y, center.Z ); // These are storage lists. They hold items and mobiles found in the map for further processing - ArrayList items = new ArrayList(), mobiles = new ArrayList(); + List items = new List(); + List mobiles = new List(); // These are also storage lists. They hold location values indicating the yard and border locations. - ArrayList yard = new ArrayList(), borders = new ArrayList(); + List yard = new List(), borders = new List(); /* RULES: * @@ -132,7 +133,7 @@ namespace Server.Multis for ( int i = 0; i < sector.Mobiles.Count; ++i ) { - Mobile m = (Mobile)sector.Mobiles[i]; + Mobile m = sector.Mobiles[i]; if ( m.X == tileX && m.Y == tileY ) mobiles.Add( m ); @@ -184,7 +185,7 @@ namespace Server.Multis for ( int j = 0; j < items.Count; ++j ) { - Item item = (Item)items[j]; + Item item = items[j]; ItemData id = item.ItemData; if ( addTileTop > item.Z && (item.Z + id.CalcHeight) > addTileZ ) @@ -205,7 +206,7 @@ namespace Server.Multis for ( int j = 0; j < mobiles.Count; ++j ) { - Mobile m = (Mobile)mobiles[j]; + Mobile m = mobiles[j]; if ( addTileTop > m.Z && (m.Z + 16) > addTileZ ) toMove.Add( m ); @@ -272,7 +273,7 @@ namespace Server.Multis for ( int i = 0; i < borders.Count; ++i ) { - Point2D borderPoint = (Point2D)borders[i]; + Point2D borderPoint = borders[i]; Tile landTile = map.Tiles.GetLandTile( borderPoint.X, borderPoint.Y ); int landID = landTile.ID & 0x3FFF; @@ -316,7 +317,7 @@ namespace Server.Multis for ( int i = 0; i < yard.Count; ++i ) { - Point2D yardPoint = (Point2D)yard[i]; + Point2D yardPoint = yard[i]; IPooledEnumerable eable = map.GetMultiTilesAt( yardPoint.X, yardPoint.Y ); diff --git a/Scripts/Multis/HousePlacementTool.cs b/Scripts/Multis/HousePlacementTool.cs index 84f0c201f..54e2916f2 100644 --- a/Scripts/Multis/HousePlacementTool.cs +++ b/Scripts/Multis/HousePlacementTool.cs @@ -557,7 +557,7 @@ namespace Server.Items { for ( int i = 0; i < entries.Length; ++i ) { - HousePlacementEntry e = (HousePlacementEntry)entries[i]; + HousePlacementEntry e = entries[i]; object obj = m_Table[e.m_Type]; diff --git a/Server/Race.cs b/Server/Race.cs index 84599e1c6..49f0c2b13 100644 --- a/Server/Race.cs +++ b/Server/Race.cs @@ -19,9 +19,9 @@ ***************************************************************************/ using System; -using System.Collections; -using Server.Network; +using System.Collections.Generic; using System.Runtime.Serialization; +using Server.Network; namespace Server { @@ -37,9 +37,9 @@ namespace Server public static Race Human { get { return m_Races[0]; } } public static Race Elf { get { return m_Races[1]; } } - private static ArrayList m_AllRaces = new ArrayList(); + private static List m_AllRaces = new List( 2 ); - public static ArrayList AllRaces { get { return m_AllRaces; } } + public static List AllRaces { get { return m_AllRaces; } } private int m_RaceID, m_RaceIndex; @@ -90,7 +90,7 @@ namespace Server for( int i = 0; i < m_AllRaces.Count; ++i ) { - Race race = (Race)m_AllRaces[i]; + Race race = m_AllRaces[i]; m_RaceNames[i] = race.Name; m_RaceValues[i] = race; diff --git a/Server/Timer.cs b/Server/Timer.cs index 17061b508..56c1651d7 100644 --- a/Server/Timer.cs +++ b/Server/Timer.cs @@ -21,9 +21,9 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Threading; -using System.Diagnostics; namespace Server {