Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -4,139 +4,139 @@ using Server.Items;
namespace Server.Multis
{
public class PreviewHouse : BaseMulti
{
private List<Item> m_Components;
private Timer m_Timer;
public class PreviewHouse : BaseMulti
{
private List<Item> m_Components;
private Timer m_Timer;
public PreviewHouse( int multiID ) : base( multiID )
{
m_Components = new List<Item>();
public PreviewHouse(int multiID) : base(multiID)
{
m_Components = new List<Item>();
MultiComponentList mcl = Components;
MultiComponentList mcl = Components;
for ( int i = 1; i < mcl.List.Length; ++i )
{
MultiTileEntry entry = mcl.List[i];
for (int i = 1; i < mcl.List.Length; ++i)
{
MultiTileEntry entry = mcl.List[i];
if ( entry.m_Flags == 0 )
{
Item item = new Static( (int)entry.m_ItemID );
if (entry.m_Flags == 0)
{
Item item = new Static((int)entry.m_ItemID);
item.MoveToWorld( new Point3D( X + entry.m_OffsetX, Y + entry.m_OffsetY, Z + entry.m_OffsetZ ), Map );
item.MoveToWorld(new Point3D(X + entry.m_OffsetX, Y + entry.m_OffsetY, Z + entry.m_OffsetZ), Map);
m_Components.Add( item );
}
}
m_Components.Add(item);
}
}
m_Timer = new DecayTimer( this );
m_Timer.Start();
}
m_Timer = new DecayTimer(this);
m_Timer.Start();
}
public override void OnLocationChange( Point3D oldLocation )
{
base.OnLocationChange( oldLocation );
public PreviewHouse(Serial serial) : base(serial)
{
}
if ( m_Components == null )
return;
public override void OnLocationChange(Point3D oldLocation)
{
base.OnLocationChange(oldLocation);
int xOffset = X - oldLocation.X;
int yOffset = Y - oldLocation.Y;
int zOffset = Z - oldLocation.Z;
if (m_Components == null)
return;
for ( int i = 0; i < m_Components.Count; ++i )
{
Item item = m_Components[i];
int xOffset = X - oldLocation.X;
int yOffset = Y - oldLocation.Y;
int zOffset = Z - oldLocation.Z;
item.MoveToWorld( new Point3D( item.X + xOffset, item.Y + yOffset, item.Z + zOffset ), Map );
}
}
for (int i = 0; i < m_Components.Count; ++i)
{
Item item = m_Components[i];
public override void OnMapChange()
{
base.OnMapChange();
item.MoveToWorld(new Point3D(item.X + xOffset, item.Y + yOffset, item.Z + zOffset), Map);
}
}
if ( m_Components == null )
return;
public override void OnMapChange()
{
base.OnMapChange();
for ( int i = 0; i < m_Components.Count; ++i )
{
Item item = m_Components[i];
if (m_Components == null)
return;
item.Map = Map;
}
}
for (int i = 0; i < m_Components.Count; ++i)
{
Item item = m_Components[i];
public override void OnDelete()
{
base.OnDelete();
item.Map = Map;
}
}
if ( m_Components == null )
return;
public override void OnDelete()
{
base.OnDelete();
for ( int i = 0; i < m_Components.Count; ++i )
{
Item item = m_Components[i];
if (m_Components == null)
return;
item.Delete();
}
}
for (int i = 0; i < m_Components.Count; ++i)
{
Item item = m_Components[i];
public override void OnAfterDelete()
{
m_Timer?.Stop();
item.Delete();
}
}
m_Timer = null;
public override void OnAfterDelete()
{
m_Timer?.Stop();
base.OnAfterDelete();
}
m_Timer = null;
public PreviewHouse( Serial serial ) : base( serial )
{
}
base.OnAfterDelete();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
writer.Write(0); // version
writer.Write( m_Components );
}
writer.Write(m_Components);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Components = reader.ReadStrongItemList();
switch (version)
{
case 0:
{
m_Components = reader.ReadStrongItemList();
break;
}
}
break;
}
}
Timer.DelayCall( TimeSpan.Zero, Delete );
}
Timer.DelayCall(TimeSpan.Zero, Delete);
}
private class DecayTimer : Timer
{
private Item m_Item;
private class DecayTimer : Timer
{
private Item m_Item;
public DecayTimer( Item item ) : base( TimeSpan.FromSeconds( 20.0 ) )
{
m_Item = item;
Priority = TimerPriority.OneSecond;
}
public DecayTimer(Item item) : base(TimeSpan.FromSeconds(20.0))
{
m_Item = item;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
}