Exemple #1
0
 public void FillZValues( Hashtable hy, float [,]zoneZ, MobileSpawner mob )
 {
     float x = mob.X;
     float y = mob.Y;
     int coordy = (int)( y / ( UNITSIZE * 0.5f ) );
     if ( (int)( coordy & 2 ) == 1 )
         x -= ( UNITSIZE * 0.5f );
     int coordx = (int)( x / UNITSIZE );
     if ( hy == null )
     {
         Console.WriteLine("hy map == null for {0}/{1}", mob.MapId, mob.ZoneId );
         return;
     }
     int oy = 0;
     for(int t = -32;t < 32;t++, oy++ )
         for(int i = -32, ox = 0;i < 32;i++, ox++ )
         {
             uint cx = (uint)( coordx + t ) + 0x8000;
             uint cy = (uint)( coordy + i ) + 0x8000;
             object o = hy[ ( (uint)cx << 16 ) + (uint)cy ];
             if ( o != null )
                 zoneZ[ oy, ox ]= (float)o;
             else
                 zoneZ[ oy, ox ] = -200000;
         }
 }
Exemple #2
0
        public void FillZValues(Hashtable hy, float [,] zoneZ, MobileSpawner mob)
        {
            float x      = mob.X;
            float y      = mob.Y;
            int   coordy = (int)(y / (UNITSIZE * 0.5f));

            if ((int)(coordy & 2) == 1)
            {
                x -= (UNITSIZE * 0.5f);
            }
            int coordx = (int)(x / UNITSIZE);

            if (hy == null)
            {
                Console.WriteLine("hy map == null for {0}/{1}", mob.MapId, mob.ZoneId);
                return;
            }
            int oy = 0;

            for (int t = -32; t < 32; t++, oy++)
            {
                for (int i = -32, ox = 0; i < 32; i++, ox++)
                {
                    uint   cx = (uint)(coordx + t) + 0x8000;
                    uint   cy = (uint)(coordy + i) + 0x8000;
                    object o  = hy[((uint)cx << 16) + (uint)cy];
                    if (o != null)
                    {
                        zoneZ[oy, ox] = (float)o;
                    }
                    else
                    {
                        zoneZ[oy, ox] = -200000;
                    }
                }
            }
        }
