Ejemplo n.º 1
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 !" );
			}
		}
Ejemplo n.º 2
0
		public override void OnDeath( Mobile by )
		{
			if ( Duel != 0 )
			{				
				this.ReleaseAllAura();
				int offset = 4;
				if ( gu != null )
				{
					Converter.ToBytes( (byte)0, tempBuff, ref offset );
					Converter.ToBytes( gu.Name, tempBuff, ref offset );
					Converter.ToBytes( (byte)0, tempBuff, ref offset );
					Converter.ToBytes( Name, tempBuff, ref offset );
					Converter.ToBytes( (byte)0, tempBuff, ref offset );
					Send( OpCodes.SMSG_DUEL_WINNER, tempBuff, offset );
					gu.Send( OpCodes.SMSG_DUEL_WINNER, tempBuff, offset );
					offset = 4;
					Converter.ToBytes( (byte)1, tempBuff, ref offset );
					Send( OpCodes.SMSG_DUEL_COMPLETE, tempBuff, offset );
					gu.Send( OpCodes.SMSG_DUEL_COMPLETE, tempBuff, offset );
					offset = 4;
					Converter.ToBytes( Duel, tempBuff, ref offset );
					Send( OpCodes.SMSG_GAMEOBJECT_DESPAWN_ANIM, tempBuff, offset );
					gu.Send( OpCodes.SMSG_GAMEOBJECT_DESPAWN_ANIM, tempBuff, offset );
					Send( OpCodes.SMSG_DESTROY_OBJECT, tempBuff, offset );
					gu.Send( OpCodes.SMSG_DESTROY_OBJECT, tempBuff, offset );
					this.HitPoints = this.BaseHitPoints / 4;
					this.SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_DYNAMIC_FLAGS, 178, 179, 186 } , new object[] { 0, 0, 0, 0 } );				
					gu.SendSmallUpdateToPlayerNearMe( new int[] { (int)UpdateFields.UNIT_DYNAMIC_FLAGS, 178, 179, 186 } , new object[] { 0, 0, 0, 0 } );				
					Aura aura = new Aura();
					this.AddAura( ( Abilities.abilities[ 7267 ] as AuraEffect ), aura, true );
					offset = 4;
					gu.Send( OpCodes.SMSG_CANCEL_COMBAT, tempBuff, offset );
					Send( OpCodes.SMSG_CANCEL_COMBAT, tempBuff, offset );	
					gu.Duel = 0;
					gu.guowner = null;
					gu.gu = null;
				}
				Duel = 0;				
				guowner = null;				
				gu = null;
				dt.Stop();
				dt = null;
				return;
			}
			this.NextAttackEffects.Clear();
			by.NextAttackEffects.Clear();
			if ( Summon != null )
				DismissPet( Summon.Guid );
			ReleaseAllAura();
			corpsGuid = 0;
			CorpseLocationX = X;
			CorpseLocationY = Y;
			CorpseLocationZ = Z;
			CorpseMapId = MapId;
			foreach( Object ch in this.KnownObjects )
				if ( ch is Character && ch != this )
					( ch as Character ).Player.RefreshMobileList( false );

			if ( by != null )
				by.XpEarn( this );
			this.SendSmallUpdateToPlayerNearMe( new int [] { (int)UpdateFields.UNIT_FIELD_HEALTH, (int)UpdateFields.UNIT_FIELD_FLAGS }, new object[] { 0, 0x4008 } );
		}
Ejemplo n.º 3
0
		public override PermanentAura AddPermanentAura( AuraEffect ae, Aura a )
		{
			PermanentAura paura = new PermanentAura(a,ae.Id);
			this.permanentAura.Add(paura);
			this.AdjustBonii();
			return paura;
		}
Ejemplo n.º 4
0
		public override void Mount( Mobile m )
		{
			if ( m == Summon )
			{
				//	Summon.Freeze = true;
				Summon.Visible = InvisibilityLevel.True;
				DestroyObject( Summon.Guid );
				Player.KnownObjects.Remove( Summon );	
				this.MountModel = Summon.Model;
			}
			else
				MountModel = m.Model;
			int offset = 4;
			Converter.ToBytes( 1, tempBuff, ref offset );
			Converter.ToBytes( (byte)0, tempBuff, ref offset );				
			PrepareUpdateData( tempBuff, ref offset , UpdateType.UpdateFull, false );
			Send( OpCodes.SMSG_UPDATE_OBJECT, tempBuff, offset );
			this.ItemsUpdate();
			Aura aura = new Aura();
			aura.OnRelease = new Aura.AuraReleaseDelegate( this.OnUnMount );
			AddAura( mountedIdAuraEffect = (AuraEffect)World.MountsList[ m.Id ], aura );
		}
Ejemplo n.º 5
0
		public virtual PermanentAura AddPermanentAura( AuraEffect ae, Aura a )
		{
			PermanentAura paura = new PermanentAura(a,ae.Id);
			permanentAura.Add(paura);
			if (this is Character) (this as Character).AdjustBonii();
			return paura;
		}
Ejemplo n.º 6
0
		public static void OnFindMineral( BaseAbility ba, Mobile c )
		{
			AuraEffect st = (AuraEffect)ba;
			Aura aura = new Aura( EffectTypes.FindMineral );
			c.CumulativeAuraEffects[ EffectTypes.FindMineral ] = true;
			c.AddAura( st, aura );	
			c.SendSmallUpdate( new int[] { (int)UpdateFields.PLAYER_TRACK_RESOURCES }, new object[] { 4 } );		
		}	
Ejemplo n.º 7
0
		public Aura AddAura( AuraEffect ae, Aura a )
		{
			
			
			return AddAura( ae, a, false );
		}
Ejemplo n.º 8
0
		public Aura AddAura( AuraEffect ae, Aura a, bool offensive )
		{
			if ( Dead )
				return null;	
	
			if ( offensive )
				this.OnGetHit( this, false, 1 );

			if ( aura.Count < 50 )
			{	
				int num = -1;
				int n = 0;
				ArrayList free = new ArrayList();
				if ( offensive || a is DotAura )
					free.AddRange( new int[] { 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45
												 , 46, 47, 48, 49 } );
				else
					free.AddRange( new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
												 , 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 } );

				foreach( AuraReleaseTimer arts in aura )
				{
					if ( arts.ae == ae )
					{
						num = n;
						break;
					}
					else
					{
						free.Remove( arts.num );
						n++;
					}
				}
				if ( free.Count == 0 )
					return null;//	Too much aura !!!!!
				if ( num == -1 )
					num = (int)free[ 0 ];
				else
				{//	l'aura a deja ete lanc?, remise a zero de son compteur
					int ne = num;
					num = ( aura[ ne ] as AuraReleaseTimer ).num;
					ReleaseAura( ( aura[ ne ] as AuraReleaseTimer ) );
				}
					
				if (ae != null)
				{
					AuraReleaseTimer art = null;
					if ( ae.Duration( this ) == 0x100 )
						art = new AuraReleaseTimer( this, a, ae, num, 0xfffffff );
					else
						art = new AuraReleaseTimer( this, a, ae, num, ae.Duration( this ) );
					aura.Add( art );
					SendSmallUpdateToPlayerNearMe( 
						new int[] { 
						(int)UpdateFields.UNIT_FIELD_AURA + num, 
						(int)UpdateFields.UNIT_FIELD_AURAFLAGS + ( num >> 3 ), 
						(int)UpdateFields.UNIT_FIELD_AURALEVELS + ( num >> 2 ),
						(int)UpdateFields.UNIT_FIELD_AURAAPPLICATIONS + ( num >> 2 ), 
						
						(int)UpdateFields.UNIT_FIELD_AURASTATE }, 
					new object[] { (int)ae.Id, 0xdddddddd, 0x01010101, 0, 0x2 } );

					int offset = 4;
					Converter.ToBytes( (byte)num, tempBuff, ref offset );
					if ( ae.Duration( this ) == 0x100 )
						Converter.ToBytes( 0xffffffff, tempBuff, ref offset );
					else
						Converter.ToBytes( ae.Duration( this ), tempBuff, ref offset );
					ToAllPlayerNear( OpCodes.SMSG_UPDATE_AURA_DURATION, tempBuff, 9 );
					if ( this is Character )
						( this as Character ).AdjustBonii();
				}
				return a;
			}
			return null;
		}
