Beispiel #1
0
        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() );
            }
        }
Beispiel #2
0
        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 );
        }
Beispiel #3
0
        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 );
        }
Beispiel #4
0
            public SendQueueEntry( GameClient 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;
            }
Beispiel #5
0
 public static void SendDetails( GameClient ns, HouseFoundation house, DesignState state )
 {
     m_SendQueue.Enqueue( new SendQueueEntry( ns, house, state ) );
     m_Sync.Set();
 }
Beispiel #6
0
        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];
        }
Beispiel #7
0
        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.ReadUShort();
                            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;
                    }
            }
        }
Beispiel #8
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 = HousingHelper.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." );
                        }
                    }
                }
            }
Beispiel #9
0
 public DesignState( HouseFoundation foundation, MultiComponentList components )
 {
     m_Foundation = foundation;
     m_Components = components;
     m_Fixtures = new MultiTileEntry[0];
 }
Beispiel #10
0
 public DesignInsertTarget( HouseFoundation foundation )
     : base(-1, false, TargetFlags.None)
 {
     m_Foundation = foundation;
 }
Beispiel #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;
        }
Beispiel #12
0
        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 );

            GameClient state = from.Client;

            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 );
        }
Beispiel #13
0
        public static int GetLevelZ( int level, HouseFoundation house )
        {
            if ( level < 1 || level > house.MaxLevels )
                level = 1;

            return ( level - 1 ) * 20 + 7;
        }
Beispiel #14
0
 public DesignContext( HouseFoundation foundation )
 {
     m_Foundation = foundation;
     m_Level = 1;
 }