Пример #1
0
 /// <summary>
 /// Clears all higher and lower object pools.
 /// Field will be ready for disposal and can not be used after this is called.
 /// </summary>
 public void Dispose()
 {
     Users.Dispose();
     Npcs.Dispose();
     Footholds.Dispose();
     Portals.Dispose();
     Mobs.Dispose();
     Reactors.Dispose();
     Drops.Dispose();
     AffectedAreas.Dispose();
     MiniRooms.Dispose();
     Kites.Dispose();
     TownPortals.Dispose();
     OpenGates1.Dispose();
     OpenGates2.Dispose();
     CurrentWeather.Dispose();
 }
Пример #2
0
        //--------------------------------------------------

        /// <summary>
        /// Updates all field objects.
        /// </summary>
        public virtual void Update()
        {
            Mobs.Update();

            Reactors.RedistributeLife();

            Drops.Update();

            if (tFieldTimerExpiration != DateTime.MinValue && tFieldTimerExpiration.SecondsUntilEnd() <= 0)
            {
                OnClockEnd();
            }

            foreach (var user in Users)
            {
                user.Update(this);
            }

            // less taxing to check item id cuz it gets reset when the effect is over
            if (CurrentWeather.nItemID > 0 && CurrentWeather.StartTime.AddedSecondsExpired(CurrentWeather.Duration))
            {
                CurrentWeather.Clear();
            }

            MiniRooms.Update();
            Kites.Update();
            TownPortals.Update();
            OpenGates1.Update();
            OpenGates2.Update();
            AffectedAreas.Update();
            Summons.Update();

            if (Template.DecHP > 0 || Template.DecMP > 0)
            {
                // TODO
                // CUserLocal::OnNotifyHPDecByField(this, iPacket);
            }
        }
Пример #3
0
        /// <summary>
        /// Clears all lower object pools and resets all higher object pools.
        /// Map can still be used after this is called.
        /// DO NOT CALL DISPOSE FROM INSIDE THIS FUNCTION
        /// </summary>
        protected virtual void Reset(bool bFromDispose = false)
        {
            if (Users.Count > 0)             // not good
            {
                throw new InvalidOperationException("Trying to reset map that still has users in it.");
            }

            QR = "";
            nFieldDeathCount      = -1;
            tFieldTimerExpiration = DateTime.MinValue;

            Mobs.Reset();
            Reactors.Reset();

            Drops.Clear();
            AffectedAreas.Clear();
            MiniRooms.Clear();
            Kites.Clear();
            TownPortals.Clear();
            OpenGates1.Clear();
            OpenGates2.Clear();
            CurrentWeather.Clear();
        }