Example #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_From == null || m_PlantBowl == null)
            {
                return;
            }
            if (m_From.Deleted || !m_From.Alive || m_PlantBowl.Deleted)
            {
                return;
            }

            if (!m_From.InRange(m_PlantBowl.GetWorldLocation(), 2))
            {
                m_From.SendMessage("You are too far away to access that.");
                return;
            }

            bool closeGump = true;

            switch (info.ButtonID)
            {
            //Harvest or Add Ingredient
            case 1:
                if (m_PlantBowl.ReadyForHarvest)
                {
                    m_PlantBowl.Harvest(m_From);
                }

                else
                {
                    m_PlantBowl.AddIngredient(m_From);
                }

                closeGump = false;
                break;

            //Launch Guide
            case 2:
                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_From.CloseGump(typeof(PlantGump));
                m_From.SendGump(new PlantGump(m_From, m_PlantBowl));
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Player == null)
            {
                return;
            }
            if (m_Player.Deleted)
            {
                return;
            }
            if (!m_Player.Alive)
            {
                return;
            }
            if (m_PlantBowl == null)
            {
                return;
            }
            if (m_PlantBowl.Deleted)
            {
                return;
            }

            if (!m_Player.InRange(m_PlantBowl.GetWorldLocation(), 2))
            {
                m_Player.SendMessage("You are too far away to access that.");
                return;
            }

            bool closeGump = true;

            switch (info.ButtonID)
            {
            //Guide
            case 1:
                closeGump = false;
                break;

            //Action
            case 2:
                if (m_PlantBowl.ReadyForHarvest)
                {
                    m_PlantBowl.Harvest(m_Player);
                }

                else
                {
                    m_PlantBowl.AddIngredient(m_Player);
                }

                closeGump = false;
                break;
            }

            if (!closeGump)
            {
                m_Player.CloseGump(typeof(PlantGump));
                m_Player.SendGump(new PlantGump(m_Player, m_PlantBowl));
            }

            else
            {
                m_Player.PlaySound(closeGumpSound);
            }
        }