Beispiel #1
0
		public static Corps Add( Character c, float X, float Y, float Z, ushort MapId )
		{
			Corps corps = new Corps( c.Guid );
			corps.X = X;
			corps.Y = Y;
			corps.Z = Z;
			corps.MapId = MapId;
			corps.Name = c.Name;
			corps.Model = c.Model;
			corps.Faction = c.Faction;
			corps.Bytes3 = (uint)( ( (uint)c.FacialHair << 24 )| ( (uint)c.Face ) | ((uint)c.HairStyle << 8) | ((uint)c.HairColour << 16 )  );
			corps.Bytes2 = (((uint)c.Skin )<<24) /*+ (((uint)c.Gender )<<16)*/ +  ( ( (uint)c.Race << 8 ) );
			World.allMobiles.Add( corps, false );	
			float nearest = float.MaxValue;
			BaseSpawner nearSpawner = null;
			foreach( BaseSpawner bs in World.allSpawners )
				if ( bs.Distance( corps ) < nearest )
				{
					nearest = bs.Distance( corps );
					nearSpawner = bs;
				}
			if ( nearSpawner != null )
			{
				nearSpawner.Bind( corps );			
				corps.SpawnerLink = nearSpawner;
			}
			return corps;
		}
Beispiel #2
0
		public static Mobile Load( GenericReader gr )
		{
			Mobile m = null;
			int id = gr.ReadInt();
			//string cl = gr.ReadString();
			if ( id == 0x7ffffffe )//cl == "Corps" )
				m = new Corps();
			else
				if ( id == 0x7fffffff )//	character
				m = (Mobile)new Character();
			else
			{
				if ( id > 99000000 )
				{
					ConstructorInfo ct = (ConstructorInfo)World.MobilePool( 99999999 );//Utility.FindConstructor( cl, Utility.externAsm );
					m = (Mobile)ct.Invoke( null );
					
				}
				else
					if ( id < 0 )
				{
					ConstructorInfo ct = (ConstructorInfo)World.MobilePool( 999999 );//Utility.FindConstructor( cl, Utility.externAsm );
					m = (Mobile)ct.Invoke( null );
				}
				else
				{
					ConstructorInfo ct = (ConstructorInfo)World.MobilePool( id );//Utility.FindConstructor( cl, Utility.externAsm );
					//if ( ct == null )
					//	ct = Utility.FindConstructor( cl );
					m = (Mobile)ct.Invoke( null );
				}
			}
			m.Deserialize( gr );
			

			/*
						if ( m.Dead && !( m is Character ) )
						{
							m.decay = new DecayTimer( m, 10 * 1000 );
						}			*/
			return m;
		}