Exemple #3
0
		void OnCommand( string cmd )
		{
			if ( Player.AccessLevel == AccessLevels.PlayerLevel )
			{
				string lower = cmd.ToLower();
				if ( lower.StartsWith( ".help" ) )
				{
					SendMessage( "Command lists" );
					SendMessage( ".whois" );
					SendMessage( ".mount" );
					SendMessage( ".unmount" );
				}
				else
					if ( lower.StartsWith( ".whois" ) )
				{					
					foreach( Account a in World.allConnectedAccounts )
					{
						if ( a.SelectedChar != null )
							SendMessage( a.SelectedChar.Name + " is online at ( " + a.SelectedChar.X.ToString() + "; " + a.SelectedChar.Y.ToString() + "; "+ a.SelectedChar.Z.ToString() + ") " );
					}
					SendMessage( "User online : " + World.allConnectedAccounts.Count.ToString() );
				}
				else
					if ( lower.StartsWith( ".mount" ) )
				{
					if ( selection != null && selection is Mobile )
					{
						if ( World.MountsList[ ( selection as Mobile ).Id ] != null )
							Mount( selection as Mobile );
					}
				}
				else
					if ( lower.StartsWith( ".unmount" ) )
				{
					if ( this.MountModel != 0 )
						UnMount();
				}				
			}
			else			
			if ( Player.AccessLevel == AccessLevels.Admin )
			{
				string lower = cmd.ToLower();
				if ( lower.StartsWith( ".importspawner" ) )
				{
					ImportSpawner();
				}
				else
					if ( lower.StartsWith( ".exportspawner" ) )
				{
					ExportSpawner();
				}
				else
					if ( lower.StartsWith( ".import" ) )
				{
					ImportWad();
				}
				else
					if ( lower.StartsWith( ".help" ) )
				{
					SendMessage( "Command lists" );
					SendMessage( ".help" );
					SendMessage( ".Addnpc [MobName|MobId] [amount] [faction]" );
					SendMessage( ".AddItem ItemName [amount]" );
					SendMessage( ".Addgo GameObjectNumber" );
					SendMessage( ".AddSpawner [MobName|MobId] amount frequency" );
					SendMessage( ".AddGoSpawner GameObjectId frequency [classname]" );
					SendMessage( ".kill" );
					SendMessage( ".nuke" );
					SendMessage( ".info" );
					SendMessage( ".where" );
					SendMessage( ".remove" );
					SendMessage( ".set xp Amount" );
					SendMessage( ".set faction FactionNumber" );
					SendMessage( ".set godmode [on/off]" );
					SendMessage( ".set turbo [on/off]" );
					SendMessage( ".password NewPassword" );
					SendMessage( ".grant [account|selected char] AccessLevel" );
					SendMessage( ".go LocationName | [ X Y Z MapId ]" );
					SendMessage( ".addlocation LocationName" );
					SendMessage( ".restart XMinutes" );
					SendMessage( ".whois" );
					SendMessage( ".broadcast Message" );
					SendMessage( ".hide" );
					SendMessage( ".unhide" );
					SendMessage( ".docgen" );
					SendMessage( ".removego" );
					SendMessage( ".armagedon" );
					SendMessage( ".mount" );
					SendMessage( ".unmount" );
				}
				else
					if ( lower.StartsWith( ".mount" ) )
				{
					if ( selection != null && selection is Mobile )
					{
						if ( World.MountsList[ ( selection as Mobile ).Id ] != null )
							Mount( selection as Mobile );

					}
				}
				else
					if ( lower.StartsWith( ".test" ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( tt.Length != 3 )
					{
						SendMessage( "Usage : .test MobName1 MobName2" );
						return;
					}
					if ( testCombatStarted )
					{
						SendMessage( "A fight test is not finished yet !!" );
						return;
					}
					//tt[ 1 ] = "SilverwingWarrior";
					//tt[ 2 ] = "RazorHillGrunt";
					ConstructorInfo ct1 = Utility.FindConstructor( tt[ 1 ] , Utility.externAsm[ "creatures" ] );
					ConstructorInfo ct2 = Utility.FindConstructor( tt[ 2 ] , Utility.externAsm[ "creatures" ] );
					
					testCombatStarted = true;
					
					for(int t = 0;t < 50;t++ )
					{
						BaseCreature bc = (BaseCreature)ct1.Invoke( null );	
						bc.Faction = Factions.Alliance;
						World.Add( bc, -13210f + (float)( Utility.Random( 50 ) - 25 ), 267.6f+ (float)( Utility.Random( 50 ) - 25 ), 22f, 0 );
						team1.Add( bc );
						bc = (BaseCreature)ct2.Invoke( null );	
						bc.Faction = Factions.Horde;
						World.Add( bc, -13210f + (float)( Utility.Random( 50 ) - 25 ), 287.6f+ (float)( Utility.Random( 50 ) - 25 ), 22f, 0 );
						team2.Add( bc );
					}
					MobBalance mb = new MobBalance( this );

					
				}
				else
					if ( lower.StartsWith( ".." ) )
				{
					string []ss = lower.Split( new char[] { ' ' } );
					ff = (uint)Convert.ToInt32( ss[ 1 ] );
					SendMessage("num = " + ff.ToString("X8" ));
					/*	if ( selection is Mobile )
							( selection as Mobile ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_DYNAMIC_FLAGS }, new object[] { ff } );
					*/
					SendSmallUpdate( new int[]{ (int)UpdateFields.UNIT_FIELD_FACTIONTEMPLATE }, new object[]{ ff } );				
				}
				else
					if ( lower.StartsWith( ".close" ) )
				{
					MainConsole.StopAllThread();
				}
				else
					if ( lower.StartsWith( ".mars" ) )
				{/*
					

					Hashtable hy = null;
					hy = World.mapZones.GetZoneHash( MapId, ZoneId, X, Y );//(Hashtable)World.mapZones.Azeroth[  MapId * 1024 + ZoneId ];
					for(float x = X - 16;x < X + 16;x+=MapZones.UNITSIZE )
					{
						for(float y = Y - 16;y < Y + 16;y++ )
						{
							int coordy = (int)( y / ( MapZones.UNITSIZE * 0.5f ) );
							int coordx = (int)( x / MapZones.UNITSIZE );
							bool decal = false;;
							if ( (int)( coordy & 1  ) == 1 )
							{
								decal = true;
								coordx -= (int)( MapZones.UNITSIZE * 0.5f );							
							}
							uint cx = (uint)( coordx + 0x8000 );
							uint cy = (uint)( coordy + 0x8000 );
							object o = hy[ (uint)( ( coordx << 16 ) + coordy ) ];
							if ( o != null )
							{
								float xx = (float)coordx * ( MapZones.UNITSIZE );
								float yy = (float)coordy * MapZones.UNITSIZE * 0.5f;
								if ( decal )
								{
									xx += MapZones.UNITSIZE * 0.5f;
								}
								GameObject go = World.Add( 621682, xx, yy, (float)o, MapId );
								World.allSpawners[ linkedSpawner ].Bind( go );								
							}
						}
					}
					account.RefreshMobileList( true );*/


					MapPoint mp = World.mapZones.NearestPoint( null, MapId, ZoneId, X, Y );
					SendMessage( "X=" + mp.x.ToString() + " Y=" + mp.y.ToString() );
					GameObject go = World.Add( 621682, mp.x , mp.y, mp.z, 0, MapId );
					World.allSpawners[ linkedSpawner ].Bind( go );	
					account.RefreshMobileList( true );
					//MainConsole.StopAllThread();
					//	Mobile.GetDirection( this, selection as Mobile );
					//		return;
					//	p.Kill();
					//for(float xxa = X - 10;xxa < 
					//string []ss = lower.Split( new char[] { ' ' } );
					//uint xff = (uint)Convert.ToUInt32( ss[ 1 ] );

					//	Items[ 24 ].SendSmallUpdate( new int[]{ (int)UpdateFields.ITEM_FIELD_FLAGS }, new object[]{ xff }, this );				
					
					/*
				Converter.ToBytes( cast.id, tempBuff, ref offset );
				Converter.ToBytes( (byte)1, tempBuff, ref offset );
				ToAllPlayerNear( OpCodes.SMSG_CAST_RESULT, tempBuff, offset );
				offset = 4;*/
					/*Converter.ToBytes( 6, tempBuff, ref offset );
					Converter.ToBytes( (byte)2, tempBuff, ref offset );
					Converter.ToBytes( (byte)xff, tempBuff, ref offset );
					Converter.ToBytes( msg, tempBuff, ref offset );
					ToAllPlayerNear( OpCodes.SMSG_CAST_RESULT, tempBuff, offset );*/
					cast.id = 8613;
					cast.type = 2;
					
					//SpellFaillure( ( SpellFailedReason )xff );
					/*		int ff2 = (int)Convert.ToInt32( ss[ 2 ] );
							SendMessage("num = " + xff.ToString("X8" ));
					
							int offset = 4;
							Converter.ToBytes( 1, tempBuff, ref offset );
							Converter.ToBytes( xff, tempBuff, ref offset );
							Converter.ToBytes( ff2, tempBuff, ref offset );
							if ( selection is Mobile )
								this.Send( OpCodes.SMSG_SET_FACTION_STANDING, tempBuff, offset );
						*/		
					//	ReputationAdjustments[ World.FactionAssociated[ Factions.Stormwind ] ] = (int)xff;
					//	this.Player.RefreshFactionReactions();
					//	( selection as Mobile ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { ff } );
					
				}
				else
					if ( lower.StartsWith( ".mare" ) )
				{
					/*	if ( selection ==null )
							return;
						string []ss = lower.Split( new char[] { ' ' } );
						int ff1 = Convert.ToInt32( ss[ 1 ] );
				//		int ff2 = Convert.ToInt32( ss[ 2 ] );
						SendMessage("num = " + ff1.ToString("X8" ));
						int offset = 4;
						Converter.ToBytes( selection.Guid, tempBuff, ref offset );
						Converter.ToBytes( ff1, tempBuff, ref offset );
						this.Send( OpCodes.SMSG_AI_REACTION, tempBuff, offset );
						return;*/
					/*	if ( selection is Mobile )
							( selection as Mobile ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.PLAYER_FLAGS }, new object[] { ff } );
					*/
					/*	for(int z = 0;z < 32;z++ )
							zones[ z ] = 0;
						for(int z = 0; z < 32 * 32;z++)
						{
							if ( z >= ff1 && z < ff2 )
							{
								int e = z % 32;
								int n = ( z / 32 );
								zones[ n ] |= (uint)( 1 << ( e ) );
							}
						}
						for(int z = 0;z < 32;z++ )
						{
							this.SendSmallUpdate( new int[] { (int)UpdateFields.PLAYER_EXPLORED_ZONES_1 + z }, new object[] { zones[ z ] } );	
						}*/
				}
				else
					if ( lower.StartsWith( ".marb" ) )
				{
					string []ss = lower.Split( new char[] { ' ' } );
					ff = (uint)Convert.ToInt32( ss[ 1 ] );
					SendMessage("num = " + ff.ToString("X8" ));
					if ( selection is Mobile )
						( selection as Mobile ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.PLAYER_FIELD_BYTES }, new object[] { ff } );
					
				}
				else
					if ( lower.StartsWith( ".marf" ) )
				{
					string []ss = lower.Split( new char[] { ' ' } );
					ff = (uint)Convert.ToInt32( ss[ 1 ] );
					SendMessage("num = " + ff.ToString("X8" ));
					if ( selection is Mobile )
						( selection as Mobile ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_NPC_FLAGS }, new object[] { ff } );
					
				}
					/*else
					if ( lower.StartsWith( ".s" ) )
					{
						string []ss = lower.Split( new char[] { ' ' } );
						SpellFaillure( (Server.SpellFailedReason)Convert.ToInt32( ss[ 1 ] ) );
					}*/
					/*	else
								if ( lower.StartsWith( ".s" ) )
							{
								string []ss = lower.Split( new char[] { ' ' } );
								if ( ss.Length > 1 )
									ff |= (uint)( 1 << Convert.ToInt32( ss[ 1 ] ) );
								if ( selection is Character )
									( selection as Character ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { ff } );
								else
									( selection as Mobile ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { ff } );
								Console.WriteLine("rage = {0}", ff.ToString("X8" ));
							}	
							else
							if ( lower.StartsWith( ".u" ) )
							{
								string []ss = lower.Split( new char[] { ' ' } );
								if ( ss.Length > 1 )
									ff &= (uint)0xffffffff ^ (uint)( 1 << Convert.ToInt32( ss[ 1 ] ) );
								if ( selection is Character )
									( selection as Character ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { ff } );
								else
									( selection as Mobile ).SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { ff } );
					
								Console.WriteLine("rage = {0}", ff.ToString("X8" ));
							}		*/				
					
				else
					if ( lower.StartsWith( ".unmount" ) )
				{
					if ( this.MountModel != 0 )
						UnMount();
				}	
				else
					if ( lower.StartsWith( ".set faction" ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( selection is Mobile )
					{
						if ( tt.Length == 3 )
						{
							int fac = Convert.ToInt32( tt[ 2 ] );
							( selection as Mobile ).SendSmallUpdateToPlayerNearMe( new int[]{ (int)UpdateFields.UNIT_FIELD_FACTIONTEMPLATE }, new object[]{ (int)fac } );
						}
						else
							SendMessage("Usage : .set faction FACTION_NUMBER" );
					}
					else
						SendMessage("You must select a mobile first !" );

				}	
					
				else
					if ( lower.StartsWith( ".removego" ) )
				{					
					Object nearest = null;
					float nearestdist = float.MaxValue;
					foreach( Object o in World.allGameObjects )
					{
						float dist = Distance( o );
						if ( dist < nearestdist )
						{
							nearestdist = dist;
							nearest = o;
						}
					}
					if ( nearest != null )
						World.Remove( nearest, this );
				}
				else
					if ( lower.StartsWith( ".docgen" ) )
				{		
					SendMessage("Documentation is being generated, please wait.");
					Console.WriteLine( "Documentation is being generated, please wait." );
					DateTime startTime = DateTime.Now;
					Docs.Document();
					DateTime endTime = DateTime.Now;
					Console.WriteLine("Documentation has been completed. The entire process took {0:F1} seconds.", (endTime - startTime).TotalSeconds );
					SendMessage("Documentation has been completed. The entire process took " + (endTime - startTime).TotalSeconds.ToString( "F1" ) + " seconds." );
					return;
				}
				else
					if ( lower == ".hide" )
				{					
					this.Visible = InvisibilityLevel.GM;
					AuraEffect st = gmInvisibilityAura;
					Aura aura = new Aura();
					aura.OnRelease = new Aura.AuraReleaseDelegate( OnGMInvisibilityEnded );
					AddAura( st, aura );
				}
				else
					if ( lower.StartsWith( ".unhide" ) )
				{					
					this.Visible = InvisibilityLevel.Visible;
					this.ReleaseAura( gmInvisibilityAura );
				}
				else
					if ( lower.StartsWith( ".whois" ) )
				{					
					foreach( Account a in World.allConnectedAccounts )
					{
						if ( a.SelectedChar != null )
							SendMessage( a.Username.ToString() + " : " + a.SelectedChar.Name + " is online at ( " + a.SelectedChar.X.ToString() + "; " + a.SelectedChar.Y.ToString() + "; "+ a.SelectedChar.Z.ToString() + ") " );
						else
							SendMessage( a.Username.ToString() + " : [loggout]" );
					}
					SendMessage( "User online : " + World.allConnectedAccounts.Count.ToString() );
				}
				else
					if ( lower.StartsWith( ".broadcast " ) )
				{
					string tt = cmd.Remove( 0, 11 );
					foreach( Account a in World.allConnectedAccounts )
					{
						if ( a.SelectedChar != null )
							SendMessage( a.Username.ToString() + ", " + tt );
					}						
				}
				else
					if ( lower.StartsWith( ".restart " ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( tt.Length == 2 )
					{
						World.Restart( Convert.ToInt32( tt[ 1 ] ) );
					}
					else
						SendMessage( "Usage : .restart minutes" );
				}
				else
					if ( lower.StartsWith( ".addlocation " ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( tt.Length == 2 )
					{
						TextReader tr = new StreamReader( "./scripts/Globals/Locations.cs" );
						string txt = tr.ReadToEnd();
						tr.Close();
						TextWriter tw = new StreamWriter( "./scripts/Globals/Locations.cs" );
						int i = txt.IndexOf( "#region Locations" );
						string ne = "\t\t\tWorld.Locations[ \"" + tt[ 1 ] + "\" ] = new Position( " + X.ToString() + "f, " + Y.ToString() + "f, " + Z.ToString() + "f, 0 );" + tw.NewLine;
						tw.Write( txt.Substring( 0, i + "#region Locations".Length ) );
						tw.Write( tw.NewLine + ne );
						tw.Write( txt.Substring( i + "#region Locations".Length ) );
						//	txt.Insert( i + "#region Locations".Length + 2, ne );
						//	tw.Write( txt );
						tw.Close();
						SendMessage( "Done : " + ne );
					}
					else
						SendMessage( "Usage : .addlocation LocationName" );
				}
				else
					if ( lower.StartsWith( ".zone" ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					this.ZoneUpdateRequested( Convert.ToInt32( tt[ 1 ] ) );
				}
				else
					if ( lower.StartsWith( ".grant " ) )
				{
					string acclevel = lower.Remove( 0, 7 );
					string []tt = acclevel.Split( new char[]{ ' ' } );
					Account acc = null;
					if ( tt.Length == 1 )
					{
						if ( selection is Character )
						{
							acclevel = tt[ 0 ];
							acc = ( selection as Character ).Player;
						}
						else
						{
							SendMessage( "Can only be used on character" );
							return;
						}
					}
					else
					{
						if ( tt.Length > 2 || tt.Length == 0 )
						{
							SendMessage( "Usage : .grant [Account] AccessLevel" );
							return;
						}
						acclevel = tt[ 1 ];
						acc = World.allAccounts.FindByUserName( tt[ 0 ].ToUpper() );
						if ( acc == null )
						{
							SendMessage( tt[ 0 ] + " account not found !" );
							return;
						}
					}
					if ( acclevel == "admin" )
					{
						SendMessage( "The account " + acc.Username + " is now an administrator" );
						acc.AccessLevel = AccessLevels.Admin;
					}
					else
						if ( acclevel == "gm" )
					{
						SendMessage( "The account " + acc.Username + " is now a game master" );
						acc.AccessLevel = AccessLevels.GM;
					}
					else
						if ( acclevel == "player" )
					{
						SendMessage( "The account " + acc.Username + " have now player access level" );
						acc.AccessLevel = AccessLevels.PlayerLevel;
					}
					else
						SendMessage( acclevel + " is not a valid access level !" );					
				}
				else
					if ( lower.StartsWith( ".password " ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( tt.Length < 2 )
					{
						SendMessage( "Usage : .password NewPassword" );
						return;
					}
					Player.Password = tt[ 1 ];
					SendMessage( "Your new password is : " + tt[ 1 ] );
					SendMessage( "Don't forget it !" );
				}
				else
					if ( lower.StartsWith( ".info" ) )
				{
					if ( selection != null )
					{
						string ret = "";
						if ( selection is BaseSpawner )
						{
							( selection as BaseSpawner ).DisplayInfo( this );
							//		ret += "Spawner for " + ( selection as BaseSpawner ).Name;
							//		SendMessage( ret );
							return;
						}
						else
							if ( selection is Character )
							ret += "Player : ";
						else
							if ( ( selection as Mobile ).SummonedBy != null )
							ret += "Summoned creature : ";
						else							
							ret += "Creature : ";
						Mobile mob = ( selection as Mobile );
						ret += mob.Name + " Faction : " + mob.Faction.ToString();
						SendMessage( ret );
						ret = "Pos : " + mob.X.ToString() + ", " + mob.Y.ToString() + ", " + selection.Z.ToString() + ", " + selection.MapId.ToString();
						SendMessage( ret );
						ret = "HitPoints : " + mob.HitPoints.ToString() + " / " + mob.BaseHitPoints.ToString();
						SendMessage( ret );
						ret = "Mana : " + mob.Mana.ToString() + " / " + mob.BaseMana.ToString();
						SendMessage( ret );
						ret = "Level : " + mob.Level.ToString() + " / " + mob.Exp.ToString() + " Xp";
						SendMessage( ret );
					}
					else
						SendMessage( "You must select a mobile before" );
				}
				else
					if ( lower.StartsWith( ".kill" ) )
				{
					if ( selection != null && selection is Mobile )
					{
						( selection as Mobile ).LooseHits( this, ( selection as Mobile ).HitPoints, true );
					}
				}
				else
					if ( lower.StartsWith( ".addgospawner" ) )
				{
					GameObjectSpawner bc = null;
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( tt.Length == 3 )
					{
						
						try
						{
							if ( Utility.FindConstructor( tt[ 1 ] ) != null )
							{
								ConstructorInfo cttest = Utility.FindConstructor( tt[ 1 ] );
								GameObject go = (GameObject)cttest.Invoke( null );
								if ( go.DefaultModel == 0 )
								{
									SendMessage( "This class does not implement the DefaultModel property !" );
									return;
								}
								bc = new GameObjectSpawner();
								bc.Init( tt[ 1 ], Convert.ToInt32( tt[ 2 ] ) );
								World.Add( bc, X, Y, Z, MapId );
							}
							else
							{
								bc = new GameObjectSpawner();
								int id = Convert.ToInt32( tt[ 1 ] );
								bc.Init( id, Convert.ToInt32( tt[ 2 ] ) );
								World.Add( bc, X, Y, Z, MapId );
							}



						}
						catch( Exception )
						{
						}
					}
					else
						if ( tt.Length == 4 )
					{
						try
						{
							bc = new GameObjectSpawner();
							int id = Convert.ToInt32( tt[ 1 ] );
							bc.Init( id, Convert.ToInt32( tt[ 2 ] ), tt[ 3 ] );
							World.Add( bc, X, Y, Z, MapId );
						}
						catch( Exception )
						{
						}
					}
					else
						SendMessage( "usage : .addgospawner gameobjectname frequency [gameobjectclass]" );
					if ( bc != null )//	Ajoute le spawner dans la liste des autres spawnpoints
					{
						if ( this.linkedSpawner == -1 )//	No spawner near the player
						{
								
						}
						else
						{
							int num = World.allSpawners.Count - 1;
							ArrayList al = new ArrayList();
							World.regSpawners[ num ] = al;
							for(int t = 0;t < num;t++ )
							{
								BaseSpawner bs2 = World.allSpawners[ t ] as BaseSpawner;
								if ( bc.MapId != bs2.MapId )
									continue;
								if ( bc.QuickDistance( bs2 ) < 150 * 150 )
									al.Add( t );
							}
								
							foreach( int i in al )
							{
								( World.regSpawners[ i ] as ArrayList ).Add( num );
							}
						}
					}
				}
				else
					if ( lower.StartsWith( ".armagedon" ) )
				{
					MobileList newMobs = new MobileList();
					int n = 0;
					foreach( Mobile m in World.allMobiles )
						if ( m is Character )
						{
							newMobs.Add( m );
						}
						else
							n++;
					n += World.allSpawners.Count;
					LinkedSpawner = -1;
					World.allSpawners.Clear();
					World.allMobiles = newMobs;
					Player.RefreshMobileList( true );
					SendMessage( n.ToString() + " mobs/spawners removed !" );
				}					
				else
					if ( lower.StartsWith( ".nuke" ) )
				{
					MobileList newMobs = new MobileList();
					int n = 0;
					foreach( Mobile m in World.allMobiles )
						if ( m is Character )//|| m is BaseSpawner )
						{
							newMobs.Add( m );
						}
						else
							n++;

					World.allSpawners.Clear();
					World.allMobiles = newMobs;
					SendMessage( n.ToString() + " mobs removed !" );
					
				}
				else
					if ( lower.StartsWith( ".set godmode on" ) )
				{
					if ( selection != null && selection is Mobile )
					{
						( selection as Mobile ).GodMode = true;
					}
					else
						GodMode = true;
				}
				else
					if ( lower.StartsWith( ".set godmode off" ) )
				{
					if ( selection != null && selection is Mobile )
					{
						( selection as Mobile ).GodMode = false;
					}
					else
						GodMode = false;
				}
				else
					if ( lower.StartsWith( ".set turbo on" ) )
				{
					RunSpeed = 40f;
					this.ChangeRunSpeed( 40f );
				}
				else
					if ( lower.StartsWith( ".set turbo off" ) )
				{
					RunSpeed = 7f;
					this.ChangeRunSpeed( 7f );
					/*
						int offset = 4;
						Converter.ToBytes( 1, tempBuff, ref offset );
						Converter.ToBytes( (byte)0, tempBuff, ref offset );
						WalkSpeed = 4.777f;
						RunSpeed = 7f;
						this.PrepareUpdateData( tempBuff, ref offset , UpdateType.UpdateFull, false );
						this.Send( OpCodes.SMSG_UPDATE_OBJECT, tempBuff, offset );*/
				}
				else
					if ( lower.StartsWith( ".guid" ) )
				{
					if ( selection == null )
						SendMessage( "Guid : " + Guid.ToString( "X16" ) );
					else
						SendMessage( "Guid : " + selection.Guid.ToString( "X16" ) );
						
				}
				else
					if ( lower.StartsWith( ".addspawner" ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( tt.Length == 4 )
					{
						ConstructorInfo ct = null;
						try
						{
							MobileSpawner bc = new MobileSpawner();

							try
							{
								int mid = (int)Convert.ToInt32( tt[ 1 ] );
								ct = World.MobilePool( mid );
							}
							catch(Exception)
							{
								ct = Utility.FindConstructor( tt[ 1 ], Utility.externAsm[ "creatures" ] );
								if ( ct == null )
									ct = Utility.FindConstructor( tt[ 1 ] );
							}

							BaseCreature b = (BaseCreature)ct.Invoke( null );
							float rec = float.MaxValue;
							foreach( BaseSpawner bs in World.allSpawners )
							{
								float xx = X - bs.X;
								float yy = Y - bs.Y;
								xx *= xx;
								yy *= yy;
								xx += xx;
								if ( xx < rec && bs.MapId == MapId )
								{
									rec = xx;
									bc.ZoneId = bs.ZoneId;
									bc.MapId = bs.MapId;
								}
							}
							//MapPoint mp = World.mapZones.NearestPoint( bc.MapId, bc.ZoneId, X, Y );
							bc.RealX = X;
							bc.RealY = Y;
							bc.RealZ = Z;
							bc.Model = b.Model;
							bc.Id = 99999999 - b.Id;
							bc.Orientation = Orientation;							
							bc.Init( ct, b.Id, Convert.ToInt32( tt[ 3 ] ), Convert.ToInt32( tt[ 2 ] ) );
							World.Add( bc, X, Y, Z, MapId );
							if ( this.linkedSpawner == -1 )//	No spawner near the player
							{
								
							}
							else
							{
								int num = World.allSpawners.Count - 1;
								ArrayList al = new ArrayList();
								World.regSpawners[ num ] = al;
								for(int t = 0;t < num;t++ )
								{
									BaseSpawner bs2 = World.allSpawners[ t ] as BaseSpawner;
									if ( bc.MapId != bs2.MapId )
										continue;
									if ( bc.QuickDistance( bs2 ) < 150 * 150 )
										al.Add( t );
								}
								
								foreach( int i in al )
								{
									( World.regSpawners[ i ] as ArrayList ).Add( num );
								}
							}

							bc.ForceRespawn();
							Player.RefreshMobileList( true );
						}
						catch( Exception )
						{
						}
					}
					else
						SendMessage( "usage : .addspawner mobname amount frequency" );
				}
				else
					if ( lower.StartsWith( ".set xp" ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( tt.Length == 3 )
					{
						Character c = selection as Character;
						if ( c == null )
							c = this;
						try 
						{
							uint a = Convert.ToUInt32( tt[ 2 ] ) - c.Exp;
							c.EarnXP( (int)a );
						}
						catch( Exception )
						{
							this.SendMessage( "usage : .set xp amount" );
						}
					}
				}
				else
					if ( lower.StartsWith( ".debug" ) )
				{
					if ( selection != null )
					{
						if ( selection is BaseCreature )
						{
							BaseCreature bc = selection as BaseCreature;
							if ( bc.DebugSniffer != null )
							{
								bc.DebugSniffer = null;
								SendMessage( "Debug Off" );
								return;
							}
							else
							{
								bc.DebugSniffer = this;
								SendMessage( "Debug On" );
							}
						}
					}
				}
					#region TRAJETS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
				else
					if ( lower.StartsWith( ".hidepath" ) )
				{
					ArrayList toRemove = new ArrayList();
					foreach( GameObject go in World.allGameObjects )
						if ( go.Id >= 621680 && go.Id <= 621683 )
							toRemove.Add( go );
					foreach( GameObject go in toRemove )
						World.allGameObjects.Remove( go );
					this.account.RefreshMobileList( true );
				}
				else
					if ( lower.StartsWith( ".showpath" ) )
				{
					foreach( Trajet tr in World.trajets )
					{
						bool start = true;
						foreach( Coord c in tr )
						{
							GameObject go;
							if ( Distance( c.x, c.y, c.z ) < 400 * 400 )
							{
								if ( c is Intersection )
								{
									go = World.Add( 621682, c.x, c.y, c.z, MapId );
								}
								else
								{					
									if ( start )
										go = World.Add( 621681, c.x, c.y, c.z, MapId );							
									else
										go = World.Add( 621680, c.x, c.y, c.z, MapId );							
								}
							}
							start = false;
						}
					}
					this.account.RefreshMobileList( true );
				}
				else
					if ( lower.StartsWith( ".delpath" ) )
				{
					if ( startTrajetFlag != null )
						DestroyObject( startTrajetFlag.Guid );
					World.RemoveTrajet( path );
					path.Clear();
					path = null;//World.AllocateTrajet();					
					SendMessage( "Path is removed" );
				}
				else
					if ( lower.StartsWith( ".startpath" ) )
				{		
					if ( selection is MobileSpawner )
					{
						World.trajets.Dirty = true;
						if ( startTrajetFlag != null )
							DestroyObject( startTrajetFlag.Guid );
						path = World.AllocateTrajet();
						( selection as MobileSpawner ).TrajetGuid = path.Guid;
						startTrajetFlag = World.Add( 621681, X, Y, Z, MapId );
						foreach( Object o in this.KnownObjects )
							if ( o is BaseCreature )
							{
								if ( ( o as BaseCreature ).SpawnerLink == selection )
								{
									( o as BaseCreature ).Freeze = true;
								}
							}
						//startTrajetFlag.Decay = DateTime.Now.Add( TimeSpan.FromMinutes( 15.0 ) );
						SendMessage( "Start a new path for the spawner" );
					}
					else
						SendMessage( "You must select a spawner before starting a new path" );
				}
				else
					if ( lower.StartsWith( ".endpath" ) )
				{					
					if ( startTrajetFlag != null )
					{
						World.Remove( startTrajetFlag, this );				
					}
					if ( path != null && path.Count > 1 )
					{
						path[ 0 ].previous = path[ path.Count - 1 ];
						path[ path.Count - 1 ].next = path[ 0 ];
					}
					foreach( Object o in this.KnownObjects )
						if ( o is BaseCreature )
						{
							if ( ( o as BaseCreature ).SpawnerLink == selection )
							{
								( o as BaseCreature ).Freeze = true;
							}
						}										
					path = null;			
					SendMessage( "Path loop completed" );
				}

					#endregion TRAJETS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
				else
					if ( lower.StartsWith( ".cast " ) )
				{
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( selection != null && selection is Mobile )
					{
						try
						{
							int i = Convert.ToInt32( tt[ 1 ] );
							( selection as Mobile ).FakeCast( i, this );
						}
						catch( Exception )
						{
							SendMessage( "Invalid spell id !" );
						}
					}
					else
						SendMessage( "You must target a mobile !" );
				}
				else
					if ( lower.StartsWith( ".additem " ) )
				{					
					string []tt = cmd.Split( new char[]{ ' ' } );
					if ( tt.Length == 3 )
					{
						try 
						{
							CreateAndAddObject( tt[ 1 ], Convert.ToInt32( tt[ 2 ] ) );
						}
						catch( Exception )
						{
							this.SendMessage( "usage : .additem ItemName [number]" );
						}
					}
					else
						if ( tt.Length == 2 )
						CreateAndAddObject( tt[ 1 ] );
					else
						this.SendMessage( "usage : .additem ItemName [number]" );
				}
				else
					if ( lower.StartsWith( ".addgo " ) )
				{

					try
					{
						cmd = cmd.Remove( 0, 7 );
						string []tt = cmd.Split( new char[]{ ' ' } );
						int i = Convert.ToInt32( tt[ 0 ] );
						if ( GameObjectDescription.all[ i ]== null )
						{
							SendMessage( "Unknow Game object " + i.ToString() );
							return;
						}
						GameObject go = null;
						if ( World.GameObjectsAssociated.Exist( i ) )
						{
							go = World.Add( i, Utility.ClassName( World.GameObjectsAssociated[ i ].ToString() ), X, Y, Z, MapId );
							go.Id = i;
						}
						else
							go = World.Add( i, X, Y, Z, MapId );
						if ( this.linkedSpawner == -1 )
						{
							SendMessage( "You cannot place a game object here, first place a spawner !" );
						}
						else
						{
							World.allSpawners[ linkedSpawner ].Bind( go );
							account.RefreshMobileList( true );
						}
					}
					catch( Exception )
					{
					}
				}
				else
					if ( lower.StartsWith( ".where" ) )
				{
					SendMessage( "X = " + X.ToString() + ", Y = " + Y.ToString() + ", Z = " + Z.ToString() + " mapId = " + this.MapId.ToString() );					
				}
				else
					if ( lower == ".remove" )
				{
					if ( selection != null )
					{
						selection.Delete();
						
						if ( selection.Guid > 0xF100000000000000 )
						{
							World.allSpawners.Remove( selection as BaseSpawner );
							SendMessage( "Spawnpoint deleted" );
							this.linkedSpawner = -1;
							
						}
						else
						{
							World.allMobiles.Remove( selection as Mobile );
							SendMessage( ( selection as Mobile ).Name + " deleted" );
						}
						account.HeartBeat();
					}
				}
				else
					if ( lower.StartsWith( ".addnpc " ) )
				{
					//SendMessage( cmd );
					string []cmds = cmd.Split( new char[]{ ' ' } );
					if ( cmds.Length < 2 )
					{
						SendMessage( "Usage : .addnpc NpcName [howmany]" );
						return;
					}
					Factions fact = Factions.NoFaction;
					
					int n = 1;
					if ( cmds.Length == 3 )
					{
						try
						{
							n = Convert.ToInt32( cmds[ 2 ] );
						}
						catch(Exception)
						{
						}
					}
					if ( cmds.Length == 4 )
					{
						try
						{
							fact = (Factions)Convert.ToInt32( cmds[ 3 ] );
						}
						catch(Exception)
						{
						}
					}
					for(int t = 0;t < n;t++ )
					{
						ConstructorInfo ct = null;
						try
						{
							int mid = (int)Convert.ToInt32( cmds[ 1 ] );
							ct = World.MobilePool( mid );
						}
						catch(Exception)
						{
							ct = Utility.FindConstructor( cmds[ 1 ] , Utility.externAsm[ "creatures" ] );
							if ( ct == null )
								ct = Utility.FindConstructor( cmds[ 1 ] );
						}

						if ( ct == null )
						{
							SendMessage( cmds[ 1 ] + " is not a valid Npc !!!" );
							return;
						}
						BaseCreature bc = null;
						try
						{
							bc =  (BaseCreature)ct.Invoke( null );
						}
						catch( Exception e )
						{
							//			Console.WriteLine( "{0}\n{1}\n{2}\n", e.Message, e.Source, e.StackTrace );
							SendMessage( e.Message );
							SendMessage( e.Source );
							SendMessage( e.StackTrace );
							return;
						}
						bc.X = X;
						bc.Y = Y;
						bc.Z = Z;
						bc.ZoneId = ZoneId;
						bc.MapId = MapId;
						bc.InitStats();
						float nearest = float.MaxValue;
						BaseSpawner nearSpawner = null;
						foreach( BaseSpawner bs in World.allSpawners )
							if ( bs.Distance( this ) < nearest )
							{
								nearest = bs.Distance( this );
								nearSpawner = bs;
							}
						if ( nearSpawner != null )
							nearSpawner.Bind( bc );
						World.allMobiles.Add( bc, true );	
						if ( fact != Factions.NoFaction )
							bc.Faction = fact;
						Player.RefreshMobileList( true );
					}
				}
				else
					if ( lower.StartsWith( ".move" ) )
				{
					byte []b4 = new byte[] {0x00, 0x31, 0x96, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x32, 0x36, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x57, 0x65, 0x6C, 0x63, 0x6F, 0x6D, 0x65, 0x20, 0x74, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64, 0x20, 0x6F, 0x66, 0x20, 0x57, 0x61, 0x72, 0x63, 0x72, 0x61, 0x66, 0x74, 0x00, 0x00};
					int offset = 9;
					Converter.ToBytes( Guid, b4, ref offset );
					Player.Handler.Send( 0x96, b4 );

					foreach( Mobile m in World.allMobiles )
						if ( !( m is Character ) )
							m.MovementHeartBeat( account.Handler, this );
				}
				else
					if ( lower.StartsWith( ".save" ) )
				{
					MainConsole.world.SaveGame();
				}
				else
					if ( lower.StartsWith( ".load" ) )
				{
				}
				else
					/*					if (lower.StartsWith( ".stest" ))
									{
										ConstructorInfo ct1 = Utility.FindConstructor( "RazorHillGrunt" , Utility.externAsm );
										for(int i = 0;i < 400;i+=30 )
										for(int t = i;t < i + 30;t++ )
										{
											BaseCreature bc = (BaseCreature)ct1.Invoke( null );	
											bc.Faction = (Factions)t;
											bc.Name = "Faction " + t.ToString();
											bc.Id = t + 65000;
											World.Add( bc, -13234f + (float)( t / 30 ) * 2, 238f+ (float)( t % 30 ) * 2, 22f, 0 );
											bc.Freeze = true;						
										}
									}
									else*/
					if ( lower.StartsWith( ".mark" ) )
				{
					mark = new Position( X, Y, Z, MapId );
					SendMessage( "Mark at " + X.ToString() + ", " + Y.ToString() + ", " + Z.ToString() + ", " + MapId.ToString() );
				}
				else
					if ( lower.StartsWith( ".recall" ) )
				{
					if ( mark == null )
						SendMessage( "You must mark a location first !" );
					else
						Teleport( mark.X, mark.Y, mark.Z, mark.MapId );
				}
				else
					if ( lower.StartsWith( ".go " ) )
				{	
					cmd = cmd.Remove( 0, 4 );
					string []val = cmd.Split( new char[]{' '} );
					if ( !( val.Length != 4 || val.Length != 2 ) )
					{
						SendMessage( "Need at 1 or 4 parameters !" );
						SendMessage( "usage : .go X Y Z MapId or .go Location" );
						return;
					}
					if ( val.Length == 1 && World.Locations[ val[ 0 ] ] == null )
					{
						SendMessage( val[ 0 ] + " is an unknown location" );
						return;
					}
					if ( val.Length == 1 )
					{
						Position pos = (Position)World.Locations[ val[ 0 ] ];
						Teleport( pos.X, pos.Y, pos.Z, pos.MapId );
					}
					else
						Teleport( Convert.ToSingle( val[ 0 ] ), 
							Convert.ToSingle( val[ 1 ] ), Convert.ToSingle( val[ 2 ] ),
							Convert.ToInt32( val[ 3 ] ) );
		
				}
				else
					if ( onCommand != null && !onCommand( this, cmd ) )
					return;
				else
					SendMessage( "Unknown command !" );
			}
		}
Exemple #4
0
		void ImportSpawner()
		{
			TextReader tr = new StreamReader( "./exportspawners.csv" );
			while( true )
			{
				string str = tr.ReadLine();
				if ( str == null )
					break;
				string []strs = str.Split( new char[] { ';' } );
				int _id = Convert.ToInt32( strs[ 0 ] );
				if ( _id != 0 )
					_id = 9999999 - _id;
				ushort _mapId = Convert.ToUInt16( strs[ 1 ] );
				float _x = Convert.ToSingle( strs[ 2 ] );
				float _y = Convert.ToSingle( strs[ 3 ] );
				float _z = Convert.ToSingle( strs[ 4 ] );
				float _orientation = Convert.ToSingle( strs[ 5 ] );
				int _ZoneId = Convert.ToInt32( strs[ 6 ] );
				int _Model = Convert.ToInt32( strs[ 7 ] );				
				int _Frequency = Convert.ToInt32( strs[ 8 ] );
				int _Amount = Convert.ToInt32( strs[ 9 ] );
				float _rx = Convert.ToSingle( strs[ 10 ] );
				float _ry = Convert.ToSingle( strs[ 11 ] );
				float _rz = Convert.ToSingle( strs[ 12 ] );
				float _f = Convert.ToSingle( strs[ 13 ] );
				UInt64 _guid = Convert.ToUInt64( strs[ 14 ] );
				int _type = Convert.ToInt32( strs[ 15 ] );
				if ( _type == 0 )
				{
					MobileSpawner bs = new MobileSpawner();
					bs.Id = _id;
					bs.X = _x;
					bs.Y = _y;
					bs.Z = _z;
					bs.MapId = _mapId;
					bs.Orientation = _orientation;
					bs.Amount = _Amount;
					bs.Frequency = _Frequency;
					bs.Model = _Model;
					bs.RealX = _rx;
					bs.RealY = _ry;
					bs.RealZ = _rz;
					bs.TrajetGuid = _guid;
					World.allSpawners.Add( bs );
				}
				else
				{
					GameObjectSpawner bs = new GameObjectSpawner();
					bs.Id = _id;
					bs.X = _x;
					bs.Y = _y;
					bs.Z = _z;
					bs.MapId = _mapId;
					bs.Orientation = _orientation;
					bs.Frequency = _Frequency;
					bs.Model = _Model;
					bs.Facing = _f;
					bs.RotationX = _rx;
					bs.RotationY = _ry;
					bs.RotationZ = _rz;
					World.allSpawners.Add( bs );
				}
			}
			tr.Close();
		}
Exemple #5
0
		void ImportWad()
		{
			Console.WriteLine( "Converting creature file..." );
			int etat = 0;
			int line = 0;
			int err = 0;
			int n = 0;
			int gos = 0;
			int gob = 0;
			Hashtable i = new Hashtable();
			i[ "mapid" ] = (ushort)0;

		//	ConstructorInfo ct;// = Utility.FindConstructor( "Spawner" );
			TextReader tx = new StreamReader( "world.save" );
			while( err < 100 )
			{
				string str = tx.ReadLine();
				line++;
				
				if ( str == null )
					break;
				if ( str.Length == 0 )
					continue;
				if ( str.StartsWith( "[" ) )
				{
					etat = 1;
					if ( i[ "type" ] != null )
					{						
						
						if ( (int)i[ "type" ] == 5 )// Game Obj
						{
							if ( GameObjectDescription.all[ (int)i[ "entry" ] ] != null )
							{
								GameObjectSpawner bc = new GameObjectSpawner();
								int goid = (int)i[ "entry" ];
								i[ "entry" ] = null;
								if ( GameObjectDescription.all[ goid ] == null )
								{
									Console.WriteLine( "Game object {0} unknown !", goid );
									continue;
								}
								bc.Init( goid, (int)1, null );
								World.Add( bc, (float)i[ "x" ], (float)i[ "y" ], (float)i[ "z" ], (ushort)i[ "mapid" ] );
								bc.Orientation = (float)i[ "o" ];
								if ( i[ "rx" ] != null )
								{
									bc.RotationX = (float)i[ "rx" ];
									bc.RotationY = (float)i[ "ry" ];
									bc.RotationZ = (float)i[ "rz" ];
									bc.Facing = (float)i[ "ro" ];
								}
								gos++;
								i[ "mapid" ] = (ushort)0;
								i[ "type" ] = null;
							}
							else
								Console.WriteLine("Unknown Game object {0}", (int)i[ "entry" ] );
							i[ "mapid" ] = (ushort)0;
						}
						else				
						if ( i[ "spawngobjid" ] != null )
						{
							GameObjectSpawner bc = new GameObjectSpawner();
							int goid = (int)i[ "spawngobjid" ];
							i[ "spawngobjid" ] = null;
							if ( GameObjectDescription.all[ goid ] == null )
							{
								Console.WriteLine( "Game object {0} unknown !", goid );
								continue;
							}
							bc.Init( goid, (int)i[ "spawntime" ], null );
							World.Add( bc, (float)i[ "x" ], (float)i[ "y" ], (float)i[ "z" ], (ushort)i[ "mapid" ] );
							bc.Orientation = (float)i[ "o" ];
							if ( i[ "rx" ] != null )
							{
								bc.RotationX = (float)i[ "rx" ];
								bc.RotationY = (float)i[ "ry" ];
								bc.RotationZ = (float)i[ "rz" ];
								bc.Facing = (float)i[ "ro" ];
							}
							gos++;
							i[ "mapid" ] = (ushort)0;
						}
						else
							if ( i[ "spawnid" ] != null )
						{
							MobileSpawner bc = new MobileSpawner();
							ConstructorInfo mob = World.MobilePool( (int)i[ "spawnid" ] );
							if ( mob == null )
							{
								Console.WriteLine("creature id {0} unknown", (int)i[ "spawnid" ] );								
							}
							else
							{
								BaseCreature b = (BaseCreature)mob.Invoke( null );
								bc.Model = b.Model;
								bc.Id = 99999999 - b.Id;
								if ( (int)i[ "spawntime" ] <= 0 )
									Console.WriteLine("Invalid spawntime {0}" , (int)i[ "spawntime" ] );
								else
								{
									bc.Init( mob, b.Id, (int)i[ "spawntime" ], (int)i[ "spawnnumber" ] );
									World.Add( bc, (float)i[ "x" ], (float)i[ "y" ], (float)i[ "z" ], (ushort)i[ "mapid" ] );
									bc.Orientation = (float)i[ "o" ];
							//		for(int t = 0;t < bc.Amount;t++ )
							//			bc.ForceRespawn();
									i[ "spawngobjid" ] = null;
								}
								i = new Hashtable();
								i[ "mapid" ] = (ushort)0;
							
								n++;
							}
						}
					}
				}
				else
					if ( etat == 1 )
				{
					if ( str.StartsWith( "//" ) )
						continue;					
					string []spl = str.Split( new Char [] { '=' } );
					if ( spl.Length != 2 )	
					{
						Console.WriteLine( "{0} : {1}","Syntaxe Error, line " + line.ToString(), str );
					}
					else
					{
						string tag = spl[ 0 ].ToLower();
						string val = spl[ 1 ];
						if ( val.EndsWith( " " ) )
							val = val.Substring( 0, val.Length - 1 );
#if !DEBUG
						try
#endif
						{
							switch( tag )
							{		
								case "model":								
									i[ "model" ] = (int)Convert.ToInt32( val );
									break;	
								case "type":								
									i[ "type" ] = (int)Convert.ToInt32( val );
									break;	
								case "entry":								
									i[ "entry" ] = (int)Convert.ToInt32( val );
									break;	
								case "gflag":								
									i[ "gflag" ] = (int)Convert.ToInt32( val );
									break;	
								case "map":								
									i[ "mapid" ] = (ushort)Convert.ToInt32( val );
									break;	
								case "rotation":		
									string[]st = val.Split( new char[]{ ' ' } );
									i[ "rx" ] = (float)Convert.ToSingle( st[ 0 ] );
									i[ "ry" ] = (float)Convert.ToSingle( st[ 1 ] );
									i[ "rz" ] = (float)Convert.ToSingle( st[ 2 ] );
									i[ "ro" ] = (float)Convert.ToSingle( st[ 3 ] );
									break;
								case "spawntime":
									string second = SecondParam( val );
									string first2 = FirstParam( val );
									int sec = Convert.ToInt32( second );
									if ( sec <= 10 )
										sec = 20;
									i[ "spawntime" ] = sec;
									break;			
								case "spawn":
									second = SecondParam( val );
									first2 = FirstParam( val );
									i[ "spawnid" ] = (int)Convert.ToInt32( first2 );
									i[ "spawnnumber" ] = (int)Convert.ToInt32( second );
									break;		
								case "spawn_gobj":
									second = SecondParam( val );
									first2 = FirstParam( val );
									i[ "spawngobjid" ] = (int)Convert.ToInt32( first2 );
									i[ "spawnnumber" ] = (int)1;//Convert.ToInt32( second );
									break;				
								case "xyz":
									string[]stro = val.Split( new char[]{ ' ' } );
									i[ "x" ] = (float)Convert.ToDouble( stro[ 0 ] );
									i[ "y" ] = (float)Convert.ToDouble( stro[ 1 ] );
									i[ "z" ] = (float)Convert.ToDouble( stro[ 2 ] );
									i[ "o" ] = (float)Convert.ToDouble( stro[ 3 ] );
									break;					
								default:
									break;
							}		
						}
#if !DEBUG
						catch( Exception e )
						{							
							Console.WriteLine( "Exception {0}", e.Message );
							Console.WriteLine( "Line {0}", line );
						}
#endif
					}
				}
				
			}			
			SendMessage( n.ToString() + " spawn point created" );
			SendMessage( gob.ToString() + " game objects created" );
			SendMessage( gos.ToString() + " game objects spawn point created" );
			SendMessage( "I'm now importing the spawn points... this could take several minutes..." );
			World.AdjustSpawners();
			SendMessage( "Spawn points imported" );
		}