private static void CSSave() { IndexFile.Serialize(SaveIndex); Maps.Export(); Dungeons.Export(); Lockouts.Export(); RestoreFile.Serialize(SaveRestore); RestoreFile.SetHidden(true); }
static Instances() { _BounceRestore = new Dictionary <PlayerMobile, MapPoint>(0x100); _ItemRestore = new Dictionary <Item, IEntity>(0x1000); CSOptions = new InstanceMapsOptions(); IndexFile = IOUtility.EnsureFile(VitaNexCore.SavesDirectory + "/InstanceMaps/Maps.idx"); RestoreFile = IOUtility.EnsureFile(VitaNexCore.CacheDirectory + "/InstanceMaps/Restore.bin"); RestoreFile.SetHidden(true); Lockouts = new BinaryDataStore <PlayerMobile, LockoutState>(VitaNexCore.SavesDirectory + "/InstanceMaps", "Lockouts") { Async = true, OnSerialize = SerializeLockouts, OnDeserialize = DeserializeLockouts }; Maps = new BinaryDirectoryDataStore <InstanceMapSerial, InstanceMap>(VitaNexCore.SavesDirectory + "/InstanceMaps", "Maps", "bin") { Async = true, OnSerialize = SerializeMap, OnDeserialize = DeserializeMap }; Dungeons = new BinaryDirectoryDataStore <DungeonSerial, Dungeon>(VitaNexCore.SavesDirectory + "/InstanceMaps", "Dungeons", "bin") { Async = true, OnSerialize = SerializeDungeon, OnDeserialize = DeserializeDungeon }; DungeonTypes = typeof(Dungeon).GetConstructableChildren(); var instances = DungeonTypes .Select(t => t.CreateInstanceSafe <Dungeon>()) .Where(d => d != null && d.ID != DungeonID.None && d.GroupMax > 0) .Where(d => d.MapParent != null && !(d.MapParent is InstanceMap)) .ToList(); DungeonInfo = instances.Select(d => new DungeonInfo(d)).ToArray(); instances.ForEach(d => d.Delete()); instances.Free(true); DefragmentTimer = PollTimer.FromMinutes(10.0, Defragment, () => !_Defragmenting, false); }
public static void Restore() { RestoreFile.SetHidden(true); RestoreFile.Deserialize(LoadRestore); var bounce = new MapPoint(CSOptions.BounceMap, CSOptions.BounceLocation); if (bounce.InternalOrZero) { // Britain Peninsula (West of the Bank) bounce.Map = Map.Felucca; bounce.Location = new Point3D(1383, 1713, 20); } foreach (var kv in _BounceRestore) { var m = kv.Key; var p = kv.Value; if (m == null || m.Deleted) { continue; } if (p == null || p.InternalOrZero) { p = bounce; } m.FixMap(p); } _BounceRestore.Clear(); foreach (var kv in _ItemRestore) { var i = kv.Key; var p = kv.Value; if (i == null || i.Deleted || i.Map != null || p == null || p.Deleted) { continue; } #if NEWPARENT var cp = i.Parent; #else var cp = i.ParentEntity; #endif if (cp == p) { continue; } if (p is Item) { ((Item)p).AddItem(i); } else if (p is Mobile) { ((Mobile)p).AddItem(i); } else { i.Parent = p; } } _ItemRestore.Clear(); }