From 90c2233e4c1f3a095fa068463da0f9930b9bc697 Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 24 Jun 2006 17:56:49 +0000 Subject: [PATCH] generic town criers, misc generics, region cleanups, container generic, yadda yadda --- Scripts/Commands/Handlers.cs | 12 +-- Scripts/Gumps/HouseGumpAOS.cs | 6 +- Scripts/Mobiles/Townfolk/TownCrier.cs | 48 +++++----- Scripts/Mobiles/Vendors/PlayerVendor.cs | 10 +- Scripts/Multis/BaseHouse.cs | 22 ++--- Scripts/Multis/Boats/BaseBoat.cs | 7 +- Scripts/Multis/MovingCrate.cs | 6 +- Scripts/Regions/BaseRegion.cs | 108 +++++++++------------- Scripts/Spells/Necromancy/Exorcism.cs | 8 +- Scripts/Spells/Necromancy/PoisonStrike.cs | 8 +- Scripts/Spells/Necromancy/Wither.cs | 8 +- Scripts/Spells/Seventh/ChainLightning.cs | 6 +- Scripts/Spells/Seventh/MassDispel.cs | 8 +- Scripts/Spells/Seventh/MeteorSwarm.cs | 6 +- Server/Items/Container.cs | 6 +- Server/Map.cs | 12 +-- 16 files changed, 114 insertions(+), 167 deletions(-) diff --git a/Scripts/Commands/Handlers.cs b/Scripts/Commands/Handlers.cs index dfb200624..1a0b0a511 100644 --- a/Scripts/Commands/Handlers.cs +++ b/Scripts/Commands/Handlers.cs @@ -329,13 +329,11 @@ namespace Server.Commands public static void ReplaceBankers_OnCommand( CommandEventArgs e ) { - ArrayList list = new ArrayList(); + List list = new List(); foreach ( Mobile m in World.Mobiles.Values ) - { if ( (m is Banker) && !(m is BaseCreature) ) list.Add( m ); - } foreach ( Mobile m in list ) { @@ -1312,24 +1310,22 @@ namespace Server.Commands { Mobile m = e.Mobile; - ArrayList list = new ArrayList(); + List list = new List(); foreach ( CommandEntry entry in CommandSystem.Entries.Values ) - { if ( m.AccessLevel >= entry.AccessLevel ) list.Add( entry ); - } list.Sort(); StringBuilder sb = new StringBuilder(); if ( list.Count > 0 ) - sb.Append( ((CommandEntry)list[0]).Command ); + sb.Append( list[0].Command ); for ( int i = 1; i < list.Count; ++i ) { - string v = ((CommandEntry)list[i]).Command; + string v = list[i].Command; if ( (sb.Length + 1 + v.Length) >= 256 ) { diff --git a/Scripts/Gumps/HouseGumpAOS.cs b/Scripts/Gumps/HouseGumpAOS.cs index 0e13921b1..111f2dc65 100644 --- a/Scripts/Gumps/HouseGumpAOS.cs +++ b/Scripts/Gumps/HouseGumpAOS.cs @@ -1,13 +1,13 @@ using System; using System.Reflection; using System.Collections; +using System.Collections.Generic; using Server.Network; using Server.Prompts; using Server.Mobiles; using Server.Multis; using Server.Multis.Deeds; using Server.Items; -using System.Collections.Generic; namespace Server.Gumps { @@ -756,8 +756,8 @@ namespace Server.Gumps house.MovingCrate = null; } - ArrayList items = house.GetItems(); - ArrayList mobiles = house.GetMobiles(); + List items = house.GetItems(); + List mobiles = house.GetMobiles(); newHouse.MoveToWorld( new Point3D( house.X + house.ConvertOffsetX, house.Y + house.ConvertOffsetY, house.Z + house.ConvertOffsetZ ), house.Map ); house.Delete(); diff --git a/Scripts/Mobiles/Townfolk/TownCrier.cs b/Scripts/Mobiles/Townfolk/TownCrier.cs index 4ba677299..f8c8ab0f7 100644 --- a/Scripts/Mobiles/Townfolk/TownCrier.cs +++ b/Scripts/Mobiles/Townfolk/TownCrier.cs @@ -1,6 +1,6 @@ using System; using System.Text; -using System.Collections; +using System.Collections.Generic; using Server; using Server.Prompts; using Server.Gumps; @@ -13,7 +13,7 @@ namespace Server.Mobiles { public interface ITownCrierEntryList { - ArrayList Entries{ get; } + List Entries{ get; } TownCrierEntry GetRandomEntry(); TownCrierEntry AddEntry( string[] lines, TimeSpan duration ); void RemoveEntry( TownCrierEntry entry ); @@ -52,9 +52,9 @@ namespace Server.Mobiles { } - private ArrayList m_Entries; + private List m_Entries; - public ArrayList Entries + public List Entries { get{ return m_Entries; } } @@ -69,7 +69,7 @@ namespace Server.Mobiles if ( i >= m_Entries.Count ) continue; - TownCrierEntry tce = (TownCrierEntry)m_Entries[i]; + TownCrierEntry tce = m_Entries[i]; if ( tce.Expired ) RemoveEntry( tce ); @@ -78,22 +78,22 @@ namespace Server.Mobiles if ( m_Entries == null || m_Entries.Count == 0 ) return null; - return (TownCrierEntry)m_Entries[Utility.Random( m_Entries.Count )]; + return m_Entries[Utility.Random( m_Entries.Count )]; } public TownCrierEntry AddEntry( string[] lines, TimeSpan duration ) { if ( m_Entries == null ) - m_Entries = new ArrayList(); + m_Entries = new List(); TownCrierEntry tce = new TownCrierEntry( lines, duration ); m_Entries.Add( tce ); - ArrayList instances = TownCrier.Instances; + List instances = TownCrier.Instances; for ( int i = 0; i < instances.Count; ++i ) - ((TownCrier)instances[i]).ForceBeginAutoShout(); + instances[i].ForceBeginAutoShout(); return tce; } @@ -158,7 +158,7 @@ namespace Server.Mobiles from.SendMessage( "Duration set to: {0}", ts ); from.SendMessage( "Enter the first line to shout:" ); - from.Prompt = new TownCrierLinesPrompt( m_Owner, null, new ArrayList(), ts ); + from.Prompt = new TownCrierLinesPrompt( m_Owner, null, new List(), ts ); } public override void OnCancel( Mobile from ) @@ -172,10 +172,10 @@ namespace Server.Mobiles { private ITownCrierEntryList m_Owner; private TownCrierEntry m_Entry; - private ArrayList m_Lines; + private List m_Lines; private TimeSpan m_Duration; - public TownCrierLinesPrompt( ITownCrierEntryList owner, TownCrierEntry entry, ArrayList lines, TimeSpan duration ) + public TownCrierLinesPrompt( ITownCrierEntryList owner, TownCrierEntry entry, List lines, TimeSpan duration ) { m_Owner = owner; m_Entry = entry; @@ -198,7 +198,7 @@ namespace Server.Mobiles if ( m_Lines.Count > 0 ) { - m_Owner.AddEntry( (string[])m_Lines.ToArray( typeof( string ) ), m_Duration ); + m_Owner.AddEntry( m_Lines.ToArray(), m_Duration ); from.SendMessage( "Message has been set." ); } else @@ -227,12 +227,12 @@ namespace Server.Mobiles } else if ( info.ButtonID > 1 ) { - ArrayList entries = m_Owner.Entries; + List entries = m_Owner.Entries; int index = info.ButtonID - 2; if ( entries != null && index < entries.Count ) { - TownCrierEntry tce = (TownCrierEntry)entries[index]; + TownCrierEntry tce = entries[index]; TimeSpan ts = tce.ExpireTime - DateTime.Now; if ( ts < TimeSpan.Zero ) @@ -240,7 +240,7 @@ namespace Server.Mobiles m_From.SendMessage( "Editing entry #{0}.", index + 1 ); m_From.SendMessage( "Enter the first line to shout:" ); - m_From.Prompt = new TownCrierLinesPrompt( m_Owner, tce, new ArrayList(), ts ); + m_From.Prompt = new TownCrierLinesPrompt( m_Owner, tce, new List(), ts ); } } } @@ -254,7 +254,7 @@ namespace Server.Mobiles AddPage( 0 ); - ArrayList entries = owner.Entries; + List entries = owner.Entries; owner.GetRandomEntry(); // force expiration checks @@ -323,11 +323,11 @@ namespace Server.Mobiles public class TownCrier : Mobile, ITownCrierEntryList { - private ArrayList m_Entries; + private List m_Entries; private Timer m_NewsTimer; private Timer m_AutoShoutTimer; - public ArrayList Entries + public List Entries { get{ return m_Entries; } } @@ -342,7 +342,7 @@ namespace Server.Mobiles if ( i >= m_Entries.Count ) continue; - TownCrierEntry tce = (TownCrierEntry)m_Entries[i]; + TownCrierEntry tce = m_Entries[i]; if ( tce.Expired ) RemoveEntry( tce ); @@ -354,7 +354,7 @@ namespace Server.Mobiles TownCrierEntry entry = GlobalTownCrierEntryList.Instance.GetRandomEntry(); if ( entry == null || Utility.RandomBool() ) - entry = (TownCrierEntry)m_Entries[Utility.Random( m_Entries.Count )]; + entry = m_Entries[Utility.Random( m_Entries.Count )]; return entry; } @@ -368,7 +368,7 @@ namespace Server.Mobiles public TownCrierEntry AddEntry( string[] lines, TimeSpan duration ) { if ( m_Entries == null ) - m_Entries = new ArrayList(); + m_Entries = new List(); TownCrierEntry tce = new TownCrierEntry( lines, duration ); @@ -472,9 +472,9 @@ namespace Server.Mobiles } } - private static ArrayList m_Instances = new ArrayList(); + private static List m_Instances = new List(); - public static ArrayList Instances + public static List Instances { get{ return m_Instances; } } diff --git a/Scripts/Mobiles/Vendors/PlayerVendor.cs b/Scripts/Mobiles/Vendors/PlayerVendor.cs index 8794c8235..5a13b6251 100644 --- a/Scripts/Mobiles/Vendors/PlayerVendor.cs +++ b/Scripts/Mobiles/Vendors/PlayerVendor.cs @@ -623,20 +623,16 @@ namespace Server.Mobiles } } - protected ArrayList GetItems() + protected List GetItems() { - ArrayList list = new ArrayList(); + List list = new List(); foreach ( Item item in this.Items ) - { if ( item.Movable && item != this.Backpack && item.Layer != Layer.Hair && item.Layer != Layer.FacialHair ) list.Add( item ); - } if ( this.Backpack != null ) - { list.AddRange( this.Backpack.Items ); - } return list; } @@ -661,7 +657,7 @@ namespace Server.Mobiles * -> do nothing (we can't do anything). */ - ArrayList list = GetItems(); + List list = GetItems(); if ( list.Count > 0 || HoldGold > 0 ) // No case 1 { diff --git a/Scripts/Multis/BaseHouse.cs b/Scripts/Multis/BaseHouse.cs index 7786571cf..0c4694539 100644 --- a/Scripts/Multis/BaseHouse.cs +++ b/Scripts/Multis/BaseHouse.cs @@ -543,9 +543,9 @@ namespace Server.Multis } } - public ArrayList GetHouseEntities() + public List GetHouseEntities() { - ArrayList list = new ArrayList(); + List list = new List(); if ( MovingCrate != null ) MovingCrate.Hide(); @@ -725,40 +725,38 @@ namespace Server.Multis MovingCrate.DropItem( item ); } - public ArrayList GetItems() + public List GetItems() { if( this.Map == null || this.Map == Map.Internal ) - return new ArrayList(); + return new List(); Point2D start = new Point2D( this.X + Components.Min.X, this.Y + Components.Min.Y ); Point2D end = new Point2D( this.X + Components.Max.X + 1, this.Y + Components.Max.Y + 1 ); Rectangle2D rect = new Rectangle2D( start, end ); - ArrayList list = new ArrayList(); + List list = new List(); IPooledEnumerable eable = this.Map.GetItemsInBounds( rect ); + foreach ( Item item in eable ) - { if ( item.Movable && IsInside( item ) ) list.Add( item ); - } + eable.Free(); return list; } - public ArrayList GetMobiles() + public List GetMobiles() { if( this.Map == null || this.Map == Map.Internal ) - return new ArrayList(); + return new List(); - ArrayList list = new ArrayList(); + List list = new List(); foreach ( Mobile mobile in Region.GetMobiles() ) - { if ( IsInside( mobile ) ) list.Add( mobile ); - } return list; } diff --git a/Scripts/Multis/Boats/BaseBoat.cs b/Scripts/Multis/Boats/BaseBoat.cs index 761bb4d5e..1325a24ba 100644 --- a/Scripts/Multis/Boats/BaseBoat.cs +++ b/Scripts/Multis/Boats/BaseBoat.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using System.Collections.Generic; using Server; using Server.Items; using Server.Movement; @@ -144,9 +145,9 @@ namespace Server.Multis public virtual BaseDockedBoat DockedBoat{ get{ return null; } } - private static ArrayList m_Instances = new ArrayList(); + private static List m_Instances = new List(); - public static ArrayList Boats{ get{ return m_Instances; } } + public static List Boats{ get{ return m_Instances; } } public BaseBoat() : base( 0x4000 ) { @@ -1642,7 +1643,7 @@ namespace Server.Multis public static void UpdateAllComponents() { for ( int i = m_Instances.Count - 1; i >= 0; --i ) - ((BaseBoat)m_Instances[i]).UpdateComponents(); + m_Instances[i].UpdateComponents(); } public static void Initialize() diff --git a/Scripts/Multis/MovingCrate.cs b/Scripts/Multis/MovingCrate.cs index f8f195b62..8337cac17 100644 --- a/Scripts/Multis/MovingCrate.cs +++ b/Scripts/Multis/MovingCrate.cs @@ -200,17 +200,13 @@ namespace Server.Multis m_InternalizeTimer = null; } - ArrayList toRemove = new ArrayList(); + List toRemove = new List(); foreach ( Item item in this.Items ) - { if ( item is PackingBox && item.Items.Count == 0 ) toRemove.Add( item ); - } foreach ( Item item in toRemove ) - { item.Delete(); - } if ( this.TotalItems == 0 ) Delete(); diff --git a/Scripts/Regions/BaseRegion.cs b/Scripts/Regions/BaseRegion.cs index 42a808112..fbf5f5194 100644 --- a/Scripts/Regions/BaseRegion.cs +++ b/Scripts/Regions/BaseRegion.cs @@ -1,8 +1,8 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Xml; using Server; -using System.Collections.Generic; namespace Server.Regions { @@ -127,8 +127,8 @@ namespace Server.Regions private int[] m_RectangleWeights; private int m_TotalWeight; - private static ArrayList m_Buffer1 = new ArrayList(); - private static ArrayList m_Buffer2 = new ArrayList(); + private static List m_RectBuffer1 = new List(); + private static List m_RectBuffer2 = new List(); private void InitRectangles() { @@ -138,55 +138,55 @@ namespace Server.Regions // Test if area rectangles are overlapping, and in that case break them into smaller non overlapping rectangles for ( int i = 0; i < this.Area.Length; i++ ) { - m_Buffer2.Add( this.Area[i] ); + m_RectBuffer2.Add( this.Area[i] ); - for ( int j = 0; j < m_Buffer1.Count && m_Buffer2.Count > 0; j++ ) + for ( int j = 0; j < m_RectBuffer1.Count && m_RectBuffer2.Count > 0; j++ ) { - Rectangle3D comp = (Rectangle3D) m_Buffer1[j]; + Rectangle3D comp = m_RectBuffer1[j]; - for ( int k = m_Buffer2.Count - 1; k >= 0; k-- ) + for ( int k = m_RectBuffer2.Count - 1; k >= 0; k-- ) { - Rectangle3D rect = (Rectangle3D) m_Buffer2[k]; + Rectangle3D rect = m_RectBuffer2[k]; int l1 = rect.Start.X, r1 = rect.End.X, t1 = rect.Start.Y, b1 = rect.End.Y; int l2 = comp.Start.X, r2 = comp.End.X, t2 = comp.Start.Y, b2 = comp.End.Y; if ( l1 < r2 && r1 > l2 && t1 < b2 && b1 > t2 ) { - m_Buffer2.RemoveAt( k ); + m_RectBuffer2.RemoveAt( k ); int sz = rect.Start.Z; int ez = rect.End.X; if ( l1 < l2 ) { - m_Buffer2.Add( new Rectangle3D( new Point3D( l1, t1, sz ), new Point3D( l2, b1, ez ) ) ); + m_RectBuffer2.Add( new Rectangle3D( new Point3D( l1, t1, sz ), new Point3D( l2, b1, ez ) ) ); } if ( r1 > r2 ) { - m_Buffer2.Add( new Rectangle3D( new Point3D( r2, t1, sz ), new Point3D( r1, b1, ez ) ) ); + m_RectBuffer2.Add( new Rectangle3D( new Point3D( r2, t1, sz ), new Point3D( r1, b1, ez ) ) ); } if ( t1 < t2 ) { - m_Buffer2.Add( new Rectangle3D( new Point3D( Math.Max( l1, l2 ), t1, sz ), new Point3D( Math.Min( r1, r2 ), t2, ez ) ) ); + m_RectBuffer2.Add( new Rectangle3D( new Point3D( Math.Max( l1, l2 ), t1, sz ), new Point3D( Math.Min( r1, r2 ), t2, ez ) ) ); } if ( b1 > b2 ) { - m_Buffer2.Add( new Rectangle3D( new Point3D( Math.Max( l1, l2 ), b2, sz ), new Point3D( Math.Min( r1, r2 ), b1, ez ) ) ); + m_RectBuffer2.Add( new Rectangle3D( new Point3D( Math.Max( l1, l2 ), b2, sz ), new Point3D( Math.Min( r1, r2 ), b1, ez ) ) ); } } } } - m_Buffer1.AddRange( m_Buffer2 ); - m_Buffer2.Clear(); + m_RectBuffer1.AddRange( m_RectBuffer2 ); + m_RectBuffer2.Clear(); } - m_Rectangles = (Rectangle3D[]) m_Buffer1.ToArray( typeof( Rectangle3D ) ); - m_Buffer1.Clear(); + m_Rectangles = m_RectBuffer1.ToArray(); + m_RectBuffer1.Clear(); m_RectangleWeights = new int[m_Rectangles.Length]; for ( int i = 0; i < m_Rectangles.Length; i++ ) @@ -199,6 +199,9 @@ namespace Server.Regions } } + private static List m_SpawnBuffer1 = new List(); + private static List m_SpawnBuffer2 = new List(); + public Point3D RandomSpawnLocation( int spawnHeight, bool land, bool water, Point3D home, int range ) { Map map = this.Map; @@ -266,7 +269,6 @@ namespace Server.Regions if ( x < 0 || y < 0 || x >= map.Width || y >= map.Height ) continue; - Tile lt = map.Tiles.GetLandTile( x, y ); int ltLowZ = 0, ltAvgZ = 0, ltTopZ = 0; @@ -276,18 +278,11 @@ namespace Server.Regions bool ltImpassable = ( (ltFlags & TileFlag.Impassable) != 0 ); if ( !lt.Ignored && ltAvgZ >= minZ && ltAvgZ < maxZ ) - { if ( (ltFlags & TileFlag.Wet) != 0 ) - { if ( water ) - m_Buffer1.Add( ltAvgZ ); - } + m_SpawnBuffer1.Add( ltAvgZ ); else if ( land && !ltImpassable ) - { - m_Buffer1.Add( ltAvgZ ); - } - } - + m_SpawnBuffer1.Add( ltAvgZ ); Tile[] staticTiles = map.Tiles.GetStaticTiles( x, y, true ); @@ -298,17 +293,11 @@ namespace Server.Regions int tileZ = tile.Z + id.CalcHeight; if ( tileZ >= minZ && tileZ < maxZ ) - { if ( (id.Flags & TileFlag.Wet) != 0 ) - { if ( water ) - m_Buffer1.Add( tileZ ); - } + m_SpawnBuffer1.Add( tileZ ); else if ( land && id.Surface && !id.Impassable ) - { - m_Buffer1.Add( tileZ ); - } - } + m_SpawnBuffer1.Add( tileZ ); } @@ -320,7 +309,7 @@ namespace Server.Regions if ( item.ItemID < 0x4000 && item.AtWorldPoint( x, y ) ) { - m_Buffer2.Add( item ); + m_SpawnBuffer2.Add( item ); if ( !item.Movable ) { @@ -328,26 +317,20 @@ namespace Server.Regions int itemZ = item.Z + id.CalcHeight; if ( itemZ >= minZ && itemZ < maxZ ) - { if ( (id.Flags & TileFlag.Wet) != 0 ) - { if ( water ) - m_Buffer1.Add( itemZ ); - } + m_SpawnBuffer1.Add( itemZ ); else if ( land && id.Surface && !id.Impassable ) - { - m_Buffer1.Add( itemZ ); - } - } + m_SpawnBuffer1.Add( itemZ ); } } } - if ( m_Buffer1.Count == 0 ) + if ( m_SpawnBuffer1.Count == 0 ) { - m_Buffer1.Clear(); - m_Buffer2.Clear(); + m_SpawnBuffer1.Clear(); + m_SpawnBuffer2.Clear(); continue; } @@ -358,9 +341,9 @@ namespace Server.Regions { z = int.MaxValue; - for ( int j = 0; j < m_Buffer1.Count; j++ ) + for ( int j = 0; j < m_SpawnBuffer1.Count; j++ ) { - int l = (int) m_Buffer1[j]; + int l = m_SpawnBuffer1[j]; if ( l < z ) z = l; @@ -372,9 +355,9 @@ namespace Server.Regions { z = int.MinValue; - for ( int j = 0; j < m_Buffer1.Count; j++ ) + for ( int j = 0; j < m_SpawnBuffer1.Count; j++ ) { - int l = (int) m_Buffer1[j]; + int l = m_SpawnBuffer1[j]; if ( l > z ) z = l; @@ -384,29 +367,28 @@ namespace Server.Regions } default: // SpawnZLevel.Random { - int index = Utility.Random( m_Buffer1.Count ); - z = (int) m_Buffer1[index]; + int index = Utility.Random( m_SpawnBuffer1.Count ); + z = m_SpawnBuffer1[index]; break; } } - m_Buffer1.Clear(); + m_SpawnBuffer1.Clear(); if ( !Region.Find( new Point3D( x, y, z ), map ).AcceptsSpawnsFrom( this ) ) { - m_Buffer2.Clear(); + m_SpawnBuffer2.Clear(); continue; } - int top = z + spawnHeight; bool ok = true; - for ( int j = 0; j < m_Buffer2.Count; j++ ) + for ( int j = 0; j < m_SpawnBuffer2.Count; j++ ) { - Item item = (Item) m_Buffer2[j]; + Item item = m_SpawnBuffer2[j]; ItemData id = item.ItemData; if ( ( id.Surface || id.Impassable ) && item.Z + id.CalcHeight > z && item.Z < top ) @@ -416,16 +398,14 @@ namespace Server.Regions } } - m_Buffer2.Clear(); + m_SpawnBuffer2.Clear(); if ( !ok ) continue; - if ( ltImpassable && ltAvgZ > z && ltLowZ < top ) continue; - for ( int j = 0; j < staticTiles.Length; j++ ) { Tile tile = staticTiles[j]; @@ -441,22 +421,18 @@ namespace Server.Regions if ( !ok ) continue; - for ( int j = 0; j < sector.Mobiles.Count; j++ ) { - Mobile m = (Mobile) sector.Mobiles[j]; + Mobile m = sector.Mobiles[j]; if ( m.X == x && m.Y == y && ( m.AccessLevel == AccessLevel.Player || !m.Hidden ) ) - { if ( m.Z + 16 > z && m.Z < top ) { ok = false; break; } - } } - if ( ok ) return new Point3D( x, y, z ); } diff --git a/Scripts/Spells/Necromancy/Exorcism.cs b/Scripts/Spells/Necromancy/Exorcism.cs index ea64f66a9..2ef6bb152 100644 --- a/Scripts/Spells/Necromancy/Exorcism.cs +++ b/Scripts/Spells/Necromancy/Exorcism.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server.Network; using Server.Items; using Server.Engines.CannedEvil; @@ -67,13 +67,11 @@ namespace Server.Spells.Necromancy if( map != null ) { - ArrayList targets = new ArrayList(); + List targets = new List(); foreach( Mobile m in r.ChampionSpawn.GetMobilesInRange( Range ) ) - { if( IsValidTarget( m ) ) targets.Add( m ); - } //Effects.PlaySound( Caster.Location, map, 0x1FB ); //Effects.PlaySound( Caster.Location, map, 0x10B ); @@ -81,7 +79,7 @@ namespace Server.Spells.Necromancy for( int i = 0; i < targets.Count; ++i ) { - Mobile m = (Mobile)targets[i]; + Mobile m = targets[i]; //m.FixedParticles( 0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255 ); diff --git a/Scripts/Spells/Necromancy/PoisonStrike.cs b/Scripts/Spells/Necromancy/PoisonStrike.cs index 3666c9188..c135f9eba 100644 --- a/Scripts/Spells/Necromancy/PoisonStrike.cs +++ b/Scripts/Spells/Necromancy/PoisonStrike.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server.Network; using Server.Items; using Server.Targeting; @@ -52,17 +52,15 @@ namespace Server.Spells.Necromancy if ( map != null ) { - ArrayList targets = new ArrayList(); + List targets = new List(); foreach ( Mobile targ in m.GetMobilesInRange( 2 ) ) - { if ( (Caster == targ || SpellHelper.ValidIndirectTarget( Caster, targ )) && Caster.CanBeHarmful( targ, false ) ) targets.Add( targ ); - } for ( int i = 0; i < targets.Count; ++i ) { - Mobile targ = (Mobile)targets[i]; + Mobile targ = targets[i]; int num; diff --git a/Scripts/Spells/Necromancy/Wither.cs b/Scripts/Spells/Necromancy/Wither.cs index 980569541..e62acefe5 100644 --- a/Scripts/Spells/Necromancy/Wither.cs +++ b/Scripts/Spells/Necromancy/Wither.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server.Network; using Server.Items; using Server.Targeting; @@ -39,13 +39,11 @@ namespace Server.Spells.Necromancy if ( map != null ) { - ArrayList targets = new ArrayList(); + List targets = new List(); foreach ( Mobile m in Caster.GetMobilesInRange( 5 ) ) - { if ( Caster != m && Caster.InLOS( m ) && SpellHelper.ValidIndirectTarget( Caster, m ) && Caster.CanBeHarmful( m, false ) ) targets.Add( m ); - } Effects.PlaySound( Caster.Location, map, 0x1FB ); Effects.PlaySound( Caster.Location, map, 0x10B ); @@ -53,7 +51,7 @@ namespace Server.Spells.Necromancy for ( int i = 0; i < targets.Count; ++i ) { - Mobile m = (Mobile)targets[i]; + Mobile m = targets[i]; Caster.DoHarmful( m ); m.FixedParticles( 0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255 ); diff --git a/Scripts/Spells/Seventh/ChainLightning.cs b/Scripts/Spells/Seventh/ChainLightning.cs index 35cb3562c..3fd4228cc 100644 --- a/Scripts/Spells/Seventh/ChainLightning.cs +++ b/Scripts/Spells/Seventh/ChainLightning.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server.Network; using Server.Items; using Server.Targeting; @@ -44,7 +44,7 @@ namespace Server.Spells.Seventh if ( p is Item ) p = ((Item)p).GetWorldLocation(); - ArrayList targets = new ArrayList(); + List targets = new List(); Map map = Caster.Map; @@ -90,7 +90,7 @@ namespace Server.Spells.Seventh for ( int i = 0; i < targets.Count; ++i ) { - Mobile m = (Mobile)targets[i]; + Mobile m = targets[i]; double toDeal = damage; diff --git a/Scripts/Spells/Seventh/MassDispel.cs b/Scripts/Spells/Seventh/MassDispel.cs index d51a59ed3..61451ecac 100644 --- a/Scripts/Spells/Seventh/MassDispel.cs +++ b/Scripts/Spells/Seventh/MassDispel.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server.Misc; using Server.Network; using Server.Items; @@ -42,7 +42,7 @@ namespace Server.Spells.Seventh SpellHelper.GetSurfaceTop( ref p ); - ArrayList targets = new ArrayList(); + List targets = new List(); Map map = Caster.Map; @@ -51,17 +51,15 @@ namespace Server.Spells.Seventh IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 8 ); foreach ( Mobile m in eable ) - { if ( m is BaseCreature && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful( m, false ) ) targets.Add( m ); - } eable.Free(); } for ( int i = 0; i < targets.Count; ++i ) { - Mobile m = (Mobile)targets[i]; + Mobile m = targets[i]; BaseCreature bc = m as BaseCreature; diff --git a/Scripts/Spells/Seventh/MeteorSwarm.cs b/Scripts/Spells/Seventh/MeteorSwarm.cs index f5b728ce0..2b7cffcdb 100644 --- a/Scripts/Spells/Seventh/MeteorSwarm.cs +++ b/Scripts/Spells/Seventh/MeteorSwarm.cs @@ -1,5 +1,5 @@ using System; -using System.Collections; +using System.Collections.Generic; using Server.Network; using Server.Items; using Server.Targeting; @@ -44,7 +44,7 @@ namespace Server.Spells.Seventh if ( p is Item ) p = ((Item)p).GetWorldLocation(); - ArrayList targets = new ArrayList(); + List targets = new List(); Map map = Caster.Map; @@ -89,7 +89,7 @@ namespace Server.Spells.Seventh for ( int i = 0; i < targets.Count; ++i ) { - Mobile m = (Mobile)targets[i]; + Mobile m = targets[i]; double toDeal = damage; diff --git a/Server/Items/Container.cs b/Server/Items/Container.cs index ace57fc1c..719646a3d 100644 --- a/Server/Items/Container.cs +++ b/Server/Items/Container.cs @@ -642,13 +642,13 @@ namespace Server.Items { Item[] typedItems = FindItemsByType( types[i], recurse ); - ArrayList groups = new ArrayList(); + List> groups = new List>(); int idx = 0; while ( idx < typedItems.Length ) { Item a = typedItems[idx++]; - ArrayList group = new ArrayList(); + List group = new List(); group.Add( a ); @@ -675,7 +675,7 @@ namespace Server.Items for ( int j = 0; j < groups.Count; ++j ) { - items[i][j] = (Item[])(((ArrayList)groups[j]).ToArray( typeof( Item ) )); + items[i][j] = groups[j].ToArray(); for ( int k = 0; k < items[i][j].Length; ++k ) totals[i][j] += items[i][j][k].Amount; diff --git a/Server/Map.cs b/Server/Map.cs index 8fcfd37d8..8eedaa54a 100644 --- a/Server/Map.cs +++ b/Server/Map.cs @@ -536,34 +536,26 @@ namespace Server } } - public ArrayList GetTilesAt( Point2D p, bool items, bool land, bool statics ) + public List GetTilesAt( Point2D p, bool items, bool land, bool statics ) { - ArrayList list = new ArrayList(); + List list = new List(); if ( this == Map.Internal ) return list; if ( land ) - { list.Add( Tiles.GetLandTile( p.m_X, p.m_Y ) ); - } if ( statics ) - { list.AddRange( Tiles.GetStaticTiles( p.m_X, p.m_Y, true ) ); - } if ( items ) { Sector sector = GetSector( p ); foreach ( Item item in sector.Items ) - { if ( item.AtWorldPoint( p.m_X, p.m_Y ) ) - { list.Add( new Tile( (short) ( ( item.ItemID & 0x3FFF ) + 0x4000 ), (sbyte) item.Z ) ); - } - } } return list;