generic town criers, misc generics, region cleanups, container generic, yadda yadda
This commit is contained in:
parent
03adafb13e
commit
90c2233e4c
16 changed files with 114 additions and 167 deletions
|
|
@ -329,13 +329,11 @@ namespace Server.Commands
|
|||
|
||||
public static void ReplaceBankers_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
|
||||
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<CommandEntry> list = new List<CommandEntry>();
|
||||
|
||||
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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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<Item> items = house.GetItems();
|
||||
List<Mobile> mobiles = house.GetMobiles();
|
||||
|
||||
newHouse.MoveToWorld( new Point3D( house.X + house.ConvertOffsetX, house.Y + house.ConvertOffsetY, house.Z + house.ConvertOffsetZ ), house.Map );
|
||||
house.Delete();
|
||||
|
|
|
|||
|
|
@ -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<TownCrierEntry> 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<TownCrierEntry> m_Entries;
|
||||
|
||||
public ArrayList Entries
|
||||
public List<TownCrierEntry> 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>();
|
||||
|
||||
TownCrierEntry tce = new TownCrierEntry( lines, duration );
|
||||
|
||||
m_Entries.Add( tce );
|
||||
|
||||
ArrayList instances = TownCrier.Instances;
|
||||
List<TownCrier> 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<String>(), 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<String> m_Lines;
|
||||
private TimeSpan m_Duration;
|
||||
|
||||
public TownCrierLinesPrompt( ITownCrierEntryList owner, TownCrierEntry entry, ArrayList lines, TimeSpan duration )
|
||||
public TownCrierLinesPrompt( ITownCrierEntryList owner, TownCrierEntry entry, List<String> 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<TownCrierEntry> 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<String>(), ts );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -254,7 +254,7 @@ namespace Server.Mobiles
|
|||
|
||||
AddPage( 0 );
|
||||
|
||||
ArrayList entries = owner.Entries;
|
||||
List<TownCrierEntry> 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<TownCrierEntry> m_Entries;
|
||||
private Timer m_NewsTimer;
|
||||
private Timer m_AutoShoutTimer;
|
||||
|
||||
public ArrayList Entries
|
||||
public List<TownCrierEntry> 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>();
|
||||
|
||||
TownCrierEntry tce = new TownCrierEntry( lines, duration );
|
||||
|
||||
|
|
@ -472,9 +472,9 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
private static ArrayList m_Instances = new ArrayList();
|
||||
private static List<TownCrier> m_Instances = new List<TownCrier>();
|
||||
|
||||
public static ArrayList Instances
|
||||
public static List<TownCrier> Instances
|
||||
{
|
||||
get{ return m_Instances; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -623,20 +623,16 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
protected ArrayList GetItems()
|
||||
protected List<Item> GetItems()
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
List<Item> list = new List<Item>();
|
||||
|
||||
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<Item> list = GetItems();
|
||||
|
||||
if ( list.Count > 0 || HoldGold > 0 ) // No case 1
|
||||
{
|
||||
|
|
|
|||
|
|
@ -543,9 +543,9 @@ namespace Server.Multis
|
|||
}
|
||||
}
|
||||
|
||||
public ArrayList GetHouseEntities()
|
||||
public List<IEntity> GetHouseEntities()
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
List<IEntity> list = new List<IEntity>();
|
||||
|
||||
if ( MovingCrate != null )
|
||||
MovingCrate.Hide();
|
||||
|
|
@ -725,40 +725,38 @@ namespace Server.Multis
|
|||
MovingCrate.DropItem( item );
|
||||
}
|
||||
|
||||
public ArrayList GetItems()
|
||||
public List<Item> GetItems()
|
||||
{
|
||||
if( this.Map == null || this.Map == Map.Internal )
|
||||
return new ArrayList();
|
||||
return new List<Item>();
|
||||
|
||||
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<Item> list = new List<Item>();
|
||||
|
||||
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<Mobile> GetMobiles()
|
||||
{
|
||||
if( this.Map == null || this.Map == Map.Internal )
|
||||
return new ArrayList();
|
||||
return new List<Mobile>();
|
||||
|
||||
ArrayList list = new ArrayList();
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
|
||||
foreach ( Mobile mobile in Region.GetMobiles() )
|
||||
{
|
||||
if ( IsInside( mobile ) )
|
||||
list.Add( mobile );
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<BaseBoat> m_Instances = new List<BaseBoat>();
|
||||
|
||||
public static ArrayList Boats{ get{ return m_Instances; } }
|
||||
public static List<BaseBoat> 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()
|
||||
|
|
|
|||
|
|
@ -200,17 +200,13 @@ namespace Server.Multis
|
|||
m_InternalizeTimer = null;
|
||||
}
|
||||
|
||||
ArrayList toRemove = new ArrayList();
|
||||
List<Item> toRemove = new List<Item>();
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -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<Rectangle3D> m_RectBuffer1 = new List<Rectangle3D>();
|
||||
private static List<Rectangle3D> m_RectBuffer2 = new List<Rectangle3D>();
|
||||
|
||||
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<Int32> m_SpawnBuffer1 = new List<Int32>();
|
||||
private static List<Item> m_SpawnBuffer2 = new List<Item>();
|
||||
|
||||
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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Mobile> targets = new List<Mobile>();
|
||||
|
||||
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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Mobile> targets = new List<Mobile>();
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Mobile> targets = new List<Mobile>();
|
||||
|
||||
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 );
|
||||
|
|
|
|||
|
|
@ -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<Mobile> targets = new List<Mobile>();
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Mobile> targets = new List<Mobile>();
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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<Mobile> targets = new List<Mobile>();
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -642,13 +642,13 @@ namespace Server.Items
|
|||
{
|
||||
Item[] typedItems = FindItemsByType( types[i], recurse );
|
||||
|
||||
ArrayList groups = new ArrayList();
|
||||
List<List<Item>> groups = new List<List<Item>>();
|
||||
int idx = 0;
|
||||
|
||||
while ( idx < typedItems.Length )
|
||||
{
|
||||
Item a = typedItems[idx++];
|
||||
ArrayList group = new ArrayList();
|
||||
List<Item> group = new List<Item>();
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -536,34 +536,26 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
public ArrayList GetTilesAt( Point2D p, bool items, bool land, bool statics )
|
||||
public List<Tile> GetTilesAt( Point2D p, bool items, bool land, bool statics )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
List<Tile> list = new List<Tile>();
|
||||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue