public TokenVendorStoneEditGump( Mobile from, VSItem vsi, TokenVendorStone stone )
            : base(125, 125)
        {
            m_Stone = stone;
            m_VSI = vsi;

            m_Stone.CloseGumps( from );

            AddPage( 0 );

            AddBackground( 0, 0, 420, 300, 0x2436 );

            AddLabel( 13, 10, 1152, "Item Type:" );
            AddTextEntry( 83, 10, 100, 15, 1152, 0, m_VSI.Item );

            AddLabel( 13, 30, 1152, "Gump Name:" );
            AddTextEntry( 90, 30, 90, 15, 1152, 1, m_VSI.Name );

            AddLabel( 13, 50, 1152, "Price:" );
            AddTextEntry( 53, 50, 85, 15, 1152, 2, ""+m_VSI.Price );

            AddLabel( 13, 70, 1152, "Amount:" );
            AddTextEntry( 63, 70, 85, 15, 1152, 3, ""+m_VSI.Amount );

            AddCheck( 15, 90, 0x2342, 0x2343, m_VSI.BlessBond, 1 );
            AddLabel( 45, 90, 1152, "Bless/Bond:" );

            AddLabel( 13, 110, 1152, "Bless/Bond Price:" );
            AddTextEntry( 123, 110, 225, 15, 1152, 4, ""+m_VSI.BBPrice );

            AddLabel( 13, 130, 1152, "Description:" );
            AddTextEntry( 13, 150, 387, 75, 1152, 5, m_VSI.Description );

            AddButton( 15, 245, 4005, 4007, 2, GumpButtonType.Reply, 0 );
            AddLabel( 45, 245, 33, "Remove" );

            AddButton( 15, 265, 4005, 4007, 0, GumpButtonType.Reply, 0 );
            AddLabel( 45, 265, 33, "Back" );
            AddButton( 85, 265, 4005, 4007, 1, GumpButtonType.Reply, 0 );
            AddLabel( 115, 265, 33, "Apply" );
        }
        public override void OnResponse( NetState state, RelayInfo info )
        {
            Mobile from = state.Mobile;

            if ( from == null )
                return;

            if ( info.ButtonID == 0 )
            {
                from.SendGump( new StaffVendorGump( from, m_Stone ) );
            }
            if ( info.ButtonID == 1 )
            {
                string item = "";
                string gumpname = "";
                int price = 0;
                int amount = 0;
                int bbprice = 0;
                bool blessbond = info.IsSwitched( 1 );
                string description = "";

                string[] tr = new string[ 6 ];
                foreach( TextRelay t in info.TextEntries )
                {
                    tr[ t.EntryID ] = t.Text;
                }

                try { price = (int) uint.Parse( tr[ 2 ] ); }
                catch {}
                try { amount = (int) uint.Parse( tr[ 3 ] ); }
                catch {}
                try { bbprice = (int) uint.Parse( tr[ 4 ] ); }
                catch {}
                if ( tr[ 0 ] != null )
                    item = tr[ 0 ];
                if ( tr[ 1 ] != null )
                    gumpname = tr[ 1 ];
                if ( tr[ 5 ] != null )
                    description = tr[ 5 ];

                if ( amount <= 0 )
                    amount = 1;

                if ( item != "" && gumpname != "" )
                {
                    VSItem vsi = new VSItem( item, gumpname, price, amount, blessbond, bbprice, description );
                    m_Stone.ItemList.Add( vsi );

                    from.SendMessage( "Item Added." );
                }
                else
                {
                    from.SendMessage( "You must set a property for each one." );
                }

                from.SendGump( new TokenVendorStoneAddItemGump( from, m_Stone ) );
            }
        }
        public TokenVendorStoneBlessBondGump( Mobile from, VSItem vsi, TokenVendorStone stone, ArrayList objects )
            : base(125, 125)
        {
            m_Stone = stone;
            m_VSI = vsi;
            m_Objects = objects;

            m_Stone.CloseGumps( from );

            AddPage( 0 );

            AddBackground( 0, 0, 375, 85, 0x2436 );

            if ( objects.Count > 0 && objects[0] is Item )
                AddLabel( 13, 10, 1152, "Would you like to bless this item: '"+ vsi.Name +"'?" );
            else if ( objects.Count > 0 && objects[0] is Mobile )
                AddLabel( 13, 10, 1152, "Would you like to bond this pet: '"+ vsi.Name +"'?" );
            AddLabel( 13, 25, 1152, "Price: "+ vsi.BBPrice );

            AddButton( 15, 50, 4005, 4007, 0, GumpButtonType.Reply, 0 );
            AddLabel( 45, 50, 33, "No" );
            AddButton( 85, 50, 4005, 4007, 1, GumpButtonType.Reply, 0 );
            AddLabel( 115, 50, 33, "Yes" );
        }
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();

            if (version == 0)
            {
                bool bNull;
                int iNull;
                bNull = reader.ReadBool(); //custom hues
                bNull = reader.ReadBool(); //m_Blessed
                bNull = reader.ReadBool(); //m_Bonded
                bNull = reader.ReadBool(); //m_Hued
                iNull = reader.ReadInt(); //m_BlessedPrice
                iNull = reader.ReadInt(); //m_BondedPrice
                iNull = reader.ReadInt(); //m_HuedPrice
                m_AccessLevel = (AccessLevel)reader.ReadInt();
                m_Currency = reader.ReadString();
                m_EditMode = reader.ReadBool();

                int size1 = reader.ReadInt();
                ArrayList alPrice = new ArrayList( size1 );
                for ( int i = 0; i < size1; ++i )
                {
                    int price = reader.ReadInt();
                    alPrice.Add( price );
                }

                int size4 = reader.ReadInt();
                ArrayList alNull = new ArrayList( size4 );
                for ( int i = 0; i < size4; ++i )
                {
                    int hue = reader.ReadInt();
                    alNull.Add( hue );
                }

                int size5 = reader.ReadInt();
                ArrayList alAmount = new ArrayList( size5 );
                for ( int i = 0; i < size5; ++i )
                {
                    int itemamount = reader.ReadInt();
                    alAmount.Add( itemamount );
                }

                int size2 = reader.ReadInt();
                ArrayList alItem = new ArrayList( size2 );
                for ( int i = 0; i < size2; ++i )
                {
                    string item = reader.ReadString();
                    alItem.Add( item );
                }

                int size3 = reader.ReadInt();
                ArrayList alName = new ArrayList( size3 );
                for ( int i = 0; i < size3; ++i )
                {
                    string gumpname = reader.ReadString();
                    alName.Add( gumpname );
                }

                int size6 = reader.ReadInt();
                alNull = new ArrayList( size6 );
                for ( int i = 0; i < size6; ++i )
                {
                    int hueprices = reader.ReadInt();
                    alNull.Add( hueprices );
                }
                //dispose of the not used arrays (bless.. bond...)
                alNull.Clear();
                for( int i = 0; i < alName.Count; i++ )
                {
                    VSItem v = new VSItem( alItem[i].ToString(), alName[i].ToString(), (int)alPrice[i], (int)alAmount[i], false, 0, "" );
                    ItemList.Add( v );
                }
                //dispose of the "old" arrays
                alItem.Clear();
                alName.Clear();
                alPrice.Clear();
                alAmount.Clear();
            }
            else switch( version )
            {
                case 3:
                case 2: goto case 0;
                case 1:
                {
                    bool blah = reader.ReadBool(); //for the usesledger

                    goto case 0;
                }
                case 0:
                {
                    m_AccessLevel = (AccessLevel)reader.ReadInt();
                    m_Currency = reader.ReadString();
                    m_EditMode = reader.ReadBool();

                    int size = reader.ReadInt();
                    m_ItemList = new ArrayList( size );
                    for ( int i = 0; i < size; ++i )
                    {
                        VSItem vsi = new VSItem();
                        vsi.Deserialize( reader, version );
                        m_ItemList.Add( vsi );
                    }

                    break;
                }
            }
        }