public virtual void Kill() { if ( !CanBeDamaged() ) return; else if ( !Alive || IsDeadBondedPet ) return; else if ( m_Deleted ) return; else if ( !Region.OnDeath( this ) ) return; else if ( !OnBeforeDeath() ) return; BankBox box = FindBankNoCreate(); if ( box != null && box.Opened ) box.Close(); if ( m_NetState != null ) m_NetState.CancelAllTrades(); if ( m_Spell != null ) m_Spell.OnCasterKilled(); //m_Spell.Disturb( DisturbType.Kill ); if ( m_Target != null ) m_Target.Cancel( this, TargetCancelType.Canceled ); DisruptiveAction(); Warmode = false; DropHolding(); Hits = 0; Stam = 0; Mana = 0; Poison = null; Combatant = null; if ( Paralyzed ) { Paralyzed = false; if ( m_ParaTimer != null ) m_ParaTimer.Stop(); } if ( Frozen ) { Frozen = false; if ( m_FrozenTimer != null ) m_FrozenTimer.Stop(); } ArrayList content = new ArrayList(); ArrayList equip = new ArrayList(); ArrayList moveToPack = new ArrayList(); ArrayList itemsCopy = new ArrayList( m_Items ); Container pack = this.Backpack; for ( int i = 0; i < itemsCopy.Count; ++i ) { Item item = (Item)itemsCopy[i]; if ( item == pack ) continue; DeathMoveResult res = GetParentMoveResultFor( item ); switch ( res ) { case DeathMoveResult.MoveToCorpse: { content.Add( item ); equip.Add( item ); break; } case DeathMoveResult.MoveToBackpack: { moveToPack.Add( item ); break; } } } if ( pack != null ) { ArrayList packCopy = new ArrayList( pack.Items ); for ( int i = 0; i < packCopy.Count; ++i ) { Item item = (Item)packCopy[i]; DeathMoveResult res = GetInventoryMoveResultFor( item ); if ( res == DeathMoveResult.MoveToCorpse ) content.Add( item ); else moveToPack.Add( item ); } for ( int i = 0; i < moveToPack.Count; ++i ) { Item item = (Item)moveToPack[i]; if ( RetainPackLocsOnDeath && item.Parent == pack ) continue; pack.DropItem( item ); } } Container c = ( m_CreateCorpse == null ? null : m_CreateCorpse( this, content, equip ) ); /*m_Corpse = c; for ( int i = 0; c != null && i < content.Count; ++i ) c.DropItem( (Item)content[i] ); if ( c != null ) c.MoveToWorld( this.Location, this.Map );*/ if ( m_Map != null ) { Packet animPacket = null;//new DeathAnimation( this, c ); Packet remPacket = null;//this.RemovePacket; IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location ); foreach ( NetState state in eable ) { if ( state != m_NetState ) { if ( animPacket == null ) animPacket = new DeathAnimation( this, c ); state.Send( animPacket ); if ( !state.Mobile.CanSee( this ) ) { if ( remPacket == null ) remPacket = this.RemovePacket; state.Send( remPacket ); } } } eable.Free(); } OnDeath( c ); }