Exemplo n.º 1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.ButtonID == 0)
            {
                return;
            }

            if (info.ButtonID == 500)            // MAIN MENU
            {
                from.SendGump(new PetBrokerGump(m_Broker, from));
                return;
            }
            else if (info.ButtonID == 501)            // ADD PET
            {
                if (m_Index >= 0 && m_Index < m_List.Count)
                {
                    if (m_Broker.BankBalance < 0)
                    {
                        from.SendGump(new BazaarInformationGump(1150623, 1150615));
                        return;
                    }

                    TextRelay relay = info.TextEntries[0];
                    int       cost  = PetBrokerEntry.DefaultPrice;

                    try
                    {
                        cost = Convert.ToInt32(relay.Text);
                    }
                    catch { }

                    if (cost > 0)
                    {
                        BaseCreature bc = m_List[m_Index];

                        if (m_Broker.TryAddEntry(bc, from, cost))
                        {
                            from.Stabled.Remove(bc);
                            from.SendGump(new SetPetPricesGump(m_Broker));
                            from.SendLocalizedMessage(1150345, String.Format("{0}\t{1}\t{2}\t{3}", PetBrokerEntry.GetOriginalName(bc), bc.Name, m_Broker.Name, cost));                             // Your pet ~1_TYPE~ named ~2_NAME~ has been transferred to the inventory of your animal broker named ~3_SHOP~ with an asking price of ~4_PRICE~.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150343);                         // You have entered an invalid price.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1150341);                     // You did not select a pet.
                }
            }
            else
            {
                from.SendGump(new SelectPetsGump(m_Broker, from, info.ButtonID - 1));
            }
        }
Exemplo n.º 2
0
        public RemovePetsGump(PetBroker broker, Mobile from, int index)
        {
            m_Broker = broker;
            m_Index  = index;

            AddHtmlLocalized(215, 10, 200, 18, 1150311, RedColor16, false, false);  // Animal Broker
            AddHtmlLocalized(145, 50, 250, 18, 1150337, RedColor16, false, false);  // ADD PET TO BROKER INVENTORY
            AddHtmlLocalized(10, 80, 500, 40, 1150633, GreenColor16, false, false); // Click the button next to a pet to select it, then click the REMOVE PET button below to transfer that pet to your stables.

            m_Broker.CheckInventory();

            int y = 130;

            for (int i = 0; i < broker.BrokerEntries.Count; i++)
            {
                BaseCreature bc  = broker.BrokerEntries[i].Pet;
                int          col = index == i ? YellowColor16 : OrangeColor16;
                AddButton(10, y, 4005, 4007, i + 1, GumpButtonType.Reply, 0);
                AddHtmlLocalized(50, y, 200, 18, 1150340, String.Format("{0}\t{1}", bc.Name, PetBrokerEntry.GetOriginalName(bc)), col, false, false);                 // ~1_NAME~ (~2_type~)

                y += 20;
            }

            AddHtmlLocalized(215, 405, 150, 18, 1150632, OrangeColor16, false, false);             // REMOVE PET
            AddButton(175, 405, 4014, 4016, 501, GumpButtonType.Reply, 0);

            AddButton(10, 490, 4014, 4016, 500, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 490, 100, 18, 1149777, BlueColor16, false, false); // MAIN MENU
        }
Exemplo n.º 3
0
        public SelectPetsGump(PetBroker broker, Mobile from, int index)
        {
            m_Broker = broker;
            m_Index  = index;

            AddHtmlLocalized(215, 10, 200, 18, 1150311, RedColor16, false, false);             // Animal Broker
            AddHtmlLocalized(145, 50, 250, 18, 1150337, RedColor16, false, false);             // ADD PET TO BROKER INVENTORY
            AddHtmlLocalized(10, 100, 500, 40, 1150338, GreenColor16, false, false);           // Click the button next to a pet to select it. Enter the price you wish to charge into the box below the pet list, then click the "ADD PET" button.

            m_List = GetList(from);

            int y = 150;

            for (int i = 0; i < m_List.Count; i++)
            {
                int          col = index == i ? YellowColor16 : OrangeColor16;
                BaseCreature bc  = m_List[i];

                if (bc == null)
                {
                    continue;
                }

                AddButton(10, y, 4005, 4007, i + 1, GumpButtonType.Reply, 0);
                AddHtmlLocalized(60, y, 200, 18, 1150340, String.Format("{0}\t{1}", bc.Name, PetBrokerEntry.GetOriginalName(bc)), col, false, false);                 // ~1_NAME~ (~2_type~)
                y += 22;
            }

            AddHtmlLocalized(215, 380, 100, 18, 1150339, OrangeColor16, false, false);             // ADD PET
            AddButton(175, 405, 4005, 4007, 501, GumpButtonType.Reply, 0);
            AddBackground(215, 405, 295, 22, 9350);
            AddTextEntry(216, 405, 294, 20, 0, 0, "");

            AddButton(10, 490, 4014, 4016, 500, GumpButtonType.Reply, 0);
            AddHtmlLocalized(50, 490, 100, 18, 1149777, BlueColor16, false, false);             // MAIN MENU
        }