private void ExtractCustomMulti(HouseFoundation house)
        {
            _extractedMultiIds.Add(house.Serial.Value);

            for(int x=0; x < house.Components.Width; ++x)
            {
                for(int y=0; y < house.Components.Height; ++y)
                {
                    Tile[] tiles = house.Components.Tiles[x][y];

                    for ( int i = 0; i < tiles.Length; ++i )
                    {
                        DesignItem designItem = new DesignItem();
                        designItem.ItemID = (short)(tiles[i].ID ^ 0x4000);

                        designItem.X = x + house.Sign.Location.X;
                        designItem.Y = (y + house.Sign.Location.Y) - (house.Components.Height - 1);
                        designItem.Z = house.Location.Z + tiles[i].Z;

                        _items.Add(designItem);
                    }

                }
            }

            DesignItem sign = new DesignItem();
            sign.ItemID = (short)(house.Sign.ItemID);

            sign.X = house.Sign.Location.X;
            sign.Y = house.Sign.Location.Y;
            sign.Z = house.Sign.Location.Z;

            _items.Add(sign);
        }
        public BeginHouseCustomization( HouseFoundation house )
            : base(0xBF)
        {
            EnsureCapacity( 17 );

            m_Stream.Write( (short) 0x20 );
            m_Stream.Write( (int) house.Serial );
            m_Stream.Write( (byte) 0x04 );
            m_Stream.Write( (ushort) 0x0000 );
            m_Stream.Write( (ushort) 0xFFFF );
            m_Stream.Write( (ushort) 0xFFFF );
            m_Stream.Write( (byte) 0xFF );
        }
Esempio n. 3
0
        public ConfirmCommitGump( Mobile from, HouseFoundation foundation, int bankBalance, int oldPrice, int newPrice )
            : base(50, 50)
        {
            m_Foundation = foundation;

            AddPage( 0 );

            AddBackground( 0, 0, 320, 320, 5054 );

            AddImageTiled( 10, 10, 300, 20, 2624 );
            AddImageTiled( 10, 40, 300, 240, 2624 );
            AddImageTiled( 10, 290, 300, 20, 2624 );

            AddAlphaRegion( 10, 10, 300, 300 );

            AddHtmlLocalized( 10, 10, 300, 20, 1062060, 32736, false, false ); // <CENTER>COMMIT DESIGN</CENTER>

            AddHtmlLocalized( 10, 40, 300, 140, (newPrice - oldPrice) <= bankBalance ? 1061898 : 1061903, 1023, false, true );

            AddHtmlLocalized( 10, 190, 150, 20, 1061902, 32736, false, false ); // Bank Balance:
            AddLabel( 170, 190, 55, bankBalance.ToString() );

            AddHtmlLocalized( 10, 215, 150, 20, 1061899, 1023, false, false ); // Old Value:
            AddLabel( 170, 215, 90, oldPrice.ToString() );

            AddHtmlLocalized( 10, 235, 150, 20, 1061900, 1023, false, false ); // Cost To Commit:
            AddLabel( 170, 235, 90, newPrice.ToString() );

            if ( newPrice - oldPrice < 0 )
            {
                AddHtmlLocalized( 10, 260, 150, 20, 1062059, 992, false, false ); // Your Refund:
                AddLabel( 170, 260, 70, (oldPrice - newPrice).ToString() );
            }
            else
            {
                AddHtmlLocalized( 10, 260, 150, 20, 1061901, 31744, false, false ); // Your Cost:
                AddLabel( 170, 260, 40, (newPrice - oldPrice).ToString() );
            }

            AddButton( 10, 290, 4005, 4007, 1, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 45, 290, 55, 20, 1011036, 32767, false, false ); // OKAY

            AddButton( 170, 290, 4005, 4007, 0, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 195, 290, 55, 20, 1011012, 32767, false, false ); // CANCEL
        }
