context: using System;
  
  
  #region Moonglow Gate
  
  namespace Server.Items
  {
      public class MoonglowGate : Moongate
      {
          private bool m_Decays;
          private DateTime m_DecayTime;
          private Timer m_Timer;
  
          [Constructable]
          public MoonglowGate() : this(true)
          {
          }
  
          [Constructable]
          public MoonglowGate(bool decays, Point3D loc, Map map) : this(decays)
          {
              MoveToWorld(loc, map);
              Effects.PlaySound(loc, map, 0x20E);
          }
  
          [Constructable]
          public MoonglowGate(bool decays) : base(new Point3D(4467, 1283, 5), Map.Trammel)
          {
              Dispellable = false;
              ItemID = 0x1FD4;
              Name = "Gate To Moonglow";
              Hue = 0x26;  //It's Red.
  
              if (decays)
              {
                  m_Decays = true;
                  m_DecayTime = DateTime.UtcNow + TimeSpan.FromSeconds(30);
  
                  m_Timer = new InternalTimer(this, m_DecayTime);
                  m_Timer.Start();
              }
          }
  
          public MoonglowGate(Serial serial) : base(serial)
          {
          }
  
          public override void OnAfterDelete()
          {
              if (m_Timer != null)
              {
                  m_Timer.Stop();
              }
  
              base.OnAfterDelete();
          }
  
          public override void Serialize(GenericWriter writer)
          {
              base.Serialize(writer);
  
              writer.Write((int)0);
  
              writer.Write(m_Decays);
  
              if (m_Decays)
                  writer.WriteDeltaTime(m_DecayTime);
          }
  
          public override void Deserialize(GenericReader reader)
          {
              base.Deserialize(reader);
  
              int version = reader.ReadInt();
  
              switch (version)
              {
                  case 0:
                      {
                          m_Decays = reader.ReadBool();
  
                          if (m_Decays)
                          {
                              m_DecayTime = reader.ReadDeltaTime();
  
                              m_Timer = new InternalTimer(this, m_DecayTime);
                              m_Timer.Start();
                          }
  
                          break;
                      }
              }
          }
  
          private class InternalTimer : Timer
          {
              private Item m_Item;
  
              public InternalTimer(Item item, DateTime end) : base(end - DateTime.UtcNow)
              {
                  m_Item = item;
              }
  
              protected override void OnTick()
              {
                  m_Item.Delete();
              }
          }
      }
  }
  
  #endregion
  
  #region Britain Gate
  
  namespace Server.Items
  {
      public class BritainGate : Moongate
      {
          private bool m_Decays;
          private DateTime m_DecayTime;
          private Timer m_Timer;
  
          [Constructable]
          public BritainGate() : this(true)
          {
          }
  
          [Constructable]
          public BritainGate(bool decays, Point3D loc, Map map) : this(decays)
          {
              MoveToWorld(loc, map);
              Effects.PlaySound(loc, map, 0x20E);
          }
  
          [Constructable]
          public BritainGate(bool decays) : base(new Point3D(1336, 1997, 5), Map.Trammel)
          {
              Dispellable = false;
              ItemID = 0x1FD4;
              Name = "Gate To Britain";
              Hue = 0x26;  //It's Red.
  
              if (decays)
              {
                  m_Decays = true;
                  m_DecayTime = DateTime.UtcNow + TimeSpan.FromSeconds(30);
  
                  m_Timer = new InternalTimer(this, m_DecayTime);
                  m_Timer.Start();
              }
          }
  
          public BritainGate(Serial serial) : base(serial)
          {
          }
  
          public override void OnAfterDelete()
          {
              if (m_Timer != null)
              {
                  m_Timer.Stop();
              }
  
              base.OnAfterDelete();
          }
  
          public override void Serialize(GenericWriter writer)
          {
              base.Serialize(writer);
  
              writer.Write((int)0);
  
              writer.Write(m_Decays);
  
              if (m_Decays)
              {
                  writer.WriteDeltaTime(m_DecayTime);
              }
          }
  
          public override void Deserialize(GenericReader reader)
          {
              base.Deserialize(reader);
  
              int version = reader.ReadInt();
  
              switch (version)
              {
                  case 0:
                      {
                          m_Decays = reader.ReadBool();
  
                          if (m_Decays)
                          {
                              m_DecayTime = reader.ReadDeltaTime();
  
                              m_Timer = new InternalTimer(this, m_DecayTime);
                              m_Timer.Start();
                          }
  
                          break;
                      }
              }
          }
  
          private class InternalTimer : Timer
          {
              private Item m_Item;
  
              public InternalTimer(Item item, DateTime end) : base(end - DateTime.UtcNow)
              {
                  m_Item = item;
              }
  
              protected override void OnTick()
              {
                  m_Item.Delete();
              }
          }
      }
  }
  
  #endregion
  
  #region Jhelom Gate
  
  namespace Server.Items
  {
      public class JhelomGate : Moongate
      {
          private bool m_Decays;
          private DateTime m_DecayTime;
          private Timer m_Timer;
  
          [Constructable]
          public JhelomGate() : this(true)
          {
          }
  
          [Constructable]
          public JhelomGate(bool decays, Point3D loc, Map map) : this(decays)
          {
              MoveToWorld(loc, map);
              Effects.PlaySound(loc, map, 0x20E);
          }
  
          [Constructable]
          public JhelomGate(bool decays) : base(new Point3D(1499, 3771, 5), Map.Trammel)
          {
              Dispellable = false;
              ItemID = 0x1FD4;
              Name = "Gate To Jhelom";
              Hue = 0x26;  //It's Red.
  
              if (decays)
              {
                  m_Decays = true;
  
gt:                 m_DecayTime = DateTime.UtcNow + TimeSpan.FromSeconds(30);