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

@ -2,103 +2,103 @@ using System;
namespace Server.Items
{
public class StarRoomGate : Moongate
{
private bool m_Decays;
private DateTime m_DecayTime;
private Timer m_Timer;
public class StarRoomGate : Moongate
{
private bool m_Decays;
private DateTime m_DecayTime;
private Timer m_Timer;
public override int LabelNumber => 1049498; // dark moongate
[Constructible]
public StarRoomGate() : this(false)
{
}
[Constructible]
public StarRoomGate() : this( false )
{
}
[Constructible]
public StarRoomGate(bool decays, Point3D loc, Map map) : this(decays)
{
MoveToWorld(loc, map);
Effects.PlaySound(loc, map, 0x20E);
}
[Constructible]
public StarRoomGate( bool decays, Point3D loc, Map map ) : this( decays )
{
MoveToWorld( loc, map );
Effects.PlaySound( loc, map, 0x20E );
}
[Constructible]
public StarRoomGate(bool decays) : base(new Point3D(5143, 1774, 0), Map.Felucca)
{
Dispellable = false;
ItemID = 0x1FD4;
[Constructible]
public StarRoomGate( bool decays ) : base( new Point3D( 5143, 1774, 0 ), Map.Felucca )
{
Dispellable = false;
ItemID = 0x1FD4;
if (decays)
{
m_Decays = true;
m_DecayTime = DateTime.UtcNow + TimeSpan.FromMinutes(2.0);
if ( decays )
{
m_Decays = true;
m_DecayTime = DateTime.UtcNow + TimeSpan.FromMinutes( 2.0 );
m_Timer = new InternalTimer(this, m_DecayTime);
m_Timer.Start();
}
}
m_Timer = new InternalTimer( this, m_DecayTime );
m_Timer.Start();
}
}
public StarRoomGate(Serial serial) : base(serial)
{
}
public StarRoomGate( Serial serial ) : base( serial )
{
}
public override int LabelNumber => 1049498; // dark moongate
public override void OnAfterDelete()
{
m_Timer?.Stop();
public override void OnAfterDelete()
{
m_Timer?.Stop();
base.OnAfterDelete();
}
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_Decays );
writer.Write(m_Decays);
if ( m_Decays )
writer.WriteDeltaTime( m_DecayTime );
}
if (m_Decays)
writer.WriteDeltaTime(m_DecayTime);
}
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_Decays = reader.ReadBool();
switch (version)
{
case 0:
{
m_Decays = reader.ReadBool();
if ( m_Decays )
{
m_DecayTime = reader.ReadDeltaTime();
if (m_Decays)
{
m_DecayTime = reader.ReadDeltaTime();
m_Timer = new InternalTimer( this, m_DecayTime );
m_Timer.Start();
}
m_Timer = new InternalTimer(this, m_DecayTime);
m_Timer.Start();
}
break;
}
}
}
break;
}
}
}
private class InternalTimer : Timer
{
private Item m_Item;
private class InternalTimer : Timer
{
private Item m_Item;
public InternalTimer( Item item, DateTime end ) : base( end - DateTime.UtcNow )
{
m_Item = item;
}
public InternalTimer(Item item, DateTime end) : base(end - DateTime.UtcNow)
{
m_Item = item;
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
}
protected override void OnTick()
{
m_Item.Delete();
}
}
}
}