Beispiel #1
0
        private static void BuildRugBox_Callback(Mobile from, Map map, Point3D start, Point3D end, object state)
        {
            BrownRugDeed m_Deed = state as BrownRugDeed;

            if (m_Deed.Deleted)
            {
                return;
            }

            if (m_Deed.IsChildOf(from.Backpack))
            {
                Rectangle2D rect = new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1);

                if (rect.Width < 3 || rect.Height < 3)
                {
                    from.SendMessage("The carpet is too small. It should be longer or wider than that.");
                    return;
                }

                BaseAddon addon = new BrownRugAddon(rect);

                BaseHouse house = null;

                AddonFitResult res = addon.CouldFit(start, map, from, ref house);

                if (res == AddonFitResult.Valid)
                {
                    addon.MoveToWorld(start, map);
                }
                else if (res == AddonFitResult.Blocked)
                {
                    from.SendLocalizedMessage(500269);                       // You cannot build that there.
                }
                else if (res == AddonFitResult.NotInHouse)
                {
                    from.SendLocalizedMessage(500274);                       // You can only place this in a house that you own!
                }
                else if (res == AddonFitResult.DoorsNotClosed)
                {
                    from.SendMessage("You must close all house doors before placing this.");
                }
                else if (res == AddonFitResult.DoorTooClose)
                {
                    from.SendLocalizedMessage(500271);                       // You cannot build near the door.
                }
                if (res == AddonFitResult.Valid)
                {
                    m_Deed.Delete();

                    //if ( house != null )
                    //{
                    //foreach ( Server.Multis.BaseHouse h in house )
                    house.Addons.Add(addon);
                    //}
                }
                else
                {
                    addon.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
		private static void BuildRugBox_Callback( Mobile from, Map map, Point3D start, Point3D end, object state )
		{
			BrownRugDeed m_Deed = state as BrownRugDeed;

			if ( m_Deed.Deleted )
				return;

			if ( m_Deed.IsChildOf( from.Backpack ) )
			{
				Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );

				if ( rect.Width < 3 || rect.Height < 3 )
				{
					from.SendMessage( "The carpet is too small. It should be longer or wider than that." );
					return;
				}

				BaseAddon addon = new BrownRugAddon( rect );

				BaseHouse house = null;

				AddonFitResult res = addon.CouldFit( start, map, from, ref house );

				if ( res == AddonFitResult.Valid )
					addon.MoveToWorld( start, map );
				else if ( res == AddonFitResult.Blocked )
					from.SendLocalizedMessage( 500269 ); // You cannot build that there.
				else if ( res == AddonFitResult.NotInHouse )
					from.SendLocalizedMessage( 500274 ); // You can only place this in a house that you own!
				else if ( res == AddonFitResult.DoorsNotClosed )
					from.SendMessage( "You must close all house doors before placing this." );
				else if ( res == AddonFitResult.DoorTooClose )
					from.SendLocalizedMessage( 500271 ); // You cannot build near the door.
					
				if ( res == AddonFitResult.Valid )
				{
					m_Deed.Delete();

					//if ( house != null )
					//{
						//foreach ( Server.Multis.BaseHouse h in house )
							house.Addons.Add( addon );
					//}
				}
				else
				{
					addon.Delete();
				}
			}
			else
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
		}