Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public static GrabOptions GetOptions(Mobile m)
        {
            if (!OptionsTable.ContainsKey(m) || OptionsTable[m] == null)
            {
                OptionsTable[m] = new GrabOptions(m);
            }

            return(OptionsTable[m]);
        }
Esempio n. 4
0
 public static void SaveOptions(Mobile m, GrabOptions options)
 {
     OptionsTable[m] = options;
 }
Esempio n. 5
0
		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();
			}
		}
Esempio n. 6
0
		public static void SaveOptions( Mobile m, GrabOptions options )
		{
			OptionsTable[m] = options;
		} 
Esempio n. 7
0
		public static GrabOptions GetOptions( Mobile m )
		{
			if( !OptionsTable.ContainsKey( m ) || OptionsTable[m] == null )
				OptionsTable[m] = new GrabOptions( m );

			return OptionsTable[m];
		}