Ejemplo n.º 9
0
		public Aura AddAura( Mobile from, AuraEffect ae, Aura a )
		{
			if ( this != from )
				this.OnGetHit( from, false, 1 );
			return AddAura( ae, a, false );
			
		}
Ejemplo n.º 10
0
		public Aura AddAura( Mobile from, AuraEffect ae, Aura a, bool offensive )
		{
			return AddAura( ae, a, offensive );
		}
Ejemplo n.º 11
0
			public AuraReleaseTimer( Mobile st, Aura ar, AuraEffect a, int n, int duration ) : base( duration, "AuraReleaseTimer" )
			{
				aura = ar;
				num = n;
				from = st;
				ae = a;
				Start();
			}
Ejemplo n.º 12
0
		public virtual void Mount( Mobile m )
		{
			this.MountModel = m.Model;

			int offset = 4;
			Converter.ToBytes( 1, tempBuff, ref offset );
			Converter.ToBytes( (byte)0, tempBuff, ref offset );				
			PrepareUpdateData( tempBuff, ref offset , UpdateType.UpdateFull, true );
			this.ToAllPlayerNearExceptMe( OpCodes.SMSG_UPDATE_OBJECT, tempBuff, offset );
			
			Aura aura = new Aura();
			aura.OnRelease = new Aura.AuraReleaseDelegate( this.OnUnMount );
			AddAura( mountedIdAuraEffect = (AuraEffect)World.MountsList[ m.Id ], aura );
		}
