当前位置: 首页>>代码示例>>C#>>正文


C# Mobile.EquipItem方法代码示例

本文整理汇总了C#中Mobile.EquipItem方法的典型用法代码示例。如果您正苦于以下问题:C# Mobile.EquipItem方法的具体用法?C# Mobile.EquipItem怎么用?C# Mobile.EquipItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mobile的用法示例。


在下文中一共展示了Mobile.EquipItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDoubleClick

        // nickfly|gorgan edits for equip method - start

        public override void OnDoubleClick(Mobile from)
        {
            if (!this.Movable)
            {
                from.SendMessage("That item cannot be moved, let alone equipped. Nice try.");
                return;
            }

            if (from.FindItemOnLayer(this.Layer) == this)
            {
                from.Backpack.DropItem(this);
                //from.SendMessage("");
                return;
            }

            if (Parent != from)
            {
                if (!from.InRange(this.GetWorldLocation(), 2))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 906, 1019045); //I can't reach that.
                    return;
                }
            }

            if (!from.Backpack.TryDropItem(from, this, false))
            {
                from.SendMessage("You don't have enough room in your backpack.");
                return;
            }

            if (this.Layer == Layer.TwoHanded)
            {
                from.Backpack.DropItem(from.FindItemOnLayer(Layer.TwoHanded));
                from.Backpack.DropItem(from.FindItemOnLayer(Layer.FirstValid));
                from.EquipItem(this);
                return;
            }

            if (from.FindItemOnLayer(this.Layer) != this)
            {
                from.Backpack.DropItem(from.FindItemOnLayer(this.Layer));
                from.EquipItem(this);
                //from.SendMessage("");
                return;
            }
        }
开发者ID:greeduomacro,项目名称:annox,代码行数:48,代码来源:BaseArmor.cs

示例2: OnDoubleClick

 public override void OnDoubleClick(Mobile from)
 {
     if (from.EquipItem(this) || IsChildOf(from))
     {
         from.PlaySound(0x166);
         from.PublicOverheadMessage(MessageType.Emote, 33, true, "*The Daemon claws demand a soul*");
         from.BeginTarget(-1, true, TargetFlags.None, OnTarget);
     }
     else
         from.SendAsciiMessage("You must equip the claws to use them");
 }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:11,代码来源:DaemonClaws.cs

示例3: OnDoubleClick

 public override void OnDoubleClick( Mobile m )
 {
    if( Parent != m )
    {
       m.SendMessage( "You must be wearing the robe to use it!" );
    }
    else
    {
       if ( ItemID == 0x2683 || ItemID == 0x2684 )
       {
          m.SendMessage( "You lower the hood." );
          m.PlaySound( 0x57 );
          ItemID = 0x1F03;
          m.NameMod = null;
          m.RemoveItem(this);
          m.EquipItem(this);
          if( m.Kills >= 5)
          {
          m.Criminal = true;
           }
           if( m.GuildTitle != null)
          {
             m.DisplayGuildTitle = true;
           }
       }
       else if ( ItemID == 0x1F03 || ItemID == 0x1F04 )
       {
          m.SendMessage( "You pull the hood over your head." );
          m.PlaySound( 0x57 );
          ItemID = 0x2683;
          m.DisplayGuildTitle = false;
          m.Criminal = false;
          m.RemoveItem(this);
          m.EquipItem(this);
       }
    }
 }
开发者ID:greeduomacro,项目名称:unknown-shard-1,代码行数:37,代码来源:Hood+Robe.cs

示例4: From

        public static void From(Mobile m)
        {
            if (m.Backpack == null)
                return;

            int key = m.Serial.Value;

            if (Config.AllowPlayerToggle && DisabledPlayers.Contains(key))
                return;

            Item weapon = m.FindItemOnLayer(Layer.OneHanded);

            if (weapon == null || !weapon.Movable)
                weapon = m.FindItemOnLayer(Layer.TwoHanded);

            Item lastWeapon = null;

            if (PlayerWeapons.ContainsKey(key))
                lastWeapon = PlayerWeapons[key];

            if (m.Warmode)
            {
                if ((weapon == null || AllowedToKeep(weapon)) && lastWeapon != null && lastWeapon.IsChildOf(m.Backpack) && lastWeapon.Movable && lastWeapon.Visible && !lastWeapon.Deleted)
                {
                    m.EquipItem(lastWeapon);

                    if (Config.SendOverheadMessage)
                        m.LocalOverheadMessage(Network.MessageType.Emote, m.EmoteHue, false, "*Unsheathes Weapon*");
                }
            }
            else
            {
                if (weapon != null && !AllowedToKeep(weapon))
                {
                    m.Backpack.DropItem(weapon);
                    PlayerWeapons[key] = weapon;

                    if (Config.SendOverheadMessage)
                        m.LocalOverheadMessage(Network.MessageType.Emote, m.EmoteHue, false, "*Sheathes Weapon*");
                }
            }
        }
