Example #1
0
        public BaseRTTGump(Mobile from, string strNotice, string strSkill, int x, int y)
            : base(x, y)
        {
            m_Mobile    = from;
            m_strNotify = strNotice;
            m_strSkill  = strSkill;

            //close any other RTT gumps
            from.CloseGump(typeof(BaseRTTGump));

            // notify staff
            if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled))
            {
                Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Administrator,
                                                                         0x482,
                                                                         String.Format("{0}({1}) is taking the RTT ({2}).", m_Mobile.Name, m_Mobile.Serial, strSkill));
            }

            // record the fact that the RTT test is being taken
            Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true);
            lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, String.Format("({0}) RTT Launched.", strSkill));
            lh.Finish();

            //This will call any child-gump's SetupGump and set it up like the child wants.
            SetupGump();

            //Save when we launched the gump for later recording
            m_RTTLaunched = DateTime.Now;

            // if the player fails to respond in 'timeout' time, then we will cound this as an RTT failure.
            //	this does two things: (1) makes the next test 5 minutes from now, (2) will move them closer to being counted as a macroer
            m_timeout = new RTTTimer(m_Mobile, TimeSpan.FromSeconds(Utility.RandomList(90, 120, 180)));
            m_timeout.Start();
        }
Example #2
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            try
            {
                // kill our timeout timer
                if (m_timeout != null)
                {
                    m_timeout.Stop();
                    m_timeout = null;
                }

                int      button = info.ButtonID;
                TimeSpan diff   = DateTime.Now - m_RTTLaunched;

                if (button == m_CorrectResponse + m_CorrectResponseOffset)
                {
                    // record answer
                    Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true);
                    lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("PASSED the RTT in {0} ms", diff.TotalMilliseconds));
                    lh.Finish();

                    m_Mobile.SendMessage("Thanks for verifying that you're at your computer.");
                    ((PlayerMobile)m_Mobile).RTTResult(true);

                    if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled))
                    {
                        if (diff <= TimeSpan.FromSeconds(1.0))
                        {
                            Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                                                                                     0x22,
                                                                                     String.Format("{0}({1}) has quickly passed the RTT ({2} ms) ({3}).", m_Mobile.Name, m_Mobile.Serial, diff.TotalMilliseconds, m_strNotify));
                        }
                        else
                        {
                            Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                                                                                     0x482,
                                                                                     String.Format("{0}({1}) has passed the RTT ({2} ms).  ({3})", m_Mobile.Name, m_Mobile.Serial, diff.TotalMilliseconds, m_strNotify));
                        }

                        // Look for and record suspiciously fast answers
                        if (diff <= TimeSpan.FromSeconds(3.0))
                        {
                            Scripts.Commands.LogHelper lh2 = new Server.Scripts.Commands.LogHelper("RTTAlert.log", false, true);
                            lh2.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("{0} ms", diff.TotalMilliseconds));
                            lh2.Finish();
                        }
                    }
                }
                else
                {
                    // record answer
                    Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true);
                    lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("FAILED the RTT in {0} ms", diff.TotalMilliseconds));
                    lh.Finish();

                    m_Mobile.SendMessage("You have failed the AFK test.");
                    ((PlayerMobile)m_Mobile).RTTResult(false);

                    if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled))
                    {
                        Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                                                                                 0x482,
                                                                                 String.Format("{0}({1}) has failed the RTT. ({2})", m_Mobile.Name, m_Mobile.Serial, this.m_strNotify));
                    }
                }
            }
            catch (Exception e)
            {
                Scripts.Commands.LogHelper.LogException(e);
            }
        }
Example #3
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            try
            {
				// kill our timeout timer
				if (m_timeout != null)
				{
					m_timeout.Stop();
					m_timeout = null;
				}

                int button = info.ButtonID;
				TimeSpan diff = DateTime.Now - m_RTTLaunched;

                if (button == m_CorrectResponse + m_CorrectResponseOffset)
                {
					// record answer
					Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true);
					lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("PASSED the RTT in {0} ms", diff.TotalMilliseconds));
					lh.Finish();

                    m_Mobile.SendMessage("Thanks for verifying that you're at your computer.");
                    ((PlayerMobile)m_Mobile).RTTResult(true);

                    if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled))
                    {
                        if (diff <= TimeSpan.FromSeconds(1.0))
                        {
                            Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                            0x22,
                            String.Format("{0}({1}) has quickly passed the RTT ({2} ms) ({3}).", m_Mobile.Name, m_Mobile.Serial, diff.TotalMilliseconds, m_strNotify));
                        }
                        else
                        {
                            Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                            0x482,
                            String.Format("{0}({1}) has passed the RTT ({2} ms).  ({3})", m_Mobile.Name, m_Mobile.Serial, diff.TotalMilliseconds, m_strNotify));
                        }

						// Look for and record suspiciously fast answers
                        if (diff <= TimeSpan.FromSeconds(3.0))
                        {
                            Scripts.Commands.LogHelper lh2 = new Server.Scripts.Commands.LogHelper("RTTAlert.log", false, true);
                            lh2.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("{0} ms", diff.TotalMilliseconds));
                            lh2.Finish();
                        }
                    }
                }
                else
                {
					// record answer
					Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true);
					lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("FAILED the RTT in {0} ms", diff.TotalMilliseconds));
					lh.Finish();

                    m_Mobile.SendMessage("You have failed the AFK test.");
                    ((PlayerMobile)m_Mobile).RTTResult(false);

                    if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled))
                    {
                        Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor,
                        0x482,
                        String.Format("{0}({1}) has failed the RTT. ({2})", m_Mobile.Name, m_Mobile.Serial, this.m_strNotify));
                    }
                }
            }
            catch (Exception e)
            {
                Scripts.Commands.LogHelper.LogException(e);
            }
        }
Example #4
0
        public BaseRTTGump(Mobile from, string strNotice, string strSkill, int x, int y)
            : base(x, y)
        {
            m_Mobile = from;
            m_strNotify = strNotice;
            m_strSkill = strSkill;

            //close any other RTT gumps
            from.CloseGump(typeof(BaseRTTGump));

            // notify staff
            if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled))
            {
                Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Administrator,
                0x482,
                String.Format("{0}({1}) is taking the RTT ({2}).", m_Mobile.Name, m_Mobile.Serial, strSkill));
            }

			// record the fact that the RTT test is being taken
			Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true);
			lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, String.Format("({0}) RTT Launched.", strSkill));
			lh.Finish();

            //This will call any child-gump's SetupGump and set it up like the child wants.
            SetupGump();

            //Save when we launched the gump for later recording
            m_RTTLaunched = DateTime.Now;

			// if the player fails to respond in 'timeout' time, then we will cound this as an RTT failure.
			//	this does two things: (1) makes the next test 5 minutes from now, (2) will move them closer to being counted as a macroer
			m_timeout = new RTTTimer(m_Mobile, TimeSpan.FromSeconds(Utility.RandomList(90,120,180)));
			m_timeout.Start();
        }