示例#1
0
文件: Grab.cs 项目: zerodowned/Ulmeta
        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();
            }
        }
示例#2
0
文件: Grab.cs 项目: zerodowned/Ulmeta
        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);
        }
示例#3
0
文件: Grab.cs 项目: zerodowned/Ulmeta
        public static GrabOptions GetOptions(Mobile m)
        {
            if (!OptionsTable.ContainsKey(m) || OptionsTable[m] == null)
            {
                OptionsTable[m] = new GrabOptions(m);
            }

            return(OptionsTable[m]);
        }
示例#4
0
文件: Grab.cs 项目: zerodowned/Ulmeta
 public static void SaveOptions(Mobile m, GrabOptions options)
 {
     OptionsTable[m] = options;
 }
示例#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();
			}
		}
示例#6
0
		public static void SaveOptions( Mobile m, GrabOptions options )
		{
			OptionsTable[m] = options;
		} 
示例#7
0
		public static GrabOptions GetOptions( Mobile m )
		{
			if( !OptionsTable.ContainsKey( m ) || OptionsTable[m] == null )
				OptionsTable[m] = new GrabOptions( m );

			return OptionsTable[m];
		}