public void Reset()
 {
     ReloadValue = 0;
     Control     = new ControlRegister();
     CoreTimer.Reset();
 }
 protected TimerState(CoreTimer coreTimer)
 {
     CoreTimer = coreTimer;
 }
Beispiel #3
0
        public void Delete()
        {
            if (Deleted || _Deleting)
            {
                return;
            }

            _Deleting = true;

            OnBeforeDelete();

            KickAll();

            EventSink.Shutdown -= InternalServerShutdown;
            EventSink.Logout   -= InternalLogout;
            EventSink.Login    -= InternalLogin;

            if (CoreTimer != null)
            {
                CoreTimer.Dispose();
                CoreTimer = null;
            }

            Instances.Dungeons.Remove(Serial);

            OnDelete();

            if (ExitPortal1 != null)
            {
                ExitPortal1.Delete();
                ExitPortal1 = null;
            }

            if (ExitPortal2 != null)
            {
                ExitPortal2.Delete();
                ExitPortal2 = null;
            }

            if (Loot != null)
            {
                Loot.ForEach(l => l.Free());
                Loot.Free(true);
            }

            if (Zones != null)
            {
                Zones.ForEachReverse(
                    z =>
                {
                    if (z != null)
                    {
                        z.Dungeon = null;
                        z.Delete();
                    }
                });
                Zones.Free(true);
            }

            if (MobileSpawns != null)
            {
                MobileSpawns.Where(m => m != null && !m.Deleted && !m.Player && m.Map == Map).ForEach(m => m.Delete());
                MobileSpawns.Free(true);
            }

            if (ItemSpawns != null)
            {
                ItemSpawns.Where(m => m != null && !m.Deleted && m.Map == Map && m.Parent == null).ForEach(i => i.Delete());
                ItemSpawns.Free(true);
            }

            if (Map != null)
            {
                if (Map.InstanceRegions.All(z => z == null || z.Deleted))
                {
                    Map.Delete();
                }

                Map = null;
            }

            if (Logs != null)
            {
                Logs.Values.Free(true);
                Logs.Clear();
            }

            if (ActiveGroup != null)
            {
                ActiveGroup.Free(true);
            }

            if (Group != null)
            {
                Group.Free(true);
            }

            if (SubCommands != null)
            {
                SubCommands.Clear();
            }

            if (Options != null)
            {
                Options.Clear();
            }

            Deleted = true;

            OnAfterDelete();

            _Deleting = false;

            /*
             * Loot = null;
             * Zones = null;
             * MobileSpawns = null;
             * ItemSpawns = null;
             * Map = null;
             * Logs = null;
             * ActiveGroup = null;
             * Group = null;
             * SubCommands = null;
             * Options = null;
             */
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PeriodicBackgroundWorkerBase"/> class.
 /// </summary>
 /// <param name="timer">A timer.</param>
 protected PeriodicBackgroundWorkerBase(CoreTimer timer)
 {
     Timer          = timer;
     Timer.Elapsed += Timer_Elapsed;
 }