Exemple #1
0
		public override void Execute( CommandEventArgs args, object o )
		{
			if( o is AddonComponent )
			{
				BaseAddon addon = ((AddonComponent)o).Addon;

				if( addon.Components.Count > 0 )
				{
					for( int i = 0; i < addon.Components.Count; i++ )
					{
						AddonComponent component = addon.Components[i];
						Item newItem = new Item( component.ItemID );

						newItem.Hue = component.Hue;
						newItem.Light = component.Light;
						newItem.Movable = true;
						newItem.Name = component.Name;

						newItem.MoveToWorld( component.Location, component.Map );
					}
				}

				addon.Delete();

				AddResponse( "The add-on has been converted into individual items." );
			}
			else if( o is Item )
			{
				Item i = (Item)o;
				Item newItem = new Item( i.ItemID );

				newItem.Hue = i.Hue;
				newItem.Layer = i.Layer;
				newItem.Light = i.Light;
				newItem.Movable = true;
				newItem.Name = i.Name;

				newItem.MoveToWorld( i.Location, i.Map );

				if( i.Parent == args.Mobile )
					newItem.Bounce( args.Mobile );

				if( i is Container )
					((Container)i).Destroy();
				else
					i.Delete();

				AddResponse( "The item has been converted to an item." );
			}
			else
			{
				LogFailure( "This command only works with item objects." );
			}
		}
Exemple #2
0
		public override void Execute( Server.Commands.CommandEventArgs args, object o )
		{
			if( o is AddonComponent )
			{
				BaseAddon addon = ((AddonComponent)o).Addon;
				
				if( addon.Components.Count > 0 )
				{
					for( int i = 0; i < addon.Components.Count; i++ )
					{
						AddonComponent component = (addon.Components)[i];
                        Item newItem = new Item( component.ItemID) {Hue = component.Hue, Name = component.Name};

					    newItem.MoveToWorld( new Point3D( component.Location ), component.Map );
					}
				}
				
				addon.Delete();
				
				AddResponse( "The add-on has been converted to an item." );
			}
			else if( o is Static )
			{
				Static s = (Static)o;
				Item newItem = new Item( s.ItemID ) {Hue = s.Hue, Layer = s.Layer, Light = s.Light, Name = s.Name};

			    newItem.MoveToWorld( new Point3D( s.Location ), s.Map );
				
				if( s.Parent == args.Mobile )
					newItem.Bounce( args.Mobile );

				s.Delete();
				
				AddResponse( "The static has been converted to an item." );
			}
			else
			{
				LogFailure( "This command only works with static items or add-ons." );
			}
		}
Exemple #3
0
		public override bool OnDragDrop( Mobile from, Item item )
		{
			if( item is BasePotion )
			{
				BasePotion pot = (BasePotion)item;
				int toHold = Math.Min( 100 - m_Held, pot.Amount );


				if( toHold <= 0 )
				{
					from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
					return false;
				}
				else if( m_Held == 0 )
				{
					if( GiveBottle( from, toHold ) )
					{
						m_Type = pot.PotionEffect;
						Held = toHold;

						from.PlaySound( 0x240 );

						from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.

						item.Consume( toHold );

						if( !item.Deleted )
							item.Bounce( from );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
						return false;
					}
				}
				else if( pot.PotionEffect != m_Type )
				{
					from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
					return false;
				}
				else
				{
					if( GiveBottle( from, toHold ) )
					{
						Held += toHold;

						from.PlaySound( 0x240 );

						from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.

						item.Consume( toHold );

						if( !item.Deleted )
							item.Bounce( from );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
						return false;
					}
				}
			}
			else
			{
				from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
				return false;
			}
		}