Removes implicit this.

This commit is contained in:
Kamron Batman 2018-09-14 12:56:58 -07:00
parent 04b4cfe75b
commit 83dcf536d8
533 changed files with 2804 additions and 2806 deletions

View file

@ -233,7 +233,7 @@ namespace Server
public static bool IsNull( object x )
{
return Object.ReferenceEquals( x, null );
return ReferenceEquals( x, null );
}
public int Compare( object x, object y )

View file

@ -30,7 +30,7 @@ namespace Server.Diagnostics {
public long TotalLength => _totalLength;
public double AverageLength => ( double ) _totalLength / Math.Max( 1, this.Count );
public double AverageLength => ( double ) _totalLength / Math.Max( 1, Count );
protected BasePacketProfile(string name)
: base( name ) {

View file

@ -87,7 +87,7 @@ namespace Server
public int CompareTo( object other )
{
if ( other is Point2D d )
return this.CompareTo( d );
return CompareTo( d );
if ( other == null )
return -1;
@ -120,7 +120,7 @@ namespace Server
public static bool operator == ( Point2D l, IPoint2D r )
{
if ( Object.ReferenceEquals( r, null ) )
if ( ReferenceEquals( r, null ) )
return false;
return l.m_X == r.X && l.m_Y == r.Y;
@ -128,7 +128,7 @@ namespace Server
public static bool operator != ( Point2D l, IPoint2D r )
{
if ( Object.ReferenceEquals( r, null ) )
if ( ReferenceEquals( r, null ) )
return false;
return l.m_X !=r.X || l.m_Y != r.Y;
@ -146,7 +146,7 @@ namespace Server
public static bool operator > ( Point2D l, IPoint2D r )
{
if ( Object.ReferenceEquals( r, null ) )
if ( ReferenceEquals( r, null ) )
return false;
return l.m_X > r.X && l.m_Y > r.Y;
@ -164,7 +164,7 @@ namespace Server
public static bool operator < ( Point2D l, IPoint2D r )
{
if ( Object.ReferenceEquals( r, null ) )
if ( ReferenceEquals( r, null ) )
return false;
return l.m_X < r.X && l.m_Y < r.Y;
@ -182,7 +182,7 @@ namespace Server
public static bool operator >= ( Point2D l, IPoint2D r )
{
if ( Object.ReferenceEquals( r, null ) )
if ( ReferenceEquals( r, null ) )
return false;
return l.m_X >= r.X && l.m_Y >= r.Y;
@ -200,7 +200,7 @@ namespace Server
public static bool operator <= ( Point2D l, IPoint2D r )
{
if ( Object.ReferenceEquals( r, null ) )
if ( ReferenceEquals( r, null ) )
return false;
return l.m_X <= r.X && l.m_Y <= r.Y;
@ -306,7 +306,7 @@ namespace Server
public static bool operator ==( Point3D l, IPoint3D r )
{
if ( Object.ReferenceEquals( r, null ) )
if ( ReferenceEquals( r, null ) )
return false;
return l.m_X == r.X && l.m_Y == r.Y && l.m_Z == r.Z;
@ -314,7 +314,7 @@ namespace Server
public static bool operator !=( Point3D l, IPoint3D r )
{
if ( Object.ReferenceEquals( r, null ) )
if ( ReferenceEquals( r, null ) )
return false;
return l.m_X != r.X || l.m_Y != r.Y || l.m_Z != r.Z;
@ -338,7 +338,7 @@ namespace Server
public int CompareTo( object other )
{
if ( other is Point3D d )
return this.CompareTo( d );
return CompareTo( d );
if ( other == null )
return -1;

View file

@ -58,7 +58,7 @@ namespace Server.Gumps
m_X = x;
m_Y = y;
m_TypeID = GetTypeID( this.GetType() );
m_TypeID = GetTypeID( GetType() );
m_Entries = new List<GumpEntry>();
m_Strings = new List<string>();

View file

@ -46,13 +46,13 @@ namespace Server
public int CompareTo( Entity other )
{
return this.CompareTo( (IEntity) other );
return CompareTo( (IEntity) other );
}
public int CompareTo( object other )
{
if ( other == null || other is IEntity )
return this.CompareTo( (IEntity) other );
return CompareTo( (IEntity) other );
throw new ArgumentException();
}

View file

@ -572,13 +572,13 @@ namespace Server
public int CompareTo( Item other )
{
return this.CompareTo( (IEntity) other );
return CompareTo( (IEntity) other );
}
public int CompareTo( object other )
{
if ( other == null || other is IEntity )
return this.CompareTo( (IEntity) other );
return CompareTo( (IEntity) other );
throw new ArgumentException();
}
@ -927,7 +927,7 @@ namespace Server
/// </summary>
public virtual void AddNameProperty( ObjectPropertyList list )
{
string name = this.Name;
string name = Name;
if ( name == null )
{
@ -1011,7 +1011,7 @@ namespace Server
/// </summary>
public virtual void AddWeightProperty( ObjectPropertyList list )
{
int weight = this.PileWeight + this.TotalWeight;
int weight = PileWeight + TotalWeight;
if ( weight == 1 ) {
list.Add( 1072788, weight.ToString() ); //Weight: ~1_WEIGHT~ stone
@ -1032,7 +1032,7 @@ namespace Server
else if ( IsLockedDown )
AddLockedDownProperty( list );
Mobile blessedFor = this.BlessedFor;
Mobile blessedFor = BlessedFor;
if ( blessedFor != null && !blessedFor.Deleted )
AddBlessedForProperty( list, blessedFor );
@ -1126,7 +1126,7 @@ namespace Server
m_Parent = null;
BounceInfo bounce = this.GetBounce();
BounceInfo bounce = GetBounce();
if ( bounce != null )
{
@ -1342,7 +1342,7 @@ namespace Server
Mobile m = state.Mobile;
if ( m.InRange( oldLocation, GetUpdateRange( m ) ) ) {
state.Send( this.RemovePacket );
state.Send( RemovePacket );
}
}
@ -1351,7 +1351,7 @@ namespace Server
}
m_Location = location;
this.OnLocationChange( oldRealLocation );
OnLocationChange( oldRealLocation );
ReleaseWorldPackets();
@ -1399,7 +1399,7 @@ namespace Server
Mobile m = state.Mobile;
if ( !m.InRange( location, GetUpdateRange( m ) ) ) {
state.Send( this.RemovePacket );
state.Send( RemovePacket );
}
}
@ -1409,7 +1409,7 @@ namespace Server
Point3D oldInternalLocation = m_Location;
m_Location = location;
this.OnLocationChange( oldRealLocation );
OnLocationChange( oldRealLocation );
ReleaseWorldPackets();
@ -1805,7 +1805,7 @@ namespace Server
Mobile m = state.Mobile;
if ( !m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) ) {
state.Send( this.RemovePacket );
state.Send( RemovePacket );
}
}
@ -1911,7 +1911,7 @@ namespace Server
Delta( ItemDelta.Update );
this.OnMapChange();
OnMapChange();
if ( old == null || old == Map.Internal )
InvalidateProperties();
@ -2166,7 +2166,7 @@ namespace Server
Map map = m_Map;
if ( map == null )
return Server.Map.NullEnumerable<IEntity>.Instance;
return Map.NullEnumerable<IEntity>.Instance;
if ( m_Parent == null )
return map.GetObjectsInRange( m_Location, range );
@ -2179,7 +2179,7 @@ namespace Server
Map map = m_Map;
if ( map == null )
return Server.Map.NullEnumerable<Item>.Instance;
return Map.NullEnumerable<Item>.Instance;
if ( m_Parent == null )
return map.GetItemsInRange( m_Location, range );
@ -2192,7 +2192,7 @@ namespace Server
Map map = m_Map;
if ( map == null )
return Server.Map.NullEnumerable<Mobile>.Instance;
return Map.NullEnumerable<Mobile>.Instance;
if ( m_Parent == null )
return map.GetMobilesInRange( m_Location, range );
@ -2205,7 +2205,7 @@ namespace Server
Map map = m_Map;
if ( map == null )
return Server.Map.NullEnumerable<NetState>.Instance;
return Map.NullEnumerable<NetState>.Instance;
if ( m_Parent == null )
return map.GetClientsInRange( m_Location, range );
@ -2367,7 +2367,7 @@ namespace Server
{
string name = reader.ReadString();
if ( name != this.DefaultName )
if ( name != DefaultName )
AcquireCompactInfo().m_Name = name;
}
@ -2487,7 +2487,7 @@ namespace Server
{
string name = reader.ReadString();
if ( name != this.DefaultName )
if ( name != DefaultName )
AcquireCompactInfo().m_Name = name;
}
@ -2583,7 +2583,7 @@ namespace Server
string name = reader.ReadString();
if ( name != this.DefaultName )
if ( name != DefaultName )
AcquireCompactInfo().m_Name = name;
Serial parent = reader.ReadInt();
@ -2646,7 +2646,7 @@ namespace Server
}
}
if ( this.HeldBy != null )
if ( HeldBy != null )
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( FixHolding_Sandbox ) );
//if ( version < 9 )
@ -2655,11 +2655,11 @@ namespace Server
private void FixHolding_Sandbox()
{
Mobile heldBy = this.HeldBy;
Mobile heldBy = HeldBy;
if ( heldBy != null )
{
if ( this.GetBounce() != null )
if ( GetBounce() != null )
{
Bounce( heldBy );
}
@ -2696,11 +2696,11 @@ namespace Server
protected virtual Packet GetWorldPacketFor( NetState state ) {
if ( state.HighSeas )
return this.WorldPacketHS;
return WorldPacketHS;
else if ( state.StygianAbyss )
return this.WorldPacketSA;
return WorldPacketSA;
else
return this.WorldPacket;
return WorldPacket;
}
public virtual bool IsVirtualItem => false;
@ -2775,22 +2775,22 @@ namespace Server
if ( info != null && info.m_Weight != -1 )
return info.m_Weight;
return this.DefaultWeight;
return DefaultWeight;
}
set
{
if ( this.Weight != value )
if ( Weight != value )
{
CompactInfo info = AcquireCompactInfo();
int oldPileWeight = this.PileWeight;
int oldPileWeight = PileWeight;
info.m_Weight = value;
if ( info.m_Weight == -1 )
VerifyCompactInfo();
int newPileWeight = this.PileWeight;
int newPileWeight = PileWeight;
UpdateTotal( this, TotalType.Weight, newPileWeight - oldPileWeight );
@ -2800,7 +2800,7 @@ namespace Server
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
public int PileWeight => (int)Math.Ceiling( this.Weight * this.Amount );
public int PileWeight => (int)Math.Ceiling( Weight * Amount );
public virtual int HuedItemID => m_ItemID;
@ -2915,14 +2915,14 @@ namespace Server
if ( item == this )
{
Console.WriteLine( "Warning: Adding item to itself: [0x{0:X} {1}].AddItem( [0x{2:X} {3}] )", this.Serial.Value, this.GetType().Name, item.Serial.Value, item.GetType().Name );
Console.WriteLine( "Warning: Adding item to itself: [0x{0:X} {1}].AddItem( [0x{2:X} {3}] )", Serial.Value, GetType().Name, item.Serial.Value, item.GetType().Name );
Console.WriteLine( new System.Diagnostics.StackTrace() );
return;
}
if ( IsChildOf( item ) )
{
Console.WriteLine( "Warning: Adding parent item to child: [0x{0:X} {1}].AddItem( [0x{2:X} {3}] )", this.Serial.Value, this.GetType().Name, item.Serial.Value, item.GetType().Name );
Console.WriteLine( "Warning: Adding parent item to child: [0x{0:X} {1}].AddItem( [0x{2:X} {3}] )", Serial.Value, GetType().Name, item.Serial.Value, item.GetType().Name );
Console.WriteLine( new System.Diagnostics.StackTrace() );
return;
}
@ -3060,7 +3060,7 @@ namespace Server
}
}
SecureTradeContainer stc = this.GetSecureTradeCont();
SecureTradeContainer stc = GetSecureTradeCont();
SecureTrade st = stc?.Trade;
@ -3253,16 +3253,16 @@ namespace Server
public virtual void OnDelete()
{
if (this.Spawner != null)
if (Spawner != null)
{
this.Spawner.Remove(this);
this.Spawner = null;
Spawner.Remove(this);
Spawner = null;
}
}
public virtual void OnParentDeleted( IEntity parent )
{
this.Delete();
Delete();
}
public virtual void FreeCache()
@ -3337,9 +3337,9 @@ namespace Server
if ( p == null )
{
if ( ascii )
p = new AsciiMessage( m_Serial, m_ItemID, type, hue, 3, this.Name, text );
p = new AsciiMessage( m_Serial, m_ItemID, type, hue, 3, Name, text );
else
p = new UnicodeMessage( m_Serial, m_ItemID, type, hue, 3, "ENU", this.Name, text );
p = new UnicodeMessage( m_Serial, m_ItemID, type, hue, 3, "ENU", Name, text );
p.Acquire();
}
@ -3375,7 +3375,7 @@ namespace Server
if ( m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) )
{
if ( p == null )
p = Packet.Acquire( new MessageLocalized( m_Serial, m_ItemID, type, hue, 3, number, this.Name, args ) );
p = Packet.Acquire( new MessageLocalized( m_Serial, m_ItemID, type, hue, 3, number, Name, args ) );
state.Send( p );
}
@ -3495,7 +3495,7 @@ namespace Server
Mobile m = state.Mobile;
if ( !m.InRange( value, GetUpdateRange( m ) ) ) {
state.Send( this.RemovePacket );
state.Send( RemovePacket );
}
}
@ -3543,7 +3543,7 @@ namespace Server
ReleaseWorldPackets();
}
this.OnLocationChange( oldLocation );
OnLocationChange( oldLocation );
}
}
}
@ -3578,12 +3578,12 @@ namespace Server
{
if ( m_ItemID != value )
{
int oldPileWeight = this.PileWeight;
int oldPileWeight = PileWeight;
m_ItemID = value;
ReleaseWorldPackets();
int newPileWeight = this.PileWeight;
int newPileWeight = PileWeight;
UpdateTotal( this, TotalType.Weight, newPileWeight - oldPileWeight );
@ -3605,7 +3605,7 @@ namespace Server
if ( info?.m_Name != null )
return info.m_Name;
return this.DefaultName;
return DefaultName;
}
set
{
@ -3688,12 +3688,12 @@ namespace Server
if ( oldValue != value )
{
int oldPileWeight = this.PileWeight;
int oldPileWeight = PileWeight;
m_Amount = value;
ReleaseWorldPackets();
int newPileWeight = this.PileWeight;
int newPileWeight = PileWeight;
UpdateTotal( this, TotalType.Weight, newPileWeight - oldPileWeight );
@ -4063,7 +4063,7 @@ namespace Server
Mobile m = state.Mobile;
if ( m.InRange( worldLoc, GetUpdateRange( m ) ) ) {
state.Send( this.RemovePacket );
state.Send( RemovePacket );
}
}
@ -4233,7 +4233,7 @@ namespace Server
parentMobile.OnSubItemBounceCleared( item );
}
public virtual bool CheckTarget( Mobile from, Server.Targeting.Target targ, object targeted )
public virtual bool CheckTarget( Mobile from, Targeting.Target targ, object targeted )
{
if ( m_Parent is Item item )
return item.CheckTarget( from, targ, targeted );
@ -4352,10 +4352,10 @@ namespace Server
public virtual void OnAosSingleClick( Mobile from )
{
ObjectPropertyList opl = this.PropertyList;
ObjectPropertyList opl = PropertyList;
if ( opl.Header > 0 )
from.Send( new MessageLocalized( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, opl.Header, this.Name, opl.HeaderArgs ) );
from.Send( new MessageLocalized( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, opl.Header, Name, opl.HeaderArgs ) );
}
public virtual void OnSingleClick( Mobile from )
@ -4370,7 +4370,7 @@ namespace Server
if ( ns != null )
{
if ( this.Name == null )
if ( Name == null )
{
if ( m_Amount <= 1 )
ns.Send( new MessageLocalized( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, LabelNumber, "", "" ) );
@ -4379,7 +4379,7 @@ namespace Server
}
else
{
ns.Send( new UnicodeMessage( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "", this.Name + ( m_Amount > 1 ? " : " + m_Amount : "" ) ) );
ns.Send( new UnicodeMessage( m_Serial, m_ItemID, MessageType.Label, 0x3B2, 3, "ENU", "", Name + ( m_Amount > 1 ? " : " + m_Amount : "" ) ) );
}
}
}
@ -4407,10 +4407,10 @@ namespace Server
Amount -= amount;
int ourHue = Hue;
Map thisMap = this.Map;
IEntity thisParent = this.m_Parent;
Point3D worldLoc = this.GetWorldLocation();
LootType type = this.LootType;
Map thisMap = Map;
IEntity thisParent = m_Parent;
Point3D worldLoc = GetWorldLocation();
LootType type = LootType;
if ( Amount == 0 )
Delete();
@ -4434,10 +4434,10 @@ namespace Server
public virtual void Consume( int amount )
{
this.Amount -= amount;
Amount -= amount;
if ( this.Amount <= 0 )
this.Delete();
if ( Amount <= 0 )
Delete();
}
public virtual void ReplaceWith( Item newItem )
@ -4517,7 +4517,7 @@ namespace Server
if ( m_LootType == LootType.Blessed || (Mobile.InsuranceEnabled && Insured) )
return true;
return ( m != null && m == this.BlessedFor );
return ( m != null && m == BlessedFor );
}
public virtual bool CheckNewbied()
@ -4530,7 +4530,7 @@ namespace Server
if ( Mobile.InsuranceEnabled && Insured )
return false;
if ( this.BlessedFor != null )
if ( BlessedFor != null )
return false;
return ( m_LootType == LootType.Regular );
@ -4557,7 +4557,7 @@ namespace Server
World.AddItem( this );
Type ourType = this.GetType();
Type ourType = GetType();
m_TypeRef = World.m_ItemTypes.IndexOf( ourType );
if ( m_TypeRef == -1 )
@ -4577,7 +4577,7 @@ namespace Server
{
m_Serial = serial;
Type ourType = this.GetType();
Type ourType = GetType();
m_TypeRef = World.m_ItemTypes.IndexOf( ourType );
if ( m_TypeRef == -1 )

View file

@ -39,7 +39,7 @@ namespace Server.Items
get => base.ItemID;
set {
if ( base.ItemID != value ) {
Map facet = ( this.Parent == null ? this.Map : null );
Map facet = ( Parent == null ? Map : null );
if ( facet != null ) {
facet.OnLeave( this );
@ -57,8 +57,8 @@ namespace Server.Items
[Obsolete( "Replace with calls to OnLeave and OnEnter surrounding component invalidation.", true )]
public virtual void RefreshComponents()
{
if ( this.Parent == null ) {
Map facet = this.Map;
if ( Parent == null ) {
Map facet = Map;
if ( facet != null ) {
facet.OnLeave( this );
@ -71,7 +71,7 @@ namespace Server.Items
{
get
{
MultiComponentList mcl = this.Components;
MultiComponentList mcl = Components;
if ( mcl.List.Length > 0 ) {
int id = mcl.List[0].m_ItemID;
@ -117,10 +117,10 @@ namespace Server.Items
public virtual bool Contains( int x, int y )
{
MultiComponentList mcl = this.Components;
MultiComponentList mcl = Components;
x -= this.X + mcl.Min.m_X;
y -= this.Y + mcl.Min.m_Y;
x -= X + mcl.Min.m_X;
y -= Y + mcl.Min.m_Y;
return x >= 0
&& x < mcl.Width
@ -131,7 +131,7 @@ namespace Server.Items
public bool Contains( Mobile m )
{
if ( m.Map == this.Map )
if ( m.Map == Map )
return Contains( m.X, m.Y );
else
return false;
@ -139,7 +139,7 @@ namespace Server.Items
public bool Contains( Item item )
{
if ( item.Map == this.Map )
if ( item.Map == Map )
return Contains( item.X, item.Y );
else
return false;

View file

@ -73,11 +73,11 @@ namespace Server.Items
get => base.ItemID;
set
{
int oldID = this.ItemID;
int oldID = ItemID;
base.ItemID = value;
if ( this.ItemID != oldID )
if ( ItemID != oldID )
UpdateContainerData();
}
}
@ -126,7 +126,7 @@ namespace Server.Items
public virtual void UpdateContainerData()
{
this.ContainerData = ContainerData.GetData( this.ItemID );
ContainerData = ContainerData.GetData( ItemID );
}
public virtual Rectangle2D Bounds => ContainerData.Bounds;
@ -199,9 +199,9 @@ namespace Server.Items
return false;
}
int maxItems = this.MaxItems;
int maxItems = MaxItems;
if ( checkItems && maxItems != 0 && (this.TotalItems + plusItems + item.TotalItems + (item.IsVirtualItem ? 0 : 1)) > maxItems )
if ( checkItems && maxItems != 0 && (TotalItems + plusItems + item.TotalItems + (item.IsVirtualItem ? 0 : 1)) > maxItems )
{
if ( message )
SendFullItemsMessage( m, item );
@ -209,7 +209,7 @@ namespace Server.Items
return false;
}
if ( MaxWeight != 0 && (this.TotalWeight + plusWeight + item.TotalWeight + item.PileWeight) > MaxWeight )
if ( MaxWeight != 0 && (TotalWeight + plusWeight + item.TotalWeight + item.PileWeight) > MaxWeight )
{
if ( message )
SendFullWeightMessage( m, item );
@ -218,7 +218,7 @@ namespace Server.Items
}
}
object parent = this.Parent;
object parent = Parent;
while ( parent != null )
{
@ -1490,7 +1490,7 @@ namespace Server.Items
public virtual bool TryDropItem( Mobile from, Item dropped, bool sendFullMessage, bool playSound )
{
List<Item> list = this.Items;
List<Item> list = Items;
for ( int i = 0; i < list.Count; ++i )
{
@ -1524,7 +1524,7 @@ namespace Server.Items
{
Item dropped = droppedItems[i];
List<Item> list = this.Items;
List<Item> list = Items;
bool stacked = false;
@ -1600,7 +1600,7 @@ namespace Server.Items
AddItem( dropped );
Rectangle2D bounds = dropped.GetGraphicBounds();
Rectangle2D ourBounds = this.Bounds;
Rectangle2D ourBounds = Bounds;
int x, y;
@ -1653,7 +1653,7 @@ namespace Server.Items
{
if ( DisplaysContent )
{
object root = this.RootParent;
object root = RootParent;
if ( root == null || root is Item || root == from || from.AccessLevel > AccessLevel.Player )
return true;
@ -1705,7 +1705,7 @@ namespace Server.Items
if ( ObjectPropertyList.Enabled )
{
List<Item> items = this.Items;
List<Item> items = Items;
for ( int i = 0; i < items.Count; ++i )
to.Send( items[i].OPLPacket );
@ -1722,7 +1722,7 @@ namespace Server.Items
if ( m_Openers != null )
{
Point3D worldLoc = GetWorldLocation();
Map map = this.Map;
Map map = Map;
for ( int i = 0; i < m_Openers.Count; ++i )
{
@ -1782,7 +1782,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( from.AccessLevel > AccessLevel.Player || from.InRange( this.GetWorldLocation(), 2 ) )
if ( from.AccessLevel > AccessLevel.Player || from.InRange( GetWorldLocation(), 2 ) )
DisplayTo( from );
else
from.SendLocalizedMessage( 500446 ); // That is too far away.

View file

@ -84,8 +84,8 @@ namespace Server.Items
}
}
if ( this.ItemID == 0xE41 )
this.ItemID = 0xE7C;
if ( ItemID == 0xE41 )
ItemID = 0xE7C;
}
private static bool m_SendRemovePacket;
@ -99,7 +99,7 @@ namespace Server.Items
m_Open = false;
if ( m_Owner != null && m_SendRemovePacket )
m_Owner.Send( this.RemovePacket );
m_Owner.Send( RemovePacket );
}
public override void OnSingleClick( Mobile from )

View file

@ -49,10 +49,10 @@ namespace Server.Items
Mobile to;
if ( this.Trade.From.Container != this )
to = this.Trade.From.Mobile;
if ( Trade.From.Container != this )
to = Trade.From.Mobile;
else
to = this.Trade.To.Mobile;
to = Trade.To.Mobile;
return m.CheckTrade( to, item, this, message, checkItems, plusItems, plusWeight );
}

View file

@ -1150,7 +1150,7 @@ namespace Server
if ( regName != null )
{
if ( m_Regions.ContainsKey( regName ) )
Console.WriteLine( "Warning: Duplicate region name '{0}' for map '{1}'", regName, this.Name );
Console.WriteLine( "Warning: Duplicate region name '{0}' for map '{1}'", regName, Name );
else
m_Regions[regName] = reg;
}

View file

@ -439,7 +439,7 @@ namespace Server
public MobileNotConnectedException( Mobile source, string message )
: base( message )
{
this.Source = source.ToString();
Source = source.ToString();
}
}
@ -478,13 +478,13 @@ namespace Server
public int CompareTo( Mobile other )
{
return this.CompareTo( (IEntity)other );
return CompareTo( (IEntity)other );
}
public int CompareTo( object other )
{
if ( other == null || other is IEntity )
return this.CompareTo( (IEntity)other );
return CompareTo( (IEntity)other );
throw new ArgumentException();
}
@ -766,15 +766,15 @@ namespace Server
}
set
{
Race oldRace = this.Race;
Race oldRace = Race;
m_Race = value;
if ( m_Race == null )
m_Race = Race.DefaultRace;
this.Body = m_Race.Body( this );
this.UpdateResistances();
Body = m_Race.Body( this );
UpdateResistances();
Delta( MobileDelta.Race );
@ -916,11 +916,11 @@ namespace Server
for( int i = 0; i < m_Resistances.Length; ++i )
m_Resistances[i] = 0;
m_Resistances[0] += this.BasePhysicalResistance;
m_Resistances[1] += this.BaseFireResistance;
m_Resistances[2] += this.BaseColdResistance;
m_Resistances[3] += this.BasePoisonResistance;
m_Resistances[4] += this.BaseEnergyResistance;
m_Resistances[0] += BasePhysicalResistance;
m_Resistances[1] += BaseFireResistance;
m_Resistances[2] += BaseColdResistance;
m_Resistances[3] += BasePoisonResistance;
m_Resistances[4] += BaseEnergyResistance;
for( int i = 0; m_ResistMods != null && i < m_ResistMods.Count; ++i )
{
@ -985,7 +985,7 @@ namespace Server
public virtual void OnAosSingleClick( Mobile from )
{
ObjectPropertyList opl = this.PropertyList;
ObjectPropertyList opl = PropertyList;
if ( opl.Header > 0 )
{
@ -1121,7 +1121,7 @@ namespace Server
m_Aggressors.RemoveAt( i );
info.Free();
if ( m_NetState != null && this.CanSee( attacker ) && Utility.InUpdateRange( m_Location, attacker.m_Location ) ) {
if ( m_NetState != null && CanSee( attacker ) && Utility.InUpdateRange( m_Location, attacker.m_Location ) ) {
m_NetState.Send(MobileIncoming.Create(m_NetState, this, attacker));
}
}
@ -1142,7 +1142,7 @@ namespace Server
m_Aggressed.RemoveAt( i );
info.Free();
if ( m_NetState != null && this.CanSee( defender ) && Utility.InUpdateRange( m_Location, defender.m_Location ) ) {
if ( m_NetState != null && CanSee( defender ) && Utility.InUpdateRange( m_Location, defender.m_Location ) ) {
m_NetState.Send(MobileIncoming.Create(m_NetState, this, defender));
}
}
@ -1545,7 +1545,7 @@ namespace Server
m_Paralyzed = value;
Delta( MobileDelta.Flags );
this.SendLocalizedMessage( m_Paralyzed ? 502381 : 502382 );
SendLocalizedMessage( m_Paralyzed ? 502381 : 502382 );
if ( m_ParaTimer != null )
{
@ -1721,7 +1721,7 @@ namespace Server
{
if ( item != null && item.Movable && !item.AllowEquippedCast( this ) )
{
Container pack = this.Backpack;
Container pack = Backpack;
if ( pack == null )
AddToBackpack( item );
@ -1741,9 +1741,9 @@ namespace Server
public virtual bool RegenThroughPoison => m_GlobalRegenThroughPoison;
public virtual bool CanRegenHits => this.Alive && (RegenThroughPoison || !this.Poisoned);
public virtual bool CanRegenStam => this.Alive;
public virtual bool CanRegenMana => this.Alive;
public virtual bool CanRegenHits => Alive && (RegenThroughPoison || !Poisoned);
public virtual bool CanRegenStam => Alive;
public virtual bool CanRegenMana => Alive;
#region Timers
@ -1752,9 +1752,9 @@ namespace Server
private Mobile m_Owner;
public ManaTimer( Mobile m )
: base( Mobile.GetManaRegenRate( m ), Mobile.GetManaRegenRate( m ) )
: base( GetManaRegenRate( m ), GetManaRegenRate( m ) )
{
this.Priority = TimerPriority.FiftyMS;
Priority = TimerPriority.FiftyMS;
m_Owner = m;
}
@ -1763,7 +1763,7 @@ namespace Server
if ( m_Owner.CanRegenMana )// m_Owner.Alive )
m_Owner.Mana++;
Delay = Interval = Mobile.GetManaRegenRate( m_Owner );
Delay = Interval = GetManaRegenRate( m_Owner );
}
}
@ -1772,9 +1772,9 @@ namespace Server
private Mobile m_Owner;
public HitsTimer( Mobile m )
: base( Mobile.GetHitsRegenRate( m ), Mobile.GetHitsRegenRate( m ) )
: base( GetHitsRegenRate( m ), GetHitsRegenRate( m ) )
{
this.Priority = TimerPriority.FiftyMS;
Priority = TimerPriority.FiftyMS;
m_Owner = m;
}
@ -1783,7 +1783,7 @@ namespace Server
if ( m_Owner.CanRegenHits )// m_Owner.Alive && !m_Owner.Poisoned )
m_Owner.Hits++;
Delay = Interval = Mobile.GetHitsRegenRate( m_Owner );
Delay = Interval = GetHitsRegenRate( m_Owner );
}
}
@ -1792,9 +1792,9 @@ namespace Server
private Mobile m_Owner;
public StamTimer( Mobile m )
: base( Mobile.GetStamRegenRate( m ), Mobile.GetStamRegenRate( m ) )
: base( GetStamRegenRate( m ), GetStamRegenRate( m ) )
{
this.Priority = TimerPriority.FiftyMS;
Priority = TimerPriority.FiftyMS;
m_Owner = m;
}
@ -1803,7 +1803,7 @@ namespace Server
if ( m_Owner.CanRegenStam )// m_Owner.Alive )
m_Owner.Stam++;
Delay = Interval = Mobile.GetStamRegenRate( m_Owner );
Delay = Interval = GetStamRegenRate( m_Owner );
}
}
@ -1839,7 +1839,7 @@ namespace Server
public ParalyzedTimer( Mobile m, TimeSpan duration )
: base( duration )
{
this.Priority = TimerPriority.TwentyFiveMS;
Priority = TimerPriority.TwentyFiveMS;
m_Mobile = m;
}
@ -1856,7 +1856,7 @@ namespace Server
public FrozenTimer( Mobile m, TimeSpan duration )
: base( duration )
{
this.Priority = TimerPriority.TwentyFiveMS;
Priority = TimerPriority.TwentyFiveMS;
m_Mobile = m;
}
@ -1914,7 +1914,7 @@ namespace Server
public ExpireCombatantTimer( Mobile m )
: base( TimeSpan.FromMinutes( 1.0 ) )
{
this.Priority = TimerPriority.FiveSeconds;
Priority = TimerPriority.FiveSeconds;
m_Mobile = m;
}
@ -1939,7 +1939,7 @@ namespace Server
public ExpireCriminalTimer( Mobile m )
: base( m_ExpireCriminalDelay )
{
this.Priority = TimerPriority.FiveSeconds;
Priority = TimerPriority.FiveSeconds;
m_Mobile = m;
}
@ -2190,7 +2190,7 @@ namespace Server
{
m_Aggressors.Add( AggressorInfo.Create( aggressor, this, criminal ) ); // new AggressorInfo( aggressor, this, criminal, true ) );
if ( this.CanSee( aggressor ) ) {
if ( CanSee( aggressor ) ) {
m_NetState?.Send(MobileIncoming.Create(m_NetState, this, aggressor));
}
@ -2204,7 +2204,7 @@ namespace Server
{
aggressor.m_Aggressed.Add( AggressorInfo.Create( aggressor, this, criminal ) ); // new AggressorInfo( aggressor, this, criminal, false ) );
if ( this.CanSee( aggressor ) ) {
if ( CanSee( aggressor ) ) {
m_NetState?.Send(MobileIncoming.Create(m_NetState, this, aggressor));
}
@ -2236,7 +2236,7 @@ namespace Server
m_Aggressed.RemoveAt( i );
info.Free();
if ( m_NetState != null && this.CanSee( aggressed ) ) {
if ( m_NetState != null && CanSee( aggressed ) ) {
m_NetState.Send(MobileIncoming.Create(m_NetState, this, aggressed));
}
@ -2263,7 +2263,7 @@ namespace Server
m_Aggressors.RemoveAt( i );
info.Free();
if ( m_NetState != null && this.CanSee( aggressor ) ) {
if ( m_NetState != null && CanSee( aggressor ) ) {
m_NetState.Send(MobileIncoming.Create(m_NetState, this, aggressor));
}
@ -2439,7 +2439,7 @@ namespace Server
{
Target t = new SimpleTarget( range, flags, allowGround, callback );
this.Target = t;
Target = t;
return t;
}
@ -2466,7 +2466,7 @@ namespace Server
{
Target t = new SimpleStateTarget( range, flags, allowGround, callback, state );
this.Target = t;
Target = t;
return t;
}
@ -2492,7 +2492,7 @@ namespace Server
{
Target t = new SimpleStateTarget<T>(range, flags, allowGround, callback, state);
this.Target = t;
Target = t;
return t;
}
@ -2594,14 +2594,14 @@ namespace Server
{
Prompt p = new SimplePrompt( callback, cancelCallback );
this.Prompt = p;
Prompt = p;
return p;
}
public Prompt BeginPrompt( PromptCallback callback, bool callbackHandlesCancel )
{
Prompt p = new SimplePrompt( callback, callbackHandlesCancel );
this.Prompt = p;
Prompt = p;
return p;
}
public Prompt BeginPrompt( PromptCallback callback )
@ -2653,14 +2653,14 @@ namespace Server
{
Prompt p = new SimpleStatePrompt( callback, cancelCallback, state );
this.Prompt = p;
Prompt = p;
return p;
}
public Prompt BeginPrompt( PromptStateCallback callback, bool callbackHandlesCancel, object state )
{
Prompt p = new SimpleStatePrompt( callback, callbackHandlesCancel, state );
this.Prompt = p;
Prompt = p;
return p;
}
public Prompt BeginPrompt( PromptStateCallback callback, object state )
@ -2712,14 +2712,14 @@ namespace Server
{
Prompt p = new SimpleStatePrompt<T>(callback, cancelCallback, state);
this.Prompt = p;
Prompt = p;
return p;
}
public Prompt BeginPrompt<T>(PromptStateCallback<T> callback, bool callbackHandlesCancel, T state)
{
Prompt p = new SimpleStatePrompt<T>(callback, callbackHandlesCancel, state);
this.Prompt = p;
Prompt = p;
return p;
}
public Prompt BeginPrompt<T>(PromptStateCallback<T> callback, T state)
@ -2775,7 +2775,7 @@ namespace Server
{
if ( m_Hidden && m_AccessLevel == AccessLevel.Player )
{
if ( m_AllowedStealthSteps-- <= 0 || (d & Direction.Running) != 0 || this.Mounted )
if ( m_AllowedStealthSteps-- <= 0 || (d & Direction.Running) != 0 || Mounted )
RevealingAction();
}
@ -3131,7 +3131,7 @@ namespace Server
public int ComputeMovementSpeed()
{
return ComputeMovementSpeed( this.Direction, false );
return ComputeMovementSpeed( Direction, false );
}
public int ComputeMovementSpeed( Direction dir )
@ -3189,7 +3189,7 @@ namespace Server
int number;
if ( this.AccessLevel > AccessLevel.Player )
if ( AccessLevel > AccessLevel.Player )
{
number = shoved.m_Hidden ? 1019041 : 1019040;
}
@ -3247,7 +3247,7 @@ namespace Server
Criminal = true;
this.Region.OnCriminalAction( this, message );
Region.OnCriminalAction( this, message );
}
public virtual bool IsSnoop( Mobile from )
@ -3306,7 +3306,7 @@ namespace Server
Mana = 0;
BodyMod = 0;
Body = this.Race.AliveBody( this );
Body = Race.AliveBody( this );
ProcessDeltaQueue();
@ -3321,8 +3321,8 @@ namespace Server
item.Delete();
}
this.SendIncomingPacket();
this.SendIncomingPacket();
SendIncomingPacket();
SendIncomingPacket();
OnAfterResurrect();
@ -3596,7 +3596,7 @@ namespace Server
List<Item> itemsCopy = new List<Item>( m_Items );
Container pack = this.Backpack;
Container pack = Backpack;
for( int i = 0; i < itemsCopy.Count; ++i )
{
@ -3683,7 +3683,7 @@ namespace Server
state.Send( animPacket );
if ( !state.Mobile.CanSee( this ) ) {
state.Send( this.RemovePacket );
state.Send( RemovePacket );
}
}
}
@ -3724,10 +3724,10 @@ namespace Server
/// </summary>
public virtual void OnDeath( Container c )
{
int sound = this.GetDeathSound();
int sound = GetDeathSound();
if ( sound >= 0 )
Effects.PlaySound( this, this.Map, sound );
Effects.PlaySound( this, Map, sound );
if ( !m_Player )
{
@ -3741,7 +3741,7 @@ namespace Server
BodyMod = 0;
//Body = this.Female ? 0x193 : 0x192;
Body = this.Race.GhostBody( this );
Body = Race.GhostBody( this );
Item deathShroud = new Item( 0x204E );
@ -3874,7 +3874,7 @@ namespace Server
public virtual void Use( Item item )
{
if ( item == null || item.Deleted || item.QuestItem || this.Deleted )
if ( item == null || item.Deleted || item.QuestItem || Deleted )
return;
DisruptiveAction();
@ -3906,7 +3906,7 @@ namespace Server
okay = false;
else if ( root is Mobile mobile && mobile.IsSnoop( this ) )
item.OnSnoop( this );
else if ( this.Region.OnDoubleClick( this, item ) )
else if ( Region.OnDoubleClick( this, item ) )
okay = true;
if ( okay )
@ -3923,7 +3923,7 @@ namespace Server
public virtual void Use( Mobile m )
{
if ( m == null || m.Deleted || this.Deleted )
if ( m == null || m.Deleted || Deleted )
return;
DisruptiveAction();
@ -3937,7 +3937,7 @@ namespace Server
m.OnDoubleClickCantSee( this );
else if ( !CheckAlive( false ) )
m.OnDoubleClickDead( this );
else if ( this.Region.OnDoubleClick( this, m ) && !m.Deleted )
else if ( Region.OnDoubleClick( this, m ) && !m.Deleted )
m.OnDoubleClick( this );
}
@ -4413,7 +4413,7 @@ namespace Server
Map map = m_Map;
if ( map == null )
return Server.Map.NullEnumerable<T>.Instance;
return Map.NullEnumerable<T>.Instance;
return map.GetItemsInRange<T>( m_Location, range );
}
@ -4423,7 +4423,7 @@ namespace Server
Map map = m_Map;
if ( map == null )
return Server.Map.NullEnumerable<IEntity>.Instance;
return Map.NullEnumerable<IEntity>.Instance;
return map.GetObjectsInRange( m_Location, range );
}
@ -4437,7 +4437,7 @@ namespace Server
Map map = m_Map;
if (map == null)
return Server.Map.NullEnumerable<T>.Instance;
return Map.NullEnumerable<T>.Instance;
return map.GetMobilesInRange<T>(m_Location, range);
}
@ -4447,7 +4447,7 @@ namespace Server
Map map = m_Map;
if ( map == null )
return Server.Map.NullEnumerable<NetState>.Instance;
return Map.NullEnumerable<NetState>.Instance;
return map.GetClientsInRange( m_Location, range );
}
@ -4488,7 +4488,7 @@ namespace Server
SpeechEventArgs regArgs = new SpeechEventArgs( this, text, type, hue, keywords );
EventSink.InvokeSpeech( regArgs );
this.Region.OnSpeech( regArgs );
Region.OnSpeech( regArgs );
OnSaid( regArgs );
if ( regArgs.Blocked )
@ -4836,7 +4836,7 @@ namespace Server
if ( !CanBeDamaged() || m_Deleted )
return;
if ( !this.Region.OnDamage( this, ref amount ) )
if ( !Region.OnDamage( this, ref amount ) )
return;
if ( amount > 0 )
@ -4877,7 +4877,7 @@ namespace Server
OnDamage( amount, from, newHits < 0 );
IMount m = this.Mount;
IMount m = Mount;
if ( m != null && informMount )
m.OnRiderDamaged( amount, from, newHits < 0 );
@ -5544,7 +5544,7 @@ namespace Server
if ( (hairflag & 0x02) != 0 )
m_FacialHair.Serialize( writer );
writer.Write( this.Race );
writer.Write( Race );
writer.Write( (int)m_TithingPoints );
@ -6234,7 +6234,7 @@ namespace Server
foreach( NetState state in eable ) {
if ( state != m_NetState && (everyone || !state.Mobile.CanSee( this )) )
state.Send( this.RemovePacket );
state.Send( RemovePacket );
}
eable.Free();
@ -6416,9 +6416,9 @@ namespace Server
if ( m_Squelched )
{
if ( Core.ML )
this.SendLocalizedMessage( 500168 ); // You can not say anything, you have been muted.
SendLocalizedMessage( 500168 ); // You can not say anything, you have been muted.
else
this.SendMessage( "You can not say anything, you have been squelched." ); //Cliloc ITSELF changed during ML.
SendMessage( "You can not say anything, you have been squelched." ); //Cliloc ITSELF changed during ML.
e.Blocked = true;
}
@ -6760,7 +6760,7 @@ namespace Server
OnHarmfulAction( target, isCriminal );
target.AggressiveAction( this, isCriminal );
this.Region.OnDidHarmful( this, target );
Region.OnDidHarmful( this, target );
target.Region.OnGotHarmful( this, target );
if ( !indirect )
@ -7554,7 +7554,7 @@ namespace Server
foreach (NetState state in eable) {
if (!state.Mobile.CanSee(this)) {
state.Send(this.RemovePacket);
state.Send(RemovePacket);
} else {
state.Send(MobileIncoming.Create(state, state.Mobile, this));
@ -7806,7 +7806,7 @@ namespace Server
m_GuildTitle = value;
if ( m_Guild != null && !m_Guild.Disbanded && m_GuildTitle != null )
this.SendLocalizedMessage( 1018026, true, m_GuildTitle ); // Your guild title has changed :
SendLocalizedMessage( 1018026, true, m_GuildTitle ); // Your guild title has changed :
InvalidateProperties();
@ -8011,7 +8011,7 @@ namespace Server
/// </summary>
public virtual void OnPoisonImmunity( Mobile from, Poison poison )
{
this.PublicOverheadMessage( MessageType.Emote, 0x3B2, 1005534 ); // * The poison seems to have no effect. *
PublicOverheadMessage( MessageType.Emote, 0x3B2, 1005534 ); // * The poison seems to have no effect. *
}
/// <summary>
@ -8033,8 +8033,8 @@ namespace Server
{
if ( poison != null )
{
this.LocalOverheadMessage( MessageType.Regular, 0x21, 1042857 + (poison.Level * 2) );
this.NonlocalOverheadMessage( MessageType.Regular, 0x21, 1042858 + (poison.Level * 2), Name );
LocalOverheadMessage( MessageType.Regular, 0x21, 1042857 + (poison.Level * 2) );
NonlocalOverheadMessage( MessageType.Regular, 0x21, 1042858 + (poison.Level * 2), Name );
}
}
@ -8106,7 +8106,7 @@ namespace Server
}
Poison oldPoison = m_Poison;
this.Poison = poison;
Poison = poison;
OnPoisoned( from, poison, oldPoison );
@ -8152,7 +8152,7 @@ namespace Server
if ( CheckCure( from ) )
{
Poison oldPoison = m_Poison;
this.Poison = null;
Poison = null;
OnCured( from, oldPoison );
@ -8292,10 +8292,10 @@ namespace Server
get
{
if ( m_Region == null )
if ( this.Map == null )
if ( Map == null )
return Map.Internal.DefaultRegion;
else
return this.Map.DefaultRegion;
return Map.DefaultRegion;
else
return m_Region;
}
@ -8567,7 +8567,7 @@ namespace Server
foreach( NetState ns in eable ) {
if ( ns != m_NetState && !Utility.InUpdateRange( newLocation, ns.Mobile.Location ) ) {
ns.Send( this.RemovePacket );
ns.Send( RemovePacket );
}
}
@ -8687,7 +8687,7 @@ namespace Server
OnLocationChange( oldLocation );
this.Region.OnLocationChanged( this, oldLocation );
Region.OnLocationChanged( this, oldLocation );
}
}
@ -9021,7 +9021,7 @@ namespace Server
if ( item.Deleted )
return false;
Container pack = this.Backpack;
Container pack = Backpack;
return pack != null && pack.TryDropItem( this, item, false );
}
@ -9056,7 +9056,7 @@ namespace Server
public virtual bool CheckNonlocalLift( Mobile from, Item item )
{
if ( from == this || (from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) )
if ( from == this || (from.AccessLevel > AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) )
return true;
return false;
@ -9124,7 +9124,7 @@ namespace Server
{
if ( from == this )
{
Container pack = this.Backpack;
Container pack = Backpack;
if ( pack != null )
return dropped.DropToItem( from, pack, new Point3D( -1, -1, 0 ) );
@ -9241,7 +9241,7 @@ namespace Server
public virtual bool CheckNonlocalDrop( Mobile from, Item item, Item target )
{
if ( from == this || (from.AccessLevel > this.AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) )
if ( from == this || (from.AccessLevel > AccessLevel && from.AccessLevel >= AccessLevel.GameMaster) )
return true;
return false;
@ -9267,7 +9267,7 @@ namespace Server
public virtual bool AllowEquipFrom( Mobile mob )
{
return (mob == this || (mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > this.AccessLevel));
return (mob == this || (mob.AccessLevel >= AccessLevel.GameMaster && mob.AccessLevel > AccessLevel));
}
public virtual bool EquipItem( Item item )
@ -9301,7 +9301,7 @@ namespace Server
m_NextSkillTime = Core.TickCount;
m_DamageEntries = new List<DamageEntry>();
Type ourType = this.GetType();
Type ourType = GetType();
m_TypeRef = World.m_MobileTypes.IndexOf( ourType );
if ( m_TypeRef == -1 )
@ -9314,13 +9314,13 @@ namespace Server
public Mobile()
{
m_Region = Map.Internal.DefaultRegion;
m_Serial = Server.Serial.NewMobile;
m_Serial = Serial.NewMobile;
DefaultMobileInit();
World.AddMobile( this );
Type ourType = this.GetType();
Type ourType = GetType();
m_TypeRef = World.m_MobileTypes.IndexOf( ourType );
if ( m_TypeRef == -1 )
@ -9687,7 +9687,7 @@ namespace Server
if ( beholder != m && beholder.CanSee( m ) )
{
if ( sendRemove )
state.Send(this.RemovePacket);
state.Send(RemovePacket);
if ( sendIncoming )
{
@ -9792,7 +9792,7 @@ namespace Server
}
if ( sendOPLUpdate )
state.Send(this.OPLPacket);
state.Send(OPLPacket);
}
}
@ -9920,7 +9920,7 @@ namespace Server
if ( !Alive )
{
if ( message )
this.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019048 ); // I am dead and cannot do that.
LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019048 ); // I am dead and cannot do that.
return false;
}
@ -10354,7 +10354,7 @@ namespace Server
/// <param name="from"></param>
public virtual void OnStatsQuery( Mobile from )
{
if ( from.Map == this.Map && Utility.InUpdateRange( this, from ) && from.CanSee( this ) )
if ( from.Map == Map && Utility.InUpdateRange( this, from ) && from.CanSee( this ) )
from.Send( new MobileStatus( from, this, m_NetState ) );
if ( from == this )

View file

@ -1138,7 +1138,7 @@ namespace Server.Network {
for ( int i = ExpansionInfo.Table.Length - 1; i >= 0; i-- ) {
ExpansionInfo info = ExpansionInfo.Table[i];
if ( ( info.RequiredClient != null && this.Version >= info.RequiredClient ) || ( ( this.Flags & info.ClientFlags ) != 0 ) ) {
if ( ( info.RequiredClient != null && Version >= info.RequiredClient ) || ( ( Flags & info.ClientFlags ) != 0 ) ) {
return info;
}
}
@ -1147,16 +1147,16 @@ namespace Server.Network {
}
}
public Expansion Expansion => ( Expansion ) this.ExpansionInfo.ID;
public Expansion Expansion => ( Expansion ) ExpansionInfo.ID;
public bool SupportsExpansion( ExpansionInfo info, bool checkCoreExpansion ) {
if ( info == null || ( checkCoreExpansion && ( int ) Core.Expansion < info.ID ) )
return false;
if ( info.RequiredClient != null )
return ( this.Version >= info.RequiredClient );
return ( Version >= info.RequiredClient );
return ( ( this.Flags & info.ClientFlags ) != 0 );
return ( ( Flags & info.ClientFlags ) != 0 );
}
public bool SupportsExpansion( Expansion ex, bool checkCoreExpansion ) {

View file

@ -2161,7 +2161,7 @@ namespace Server.Network
state.Send(new MobileIncoming(m, m));
//state.Send( new MobileAttributes( m ) );
state.Send(new MobileStatus(m, m));
state.Send(Server.Network.SetWarMode.Instantiate(m.Warmode));
state.Send(Network.SetWarMode.Instantiate(m.Warmode));
m.SendEverything();
@ -2169,7 +2169,7 @@ namespace Server.Network
state.Send(new MobileUpdate(m));
//state.Send( new MobileAttributes( m ) );
state.Send(new MobileStatus(m, m));
state.Send(Server.Network.SetWarMode.Instantiate(m.Warmode));
state.Send(Network.SetWarMode.Instantiate(m.Warmode));
state.Send(new MobileIncoming(m, m));
} else if ( state.StygianAbyss ) {
state.Send( new MobileUpdate( m ) );
@ -2182,7 +2182,7 @@ namespace Server.Network
state.Send( new MobileIncomingSA( m, m ) );
//state.Send( new MobileAttributes( m ) );
state.Send( new MobileStatus( m, m ) );
state.Send( Server.Network.SetWarMode.Instantiate( m.Warmode ) );
state.Send( Network.SetWarMode.Instantiate( m.Warmode ) );
m.SendEverything();
@ -2190,7 +2190,7 @@ namespace Server.Network
state.Send( new MobileUpdate( m ) );
//state.Send( new MobileAttributes( m ) );
state.Send( new MobileStatus( m, m ) );
state.Send( Server.Network.SetWarMode.Instantiate( m.Warmode ) );
state.Send( Network.SetWarMode.Instantiate( m.Warmode ) );
state.Send( new MobileIncomingSA( m, m ) );
} else {
state.Send( new MobileUpdateOld( m ) );
@ -2203,7 +2203,7 @@ namespace Server.Network
state.Send( new MobileIncomingOld( m, m ) );
//state.Send( new MobileAttributes( m ) );
state.Send( new MobileStatus( m, m ) );
state.Send( Server.Network.SetWarMode.Instantiate( m.Warmode ) );
state.Send( Network.SetWarMode.Instantiate( m.Warmode ) );
m.SendEverything();
@ -2211,7 +2211,7 @@ namespace Server.Network
state.Send( new MobileUpdateOld( m ) );
//state.Send( new MobileAttributes( m ) );
state.Send( new MobileStatus( m, m ) );
state.Send( Server.Network.SetWarMode.Instantiate( m.Warmode ) );
state.Send( Network.SetWarMode.Instantiate( m.Warmode ) );
state.Send( new MobileIncomingOld( m, m ) );
}

View file

@ -280,7 +280,7 @@ namespace Server.Network
{
public ObjectHelpResponse( IEntity e, string text ) : base( 0xB7 )
{
this.EnsureCapacity( 9 + (text.Length * 2) );
EnsureCapacity( 9 + (text.Length * 2) );
m_Stream.Write( (int) e.Serial );
m_Stream.WriteBigUniNull( text );
@ -292,7 +292,7 @@ namespace Server.Network
public VendorBuyContent( List<BuyItemState> list )
: base( 0x3c )
{
this.EnsureCapacity( list.Count*19 + 5 );
EnsureCapacity( list.Count*19 + 5 );
m_Stream.Write( (short)list.Count );
@ -320,7 +320,7 @@ namespace Server.Network
{
public VendorBuyContent6017( List<BuyItemState> list ) : base( 0x3c )
{
this.EnsureCapacity( list.Count*20 + 5 );
EnsureCapacity( list.Count*20 + 5 );
m_Stream.Write( (short)list.Count );
@ -369,7 +369,7 @@ namespace Server.Network
public VendorBuyList( Mobile vendor, List<BuyItemState> list )
: base( 0x74 )
{
this.EnsureCapacity( 256 );
EnsureCapacity( 256 );
m_Stream.Write( (int)(!(vendor.FindItemOnLayer( Layer.ShopBuy ) is Container BuyPack) ? Serial.MinusOne : BuyPack.Serial) );
@ -396,7 +396,7 @@ namespace Server.Network
{
public VendorSellList( Mobile shopkeeper, ICollection<SellItemState> sis ) : base( 0x9E )
{
this.EnsureCapacity( 256 );
EnsureCapacity( 256 );
m_Stream.Write( (int) shopkeeper.Serial );
@ -458,7 +458,7 @@ namespace Server.Network
{
public StatLockInfo( Mobile m ) : base( 0xBF )
{
this.EnsureCapacity( 12 );
EnsureCapacity( 12 );
m_Stream.Write( (short) 0x19 );
m_Stream.Write( (byte) 2 );
@ -525,7 +525,7 @@ namespace Server.Network
{
EquipInfoAttribute[] attrs = info.Attributes;
this.EnsureCapacity( 17 + (info.Crafter == null ? 0 : 6 + info.Crafter.Name == null ? 0 : info.Crafter.Name.Length) + (info.Unidentified ? 4 : 0) + (attrs.Length * 6) );
EnsureCapacity( 17 + (info.Crafter == null ? 0 : 6 + info.Crafter.Name == null ? 0 : info.Crafter.Name.Length) + (info.Unidentified ? 4 : 0) + (attrs.Length * 6) );
m_Stream.Write( (short) 0x10 );
m_Stream.Write( (int) item.Serial );
@ -627,7 +627,7 @@ namespace Server.Network
{
public UnicodePrompt( Prompt prompt ) : base( 0xC2 )
{
this.EnsureCapacity( 21 );
EnsureCapacity( 21 );
m_Stream.Write( (int) prompt.Serial );
m_Stream.Write( (int) prompt.Serial );
@ -641,7 +641,7 @@ namespace Server.Network
{
public ChangeCharacter( IAccount a ) : base( 0x81 )
{
this.EnsureCapacity( 305 );
EnsureCapacity( 305 );
int count = 0;
@ -678,8 +678,8 @@ namespace Server.Network
public sealed class DeathStatus : Packet
{
public static readonly Packet Dead = Packet.SetStatic( new DeathStatus( true ) );
public static readonly Packet Alive = Packet.SetStatic( new DeathStatus( false ) );
public static readonly Packet Dead = SetStatic( new DeathStatus( true ) );
public static readonly Packet Alive = SetStatic( new DeathStatus( false ) );
public static Packet Instantiate( bool dead )
{
@ -694,9 +694,9 @@ namespace Server.Network
public sealed class SpeedControl : Packet
{
public static readonly Packet WalkSpeed = Packet.SetStatic( new SpeedControl( 2 ) );
public static readonly Packet MountSpeed = Packet.SetStatic( new SpeedControl( 1 ) );
public static readonly Packet Disable = Packet.SetStatic( new SpeedControl( 0 ) );
public static readonly Packet WalkSpeed = SetStatic( new SpeedControl( 2 ) );
public static readonly Packet MountSpeed = SetStatic( new SpeedControl( 1 ) );
public static readonly Packet Disable = SetStatic( new SpeedControl( 0 ) );
public SpeedControl( int speedControl )
: base( 0xBF )
@ -719,7 +719,7 @@ namespace Server.Network
{
public BondedStatus( int val1, Serial serial, int val2 ) : base( 0xBF )
{
this.EnsureCapacity( 11 );
EnsureCapacity( 11 );
m_Stream.Write( (short) 0x19 );
m_Stream.Write( (byte) val1 );
@ -746,7 +746,7 @@ namespace Server.Network
{
public DisplayItemListMenu( ItemListMenu menu ) : base( 0x7C )
{
this.EnsureCapacity( 256 );
EnsureCapacity( 256 );
m_Stream.Write( (int) ((IMenu)menu).Serial );
m_Stream.Write( (short) 0 );
@ -793,7 +793,7 @@ namespace Server.Network
{
public DisplayQuestionMenu( QuestionMenu menu ) : base( 0x7C )
{
this.EnsureCapacity( 256 );
EnsureCapacity( 256 );
m_Stream.Write( (int) ((IMenu)menu).Serial );
m_Stream.Write( (short) 0 );
@ -897,7 +897,7 @@ namespace Server.Network
int length = (byte) entries.Length;
this.EnsureCapacity( 12 + (length * 8) );
EnsureCapacity( 12 + (length * 8) );
m_Stream.Write( (short) 0x14 );
m_Stream.Write( (short) 0x02 );
@ -946,7 +946,7 @@ namespace Server.Network
int length = (byte) entries.Length;
this.EnsureCapacity( 12 + (length * 8) );
EnsureCapacity( 12 + (length * 8) );
m_Stream.Write( (short) 0x14 );
m_Stream.Write( (short) 0x01 );
@ -1021,7 +1021,7 @@ namespace Server.Network
{
public CloseGump( int typeID, int buttonID ) : base( 0xBF )
{
this.EnsureCapacity( 13 );
EnsureCapacity( 13 );
m_Stream.Write( (short) 0x04 );
m_Stream.Write( (int) typeID );
@ -1068,7 +1068,7 @@ namespace Server.Network
{
public WorldItem( Item item ) : base( 0x1A )
{
this.EnsureCapacity( 20 );
EnsureCapacity( 20 );
// 14 base length
// +2 - Amount
@ -1284,7 +1284,7 @@ namespace Server.Network
{
public UnkD3( Mobile beholder, Mobile beheld ) : base( 0xD3 )
{
this.EnsureCapacity( 256 );
EnsureCapacity( 256 );
//int
//short
@ -1327,7 +1327,7 @@ namespace Server.Network
{
public GQRequest() : base( 0xC3 )
{
this.EnsureCapacity( 256 );
EnsureCapacity( 256 );
m_Stream.Write( (int) 1 );
m_Stream.Write( (int) 2 ); // ID
@ -1386,7 +1386,7 @@ namespace Server.Network
{
public ClientVersionReq() : base( 0xBD )
{
this.EnsureCapacity( 3 );
EnsureCapacity( 3 );
}
}
@ -1397,7 +1397,7 @@ namespace Server.Network
{
public AssistVersionReq( int unk ) : base( 0xBE )
{
this.EnsureCapacity( 7 );
EnsureCapacity( 7 );
m_Stream.Write( (int) unk );
}
@ -1582,7 +1582,7 @@ namespace Server.Network
public sealed class ScreenFadeOut : ScreenEffect
{
public static readonly Packet Instance = Packet.SetStatic( new ScreenFadeOut() );
public static readonly Packet Instance = SetStatic( new ScreenFadeOut() );
public ScreenFadeOut()
: base( ScreenEffectType.FadeOut )
@ -1592,7 +1592,7 @@ namespace Server.Network
public sealed class ScreenFadeIn : ScreenEffect
{
public static readonly Packet Instance = Packet.SetStatic( new ScreenFadeIn() );
public static readonly Packet Instance = SetStatic( new ScreenFadeIn() );
public ScreenFadeIn()
: base( ScreenEffectType.FadeIn )
@ -1602,7 +1602,7 @@ namespace Server.Network
public sealed class ScreenFadeInOut : ScreenEffect
{
public static readonly Packet Instance = Packet.SetStatic( new ScreenFadeInOut() );
public static readonly Packet Instance = SetStatic( new ScreenFadeInOut() );
public ScreenFadeInOut()
: base( ScreenEffectType.FadeInOut )
@ -1612,7 +1612,7 @@ namespace Server.Network
public sealed class ScreenLightFlash : ScreenEffect
{
public static readonly Packet Instance = Packet.SetStatic( new ScreenLightFlash() );
public static readonly Packet Instance = SetStatic( new ScreenLightFlash() );
public ScreenLightFlash()
: base( ScreenEffectType.LightFlash )
@ -1622,7 +1622,7 @@ namespace Server.Network
public sealed class ScreenDarkFlash : ScreenEffect
{
public static readonly Packet Instance = Packet.SetStatic( new ScreenDarkFlash() );
public static readonly Packet Instance = SetStatic( new ScreenDarkFlash() );
public ScreenDarkFlash()
: base( ScreenEffectType.DarkFlash )
@ -1763,7 +1763,7 @@ namespace Server.Network
{
public SpellbookContent( int count, int offset, ulong content, Item item ) : base( 0x3C )
{
this.EnsureCapacity( 5 + (count * 19) );
EnsureCapacity( 5 + (count * 19) );
int written = 0;
@ -1797,7 +1797,7 @@ namespace Server.Network
{
public SpellbookContent6017( int count, int offset, ulong content, Item item ) : base( 0x3C )
{
this.EnsureCapacity( 5 + (count * 20) );
EnsureCapacity( 5 + (count * 20) );
int written = 0;
@ -1909,7 +1909,7 @@ namespace Server.Network
List<Item> items = beheld.Items;
int count = items.Count;
this.EnsureCapacity( 5 + (count * 19) );
EnsureCapacity( 5 + (count * 19) );
long pos = m_Stream.Position;
@ -1950,7 +1950,7 @@ namespace Server.Network
List<Item> items = beheld.Items;
int count = items.Count;
this.EnsureCapacity( 5 + (count * 20) );
EnsureCapacity( 5 + (count * 20) );
long pos = m_Stream.Position;
@ -1987,8 +1987,8 @@ namespace Server.Network
public sealed class SetWarMode : Packet
{
public static readonly Packet InWarMode = Packet.SetStatic( new SetWarMode( true ) );
public static readonly Packet InPeaceMode = Packet.SetStatic( new SetWarMode( false ) );
public static readonly Packet InWarMode = SetStatic( new SetWarMode( true ) );
public static readonly Packet InPeaceMode = SetStatic( new SetWarMode( false ) );
public static Packet Instantiate( bool mode )
{
@ -2065,7 +2065,7 @@ namespace Server.Network
{
public SkillUpdate( Skills skills ) : base( 0x3A )
{
this.EnsureCapacity( 6 + (skills.Length * 9) );
EnsureCapacity( 6 + (skills.Length * 9) );
m_Stream.Write( (byte) 0x02 ); // type: absolute, capped
@ -2104,7 +2104,7 @@ namespace Server.Network
{
public SkillChange( Skill skill ) : base( 0x3A )
{
this.EnsureCapacity( 13 );
EnsureCapacity( 13 );
double v = skill.NonRacialValue;
int uv = (int)(v * 10);
@ -2135,7 +2135,7 @@ namespace Server.Network
{
if ( url == null ) url = "";
this.EnsureCapacity( 4 + url.Length );
EnsureCapacity( 4 + url.Length );
m_Stream.WriteAsciiNull( url );
}
@ -2196,7 +2196,7 @@ namespace Server.Network
if ( hue == 0 )
hue = 0x3B2;
this.EnsureCapacity( 50 + (args.Length * 2) );
EnsureCapacity( 50 + (args.Length * 2) );
m_Stream.Write( (int) serial );
m_Stream.Write( (short) graphic );
@ -2296,7 +2296,7 @@ namespace Server.Network
public sealed class CancelTarget : Packet
{
public static readonly Packet Instance = Packet.SetStatic( new CancelTarget() );
public static readonly Packet Instance = SetStatic( new CancelTarget() );
public CancelTarget() : base( 0x6C, 19 )
{
@ -2613,7 +2613,7 @@ namespace Server.Network
{
if ( layout == null ) layout = "";
this.EnsureCapacity( 256 );
EnsureCapacity( 256 );
m_Stream.Write( (int) g.Serial );
m_Stream.Write( (int) g.TypeID );
@ -2679,7 +2679,7 @@ namespace Server.Network
public sealed class PlayMusic : Packet
{
public static readonly Packet InvalidInstance = Packet.SetStatic( new PlayMusic( MusicName.Invalid ) );
public static readonly Packet InvalidInstance = SetStatic( new PlayMusic( MusicName.Invalid ) );
private static Packet[] m_Instances = new Packet[60];
@ -2696,7 +2696,7 @@ namespace Server.Network
p = m_Instances[v];
if ( p == null )
m_Instances[v] = p = Packet.SetStatic( new PlayMusic( name ) );
m_Instances[v] = p = SetStatic( new PlayMusic( name ) );
}
else
{
@ -2718,7 +2718,7 @@ namespace Server.Network
{
if ( text == null ) text = "";
this.EnsureCapacity( 10 + text.Length );
EnsureCapacity( 10 + text.Length );
m_Stream.Write( (byte) type );
m_Stream.Write( (int) tip );
@ -2743,7 +2743,7 @@ namespace Server.Network
{
public MapChange( Mobile m ) : base( 0xBF )
{
this.EnsureCapacity( 6 );
EnsureCapacity( 6 );
m_Stream.Write( (short) 0x08 );
m_Stream.Write( (byte) (m.Map == null ? 0 : m.Map.MapID) );
@ -2988,7 +2988,7 @@ namespace Server.Network
if ( name == null ) name = "";
this.EnsureCapacity( 37 );
EnsureCapacity( 37 );
m_Stream.Write( (int) m.Serial );
m_Stream.WriteAsciiFixed( name, 30 );
@ -3027,7 +3027,7 @@ namespace Server.Network
string name = m.Name;
if ( name == null ) name = "";
this.EnsureCapacity( 43 );
EnsureCapacity( 43 );
m_Stream.Write( (int) m.Serial );
m_Stream.WriteAsciiFixed( name, 30 );
@ -3366,7 +3366,7 @@ namespace Server.Network
if (beheld.FacialHairItemID > 0)
count++;
this.EnsureCapacity(23 + (count * 9));
EnsureCapacity(23 + (count * 9));
int hue = beheld.Hue;
@ -3474,7 +3474,7 @@ namespace Server.Network
if ( beheld.FacialHairItemID > 0 )
count++;
this.EnsureCapacity( 23 + (count * 9) );
EnsureCapacity( 23 + (count * 9) );
int hue = beheld.Hue;
@ -3600,7 +3600,7 @@ namespace Server.Network
if ( beheld.FacialHairItemID > 0 )
count++;
this.EnsureCapacity( 23 + (count * 9) );
EnsureCapacity( 23 + (count * 9) );
int hue = beheld.Hue;
@ -3716,7 +3716,7 @@ namespace Server.Network
if ( hue == 0 )
hue = 0x3B2;
this.EnsureCapacity( 45 + text.Length );
EnsureCapacity( 45 + text.Length );
m_Stream.Write( (int) serial );
m_Stream.Write( (short) graphic );
@ -3739,7 +3739,7 @@ namespace Server.Network
if ( hue == 0 )
hue = 0x3B2;
this.EnsureCapacity( 50 + (text.Length * 2) );
EnsureCapacity( 50 + (text.Length * 2) );
m_Stream.Write( (int) serial );
m_Stream.Write( (short) graphic );
@ -3853,7 +3853,7 @@ namespace Server.Network
public sealed class LoginComplete : Packet
{
public static readonly Packet Instance = Packet.SetStatic( new LoginComplete() );
public static readonly Packet Instance = SetStatic( new LoginComplete() );
public LoginComplete() : base( 0x55, 1 )
{
@ -3942,7 +3942,7 @@ namespace Server.Network
{
public CharacterListUpdate( IAccount a ) : base( 0x86 )
{
this.EnsureCapacity( 4 + (a.Length * 60) );
EnsureCapacity( 4 + (a.Length * 60) );
int highSlot = -1;
@ -4043,7 +4043,7 @@ namespace Server.Network
{
public CharacterList( IAccount a, CityInfo[] info ) : base( 0xA9 )
{
this.EnsureCapacity( 11 + (a.Length * 60) + (info.Length * 89) );
EnsureCapacity( 11 + (a.Length * 60) + (info.Length * 89) );
int highSlot = -1;
@ -4144,7 +4144,7 @@ namespace Server.Network
{
public CharacterListOld( IAccount a, CityInfo[] info ) : base( 0xA9 )
{
this.EnsureCapacity( 9 + (a.Length * 60) + (info.Length * 63) );
EnsureCapacity( 9 + (a.Length * 60) + (info.Length * 63) );
int highSlot = -1;
@ -4227,7 +4227,7 @@ namespace Server.Network
public sealed class ClearWeaponAbility : Packet
{
public static readonly Packet Instance = Packet.SetStatic( new ClearWeaponAbility() );
public static readonly Packet Instance = SetStatic( new ClearWeaponAbility() );
public ClearWeaponAbility() : base( 0xBF )
{
@ -4273,7 +4273,7 @@ namespace Server.Network
if ( hue == 0 )
hue = 0x3B2;
this.EnsureCapacity( 52 + affix.Length + (args.Length * 2) );
EnsureCapacity( 52 + affix.Length + (args.Length * 2) );
m_Stream.Write( (int) serial );
m_Stream.Write( (short) graphic );
@ -4341,7 +4341,7 @@ namespace Server.Network
{
public AccountLoginAck( ServerInfo[] info ) : base( 0xA8 )
{
this.EnsureCapacity( 6 + (info.Length * 40) );
EnsureCapacity( 6 + (info.Length * 40) );
m_Stream.Write( (byte) 0x5D ); // Unknown
@ -4367,7 +4367,7 @@ namespace Server.Network
if ( unknown == null ) unknown = "";
if ( caption == null ) caption = "";
this.EnsureCapacity( 16 + unknown.Length + caption.Length );
EnsureCapacity( 16 + unknown.Length + caption.Length );
m_Stream.Write( (int) serial );
m_Stream.Write( (short) gumpID );
@ -4583,7 +4583,7 @@ namespace Server.Network
{
using (StreamWriter op = new StreamWriter("net_opt.log", true))
{
op.WriteLine("Redundant compile for packet {0}, use Acquire() and Release()", this.GetType());
op.WriteLine("Redundant compile for packet {0}, use Acquire() and Release()", GetType());
op.WriteLine(new System.Diagnostics.StackTrace());
}
}

View file

@ -58,7 +58,7 @@ namespace Server.Network {
}
public int Write( byte[] buffer, int offset, int length ) {
int write = Math.Min( length, this.Available );
int write = Math.Min( length, Available );
System.Buffer.BlockCopy( buffer, offset, _buffer, _length, write );

View file

@ -28,7 +28,7 @@ namespace Server {
public BinaryMemoryWriter()
: base( new MemoryStream( 512 ), true ) {
this.stream = this.UnderlyingStream as MemoryStream;
stream = UnderlyingStream as MemoryStream;
}
private static byte[] indexBuffer;

View file

@ -29,7 +29,7 @@ namespace Server {
public override void Save( SaveMetrics metrics, bool permitBackgroundWrite )
{
this.PermitBackgroundWrite = permitBackgroundWrite;
PermitBackgroundWrite = permitBackgroundWrite;
Thread saveThread = new Thread( delegate() {
SaveItems(metrics);

View file

@ -53,7 +53,7 @@ namespace Server
public override void Save(SaveMetrics metrics, bool permitBackgroundWrite)
{
this._metrics = metrics;
_metrics = metrics;
OpenFiles();

View file

@ -51,7 +51,7 @@ namespace Server {
}
public void Commit() {
owner.Commit( this, this.slot );
owner.Commit( this, slot );
}
}
@ -93,14 +93,14 @@ namespace Server {
throw new ArgumentNullException( "callback" );
}
this.syncRoot = new object();
syncRoot = new object();
this.active = new Chunk[concurrentWrites];
this.pending = new Queue<Page>();
active = new Chunk[concurrentWrites];
pending = new Queue<Page>();
this.callback = callback;
this.idle = new ManualResetEvent( true );
idle = new ManualResetEvent( true );
}
private void Append( Page page ) {

View file

@ -282,13 +282,13 @@ namespace Server {
public Consumer( ParallelSaveStrategy owner, int bufferSize ) {
this.owner = owner;
this.buffer = new ConsumableEntry[bufferSize];
buffer = new ConsumableEntry[bufferSize];
for ( int i = 0; i < this.buffer.Length; ++i ) {
this.buffer[i].writer = new BinaryMemoryWriter();
for ( int i = 0; i < buffer.Length; ++i ) {
buffer[i].writer = new BinaryMemoryWriter();
}
this.completionEvent = new ManualResetEvent( false );
completionEvent = new ManualResetEvent( false );
thread = new Thread( Processor );

View file

@ -40,7 +40,7 @@ namespace Server
public QueuedMemoryWriter()
: base(new MemoryStream(1024 * 1024), true)
{
this._memStream = this.UnderlyingStream as MemoryStream;
_memStream = UnderlyingStream as MemoryStream;
}
public void QueueForIndex(ISerializable serializable, int size)
@ -57,7 +57,7 @@ namespace Server
public void CommitTo(SequentialFileWriter dataFile, SequentialFileWriter indexFile)
{
this.Flush();
Flush();
int memLength = (int)_memStream.Position;
@ -115,7 +115,7 @@ namespace Server
}
}
this.Close(); //We're done with this writer.
Close(); //We're done with this writer.
}
}
}

View file

@ -37,7 +37,7 @@ namespace Server {
this.metrics = metrics;
this.fileStream = FileOperations.OpenSequentialStream( path, FileMode.Create, FileAccess.Write, FileShare.None );
fileStream = FileOperations.OpenSequentialStream( path, FileMode.Create, FileAccess.Write, FileShare.None );
fileQueue = new FileQueue(
Math.Max( 1, FileOperations.Concurrency ),
@ -61,7 +61,7 @@ namespace Server {
chunk.Commit();
} else {
if ( writeCallback == null ) {
writeCallback = this.OnWrite;
writeCallback = OnWrite;
}
fileStream.BeginWrite( chunk.Buffer, chunk.Offset, chunk.Size, writeCallback, chunk );
@ -109,7 +109,7 @@ namespace Server {
public override bool CanWrite => true;
public override long Length => this.Position;
public override long Length => Position;
public override int Read( byte[] buffer, int offset, int count ) {
throw new InvalidOperationException();

View file

@ -45,7 +45,7 @@ namespace Server {
set => _permitBackgroundWrite = value;
}
protected bool UseSequentialWriters => (StandardSaveStrategy.SaveType == SaveOption.Normal || !_permitBackgroundWrite);
protected bool UseSequentialWriters => (SaveType == SaveOption.Normal || !_permitBackgroundWrite);
public override void Save(SaveMetrics metrics, bool permitBackgroundWrite)
{

View file

@ -35,7 +35,7 @@ namespace Server
public override string ToString()
{
return this.Name;
return Name;
}

View file

@ -216,7 +216,7 @@ namespace Server
m_Parent = parent;
m_Area = area;
m_Dynamic = true;
m_Music = this.DefaultMusic;
m_Music = DefaultMusic;
if ( m_Parent == null )
{
@ -503,7 +503,7 @@ namespace Server
throw new ArgumentException( "obj is not a Region", nameof(obj) );
// Dynamic regions go first
if ( this.Dynamic )
if ( Dynamic )
{
if ( !reg.Dynamic )
return -1;
@ -513,13 +513,13 @@ namespace Server
return 1;
}
int thisPriority = this.Priority;
int thisPriority = Priority;
int regPriority = reg.Priority;
if ( thisPriority != regPriority )
return ( regPriority - thisPriority );
return ( reg.ChildLevel - this.ChildLevel );
return ( reg.ChildLevel - ChildLevel );
}
public override string ToString()
@ -988,7 +988,7 @@ namespace Server
}
MusicName music = this.DefaultMusic;
MusicName music = DefaultMusic;
ReadEnum( xml["music"], "name", ref music, false );

View file

@ -81,7 +81,7 @@ namespace Server
public int CompareTo( object other )
{
if ( other is Serial serial )
return this.CompareTo( serial );
return CompareTo( serial );
if ( other == null )
return -1;

View file

@ -1440,7 +1440,7 @@ namespace Server
public void Worker()
{
AsyncWriter.m_ThreadCount++;
m_ThreadCount++;
int lastCount = 0;
@ -1459,9 +1459,9 @@ namespace Server
if ( m_Owner.m_Closed )
m_Owner.m_File.Close();
AsyncWriter.m_ThreadCount--;
m_ThreadCount--;
if (AsyncWriter.m_ThreadCount <= 0)
if (m_ThreadCount <= 0)
World.NotifyDiskWriteComplete();
}
}

View file

@ -306,7 +306,7 @@ namespace Server
get
{
//There has to be this distinction between the racial values and not to account for gaining skills and these skills aren't displayed nor Totaled up.
double value = this.NonRacialValue;
double value = NonRacialValue;
double raceBonus = m_Owner.Owner.RacialSkillBonus;

View file

@ -455,7 +455,7 @@ namespace Server
}
}
int b = (byte)(Utility.GetAddressValue( ip ) >> (i * 8));
int b = (byte)(GetAddressValue( ip ) >> (i * 8));
if ( b < lowPart || b > highPart )
return false;
@ -466,7 +466,7 @@ namespace Server
public static bool IPMatchClassC( IPAddress ip1, IPAddress ip2 )
{
return ( (Utility.GetAddressValue( ip1 ) & 0xFFFFFF) == (Utility.GetAddressValue( ip2 ) & 0xFFFFFF) );
return ( (GetAddressValue( ip1 ) & 0xFFFFFF) == (GetAddressValue( ip2 ) & 0xFFFFFF) );
}
public static int InsensitiveCompare( string first, string second )
@ -987,10 +987,10 @@ namespace Server
/// </summary>
public static int RandomBrightHue()
{
if ( Utility.RandomDouble() < 0.1 )
return Utility.RandomList( 0x62, 0x71 );
if ( RandomDouble() < 0.1 )
return RandomList( 0x62, 0x71 );
return Utility.RandomList( 0x03, 0x0D, 0x13, 0x1C, 0x21, 0x30, 0x37, 0x3A, 0x44, 0x59 );
return RandomList( 0x03, 0x0D, 0x13, 0x1C, 0x21, 0x30, 0x37, 0x3A, 0x44, 0x59 );
}
//[Obsolete( "Depreciated, use the methods for the Mobile's race", false )]
@ -1112,17 +1112,17 @@ namespace Server
public static SkillName RandomSkill()
{
return m_AllSkills[Utility.Random(m_AllSkills.Length - ( Core.ML ? 0 : Core.SE ? 1 : Core.AOS ? 3 : 6 ) )];
return m_AllSkills[Random(m_AllSkills.Length - ( Core.ML ? 0 : Core.SE ? 1 : Core.AOS ? 3 : 6 ) )];
}
public static SkillName RandomCombatSkill()
{
return m_CombatSkills[Utility.Random(m_CombatSkills.Length)];
return m_CombatSkills[Random(m_CombatSkills.Length)];
}
public static SkillName RandomCraftSkill()
{
return m_CraftSkills[Utility.Random(m_CraftSkills.Length)];
return m_CraftSkills[Random(m_CraftSkills.Length)];
}
public static void FixPoints( ref Point3D top, ref Point3D bottom )

View file

@ -668,7 +668,7 @@ namespace Server {
NetState.FlushAll();
NetState.Pause();
World.WaitForWriteCompletion();//Blocks Save until current disk flush is done.
WaitForWriteCompletion();//Blocks Save until current disk flush is done.
m_Saving = true;
@ -707,7 +707,7 @@ namespace Server {
m_Saving = false;
if (!permitBackgroundWrite)
World.NotifyDiskWriteComplete(); //Sets the DiskWriteHandle. If we allow background writes, we leave this upto the individual save strategies.
NotifyDiskWriteComplete(); //Sets the DiskWriteHandle. If we allow background writes, we leave this upto the individual save strategies.
ProcessSafetyQueues();