Exemple #1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.ButtonID < 200)            // LORE
            {
                int id = info.ButtonID - 100;

                if (id >= 0 && id < m_Entries.Count)
                {
                    PetBrokerEntry entry = m_Entries[id];

                    if (entry != null && entry.Pet != null && m_Broker.BrokerEntries.Contains(entry))
                    {
                        from.SendGump(new PetInventoryGump(m_Broker, from));
                        from.SendGump(new Server.SkillHandlers.AnimalLoreGump(entry.Pet));
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150368); // The selected animal is not available.
                    }
                }
            }
            else if (info.ButtonID < 300)             // VIEW
            {
                int id = info.ButtonID - 200;

                if (id >= 0 && id < m_Entries.Count)
                {
                    PetBrokerEntry entry = m_Entries[id];

                    if (entry != null && entry.Pet != null && m_Broker.BrokerEntries.Contains(entry) && entry.Pet.IsStabled)
                    {
                        BaseCreature pet = entry.Pet;

                        pet.Blessed = true;
                        pet.SetControlMaster(m_Broker);
                        pet.ControlTarget = m_Broker;
                        pet.ControlOrder  = OrderType.None;
                        pet.MoveToWorld(m_Broker.Location, m_Broker.Map);
                        pet.IsStabled = false;
                        pet.Home      = pet.Location;
                        pet.RangeHome = 2;
                        pet.Loyalty   = BaseCreature.MaxLoyalty;

                        PetBroker.AddToViewTimer(pet);
                        from.SendLocalizedMessage(1150369, String.Format("{0}\t{1}", entry.TypeName, pet.Name));                         // The ~1_TYPE~ named "~2_NAME~" is now in the animal broker's pen for inspection.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150368);                         // The selected animal is not available.
                    }
                }

                from.SendGump(new PetInventoryGump(m_Broker, from));
            }
            else             // BUY
            {
                int id = info.ButtonID - 300;

                if (id >= 0 && id < m_Entries.Count)
                {
                    PetBrokerEntry entry = m_Entries[id];

                    if (entry != null && entry.Pet != null && m_Broker.BrokerEntries.Contains(entry))
                    {
                        from.SendGump(new ConfirmBuyPetGump(m_Broker, entry));
                    }
                }
            }
        }