Esempio n. 4
0
        public static DesignInsertResult ProcessInsert(Item item, bool staticsOnly, out HouseFoundation house)
        {
            house = null;

            if (item == null || item is BaseMulti || item is HouseSign || (staticsOnly && !(item is Static)))
                return DesignInsertResult.InvalidItem;

            house = BaseHouse.FindHouseAt(item) as HouseFoundation;

            if (house == null)
                return DesignInsertResult.NotInHouse;

            int x = item.X - house.X;
            int y = item.Y - house.Y;
            int z = item.Z - house.Z;

            if (!TryInsertIntoState(house.CurrentState, item.ItemID, x, y, z))
                return DesignInsertResult.OutsideHouseBounds;

            TryInsertIntoState(house.DesignState, item.ItemID, x, y, z);
            item.Delete();

            return DesignInsertResult.Valid;
        }
        public DesignState( HouseFoundation foundation, GenericReader reader )
        {
            m_Foundation = foundation;

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                {
                    m_Components = new MultiComponentList( reader );

                    int length = reader.ReadInt();

                    m_Fixtures = new MultiTileEntry[length];

                    for ( int i = 0; i < length; ++i )
                    {
                        m_Fixtures[i].m_ItemID = reader.ReadShort();
                        m_Fixtures[i].m_OffsetX = reader.ReadShort();
                        m_Fixtures[i].m_OffsetY = reader.ReadShort();
                        m_Fixtures[i].m_OffsetZ = reader.ReadShort();
                        m_Fixtures[i].m_Flags = reader.ReadInt();
                    }

                    m_Revision = reader.ReadInt();

                    break;
                }
            }
        }
        public DesignState( DesignState toCopy )
        {
            m_Foundation = toCopy.m_Foundation;
            m_Components = new MultiComponentList( toCopy.m_Components );
            m_Revision = toCopy.m_Revision;
            m_Fixtures = new MultiTileEntry[toCopy.m_Fixtures.Length];

            for ( int i = 0; i < m_Fixtures.Length; ++i )
                m_Fixtures[i] = toCopy.m_Fixtures[i];
        }
 public DesignState( HouseFoundation foundation, MultiComponentList components )
 {
     m_Foundation = foundation;
     m_Components = components;
     m_Fixtures = new MultiTileEntry[0];
 }
            protected override void OnTarget( Mobile from, object obj )
            {
                Item item = obj as Item;

                if ( item == null )
                {
                    from.Target = new DesignInsertTarget( m_Foundation );
                    from.SendMessage( "That is not an item. Try again." );
                }
                else
                {
                    HouseFoundation house = BaseHouse.FindHouseAt( item ) as HouseFoundation;

                    if ( house == null )
                    {
                        from.Target = new DesignInsertTarget( m_Foundation );
                        from.SendMessage( "That item is not inside a customizable house. Try again." );
                    }
                    else if ( m_Foundation != null && house != m_Foundation )
                    {
                        from.Target = new DesignInsertTarget( m_Foundation );
                        from.SendMessage( "That item is not inside the current house; all targeted items must reside in the same house. You may cancel this target and repeat the command." );
                    }
                    else
                    {
                        DesignState state = house.CurrentState;
                        MultiComponentList mcl = state.Components;

                        int x = item.X - house.X;
                        int y = item.Y - house.Y;
                        int z = item.Z - house.Z;

                        if ( x >= mcl.Min.X && y >= mcl.Min.Y && x <= mcl.Max.X && y <= mcl.Max.Y )
                        {
                            mcl.Add( item.ItemID, x, y, z );
                            item.Delete();

                            state.OnRevised();

                            state = house.DesignState;
                            mcl = state.Components;

                            if ( x >= mcl.Min.X && y >= mcl.Min.Y && x <= mcl.Max.X && y <= mcl.Max.Y )
                            {
                                mcl.Add( item.ItemID, x, y, z );
                                state.OnRevised();
                            }

                            from.Target = new DesignInsertTarget( house );

                            if ( m_Foundation == null )
                                from.SendMessage( "The item has been inserted into the house design. Press ESC when you are finished." );
                            else
                                from.SendMessage( "The item has been inserted into the house design." );

                            m_Foundation = house;
                        }
                        else
                        {
                            from.Target = new DesignInsertTarget( m_Foundation );
                            from.SendMessage( "That item is not inside a customizable house. Try again." );
                        }
                    }
                }
            }
 public DesignInsertTarget( HouseFoundation foundation )
     : base(-1, false, TargetFlags.None)
 {
     m_Foundation = foundation;
 }
            public SendQueueEntry( NetState ns, HouseFoundation foundation, DesignState state )
            {
                m_NetState = ns;
                m_Serial = foundation.Serial;
                m_Revision = state.Revision;
                m_Root = state;

                MultiComponentList mcl = state.Components;

                m_xMin = mcl.Min.X;
                m_yMin = mcl.Min.Y;
                m_xMax = mcl.Max.X;
                m_yMax = mcl.Max.Y;

                m_Tiles = mcl.List;
            }
Esempio n. 11
0
		public static int GetZLevel( int z, HouseFoundation house )
		{
			int level = (z - 7)/20 +1;

			if( level < 1 || level > house.MaxLevels )
				level = 1;

			return level;
		}
