Adds better type support for pooled enumerables. Refactors code. (#16)
This commit is contained in:
parent
62b95f4d74
commit
b06f5bf60d
48 changed files with 252 additions and 243 deletions
|
|
@ -2078,7 +2078,7 @@ namespace Server.Mobiles
|
|||
|
||||
int destroyables = 0;
|
||||
|
||||
IPooledEnumerable eable = map.GetItemsInRange(new Point3D(x, y, m_Mobile.Location.Z), 1);
|
||||
IPooledEnumerable<Item> eable = map.GetItemsInRange(new Point3D(x, y, m_Mobile.Location.Z), 1);
|
||||
|
||||
foreach (Item item in eable)
|
||||
{
|
||||
|
|
@ -2634,7 +2634,7 @@ namespace Server.Mobiles
|
|||
if (srcSkill <= 0)
|
||||
return;
|
||||
|
||||
IPooledEnumerable eable = m_Mobile.GetMobilesInRange(m_Mobile.RangePerception);
|
||||
IPooledEnumerable<Mobile> eable = m_Mobile.GetMobilesInRange(m_Mobile.RangePerception);
|
||||
foreach (Mobile trg in eable)
|
||||
{
|
||||
if (trg != m_Mobile && trg.Player && trg.Alive && trg.Hidden && trg.AccessLevel == AccessLevel.Player && m_Mobile.InLOS(trg))
|
||||
|
|
|
|||
|
|
@ -5450,12 +5450,12 @@ namespace Server.Mobiles
|
|||
{
|
||||
Corpse toRummage = null;
|
||||
|
||||
IPooledEnumerable eable = this.GetItemsInRange(2);
|
||||
foreach ( Item item in eable )
|
||||
IPooledEnumerable<Corpse> eable = this.GetItemsInRange<Corpse>(2);
|
||||
foreach ( Corpse item in eable )
|
||||
{
|
||||
if ( item is Corpse && item.Items.Count > 0 )
|
||||
if ( item.Items.Count > 0 )
|
||||
{
|
||||
toRummage = (Corpse)item;
|
||||
toRummage = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,20 +182,15 @@ namespace Server.Mobiles
|
|||
base.OnThink();
|
||||
|
||||
// Check to see if we need to devour any corpses
|
||||
IPooledEnumerable eable = GetItemsInRange( 3 ); // Get all corpses in range
|
||||
IPooledEnumerable<Corpse> eable = GetItemsInRange<Corpse>( 3 ); // Get all corpses in range
|
||||
|
||||
foreach( Item item in eable )
|
||||
foreach( Corpse item in eable )
|
||||
{
|
||||
if( item is Corpse ) // For each Corpse
|
||||
// Ensure that the corpse was killed by us
|
||||
if ( item.Killer == this && item.Owner != null )
|
||||
{
|
||||
Corpse corpse = item as Corpse;
|
||||
|
||||
// Ensure that the corpse was killed by us
|
||||
if( corpse != null && corpse.Killer == this && corpse.Owner != null )
|
||||
{
|
||||
if( !corpse.DevourCorpse() && !corpse.Devoured )
|
||||
PublicOverheadMessage( MessageType.Emote, 0x3B2, 1053032 ); // * The plague beast attempts to absorb the remains, but cannot! *
|
||||
}
|
||||
if( !item.DevourCorpse() && !item.Devoured )
|
||||
PublicOverheadMessage( MessageType.Emote, 0x3B2, 1053032 ); // * The plague beast attempts to absorb the remains, but cannot! *
|
||||
}
|
||||
}
|
||||
eable.Free();
|
||||
|
|
@ -229,10 +224,10 @@ namespace Server.Mobiles
|
|||
|
||||
private void IncreaseHits( int hp )
|
||||
{
|
||||
int maxhits = 2000;
|
||||
int maxhits = 2000;
|
||||
|
||||
if ( this.IsParagon )
|
||||
maxhits = (int)(maxhits * Paragon.HitsBuff);
|
||||
if ( this.IsParagon )
|
||||
maxhits = (int)(maxhits * Paragon.HitsBuff);
|
||||
|
||||
if( hp < 1000 && !Core.AOS )
|
||||
hp = (hp * 100) / 60;
|
||||
|
|
@ -241,9 +236,9 @@ namespace Server.Mobiles
|
|||
{
|
||||
HitsMaxSeed = maxhits;
|
||||
|
||||
int newHits = this.Hits + hp + Utility.RandomMinMax( 10, 20 ); // increase the hp until it hits if it goes over it'll max at 2000
|
||||
int newHits = this.Hits + hp + Utility.RandomMinMax( 10, 20 ); // increase the hp until it hits if it goes over it'll max at 2000
|
||||
|
||||
this.Hits = Math.Min( maxhits, newHits );
|
||||
this.Hits = Math.Min( maxhits, newHits );
|
||||
// Also provide heal for each devour on top of the hp increase
|
||||
}
|
||||
else
|
||||
|
|
@ -258,4 +253,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ namespace Server.Mobiles
|
|||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
IPooledEnumerable mobiles = Map.GetMobilesInRange( location, 0 );
|
||||
IPooledEnumerable<Mobile> mobiles = Map.GetMobilesInRange( location, 0 );
|
||||
|
||||
foreach ( Mobile m in mobiles )
|
||||
{
|
||||
|
|
@ -5175,4 +5175,4 @@ namespace Server.Mobiles
|
|||
m_AutoStabled.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1315,11 +1315,11 @@ namespace Server.Mobiles
|
|||
OpenBackpack( from );
|
||||
else
|
||||
{
|
||||
IPooledEnumerable mobiles = e.Mobile.GetMobilesInRange( 2 );
|
||||
IPooledEnumerable<PlayerVendor> mobiles = e.Mobile.GetMobilesInRange<PlayerVendor>( 2 );
|
||||
|
||||
foreach ( Mobile m in mobiles )
|
||||
if ( m is PlayerVendor && m.CanSee( e.Mobile ) && m.InLOS( e.Mobile ) )
|
||||
((PlayerVendor)m).OpenBackpack( from );
|
||||
foreach ( PlayerVendor m in mobiles )
|
||||
if ( m.CanSee( e.Mobile ) && m.InLOS( e.Mobile ) )
|
||||
m.OpenBackpack( from );
|
||||
|
||||
mobiles.Free();
|
||||
}
|
||||
|
|
@ -1741,4 +1741,4 @@ namespace Server.Mobiles
|
|||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue