Ejemplo n.º 1
0
        private static void EventSink_WorldSave(WorldSaveEventArgs e)
        {
            List <BaseCollectionMobile> newMobiles = new List <BaseCollectionMobile>();

            for (var index = 0; index < m_Mobiles.Count; index++)
            {
                BaseCollectionMobile mob = m_Mobiles[index];

                if (!mob.Deleted)
                {
                    newMobiles.Add(mob);
                }
            }

            m_Mobiles = newMobiles;

            Persistence.Serialize(
                m_Path,
                writer =>
            {
                writer.WriteMobileList(m_Mobiles);
                writer.Write(m_Mobiles.Count);
                for (var index = 0; index < m_Mobiles.Count; index++)
                {
                    BaseCollectionMobile mob = m_Mobiles[index];
                    writer.Write((int)mob.CollectionID);
                    CollectionData data = mob.GetData();
                    data.Write(writer);
                    m_Collections[mob.CollectionID] = data;
                }
            });
        }
Ejemplo n.º 2
0
 public static void UnregisterMobile(BaseCollectionMobile mob)
 {
     m_Collections[mob.CollectionID] = mob.GetData();
     m_Mobiles.Remove(mob);
 }