Esempio n. 1
0
		public void ReleaseAura( AuraReleaseTimer art )
		{
			art.Stop();
			aura.Remove( art );
			if ( this is Character )
				( this as Character ).AdjustBonii();
			art.aura.Release( this );
			SendSmallUpdateToPlayerNearMe( 
		new int[] { (int)UpdateFields.UNIT_FIELD_AURA + art.num, 
					  (int)UpdateFields.UNIT_FIELD_AURALEVELS + ( art.num >> 2 ), 
					  (int)UpdateFields.UNIT_FIELD_AURAAPPLICATIONS + ( art.num >> 2 ), 
					  (int)UpdateFields.UNIT_FIELD_AURAFLAGS + ( art.num >> 3 ), 
					  (int)UpdateFields.UNIT_FIELD_AURASTATE }, 
				new object[] { 0, 0xdddddddd, 0x01010101, 0, 0x2 } );
		}
Esempio n. 2
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;
		}