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
 private void StartMacroTimer()
 {
     timerStep = 0;
     MacroTimer.Start();
 }
Ejemplo n.º 3
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());
                    }
                }
            }
        }