Server.Items.Corpse.Open C# (CSharp) Méthode

Open() public méthode

public Open ( Server.Mobile from, bool checkSelfLoot ) : void
from Server.Mobile
checkSelfLoot bool
Résultat void
		public virtual void Open( Mobile from, bool checkSelfLoot )
		{
			if ( from.AccessLevel > AccessLevel.Player || from.InRange( this.GetWorldLocation(), 2 ) )
			{
				#region Self Looting
				if ( checkSelfLoot && from == m_Owner && !GetFlag( CorpseFlag.SelfLooted ) && this.Items.Count != 0 )
				{
					DeathRobe robe = from.FindItemOnLayer( Layer.OuterTorso ) as DeathRobe;

					if ( robe != null )
					{
						Map map = from.Map;

						if ( map != null && map != Map.Internal )
						{
							robe.MoveToWorld( from.Location, map );
							robe.BeginDecay();
						}
					}

					Container pack = from.Backpack;

					if ( m_RestoreEquip != null && pack != null )
					{
						List<Item> packItems = new List<Item>( pack.Items ); // Only items in the top-level pack are re-equipped

						for ( int i = 0; i < packItems.Count; i++ )
						{
							Item packItem = packItems[i];

							if ( m_RestoreEquip.Contains( packItem ) && packItem.Movable )
								from.EquipItem( packItem );
						}
					}

					List<Item> items = new List<Item>( this.Items );

					bool didntFit = false;

					for ( int i = 0; !didntFit && i < items.Count; ++i )
					{
						Item item = items[i];
						Point3D loc = item.Location;

						if ( ( item.Layer == Layer.Hair || item.Layer == Layer.FacialHair ) || !item.Movable || !GetRestoreInfo( item, ref loc ) )
							continue;

						if ( pack != null && pack.CheckHold( from, item, false, true ) )
						{
							item.Location = loc;
							pack.AddItem( item );

							if ( m_RestoreEquip != null && m_RestoreEquip.Contains( item ) )
								from.EquipItem( item );
						}
						else
						{
							didntFit = true;
						}
					}

					from.PlaySound( 0x3E3 );

					if ( this.Items.Count != 0 )
					{
						from.SendLocalizedMessage( 1062472 ); // You gather some of your belongings. The rest remain on the corpse.
					}
					else
					{
						SetFlag( CorpseFlag.Carved, true );

						if ( ItemID == 0x2006 )
						{
							ProcessDelta();
							SendRemovePacket();
							ItemID = Utility.Random( 0xECA, 9 ); // bone graphic
							Hue = 0;
							ProcessDelta();
						}

						from.SendLocalizedMessage( 1062471 ); // You quickly gather all of your belongings.
					}

					SetFlag( CorpseFlag.SelfLooted, true );
				}
				#endregion

				if ( !CheckLoot( from ) )
					return;

				base.OnDoubleClick( from );
			}
			else
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return;
			}
		}

Usage Example

Exemple #1
0
            protected override void OnTick()
            {
                if (m_Corpse.Deleted || m_Ghost.Deleted || m_Healer.Deleted)
                {
                    return;
                }

                if (!m_Healer.Alive)
                {
                    m_Healer.SendMessage("You were unable to finish your work before your died.");
                    return;
                }

                if (m_Healer.CheckSkill(SkillName.Healing, 40.0, 120.0))
                {
                    m_Ghost.Location = m_Corpse.Location;
                    m_Ghost.Resurrect();

                    if (m_Healer is TeiravonMobile && (((TeiravonMobile)m_Healer).IsCleric() || ((TeiravonMobile)m_Healer).IsDarkCleric() || ((TeiravonMobile)m_Healer).IsForester() || ((TeiravonMobile)m_Healer).IsPaladin()))
                    {
                        Titles.AwardExp((TeiravonMobile)(m_Healer), m_Ghost.Fame);
                    }
                    Titles.AwardFame(m_Ghost, -(m_Ghost.Fame / 15), true);
                    m_Corpse.Open(m_Ghost, true);
                    m_Ghost.Animate(m_Ghost.Body == 17 ? 2 : 21, 4, 1, false, false, 0);
                    m_Ghost.Emote("*Gasps back to life!*");
                    m_Ghost.PlaySound(m_Ghost.Female ? 0x319 : 0x429);
                    m_Healer.SendMessage("You revive the fallen!");
                    Titles.AwardFame(m_Healer, m_Ghost.Fame / 20, true);
                }
                else
                {
                    m_Healer.SendMessage("You were unable to revive the body.");
                }
            }
All Usage Examples Of Server.Items.Corpse::Open