开发者ID:FreeReign,项目名称:runuo-custom-scripts,代码行数:42,代码来源:AutoSheatheWeapon.cs

示例5: Open

		public virtual void Open( Mobile from, bool checkSelfLoot )
		{
            //You can not loot as soon as you open the bones, you have to wait 1.5 secs.
            //This is used to stop people from looting their own items right after they
            //die and get cut and should not interfer with normal players to much
            //Taran: This caused too much annoyance so I removed it

            //if (m_ViewedBy != null && from.AccessLevel == AccessLevel.Player && Owner is PlayerMobile && Carved && !m_ViewedBy.Contains(from))
            //    from.NextActionTime = DateTime.Now + TimeSpan.FromSeconds(1.5);

			if ( from.AccessLevel > AccessLevel.Player || (from.InRange( GetWorldLocation(), 2 ) && from.InLOS(this)) )
			{
                #region Self Looting
                if (checkSelfLoot && from == m_Owner && !GetFlag(CorpseFlag.SelfLooted) && Items.Count != 0 && !GetFlag(CorpseFlag.Carved) && m_Looters.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);

                    if (!m_Looters.Contains(from)) //Add looter flag when self looting
                        m_Looters.Add(from);
                }
                #endregion

                if (!CheckLoot(from, null))
					return;
//.........这里部分代码省略.........
开发者ID:FreeReign,项目名称:imaginenation,代码行数:101,代码来源:Corpse.cs

示例6: EQUIP

			public static bool EQUIP(TriggerObject trigObject, Mobile mob, Item item)
			{
				if (mob == null || item == null || item.Deleted || item.Layer == Layer.Invalid)
				{
					return false;
				}

				Item currentlyEquipped = mob.FindItemOnLayer(item.Layer);

				if (currentlyEquipped != null && !currentlyEquipped.Deleted)
				{
					mob.AddToBackpack(currentlyEquipped);
				}

				return mob.EquipItem(item);
			}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:16,代码来源:UberScriptFunctions.cs

示例7: RandomPoorClothes

        public static void RandomPoorClothes( Mobile m, Nation nation )
        {
            if( m == null )
                return;

            int choice = Utility.RandomMinMax( 0, 2 );

            switch (nation)
            {
                case Nation.Imperial: { if (Utility.RandomBool()) { nation = Nation.Vhalurian; } else { nation = Nation.Khemetar; } break; }
                case Nation.Sovereign: { if (Utility.RandomBool()) { nation = Nation.Alyrian; } else { nation = Nation.Mhordul; } break; }
                case Nation.Society: { if (Utility.RandomBool()) { nation = Nation.Azhuran; } else { nation = Nation.Tyrean; } break; }
                case Nation.Insularii: { if (Utility.RandomBool()) { nation = Nation.Vhalurian; } else { nation = Nation.Khemetar; } break; }
            }

            switch( nation )
            {
                case Nation.Alyrian:
                {
                    if( m.Female )
                    {
                        switch( choice )
                        {
                            case 0: m.EquipItem( new FemaleKilt( Utility.RandomNeutralHue() ) ); break;
                            case 1: m.EquipItem( new ElegantFemaleKilt( Utility.RandomNeutralHue() ) ); break;
                            case 2: m.EquipItem( new LongSkirt( Utility.RandomNeutralHue() ) ); break;
                        }

                        if( choice < 2 )
                        {
                            m.EquipItem( new MetallicBra() );
                            m.EquipItem( new ElegantShoes() );
                        }

                        else
                        {
                            m.EquipItem( new Sandals() );
                            m.EquipItem( new Shirt() );
                        }
                    }

                    else
                    {
                        switch( choice )
                        {
                            case 0: m.EquipItem( new ElegantKilt( Utility.RandomNeutralHue() ) ); break;
                            case 1: m.EquipItem( new PlainKilt( Utility.RandomNeutralHue() ) ); break;
                            case 2: m.EquipItem( new Kilt( Utility.RandomNeutralHue() ) ); break;
                        }

                        if( choice > 0 )
                        {
                            m.EquipItem( new Sandals() );
                        }

                        else
                        {
                            m.EquipItem( new LeatherBoots() );
                        }
                    }

                    break;
                }

                case Nation.Azhuran:
                {
                    if( m.Female )
                    {
                        switch( choice )
                        {
                            case 0: m.EquipItem( new WaistCloth( Utility.RandomNeutralHue() ) ); break;
                            case 1: m.EquipItem( new ElegantWaistCloth( Utility.RandomNeutralHue() ) ); break;
                            case 2: m.EquipItem( new LoinCloth( Utility.RandomNeutralHue() ) ); break;
                        }

                        m.EquipItem( new Sandals() );
                        m.EquipItem( new MetallicBra() );
                    }

                    else
                    {
                        switch( choice )
                        {
                            case 0: m.EquipItem( new WaistCloth( Utility.RandomNeutralHue() ) ); break;
                            case 1: m.EquipItem( new ElegantWaistCloth( Utility.RandomNeutralHue() ) ); break;
                            case 2: m.EquipItem( new OrnateWaistCloth( Utility.RandomNeutralHue() ) ); break;
                        }

                        m.EquipItem( new Sandals() );
                    }

                    break;
                }

                case Nation.Khemetar:
                {
                    if( m.Female )
                    {
                        switch( choice )
                        {
//.........这里部分代码省略.........
开发者ID:justdanofficial,项目名称:khaeros,代码行数:101,代码来源:BaseKhaerosMobile.cs

示例8: EquipItem

	    private static void EquipItem( Item item, bool mustEquip, Mobile m )
		{
			if ( !Core.AOS )
				item.LootType = LootType.Blessed;

			if ( m != null && m.EquipItem( item ) )
				return;

	        Container pack = null;

            if (m != null)
			    pack = m.Backpack;
 
			if ( !mustEquip && pack != null )
				pack.DropItem( item );
			else
				item.Delete();
		}
开发者ID:rberiot,项目名称:imaginenation,代码行数:18,代码来源:CharacterCreation.cs

示例9: Refresh

		public void Refresh( Mobile mob, Container cont )
		{
			if ( !mob.Alive )
			{
				mob.Resurrect();

				DeathRobe robe = mob.FindItemOnLayer( Layer.OuterTorso ) as DeathRobe;

				if ( robe != null )
					robe.Delete();

				if ( cont is Corpse )
				{
					Corpse corpse = (Corpse) cont;

					for ( int i = 0; i < corpse.EquipItems.Count; ++i )
					{
						Item item = corpse.EquipItems[i];

						if ( item.Movable && item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.IsChildOf( mob.Backpack ) )
							mob.EquipItem( item );
					}
				}
			}

			mob.Hits = mob.HitsMax;
			mob.Stam = mob.StamMax;
			mob.Mana = mob.ManaMax;

			mob.Poison = null;
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:31,代码来源:DuelContext.cs

示例10: RandomGuardEquipment

        public static void RandomGuardEquipment( Mobile m, Nation nation, int choice )
        {
            if( m == null )
                return;

            if( choice > 3 || choice < 1 )
                choice = Utility.RandomMinMax( 0, 2 );
            else
                choice--;

            switch (nation)
            {
                case Nation.Imperial: { if (Utility.RandomBool()) { nation = Nation.Vhalurian; } else { nation = Nation.Khemetar; } break; }
                case Nation.Sovereign: { if (Utility.RandomBool()) { nation = Nation.Alyrian; } else { nation = Nation.Mhordul; } break; }
                case Nation.Society: { if (Utility.RandomBool()) { nation = Nation.Azhuran; } else { nation = Nation.Tyrean; } break; }
                case Nation.Insularii: { if (Utility.RandomBool()) { nation = Nation.Vhalurian; } else { nation = Nation.Khemetar; } break; }
            }

            switch( nation )
            {
                case Nation.Alyrian:
                {
                    GreenBeret greenberet = new GreenBeret();
                    greenberet.Hue = 2587;
                    m.EquipItem( greenberet );

                    switch( choice )
                    {
                        case 0:
                        {
                            AlyrianChainChest chest = new AlyrianChainChest();
                            chest.Resource = CraftResource.Bronze;

                            AlyrianChainLegs legs = new AlyrianChainLegs();
                            legs.Resource = CraftResource.Bronze;

                            AlyrianChainArms arms = new AlyrianChainArms();
                            arms.Resource = CraftResource.Bronze;

                            AlyrianChainGorget gorget = new AlyrianChainGorget();
                            gorget.Resource = CraftResource.Bronze;

                            m.EquipItem( chest );
                            m.EquipItem( legs );
                            m.EquipItem( arms );
                            m.EquipItem( gorget );
                            m.EquipItem( new Cloak( 2587 ) );

                            if( m.Female )
                            {
                                AlyrianLeafShield shield = new AlyrianLeafShield();
                                shield.Resource = CraftResource.Bronze;

                                AlyrianSabre sabre = new AlyrianSabre();
                                sabre.Resource = CraftResource.Bronze;

                                m.EquipItem( shield );
                                m.EquipItem( sabre );
                                m.EquipItem( new FemaleKilt( 2587 ) );
                            }

                            else
                            {
                                AlyrianTwoHandedAxe axe = new AlyrianTwoHandedAxe();
                                axe.Resource = CraftResource.Bronze;

                                m.EquipItem( axe );
                                m.EquipItem( new ElegantKilt( 2587 ) );
                            }

                            break;
                        }

                        case 1:
                        {
                            if( m.Female )
                            {
                                AlyrianRoundShield shield = new AlyrianRoundShield();
                                shield.Resource = CraftResource.Bronze;

                                AlyrianLongsword sword = new AlyrianLongsword();
                                sword.Resource = CraftResource.Bronze;

                                m.EquipItem( shield );
                                m.EquipItem( sword );
                                m.EquipItem( new ElegantFemaleKilt( 2587 ) );
                                m.EquipItem( new MetallicBra() );
                                m.EquipItem( new ElegantShoes() );
                            }

                            else
                            {
                                AlyrianClaymore sword = new AlyrianClaymore();
                                sword.Resource = CraftResource.Bronze;

                                m.EquipItem( sword );
                                m.EquipItem( new OrnateKilt( 2587 ) );
                                m.EquipItem( new Sandals() );
                            }

//.........这里部分代码省略.........
开发者ID:justdanofficial,项目名称:khaeros,代码行数:101,代码来源:BaseKhaerosMobile.cs

示例11: MoveEquip

        private static void MoveEquip( Mobile from, Mobile to, bool fromBackpack)
        {
            Item item;

            for ( int i = 0; i < m_DesiredLayerOrder.Length; ++i )
            {
                item = to.FindItemOnLayer( m_DesiredLayerOrder[i] );
                if ( item != null )
                    item.Bounce(to);

                item = from.FindItemOnLayer( m_DesiredLayerOrder[i] );
                if( item != null )
                {
                    to.EquipItem(item);
                }
            }

            //Backpack
            if ( from.Backpack != null && !(from.Backpack is VendorBackpack) && fromBackpack )
            {

                if ( to.Backpack == null )
                    to.EquipItem( new Backpack() );

                ArrayList itemsToMove = new ArrayList();

                for (int i = 0; i < from.Backpack.Items.Count;++i)
                {
                    item = (Item)from.Backpack.Items[i];

                    if( item != null && !item.Deleted && item.LootType != LootType.Newbied && item.LootType != LootType.Blessed )
                    {
                        itemsToMove.Add( item );
                    }
                }

                for ( int i = 0; i < itemsToMove.Count; ++i)
                {
                    to.Backpack.DropItem((Item)itemsToMove[i]);
                }
                itemsToMove.Clear();

            }
        }
开发者ID:Telm,项目名称:RunUO_EME,代码行数:44,代码来源:Control.cs

示例12: Open

        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 );

                        this.Delete();

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

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

                if ( !CheckLoot( from, null ) )
                    return;

                #region Quests
                PlayerMobile player = from as PlayerMobile;

                if ( player != null )
                {
                    QuestSystem qs = player.Quest;

                    if ( qs is UzeraanTurmoilQuest )
                    {
                        GetDaemonBoneObjective obj = qs.FindObjective( typeof( GetDaemonBoneObjective ) ) as GetDaemonBoneObjective;

                        if ( obj != null && obj.CorpseWithBone == this && ( !obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone( player ) ) )
                        {
                            Item bone = new QuestDaemonBone();

                            if ( player.PlaceInBackpack( bone ) )
                            {
//.........这里部分代码省略.........
开发者ID:felladrin,项目名称:last-wish,代码行数:101,代码来源:Corpse.cs

示例13: Open

		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;
			}
		}
开发者ID:Grimoric,项目名称:RunUO.T2A,代码行数:98,代码来源:Corpse.cs

示例14: OnDoubleClick

        public override void OnDoubleClick(Mobile from)
        {
            // if not a player
            Mobile m_Mob = (Mobile)from;
            AccessLevel al_MobLevel = m_Mob.AccessLevel;
            Account a_Account = (Account)m_Mob.Account;
            AccessLevel al_AccLevel = a_Account.AccessLevel;
            if (al_AccLevel > AccessLevel.Player)
            {
                // if not already possessing a mobile
                if (!m_Possessing)
                {
                    from.SendMessage("Who or What do you want to possess?");
                    from.Target = new InternalTarget(this);
                }
                // restore your self and unhide the previously possessed mobile
                else
                {
                    // restore basics
                    m_Possessing = false;
                    from.Karma = m_Karma;
                    from.Fame = m_Fame;
                    from.Name = m_Name;
                    from.Title = m_Title;
                    from.Hue = m_Hue;
                    from.BodyValue = m_BodyValue;
                    from.Female = m_Female;
                    from.Hidden = true;
                    // Delete eveything you have equipped which is just a copy of what the NPC had   
                    ArrayList equipitems = new ArrayList(from.Items);
                    foreach (Item item in equipitems)
                    {
                        if ((item.Layer != Layer.Bank) && (item.Layer != Layer.Backpack))
                            item.Delete();
                    }
                    // get dressed and delete that white backpack
                    for (int i = m_Stuff.Items.Count - 1; i >= 0; --i)
                    {
                        if (i >= m_Stuff.Items.Count)
                            continue;
                        from.EquipItem((Item)m_Stuff.Items[i]);
                    }
                    // do we really want to delete the backpack?
                    m_Stuff.Delete();

                    // get your location, orient, enabale and show the mobile
                    Point3D from_Location = new Point3D(from.Location.X, from.Location.Y, from.Location.Z);
                    if (m_Possessed != null)
                    {
                        m_Possessed.Direction = from.Direction;
                        m_Possessed.MoveToWorld(from_Location, from.Map);
                        m_Possessed.Hidden = false;
                        m_Possessed.CantWalk = false;
                    }

                }
            }
            else // somehow a player got one of these which should never happen, just delete it and put a scare into them
            {
                from.SendMessage("You are trying to access a restricted item. The item has been removed and your account has been scheduled for deletion.");
                this.Delete();
            }

        }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:64,代码来源:Possess+Stone.cs

示例15: SphereDoubleClick

        //Maka : fix the bad code practise
        public void SphereDoubleClick(Mobile from)
        {

            if (Parent == null)
                SpellHelper.Turn(from, this);

            //Maka : New layers
            if (from.FindItemOnLayer(Layer.FirstValid) != null && from.FindItemOnLayer(Layer.FirstValid) != this)
            {
                Item i = from.FindItemOnLayer(Layer.FirstValid);

                if (i != null)
                {
                    from.SendAsciiMessage(string.Format("You put the {0} in your pack.", Sphere.ComputeName(i)));
                    from.AddToBackpack(i);
                }
            }

            if (from.FindItemOnLayer(Layer) != null && from.FindItemOnLayer(Layer) != this)
            {
                Item i = from.FindItemOnLayer(Layer);

                //Is it a shield
                if (i is BaseArmor)
                {
                    from.SendAsciiMessage(string.Format("You put the {0} in your pack.", Sphere.ComputeName(i)));
                    from.AddToBackpack(i);

                    //If its a shield, is he holding a weap
                    i = from.FindItemOnLayer(Layer.OneHanded);

                    if (i != null)
                    {
                        from.SendAsciiMessage(string.Format("You put the {0} in your pack.", Sphere.ComputeName(i)));
                        from.AddToBackpack(i);
                    }
                }
                else
                {
                    i = from.FindItemOnLayer(Layer);

                    from.SendAsciiMessage(string.Format("You put the {0} in your pack.", Sphere.ComputeName(i)));

                    from.AddToBackpack(i);
                }

                from.EquipItem(this);
                from.PlaySound(0x57);
            }
            else if (Layer == Layer.OneHanded && from.FindItemOnLayer(Layer.TwoHanded) != null || Layer == Layer.TwoHanded && from.FindItemOnLayer(Layer.OneHanded) != null)
            {
                Item i = from.FindItemOnLayer(Layer.TwoHanded);

                if (i != null && !(i is BaseShield))
                {
                    from.SendAsciiMessage(string.Format("You put the {0} in your pack.", Sphere.ComputeName(i)));
                    from.AddToBackpack(i);
                }

                from.EquipItem(this);
            }
            else if (Layer == Layer.TwoHanded && from.FindItemOnLayer(Layer.OneHanded) != null)
            {
                Item i = from.FindItemOnLayer(Layer.OneHanded);

                if (i != null)
                {
                    from.SendAsciiMessage(string.Format("You put the {0} in your pack.", Sphere.ComputeName(i)));
                    from.AddToBackpack(i);
                }

                from.EquipItem(this);
            }
            else
                from.EquipItem(this);
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:77,代码来源:BaseTool.cs


注:本文中的Mobile.EquipItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。