Ejemplo n.º 1
0
        public OldAntiMacroGump(PlayerMobile gumpOwner) : base(Utility.Random(5,300), Utility.Random(30,60))
        {
            m_GumpOwner = gumpOwner;
            //PlayerMobile target = obj as PlayerMobile; 

            if (m_GumpOwner.AntiMacroGump)
                return;
            //Randomise the amount of options this gump will have.
            int optionCount = Utility.Random(3, 5);

            //Sets the "I'm not autoharvesting" button.
            m_CorrectChoice = Utility.Random(0, optionCount);

            //Start the macro check timer. If the user doesn't respond within 120 seconds, he will be penalized.
            m_MacroTimer = new MacroTimer(gumpOwner, TimeSpan.FromSeconds(120));
            m_MacroTimer.Start();

            #region CreateGump
            Closable = false;
            Disposable = true;
            Dragable = false;
            Resizable = false;

            //Generate a random background for the gump
            AddImageTiled(0, 0, m_GumpLenght, (int)((optionCount + 1.5) * m_ButtonHeightOffset), GetRandomBackground());

            //Display the gump name
            AddLabel(100, 0, 33, m_GumpName);
            #endregion

            for (int i = 0; i <= optionCount; i++)
            {
                //Initialize the starting locations for buttons and text labels
                int xStart = Utility.RandomMinMax(20, 60);
                int yStart = (m_ButtonHeightOffset / 2) + (i * m_ButtonHeightOffset);

                //Add a button that will be located next to the string, no matter if it's fake or not.
                AddButton(xStart, yStart, 2151, 2154, i, GumpButtonType.Reply, 0);

                //The starting x location to be used to place the text
                int xLabelStart = xStart + Utility.RandomMinMax(35, 60);

                //Will display the button on somewhat random locations.
                if (i == m_CorrectChoice)      //This will display the right button text
                    for (int j = 0; j < m_CorrectButtonString.Length; j++)
                        AddLabel(xLabelStart + (j * 11) + Utility.RandomMinMax(-m_CharWidthOffset, m_CharWidthOffset), (yStart + 5) + Utility.RandomMinMax(-m_CharHeightOffset, m_CharHeightOffset), GetRandomTextColor(), m_CorrectButtonString[j].ToString());
                else                           //This will display the wrong button text
                    for (int j = 0; j < m_WrongButtonString.Length; j++)
                        AddLabel(xLabelStart + (j * 11) + Utility.RandomMinMax(-m_CharWidthOffset, m_CharWidthOffset), (yStart + 5) + Utility.RandomMinMax(-m_CharHeightOffset, m_CharHeightOffset), GetRandomTextColor(), m_WrongButtonString[j].ToString());
            }
        }
Ejemplo n.º 2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID != m_CorrectChoice)
            {
                if (m_GumpOwner.AntiMacroTimeCheck < (DateTime.Now - TimeSpan.FromHours(24)))
                {
                    m_GumpOwner.AntiMacroFailed    = 1;
                    m_GumpOwner.AntiMacroTimeCheck = DateTime.Now;
                }
                else
                {
                    m_GumpOwner.AntiMacroFailed++;
                }

                m_GumpOwner.Kill();

                if (m_GumpOwner.AntiMacroFailed >= 3)
                {
                    m_GumpOwner.SendAsciiMessage("You failed the gump too many times and have been moved to a secure location.");
                    m_GumpOwner.Location        = new Point3D(2567, 448, 0);
                    m_GumpOwner.Map             = Map.Felucca;
                    m_GumpOwner.AntiMacroFailed = 0;
                }
            }
            else
            {
                m_GumpOwner.AntiMacroFailed = 0;
            }

            //m_GumpOwner.Frozen = false;
            m_GumpOwner.CloseGump(typeof(OldAntiMacroGump));
            m_GumpOwner.AntiMacroGump = false;

            if (m_MacroTimer != null)
            {
                m_MacroTimer.Stop();
                m_MacroTimer = null;
            }
        }
