private static void event_worldLoad() { if (!File.Exists(PersistenceFile)) { return; } using (FileStream stream = new FileStream(PersistenceFile, FileMode.Open, FileAccess.Read, FileShare.Read)) { BinaryFileReader reader = new BinaryFileReader(new BinaryReader(stream)); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { int serial = reader.ReadInt(); if (serial > -1) { Mobile m = World.FindMobile(serial); GrabOptions options = new GrabOptions(reader); if (m != null && !m.Deleted) { if (options != null && !OptionsTable.ContainsKey(m)) { OptionsTable.Add(m, options); } } } } reader.Close(); } }
public static string GetContainerName(Mobile m, GrabFlag flag) { GrabOptions options = GetOptions(m); Container cont = options.GetPlacementContainer(flag); string res = "(not set)"; if (cont == null || !cont.IsChildOf(m.Backpack)) { res = "(not set)"; } else if (cont == m.Backpack) { res = "(main backpack)"; } else if (!String.IsNullOrEmpty(cont.Name)) { res = cont.Name; } else { res = cont.ItemData.Name; } return(res); }
public static GrabOptions GetOptions(Mobile m) { if (!OptionsTable.ContainsKey(m) || OptionsTable[m] == null) { OptionsTable[m] = new GrabOptions(m); } return(OptionsTable[m]); }
public static void SaveOptions(Mobile m, GrabOptions options) { OptionsTable[m] = options; }
private static void event_worldLoad() { if( !File.Exists( PersistenceFile ) ) return; using( FileStream stream = new FileStream( PersistenceFile, FileMode.Open, FileAccess.Read, FileShare.Read ) ) { BinaryFileReader reader = new BinaryFileReader( new BinaryReader( stream ) ); int count = reader.ReadInt(); for( int i = 0; i < count; i++ ) { int serial = reader.ReadInt(); if( serial > -1 ) { Mobile m = World.FindMobile( serial ); GrabOptions options = new GrabOptions( reader ); if( m != null && !m.Deleted ) { if( options != null && !OptionsTable.ContainsKey( m ) ) OptionsTable.Add( m, options ); } } } reader.Close(); } }
public static void SaveOptions( Mobile m, GrabOptions options ) { OptionsTable[m] = options; }
public static GrabOptions GetOptions( Mobile m ) { if( !OptionsTable.ContainsKey( m ) || OptionsTable[m] == null ) OptionsTable[m] = new GrabOptions( m ); return OptionsTable[m]; }