Esempio n. 1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_SellList.Length)
            {
                HairstylistBuyInfo buyInfo = m_SellList[index];

                int balance = Banker.GetBalance(m_From);

                bool isFemale = (m_From.Female || m_From.Body.IsFemale);

                if (buyInfo.FacialHair && isFemale)
                {
                    // You cannot place facial hair on a woman!
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState);
                }
                else if (balance >= buyInfo.Price)
                {
                    try
                    {
                        object[] origArgs = buyInfo.GumpArgs;
                        object[] args     = new object[origArgs.Length];

                        for (int i = 0; i < args.Length; ++i)
                        {
                            if (origArgs[i] == CustomHairstylist.Price)
                            {
                                args[i] = m_SellList[index].Price;
                            }
                            else if (origArgs[i] == CustomHairstylist.From)
                            {
                                args[i] = m_From;
                            }
                            else if (origArgs[i] == CustomHairstylist.Vendor)
                            {
                                args[i] = m_Vendor;
                            }
                            else
                            {
                                args[i] = origArgs[i];
                            }
                        }

                        Gump g = Activator.CreateInstance(buyInfo.GumpType, args) as Gump;

                        m_From.SendGump(g);
                    }
                    catch (Exception e)
                    {
                        Diagnostics.ExceptionLogging.LogException(e);
                    }
                }
                else
                {
                    // You cannot afford my services for that style.
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);
                }
            }
        }
Esempio n. 2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_SellList.Length)
            {
                HairstylistBuyInfo buyInfo = m_SellList[index];

                int balance = Banker.GetBalance(m_From);

                bool isFemale = m_From.Female || m_From.Body.IsFemale;

                if (buyInfo.FacialHair && isFemale)
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState);
                }
                else if (balance >= buyInfo.Price)
                {
                    try
                    {
                        object[] origArgs = buyInfo.GumpArgs;
                        object[] args     = new object[origArgs.Length];

                        for (int i = 0; i < args.Length; ++i)
                        {
                            if (origArgs[i] == CustomHairstylist.Price)
                            {
                                args[i] = m_SellList[index].Price;
                            }
                            else if (origArgs[i] == CustomHairstylist.From)
                            {
                                args[i] = m_From;
                            }
                            else if (origArgs[i] == CustomHairstylist.Vendor)
                            {
                                args[i] = m_Vendor;
                            }
                            else
                            {
                                args[i] = origArgs[i];
                            }
                        }

                        Gump g = ActivatorUtil.CreateInstance(buyInfo.GumpType, args) as Gump;

                        m_From.SendGump(g);
                    }
                    catch
                    {
                        // ignored
                    }
                }
                else
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042293, m_From.NetState);
                }
            }
        }
Esempio n. 3
0
        public HairstylistBuyGump( Mobile from, Mobile vendor, HairstylistBuyInfo[] sellList )
            : base(50, 50)
        {
            m_From = from;
            m_Vendor = vendor;
            m_SellList = sellList;

            from.CloseGump( typeof( HairstylistBuyGump ) );
            from.CloseGump( typeof( ChangeHairHueGump ) );
            from.CloseGump( typeof( ChangeHairstyleGump ) );

            bool isFemale = ( from.Female || from.Body.IsFemale );

            int balance = Banker.GetBalance( from );
            int canAfford = 0;

            for ( int i = 0; i < sellList.Length; ++i )
            {
                if ( balance >= sellList[i].Price && (!sellList[i].FacialHair || !isFemale) )
                        ++canAfford;
            }

            AddPage( 0 );

            AddBackground( 50, 10, 450, 100 + (canAfford * 25), 2600 );

            AddHtmlLocalized( 100, 40, 350, 20, 1018356, false, false ); // Choose your hairstyle change:

            int index = 0;

            for ( int i = 0; i < sellList.Length; ++i )
            {
                if ( balance >= sellList[i].Price && (!sellList[i].FacialHair || !isFemale) )
                {
                    if ( sellList[i].TitleString != null )
                        AddHtml( 140, 75 + (index * 25), 300, 20, sellList[i].TitleString, false, false );
                    else
                        AddHtmlLocalized( 140, 75 + (index * 25), 300, 20, sellList[i].Title, false, false );

                    AddButton( 100, 75 + (index++ * 25), 4005, 4007, 1 + i, GumpButtonType.Reply, 0 );
                }
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int index = info.ButtonID - 1;

            if (index >= 0 && index < m_SellList.Length)
            {
                HairstylistBuyInfo buyInfo = m_SellList[index];

                int balance = Banker.GetBalance(m_From);

                bool isFemale = (m_From.Female || m_From.Body.IsFemale);

                if (buyInfo.Layer == Layer.FacialHair && isFemale)
                {
                    // You cannot place facial hair on a woman!
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1010639, m_From.NetState);
                }
                else if (m_From is TeiravonMobile && ((TeiravonMobile)m_From).IsOrc())
                {
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "I don't work for any orc!", m_From.NetState);
                }
                else if (balance >= buyInfo.Price)
                {
                    try
                    {
                        object[] origArgs = buyInfo.GumpArgs;
                        object[] args     = new object[origArgs.Length];

                        for (int i = 0; i < args.Length; ++i)
                        {
                            if (origArgs[i] == CustomHairstylist.Price)
                            {
                                args[i] = m_SellList[index].Price;
                            }
                            else if (origArgs[i] == CustomHairstylist.From)
                            {
                                args[i] = m_From;
                            }
                            else if (origArgs[i] == CustomHairstylist.Vendor)
                            {
                                args[i] = m_Vendor;
                            }
                            else
                            {
                                args[i] = origArgs[i];
                            }
                        }

                        Gump g = Activator.CreateInstance(buyInfo.GumpType, args) as Gump;

                        m_From.SendGump(g);
                    }
                    catch
                    {
                    }
                }
                else
                {
                    // You cannot afford my services for that style.
                    //m_Vendor.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1042293, m_From.NetState );
                    m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "You dont have enough gold in your bankbox for that!", m_From.NetState);
                }
            }
        }