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; } }); }
public static void UnregisterMobile(BaseCollectionMobile mob) { m_Collections[mob.CollectionID] = mob.GetData(); m_Mobiles.Remove(mob); }