コード例 #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Player == null)
            {
                return;
            }
            if (m_Vendor == null)
            {
                return;
            }
            if (m_Creature == null)
            {
                return;
            }

            if (m_Vendor.Deleted || !m_Vendor.Alive)
            {
                return;
            }

            if (m_Creature.Deleted)
            {
                return;
            }

            if (!m_Player.Alive)
            {
                m_Player.SendMessage("You must be alive to do that.");

                m_Player.CloseGump(typeof(StableGump));
                m_Player.SendGump(new StableGump(m_Vendor, m_Player, m_Page));

                return;
            }

            if (Utility.GetDistance(m_Vendor.Location, m_Player.Location) >= 15)
            {
                m_Player.SendMessage("You are too far away to continue that.");

                m_Player.CloseGump(typeof(StableGump));
                m_Player.SendGump(new StableGump(m_Vendor, m_Player, m_Page));

                return;
            }

            if (ArenaController.GetArenaAtLocation(m_Player.Location, m_Player.Map) != null)
            {
                m_Player.SendMessage("You cannot access stables while in that location.");

                return;
            }

            if (info.ButtonID == 1)
            {
                if (m_Player.Stabled.Contains(m_Creature))
                {
                    m_Player.Stabled.Remove(m_Creature);
                }

                m_Player.SendSound(m_Creature.GetDeathSound());

                m_Creature.Delete();

                m_Player.SendMessage("You permanently dismiss the follower.");
            }

            m_Player.CloseGump(typeof(StableGump));
            m_Player.SendGump(new StableGump(m_Vendor, m_Player, m_Page));
        }