Beispiel #1
0
        public static void TaxiMountAndMove(Character ch, TaxiPath path)
        {
            PathForTaxi taxiPFT = new PathForTaxi(path.Id,ch);
            int MountId = 0;
            foreach(Object o in ch.KnownObjects)
            {
                if(o is TaxiVendor)	if((o as TaxiVendor).MountId != 0)	MountId = (o as TaxiVendor).MountId;
            }
            if (MountId == 0) MountId = 1147;
            ch.MountModel = (int)MountId;
            ch.taxiOn = true;
            ch.GodMode = true;
            ch.UnInteractible = true;
            if(ch.Summon != null) ch.Summon.Freeze = true;
            ch.Speed = 20f;
            ch.RunSpeed = 40f;
            int offset = 4;
            Converter.ToBytes( 1, ch.tempBuff, ref offset );
            Converter.ToBytes( (byte)0, ch.tempBuff, ref offset );
            ch.PrepareUpdateData( ch.tempBuff, ref offset , UpdateType.UpdateFull, false );
            ch.Send( OpCodes.SMSG_UPDATE_OBJECT, ch.tempBuff, offset );
            ch.ItemsUpdate();

            ch.MoveTaxiTo(taxiPFT.T,taxiPFT.mapIds, taxiPFT.mapChange);
        }
Beispiel #2
0
		public void MoveTaxiTo( Trajet t,PathForTaxi.MapIds[] mapIds, int mapChange)
		{
			if (t.Count != 0)
			{
				if (mapChange == 0)
				{
					int offset = 4;
					float x = X - t[0].x;
					float y = Y - t[0].y;
					float z = Z - t[0].z;
					x *= x;
					y *= y;
					z *= z;
					x = (float)Math.Sqrt( x + y + z );
					float distTotale = x;
					for (int j = 0; j < t.Count - 1;j++)
					{
						x = t[j].x - t[j + 1].x;
						y = t[j].y - t[j + 1].y;
						z = t[j].z - t[j + 1].z;
						x *= x;
						y *= y;
						z *= z;
						distTotale += (float)Math.Sqrt( x + y + z );
					}
				
					float xd = (float)( distTotale / ( 37f / 1000 ) );
					int instantSpeed = (int)xd;
					byte []movePacket = new byte[ 60 + t.Count * 3 * 4 ];
					uint time = (uint)( DateTime.Now.Ticks - localTime );
					Converter.ToBytes( Guid, movePacket, ref offset );	
					Converter.ToBytes( (float)X, movePacket, ref offset );//	X
					Converter.ToBytes( (float)Y, movePacket, ref offset );//	Y
					Converter.ToBytes( (float)Z, movePacket, ref offset );//	Z			
					Converter.ToBytes( (float)this.Orientation, movePacket, ref offset );//	Z	
					Converter.ToBytes( (byte)0, movePacket, ref offset );//	Z	
			
					Converter.ToBytes( (uint)0x00000300, movePacket, ref offset );//	pas d'animation de mouvement, taxi node ?		
							
					Converter.ToBytes( (uint)instantSpeed, movePacket, ref offset );//	Z	
					Converter.ToBytes( (uint)distTotale, movePacket, ref offset );//	Z	
					foreach( Coord c in t )
					{
						Converter.ToBytes( (float)c.x, movePacket, ref offset );//	X
						Converter.ToBytes( (float)c.y, movePacket, ref offset );//	Y
						Converter.ToBytes( (float)c.z, movePacket, ref offset );//	Z
					}
					(this as Character).ToAllPlayerNear(  (OpCodes)0xDD, movePacket, offset );
					OnTaxiEndTimer onTaxiEndTimer = new OnTaxiEndTimer( instantSpeed,this as Character,t );
				}
				else
				{
					if (mapChange == 1 && mapIds[0].index == 0)
					{
						Coord cord = new Coord(this.X,this.Y,this.Z,null,null);
						Coord [] coords= new Coord[1];
						coords[0] = cord;
						Trajet t1 = new Trajet(coords);
						(this as Character).SendMessage("Not supported now");
						OnTaxiEndTimer onTaxiEndTimer1 = new OnTaxiEndTimer(0,this as Character,t1 );
						return;
						//(this as Character).Teleport(t[0].x,t[0].y,t[0].z,30);
						//t.RemoveAt(0);
						//this.MoveTaxiTo( t,mapIds, 0);	
					
					}
					int offset = 4;
					float x = X - t[0].x;
					float y = Y - t[0].y;
					float z = Z - t[0].z;
					x *= x;
					y *= y;
					z *= z;
					x = (float)Math.Sqrt( x + y + z );
					float distTotale = x;
					for (int j = 0; j < t.Count - 1;j++)
					{
						x = t[j].x - t[j + 1].x;
						y = t[j].y - t[j + 1].y;
						z = t[j].z - t[j + 1].z;
						x *= x;
						y *= y;
						z *= z;
						distTotale += (float)Math.Sqrt( x + y + z );
					}
				
					float xd = (float)( distTotale / ( 37f / 1000 ) );
					int instantSpeed = (int)xd;
					byte []movePacket = new byte[ 60 + t.Count * 3 * 4 ];
					uint time = (uint)( DateTime.Now.Ticks - localTime );
					Converter.ToBytes( Guid, movePacket, ref offset );	
					Converter.ToBytes( (float)X, movePacket, ref offset );//	X
					Converter.ToBytes( (float)Y, movePacket, ref offset );//	Y
					Converter.ToBytes( (float)Z, movePacket, ref offset );//	Z			
					Converter.ToBytes( (float)this.Orientation, movePacket, ref offset );//	Z	
					Converter.ToBytes( (byte)0, movePacket, ref offset );//	Z	
			
					Converter.ToBytes( (uint)0x00000300, movePacket, ref offset );//	pas d'animation de mouvement, taxi node ?		
							
					Converter.ToBytes( (uint)instantSpeed, movePacket, ref offset );//	Z	
					Converter.ToBytes( (uint)distTotale, movePacket, ref offset );//	Z	
					foreach( Coord c in t )
					{
						Converter.ToBytes( (float)c.x, movePacket, ref offset );//	X
						Converter.ToBytes( (float)c.y, movePacket, ref offset );//	Y
						Converter.ToBytes( (float)c.z, movePacket, ref offset );//	Z
					}
					(this as Character).ToAllPlayerNear(  (OpCodes)0xDD, movePacket, offset );
					OnTaxiEndTimer onTaxiEndTimer = new OnTaxiEndTimer( instantSpeed,this as Character,t );
				}
			}
			else
			{}
			
			//	Console.WriteLine( "Je vais mettre {0}", instantSpeed );
		}