Example #1
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 } );
		}
Example #2
0
		public virtual void OnDeath( Mobile by )
		{
			this.NextAttackEffects.Clear();
			by.NextAttackEffects.Clear();
			if( this.channelTarget )
				by.ChannelEnd();
			this.ChannelEnd();
			if ( MountModel != 0 )
			{
				if ( Mounting == null )
					Console.WriteLine("Npc {0} have an incorrect 'Mounting' value", this.Name );
				else
					World.Add( (BaseCreature)Mounting, X, Y, Z, MapId );
			}
			ReleaseAllAura();
			UpdateXYZ();
			if ( Faction == Factions.Darnasus || Faction == Factions.DarkspearTrolls ||
				Faction == Factions.GnomereganExiles || Faction == Factions.IronForge ||
				Faction == Factions.Ogrimmar || Faction ==  Factions.Stormwind ||
				Faction == Factions.ThunderBluff || Faction == Factions.Undercity || 
				(int)Faction < 12 )
			{
				if ( by is Character && by.Faction != this.Faction )
				{
					if( this.Level > by.Level + 8 )	
					{
						(by as Character).Honor.DishonorableKillsToday += 1;
						(by as Character).Honor.HonorToday -= 1;//(ushort)((by.Level-this.Level)/5);
					}
					else 
					{
						(by as Character).Honor.HonorableKillsToday += 1;
						(by as Character).Honor.HonorToday += 1;//(ushort)((by.Level-this.Level)/5);
					}				
				}
			}
			if ( !moveVector.NearDestination() )
				this.MoveTo( X, Y, Z );
			this.ReleaseAllAura();
			if ( by is Character )
				( by as Character ).CheckKills( this );
			else
				if ( by.summonedBy != null )
				( by.summonedBy as Character ).CheckKills( this );


			by.XpEarn( this );
			if ( SummonedBy != null )
			{
				SummonedBy.Summon = null;
				decay = new DecayTimer( this, 1 );
			}
			else
			{
				GenerateLoot();
				if ( Treasure != null && Treasure.Length > 0 && KnownObjects != null )//&& by is Character )
				{
					foreach( Object obj in this.KnownObjects )
					{
						if ( obj is Character )
						{
							if ( ( obj as Character ).SeeAnyLoot( by, Treasure ) )
								SendSmallUpdateToPlayer( obj as Character, new int[] { (int)UpdateFields.UNIT_FIELD_FLAGS, (int)UpdateFields.UNIT_DYNAMIC_FLAGS }, new object[] { (int)Flags, DynFlags( by ) + 1 } );
							else
								SendSmallUpdateToPlayer( obj as Character, new int[] { (int)UpdateFields.UNIT_FIELD_FLAGS, (int)UpdateFields.UNIT_DYNAMIC_FLAGS }, new object[] { Flags, DynFlags( by ) } );

						}
					}
				}
				else
					SendSmallUpdate( new int[] { (int)UpdateFields.UNIT_FIELD_FLAGS, (int)UpdateFields.UNIT_DYNAMIC_FLAGS }, new object[] { Flags, DynFlags( by ) } );
				decay = new DecayTimer( this, World.DecayTime );
			}
		}