コード例 #1
0
        public static bool CanUse(Mobile from, Item toUse)
        {
            if (from == null || toUse == null)
            {
                return(false);
            }

            if (from.Frozen)
            {
                from.SendAsciiMessage("You are frozen and you cannot do that.");
            }
            else if (!toUse.Movable)
            {
                from.SendAsciiMessage("You can't use that.");
            }
            else if (!toUse.IsChildOf(from.Backpack) && toUse.Parent != from && !from.InRange(toUse.Location, 4) && !toUse.IsChildOf(from.BankBox) && !from.BankBox.Opened)
            {
                from.SendAsciiMessage("You can't reach that.");
            }
            else if (!from.InLOS(toUse) && !toUse.IsChildOf(from.BankBox) && !from.BankBox.Opened)
            {
                from.SendAsciiMessage("You can't see that.");
            }
            else
            {
                return(toUse.CanEquip(from));
            }

            return(false);
        }
コード例 #2
0
ファイル: Mobile.cs プロジェクト: BackupTheBerlios/sunuo-svn
        public virtual bool EquipItem( Item item )
        {
            if ( item == null || item.Deleted || !item.CanEquip( this ) )
                return false;

            if ( CheckEquip( item ) && OnEquip( item ) && item.OnEquip( this ) )
            {
                if ( m_Spell != null && !m_Spell.OnCasterEquiping( item ) )
                    return false;

                //if ( m_Spell != null && m_Spell.State == SpellState.Casting )
                //	m_Spell.Disturb( DisturbType.EquipRequest );

                AddItem( item );
                return true;
            }

            return false;
        }
コード例 #3
0
ファイル: Mobile.cs プロジェクト: Ravenwolfe/xrunuo
        public bool EquipItem( Item item )
        {
            if ( item == null || item.Deleted || !item.CanEquip( this ) )
                return false;

            if ( CheckEquip( item ) && OnEquip( item ) && item.OnEquip( this ) )
            {
                if ( m_Spell != null && !m_Spell.OnCasterEquiping( item ) )
                    return false;

                AddItem( item );
                item.OnAfterEquip( this );
                return true;
            }

            return false;
        }
コード例 #4
0
ファイル: Sphere.cs プロジェクト: FreeReign/imaginenation
		public static bool CanUse( Mobile from, Item toUse )
		{
			if( from == null || toUse == null )
				return false;

			if( from.Frozen )
				from.SendAsciiMessage( "You are frozen and you cannot do that." );
			else if( !toUse.Movable )
				from.SendAsciiMessage( "You can't use that." );
			else if( !toUse.IsChildOf( from.Backpack ) && toUse.Parent != from && !from.InRange( toUse.Location, 4 ) && !toUse.IsChildOf( from.BankBox ) && !from.BankBox.Opened )
				from.SendAsciiMessage( "You can't reach that." );
			else if( !from.InLOS( toUse ) && !toUse.IsChildOf( from.BankBox ) && !from.BankBox.Opened )
				from.SendAsciiMessage( "You can't see that." );
			else
				return toUse.CanEquip( from );

			return false;
		}