public AntiRailGump(Mobile from, string strNotice, string strSkill) : base(50, 50) { m_Mobile = from; m_strNotify = strNotice; m_strSkill = strSkill; //close any other RTT gumps from.CloseGump(typeof(AntiRailGump)); // notify staff CommandHandlers.BroadcastMessage(AccessLevel.Administrator, 0x482, String.Format("{0}({1}) is taking the RTT ({2}).", m_Mobile.Name, m_Mobile.Serial, strSkill)); SetupGump(); m_AntiRailTestLaunched = DateTime.UtcNow; m_timeout = new AntiRailTimer(m_Mobile, TimeSpan.FromSeconds(Utility.RandomList(90, 120, 180))); m_timeout.Start(); }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { // kill our timeout timer if (m_timeout != null) { m_timeout.Stop(); m_timeout = null; } int button = info.ButtonID; TimeSpan diff = DateTime.UtcNow - m_AntiRailTestLaunched; if (button == m_CorrectResponse + m_CorrectResponseOffset) { m_Mobile.SendMessage("Thanks for verifying that you're at your computer."); if (diff <= TimeSpan.FromSeconds(1.0)) { 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 { 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)); } } else { m_Mobile.SendMessage("You have failed the AFK test."); CommandHandlers.BroadcastMessage(AccessLevel.Counselor, 0x482, String.Format("{0}({1}) has failed the RTT. ({2})", m_Mobile.Name, m_Mobile.Serial, this.m_strNotify)); } }