Ejemplo n.º 13
0
        public void MakeDMGSpellTriggers(Mobile src, Mobile target, LastSpellState state,int dmg)
        {
            int roll;
            #region Additional effects
            #region OnCriticalTalentsHandling
                if(state == LastSpellState.Critical)
                {
                    if(src.Level > 9)
                    {
                        switch (src.Classe)
                        {
                            #region mage
                            case Classes.Mage:
                                // ignite
                                if ( resistance == Resistances.Fire)
                                {
                                    if ( src.HaveTalent( Talents.Ignite ) )
                                    {
                                        AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Ignite );
                                        AuraEffect af = (AuraEffect)Abilities.abilities[12654];
                                        float modif = (float)ae.S1/100;
                                        af.ApplyDot(src, target, (int)(dmg*modif), af.T1, af.Duration(src));
                                    }
                                }
                                break;
                                #endregion
                            #region warrior
                            case Classes.Warrior:

                                break;
                                #endregion
                        }
                    }

                }
                #endregion
            #region Other Spell effecting Talents
                switch (src.Classe)
                {
                    #region mage
                    case Classes.Mage:
                        //Impact
                        if (state == LastSpellState.Normal)
                        {
                            if (src.HaveTalent(Talents.Impact))
                            {
                                if (this.resistance == Resistances.Fire)
                                {
                                    AuraEffect af = (AuraEffect)src.GetTalentEffect(Talents.Impact);
                                    roll = Utility.Random( 100 );
                                    if(roll < af.S1)
                                    {
                                        AuraEffect ef = (AuraEffect)Abilities.abilities[(int)af.AdditionalSpell];
                                        Aura aura = new Aura();
                                        aura.ForceStun = true;
                                        target.AddAura(src,ef,aura,true);
                                    }

                                }
                            }

                            // Improved Scorch
                            if ( src.HaveTalent( Talents.ImprovedScorch ) &&
                                SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 2948 ] )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedScorch);
                                roll = Utility.Random( 100 );
                                if(roll < ae.S1)
                                {
                                    AuraEffect ef = (AuraEffect)Abilities.abilities[(int)ae.AdditionalSpell];
                                    Aura aura = new Aura();
                                    aura.FireDamageTakenModifier = 1 + (float)ef.S1/100;
                                    target.AddAura(src,ef,aura,true);
                                }
                            }

                            // Arcane Concentration
                            int ClearingState = 0xd45a45;
                            if ( src.HaveTalent( Talents.ArcaneConcentration ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ArcaneConcentration);
                                roll = Utility.Random( 100 );
                                if(roll < ae.H)
                                {
                                    src.AdditionnalStates.Add(ClearingState);
                                }
                            }
                        }

                        break;
                    #endregion
                    #region Warlock
                    case Classes.Warlock:
                        ///aftewmatch
                        if ( AbilityClasses.abilityClasses[ (int)Id ] == (int)ClassesOfSpells.Destruction )
                            if ( src.HaveTalent( Talents.Aftermath ) )
                            {
                                AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.Aftermath );
                                if ( Utility.Random( 100 ) < ae.H )
                                {
                                    Aura aura = new Aura();
                                    aura.SpeedModifier = ( -( (float)ae.S1 ) / 100.0f );
                                    aura.OnRelease = new Aura.AuraReleaseDelegate( SpellTemplate.OnCastSpeedModEnd );
                                    target.AddAura(src, ae, aura, true );
                                    target.ChangeRunSpeed( target.RunSpeed );
                                }
                            }
                        // pyroclasm
                        if ( SpellTemplate.SpellEffects[ (int)Id ] == SpellTemplate.SpellEffects[ 1949 ] ||//Hell fire
                            SpellTemplate.SpellEffects[5740] == SpellTemplate.SpellEffects[ (int)Id ] )// Rain of fire
                            if ( src.HaveTalent( Talents.Pyroclasm ) )
                            {
                                int prob = 0;
                                if ( src.TalentLevel( Talents.Pyroclasm ) == 1 )
                                    prob = 13;
                                else
                                    prob = 26;
                                if ( Utility.Random( 100 ) < prob )
                                {
                                    Aura aura = new Aura();
                                    aura.ForceStun = true;
                                    target.AddAura( (AuraEffect)Abilities.abilities[ 18093 ], aura, true );
                                }
                            }
                        break;
                    #endregion
                }
            #endregion
            #endregion
        }
Ejemplo n.º 14
0
        public bool ImmuneCheck(Mobile target, Aura a)
        {
            // test for immunity for auras spells
            if (target.ImmuneAllSpellsAndAbilites)
                return true;
            if (this.resistance == Resistances.Fire)
                if (target.ImmuneFireSpell) return true;
            if (this.resistance == Resistances.Frost)
                if (target.ImmuneFrostSpell) return true;
            if (this.resistance == Resistances.Armor)
                if (target.ImmunePhysicalDamage) return true;

            switch ( this.dispeltype)
            {
                case DispelType.Magic : if (target.ImmuneMagic)	return true;break;
                case DispelType.Disease: if (target.ImmuneDisease) return true;break;
                case DispelType.Poison: if (target.ImmunePoison) return true;break;
            }

            if(a.ForceFlee)
                {
                    if (target.ImmuneToFear)
                        return true;
                }

                if (a.ForceRoot || a.ForceStun)
                {
                    if (target.ImmuneToImmobilization)
                        return true;
                }

                /*
                if(a.ForceDisarm)
                    {
                        if(target.ImmuneToDisarm)
                            return true;
                    }
                */

            return false;
        }
Ejemplo n.º 15
0
		public PermanentAura(Aura _aura, int _id)
		{
			aura = _aura;
			id = _id;
		}