Exemplo n.º 1
0
        public void Defragment()
        {
            if (Mobiles != null && Mobiles.Count > 0)
            {
                Mobiles.RemoveAll(o => o == null || o.Deleted || o.Map != this);
            }

            if (Items != null && Items.Count > 0)
            {
                Items.RemoveAll(o => o == null || o.Deleted || o.Map != this);
            }

            if (InstanceRegions != null && InstanceRegions.Count > 0)
            {
                InstanceRegions.RemoveAll(o => o == null || o.Deleted || o.Map != this);
            }

            if (BounceInfo != null && BounceInfo.Count > 0)
            {
                BounceInfo.RemoveKeyRange(m => m == null || m.Deleted || (m.Map != null && m.Map != Internal && m.Map != this));
                BounceInfo.RemoveValueRange(p => p == null || p.InternalOrZero);
            }
        }
Exemplo n.º 2
0
        private void Wipe()
        {
            EjectMobiles();

            if (Mobiles != null && Mobiles.Count != 0)
            {
                Mobiles.RemoveAll(o => o == null || o.Deleted || o.Map != this || o.Player);
                Mobiles.ForEachReverse(o => o.Delete());
            }

            if (Items != null && Items.Count != 0)
            {
                Items.RemoveAll(o => o == null || o.Deleted || o.Map != this || o.RootParent != null);
                Items.ForEachReverse(o => o.Delete());
            }

            if (InstanceRegions != null && InstanceRegions.Count != 0)
            {
                InstanceRegions.RemoveAll(o => o == null || o.Deleted || o.Map != this);
                InstanceRegions.ForEachReverse(o => o.Delete());
            }

            Defragment();
        }