Ejemplo n.º 3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID != m_CorrectChoice)
            {
                if (m_GumpOwner.AntiMacroTimeCheck < (DateTime.Now - TimeSpan.FromHours(24)))
                {
                    m_GumpOwner.AntiMacroFailed = 1;
                    m_GumpOwner.AntiMacroTimeCheck = DateTime.Now;
                }
                else
                    m_GumpOwner.AntiMacroFailed++;

                m_GumpOwner.Kill();

                if (m_GumpOwner.AntiMacroFailed >= 3)
                {
                    m_GumpOwner.SendAsciiMessage("You failed the gump too many times and have been moved to a secure location.");
                    m_GumpOwner.Location = new Point3D(2567, 448, 0);
                    m_GumpOwner.Map = Map.Felucca;
                    m_GumpOwner.AntiMacroFailed = 0;
                }
            }
            else
                m_GumpOwner.AntiMacroFailed = 0;

            //m_GumpOwner.Frozen = false;
            m_GumpOwner.CloseGump(typeof(OldAntiMacroGump));
            m_GumpOwner.AntiMacroGump = false;

            if (m_MacroTimer != null)
            {
                m_MacroTimer.Stop();
                m_MacroTimer = null;
            }
        }
Ejemplo n.º 4
0
 private void StopMacroTimer()
 {
     MacroTimer.Stop();
 }
Ejemplo n.º 5
0
 private void StartMacroTimer()
 {
     timerStep = 0;
     MacroTimer.Start();
 }
Ejemplo n.º 6
0
 static MacroManager()
 {
     m_List  = new ArrayList();
     m_Timer = new MacroTimer();
 }
Ejemplo n.º 7
0
 static MacroManager()
 {
     m_MacroList = new List <Macro>();
     m_Timer     = new MacroTimer();
 }
Ejemplo n.º 8
0
        public OldAntiMacroGump(PlayerMobile gumpOwner) : base(Utility.Random(5, 300), Utility.Random(30, 60))
        {
            m_GumpOwner = gumpOwner;
            //PlayerMobile target = obj as PlayerMobile;

            if (m_GumpOwner.AntiMacroGump)
            {
                return;
            }
            //Randomise the amount of options this gump will have.
            int optionCount = Utility.Random(3, 5);

            //Sets the "I'm not autoharvesting" button.
            m_CorrectChoice = Utility.Random(0, optionCount);

            //Start the macro check timer. If the user doesn't respond within 120 seconds, he will be penalized.
            m_MacroTimer = new MacroTimer(gumpOwner, TimeSpan.FromSeconds(120));
            m_MacroTimer.Start();

            #region CreateGump
            Closable   = false;
            Disposable = true;
            Dragable   = false;
            Resizable  = false;

            //Generate a random background for the gump
            AddImageTiled(0, 0, m_GumpLenght, (int)((optionCount + 1.5) * m_ButtonHeightOffset), GetRandomBackground());

            //Display the gump name
            AddLabel(100, 0, 33, m_GumpName);
            #endregion

            for (int i = 0; i <= optionCount; i++)
            {
                //Initialize the starting locations for buttons and text labels
                int xStart = Utility.RandomMinMax(20, 60);
                int yStart = (m_ButtonHeightOffset / 2) + (i * m_ButtonHeightOffset);

                //Add a button that will be located next to the string, no matter if it's fake or not.
                AddButton(xStart, yStart, 2151, 2154, i, GumpButtonType.Reply, 0);

                //The starting x location to be used to place the text
                int xLabelStart = xStart + Utility.RandomMinMax(35, 60);

                //Will display the button on somewhat random locations.
                if (i == m_CorrectChoice)      //This will display the right button text
                {
                    for (int j = 0; j < m_CorrectButtonString.Length; j++)
                    {
                        AddLabel(xLabelStart + (j * 11) + Utility.RandomMinMax(-m_CharWidthOffset, m_CharWidthOffset), (yStart + 5) + Utility.RandomMinMax(-m_CharHeightOffset, m_CharHeightOffset), GetRandomTextColor(), m_CorrectButtonString[j].ToString());
                    }
                }
                else                           //This will display the wrong button text
                {
                    for (int j = 0; j < m_WrongButtonString.Length; j++)
                    {
                        AddLabel(xLabelStart + (j * 11) + Utility.RandomMinMax(-m_CharWidthOffset, m_CharWidthOffset), (yStart + 5) + Utility.RandomMinMax(-m_CharHeightOffset, m_CharHeightOffset), GetRandomTextColor(), m_WrongButtonString[j].ToString());
                    }
                }
            }
        }
Ejemplo n.º 9
0
 static MacroManager()
 {
     m_List = new ArrayList();
     m_Timer = new MacroTimer();
 }
Ejemplo n.º 10
0
 static MacroManager()
 {
     m_MacroList          = new List <Macro>();
     m_AbsoluteTargetList = new List <AbsoluteTarget>();
     m_Timer = new MacroTimer();
 }