Example #1
0
 public void AddShadowguardCanal(Item canal)
 {
     if (ShadowguardCanals != null && !ShadowguardCanals.Contains(canal))
     {
         ShadowguardCanals.Add(canal);
     }
 }
Example #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            Elementals = new List <BaseCreature>();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                BaseCreature bc = reader.ReadMobile() as BaseCreature;

                if (bc != null)
                {
                    Elementals.Add(bc);
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                if (ShadowguardCanals == null)
                {
                    ShadowguardCanals = new List <Item>();
                }

                Item canal = reader.ReadItem();

                if (canal != null)
                {
                    ShadowguardCanals.Add(canal);
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                if (FlowCheckers == null)
                {
                    FlowCheckers = new List <FlowChecker>();
                }

                FlowCheckers.Add(new FlowChecker(reader, this));
            }

            if (Elementals == null || Elementals.Count < 8)
            {
                int toSpawn = Elementals == null ? 8 : 8 - Elementals.Count;

                for (int i = 0; i < toSpawn; i++)
                {
                    SpawnRandomElemental();
                }
            }
        }
Example #3
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write(0);

            writer.Write(Elementals == null ? 0 : Elementals.Count);
            if (Elementals != null)
            {
                Elementals.ForEach(e => writer.Write(e));
            }

            writer.Write(ShadowguardCanals == null ? 0 : ShadowguardCanals.Count);
            if (ShadowguardCanals != null)
            {
                ShadowguardCanals.ForEach(c => writer.Write(c));
            }

            writer.Write(FlowCheckers == null ? 0 : FlowCheckers.Count);
            if (FlowCheckers != null)
            {
                FlowCheckers.ForEach(f => f.Serialize(writer));
            }
        }
Example #4
0
        public override void ClearItems()
        {
            if (ShadowguardCanals != null)
            {
                List <Item> list = new List <Item>(ShadowguardCanals.Where(i => i != null && !i.Deleted));

                foreach (var canal in list)
                {
                    canal.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(ShadowguardCanals);
                ShadowguardCanals = null;
            }

            if (Elementals != null)
            {
                List <BaseCreature> list = new List <BaseCreature>(Elementals.Where(t => t != null && !t.Deleted));

                foreach (var elemental in list)
                {
                    elemental.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(Elementals);
                Elementals = null;
            }

            if (FlowCheckers != null)
            {
                ColUtility.ForEach(FlowCheckers.Where(f => f != null), f => f.EndEncounter());
            }
        }