Esempio n. 12
0
		public static int GetLevelZ( int level, HouseFoundation house )
		{
			if( level < 1 || level > house.MaxLevels )
				level = 1;

			return (level-1)*20 + 7;

			/*
			switch( level )
			{
				default:
				case 1: return 07;
				case 2: return 27;
				case 3: return 47;
				case 4: return 67;
			}
			 * */
		}
		public ConfirmCommitGump( Mobile from, HouseFoundation foundation, int bankBalance, int oldPrice, int newPrice )
			: base( 50, 50 )
		{
			m_Foundation = foundation;

			int cost = newPrice - oldPrice;
			bool canAfford = cost <= bankBalance;

			AddPage( 0 );

			AddBackground( 0, 0, 320, 320, 5054 );

			AddImageTiled( 10, 10, 300, 20, 2624 );
			AddImageTiled( 10, 40, 300, 240, 2624 );
			AddImageTiled( 10, 290, 300, 20, 2624 );

			AddAlphaRegion( 10, 10, 300, 300 );

			AddHtmlLocalized( 10, 10, 300, 20, 1062060, 32736, false, false ); // <CENTER>COMMIT DESIGN</CENTER>

			AddHtmlLocalized( 10, 190, 150, 20, 1061902, 32736, false, false ); // Bank Balance:
			AddLabel( 170, 190, 55, bankBalance.ToString() );

			AddHtmlLocalized( 10, 215, 150, 20, 1061899, 1023, false, false ); // Old Value:
			AddLabel( 170, 215, 90, oldPrice.ToString() );

			AddHtmlLocalized( 10, 235, 150, 20, 1061900, 1023, false, false ); // Cost To Commit:
			AddLabel( 170, 235, 90, newPrice.ToString() );

			AddButton( 170, 290, 4005, 4007, 0, GumpButtonType.Reply, 0 );
			AddHtmlLocalized( 195, 290, 55, 20, 1011012, 32767, false, false ); // CANCEL

			if ( canAfford )
			{
				AddHtmlLocalized( 10, 40, 300, 140, 1061898, 0x3FF, false, true );

				AddButton( 10, 290, 4005, 4007, 1, GumpButtonType.Reply, 0 );
				AddHtmlLocalized( 45, 290, 55, 20, 1011036, 32767, false, false ); // OKAY
			}
			else
			{
				AddHtmlLocalized( 10, 40, 300, 140, 1061903, 0x7C00, false, true );
			}

			if ( cost >= 0 )
			{
				AddHtmlLocalized( 10, 260, 150, 20, 1061901, 0x7C00, false, false ); // Your Cost:
				AddLabel( 170, 260, 40, cost.ToString() );
			}
			else
			{
				AddHtmlLocalized( 10, 260, 150, 20, 1062059, 0x3E0, false, false ); // Your Refund:
				AddLabel( 170, 260, 70, ( -cost ).ToString() );
			}
		}
		public static int GetLevelZ( int level, HouseFoundation house )
		{
			if ( level < 1 || level > house.MaxLevels )
				level = 1;

			return ( level - 1 ) * 20 + 7;
		}
Esempio n. 15
0
        public EndHouseCustomization(HouseFoundation house)
            : base(0xBF)
        {
            this.EnsureCapacity(17);

            this.m_Stream.Write((short)0x20);
            this.m_Stream.Write((int)house.Serial);
            this.m_Stream.Write((byte)0x05);
            this.m_Stream.Write((ushort)0x0000);
            this.m_Stream.Write((ushort)0xFFFF);
            this.m_Stream.Write((ushort)0xFFFF);
            this.m_Stream.Write((byte)0xFF);
        }
 public static void SendDetails( NetState ns, HouseFoundation house, DesignState state )
 {
     m_SendQueue.Enqueue( new SendQueueEntry( ns, house, state ) );
     m_Sync.Set();
 }
 public DesignContext( HouseFoundation foundation )
 {
     m_Foundation = foundation;
     m_Level = 1;
 }
        public DesignStateGeneral( HouseFoundation house, DesignState state )
            : base(0xBF)
        {
            EnsureCapacity( 13 );

            m_Stream.Write( (short) 0x1D );
            m_Stream.Write( (int) house.Serial );
            m_Stream.Write( (int) state.Revision );
        }
        public static void Add( Mobile from, HouseFoundation foundation )
        {
            if ( from == null )
                return;

            DesignContext c = new DesignContext( foundation );

            m_Table[from] = c;

            if ( from is PlayerMobile )
                ((PlayerMobile)from).DesignContext = c;

            foundation.Customizer = from;

            from.Hidden = true;
            from.Location = new Point3D( foundation.X, foundation.Y, foundation.Z + 7 );

            NetState state = from.NetState;

            if ( state == null )
                return;

            ArrayList fixtures = foundation.Fixtures;

            for ( int i = 0; fixtures != null && i < fixtures.Count; ++i )
            {
                Item item = (Item)fixtures[i];

                state.Send( item.RemovePacket );
            }

            if ( foundation.Signpost != null )
                state.Send( foundation.Signpost.RemovePacket );
        }