diff --git a/Scripts/Accounting/Account.cs b/Scripts/Accounting/Account.cs index d0907b43b..5c82d0c0f 100644 --- a/Scripts/Accounting/Account.cs +++ b/Scripts/Accounting/Account.cs @@ -41,10 +41,10 @@ namespace Server.Accounting if ( m == null ) continue; - ArrayList list = Multis.BaseHouse.GetHouses( m ); + List list = Multis.BaseHouse.GetHouses( m ); for ( int j = 0; j < list.Count; ++j ) - ( (Item) list[j] ).Delete(); + list[j].Delete(); m.Delete(); diff --git a/Scripts/Gumps/ViewHousesGump.cs b/Scripts/Gumps/ViewHousesGump.cs index 99ee0b438..3f41c6b22 100644 --- a/Scripts/Gumps/ViewHousesGump.cs +++ b/Scripts/Gumps/ViewHousesGump.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Collections.Generic; using Server; using Server.Items; using Server.Multis; @@ -29,19 +30,19 @@ namespace Server.Gumps from.SendGump( new ViewHousesGump( from, GetHouses( (Mobile)targeted ), null ) ); } - private class HouseComparer : IComparer + private class HouseComparer : IComparer { - public static readonly IComparer Instance = new HouseComparer(); + public static readonly IComparer Instance = new HouseComparer(); - public int Compare( object x, object y ) + public int Compare( BaseHouse x, BaseHouse y ) { - return ((BaseHouse)x).BuiltOn.CompareTo( ((BaseHouse)y).BuiltOn ); + return x.BuiltOn.CompareTo( y.BuiltOn ); } } - public static ArrayList GetHouses( Mobile owner ) + public static List GetHouses( Mobile owner ) { - ArrayList list = new ArrayList(); + List list = new List(); Account acct = owner.Account as Account; @@ -66,10 +67,10 @@ namespace Server.Gumps } private Mobile m_From; - private ArrayList m_List; + private List m_List; private BaseHouse m_Selection; - public ViewHousesGump( Mobile from, ArrayList list, BaseHouse sel ) : base( 50, 40 ) + public ViewHousesGump( Mobile from, List list, BaseHouse sel ) : base( 50, 40 ) { m_From = from; m_List = list; @@ -109,7 +110,7 @@ namespace Server.Gumps AddButton( 190, 17, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page-1 ); } - object name = FindHouseName( (BaseHouse)list[i] ); + object name = FindHouseName( list[i] ); AddHtml( 15, 40 + ((i % 15) * 20), 20, 20, Color( String.Format( "{0}.", i+1 ), White ), false, false ); @@ -192,7 +193,7 @@ namespace Server.Gumps int v = info.ButtonID - 1; if ( v >= 0 && v < m_List.Count ) - m_From.SendGump( new ViewHousesGump( m_From, m_List, (BaseHouse)m_List[v] ) ); + m_From.SendGump( new ViewHousesGump( m_From, m_List, m_List[v] ) ); } else if ( !m_Selection.Deleted ) { diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs index dfa50725c..408ae2be6 100644 --- a/Scripts/Multis/BaseHouse.cs +++ b/Scripts/Multis/BaseHouse.cs @@ -29,7 +29,7 @@ namespace Server.Multis public static void Decay_OnTick() { for ( int i = 0; i < m_AllHouses.Count; ++i ) - ((BaseHouse)m_AllHouses[i]).CheckDecay(); + m_AllHouses[i].CheckDecay(); } private DateTime m_LastRefreshed; @@ -83,7 +83,7 @@ namespace Server.Multis if ( (acct.LastLogin + TimeSpan.FromDays( 90.0 )) < DateTime.Now ) return DecayType.Condemned; - ArrayList allHouses = new ArrayList( 2 ); + List allHouses = new List( 2 ); for ( int i = 0; i < acct.Length; ++i ) { @@ -97,7 +97,7 @@ namespace Server.Multis for ( int i = 0; i < allHouses.Count; ++i ) { - BaseHouse check = (BaseHouse)allHouses[i]; + BaseHouse check = allHouses[i]; if ( newest == null || IsNewer( check, newest ) ) newest = check; @@ -246,7 +246,7 @@ namespace Server.Multis private Point3D m_RelativeBanLocation; - private static Hashtable m_Table = new Hashtable(); + private static Dictionary> m_Table = new Dictionary>(); public virtual bool IsAosRules{ get{ return Core.AOS; } } @@ -820,19 +820,20 @@ namespace Server.Multis return ( house != null && (house.IsSecure( item ) || house.IsLockedDown( item )) ); } - public static ArrayList GetHouses( Mobile m ) + public static List GetHouses( Mobile m ) { - ArrayList list = new ArrayList(); + List list = new List(); if ( m != null ) { - ArrayList exists = (ArrayList)m_Table[m]; + List exists = null; + m_Table.TryGetValue( m, out exists ); if ( exists != null ) { for ( int i = 0; i < exists.Count; ++i ) { - BaseHouse house = exists[i] as BaseHouse; + BaseHouse house = exists[i]; if ( house != null && !house.Deleted && house.Owner == m ) list.Add( house ); @@ -1040,7 +1041,7 @@ namespace Server.Multis return SecureAccessResult.Insecure; } - private static ArrayList m_AllHouses = new ArrayList(); + private static List m_AllHouses = new List(); public BaseHouse( int multiID, Mobile owner, int MaxLockDown, int MaxSecure ) : base( multiID | 0x4000 ) { @@ -1075,10 +1076,11 @@ namespace Server.Multis if ( owner != null ) { - ArrayList list = (ArrayList)m_Table[owner]; + List(); list.Add( this ); } @@ -2478,10 +2480,11 @@ namespace Server.Multis if ( m_Owner != null ) { - ArrayList list = (ArrayList)m_Table[m_Owner]; + List(); list.Add( this ); } @@ -2533,7 +2536,7 @@ namespace Server.Multis public static void HandleDeletion( Mobile mob ) { - ArrayList houses = GetHouses( mob ); + List houses = GetHouses( mob ); if ( houses.Count == 0 ) return; @@ -2549,7 +2552,7 @@ namespace Server.Multis for ( int i = 0; i < houses.Count; ++i ) { - BaseHouse house = houses[i] as BaseHouse; + BaseHouse house = houses[i]; bool canClaim = false; @@ -2586,10 +2589,11 @@ namespace Server.Multis { if ( m_Owner != null ) { - ArrayList list = (ArrayList)m_Table[m_Owner]; + List(); list.Remove( this ); m_Owner.Delta( MobileDelta.Noto ); @@ -2599,10 +2603,11 @@ namespace Server.Multis if ( m_Owner != null ) { - ArrayList list = (ArrayList)m_Table[m_Owner]; + List(); list.Add( this ); m_Owner.Delta( MobileDelta.Noto ); @@ -2834,10 +2839,11 @@ namespace Server.Multis if ( m_Owner != null ) { - ArrayList list = (ArrayList)m_Table[m_Owner]; - + List(); list.Remove( this ); } @@ -2966,14 +2972,15 @@ namespace Server.Multis if ( m == null ) return false; - ArrayList list = (ArrayList)m_Table[m]; + List