Esempio n. 1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from = sender.Mobile;
            PlayerMobile pm   = (PlayerMobile)from;

            if (m_AnimationLocator.Deleted)
            {
                return;
            }

            if (info.ButtonID == 1)
            {
                m_AnimationLocator.AnimationNumber += 1;
                pm.CloseGump(typeof(AnimationLocatorGump));
                pm.SendGump(new AnimationLocatorGump(m_AnimationLocator));
            }

            if (info.ButtonID == 2)
            {
                m_AnimationLocator.AnimationNumber -= 1;
                pm.CloseGump(typeof(AnimationLocatorGump));
                pm.SendGump(new AnimationLocatorGump(m_AnimationLocator));
            }

            if (info.ButtonID == 3)
            {
                TextRelay tr_AnimationNumber = info.GetTextEntry(1);
                if (tr_AnimationNumber != null)
                {
                    int i_MaxAmount = 0;
                    try
                    {
                        i_MaxAmount = Convert.ToInt32(tr_AnimationNumber.Text, 10);
                    }
                    catch
                    {
                        pm.SendMessage(1161, "Please only use numbers.");
                    }

                    m_AnimationLocator.AnimationNumber = i_MaxAmount;
                }


                if (m_AnimationLocator.Active == false)
                {
                    m_AnimationLocator.TargetMobile.Emote("† Animation locator started †");
                    m_AnimationLocator.StartLoop(pm);
                    m_AnimationLocator.Active = true;
                }

                else
                {
                    m_AnimationLocator.TargetMobile.Emote("† Animation locator stopped †");
                    m_AnimationLocator.Active = false;
                }

                pm.CloseGump(typeof(AnimationLocatorGump));
                pm.SendGump(new AnimationLocatorGump(m_AnimationLocator));
            }

            if (info.ButtonID == 4)
            {
                TextRelay tr_AnimationNumber = info.GetTextEntry(1);
                if (tr_AnimationNumber != null)
                {
                    int i_MaxAmount = 0;
                    try
                    {
                        i_MaxAmount = Convert.ToInt32(tr_AnimationNumber.Text, 10);
                    }
                    catch
                    {
                        pm.SendMessage(1161, "Please make sure to only use numbers.");
                    }

                    m_AnimationLocator.AnimationNumber = i_MaxAmount;
                }

                m_AnimationLocator.TargetMobile.Emote("† animation " + m_AnimationLocator.AnimationNumber.ToString() + " †");
                m_AnimationLocator.TargetMobile.Animate(m_AnimationLocator.AnimationNumber, 0, 1, true, false, 0);

                pm.CloseGump(typeof(AnimationLocatorGump));
                pm.SendGump(new AnimationLocatorGump(m_AnimationLocator));
            }

            if (info.ButtonID == 5)
            {
                pm.SendMessage("Please target the mobile you wish to animate.");
                m_AnimationLocator.Use(pm);

                pm.CloseGump(typeof(AnimationLocatorGump));
                pm.SendGump(new AnimationLocatorGump(m_AnimationLocator));
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile       from = sender.Mobile;
            PlayerMobile pm   = (PlayerMobile)from;

            if (m_AnimationLocator.Deleted)
            {
                return;
            }

            if (info.ButtonID == (int)Button.IncreaseAnimation)
            {
                m_AnimationLocator.AnimationNumber += 1;

                ResendGump(pm);
            }

            if (info.ButtonID == (int)Button.DecreaseAnimation)
            {
                m_AnimationLocator.AnimationNumber -= 1;

                ResendGump(pm);
            }

            if (info.ButtonID == (int)Button.CycleAnimation)
            {
                TextRelay tr_AnimationNumber = info.GetTextEntry((int)Button.AnimationNumberEntry);
                if (tr_AnimationNumber != null)
                {
                    int i_MaxAmount = 0;
                    try { i_MaxAmount = Convert.ToInt32(tr_AnimationNumber.Text, 10); }
                    catch { pm.SendMessage(1161, "Only use numbers that are two digits or less."); }

                    m_AnimationLocator.AnimationNumber = i_MaxAmount;
                }


                if (m_AnimationLocator.Active == false)
                {
                    m_AnimationLocator.Active = true;
                    m_AnimationLocator.TargetMobile.Emote(" Animation locator started ");
                    m_AnimationLocator.StartLoop(pm);
                }

                else
                {
                    m_AnimationLocator.TargetMobile.Emote(" Animation locator stopped ");
                    m_AnimationLocator.Active = false;
                }

                ResendGump(pm);
            }

            if (info.ButtonID == (int)Button.SingleAnimation)
            {
                TextRelay tr_AnimationNumber = info.GetTextEntry(1);
                int       PlayAnim           = 0;

                if (tr_AnimationNumber != null)
                {
                    try { PlayAnim = Convert.ToInt32(tr_AnimationNumber.Text, 10); }
                    catch {
                        pm.SendMessage(1161, "Only use numbers that are two digits or less.");
                        return;
                    }
                }

                m_AnimationLocator.TargetMobile.Animate(PlayAnim, 0, 1, true, false, 0);

                ResendGump(pm);
            }

            if (info.ButtonID == (int)Button.TargetMobile)
            {
                pm.SendMessage("Please target the mobile you wish to animate.");
                m_AnimationLocator.Use(pm);

                ResendGump(pm);
            }

            if (info.ButtonID == (int)Button.FreezeFrame)
            {
                TextRelay AnimationEntry = info.GetTextEntry((int)Button.FreezeAnimationNumberEntry);
                TextRelay FrameEntry     = info.GetTextEntry((int)Button.FrameNumberEntry);

                int AnimEnt = 0;
                int FramEnt = 0;

                if (AnimationEntry != null)
                {
                    try { AnimEnt = Convert.ToInt32(AnimationEntry.Text, 10); }
                    catch {
                        pm.SendMessage(1161, "Only use numbers that are two digits or less.");
                        return;
                    }
                }

                if (FrameEntry != null)
                {
                    try { FramEnt = Convert.ToInt32(FrameEntry.Text, 10); }
                    catch {
                        pm.SendMessage(1161, "Only use numbers that are two digits or less.");
                        return;
                    }
                }

                ResendGump(pm);

                m_AnimationLocator.TargetMobile.Animate(AnimEnt, FramEnt, 1, true, false, 255);
            }
            if (info.ButtonID == (int)Button.StopAnimation)
            {
                m_AnimationLocator.Active = false;
                m_AnimationLocator.TargetMobile.Emote(" Animation locator stopped ");
                ResendGump(pm);
            }
            if (info.ButtonID == (int)Button.FrameIncrease)
            {
                m_AnimationLocator.FrameNumber += 1;

                ResendGump(pm);
            }
            if (info.ButtonID == (int)Button.FrameDecrease)
            {
                m_AnimationLocator.FrameNumber -= 1;

                ResendGump(pm);
            }
            if (info.ButtonID == (int)Button.Update)
            {
                TextRelay AnimationEntry = info.GetTextEntry((int)Button.FreezeAnimationNumberEntry);
                TextRelay FrameEntry     = info.GetTextEntry((int)Button.FrameNumberEntry);

                int AnimEnt = 0;
                int FramEnt = 0;

                if (AnimationEntry != null)
                {
                    try { AnimEnt = Convert.ToInt32(AnimationEntry.Text, 10); }
                    catch {
                        pm.SendMessage(1161, "Only use numbers that are two digits or less.");
                        return;
                    }
                }

                if (FrameEntry != null)
                {
                    try { FramEnt = Convert.ToInt32(FrameEntry.Text, 10); }
                    catch {
                        pm.SendMessage(1161, "Only use numbers that are two digits or less.");
                        return;
                    }
                }

                m_AnimationLocator.AnimationNumber = AnimEnt;
                m_AnimationLocator.FrameNumber     = FramEnt;
                ResendGump(pm);
            }
        }